From 4b1c40f343416f11d6f0bf7433fb96b922108e94 Mon Sep 17 00:00:00 2001 From: abd Date: Tue, 5 Jul 2005 05:17:55 +0000 Subject: [PATCH] Update comments --- src/GLViewer/GLViewer_Compass.cxx | 99 +++++++++++++++++++- src/GLViewer/GLViewer_Compass.h | 145 +++++++++++++++++++----------- src/GLViewer/GLViewer_Widget.cxx | 4 +- src/GLViewer/GLViewer_Widget.h | 8 -- 4 files changed, 194 insertions(+), 62 deletions(-) diff --git a/src/GLViewer/GLViewer_Compass.cxx b/src/GLViewer/GLViewer_Compass.cxx index 0f821173a..097a6edf8 100644 --- a/src/GLViewer/GLViewer_Compass.cxx +++ b/src/GLViewer/GLViewer_Compass.cxx @@ -3,13 +3,22 @@ // Author: OCC team // Copyright (C) CEA 2004 -//#include +//================================================================ +// 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; diff --git a/src/GLViewer/GLViewer_Compass.h b/src/GLViewer/GLViewer_Compass.h index 0d03856f6..dafa45619 100644 --- a/src/GLViewer/GLViewer_Compass.h +++ b/src/GLViewer/GLViewer_Compass.h @@ -14,69 +14,114 @@ #pragma warning( disable:4251 ) #endif +/*! Class GLViewer_Compass + * Class implement representatiof of compass in one of corner in GLViewer. + * Compass it's a some round visual pointer rotated with view window and + * located in fixed place (in one fixed corner) + */ + class GLViewer_TexFont; class GLVIEWER_API GLViewer_Compass { public: - enum Position { TopLeft, TopRight, BottomLeft, BottomRight }; - - GLViewer_Compass( const QColor& color = QColor ( 0, 255, 0 ), + //! Position of compass + enum Position + { + TopLeft, + TopRight, + BottomLeft, + BottomRight + }; + + //! A constructor + /*! + *\param color - a color of compass + *\param size - a diameter of compass + *\param pos - a position + *\param WidthTop - width of wide part of arrow + *\param WidthBottom - width of base part of arrow + *\param HeightTop - height of arrow header + *\param HeightBottom - height of arrow cut on bottom + */ + GLViewer_Compass( const QColor& color = QColor ( 0, 255, 0 ), const int size = 60, const Position pos = TopRight, const int WidthTop = 20, const int WidthBottom = 10, const int HeightTop = 25, const int HeightBottom = 7 ); - ~GLViewer_Compass(); - - void setCompass( const QColor& color, const int size, const Position pos ) - {myCol=color;mySize=size;myPos=pos;}; - void setVisible( const bool vis = true ); - bool getVisible(){ return myIsVisible; }; - - void setSize( const int size ){mySize=size;}; - int getSize(){ return mySize; }; - - void setPos( const Position pos ){myPos=pos;}; - int getPos(){ return myPos; }; - - void setColor( const QColor& color ){myCol=color;}; - QColor getColor(){ return myCol; }; - - void setArrowWidthTop( const int WidthTop ){ if( WidthTopmySize ) return; - myArrowWidthTop=WidthTop; }; - int getArrowWidthTop(){return myArrowWidthTop;}; - - void setArrowWidthBottom( const int WidthBot ){ if( WidthBot>myArrowWidthTop || WidthBot<1 )return; - myArrowWidthBottom=WidthBot; }; - int getArrowWidthBottom(){return myArrowWidthBottom;}; - - void setArrowHeightTop( const int HeightTop ){ if( HeightTop>(2*mySize-myArrowHeightBottom ) || - HeightTop<1 )return; - myArrowHeightTop=HeightTop;}; - int getArrowHeightTop(){return myArrowHeightTop;}; - - void setArrowHeightBottom( const int HeightBot ){ if( HeightBot>( 2*mySize-myArrowHeightTop ) || - HeightBot<1)return; - myArrowHeightBottom=HeightBot;}; - int getArrowHeightBottom(){return myArrowHeightBottom;}; - - GLViewer_TexFont* getFont(); - void setFont( QFont theFont ); + //! A destructor + ~GLViewer_Compass(); + + //! A function installing main parameters of compass + void setCompass( const QColor& color, const int size, const Position pos ); + //! A function installing a visible status + void setVisible( const bool vis = true ); + //! Returns visible status + bool getVisible(){ return myIsVisible; }; + + //! A function installing diameter + void setSize( const int size ); + //! Returns diameter + int getSize(){ return mySize; } + + //! A function installing position + void setPos( const Position pos ){ myPos = pos; } + //! Returns position + int getPos(){ return myPos; } + + //! A function installing color + void setColor( const QColor& color ){ myCol = color; } + //! Returns color + QColor getColor(){ return myCol; } + + //! A function installing width of wide part of arrow + void setArrowWidthTop( const int WidthTop ); + //! Returns width of wide part of arrow + int getArrowWidthTop(){ return myArrowWidthTop; } + + //! A function installing width of base part of arrow + void setArrowWidthBottom( const int WidthBot ); + //! Returns width of base part of arrow + int getArrowWidthBottom(){return myArrowWidthBottom;}; + + //! A function installing height of arrow header + void setArrowHeightTop( const int HeightTop ); + //! Returns height of arrow header + int getArrowHeightTop(){return myArrowHeightTop;}; + + //! A function installing height of arrow cut on bottom + void setArrowHeightBottom( const int HeightBot ); + //! Returns height of arrow cut on bottom + int getArrowHeightBottom(){return myArrowHeightBottom;}; + + //! A function installing + void setFont( QFont theFont ); + //! Returns + GLViewer_TexFont* getFont(); protected: - QColor myCol; - int mySize; - int myPos; - bool myIsVisible; - int myArrowWidthTop; - int myArrowWidthBottom; - int myArrowHeightTop; - int myArrowHeightBottom; - GLViewer_TexFont* myFont; - bool isGenereted; + //! Compass color + QColor myCol; + //! Compass diameter + int mySize; + //! Compass position + int myPos; + //! Compass invisible status + bool myIsVisible; + //! Width of wide part of arrow + int myArrowWidthTop; + //! Width of base part of arrow + int myArrowWidthBottom; + //! Height of arrow header + int myArrowHeightTop; + //! Height of arrow cut on bottom + int myArrowHeightBottom; + //! Compass font + GLViewer_TexFont* myFont; + //! Status of generated font + bool isGenereted; }; #ifdef WNT diff --git a/src/GLViewer/GLViewer_Widget.cxx b/src/GLViewer/GLViewer_Widget.cxx index 45f4b942d..3ec22e82f 100644 --- a/src/GLViewer/GLViewer_Widget.cxx +++ b/src/GLViewer/GLViewer_Widget.cxx @@ -424,8 +424,8 @@ inline char hex( uchar c ) return '0'+c; else if( c < 16 ) return 'a' + c - 10; - else - ' '; + + return ' '; } //======================================================================= diff --git a/src/GLViewer/GLViewer_Widget.h b/src/GLViewer/GLViewer_Widget.h index 4e48852b6..917391c24 100644 --- a/src/GLViewer/GLViewer_Widget.h +++ b/src/GLViewer/GLViewer_Widget.h @@ -3,16 +3,8 @@ // Author: OCC team // Copyright (C) CEA 2004 -/*************************************************************************** -** Class: GLViewer_Widget -** Descr: OpenGL Widget for GLViewer -** Module: GLViewer -** Created: UI team, 27.03.03 -****************************************************************************/ - /*! Class GLViewer_Widget * Class for visualization OpenGL scene (widget) for GLViewer - * */ #ifndef GLVIEWER_WIDGET_H #define GLVIEWER_WIDGET_H -- 2.30.2