1 // Copyright (C) 2007-2023 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, or (at your option) any later version.
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
23 // Author : OPEN CASCADE
24 // File: GLViewer_CoordSystem.h
25 // Created: November, 2004
27 /*! Class GLViewer_CoordSystem
28 * Class implementing mathematical model of 2D coordinate system
31 #ifndef GLVIEWER_COORDSYSTEM_H
32 #define GLVIEWER_COORDSYSTEM_H
37 #pragma warning( disable:4251 )
41 \class GLViewer_CoordSystem
42 \brief Class implementing mathematical model of 2D coordinate system
44 class GLVIEWER_API GLViewer_CoordSystem
47 //! A type of coordinate system
55 //! The coordinates of origin in the reference CS
57 //! The lengths of axis units in the reference unit
58 double myXUnit, myYUnit;
59 //! The rotation in radians relative to reference CS
62 //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
66 //! A constructor ( by default new system is identical to reference )
67 GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0,
68 double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
70 //! Returns the origin in reference system
71 void getOrigin( double& x, double& y ) const;
72 //! A function installing the origin in reference system
73 void setOrigin( double x, double y );
75 //! Returns units along axes
76 void getUnits( double& x, double& y ) const;
77 //! A function installing units along axes
78 void setUnits( double x, double y );
80 //! Returns rotation angle of axes in reference system
81 double getRotation() const;
82 //! A function installing rotation angle of axes in reference system
83 void setRotation( double rotation );
85 //! Returns type of system
86 CSType getType() const;
87 //! A function installing type of system
88 void setType( CSType type );
90 //! Transform the coordinates x, y from current CS to aSystem
91 void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
94 //! Return how many times line width in aSystem system bigger than in current
95 virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
99 //! A function transforms system coords to coords in reference system
100 virtual void toReference( double& x, double& y );
101 //! A function transforms from coords in reference system to system coords
102 virtual void fromReference( double& x, double& y );
106 #pragma warning ( default:4251 )