casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
AnnPolyline.h
Go to the documentation of this file.
00001 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00002 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00003 //# License for more details.
00004 //#
00005 //# You should have received a copy of the GNU Library General Public License
00006 //# along with this library; if not, write to the Free Software Foundation,
00007 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00008 //#
00009 //# Correspondence concerning AIPS++ should be addressed as follows:
00010 //#        Internet email: aips2-request@nrao.edu.
00011 //#        Postal address: AIPS++ Project Office
00012 //#                        National Radio Astronomy Observatory
00013 //#                        520 Edgemont Road
00014 //#                        Charlottesville, VA 22903-2475 USA
00015 //#
00016 
00017 #ifndef ANNOTATIONS_ANNPOLYLINE_H
00018 #define ANNOTATIONS_ANNPOLYLINE_H
00019 
00020 #include <casa/aips.h>
00021 #include <imageanalysis/Annotations/AnnRegion.h>
00022 
00023 namespace casa {
00024 
00025 // <summary>
00026 // This class represents a single polyline (in position coordinates) annotation specified
00027 // in an ascii region file as proposed in CAS-2285
00028 // </summary>
00029 // <use visibility=export>
00030 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00031 // </reviewed>
00032 // <prerequisite>
00033 
00034 // </prerequisite>
00035 
00036 // <etymology>
00037 // Holds the specification of a polyline annotation.
00038 // </etymology>
00039 
00040 // <synopsis>
00041 // This class represents a polyline annotation.
00042 // </synopsis>
00043 
00044 
00045 class AnnPolyline: public AnnRegion {
00046 
00047 public:
00048 
00049         AnnPolyline(
00050                 const Vector<Quantity>& xPositions,
00051                 const Vector<Quantity>& yPositions,
00052                 const String& dirRefFrameString,
00053                 const CoordinateSystem& csys,
00054                 const IPosition& imShape,
00055                 const Quantity& beginFreq,
00056                 const Quantity& endFreq,
00057                 const String& freqRefFrameString,
00058                 const String& dopplerString,
00059                 const Quantity& restfreq,
00060                 const Vector<Stokes::StokesTypes> stokes,
00061                 const Bool annotationOnly
00062         );
00063 
00064         // Simplified constructor.
00065         // all frequencies are used (these can be set after construction).
00066         // xPositions and yPositions
00067         // must be in the same frame as the csys direction coordinate.
00068         // is a region (not just an annotation), although this value can be changed after
00069         // construction.
00070         AnnPolyline(
00071                 const Vector<Quantity>& xPositions,
00072                 const Vector<Quantity>& yPositions,
00073                 const CoordinateSystem& csys,
00074                 const IPosition& imShape,
00075                 const Vector<Stokes::StokesTypes>& stokes
00076         );
00077 
00078         // implicit copy constructor and destructor are fine
00079 
00080         AnnPolyline& operator=(const AnnPolyline& other);
00081 
00082         // get the vertices converted to the coordinate system used at construction.
00083         Vector<MDirection> getCorners() const;
00084 
00085         // get the world coordinates of the polygon vertices
00086         void worldVertices(vector<Quantity>& x, vector<Quantity>& y) const;
00087 
00088         // get the pixel coordinates of the polygon vertices
00089         void pixelVertices(vector<Double>& x, vector<Double>& y) const;
00090 
00091 
00092         virtual ostream& print(ostream &os) const;
00093 
00094 private:
00095         Vector<Quantity> _origXPos, _origYPos;
00096 
00097         void _init();
00098 };
00099 
00100 }
00101 
00102 #endif /* ASCIIPOLYLINEREGION_H_ */