1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // Author : OPEN CASCADE
24 // File: GLViewer_Compass.cxx
25 // Created: November, 2004
27 #include "GLViewer_Compass.h"
28 #include "GLViewer_Drawer.h"
32 \param color - a color of compass
33 \param size - a diameter of compass
34 \param pos - a position
35 \param WidthTop - width of wide part of arrow
36 \param WidthBottom - width of base part of arrow
37 \param HeightTop - height of arrow header
38 \param HeightBottom - height of arrow cut on bottom
40 GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
41 const int WidthTop, const int WidthBottom, const int HeightTop,
42 const int HeightBottom )
47 myArrowWidthTop = WidthTop;
48 myArrowWidthBottom = WidthBottom;
49 myArrowHeightTop = HeightTop;
50 myArrowHeightBottom = HeightBottom;
52 QFont* aFont = new QFont("Times",16);
53 myFont = new GLViewer_TexFont( aFont );
55 //myFont->generateTexture();
61 GLViewer_Compass::~GLViewer_Compass()
67 Sets parameters of compass
68 \param color - a color of compass
69 \param size - a diameter of compass
70 \param pos - a position
72 void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
80 Sets visibility of compass
81 \param vis - new visibility state
83 void GLViewer_Compass::setVisible( const bool vis )
90 \param size - new size
92 void GLViewer_Compass::setSize( const int size )
100 \param WidthTop - new arrow width top
102 void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
104 if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
106 myArrowWidthTop=WidthTop;
110 Sets arrow width bottom
111 \param WidthBot - new arrow width bottom
113 void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
115 if( WidthBot > myArrowWidthTop || WidthBot < 1 )
117 myArrowWidthBottom=WidthBot;
121 Sets arrow height top
122 \param HeightTop - new arrow height top
124 void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
126 if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
128 myArrowHeightTop=HeightTop;
132 Sets arrow height bottom
133 \param HeightBot - new arrow height bottom
135 void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
137 if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
139 myArrowHeightBottom=HeightBot;
143 \return font of compass
145 GLViewer_TexFont* GLViewer_Compass::getFont()
149 myFont->generateTexture();
157 \param theFont - new font
159 void GLViewer_Compass::setFont( QFont theFont )
162 myFont = new GLViewer_TexFont( &theFont );