RegionShapes.h

Go to the documentation of this file.
00001 //# RegionShapes.h: Classes for displaying region shapes on the viewer.
00002 //# Copyright (C) 2008
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
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 // Subclass of RegionShape used for drawing ellipses.  An ellipse has the
00039 // following properties in addition to those listed for RegionShape:
00040 // <ul><li>x and y coordinate</li>
00041 //     <li>x-radius and y-radius</li>
00042 //     <li>angle of rotation</li></ul>
00043         class RSEllipse : public RegionShape {
00044         public:
00045                 // World Constructor.  x, y, xRadius, yRadius, and angle must all be
00046                 // 1) using the same world system as defined by worldSystem, and 2) in
00047                 // unit RegionShape::UNIT.  Angle is counterclockwise, and angle 0 is the
00048                 // east vector.
00049                 RSEllipse(double x, double y, double xRadius, double yRadius,
00050                           MDirection::Types worldSystem, double angle = 0);
00051 
00052                 // Pixel Constructor.  Angle in counterclockwise degrees.
00053                 RSEllipse(double x, double y, double xRadius, double yRadius,
00054                           double angle = 0);
00055 
00056                 // Record Constructor.
00057                 RSEllipse(const RecordInterface& properties);
00058 
00059                 // Destructor.
00060                 virtual ~RSEllipse();
00061 
00062                 // Implements RegionShape::drawAndUpdateBoundingBox.
00063                 virtual bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch,
00064                                                       String* error = NULL);
00065 
00066                 // Implements RegionShape::type.
00067                 virtual String type() const {
00068                         return "ellipse";
00069                 }
00070 
00071                 // Gets ellipse-specific coordinates, to avoid dependence on
00072                 // coordParameterValues() when the shape type is known.
00073                 // If toSystem is empty, no conversion is done; otherwise see the
00074                 // constraints listed in RegionShape::coordParameterValues(String).
00075                 void getEllipseCoordinates(double& x, double& y, double& xRadius,
00076                                            double& yRadius, double& angle,
00077                                            String toSystem = "") const;
00078 
00079                 // Implements RegionShape::coordParameterValues.
00080                 virtual vector<double> coordParameterValues() const;
00081 
00082                 // Implements RegionShape::coordParameterValues.
00083                 virtual vector<double> coordParameterValues(String toSystem) const;
00084 
00085                 // Implements RegionShape::coordParameterNames.
00086                 virtual vector<String> coordParameterNames() const;
00087 
00088                 // Implements RegionShape::coordParameterPositions.
00089                 virtual vector<CoordinateParameterType> coordParameterTypes() const;
00090 
00091                 // Implements RegionShape::setCoordParameters.
00092                 virtual void setCoordParameters(const vector<double>& vals);
00093 
00094                 // Implements RegionShape::setCoordParameters.
00095                 virtual void setCoordParameters(const vector<double>& vals, String system);
00096 
00097                 // Implements RegionShape::move.
00098                 virtual void move(double dx, double dy, String system = "");
00099 
00100                 // Implements RegionShape::getHandle.
00101                 virtual RSHandle getHandle() const;
00102 
00103                 // Implements RegionShape option methods.  Note: ellipses do not have
00104                 // additonal options.
00105                 // <group>
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>& /*options*/) { }
00116                 // </group>
00117 
00118         protected:
00119                 vector<double> m_spec;        // order: [x, y, x-radius, y-radius, angle]
00120                 // either world or pixel coords
00121                 vector<double> m_screenSpec;  // same order, screen coords
00122 
00123 
00124                 // Implements RegionShape::getShapeSpecificProperties.
00125                 virtual void getShapeSpecificProperties(Record& properties) const {
00126                         properties.define(PROPTYPE, PROPTYPE_ELLIPSE);
00127                 }
00128 
00129                 // Implements RegionShape::setShapeSpecificProperties.
00130                 virtual void setShapeSpecificProperties(const RecordInterface& /*props*/) { }
00131 
00132                 // Updates screen coords using world/pixel coords and the given WorldCanvas
00133                 virtual bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00134 
00135                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.
00136                 virtual void updateMinMax();
00137         };
00138 
00139 
00140 // Subclass of RSEllipse used for drawing circles.  Only one radius (x) is
00141 // taken and no angle.
00142         class RSCircle : public RSEllipse {
00143         public:
00144                 // World constructor.  x, y, and xRadius must be of the type defined by
00145                 // worldSys and in units of RegionShape::UNIT.
00146                 RSCircle(double x, double y, double xRadius, MDirection::Types worldSys);
00147 
00148                 // Pixel constructor.
00149                 RSCircle(double x, double y, double xRadius);
00150 
00151                 // Record Constructor.
00152                 RSCircle(const RecordInterface& properties);
00153 
00154                 // Destructor.
00155                 ~RSCircle();
00156 
00157                 // Overrides RSEllipse::type.
00158                 String type() const {
00159                         return "circle";
00160                 }
00161 
00162                 // Gets circle-specific coordinates, to avoid dependence on
00163                 // coordParameterValues() when the shape type is known.
00164                 // If toSystem is empty, no conversion is done; otherwise see the
00165                 // constraints listed in RegionShape::coordParameterValues(String).
00166                 void getCircleCoordinates(double& x, double& y, double& xRadius,
00167                                           String toSystem = "") const;
00168 
00169                 // Overrides RSEllipse::coordParameterValues.
00170                 vector<double> coordParameterValues() const;
00171 
00172                 // Overrides RSEllipse::coordParameterValues.
00173                 vector<double> coordParameterValues(String toSystem) const;
00174 
00175                 // Overrides RSEllipse::coordParameterNames.
00176                 vector<String> coordParameterNames() const;
00177 
00178                 // Overrides RSEllipse::coordParameterPositions.
00179                 vector<CoordinateParameterType> coordParameterTypes() const;
00180 
00181                 // Overrides RSEllipse::setCoordParameters.
00182                 void setCoordParameters(const vector<double>& vals);
00183 
00184                 // Overrides RSEllipse::setCoordParameters.
00185                 void setCoordParameters(const vector<double>& vals, String valSystem);
00186 
00187         protected:
00188                 // Overrides RSEllipse::getShapeSpecificProperties.
00189                 void getShapeSpecificProperties(Record& properties) const {
00190                         properties.define(PROPTYPE, PROPTYPE_CIRCLE);
00191                 }
00192 
00193                 // Overrides RSEllipse::updateScreenCoordinates.
00194                 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00195         };
00196 
00197 
00198 // Subclass of RegionShape used for drawing rectangles.  A rectangle has the
00199 // following properties in addition to those listed for RegionShape:
00200 // <ul><li>x and y coordinate of center</li>
00201 //     <li>width and height</li></ul>
00202         class RSRectangle : public RegionShape {
00203         public:
00204                 // Static Members //
00205 
00206                 // Gets the four rectangle points for the given center, radii, and angle
00207                 // and puts them in the given vectors.  Returns whether or not the
00208                 // operation succeeded.  Angle is in counterclockwise degrees.  The point
00209                 // order is [top right, top left, bottom left, bottom right] in the
00210                 // coordinate system of the given points.
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                 // Non-Static Members //
00218 
00219                 // World Constructor.  x, y, width, and height must all be 1) using the
00220                 // same world system as defined by worldSystem, and 2) in unit
00221                 // RegionShape::UNIT.  (x, y) specifies the center of the rectangle.
00222                 // Angle is in counterclockwise degrees starting at the east vector.
00223                 RSRectangle(double x, double y, double width, double height,
00224                             MDirection::Types worldSystem, double angle = 0);
00225 
00226                 // Pixel Constructor.  (x, y) specifies the center of the rectangle.
00227                 RSRectangle(double x, double y, double width, double height,
00228                             double angle = 0);
00229 
00230                 // Record Constructor.
00231                 RSRectangle(const RecordInterface& properties);
00232 
00233                 // Destructor.
00234                 ~RSRectangle();
00235 
00236                 // Implements RegionShape::drawAndUpdateBoundingBox.
00237                 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00238 
00239                 // Implements RegionShape::type.
00240                 String type() const {
00241                         return "rectangle";
00242                 }
00243 
00244                 // Gets rectangle-specific coordinates, to avoid dependence on
00245                 // coordParameterValues() when the shape type is known.
00246                 // If toSystem is empty, no conversion is done; otherwise see the
00247                 // constraints listed in RegionShape::coordParameterValues(String).
00248                 void getRectangleCoordinates(double& x, double& y, double& width,
00249                                              double& height, double& angle,
00250                                              String toSystem = "") const;
00251 
00252                 // Implements RegionShape::coordParameterValues.
00253                 vector<double> coordParameterValues() const;
00254 
00255                 // Implements RegionShape::coordParameterValues.
00256                 vector<double> coordParameterValues(String toSystem) const;
00257 
00258                 // Implements RegionShape::coordParameterNames.
00259                 vector<String> coordParameterNames() const;
00260 
00261                 // Implements RegionShape::coordParameterPositions.
00262                 vector<CoordinateParameterType> coordParameterTypes() const;
00263 
00264                 // Implements RegionShape::setCoordParameters.
00265                 void setCoordParameters(const vector<double>& vals);
00266 
00267                 // Implements RegionShape::setCoordParameters.
00268                 void setCoordParameters(const vector<double>& vals, String valSystem);
00269 
00270                 // Implements RegionShape::move.
00271                 void move(double dx, double dy, String system = "");
00272 
00273                 // Implements RegionShape::getHandle.
00274                 RSHandle getHandle() const;
00275 
00276                 // Implements RegionShape option methods.  Note: rectangles do not have
00277                 // additonal options.
00278                 // <group>
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>& /*options*/) { }
00289                 // </group>
00290 
00291         protected:
00292                 vector<double> m_spec;               // order: [x, y, width, height, angle]
00293                 // either world or pixel coords
00294                 Vector<double> m_x, m_y;             // pixel/world coords for four points
00295                 // in order: [upL, boL, boR, upR]
00296                 Vector<double> m_screenX, m_screenY; // screen coords for four points
00297                 // same order
00298 
00299                 // Implements RegionShape::getShapeSpecificProperties.
00300                 void getShapeSpecificProperties(Record& properties) const {
00301                         properties.define(PROPTYPE, PROPTYPE_RECTANGLE);
00302                 }
00303 
00304                 // Implements RegionShape::setShapeSpecificProperties.
00305                 void setShapeSpecificProperties(const RecordInterface& /*properties*/) { }
00306 
00307                 // Updates screen coords using world/pixel coords and the given WorldCanvas
00308                 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00309 
00310                 // Translates m_spec into m_x and m_y.
00311                 void updatePoints();
00312 
00313                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.
00314                 void updateMinMax();
00315         };
00316 
00317 
00318 // Subclass of RegionShape used for drawing polygons.  A polygon has the
00319 // following properties in addition to those listed for RegionShape:
00320 // <ul><li>list of x and y coordinates</li>
00321 //     <li>optional custom name</li></ul>
00322 // The following properties are also available:
00323 // <ul><li><b>RSPolygon::PROPXCOORDINATES</b> (<i>Array&lt;double&gt;</i>):
00324 //         vertices x values.  <b>NOT STRICTLY REQUIRED, BUT A VALID POLYGON
00325 //         HAS AT LEAST TWO VERTICES.</b></li>
00326 //     <li><b>RSPolygon::PROPYCOORDINATES</b> (<i>Array&lt;double&gt;</li>):
00327 //         vertices y values.  <b>NOT STRICTLY REQUIRED, BUT A VALID POLYGON
00328 //         HAS AT LEAST TWO VERTICES.</b></li></ul>
00329         class RSPolygon : public RegionShape {
00330         public:
00331                 // Static Members //
00332 
00333                 // Properties.  (See class descriptions of RegionShape and RSPolygon.)
00334                 // <group>
00335                 static const String PROPXCOORDINATES;
00336                 static const String PROPYCOORDINATES;
00337                 // </group>
00338 
00339 
00340                 // Non-Static Members //
00341 
00342                 // World Constructor.  x and y must both be 1) using the same world system
00343                 // as defined by worldSystem, and 2) in unit RegionShape::UNIT.  A custom
00344                 // name can be provided to be returned with RSPolygon::type().
00345                 RSPolygon(const Vector<double>& x, const Vector<double>& y,
00346                           MDirection::Types worldSystem, String custName = "");
00347 
00348                 // Pixel Constructor.
00349                 RSPolygon(const Vector<double>& x, const Vector<double>& y,
00350                           String custName = "");
00351 
00352                 // Record Constructor.
00353                 RSPolygon(const RecordInterface& properties);
00354 
00355                 // Destructor.
00356                 ~RSPolygon();
00357 
00358                 // Sets the polygon coordinates to the given.
00359                 void setPolygonCoordinates(const Vector<double>& x,
00360                                            const Vector<double>& y);
00361 
00362                 // Implements RegionShape::drawAndUpdateBoundingBox.
00363                 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00364 
00365                 // Implements RegionShape::type.
00366                 String type() const {
00367                         if(!m_custName.empty()) return m_custName;
00368                         else                    return "polygon";
00369                 }
00370 
00371                 // Overrides RegionShape::oneWordType.
00372                 String oneWordType() const {
00373                         return "polygon";
00374                 }
00375 
00376                 // Gets polygon-specific coordinates, to avoid dependence on
00377                 // coordParameterValues() when the shape type is known.
00378                 // If toSystem is empty, no conversion is done; otherwise see the
00379                 // constraints listed in RegionShape::coordParameterValues(String).
00380                 void getPolygonCoordinates(double& centerX, double& centerY,
00381                                            String toSystem = "") const;
00382 
00383                 // Gets actual polygon coordinates.
00384                 // If toSystem is empty, no conversion is done; otherwise see the
00385                 // constraints listed in RegionShape::coordParameterValues(String).
00386                 void getPolygonCoordinates(vector<double>& x, vector<double>& y,
00387                                            String toSystem = "") const;
00388 
00389                 // Implements RegionShape::coordParameterValues.
00390                 vector<double> coordParameterValues() const;
00391 
00392                 // Implements RegionShape::coordParameterValues.
00393                 vector<double> coordParameterValues(String toSystem) const;
00394 
00395                 // Implements RegionShape::coordParameterNames.
00396                 vector<String> coordParameterNames() const;
00397 
00398                 // Implements RegionShape::coordParameterPositions.
00399                 vector<CoordinateParameterType> coordParameterTypes() const;
00400 
00401                 // Implements RegionShape::setCoordParameters.
00402                 void setCoordParameters(const vector<double>& vals);
00403 
00404                 // Implements RegionShape::setCoordParameters.
00405                 void setCoordParameters(const vector<double>& vals, String valSystem);
00406 
00407                 // Implements RegionShape::move.
00408                 void move(double dx, double dy, String system = "");
00409 
00410                 // Implements RegionShape::getHandle.
00411                 RSHandle getHandle() const;
00412 
00413                 // Implements RegionShape::optionNames.
00414                 vector<String> optionNames() const;
00415 
00416                 // Implements RegionShape::optionTypes.
00417                 vector<OptionType> optionTypes() const;
00418 
00419                 // Implements RegionShape::optionValues.
00420                 vector<RSOption> optionValues() const;
00421 
00422                 // Implements RegionShape::setOptions.
00423                 void setOptionValues(const vector<RSOption>& options);
00424 
00425         protected:
00426                 Vector<Double> m_x, m_y;             // coordinates, world or pixel
00427                 double m_centerX, m_centerY;         // center of polygon, world or pixel
00428                 Vector<Double> m_screenX, m_screenY; // coordinates, screen
00429                 unsigned int m_n;                    // number of points
00430                 String m_custName;                   // optional custom name
00431 
00432                 // Implements RegionShape::getShapeSpecificProperties.
00433                 void getShapeSpecificProperties(Record& properties) const;
00434 
00435                 // Implements RegionShape::setShapeSpecificProperties.
00436                 void setShapeSpecificProperties(const RecordInterface& properties);
00437 
00438                 // Updates screen coords using world/pixel coords and the given WorldCanvas
00439                 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00440 
00441                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.
00442                 void updateMinMax();
00443         };
00444 
00445 
00446 // Subclass of RegionShape used for drawing lines.  A line has the
00447 // following properties in addition to those listed for RegionShape:
00448 // <ul><li>x1, y1 and x2, y2 coordinates</li>
00449 //     <li>whether to draw an arrow on either of the endpoints</li>
00450 //     <li>arrow length</li></ul>
00451         class RSLine : public RegionShape {
00452         public:
00453                 // Static Members //
00454 
00455                 // Different ways to draw the arrow(s) at the end of the line.
00456                 enum ArrowType {
00457                     FilledTriangle, Triangle, V, FilledDoubleV
00458                 };
00459 
00460                 // Returns all possible arrow types.
00461                 // <group>
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                 // </group>
00478 
00479                 // Converts to/from the String representation of arrow types.
00480                 // <group>
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                 // </group>
00508 
00509 
00510                 // Non-Static Members //
00511 
00512                 // World Constructor.  x1, y1, x2, and y2 must all be 1) using the
00513                 // same world system as defined by worldSystem, and 2) in unit
00514                 // RegionShape::UNIT.  arrowLength is in screen pixels.  arrow1 defines
00515                 // whether (x1, y1) has an arrow; arrow2 for (x2, y2).
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                 // Pixel Constructor.  arrowLength is in screen pixels.  arrow1 defines
00522                 // whether (x1, y1) has an arrow; arrow2 for (x2, y2).
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                 // Record Constructor.
00528                 RSLine(const RecordInterface& properties);
00529 
00530                 // Destructor.
00531                 virtual ~RSLine();
00532 
00533                 // Returns whether the two endpoints have arrows or not.
00534                 // </group>
00535                 bool p1Arrow() const {
00536                         return m_arrow1;
00537                 }
00538                 bool p2Arrow() const {
00539                         return m_arrow2;
00540                 }
00541                 // </group>
00542 
00543                 // Implements RegionShape::drawAndUpdateBoundingBox.
00544                 virtual bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch,
00545                                                       String* error = NULL);
00546 
00547                 // Implements RegionShape::type.
00548                 virtual String type() const {
00549                         return "line";
00550                 }
00551 
00552                 // Gets line-specific coordinates, to avoid dependence on
00553                 // coordParameterValues() when the shape type is known.
00554                 // If toSystem is empty, no conversion is done; otherwise see the
00555                 // constraints listed in RegionShape::coordParameterValues(String).
00556                 void getLineCoordinates(double& x1, double& y1, double& x2, double& y2,
00557                                         int& arrowLength, String toSystem = "") const;
00558 
00559                 // Implements RegionShape::coordParameterVales.
00560                 virtual vector<double> coordParameterValues() const;
00561 
00562                 // Implements RegionShape::coordParameterValues.
00563                 vector<double> coordParameterValues(String toSystem) const;
00564 
00565                 // Implements RegionShape::coordParameterNames.
00566                 virtual vector<String> coordParameterNames() const;
00567 
00568                 // Implements RegionShape::coordParameterPositions.
00569                 virtual vector<CoordinateParameterType> coordParameterTypes() const;
00570 
00571                 // Implements RegionShape::setCoordParameters.
00572                 virtual void setCoordParameters(const vector<double>& vals);
00573 
00574                 // Implements RegionShape::setCoordParameters.
00575                 virtual void setCoordParameters(const vector<double>& vals, String System);
00576 
00577                 // Implements RegionShape::move.
00578                 virtual void move(double dx, double dy, String system = "");
00579 
00580                 // Implements RegionShape::getHandle.
00581                 virtual RSHandle getHandle() const;
00582 
00583                 // Implements RegionShape::optionNames.
00584                 virtual vector<String> optionNames() const;
00585 
00586                 // Implements RegionShape::optionTypes.
00587                 virtual vector<OptionType> optionTypes() const;
00588 
00589                 // Implements RegionShape::optionChoices.
00590                 virtual vector<vector<String> > optionChoices() const;
00591 
00592                 // Implements RegionShape::optionValues.
00593                 virtual vector<RSOption> optionValues() const;
00594 
00595                 // Implements RegionShape::setOptions.
00596                 virtual void setOptionValues(const vector<RSOption>& options);
00597 
00598         protected:
00599                 vector<double> m_spec;        // order: [x1 y1 x2 y2], either world or pixel
00600                 vector<double> m_screenSpec;  // same order, screen coords
00601                 int m_arrowLength;            // arrow length, screen coords
00602                 bool m_arrow1, m_arrow2;      // whether to draw the arrows
00603                 ArrowType m_aType1, m_aType2; // arrow types
00604 
00605                 // Implements RegionShape::getShapeSpecificProperties.
00606                 virtual void getShapeSpecificProperties(Record& properties) const {
00607                         properties.define(PROPTYPE, PROPTYPE_LINE);
00608                 }
00609 
00610                 // Implements RegionShape::setShapeSpecificProperties.
00611                 virtual void setShapeSpecificProperties(const RecordInterface& /*props*/) { }
00612 
00613                 // Updates screen coords using world/pixel coords and the given WorldCanvas
00614                 virtual bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00615 
00616                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.
00617                 void updateMinMax();
00618 
00619                 // Generates arrow points based on the given (x1, y1) (x2, y2) points.
00620                 // NOTE: Duplicated code from casaqt/QwtPlotter/QPShape (QPArrow class).
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                 // Helper for arrowPoints.  NOTE: Duplicated code.
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 // Subclass of RSLine that takes a length and angle instead of a second point.
00633         class RSVector : public RSLine {
00634         public:
00635                 // World Constructor.  x, y, length, and angle must all be 1) using the
00636                 // same world system as defined by worldSystem, and 2) in unit
00637                 // RegionShape::UNIT.  Angle is counterclockwise, and the base is the east
00638                 // vector.   arrowLength is in screen pixels. arrow defines whether the
00639                 // second point has an arrow.
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                 // Pixel Constructor.  Angle is counterclockwise.  arrowLength is in screen
00645                 // pixels.  arrow defines whether the second point has an arrow.
00646                 RSVector(double x, double y, double length, double angle, int arrowLength,
00647                          bool arrow = true, ArrowType arrowType = FilledDoubleV);
00648 
00649                 // Record Constructor.
00650                 RSVector(const RecordInterface& properties);
00651 
00652                 // Destructor.
00653                 ~RSVector();
00654 
00655                 // Returns whether the vector has an arrow at the end or not.
00656                 bool arrow() const {
00657                         return p2Arrow();
00658                 }
00659 
00660                 // Overrides RSLine::type.
00661                 String type() const {
00662                         return "vector";
00663                 }
00664 
00665                 // Gets vector-specific coordinates, to avoid dependence on
00666                 // coordParameterValues() when the shape type is known.
00667                 // If toSystem is empty, no conversion is done; otherwise see the
00668                 // constraints listed in RegionShape::coordParameterValues(String).
00669                 void getVectorCoordinates(double& x, double& y, double& angle,
00670                                           double& length, int& arrowLength,
00671                                           String toSystem = "") const;
00672 
00673                 // Overrides RSLine::coordParameterValues.
00674                 vector<double> coordParameterValues() const;
00675 
00676                 // Implements RegionShape::coordParameterValues.
00677                 vector<double> coordParameterValues(String toSystem) const;
00678 
00679                 // Overrides RSLine::coordParameterNames.
00680                 vector<String> coordParameterNames() const;
00681 
00682                 // Overrides RSLine::coordParameterPositions.
00683                 vector<CoordinateParameterType> coordParameterTypes() const;
00684 
00685                 // Overrides RSLine::setCoordParameters.
00686                 void setCoordParameters(const vector<double>& vals);
00687 
00688                 // Overrides RSLine::setCoordParameters.
00689                 void setCoordParameters(const vector<double>& vals, String valSystem);
00690 
00691                 // Overrides RSLine::optionNames.
00692                 vector<String> optionNames() const;
00693 
00694                 // Overrides RSLine::optionTypes.
00695                 vector<OptionType> optionTypes() const;
00696 
00697                 // Overrides RSLine::optionChoices.
00698                 vector<vector<String> > optionChoices() const;
00699 
00700                 // Overrides RSLine::optionValues.
00701                 vector<RSOption> optionValues() const;
00702 
00703                 // Overrides RSLine::setOptions.
00704                 void setOptionValues(const vector<RSOption>& options);
00705 
00706         protected:
00707                 double m_length; // length, world or pixel
00708                 double m_angle;  // angle, world or pixel
00709 
00710                 // Overrides RSLine::getShapeSpecificProperties.
00711                 void getShapeSpecificProperties(Record& properties) const {
00712                         properties.define(PROPTYPE, PROPTYPE_VECTOR);
00713                 }
00714         };
00715 
00716 
00717 // Subclass of RegionShape used for drawing markers.  A marker has the
00718 // following properties in addition to those listed for RegionShape:
00719 // <ul><li>x and y coordinates</li>
00720 //     <li>marker type, or list of marker types</li>
00721 //     <li>pixel height</li></ul>
00722         class RSMarker : public RegionShape {
00723         public:
00724                 // World Constructor for a single marker type.  x and y must all be
00725                 // 1) using the same world system as defined by worldSystem, and
00726                 // 2) in the unit RegionShape::UNIT.  pixelHeight is in screen pixels.
00727                 RSMarker(double x, double y, Display::Marker marker, int pixelHeight,
00728                          MDirection::Types worldSystem);
00729 
00730                 // World Constructor for a compound marker type.  x and y must all be
00731                 // 1) using the same world system as defined by worldSystem, and
00732                 // 2) in the unit RegionShape::UNIT.  pixelHeight is in screen pixels.
00733                 RSMarker(double x, double y, const vector<Display::Marker>& markers,
00734                          int pixelHeight, MDirection::Types worldSystem);
00735 
00736                 // Pixel Constructor for a single marker type.  pixelHeight is in screen
00737                 // pixels.
00738                 RSMarker(double x, double y, Display::Marker marker, int pixelHeight);
00739 
00740                 // Pixel Constructor for a compound marker type.  pixelHeight is in screen
00741                 // pixels.
00742                 RSMarker(double x, double y, const vector<Display::Marker>& markers,
00743                          int pixelHeight);
00744 
00745                 // Record Constructor.
00746                 RSMarker(const RecordInterface& properties);
00747 
00748                 // Destructor.
00749                 ~RSMarker();
00750 
00751                 // Gets/sets the markers used for this shape.
00752                 // <group>
00753                 vector<Display::Marker> markers() const;
00754                 void setMarker(Display::Marker marker);
00755                 void setMarkers(const vector<Display::Marker>& markers);
00756                 // </group>
00757 
00758 
00759                 // Implements RegionShape::drawAndUpdateBoundingBox.
00760                 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00761 
00762                 // Implements RegionShape::type.
00763                 String type() const;
00764 
00765                 // Overrides RegionShape::oneWordType.
00766                 String oneWordType() const {
00767                         return "marker";
00768                 }
00769 
00770                 // Gets marker-specific coordinates, to avoid dependence on
00771                 // coordParameterValues() when the shape type is known.
00772                 // If toSystem is empty, no conversion is done; otherwise see the
00773                 // constraints listed in RegionShape::coordParameterValues(String).
00774                 void getMarkerCoordinates(double& x, double& y, int& pixelHeight,
00775                                           String toSystem = "") const;
00776 
00777                 // Implements RegionShape::coordParameterValues.
00778                 vector<double> coordParameterValues() const;
00779 
00780                 // Implements RegionShape::coordParameterValues.
00781                 vector<double> coordParameterValues(String toSystem) const;
00782 
00783                 // Implements RegionShape::coordParameterNames.
00784                 vector<String> coordParameterNames() const;
00785 
00786                 // Implements RegionShape::coordParameterPositions.
00787                 vector<CoordinateParameterType> coordParameterTypes() const;
00788 
00789                 // Implements RegionShape::setCoordParameters.
00790                 void setCoordParameters(const vector<double>& vals);
00791 
00792                 // Implements RegionShape::setCoordParameters.
00793                 void setCoordParameters(const vector<double>& vals, String valSystem);
00794 
00795                 // Implements RegionShape::move.
00796                 void move(double dx, double dy, String system = "");
00797 
00798                 // Implements RegionShape::getHandle.
00799                 RSHandle getHandle() const;
00800 
00801                 // Implements RegionShape::optionNames.
00802                 vector<String> optionNames() const;
00803 
00804                 // Implements RegionShape::optionTypes.
00805                 vector<OptionType> optionTypes() const;
00806 
00807                 // Overrides RegionShape::optionChoices.
00808                 vector<vector<String> > optionChoices() const;
00809 
00810                 // Implements RegionShape::optionValues.
00811                 vector<RSOption> optionValues() const;
00812 
00813                 // Implements RegionShape::setOptions.
00814                 void setOptionValues(const vector<RSOption>& options);
00815 
00816         protected:
00817                 double m_x, m_y;                   // location, world or pixel
00818                 double m_screenX, m_screenY;       // location, screen
00819                 vector<Display::Marker> m_markers; // marker(s) to be drawn
00820                 int m_pixelHeight;                 // pixel height for marker(s)
00821 
00822                 // Implements RegionShape::getShapeSpecificProperties.
00823                 void getShapeSpecificProperties(Record& properties) const {
00824                         properties.define(PROPTYPE, PROPTYPE_MARKER);
00825                 }
00826 
00827                 // Implements RegionShape::setShapeSpecificProperties.
00828                 void setShapeSpecificProperties(const RecordInterface& /*properties*/) { }
00829 
00830                 // Updates screen coords using world/pixel coords and the given WorldCanvas
00831                 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
00832 
00833                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.
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 // Subclass of RegionShape used for drawing text.  Text uses RegionShape's
00922 // label property.
00923         class RSText : public RegionShape {
00924         public:
00925                 // World Constructor.  x, y, and angle must both be 1) using the same world
00926                 // system as defined by worldSystem, and 2) in unit RegionShape::UNIT.
00927                 // Angle is counterclockwise, and the base is the east vector.
00928                 RSText(double x, double y, const String& text, MDirection::Types worldSys,
00929                        double angle = 0);
00930 
00931                 // Pixel Constructor.  Angle is counterclockwise.
00932                 RSText(double x, double y, const String& text, double angle = 0);
00933 
00934                 // Record Constructor.
00935                 RSText(const RecordInterface& properties);
00936 
00937                 // Destructor.
00938                 ~RSText();
00939 
00940                 // Implements RegionShape::drawAndUpdateBoundingBox.
00941                 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
00942 
00943                 // Implements RegionShape::type.
00944                 String type() const {
00945                         return "text";
00946                 }
00947 
00948                 // Gets text-specific coordinates, to avoid dependence on
00949                 // coordParameterValues() when the shape type is known.
00950                 // If toSystem is empty, no conversion is done; otherwise see the
00951                 // constraints listed in RegionShape::coordParameterValues(String).
00952                 void getTextCoordinates(double& x, double& y, double& angle,
00953                                         String toSystem = "") const;
00954 
00955                 // Implements RegionShape::coordParameterValues.
00956                 vector<double> coordParameterValues() const;
00957 
00958                 // Implements RegionShape::coordParameterValues.
00959                 vector<double> coordParameterValues(String toSystem) const;
00960 
00961                 // Implements RegionShape::coordParameterNames.
00962                 vector<String> coordParameterNames() const;
00963 
00964                 // Implements RegionShape::coordParameterPositions.
00965                 vector<CoordinateParameterType> coordParameterTypes() const;
00966 
00967                 // Implements RegionShape::setCoordParameters.
00968                 void setCoordParameters(const vector<double>& vals);
00969 
00970                 // Implements RegionShape::setCoordParameters.
00971                 void setCoordParameters(const vector<double>& vals, String valSystem);
00972 
00973                 // Implements RegionShape::move.
00974                 void move(double dx, double dy, String system = "");
00975 
00976                 // Implements RegionShape::getHandle.
00977                 RSHandle getHandle() const;
00978 
00979                 // Implements RegionShape option methods.  Note: text do not have
00980                 // additonal options.
00981                 // <group>
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>& /*options*/) { }
00992                 // </group>
00993 
00994         protected:
00995                 double m_x, m_y;             // location, pixel or world
00996                 double m_angle;              // angle, pixel or world
00997                 double m_wWidth;             // width in pixel/world
00998                 // updated during updateScreenCoordinates
00999                 double m_screenX, m_screenY; // location, screen
01000 
01001                 // Implements RegionShape::getShapeSpecificProperties.
01002                 void getShapeSpecificProperties(Record& properties) const {
01003                         properties.define(PROPTYPE, PROPTYPE_TEXT);
01004                 }
01005 
01006                 // Implements RegionShape::setShapeSpecificProperties.
01007                 void setShapeSpecificProperties(const RecordInterface& /*properties*/) { }
01008 
01009                 // Updates screen coords using world/pixel coords and the given WorldCanvas
01010                 bool updateScreenCoordinates(WorldCanvasHolder& wch, String* err);
01011 
01012                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.  Note that this is only valid
01013                 // the screen coordinates have been updated.
01014                 void updateMinMax();
01015         };
01016 
01017 
01018 // Subclass of RegionShape used for drawing composite regions.  A composite
01019 // region consists of zero or more children RegionShapes.  A RSComposite can
01020 // either see its children as dependent, in which the parent controls the
01021 // properties for each shape, or independent in which each child's properties
01022 // must be set individually.  An RSComposite can have a custom name/type.
01023 // NOTE: xMin, xMax, yMin, and yMax values are ONLY valid if all children
01024 // shapes have the same coordinate system as the parent composite.
01025 // The following properties are also available:
01026 // <ul><li><b>RSComposite::PROPDEPENDENTCHILDREN</b> (<i>bool</i>):
01027 //         whether the composite's children are dependent (true) or independent
01028 //         (false).  <b>OPTIONAL</b>.</li>
01029 //     <li><b>RSComposite::PROPCHILDREN</b> (<i>Record of Records</li>):
01030 //         ordered list of children records.  Each field must have a unique
01031 //         name (the specifics are irrelevant because it's the order that
01032 //         matters) and the value must be a record that can be used to create a
01033 //         RegionShape child.  <b>NOT STRICTLY REQUIRED, BUT A VALID COMPOSITE
01034 //         HAS AT LEAST ONE CHILD.</b></li></ul>
01035         class RSComposite : public RegionShape {
01036         public:
01037                 // Static Members //
01038 
01039                 // Properties.  (See class descriptions of RegionShape and RSComposite.)
01040                 // <group>
01041                 static const String PROPDEPENDENTCHILDREN;
01042                 static const String PROPCHILDREN;
01043                 // </group>
01044 
01045 
01046                 // Non-Static Members //
01047 
01048                 // World constructor.  Initially empty composite.  The dependent flag
01049                 // controls whether the children are dependent or independent.  If
01050                 // customName is set, it will be returned on type().  The given world
01051                 // system is only used for displaying/setting the center of the composite
01052                 // and does not affect the coordinate systems of the children.
01053                 RSComposite(MDirection::Types worldSys, bool dependent = true,
01054                             String customName = "");
01055 
01056                 // Pixel constructor.  Initially empty composite.  The dependent flag
01057                 // controls whether the children are dependent or independent.  If
01058                 // custonName is set, it will be returned on type().
01059                 RSComposite(bool dependent = true, String customName = "");
01060 
01061                 // Record Constructor.
01062                 RSComposite(const RecordInterface& properties);
01063 
01064                 // Destructor.
01065                 ~RSComposite();
01066 
01067                 // Adds the given shape(s) to this composite.  Note that in the case of
01068                 // depdendent children, line properties, linethrough properties, and label
01069                 // properties of the individual shapes are discarded in favor of those of
01070                 // the parent RSComposite.
01071                 // <group>
01072                 void addShape(RegionShape* shape);
01073                 void addShapes(const vector<RegionShape*> shapes);
01074                 // </group>
01075 
01076                 // Returns true if the children are dependent, false otherwise.
01077                 bool childrenAreDependent() const;
01078 
01079                 // Sets whether children are dependent or not.  NOTE: This should never be
01080                 // called AFTER the composite has already been added to the
01081                 // QtRegionShapeManager.  Preferably it should be done before adding any
01082                 // children either.
01083                 void setChildrenAreDependent(bool dependent = true);
01084 
01085                 // Returns the composite's children.
01086                 // <group>
01087                 vector<RegionShape*> children();
01088                 vector<const RegionShape*> children() const;
01089                 // </group>
01090 
01091 
01092                 // Overrides RegionShape methods in the case of dependent children.
01093                 // <group>
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                 // </group>
01099 
01100                 // Implements RegionShape::drawAndUpdateBoundingBox.
01101                 bool drawAndUpdateBoundingBox(WorldCanvasHolder& wch, String* err = NULL);
01102 
01103                 // Implements RegionShape::type.
01104                 String type() const;
01105 
01106                 // Overrides RegionShape::oneWordType.
01107                 String oneWordType() const {
01108                         return "composite";
01109                 }
01110 
01111                 // Returns 0 degrees pixel/screen in the given coordinate system (own
01112                 // system if toSystem is empty, otherwise see the constraints listed in
01113                 // RegionShape::coordParameterValues(String).
01114                 double getAngle(String toSystem = "") const;
01115 
01116                 // Gets composite-specific coordinates, to avoid dependence on
01117                 // coordParameterValues() when the shape type is known.
01118                 // If toSystem is empty, no conversion is done; otherwise see the
01119                 // constraints listed in RegionShape::coordParameterValues(String).
01120                 void getCompositeCoordinates(double& centerX, double& centerY,
01121                                              String toSystem = "") const;
01122 
01123                 // Implements RegionShape::coordParameterValues.
01124                 vector<double> coordParameterValues() const;
01125 
01126                 // Implements RegionShape::coordParameterValues.
01127                 vector<double> coordParameterValues(String toSystem) const;
01128 
01129                 // Implements RegionShape::coordParameterNames.
01130                 vector<String> coordParameterNames() const;
01131 
01132                 // Implements RegionShape::coordParameterPositions.
01133                 vector<CoordinateParameterType> coordParameterTypes() const;
01134 
01135                 // Implements RegionShape::setCoordParameters.
01136                 void setCoordParameters(const vector<double>& vals);
01137 
01138                 // Implements RegionShape::setCoordParameters.
01139                 void setCoordParameters(const vector<double>& vals, String valSystem);
01140 
01141                 // Implements RegionShape::move.
01142                 void move(double dx, double dy, String system = "");
01143 
01144                 // Implements RegionShape::getHandle.
01145                 RSHandle getHandle() const;
01146 
01147                 // Implements RegionShape::optionNames.
01148                 vector<String> optionNames() const;
01149 
01150                 // Implements RegionShape::optionTypes.
01151                 vector<OptionType> optionTypes() const;
01152 
01153                 // Implements RegionShape::optionValues.
01154                 vector<RSOption> optionValues() const;
01155 
01156                 // Implements RegionShape::setOptions.
01157                 void setOptionValues(const vector<RSOption>& options);
01158 
01159         protected:
01160                 String m_custName;             // optional custom name
01161                 bool m_dependentChildren;      // whether children are dependent
01162                 vector<RegionShape*> m_shapes; // children
01163                 double m_centerX, m_centerY;   // center
01164                 bool m_syncAngleDepChildren;   // flag for whether all children:
01165                 // 1) are dependent
01166                 // 2) have angles (rectangle, ellipse,
01167                 //    vector, text)
01168                 // 3) all have synched (same) angle
01169                 double m_syncAngle;            // Sync angle (if applicable).
01170                 bool m_applyChangesToChildren; // Whether or not to apply options changes
01171                 // to children or not.
01172 
01173                 // Implements RegionShape::getShapeSpecificProperties.
01174                 void getShapeSpecificProperties(Record& properties) const;
01175 
01176                 // Implements RegionShape::setShapeSpecificProperties.
01177                 void setShapeSpecificProperties(const RecordInterface& properties);
01178 
01179                 // Update m_xMin, m_xMax, m_yMin, and m_yMax.
01180                 void updateMinMax();
01181 
01182         private:
01183                 // Adds the given child but does not perform upkeep.  Returns true if the
01184                 // shape was added, false otherwise.
01185                 bool addShapeHelper(RegionShape* shape);
01186 
01187                 // Does upkeep after adding shapes.
01188                 void addShapeUpkeep();
01189 
01190                 // Gets the min/max of the child at the given index, in the composite's
01191                 // coordinate system.
01192                 void convertMinMax(double& xmin, double& xmax, double& ymin, double& ymax,
01193                                    unsigned int index) const;
01194         };
01195 
01196 }
01197 
01198 #endif /*REGIONSHAPES_H_*/
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1