1 // File: GLViewer_Compass.cxx
2 // Created: November, 2004
4 // Copyright (C) CEA 2004
6 //================================================================
7 // Class : GLViewer_Compass
8 // Description : Class implement representatiof of compass in one of corner in GLViewer
9 //================================================================
11 #include "GLViewer_Compass.h"
12 #include "GLViewer_Drawer.h"
14 //=======================================================================
15 // Function: GLViewer_Compass
17 //=======================================================================
18 GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
19 const int WidthTop, const int WidthBottom, const int HeightTop,
20 const int HeightBottom )
25 myArrowWidthTop = WidthTop;
26 myArrowWidthBottom = WidthBottom;
27 myArrowHeightTop = HeightTop;
28 myArrowHeightBottom = HeightBottom;
30 QFont* aFont = new QFont("Times",16);
31 myFont = new GLViewer_TexFont( aFont );
33 //myFont->generateTexture();
36 //=======================================================================
37 // Function: ~GLViewer_Compass
39 //=======================================================================
40 GLViewer_Compass::~GLViewer_Compass()
45 //=======================================================================
46 // Function: setCompass
48 //=======================================================================
49 void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
56 //=======================================================================
57 // Function: setVisible
59 //=======================================================================
60 void GLViewer_Compass::setVisible( const bool vis )
65 //=======================================================================
68 //=======================================================================
69 void GLViewer_Compass::setSize( const int size )
75 //=======================================================================
76 // Function: setArrowWidthTop
78 //=======================================================================
79 void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
81 if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
83 myArrowWidthTop=WidthTop;
86 //=======================================================================
87 // Function: setArrowWidthBottom
89 //=======================================================================
90 void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
92 if( WidthBot > myArrowWidthTop || WidthBot < 1 )
94 myArrowWidthBottom=WidthBot;
97 //=======================================================================
98 // Function: setArrowHeightTop
100 //=======================================================================
101 void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
103 if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
105 myArrowHeightTop=HeightTop;
108 //=======================================================================
109 // Function: setArrowHeightBottom
111 //=======================================================================
112 void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
114 if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
116 myArrowHeightBottom=HeightBot;
119 //=======================================================================
122 //=======================================================================
123 GLViewer_TexFont* GLViewer_Compass::getFont()
127 myFont->generateTexture();
133 //=======================================================================
136 //=======================================================================
137 void GLViewer_Compass::setFont( QFont theFont )
140 myFont = new GLViewer_TexFont( &theFont );