1 // Copyright (C) 2007-2008 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
22 // Author : OPEN CASCADE
23 // File: GLViewer_Compass.cxx
24 // Created: November, 2004
26 #include "GLViewer_Compass.h"
27 #include "GLViewer_Drawer.h"
31 \param color - a color of compass
32 \param size - a diameter of compass
33 \param pos - a position
34 \param WidthTop - width of wide part of arrow
35 \param WidthBottom - width of base part of arrow
36 \param HeightTop - height of arrow header
37 \param HeightBottom - height of arrow cut on bottom
39 GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
40 const int WidthTop, const int WidthBottom, const int HeightTop,
41 const int HeightBottom )
46 myArrowWidthTop = WidthTop;
47 myArrowWidthBottom = WidthBottom;
48 myArrowHeightTop = HeightTop;
49 myArrowHeightBottom = HeightBottom;
51 QFont* aFont = new QFont("Times",16);
52 myFont = new GLViewer_TexFont( aFont );
54 //myFont->generateTexture();
60 GLViewer_Compass::~GLViewer_Compass()
66 Sets parameters of compass
67 \param color - a color of compass
68 \param size - a diameter of compass
69 \param pos - a position
71 void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
79 Sets visibility of compass
80 \param vis - new visibility state
82 void GLViewer_Compass::setVisible( const bool vis )
89 \param size - new size
91 void GLViewer_Compass::setSize( const int size )
99 \param WidthTop - new arrow width top
101 void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
103 if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
105 myArrowWidthTop=WidthTop;
109 Sets arrow width bottom
110 \param WidthBot - new arrow width bottom
112 void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
114 if( WidthBot > myArrowWidthTop || WidthBot < 1 )
116 myArrowWidthBottom=WidthBot;
120 Sets arrow height top
121 \param HeightTop - new arrow height top
123 void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
125 if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
127 myArrowHeightTop=HeightTop;
131 Sets arrow height bottom
132 \param HeightBot - new arrow height bottom
134 void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
136 if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
138 myArrowHeightBottom=HeightBot;
142 \return font of compass
144 GLViewer_TexFont* GLViewer_Compass::getFont()
148 myFont->generateTexture();
156 \param theFont - new font
158 void GLViewer_Compass::setFont( QFont theFont )
161 myFont = new GLViewer_TexFont( &theFont );