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 )
38 class GLVIEWER_API GLViewer_CoordSystem
41 //! A type of coordinate system
49 //! The coordinates of origin in the reference CS
51 //! The lengths of axis units in the reference unit
52 double myXUnit, myYUnit;
53 //! The rotation in radians relative to reference CS
56 //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
60 //! A constructor ( by default new system is identical to reference )
61 GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0,
62 double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
64 //! Returns the origin in reference system
65 void getOrigin( double& x, double& y ) const;
66 //! A function installing the origin in reference system
67 void setOrigin( double x, double y );
69 //! Returns units along axes
70 void getUnits( double& x, double& y ) const;
71 //! A function installing units along axes
72 void setUnits( double x, double y );
74 //! Returns rotation angle of axes in reference system
75 double getRotation() const;
76 //! A function installing rotation angle of axes in reference system
77 void setRotation( double rotation );
79 //! Returns type of system
80 CSType getType() const;
81 //! A function installing type of system
82 void setType( CSType type );
84 //! Transform the coordinates x, y from current CS to aSystem
85 void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
88 //! Return how many times line width in aSystem system bigger than in current
89 virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
93 //! A function transforms system coords to coords in reference system
94 virtual void toReference( double& x, double& y );
95 //! A function transforms from coords in reference system to system coords
96 virtual void fromReference( double& x, double& y );
100 #pragma warning ( default:4251 )