00001
00002
00004
00006
00007
00008
00009
00010
00011 #ifndef _LocalSpaceRectangular2D_h
00012 #define _LocalSpaceRectangular2D_h
00013
00019 #include "BaseSRF.h"
00020 #include "Coord.h"
00021 #include "Exception.h"
00022
00023 namespace srm
00024 {
00025
00026
00033 class EXPORT_SRM_CPP_DLL SRF_LocalSpaceRectangular2D: public BaseSRF_2D
00034 {
00035 public:
00036
00040 static SRF_LocalSpaceRectangular2D* create( const SRM_ORM_Code orm,
00041 const SRM_RT_Code rt,
00042 const SRM_LSR_2D_Parameters ¶ms );
00043
00047 static SRF_LocalSpaceRectangular2D* create(
00048 SRM_ORM_Code orm,
00049 SRM_RT_Code rt,
00050 SRM_Axis_Direction forward_direction
00051 );
00052
00056 static SRF_LocalSpaceRectangular2D* create( SRM_SRF_Parameters_Info srf_params )
00057 {
00058 return create( srf_params.value.srf_template.orm_code,
00059 srf_params.rt_code,
00060 srf_params.value.srf_template.parameters.lsr_2d_srf_parameters );
00061 }
00062
00064 Coord2D* createCoordinate2D(SRM_Long_Float coord_comp1,
00065 SRM_Long_Float coord_comp2 );
00066
00070 const SRM_LSR_2D_Parameters &getSRFParameters() const;
00071
00075 SRM_Axis_Direction get_forward_direction() const;
00076
00078 virtual bool isA( SRF_ClassType type ) const;
00079
00080
00082 virtual SRF_ClassType getClassType() const {
00083 return BaseSRF::SRF_TYP_LSR_2D;
00084 }
00085
00087 bool isEqual( const SRF_LocalSpaceRectangular2D &srf ) const;
00088
00089
00093 SRF_LocalSpaceRectangular2D* makeCopy() const;
00094
00095
00099 const char* toString();
00100
00101 protected:
00102
00103 friend class BaseSRF;
00104 friend class BaseSRF_3D;
00105 friend class BaseSRF_WithEllipsoidalHeight;
00106 SRF_LocalSpaceRectangular2D( void *impl ) : BaseSRF_2D(impl) {}
00107 SRF_LocalSpaceRectangular2D &operator =( const BaseSRF & ) { return *this; }
00108 virtual ~SRF_LocalSpaceRectangular2D() {}
00109
00110 };
00111
00112
00113 inline bool SRF_LocalSpaceRectangular2D::isA( SRF_ClassType type ) const
00114 {
00115 if (type == BaseSRF::SRF_TYP_LSR_2D)
00116 return true;
00117 else
00118 return BaseSRF_2D::isA(type);
00119 };
00120
00121
00123 typedef SRF_LocalSpaceRectangular2D SRF_LSR_2D;
00124
00125
00130 class EXPORT_SRM_CPP_DLL Coord2D_LocalSpaceRectangular2D: public Coord2D
00131 {
00132 public:
00133
00135 Coord2D_LocalSpaceRectangular2D( SRF_LocalSpaceRectangular2D *srf,
00136 SRM_Long_Float u = 0.0,
00137 SRM_Long_Float v = 0.0 )
00138 : Coord2D(srf)
00139 {
00140 setComponentValues(u, v);
00141 }
00142
00144 Coord2D_LocalSpaceRectangular2D( const Coord2D_LocalSpaceRectangular2D &coord )
00145 : Coord2D(coord._srf)
00146 {
00147 setComponentValues( coord._values[0], coord._values[1] );
00148 }
00149
00153 void copyTo( Coord2D_LocalSpaceRectangular2D &coord ) const
00154 {
00155 if (coord._srf != _srf)
00156 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00157
00158 coord._values[0] = _values[0];
00159 coord._values[1] = _values[1];
00160 }
00161
00163 bool isEqual( const Coord2D_LocalSpaceRectangular2D &coord ) const
00164 {
00165 return (_srf == coord._srf &&
00166 _values[0] == coord._values[0] &&
00167 _values[1] == coord._values[1] );
00168 }
00169
00171 void setComponentValues( SRM_Long_Float u, SRM_Long_Float v )
00172 {
00173 _values[0] = u;
00174 _values[1] = v;
00175 }
00176
00178 SRM_Long_Float get_u() const {
00179 return _values[0];
00180 }
00181
00183 SRM_Long_Float get_v() const {
00184 return _values[1];
00185 }
00186
00188 void set_u( SRM_Long_Float value ) {
00189 _values[0] = value;
00190 }
00191
00193 void set_v( SRM_Long_Float value ) {
00194 _values[1] = value;
00195 }
00196
00198 virtual bool isA( Coord_ClassType type ) const;
00199
00200
00202 virtual Coord_ClassType getClassType() const {
00203 return Coord::COORD_TYP_LSR_2D;
00204 }
00205
00206 };
00207
00208
00209 inline bool Coord2D_LocalSpaceRectangular2D::isA( Coord_ClassType type ) const
00210 {
00211 if (type == Coord::COORD_TYP_LSR_2D)
00212 return true;
00213 else
00214 return Coord2D::isA(type);
00215 };
00216
00217
00219 typedef Coord2D_LocalSpaceRectangular2D Coord2D_LSR_2D;
00220
00221
00222 }
00223
00224 #endif // _LocalSpaceRectangular2D_h