Version: 9.12.0
GLViewer_CoordSystem.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // Author : OPEN CASCADE
24 // File: GLViewer_CoordSystem.h
25 // Created: November, 2004
26 //
31 #ifndef GLVIEWER_COORDSYSTEM_H
32 #define GLVIEWER_COORDSYSTEM_H
33 
34 #include "GLViewer.h"
35 
36 #ifdef WIN32
37 #pragma warning( disable:4251 )
38 #endif
39 
45 {
46 public:
48  enum CSType
49  {
51  Polar
52  };
53 
54 private:
56  double myX0, myY0;
58  double myXUnit, myYUnit;
60  double myRotation;
61 
64 
65 public:
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 );
69 
71  void getOrigin( double& x, double& y ) const;
73  void setOrigin( double x, double y );
74 
76  void getUnits( double& x, double& y ) const;
78  void setUnits( double x, double y );
79 
81  double getRotation() const;
83  void setRotation( double rotation );
84 
86  CSType getType() const;
88  void setType( CSType type );
89 
91  void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
92 
93 
95  virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
96 
97 
98 protected:
100  virtual void toReference( double& x, double& y );
102  virtual void fromReference( double& x, double& y );
103 };
104 
105 #ifdef WIN32
106 #pragma warning ( default:4251 )
107 #endif
108 
109 #endif
#define GLVIEWER_API
Macro for exports.
Definition: GLViewer.h:37
Class implementing mathematical model of 2D coordinate system.
Definition: GLViewer_CoordSystem.h:45
CSType
A type of coordinate system.
Definition: GLViewer_CoordSystem.h:49
@ Cartesian
Definition: GLViewer_CoordSystem.h:50
double myX0
The coordinates of origin in the reference CS.
Definition: GLViewer_CoordSystem.h:56
double myXUnit
The lengths of axis units in the reference unit.
Definition: GLViewer_CoordSystem.h:58
double myRotation
The rotation in radians relative to reference CS.
Definition: GLViewer_CoordSystem.h:60
CSType myType
In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius
Definition: GLViewer_CoordSystem.h:63