From ca6c70bd15888367063d08008e245dafcb26c544 Mon Sep 17 00:00:00 2001 From: abd Date: Mon, 4 Jul 2005 04:58:25 +0000 Subject: [PATCH] Update comments --- src/GLViewer/GLViewer_Context.cxx | 42 ++++++++-------- src/GLViewer/GLViewer_CoordSystem.cxx | 70 +++++++++++++++++++++++---- src/GLViewer/GLViewer_CoordSystem.h | 42 ++++++++++++---- 3 files changed, 114 insertions(+), 40 deletions(-) diff --git a/src/GLViewer/GLViewer_Context.cxx b/src/GLViewer/GLViewer_Context.cxx index 699df866d..264a5657f 100644 --- a/src/GLViewer/GLViewer_Context.cxx +++ b/src/GLViewer/GLViewer_Context.cxx @@ -164,7 +164,7 @@ int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle ) } //======================================================================= -// Function: GLViewer_Select +// Function: Select // Purpose : //======================================================================= int GLViewer_Context::Select( bool Append, bool byCircle ) @@ -295,7 +295,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle ) } //======================================================================= -// Function: GLViewer_SelectByRect +// Function: SelectByRect // Purpose : //======================================================================= int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append ) @@ -357,7 +357,7 @@ int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append ) } //======================================================================= -// Function: GLViewer_SetHighlightColor +// Function: SetHighlightColor // Purpose : //======================================================================= void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol ) @@ -380,7 +380,7 @@ void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol ) } //======================================================================= -// Function: GLViewer_SetSelectionColor +// Function: SetSelectionColor // Purpose : //======================================================================= void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol ) @@ -403,7 +403,7 @@ void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol ) } //======================================================================= -// Function: GLViewer_NbSelected +// Function: NbSelected // Purpose : //======================================================================= int GLViewer_Context::NbSelected() @@ -412,7 +412,7 @@ int GLViewer_Context::NbSelected() } //======================================================================= -// Function: GLViewer_InitSelected +// Function: InitSelected // Purpose : //======================================================================= void GLViewer_Context::InitSelected() @@ -421,7 +421,7 @@ void GLViewer_Context::InitSelected() } //======================================================================= -// Function: GLViewer_MoreSelected +// Function: MoreSelected // Purpose : //======================================================================= bool GLViewer_Context::MoreSelected() @@ -430,7 +430,7 @@ bool GLViewer_Context::MoreSelected() } //======================================================================= -// Function: GLViewer_NextSelected +// Function: NextSelected // Purpose : //======================================================================= bool GLViewer_Context::NextSelected() @@ -445,7 +445,7 @@ bool GLViewer_Context::NextSelected() } //======================================================================= -// Function: GLViewer_SelectedObject +// Function: SelectedObject // Purpose : //======================================================================= GLViewer_Object* GLViewer_Context::SelectedObject() @@ -454,7 +454,7 @@ GLViewer_Object* GLViewer_Context::SelectedObject() } //======================================================================= -// Function: GLViewer_isSelected +// Function: isSelected // Purpose : //======================================================================= bool GLViewer_Context::isSelected( GLViewer_Object* theObj ) @@ -463,7 +463,7 @@ bool GLViewer_Context::isSelected( GLViewer_Object* theObj ) } //======================================================================= -// Function: GLViewer_insertObject +// Function: insertObject // Purpose : //======================================================================= int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool isActive ) @@ -490,7 +490,7 @@ int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool } //======================================================================= -// Function: GLViewer_replaceObject +// Function: replaceObject // Purpose : //======================================================================= bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject ) @@ -516,7 +516,7 @@ bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Objec } //======================================================================= -// Function: GLViewer_updateScales +// Function: updateScales // Purpose : //======================================================================= void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY ) @@ -534,7 +534,7 @@ void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY ) } //======================================================================= -// Function: GLViewer_clearHighlighted +// Function: clearHighlighted // Purpose : //======================================================================= void GLViewer_Context::clearHighlighted() @@ -549,7 +549,7 @@ void GLViewer_Context::clearHighlighted() } //======================================================================= -// Function: GLViewer_clearSelected +// Function: clearSelected // Purpose : //======================================================================= void GLViewer_Context::clearSelected( bool updateViewer ) @@ -572,7 +572,7 @@ void GLViewer_Context::clearSelected( bool updateViewer ) } //======================================================================= -// Function: GLViewer_setSelected +// Function: setSelected // Purpose : //======================================================================= void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer ) @@ -591,7 +591,7 @@ void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer ) } //======================================================================= -// Function: GLViewer_remSelected +// Function: remSelected // Purpose : //======================================================================= void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer ) @@ -607,7 +607,7 @@ void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer ) } //======================================================================= -// Function: GLViewer_eraseObject +// Function: eraseObject // Purpose : //======================================================================= void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateViewer ) @@ -624,7 +624,7 @@ void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateVi } //======================================================================= -// Function: GLViewer_deleteObject +// Function: deleteObject // Purpose : //======================================================================= void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateViewer ) @@ -654,7 +654,7 @@ void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateView } //======================================================================= -// Function: GLViewer_setActive +// Function: setActive // Purpose : //======================================================================= bool GLViewer_Context::setActive( GLViewer_Object* theObject ) @@ -668,7 +668,7 @@ bool GLViewer_Context::setActive( GLViewer_Object* theObject ) } //======================================================================= -// Function: GLViewer_setInactive +// Function: setInactive // Purpose : //======================================================================= bool GLViewer_Context::setInactive( GLViewer_Object* theObject ) diff --git a/src/GLViewer/GLViewer_CoordSystem.cxx b/src/GLViewer/GLViewer_CoordSystem.cxx index 85502237c..0fbcb3b6b 100644 --- a/src/GLViewer/GLViewer_CoordSystem.cxx +++ b/src/GLViewer/GLViewer_CoordSystem.cxx @@ -1,14 +1,19 @@ -/*************************************************************************** -** Class: GLViewer_CoordSystem -** Descr: -** Module: GLViewer -** Created: UI team, 03.09.02 -****************************************************************************/ - -//#include +// File: GLViewer_Context.cxx +// Created: November, 2004 +// Author: OCC team +// Copyright (C) CEA 2004 + +//================================================================ +// Class : GLViewer_CoordSystem +// Description : Class implementing mathematical model of 2D coordinate system +//================================================================ #include "GLViewer_CoordSystem.h" #include +//======================================================================= +// Function: GLViewer_CoordSystem +// Purpose : +//======================================================================= GLViewer_CoordSystem::GLViewer_CoordSystem( CSType aType, double X0, double Y0, double XUnit, double YUnit, double Rotation ) { @@ -18,24 +23,40 @@ GLViewer_CoordSystem::GLViewer_CoordSystem( CSType aType, double X0, double Y0, setRotation( Rotation ); } +//======================================================================= +// Function: getOrigin +// Purpose : +//======================================================================= void GLViewer_CoordSystem::getOrigin( double& x, double& y ) const { x = myX0; y = myY0; } +//======================================================================= +// Function: setOrigin +// Purpose : +//======================================================================= void GLViewer_CoordSystem::setOrigin( double x, double y ) { myX0 = x; myY0 = y; } +//======================================================================= +// Function: getUnits +// Purpose : +//======================================================================= void GLViewer_CoordSystem::getUnits( double& x, double& y ) const { x = myXUnit; y = myYUnit; } +//======================================================================= +// Function: setUnits +// Purpose : +//======================================================================= void GLViewer_CoordSystem::setUnits( double x, double y ) { if( x>0 ) @@ -48,27 +69,46 @@ void GLViewer_CoordSystem::setUnits( double x, double y ) else myYUnit = 1.0; } - +//======================================================================= +// Function: getRotation +// Purpose : +//======================================================================= double GLViewer_CoordSystem::getRotation() const { return myRotation; } +//======================================================================= +// Function: setRotation +// Purpose : +//======================================================================= void GLViewer_CoordSystem::setRotation( double rotation ) { myRotation = rotation; } +//======================================================================= +// Function: getType +// Purpose : +//======================================================================= GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType() const { return myType; } +//======================================================================= +// Function: setType +// Purpose : +//======================================================================= void GLViewer_CoordSystem::setType( CSType type ) { myType = type; } +//======================================================================= +// Function: toReference +// Purpose : +//======================================================================= void GLViewer_CoordSystem::toReference( double& x, double& y ) { if( myType==Cartesian ) @@ -86,6 +126,10 @@ void GLViewer_CoordSystem::toReference( double& x, double& y ) } } +//======================================================================= +// Function: fromReference +// Purpose : +//======================================================================= void GLViewer_CoordSystem::fromReference( double& x, double& y ) { x = (x - myX0) / myXUnit; @@ -122,12 +166,20 @@ void GLViewer_CoordSystem::fromReference( double& x, double& y ) } } +//======================================================================= +// Function: transform +// Purpose : +//======================================================================= void GLViewer_CoordSystem::transform( GLViewer_CoordSystem& aSystem, double& x, double& y ) { toReference( x, y ); aSystem.fromReference( x, y ); } +//======================================================================= +// Function: getStretching +// Purpose : +//======================================================================= void GLViewer_CoordSystem::getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY ) { theX = myXUnit / aSystem.myXUnit; diff --git a/src/GLViewer/GLViewer_CoordSystem.h b/src/GLViewer/GLViewer_CoordSystem.h index 5a8424179..dbc2b9202 100644 --- a/src/GLViewer/GLViewer_CoordSystem.h +++ b/src/GLViewer/GLViewer_CoordSystem.h @@ -3,6 +3,10 @@ // Author: OCC team // Copyright (C) CEA 2004 +/*! Class GLViewer_CoordSystem + * Class implementing mathematical model of 2D coordinate system + */ + #ifndef GLVIEWER_COORDSYSTEM_H #define GLVIEWER_COORDSYSTEM_H @@ -12,46 +16,64 @@ #pragma warning( disable:4251 ) #endif -// Class: GLViewer_CoordSystem - class GLVIEWER_API GLViewer_CoordSystem { public: - enum CSType { Cartesian, Polar }; + //! A type of coordinate system + enum CSType + { + Cartesian, + Polar + }; private: - double myX0, myY0; //The coordinates of origin in the reference CS - double myXUnit, myYUnit; //The lengths of axis units in the reference unit - double myRotation; //The rotation in radians relative to reference CS - - //!!! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius + //! The coordinates of origin in the reference CS + double myX0, myY0; + //! The lengths of axis units in the reference unit + double myXUnit, myYUnit; + //! The rotation in radians relative to reference CS + double myRotation; + //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius CSType myType; public: + //! A constructor ( by default new system is identical to reference ) GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0, double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 ); + //! Returns the origin in reference system void getOrigin( double& x, double& y ) const; + //! A function installing the origin in reference system void setOrigin( double x, double y ); + //! Returns units along axes void getUnits( double& x, double& y ) const; + //! A function installing units along axes void setUnits( double x, double y ); + //! Returns rotation angle of axes in reference system double getRotation() const; + //! A function installing rotation angle of axes in reference system void setRotation( double rotation ); + //! Returns type of system CSType getType() const; + //! A function installing type of system void setType( CSType type ); + //! Transform the coordinates x, y from current CS to aSystem void transform( GLViewer_CoordSystem& aSystem, double& x, double& y ); - //Transform the coordinates x, y from current CS to aSystem + + //! Return how many times line width in aSystem system bigger than in current virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY ); - //Return how many times line width in aSystem system bigger than in current + protected: + //! A function transforms system coords to coords in reference system virtual void toReference( double& x, double& y ); + //! A function transforms from coords in reference system to system coords virtual void fromReference( double& x, double& y ); }; -- 2.39.2