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 #include "GLViewer_Compass.h"
26 #include "GLViewer_Drawer.h"
30 \param color - a color of compass
31 \param size - a diameter of compass
32 \param pos - a position
33 \param WidthTop - width of wide part of arrow
34 \param WidthBottom - width of base part of arrow
35 \param HeightTop - height of arrow header
36 \param HeightBottom - height of arrow cut on bottom
38 GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
39 const int WidthTop, const int WidthBottom, const int HeightTop,
40 const int HeightBottom )
45 myArrowWidthTop = WidthTop;
46 myArrowWidthBottom = WidthBottom;
47 myArrowHeightTop = HeightTop;
48 myArrowHeightBottom = HeightBottom;
50 QFont* aFont = new QFont("Times",16);
51 myFont = new GLViewer_TexFont( aFont );
53 //myFont->generateTexture();
59 GLViewer_Compass::~GLViewer_Compass()
65 Sets parameters of compass
66 \param color - a color of compass
67 \param size - a diameter of compass
68 \param pos - a position
70 void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
78 Sets visibility of compass
79 \param vis - new visibility state
81 void GLViewer_Compass::setVisible( const bool vis )
88 \param size - new size
90 void GLViewer_Compass::setSize( const int size )
98 \param WidthTop - new arrow width top
100 void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
102 if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
104 myArrowWidthTop=WidthTop;
108 Sets arrow width bottom
109 \param WidthBot - new arrow width bottom
111 void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
113 if( WidthBot > myArrowWidthTop || WidthBot < 1 )
115 myArrowWidthBottom=WidthBot;
119 Sets arrow height top
120 \param HeightTop - new arrow height top
122 void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
124 if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
126 myArrowHeightTop=HeightTop;
130 Sets arrow height bottom
131 \param HeightBot - new arrow height bottom
133 void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
135 if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
137 myArrowHeightBottom=HeightBot;
141 \return font of compass
143 GLViewer_TexFont* GLViewer_Compass::getFont()
147 myFont->generateTexture();
155 \param theFont - new font
157 void GLViewer_Compass::setFont( QFont theFont )
160 myFont = new GLViewer_TexFont( &theFont );