]> SALOME platform Git repositories - modules/gui.git/blob - src/GLViewer/GLViewer_Compass.h
Salome HOME
0ace9ae752630f023988406adaed38b4aad717e8
[modules/gui.git] / src / GLViewer / GLViewer_Compass.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, 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.
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 //  Author : OPEN CASCADE
23 // File:      GLViewer_Compass.h
24 // Created:   November, 2004
25 //
26 #ifndef GLVIEWER_COMPASS_H
27 #define GLVIEWER_COMPASS_H
28
29 #include "GLViewer.h"
30
31 #include <QColor>
32
33 class QFont;
34
35 #ifdef WIN32
36 #pragma warning( disable:4251 )
37 #endif
38
39 class GLViewer_TexFont;
40
41 /*! Class GLViewer_Compass
42  * Class implement representatiof of compass in one of corner in GLViewer.
43  * Compass it's a some round visual pointer rotated with view window and 
44  * located in fixed place (in one fixed corner)
45  */
46 class GLVIEWER_API GLViewer_Compass
47 {
48 public:
49   //! Position of compass
50   enum Position
51   {
52     TopLeft,
53     TopRight,
54     BottomLeft,
55     BottomRight
56   };
57
58   //! A constructor
59   /*!
60   *\param color        - a color of compass
61   *\param size         - a diameter of compass
62   *\param pos          - a position
63   *\param WidthTop     - width of wide part of arrow
64   *\param WidthBottom  - width of base part of arrow
65   *\param HeightTop    - height of arrow header
66   *\param HeightBottom - height of arrow cut on bottom
67   */
68   GLViewer_Compass( const QColor& color = QColor ( 0, 255, 0 ), 
69                    const int size = 60,
70                    const Position pos = TopRight,
71                    const int WidthTop = 20,
72                    const int WidthBottom = 10,
73                    const int HeightTop = 25,
74                    const int HeightBottom = 7 );
75   //! A destructor
76   ~GLViewer_Compass();
77
78   //! A function installing main parameters of compass
79   void              setCompass( const QColor& color, const int size, const Position pos );
80   //! A function installing a visible status
81   void              setVisible( const bool vis = true );
82   //! Returns visible status
83   bool              getVisible(){ return myIsVisible; };
84   
85   //! A function installing diameter
86   void              setSize( const int size );
87   //! Returns diameter
88   int               getSize(){ return mySize; }
89   
90   //! A function installing position
91   void              setPos( const Position pos ){ myPos = pos; }
92   //! Returns position
93   int               getPos(){ return myPos; }
94   
95   //! A function installing color
96   void              setColor( const QColor& color ){ myCol = color; }
97   //! Returns color
98   QColor            getColor(){ return myCol; }
99
100   //! A function installing width of wide part of arrow
101   void              setArrowWidthTop( const int WidthTop );
102   //! Returns width of wide part of arrow
103   int               getArrowWidthTop(){ return myArrowWidthTop; }
104   
105   //! A function installing width of base part of arrow
106   void              setArrowWidthBottom( const int WidthBot );
107   //! Returns width of base part of arrow
108   int               getArrowWidthBottom(){return myArrowWidthBottom;};
109
110   //! A function installing height of arrow header
111   void              setArrowHeightTop( const int HeightTop );
112   //! Returns height of arrow header
113   int               getArrowHeightTop(){return myArrowHeightTop;};
114   
115   //! A function installing height of arrow cut on bottom
116   void              setArrowHeightBottom( const int HeightBot );
117   //! Returns height of arrow cut on bottom
118   int               getArrowHeightBottom(){return myArrowHeightBottom;};        
119   
120   //! A function installing
121   void              setFont( QFont theFont );
122   //! Returns
123   GLViewer_TexFont* getFont();
124
125 protected:
126   //! Compass color
127   QColor             myCol;
128   //! Compass diameter
129   int                mySize;
130   //! Compass position
131   int                myPos;
132   //! Compass invisible status
133   bool               myIsVisible;
134   //! Width of wide part of arrow
135   int                myArrowWidthTop;
136   //! Width of base part of arrow
137   int                myArrowWidthBottom;
138   //! Height of arrow header
139   int                myArrowHeightTop;
140   //! Height of arrow cut on bottom
141   int                myArrowHeightBottom;
142   //! Compass font
143   GLViewer_TexFont*  myFont;
144   //! Status of generated font
145   bool               isGenereted;
146 };
147
148 #ifdef WIN32
149 #pragma warning ( default:4251 )
150 #endif
151
152 #endif