00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef REGIONSHAPES_H_
00028 #define REGIONSHAPES_H_
00029
00030 #include <display/RegionShapes/RegionShape.h>
00031
00032 #include <cctype>
00033
00034 #include <casa/namespace.h>
00035
00036 namespace casa {
00037
00038
00039
00040
00041
00042
00043 class RSEllipse : public RegionShape {
00044 public:
00045
00046
00047
00048
00049 RSEllipse(double x, double y, double xRadius, double yRadius,
00050 MDirection::Types worldSystem, double angle = 0);
00051
00052
00053 RSEllipse(double x, double y, double xRadius, double yRadius,
00054 double angle = 0);
00055
00056
00057 RSEllipse(const RecordInterface& properties);
00058
00059
00060 virtual ~RSEllipse();
00061
00062
00063 virtual bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch,
00064 String* error = NULL);
00065
00066
00067 virtual String type() const {
00068 return "ellipse";
00069 }
00070
00071
00072
00073
00074
00075 void getEllipseCoordinates(double& x, double& y, double& xRadius,
00076 double& yRadius, double& angle,
00077 String toSystem = "") const;
00078
00079
00080 virtual vector<double> coordParameterValues() const;
00081
00082
00083 virtual vector<double> coordParameterValues(String toSystem) const;
00084
00085
00086 virtual vector<String> coordParameterNames() const;
00087
00088
00089 virtual vector<CoordinateParameterType> coordParameterTypes() const;
00090
00091
00092 virtual void setCoordParameters(const vector<double>& vals);
00093
00094
00095 virtual void setCoordParameters(const vector<double>& vals, String system);
00096
00097
00098 virtual void move(double dx, double dy, String system = "");
00099
00100
00101 virtual RSHandle getHandle() const;
00102
00103
00104
00105
00106 virtual vector<String> optionNames() const {
00107 return vector<String>();
00108 }
00109 virtual vector<OptionType> optionTypes() const {
00110 return vector<OptionType>();
00111 }
00112 virtual vector<RSOption> optionValues() const {
00113 return vector<RSOption>();
00114 }
00115 virtual void setOptionValues(const vector<RSOption>& ) { }
00116
00117
00118 protected:
00119 vector<double> m_spec;
00120
00121 vector<double> m_screenSpec;
00122
00123
00124
00125 virtual void getShapeSpecificProperties(Record& properties) const {
00126 properties.define(PROPTYPE, PROPTYPE_ELLIPSE);
00127 }
00128
00129
00130 virtual void setShapeSpecificProperties(const RecordInterface& ) { }
00131
00132
00133 virtual bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00134
00135
00136 virtual void updateMinMax();
00137 };
00138
00139
00140
00141
00142 class RSCircle : public RSEllipse {
00143 public:
00144
00145
00146 RSCircle(double x, double y, double xRadius, MDirection::Types worldSys);
00147
00148
00149 RSCircle(double x, double y, double xRadius);
00150
00151
00152 RSCircle(const RecordInterface& properties);
00153
00154
00155 ~RSCircle();
00156
00157
00158 String type() const {
00159 return "circle";
00160 }
00161
00162
00163
00164
00165
00166 void getCircleCoordinates(double& x, double& y, double& xRadius,
00167 String toSystem = "") const;
00168
00169
00170 vector<double> coordParameterValues() const;
00171
00172
00173 vector<double> coordParameterValues(String toSystem) const;
00174
00175
00176 vector<String> coordParameterNames() const;
00177
00178
00179 vector<CoordinateParameterType> coordParameterTypes() const;
00180
00181
00182 void setCoordParameters(const vector<double>& vals);
00183
00184
00185 void setCoordParameters(const vector<double>& vals, String valSystem);
00186
00187 protected:
00188
00189 void getShapeSpecificProperties(Record& properties) const {
00190 properties.define(PROPTYPE, PROPTYPE_CIRCLE);
00191 }
00192
00193
00194 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00195 };
00196
00197
00198
00199
00200
00201
00202 class RSRectangle : public RegionShape {
00203 public:
00204
00205
00206
00207
00208
00209
00210
00211 static bool getRectanglePoints(double centerX, double centerY,
00212 double radiusX, double radiusY,
00213 double angle, Vector<double>& xPoints,
00214 Vector<double>& yPoints);
00215
00216
00217
00218
00219
00220
00221
00222
00223 RSRectangle(double x, double y, double width, double height,
00224 MDirection::Types worldSystem, double angle = 0);
00225
00226
00227 RSRectangle(double x, double y, double width, double height,
00228 double angle = 0);
00229
00230
00231 RSRectangle(const RecordInterface& properties);
00232
00233
00234 ~RSRectangle();
00235
00236
00237 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00238
00239
00240 String type() const {
00241 return "rectangle";
00242 }
00243
00244
00245
00246
00247
00248 void getRectangleCoordinates(double& x, double& y, double& width,
00249 double& height, double& angle,
00250 String toSystem = "") const;
00251
00252
00253 vector<double> coordParameterValues() const;
00254
00255
00256 vector<double> coordParameterValues(String toSystem) const;
00257
00258
00259 vector<String> coordParameterNames() const;
00260
00261
00262 vector<CoordinateParameterType> coordParameterTypes() const;
00263
00264
00265 void setCoordParameters(const vector<double>& vals);
00266
00267
00268 void setCoordParameters(const vector<double>& vals, String valSystem);
00269
00270
00271 void move(double dx, double dy, String system = "");
00272
00273
00274 RSHandle getHandle() const;
00275
00276
00277
00278
00279 vector<String> optionNames() const {
00280 return vector<String>();
00281 }
00282 vector<OptionType> optionTypes() const {
00283 return vector<OptionType>();
00284 }
00285 vector<RSOption> optionValues() const {
00286 return vector<RSOption>();
00287 }
00288 void setOptionValues(const vector<RSOption>& ) { }
00289
00290
00291 protected:
00292 vector<double> m_spec;
00293
00294 Vector<double> m_x, m_y;
00295
00296 Vector<double> m_screenX, m_screenY;
00297
00298
00299
00300 void getShapeSpecificProperties(Record& properties) const {
00301 properties.define(PROPTYPE, PROPTYPE_RECTANGLE);
00302 }
00303
00304
00305 void setShapeSpecificProperties(const RecordInterface& ) { }
00306
00307
00308 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00309
00310
00311 void updatePoints();
00312
00313
00314 void updateMinMax();
00315 };
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 class RSPolygon : public RegionShape {
00330 public:
00331
00332
00333
00334
00335 static const String PROPXCOORDINATES;
00336 static const String PROPYCOORDINATES;
00337
00338
00339
00340
00341
00342
00343
00344
00345 RSPolygon(const Vector<double>& x, const Vector<double>& y,
00346 MDirection::Types worldSystem, String custName = "");
00347
00348
00349 RSPolygon(const Vector<double>& x, const Vector<double>& y,
00350 String custName = "");
00351
00352
00353 RSPolygon(const RecordInterface& properties);
00354
00355
00356 ~RSPolygon();
00357
00358
00359 void setPolygonCoordinates(const Vector<double>& x,
00360 const Vector<double>& y);
00361
00362
00363 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00364
00365
00366 String type() const {
00367 if(!m_custName.empty()) return m_custName;
00368 else return "polygon";
00369 }
00370
00371
00372 String oneWordType() const {
00373 return "polygon";
00374 }
00375
00376
00377
00378
00379
00380 void getPolygonCoordinates(double& centerX, double& centerY,
00381 String toSystem = "") const;
00382
00383
00384
00385
00386 void getPolygonCoordinates(vector<double>& x, vector<double>& y,
00387 String toSystem = "") const;
00388
00389
00390 vector<double> coordParameterValues() const;
00391
00392
00393 vector<double> coordParameterValues(String toSystem) const;
00394
00395
00396 vector<String> coordParameterNames() const;
00397
00398
00399 vector<CoordinateParameterType> coordParameterTypes() const;
00400
00401
00402 void setCoordParameters(const vector<double>& vals);
00403
00404
00405 void setCoordParameters(const vector<double>& vals, String valSystem);
00406
00407
00408 void move(double dx, double dy, String system = "");
00409
00410
00411 RSHandle getHandle() const;
00412
00413
00414 vector<String> optionNames() const;
00415
00416
00417 vector<OptionType> optionTypes() const;
00418
00419
00420 vector<RSOption> optionValues() const;
00421
00422
00423 void setOptionValues(const vector<RSOption>& options);
00424
00425 protected:
00426 Vector<Double> m_x, m_y;
00427 double m_centerX, m_centerY;
00428 Vector<Double> m_screenX, m_screenY;
00429 unsigned int m_n;
00430 String m_custName;
00431
00432
00433 void getShapeSpecificProperties(Record& properties) const;
00434
00435
00436 void setShapeSpecificProperties(const RecordInterface& properties);
00437
00438
00439 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00440
00441
00442 void updateMinMax();
00443 };
00444
00445
00446
00447
00448
00449
00450
00451 class RSLine : public RegionShape {
00452 public:
00453
00454
00455
00456 enum ArrowType {
00457 FilledTriangle, Triangle, V, FilledDoubleV
00458 };
00459
00460
00461
00462 static vector<ArrowType> allArrowTypes() {
00463 static vector<ArrowType> v(4);
00464 v[0] = FilledTriangle;
00465 v[1] = Triangle;
00466 v[2] = V;
00467 v[3] = FilledDoubleV;
00468 return v;
00469 }
00470
00471 static vector<String> allArrowTypesStrings() {
00472 vector<ArrowType> types = allArrowTypes();
00473 vector<String> v(types.size());
00474 for(unsigned int i = 0; i < v.size(); i++) v[i] = arrowType(types[i]);
00475 return v;
00476 }
00477
00478
00479
00480
00481 static String arrowType(ArrowType type) {
00482 switch(type) {
00483 case FilledTriangle:
00484 return "filled triangle";
00485 case Triangle:
00486 return "triangle";
00487 case V:
00488 return "v";
00489 case FilledDoubleV:
00490 return "filled double v";
00491
00492 default:
00493 return "";
00494 }
00495 }
00496
00497 static ArrowType arrowType(const String& type) {
00498 String t = type;
00499 for(unsigned int i = 0; i < t.size(); i++) t[i] = tolower(t[i]);
00500 if(t == "filled triangle") return FilledTriangle;
00501 else if(t == "triangle") return Triangle;
00502 else if(t == "v") return V;
00503 else if(t == "filled double v") return FilledDoubleV;
00504
00505 else return FilledTriangle;
00506 }
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516 RSLine(double x1, double y1, double x2, double y2,
00517 MDirection::Types worldSystem, int arrowLength, bool arrow1 = false,
00518 bool arrow2 = false, ArrowType type1 = FilledDoubleV,
00519 ArrowType type2 = FilledDoubleV);
00520
00521
00522
00523 RSLine(double x1, double y1, double x2, double y2, int arrowLength,
00524 bool arrow1 = false, bool arrow2 = false,
00525 ArrowType type1 = FilledDoubleV, ArrowType type2 = FilledDoubleV);
00526
00527
00528 RSLine(const RecordInterface& properties);
00529
00530
00531 virtual ~RSLine();
00532
00533
00534
00535 bool p1Arrow() const {
00536 return m_arrow1;
00537 }
00538 bool p2Arrow() const {
00539 return m_arrow2;
00540 }
00541
00542
00543
00544 virtual bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch,
00545 String* error = NULL);
00546
00547
00548 virtual String type() const {
00549 return "line";
00550 }
00551
00552
00553
00554
00555
00556 void getLineCoordinates(double& x1, double& y1, double& x2, double& y2,
00557 int& arrowLength, String toSystem = "") const;
00558
00559
00560 virtual vector<double> coordParameterValues() const;
00561
00562
00563 vector<double> coordParameterValues(String toSystem) const;
00564
00565
00566 virtual vector<String> coordParameterNames() const;
00567
00568
00569 virtual vector<CoordinateParameterType> coordParameterTypes() const;
00570
00571
00572 virtual void setCoordParameters(const vector<double>& vals);
00573
00574
00575 virtual void setCoordParameters(const vector<double>& vals, String System);
00576
00577
00578 virtual void move(double dx, double dy, String system = "");
00579
00580
00581 virtual RSHandle getHandle() const;
00582
00583
00584 virtual vector<String> optionNames() const;
00585
00586
00587 virtual vector<OptionType> optionTypes() const;
00588
00589
00590 virtual vector<vector<String> > optionChoices() const;
00591
00592
00593 virtual vector<RSOption> optionValues() const;
00594
00595
00596 virtual void setOptionValues(const vector<RSOption>& options);
00597
00598 protected:
00599 vector<double> m_spec;
00600 vector<double> m_screenSpec;
00601 int m_arrowLength;
00602 bool m_arrow1, m_arrow2;
00603 ArrowType m_aType1, m_aType2;
00604
00605
00606 virtual void getShapeSpecificProperties(Record& properties) const {
00607 properties.define(PROPTYPE, PROPTYPE_LINE);
00608 }
00609
00610
00611 virtual void setShapeSpecificProperties(const RecordInterface& ) { }
00612
00613
00614 virtual bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00615
00616
00617 void updateMinMax();
00618
00619
00620
00621 static bool arrowPoints(double x1, double y1, double x2, double y2,
00622 double length, double& resX1, double& resY1,
00623 double& resX2, double& resY2);
00624
00625
00626 static bool arrowPointsHelper(double x1, double y1, double x2, double y2,
00627 double length, double& resX1, double& resY1,
00628 double& resX2, double& resY2);
00629 };
00630
00631
00632
00633 class RSVector : public RSLine {
00634 public:
00635
00636
00637
00638
00639
00640 RSVector(double x, double y, double length, double angle,
00641 MDirection::Types worldSystem, int arrowLength,
00642 bool arrow = true, ArrowType arrowType = FilledDoubleV);
00643
00644
00645
00646 RSVector(double x, double y, double length, double angle, int arrowLength,
00647 bool arrow = true, ArrowType arrowType = FilledDoubleV);
00648
00649
00650 RSVector(const RecordInterface& properties);
00651
00652
00653 ~RSVector();
00654
00655
00656 bool arrow() const {
00657 return p2Arrow();
00658 }
00659
00660
00661 String type() const {
00662 return "vector";
00663 }
00664
00665
00666
00667
00668
00669 void getVectorCoordinates(double& x, double& y, double& angle,
00670 double& length, int& arrowLength,
00671 String toSystem = "") const;
00672
00673
00674 vector<double> coordParameterValues() const;
00675
00676
00677 vector<double> coordParameterValues(String toSystem) const;
00678
00679
00680 vector<String> coordParameterNames() const;
00681
00682
00683 vector<CoordinateParameterType> coordParameterTypes() const;
00684
00685
00686 void setCoordParameters(const vector<double>& vals);
00687
00688
00689 void setCoordParameters(const vector<double>& vals, String valSystem);
00690
00691
00692 vector<String> optionNames() const;
00693
00694
00695 vector<OptionType> optionTypes() const;
00696
00697
00698 vector<vector<String> > optionChoices() const;
00699
00700
00701 vector<RSOption> optionValues() const;
00702
00703
00704 void setOptionValues(const vector<RSOption>& options);
00705
00706 protected:
00707 double m_length;
00708 double m_angle;
00709
00710
00711 void getShapeSpecificProperties(Record& properties) const {
00712 properties.define(PROPTYPE, PROPTYPE_VECTOR);
00713 }
00714 };
00715
00716
00717
00718
00719
00720
00721
00722 class RSMarker : public RegionShape {
00723 public:
00724
00725
00726
00727 RSMarker(double x, double y, Display::Marker marker, int pixelHeight,
00728 MDirection::Types worldSystem);
00729
00730
00731
00732
00733 RSMarker(double x, double y, const vector<Display::Marker>& markers,
00734 int pixelHeight, MDirection::Types worldSystem);
00735
00736
00737
00738 RSMarker(double x, double y, Display::Marker marker, int pixelHeight);
00739
00740
00741
00742 RSMarker(double x, double y, const vector<Display::Marker>& markers,
00743 int pixelHeight);
00744
00745
00746 RSMarker(const RecordInterface& properties);
00747
00748
00749 ~RSMarker();
00750
00751
00752
00753 vector<Display::Marker> markers() const;
00754 void setMarker(Display::Marker marker);
00755 void setMarkers(const vector<Display::Marker>& markers);
00756
00757
00758
00759
00760 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00761
00762
00763 String type() const;
00764
00765
00766 String oneWordType() const {
00767 return "marker";
00768 }
00769
00770
00771
00772
00773
00774 void getMarkerCoordinates(double& x, double& y, int& pixelHeight,
00775 String toSystem = "") const;
00776
00777
00778 vector<double> coordParameterValues() const;
00779
00780
00781 vector<double> coordParameterValues(String toSystem) const;
00782
00783
00784 vector<String> coordParameterNames() const;
00785
00786
00787 vector<CoordinateParameterType> coordParameterTypes() const;
00788
00789
00790 void setCoordParameters(const vector<double>& vals);
00791
00792
00793 void setCoordParameters(const vector<double>& vals, String valSystem);
00794
00795
00796 void move(double dx, double dy, String system = "");
00797
00798
00799 RSHandle getHandle() const;
00800
00801
00802 vector<String> optionNames() const;
00803
00804
00805 vector<OptionType> optionTypes() const;
00806
00807
00808 vector<vector<String> > optionChoices() const;
00809
00810
00811 vector<RSOption> optionValues() const;
00812
00813
00814 void setOptionValues(const vector<RSOption>& options);
00815
00816 protected:
00817 double m_x, m_y;
00818 double m_screenX, m_screenY;
00819 vector<Display::Marker> m_markers;
00820 int m_pixelHeight;
00821
00822
00823 void getShapeSpecificProperties(Record& properties) const {
00824 properties.define(PROPTYPE, PROPTYPE_MARKER);
00825 }
00826
00827
00828 void setShapeSpecificProperties(const RecordInterface& ) { }
00829
00830
00831 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00832
00833
00834 void updateMinMax();
00835
00836
00837 static String markerToString(Display::Marker marker) {
00838 switch(marker) {
00839 case Display::Cross:
00840 return "cross";
00841 case Display::X:
00842 return "x";
00843 case Display::Diamond:
00844 return "diamond";
00845 case Display::Circle:
00846 return "circle";
00847 case Display::Square:
00848 return "square";
00849 case Display::Triangle:
00850 return "triangle";
00851 case Display::InvertedTriangle:
00852 return "inverted triangle";
00853 case Display::FilledCircle:
00854 return "filled circle";
00855 case Display::FilledSquare:
00856 return "filled square";
00857 case Display::FilledDiamond:
00858 return "filled diamond";
00859 case Display::FilledTriangle:
00860 return "filled triangle";
00861 case Display::FilledInvertedTriangle:
00862 return "filled inverted triangle";
00863 case Display::CircleAndCross:
00864 return "circle and cross";
00865 case Display::CircleAndX:
00866 return "circle and x";
00867 case Display::CircleAndDot:
00868 return "circle and dot";
00869
00870 default:
00871 return "";
00872 }
00873 }
00874
00875 static bool stringToMarker(const String& str, Display::Marker& marker) {
00876 String m = str;
00877 for(unsigned int i = 0; i < m.size(); i++) m[i] = tolower(str[i]);
00878
00879 if(m == "cross") marker = Display::Cross;
00880 else if(m == "x") marker = Display::X;
00881 else if(m == "diamond") marker = Display::Diamond;
00882 else if(m == "circle") marker = Display::Circle;
00883 else if(m == "square") marker = Display::Square;
00884 else if(m == "triangle") marker = Display::Triangle;
00885 else if(m == "inverted triangle") marker = Display::InvertedTriangle;
00886 else if(m == "filled circle") marker = Display::FilledCircle;
00887 else if(m == "filled square") marker = Display::FilledSquare ;
00888 else if(m == "filled diamond") marker = Display::FilledDiamond;
00889 else if(m == "filled triangle") marker = Display::FilledTriangle;
00890 else if(m == "filled inverted triangle")
00891 marker = Display::FilledInvertedTriangle;
00892 else if(m == "circle and cross") marker = Display::CircleAndCross;
00893 else if(m == "circle and x") marker = Display::CircleAndX;
00894 else if(m == "circle and dot") marker = Display::CircleAndDot;
00895 else return false;
00896 return true;
00897 }
00898
00899 static vector<Display::Marker> allMarkers() {
00900 static vector<Display::Marker> v(15);
00901 v[0] = Display::Cross;
00902 v[1] = Display::X;
00903 v[2] = Display::Diamond;
00904 v[3] = Display::Circle;
00905 v[4] = Display::Square;
00906 v[5] = Display::Triangle;
00907 v[6] = Display::InvertedTriangle;
00908 v[7] = Display::FilledCircle;
00909 v[8] = Display::FilledSquare;
00910 v[9] = Display::FilledDiamond;
00911 v[10] = Display::FilledTriangle;
00912 v[11]=Display::FilledInvertedTriangle;
00913 v[12] = Display::CircleAndCross;
00914 v[13] = Display::CircleAndX;
00915 v[14] = Display::CircleAndDot;
00916 return v;
00917 }
00918 };
00919
00920
00921
00922
00923 class RSText : public RegionShape {
00924 public:
00925
00926
00927
00928 RSText(double x, double y, const String& text, MDirection::Types worldSys,
00929 double angle = 0);
00930
00931
00932 RSText(double x, double y, const String& text, double angle = 0);
00933
00934
00935 RSText(const RecordInterface& properties);
00936
00937
00938 ~RSText();
00939
00940
00941 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00942
00943
00944 String type() const {
00945 return "text";
00946 }
00947
00948
00949
00950
00951
00952 void getTextCoordinates(double& x, double& y, double& angle,
00953 String toSystem = "") const;
00954
00955
00956 vector<double> coordParameterValues() const;
00957
00958
00959 vector<double> coordParameterValues(String toSystem) const;
00960
00961
00962 vector<String> coordParameterNames() const;
00963
00964
00965 vector<CoordinateParameterType> coordParameterTypes() const;
00966
00967
00968 void setCoordParameters(const vector<double>& vals);
00969
00970
00971 void setCoordParameters(const vector<double>& vals, String valSystem);
00972
00973
00974 void move(double dx, double dy, String system = "");
00975
00976
00977 RSHandle getHandle() const;
00978
00979
00980
00981
00982 vector<String> optionNames() const {
00983 return vector<String>();
00984 }
00985 vector<OptionType> optionTypes() const {
00986 return vector<OptionType>();
00987 }
00988 vector<RSOption> optionValues() const {
00989 return vector<RSOption>();
00990 }
00991 void setOptionValues(const vector<RSOption>& ) { }
00992
00993
00994 protected:
00995 double m_x, m_y;
00996 double m_angle;
00997 double m_wWidth;
00998
00999 double m_screenX, m_screenY;
01000
01001
01002 void getShapeSpecificProperties(Record& properties) const {
01003 properties.define(PROPTYPE, PROPTYPE_TEXT);
01004 }
01005
01006
01007 void setShapeSpecificProperties(const RecordInterface& ) { }
01008
01009
01010 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
01011
01012
01013
01014 void updateMinMax();
01015 };
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035 class RSComposite : public RegionShape {
01036 public:
01037
01038
01039
01040
01041 static const String PROPDEPENDENTCHILDREN;
01042 static const String PROPCHILDREN;
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053 RSComposite(MDirection::Types worldSys, bool dependent = true,
01054 String customName = "");
01055
01056
01057
01058
01059 RSComposite(bool dependent = true, String customName = "");
01060
01061
01062 RSComposite(const RecordInterface& properties);
01063
01064
01065 ~RSComposite();
01066
01067
01068
01069
01070
01071
01072 void addShape(RegionShape* shape);
01073 void addShapes(const vector<RegionShape*> shapes);
01074
01075
01076
01077 bool childrenAreDependent() const;
01078
01079
01080
01081
01082
01083 void setChildrenAreDependent(bool dependent = true);
01084
01085
01086
01087 vector<RegionShape*> children();
01088 vector<const RegionShape*> children() const;
01089
01090
01091
01092
01093
01094 void setLineColor(const String& newColor, bool alsoSetLabel = true);
01095 void setLineWidth(double width);
01096 void setLineStyle(LineStyle style);
01097 void setLabel(const RegionShapeLabel& label);
01098
01099
01100
01101 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
01102
01103
01104 String type() const;
01105
01106
01107 String oneWordType() const {
01108 return "composite";
01109 }
01110
01111
01112
01113
01114 double getAngle(String toSystem = "") const;
01115
01116
01117
01118
01119
01120 void getCompositeCoordinates(double& centerX, double& centerY,
01121 String toSystem = "") const;
01122
01123
01124 vector<double> coordParameterValues() const;
01125
01126
01127 vector<double> coordParameterValues(String toSystem) const;
01128
01129
01130 vector<String> coordParameterNames() const;
01131
01132
01133 vector<CoordinateParameterType> coordParameterTypes() const;
01134
01135
01136 void setCoordParameters(const vector<double>& vals);
01137
01138
01139 void setCoordParameters(const vector<double>& vals, String valSystem);
01140
01141
01142 void move(double dx, double dy, String system = "");
01143
01144
01145 RSHandle getHandle() const;
01146
01147
01148 vector<String> optionNames() const;
01149
01150
01151 vector<OptionType> optionTypes() const;
01152
01153
01154 vector<RSOption> optionValues() const;
01155
01156
01157 void setOptionValues(const vector<RSOption>& options);
01158
01159 protected:
01160 String m_custName;
01161 bool m_dependentChildren;
01162 vector<RegionShape*> m_shapes;
01163 double m_centerX, m_centerY;
01164 bool m_syncAngleDepChildren;
01165
01166
01167
01168
01169 double m_syncAngle;
01170 bool m_applyChangesToChildren;
01171
01172
01173
01174 void getShapeSpecificProperties(Record& properties) const;
01175
01176
01177 void setShapeSpecificProperties(const RecordInterface& properties);
01178
01179
01180 void updateMinMax();
01181
01182 private:
01183
01184
01185 bool addShapeHelper(RegionShape* shape);
01186
01187
01188 void addShapeUpkeep();
01189
01190
01191
01192 void convertMinMax(double& xmin, double& xmax, double& ymin, double& ymax,
01193 unsigned int index) const;
01194 };
01195
01196 }
01197
01198 #endif