Back to index

salome-gui  6.5.0
GLViewer_CoordSystem.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  Author : OPEN CASCADE
00024 // File:      GLViewer_CoordSystem.h
00025 // Created:   November, 2004
00026 //
00031 #ifndef GLVIEWER_COORDSYSTEM_H
00032 #define GLVIEWER_COORDSYSTEM_H
00033 
00034 #include "GLViewer.h"
00035 
00036 #ifdef WIN32
00037 #pragma warning( disable:4251 )
00038 #endif
00039 
00044 class GLVIEWER_API GLViewer_CoordSystem
00045 {
00046 public:
00048   enum CSType
00049   {
00050     Cartesian,
00051     Polar     
00052   };
00053   
00054 private:
00056   double myX0, myY0;
00058   double myXUnit, myYUnit;
00060   double myRotation;
00061   
00063   CSType myType;
00064   
00065 public:
00067   GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0, 
00068                         double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 );
00069   
00071   void getOrigin( double& x, double& y ) const;
00073   void setOrigin( double x, double y );
00074   
00076   void getUnits( double& x, double& y ) const;
00078   void setUnits( double x, double y );
00079   
00081   double getRotation() const;
00083   void   setRotation( double rotation );
00084   
00086   CSType getType() const;
00088   void setType( CSType type );
00089   
00091   void transform( GLViewer_CoordSystem& aSystem, double& x, double& y );
00092   
00093   
00095   virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY );
00096   
00097   
00098 protected:
00100   virtual void toReference( double& x, double& y );
00102   virtual void fromReference( double& x, double& y );
00103 };
00104 
00105 #ifdef WIN32
00106 #pragma warning ( default:4251 )
00107 #endif
00108 
00109 #endif