1 // File: GLViewer_CoordSystem.h
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 #ifndef GLVIEWER_COORDSYSTEM_H
7 #define GLVIEWER_COORDSYSTEM_H
12 #pragma warning( disable:4251 )
15 // Class: GLViewer_CoordSystem
17 class GLVIEWER_API GLViewer_CoordSystem
20 enum CSType { Cartesian, Polar };
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
27 //!!! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
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 );
35 void getOrigin( double& x, double& y ) const;
36 void setOrigin( double x, double y );
38 void getUnits( double& x, double& y ) const;
39 void setUnits( double x, double y );
41 double getRotation() const;
42 void setRotation( double rotation );
44 CSType getType() const;
45 void setType( CSType type );
47 void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
48 //Transform the coordinates x, y from current CS to aSystem
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
54 virtual void toReference( double& x, double& y );
55 virtual void fromReference( double& x, double& y );
59 #pragma warning ( default:4251 )