00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef ANNOTATIONS_ANNPOLYGON_H
00018 #define ANNOTATIONS_ANNPOLYGON_H
00019
00020 #include <casa/aips.h>
00021 #include <imageanalysis/Annotations/AnnRegion.h>
00022
00023 namespace casa {
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class AnnPolygon: public AnnRegion {
00047
00048 public:
00049
00050 AnnPolygon(
00051 const Vector<Quantity>& xPositions,
00052 const Vector<Quantity>& yPositions,
00053 const String& dirRefFrameString,
00054 const CoordinateSystem& csys,
00055 const IPosition& imShape,
00056 const Quantity& beginFreq,
00057 const Quantity& endFreq,
00058 const String& freqRefFrameString,
00059 const String& dopplerString,
00060 const Quantity& restfreq,
00061 const Vector<Stokes::StokesTypes> stokes,
00062 const Bool annotationOnly
00063 );
00064
00065
00066
00067
00068
00069
00070
00071 AnnPolygon(
00072 const Vector<Quantity>& xPositions,
00073 const Vector<Quantity>& yPositions,
00074 const CoordinateSystem& csys,
00075 const IPosition& imShape,
00076 const Vector<Stokes::StokesTypes>& stokes
00077 );
00078
00079
00080
00081 AnnPolygon& operator=(const AnnPolygon& other);
00082
00083
00084 Vector<MDirection> getCorners() const;
00085
00086
00087 void worldVertices(vector<Quantity>& x, vector<Quantity>& y) const;
00088
00089
00090 void pixelVertices(vector<Double>& x, vector<Double>& y) const;
00091
00092
00093 virtual ostream& print(ostream &os) const;
00094
00095 protected:
00096
00097 AnnPolygon(
00098 AnnotationBase::Type shape,
00099 const Quantity& blcx,
00100 const Quantity& blcy,
00101 const Quantity& trcx,
00102 const Quantity& trcy,
00103 const String& dirRefFrameString,
00104 const CoordinateSystem& csys,
00105 const IPosition& imShape,
00106 const Quantity& beginFreq,
00107 const Quantity& endFreq,
00108 const String& freqRefFrameString,
00109 const String& dopplerString,
00110 const Quantity& restfreq,
00111 const Vector<Stokes::StokesTypes> stokes,
00112 const Bool annotationOnly
00113 );
00114
00115
00116
00117
00118
00119
00120
00121 AnnPolygon(
00122 AnnotationBase::Type shape,
00123 const Quantity& blcx,
00124 const Quantity& blcy,
00125 const Quantity& trcx,
00126 const Quantity& trcy,
00127 const CoordinateSystem& csys,
00128 const IPosition& imShape,
00129 const Vector<Stokes::StokesTypes>& stokes
00130 );
00131
00132
00133 AnnPolygon(
00134 AnnotationBase::Type shape,
00135 const Quantity& centerx,
00136 const Quantity& centery,
00137 const Quantity& widthx,
00138 const Quantity& widthy,
00139 const Quantity& positionAngle,
00140 const String& dirRefFrameString,
00141 const CoordinateSystem& csys,
00142 const IPosition& imShape,
00143 const Quantity& beginFreq,
00144 const Quantity& endFreq,
00145 const String& freqRefFrameString,
00146 const String& dopplerString,
00147 const Quantity& restfreq,
00148 const Vector<Stokes::StokesTypes> stokes,
00149 const Bool annotationOnly
00150 );
00151
00152
00153
00154
00155
00156
00157
00158 AnnPolygon(
00159 AnnotationBase::Type shape,
00160 const Quantity& centerx,
00161 const Quantity& centery,
00162 const Quantity& widthx,
00163 const Quantity& widthy,
00164 const Quantity& positionAngle,
00165 const CoordinateSystem& csys,
00166 const IPosition& imShape,
00167 const Vector<Stokes::StokesTypes>& stokes
00168 );
00169
00170 private:
00171 Vector<Quantity> _origXPos, _origYPos;
00172
00173 void _init();
00174
00175 void _initCorners(
00176 const Quantity& blcx,
00177 const Quantity& blcy,
00178 const Quantity& trcx,
00179 const Quantity& trcy
00180 );
00181
00182 void _initCorners(
00183 const MDirection& blc,
00184 const MDirection& corner2,
00185 const MDirection& trc,
00186 const MDirection& corner4
00187 );
00188
00189 void _initCenterRectCorners(
00190 const Quantity& centerx,
00191 const Quantity& centery,
00192 const Quantity& widthx,
00193 const Quantity& widthy,
00194 const Quantity& positionAngle
00195 );
00196
00197 void _doCorners(const Quantity& widthx, const Quantity widthy);
00198
00199 };
00200
00201 }
00202
00203 #endif