00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_POINT_2D_H_
00028 #define OSDL_POINT_2D_H_
00029
00030
00031 #include "OSDLVideoTypes.h"
00032 #include "OSDLPoint.h"
00033
00034 #include "OSDLTypes.h"
00035
00036 #include "Ceylan.h"
00037
00038 #include <string>
00039 #include <list>
00040
00041
00042
00043 namespace OSDL
00044 {
00045
00046
00047
00048 namespace Video
00049 {
00050
00051
00052
00053 namespace TwoDimensional
00054 {
00055
00056
00057
00058
00067 class OSDL_DLL Point2D : public Point
00068 {
00069
00070
00071 public:
00072
00073
00074
00080 explicit Point2D( Coordinate x = 0, Coordinate y = 0 ) ;
00081
00082
00083
00092 Point2D( const Point2D & source ) ;
00093
00094
00095
00104 explicit Point2D(
00105 const Ceylan::Maths::Linear::Bipoint & source ) ;
00106
00107
00108
00117 explicit Point2D(
00118 const Ceylan::Maths::Linear::Vector2 & source ) ;
00119
00120
00121
00142 static Point2D & CreateFrom( FloatingPointCoordinate x = 0,
00143 FloatingPointCoordinate y = 0 ) ;
00144
00145
00146
00148 virtual ~Point2D() throw() ;
00149
00150
00151
00157 virtual void setTo( Coordinate x, Coordinate y ) ;
00158
00159
00160
00169 virtual void setTo( FloatingPointCoordinate x,
00170 FloatingPointCoordinate y ) ;
00171
00172
00173
00179 virtual void setFrom( const Point2D & source ) ;
00180
00181
00182
00191 virtual void setFrom(
00192 const Ceylan::Maths::Linear::Vector2 & source ) ;
00193
00194
00195
00197 inline Coordinate getX() const ;
00198
00199
00201 inline void setX( Coordinate newX ) ;
00202
00203
00204
00206 inline Coordinate getY() const ;
00207
00208
00210 inline void setY( Coordinate newY ) ;
00211
00212
00213
00219 void translate( Offset x, Offset y ) ;
00220
00221
00222
00224 virtual void flip() ;
00225
00226
00227
00229 virtual void flipX() ;
00230
00231
00232
00234 virtual void flipY() ;
00235
00236
00237
00250 virtual const std::string toString(
00251 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00252
00253
00254
00255
00256
00257
00258
00259
00261 static const Point2D Origin ;
00262
00263
00264
00265
00272 static void Translate( std::list<Point2D *> & pointList,
00273 Offset x, Offset y ) ;
00274
00275
00281 static const Ceylan::Maths::Linear::MatrixIndex Dimensions
00282 = 2 ;
00283
00284
00285
00286
00287 protected:
00288
00289
00295 Coordinate _coord[ Dimensions ] ;
00296
00297
00298
00299 } ;
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 Coordinate Point2D::getX() const
00310 {
00311
00312 return _coord[0] ;
00313
00314 }
00315
00316
00317
00318 void Point2D::setX( Coordinate newX )
00319 {
00320
00321 _coord[0] = newX ;
00322
00323 }
00324
00325
00326
00327 Coordinate Point2D::getY() const
00328 {
00329
00330 return _coord[1] ;
00331
00332 }
00333
00334
00335
00336 void Point2D::setY( Coordinate newY )
00337 {
00338
00339 _coord[1] = newY ;
00340
00341 }
00342
00343
00344
00345 }
00346
00347 }
00348
00349 }
00350
00351
00352
00354 OSDL_DLL std::ostream & operator << ( std::ostream & os,
00355 const OSDL::Video::TwoDimensional::Point2D & p ) ;
00356
00357
00358
00359 #endif // OSDL_POINT_2D_H_
00360