00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #ifndef _LocalSpaceRectangular2D_h
00077 #define _LocalSpaceRectangular2D_h
00078
00079 #include "BaseSRF.h"
00080 #include "Coord.h"
00081 #include "Exception.h"
00082
00083 namespace srm
00084 {
00091 class EXPORT_SRM_CPP_DLL SRF_LocalSpaceRectangular2D: public BaseSRF_2D
00092 {
00093 public:
00097 static SRF_LocalSpaceRectangular2D* create( SRM_ORM_Code orm,
00098 SRM_RT_Code rt,
00099 const SRM_LSR_2D_Parameters ¶ms);
00100
00104 static SRF_LocalSpaceRectangular2D* create(
00105 SRM_ORM_Code orm,
00106 SRM_RT_Code rt,
00107 SRM_Axis_Direction forward_direction
00108 );
00109
00113 static SRF_LocalSpaceRectangular2D* create( SRM_SRF_Parameters_Info srf_params )
00114 {
00115 return create( srf_params.value.srf_template.orm_code,
00116 srf_params.rt_code,
00117 srf_params.value.srf_template.parameters.lsr_2d_srf_parameters );
00118 }
00119
00122 Coord2D* createCoordinate2D(SRM_Long_Float coord_comp1,
00123 SRM_Long_Float coord_comp2 );
00124
00128 const SRM_LSR_2D_Parameters &getSRFParameters() const;
00129
00133 SRM_Axis_Direction get_forward_direction() const;
00134
00137 virtual bool isA( SRF_ClassType type ) const;
00138
00141 virtual SRF_ClassType getClassType() const
00142 {
00143 return BaseSRF::SRF_TYP_LSR_2D;
00144 }
00145
00149 bool isEqual( const SRF_LocalSpaceRectangular2D &srf ) const;
00150
00154 bool operator==( const SRF_LocalSpaceRectangular2D &rhs ) const;
00155
00159 SRF_LocalSpaceRectangular2D* makeCopy() const;
00160
00164 const char* toString();
00165
00166 protected:
00167 SRF_LocalSpaceRectangular2D( void *impl ) : BaseSRF_2D(impl) {}
00168 SRF_LocalSpaceRectangular2D &operator =( const SRF_LocalSpaceRectangular2D & ) { return *this; }
00169 virtual ~SRF_LocalSpaceRectangular2D() {}
00170 };
00171
00172
00173 inline bool SRF_LocalSpaceRectangular2D::isA( SRF_ClassType type ) const
00174 {
00175 if (type == BaseSRF::SRF_TYP_LSR_2D)
00176 return true;
00177 else
00178 return BaseSRF_2D::isA(type);
00179 };
00180
00181
00183 typedef SRF_LocalSpaceRectangular2D SRF_LSR_2D;
00184
00185
00190 class EXPORT_SRM_CPP_DLL Coord2D_LocalSpaceRectangular2D: public Coord2D
00191 {
00192 public:
00195 Coord2D_LocalSpaceRectangular2D(SRF_LocalSpaceRectangular2D *srf,
00196 SRM_Long_Float u = 0.0,
00197 SRM_Long_Float v = 0.0 )
00198 : Coord2D(srf)
00199 {
00200 setComponentValues(u, v);
00201 }
00202
00205 Coord2D_LocalSpaceRectangular2D( const Coord2D_LocalSpaceRectangular2D &coord )
00206 : Coord2D(coord._srf)
00207 {
00208 setComponentValues( coord._values[0], coord._values[1] );
00209 }
00210
00216 void copyTo( Coord2D_LocalSpaceRectangular2D &coord ) const
00217 {
00218 if (coord._srf != _srf)
00219 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00220
00221 coord._values[0] = _values[0];
00222 coord._values[1] = _values[1];
00223 }
00224
00228 bool isEqual( const Coord2D_LocalSpaceRectangular2D &coord ) const
00229 {
00230 return (_srf == coord._srf &&
00231 _values[0] == coord._values[0] &&
00232 _values[1] == coord._values[1] );
00233 }
00234
00237 void setComponentValues( SRM_Long_Float u, SRM_Long_Float v )
00238 {
00239 _values[0] = u;
00240 _values[1] = v;
00241 }
00242
00245 SRM_Long_Float get_u() const
00246 {
00247 return _values[0];
00248 }
00249
00252 SRM_Long_Float get_v() const
00253 {
00254 return _values[1];
00255 }
00256
00259 void set_u( SRM_Long_Float value )
00260 {
00261 _values[0] = value;
00262 }
00263
00266 void set_v( SRM_Long_Float value )
00267 {
00268 _values[1] = value;
00269 }
00270
00273 virtual bool isA( Coord_ClassType type ) const;
00274
00277 virtual Coord_ClassType getClassType() const
00278 {
00279 return Coord::COORD_TYP_LSR_2D;
00280 }
00281
00284 bool operator==( const Coord2D_LocalSpaceRectangular2D &rhs ) const;
00285
00291 bool isCompatibleWith( const Coord2D_LocalSpaceRectangular2D &rhs ) const
00292 {
00293 return ((*(SRF_LocalSpaceRectangular2D*)(this->_srf)) == (*(SRF_LocalSpaceRectangular2D*)(rhs._srf)));
00294 }
00295
00300 Coord2D_LocalSpaceRectangular2D &operator= ( const Coord2D_LocalSpaceRectangular2D &rhs )
00301 {
00302 if((*(SRF_LocalSpaceRectangular2D*)(this->_srf)) == (*(SRF_LocalSpaceRectangular2D*)(rhs._srf)))
00303 {
00304 _values[0] = rhs._values[0];
00305 _values[1] = rhs._values[1];
00306 }
00307 else
00308 throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00309 "Coord2D_LocalSpaceRectangular2D op=: incompatible rhs coordinate");
00310
00311 return *this;
00312 }
00313 };
00314
00315
00316 inline bool Coord2D_LocalSpaceRectangular2D::isA( Coord_ClassType type ) const
00317 {
00318 if (type == Coord::COORD_TYP_LSR_2D)
00319 return true;
00320 else
00321 return Coord2D::isA(type);
00322 };
00323
00324
00326 typedef Coord2D_LocalSpaceRectangular2D Coord2D_LSR_2D;
00327
00328 }
00329
00330 #endif // _LocalSpaceRectangular2D_h