src/GLViewer/GLViewer_CoordSystem.h

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