1 // File: GLViewer_CoordSystem.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 /*! Class GLViewer_CoordSystem
7 * Class implementing mathematical model of 2D coordinate system
10 #ifndef GLVIEWER_COORDSYSTEM_H
11 #define GLVIEWER_COORDSYSTEM_H
16 #pragma warning( disable:4251 )
19 class GLVIEWER_API GLViewer_CoordSystem
22 //! A type of coordinate system
30 //! The coordinates of origin in the reference CS
32 //! The lengths of axis units in the reference unit
33 double myXUnit, myYUnit;
34 //! The rotation in radians relative to reference CS
37 //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
41 //! A constructor ( by default new system is identical to reference )
42 GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0,
43 double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
45 //! Returns the origin in reference system
46 void getOrigin( double& x, double& y ) const;
47 //! A function installing the origin in reference system
48 void setOrigin( double x, double y );
50 //! Returns units along axes
51 void getUnits( double& x, double& y ) const;
52 //! A function installing units along axes
53 void setUnits( double x, double y );
55 //! Returns rotation angle of axes in reference system
56 double getRotation() const;
57 //! A function installing rotation angle of axes in reference system
58 void setRotation( double rotation );
60 //! Returns type of system
61 CSType getType() const;
62 //! A function installing type of system
63 void setType( CSType type );
65 //! Transform the coordinates x, y from current CS to aSystem
66 void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
69 //! Return how many times line width in aSystem system bigger than in current
70 virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
74 //! A function transforms system coords to coords in reference system
75 virtual void toReference( double& x, double& y );
76 //! A function transforms from coords in reference system to system coords
77 virtual void fromReference( double& x, double& y );
81 #pragma warning ( default:4251 )