1 // Copyright (C) 2005 OPEN CASCADE
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.
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.
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
17 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 // Author : OPEN CASCADE
22 // File: GLViewer_Compass.cxx
23 // Created: November, 2004
25 //================================================================
26 // Class : GLViewer_Compass
27 // Description : Class implement representatiof of compass in one of corner in GLViewer
28 //================================================================
30 #include "GLViewer_Compass.h"
31 #include "GLViewer_Drawer.h"
33 //=======================================================================
34 // Function: GLViewer_Compass
36 //=======================================================================
37 GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
38 const int WidthTop, const int WidthBottom, const int HeightTop,
39 const int HeightBottom )
44 myArrowWidthTop = WidthTop;
45 myArrowWidthBottom = WidthBottom;
46 myArrowHeightTop = HeightTop;
47 myArrowHeightBottom = HeightBottom;
49 QFont* aFont = new QFont("Times",16);
50 myFont = new GLViewer_TexFont( aFont );
52 //myFont->generateTexture();
55 //=======================================================================
56 // Function: ~GLViewer_Compass
58 //=======================================================================
59 GLViewer_Compass::~GLViewer_Compass()
64 //=======================================================================
65 // Function: setCompass
67 //=======================================================================
68 void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
75 //=======================================================================
76 // Function: setVisible
78 //=======================================================================
79 void GLViewer_Compass::setVisible( const bool vis )
84 //=======================================================================
87 //=======================================================================
88 void GLViewer_Compass::setSize( const int size )
94 //=======================================================================
95 // Function: setArrowWidthTop
97 //=======================================================================
98 void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
100 if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
102 myArrowWidthTop=WidthTop;
105 //=======================================================================
106 // Function: setArrowWidthBottom
108 //=======================================================================
109 void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
111 if( WidthBot > myArrowWidthTop || WidthBot < 1 )
113 myArrowWidthBottom=WidthBot;
116 //=======================================================================
117 // Function: setArrowHeightTop
119 //=======================================================================
120 void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
122 if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
124 myArrowHeightTop=HeightTop;
127 //=======================================================================
128 // Function: setArrowHeightBottom
130 //=======================================================================
131 void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
133 if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
135 myArrowHeightBottom=HeightBot;
138 //=======================================================================
141 //=======================================================================
142 GLViewer_TexFont* GLViewer_Compass::getFont()
146 myFont->generateTexture();
152 //=======================================================================
155 //=======================================================================
156 void GLViewer_Compass::setFont( QFont theFont )
159 myFont = new GLViewer_TexFont( &theFont );