Salome HOME
new files added
[modules/gui.git] / src / GLViewer / GLViewer_CoordSystem.h
1 // File:      GLViewer_CoordSystem.h
2 // Created:   November, 2004
3 // Author:    OCC team
4 // Copyright (C) CEA 2004
5
6 #ifndef GLVIEWER_COORDSYSTEM_H
7 #define GLVIEWER_COORDSYSTEM_H
8
9 #include "GLViewer.h"
10
11 #ifdef WNT
12 #pragma warning( disable:4251 )
13 #endif
14
15 // Class:   GLViewer_CoordSystem
16
17 class GLVIEWER_API GLViewer_CoordSystem
18 {
19 public:
20   enum CSType { Cartesian, Polar };
21   
22 private:
23   double myX0, myY0;       //The coordinates of origin in the reference CS
24   double myXUnit, myYUnit; //The lengths of axis units in the reference unit
25   double myRotation;       //The rotation in radians relative to reference CS
26   
27   //!!! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
28   
29   CSType myType;
30   
31 public:
32   GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0, 
33                         double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
34   
35   void getOrigin( double& x, double& y ) const;
36   void setOrigin( double x, double y );
37   
38   void getUnits( double& x, double& y ) const;
39   void setUnits( double x, double y );
40   
41   double getRotation() const;
42   void   setRotation( double rotation );
43   
44   CSType getType() const;
45   void setType( CSType type );
46   
47   void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
48   //Transform the coordinates x, y from current CS to aSystem
49   
50   virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
51   //Return how many times line width in aSystem system bigger than in current
52   
53 protected:
54   virtual void toReference( double& x, double& y );
55   virtual void fromReference( double& x, double& y );
56 };
57
58 #ifdef WNT
59 #pragma warning ( default:4251 )
60 #endif
61
62 #endif