}
//=======================================================================
-// Function: GLViewer_Select
+// Function: Select
// Purpose :
//=======================================================================
int GLViewer_Context::Select( bool Append, bool byCircle )
}
//=======================================================================
-// Function: GLViewer_SelectByRect
+// Function: SelectByRect
// Purpose :
//=======================================================================
int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append )
}
//=======================================================================
-// Function: GLViewer_SetHighlightColor
+// Function: SetHighlightColor
// Purpose :
//=======================================================================
void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol )
}
//=======================================================================
-// Function: GLViewer_SetSelectionColor
+// Function: SetSelectionColor
// Purpose :
//=======================================================================
void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol )
}
//=======================================================================
-// Function: GLViewer_NbSelected
+// Function: NbSelected
// Purpose :
//=======================================================================
int GLViewer_Context::NbSelected()
}
//=======================================================================
-// Function: GLViewer_InitSelected
+// Function: InitSelected
// Purpose :
//=======================================================================
void GLViewer_Context::InitSelected()
}
//=======================================================================
-// Function: GLViewer_MoreSelected
+// Function: MoreSelected
// Purpose :
//=======================================================================
bool GLViewer_Context::MoreSelected()
}
//=======================================================================
-// Function: GLViewer_NextSelected
+// Function: NextSelected
// Purpose :
//=======================================================================
bool GLViewer_Context::NextSelected()
}
//=======================================================================
-// Function: GLViewer_SelectedObject
+// Function: SelectedObject
// Purpose :
//=======================================================================
GLViewer_Object* GLViewer_Context::SelectedObject()
}
//=======================================================================
-// Function: GLViewer_isSelected
+// Function: isSelected
// Purpose :
//=======================================================================
bool GLViewer_Context::isSelected( GLViewer_Object* theObj )
}
//=======================================================================
-// Function: GLViewer_insertObject
+// Function: insertObject
// Purpose :
//=======================================================================
int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool isActive )
}
//=======================================================================
-// Function: GLViewer_replaceObject
+// Function: replaceObject
// Purpose :
//=======================================================================
bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject )
}
//=======================================================================
-// Function: GLViewer_updateScales
+// Function: updateScales
// Purpose :
//=======================================================================
void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY )
}
//=======================================================================
-// Function: GLViewer_clearHighlighted
+// Function: clearHighlighted
// Purpose :
//=======================================================================
void GLViewer_Context::clearHighlighted()
}
//=======================================================================
-// Function: GLViewer_clearSelected
+// Function: clearSelected
// Purpose :
//=======================================================================
void GLViewer_Context::clearSelected( bool updateViewer )
}
//=======================================================================
-// Function: GLViewer_setSelected
+// Function: setSelected
// Purpose :
//=======================================================================
void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer )
}
//=======================================================================
-// Function: GLViewer_remSelected
+// Function: remSelected
// Purpose :
//=======================================================================
void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer )
}
//=======================================================================
-// Function: GLViewer_eraseObject
+// Function: eraseObject
// Purpose :
//=======================================================================
void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateViewer )
}
//=======================================================================
-// Function: GLViewer_deleteObject
+// Function: deleteObject
// Purpose :
//=======================================================================
void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateViewer )
}
//=======================================================================
-// Function: GLViewer_setActive
+// Function: setActive
// Purpose :
//=======================================================================
bool GLViewer_Context::setActive( GLViewer_Object* theObject )
}
//=======================================================================
-// Function: GLViewer_setInactive
+// Function: setInactive
// Purpose :
//=======================================================================
bool GLViewer_Context::setInactive( GLViewer_Object* theObject )
-/***************************************************************************
-** Class: GLViewer_CoordSystem
-** Descr:
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
-
-//#include <GLViewerAfx.h>
+// 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 <math.h>
+//=======================================================================
+// Function: GLViewer_CoordSystem
+// Purpose :
+//=======================================================================
GLViewer_CoordSystem::GLViewer_CoordSystem( CSType aType, double X0, double Y0,
double XUnit, double YUnit, double Rotation )
{
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 )
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 )
}
}
+//=======================================================================
+// Function: fromReference
+// Purpose :
+//=======================================================================
void GLViewer_CoordSystem::fromReference( double& x, double& y )
{
x = (x - myX0) / myXUnit;
}
}
+//=======================================================================
+// 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;
// 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
#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 );
};