1 // Copyright (C) 2005 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 // Author : OPEN CASCADE
22 // File: GLViewer_CoordSystem.h
23 // Created: November, 2004
25 /*! Class GLViewer_CoordSystem
26 * Class implementing mathematical model of 2D coordinate system
29 #ifndef GLVIEWER_COORDSYSTEM_H
30 #define GLVIEWER_COORDSYSTEM_H
35 #pragma warning( disable:4251 )
39 \class GLViewer_CoordSystem
40 \brief Class implementing mathematical model of 2D coordinate system
42 class GLVIEWER_API GLViewer_CoordSystem
45 //! A type of coordinate system
53 //! The coordinates of origin in the reference CS
55 //! The lengths of axis units in the reference unit
56 double myXUnit, myYUnit;
57 //! The rotation in radians relative to reference CS
60 //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
64 //! A constructor ( by default new system is identical to reference )
65 GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0,
66 double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
68 //! Returns the origin in reference system
69 void getOrigin( double& x, double& y ) const;
70 //! A function installing the origin in reference system
71 void setOrigin( double x, double y );
73 //! Returns units along axes
74 void getUnits( double& x, double& y ) const;
75 //! A function installing units along axes
76 void setUnits( double x, double y );
78 //! Returns rotation angle of axes in reference system
79 double getRotation() const;
80 //! A function installing rotation angle of axes in reference system
81 void setRotation( double rotation );
83 //! Returns type of system
84 CSType getType() const;
85 //! A function installing type of system
86 void setType( CSType type );
88 //! Transform the coordinates x, y from current CS to aSystem
89 void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
92 //! Return how many times line width in aSystem system bigger than in current
93 virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
97 //! A function transforms system coords to coords in reference system
98 virtual void toReference( double& x, double& y );
99 //! A function transforms from coords in reference system to system coords
100 virtual void fromReference( double& x, double& y );
104 #pragma warning ( default:4251 )