Salome HOME
PAL10125 - by double click on reference original object becomes selected
[modules/gui.git] / src / GLViewer / GLViewer_Compass.cxx
index 0f821173a31edbde3cee587d3c4fbe8579d500b8..097a6edf87c337c962ac2a40914795c657a983f9 100644 (file)
@@ -3,13 +3,22 @@
 // Author:    OCC team
 // Copyright (C) CEA 2004
 
-//#include <GLViewerAfx.h>
+//================================================================
+// Class       : GLViewer_Compass
+// Description : Class implement representatiof of compass in one of corner in GLViewer
+//================================================================
+
 #include "GLViewer_Compass.h"
 #include "GLViewer_Drawer.h"
 
+//=======================================================================
+// Function: GLViewer_Compass
+// Purpose :
+//=======================================================================
 GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
                                const int WidthTop, const int WidthBottom, const int HeightTop,
-                               const int HeightBottom ){
+                               const int HeightBottom )
+{
     myCol = color;
     mySize = size;
     myPos = pos;
@@ -24,11 +33,93 @@ GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const
     //myFont->generateTexture();
 }
 
+//=======================================================================
+// Function: ~GLViewer_Compass
+// Purpose :
+//=======================================================================
 GLViewer_Compass::~GLViewer_Compass()
 {
     delete myFont;
 }
 
+//=======================================================================
+// Function: setCompass
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
+{
+  myCol = color;
+  mySize = size;
+  myPos = pos;
+}
+
+//=======================================================================
+// Function: setVisible
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setVisible( const bool vis )
+{
+  myIsVisible = vis;
+}
+
+//=======================================================================
+// Function: setSize
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setSize( const int size )
+{
+  if( size > 0 )
+    mySize=size;
+}
+
+//=======================================================================
+// Function: setArrowWidthTop
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
+{
+  if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
+    return;
+  myArrowWidthTop=WidthTop;
+}
+
+//=======================================================================
+// Function: setArrowWidthBottom
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
+{ 
+  if( WidthBot > myArrowWidthTop || WidthBot < 1 )
+    return;    
+  myArrowWidthBottom=WidthBot;
+}
+
+//=======================================================================
+// Function: setArrowHeightTop
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
+{
+  if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
+    return;
+  myArrowHeightTop=HeightTop;
+}
+
+//=======================================================================
+// Function: setArrowHeightBottom
+// Purpose :
+//=======================================================================
+void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
+{
+  if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
+    return;
+  myArrowHeightBottom=HeightBot;
+}
+
+//=======================================================================
+// Function: getFont
+// Purpose :
+//=======================================================================
 GLViewer_TexFont* GLViewer_Compass::getFont()
 { 
     if(!isGenereted) 
@@ -39,6 +130,10 @@ GLViewer_TexFont* GLViewer_Compass::getFont()
     return myFont;
 }
 
+//=======================================================================
+// Function: setFont
+// Purpose :
+//=======================================================================
 void GLViewer_Compass::setFont( QFont theFont )
 {
     delete myFont;