1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // Author : OPEN CASCADE
23 // File: GLViewer_CoordSystem.h
24 // Created: November, 2004
26 /*! Class GLViewer_CoordSystem
27 * Class implementing mathematical model of 2D coordinate system
30 #ifndef GLVIEWER_COORDSYSTEM_H
31 #define GLVIEWER_COORDSYSTEM_H
36 #pragma warning( disable:4251 )
40 \class GLViewer_CoordSystem
41 \brief Class implementing mathematical model of 2D coordinate system
43 class GLVIEWER_API GLViewer_CoordSystem
46 //! A type of coordinate system
54 //! The coordinates of origin in the reference CS
56 //! The lengths of axis units in the reference unit
57 double myXUnit, myYUnit;
58 //! The rotation in radians relative to reference CS
61 //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
65 //! A constructor ( by default new system is identical to reference )
66 GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0,
67 double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
69 //! Returns the origin in reference system
70 void getOrigin( double& x, double& y ) const;
71 //! A function installing the origin in reference system
72 void setOrigin( double x, double y );
74 //! Returns units along axes
75 void getUnits( double& x, double& y ) const;
76 //! A function installing units along axes
77 void setUnits( double x, double y );
79 //! Returns rotation angle of axes in reference system
80 double getRotation() const;
81 //! A function installing rotation angle of axes in reference system
82 void setRotation( double rotation );
84 //! Returns type of system
85 CSType getType() const;
86 //! A function installing type of system
87 void setType( CSType type );
89 //! Transform the coordinates x, y from current CS to aSystem
90 void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
93 //! Return how many times line width in aSystem system bigger than in current
94 virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
98 //! A function transforms system coords to coords in reference system
99 virtual void toReference( double& x, double& y );
100 //! A function transforms from coords in reference system to system coords
101 virtual void fromReference( double& x, double& y );
105 #pragma warning ( default:4251 )