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