mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0026083: Coding Rules - Poor design of Graphic3d_GraduatedTrihedron
- Made class Graphic3d_AxisAspect publicly nested in Graphic3d_GraduatedTrihedron. - Removed public PtrView field from trihedron and obtained it from OpenGL_Workspace while rendering. - Made CubicAxesCallback protected and provided corresponding getter/setter. - Renamed AxisAspect() to AxisAspectAt().
This commit is contained in:
@@ -355,7 +355,7 @@ void OpenGl_GraduatedTrihedron::renderGridPlane (const Handle(OpenGl_Workspace)&
|
||||
const GridAxes& theGridAxes,
|
||||
OpenGl_Mat4& theMat) const
|
||||
{
|
||||
const Graphic3d_AxisAspect& aCurAspect = myData.AxisAspect (theIndex);
|
||||
const Graphic3d_GraduatedTrihedron::AxisAspect& aCurAspect = myData.AxisAspectAt (theIndex);
|
||||
if (aCurAspect.TickmarksNumber() <= 0)
|
||||
{
|
||||
return;
|
||||
@@ -475,7 +475,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
|
||||
const GridAxes& theGridAxes,
|
||||
const Standard_ShortReal theDpix) const
|
||||
{
|
||||
const Graphic3d_AxisAspect& aCurAspect = myData.AxisAspect (theIndex);
|
||||
const Graphic3d_GraduatedTrihedron::AxisAspect& aCurAspect = myData.AxisAspectAt (theIndex);
|
||||
if (!aCurAspect.ToDrawName() && !aCurAspect.ToDrawValues())
|
||||
{
|
||||
return;
|
||||
@@ -566,9 +566,8 @@ void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace)& theWorks
|
||||
OpenGl_Vec3 anOldMin = myMin;
|
||||
OpenGl_Vec3 anOldMax = myMax;
|
||||
|
||||
if (myData.CubicAxesCallback)
|
||||
if (myData.CubicAxesCallback(theWorkspace->View()))
|
||||
{
|
||||
myData.CubicAxesCallback (myData.PtrView);
|
||||
if (!myAxes[0].Line.IsInitialized()
|
||||
|| !myAxes[1].Line.IsInitialized()
|
||||
|| !myAxes[2].Line.IsInitialized()
|
||||
@@ -719,7 +718,7 @@ void OpenGl_GraduatedTrihedron::SetMinMax (const OpenGl_Vec3& theMin, const Open
|
||||
// method : OpenGl_GraduatedTrihedron::Axis constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
|
||||
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_GraduatedTrihedron::AxisAspect& theAspect,
|
||||
const OpenGl_Vec3& theDirection)
|
||||
: Direction (theDirection),
|
||||
Tickmark (NULL),
|
||||
|
@@ -81,7 +81,8 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
Axis (const Graphic3d_AxisAspect& theAspect = Graphic3d_AxisAspect(),
|
||||
Axis (const Graphic3d_GraduatedTrihedron::AxisAspect& theAspect =
|
||||
Graphic3d_GraduatedTrihedron::AxisAspect(),
|
||||
const OpenGl_Vec3& theDirection = OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
|
||||
|
||||
~Axis();
|
||||
|
@@ -433,8 +433,7 @@ static void SetMinMaxValuesCallback (Graphic3d_CView* theView)
|
||||
void OpenGl_View::GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrihedronData)
|
||||
{
|
||||
myGTrihedronData = theTrihedronData;
|
||||
myGTrihedronData.PtrView = this;
|
||||
myGTrihedronData.CubicAxesCallback = SetMinMaxValuesCallback;
|
||||
myGTrihedronData.SetCubicAxesCallback (SetMinMaxValuesCallback);
|
||||
myGraduatedTrihedron.SetValues (myGTrihedronData);
|
||||
myToShowGradTrihedron = true;
|
||||
}
|
||||
@@ -445,7 +444,6 @@ void OpenGl_View::GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron&
|
||||
// =======================================================================
|
||||
void OpenGl_View::GraduatedTrihedronErase()
|
||||
{
|
||||
myGTrihedronData.PtrView = NULL;
|
||||
myGraduatedTrihedron.Release (myWorkspace->GetGlContext().operator->());
|
||||
myToShowGradTrihedron = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user