]> SALOME platform Git repositories - modules/gui.git/blob - src/GLViewer/GLViewer_Compass.h
Salome HOME
bb3b98913ebeacd5e11f6decb48d65ffc6ac1467
[modules/gui.git] / src / GLViewer / GLViewer_Compass.h
1 //  Copyright (C) 2005 OPEN CASCADE
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
18 //
19 //  Author : OPEN CASCADE
20 //
21
22 // File:      GLViewer_Compass.h
23 // Created:   November, 2004
24
25 #ifndef GLVIEWER_COMPASS_H
26 #define GLVIEWER_COMPASS_H
27
28 #include "GLViewer.h"
29
30 #include <qcolor.h>
31
32 #ifdef WNT
33 #pragma warning( disable:4251 )
34 #endif
35
36 class GLViewer_TexFont;
37
38 /*! Class GLViewer_Compass
39  * Class implement representatiof of compass in one of corner in GLViewer.
40  * Compass it's a some round visual pointer rotated with view window and 
41  * located in fixed place (in one fixed corner)
42  */
43 class GLVIEWER_API GLViewer_Compass
44 {
45 public:
46   //! Position of compass
47   enum Position
48   {
49     TopLeft,
50     TopRight,
51     BottomLeft,
52     BottomRight
53   };
54
55   //! A constructor
56   /*!
57   *\param color        - a color of compass
58   *\param size         - a diameter of compass
59   *\param pos          - a position
60   *\param WidthTop     - width of wide part of arrow
61   *\param WidthBottom  - width of base part of arrow
62   *\param HeightTop    - height of arrow header
63   *\param HeightBottom - height of arrow cut on bottom
64   */
65   GLViewer_Compass( const QColor& color = QColor ( 0, 255, 0 ), 
66                    const int size = 60,
67                    const Position pos = TopRight,
68                    const int WidthTop = 20,
69                    const int WidthBottom = 10,
70                    const int HeightTop = 25,
71                    const int HeightBottom = 7 );
72   //! A destructor
73   ~GLViewer_Compass();
74
75   //! A function installing main parameters of compass
76   void              setCompass( const QColor& color, const int size, const Position pos );
77   //! A function installing a visible status
78   void              setVisible( const bool vis = true );
79   //! Returns visible status
80   bool              getVisible(){ return myIsVisible; };
81   
82   //! A function installing diameter
83   void              setSize( const int size );
84   //! Returns diameter
85   int               getSize(){ return mySize; }
86   
87   //! A function installing position
88   void              setPos( const Position pos ){ myPos = pos; }
89   //! Returns position
90   int               getPos(){ return myPos; }
91   
92   //! A function installing color
93   void              setColor( const QColor& color ){ myCol = color; }
94   //! Returns color
95   QColor            getColor(){ return myCol; }
96
97   //! A function installing width of wide part of arrow
98   void              setArrowWidthTop( const int WidthTop );
99   //! Returns width of wide part of arrow
100   int               getArrowWidthTop(){ return myArrowWidthTop; }
101   
102   //! A function installing width of base part of arrow
103   void              setArrowWidthBottom( const int WidthBot );
104   //! Returns width of base part of arrow
105   int               getArrowWidthBottom(){return myArrowWidthBottom;};
106
107   //! A function installing height of arrow header
108   void              setArrowHeightTop( const int HeightTop );
109   //! Returns height of arrow header
110   int               getArrowHeightTop(){return myArrowHeightTop;};
111   
112   //! A function installing height of arrow cut on bottom
113   void              setArrowHeightBottom( const int HeightBot );
114   //! Returns height of arrow cut on bottom
115   int               getArrowHeightBottom(){return myArrowHeightBottom;};        
116   
117   //! A function installing
118   void              setFont( QFont theFont );
119   //! Returns
120   GLViewer_TexFont* getFont();
121
122 protected:
123   //! Compass color
124   QColor             myCol;
125   //! Compass diameter
126   int                mySize;
127   //! Compass position
128   int                myPos;
129   //! Compass invisible status
130   bool               myIsVisible;
131   //! Width of wide part of arrow
132   int                myArrowWidthTop;
133   //! Width of base part of arrow
134   int                myArrowWidthBottom;
135   //! Height of arrow header
136   int                myArrowHeightTop;
137   //! Height of arrow cut on bottom
138   int                myArrowHeightBottom;
139   //! Compass font
140   GLViewer_TexFont*  myFont;
141   //! Status of generated font
142   bool               isGenereted;
143 };
144
145 #ifdef WNT
146 #pragma warning ( default:4251 )
147 #endif
148
149 #endif