mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-06 18:26:22 +03:00
0026154: Visualization - v3d viewer grid disappears due to automatic z-fit
V3d_RectangularGrid, V3d_CircularGrid, fixed initialization of presentation bounding box (lost Z offset).
This commit is contained in:
parent
f6b4e578cd
commit
e36ee9677a
@ -28,8 +28,12 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(V3d_CircularGrid,Aspect_CircularGrid)
|
IMPLEMENT_STANDARD_RTTIEXT(V3d_CircularGrid,Aspect_CircularGrid)
|
||||||
|
|
||||||
#define DIVISION 8
|
namespace
|
||||||
#define MYFACTOR 50.
|
{
|
||||||
|
static const Standard_Real THE_DEFAULT_GRID_STEP = 10.0;
|
||||||
|
#define DIVISION 8
|
||||||
|
#define MYFACTOR 50.
|
||||||
|
}
|
||||||
|
|
||||||
//! Dummy implementation of Graphic3d_Structure overriding ::Compute() method for handling Device Lost.
|
//! Dummy implementation of Graphic3d_Structure overriding ::Compute() method for handling Device Lost.
|
||||||
class V3d_CircularGrid::CircularGridStructure : public Graphic3d_Structure
|
class V3d_CircularGrid::CircularGridStructure : public Graphic3d_Structure
|
||||||
@ -58,7 +62,15 @@ V3d_CircularGrid::V3d_CircularGrid (const V3d_ViewerPointer& aViewer, const Quan
|
|||||||
: Aspect_CircularGrid (1.,8),
|
: Aspect_CircularGrid (1.,8),
|
||||||
myViewer (aViewer),
|
myViewer (aViewer),
|
||||||
myCurAreDefined (Standard_False),
|
myCurAreDefined (Standard_False),
|
||||||
myToComputePrs (Standard_False)
|
myToComputePrs (Standard_False),
|
||||||
|
myCurDrawMode (Aspect_GDM_Lines),
|
||||||
|
myCurXo (0.0),
|
||||||
|
myCurYo (0.0),
|
||||||
|
myCurAngle (0.0),
|
||||||
|
myCurStep (0.0),
|
||||||
|
myCurDivi (0),
|
||||||
|
myRadius (0.5 * aViewer->DefaultViewSize()),
|
||||||
|
myOffSet (THE_DEFAULT_GRID_STEP / MYFACTOR)
|
||||||
{
|
{
|
||||||
myColor = aColor;
|
myColor = aColor;
|
||||||
myTenthColor = aTenthColor;
|
myTenthColor = aTenthColor;
|
||||||
@ -67,10 +79,7 @@ V3d_CircularGrid::V3d_CircularGrid (const V3d_ViewerPointer& aViewer, const Quan
|
|||||||
myGroup = myStructure->NewGroup();
|
myGroup = myStructure->NewGroup();
|
||||||
myStructure->SetInfiniteState (Standard_True);
|
myStructure->SetInfiniteState (Standard_True);
|
||||||
|
|
||||||
const Standard_Real step = 10.;
|
SetRadiusStep (THE_DEFAULT_GRID_STEP);
|
||||||
const Standard_Real size = 0.5*myViewer->DefaultViewSize();
|
|
||||||
SetGraphicValues (size, step/MYFACTOR);
|
|
||||||
SetRadiusStep (step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
V3d_CircularGrid::~V3d_CircularGrid()
|
V3d_CircularGrid::~V3d_CircularGrid()
|
||||||
@ -263,7 +272,7 @@ void V3d_CircularGrid::DefineLines ()
|
|||||||
myGroup->AddPrimitiveArray(aPrims3, Standard_False);
|
myGroup->AddPrimitiveArray(aPrims3, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGroup->SetMinMaxValues(-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
|
myGroup->SetMinMaxValues (-myRadius, -myRadius, -myOffSet, myRadius, myRadius, -myOffSet);
|
||||||
myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
|
myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
|
||||||
|
|
||||||
// update bounding box
|
// update bounding box
|
||||||
@ -321,7 +330,7 @@ void V3d_CircularGrid::DefinePoints ()
|
|||||||
}
|
}
|
||||||
myGroup->AddPrimitiveArray (Cercle, Standard_False);
|
myGroup->AddPrimitiveArray (Cercle, Standard_False);
|
||||||
}
|
}
|
||||||
myGroup->SetMinMaxValues(-myRadius, -myRadius, 0.0, myRadius, myRadius, 0.0);
|
myGroup->SetMinMaxValues (-myRadius, -myRadius, -myOffSet, myRadius, myRadius, -myOffSet);
|
||||||
|
|
||||||
myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
|
myCurStep = aStep, myCurDivi = (Standard_Integer ) aDivision;
|
||||||
|
|
||||||
|
@ -28,7 +28,11 @@
|
|||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(V3d_RectangularGrid,Aspect_RectangularGrid)
|
IMPLEMENT_STANDARD_RTTIEXT(V3d_RectangularGrid,Aspect_RectangularGrid)
|
||||||
|
|
||||||
#define MYFACTOR 50.
|
namespace
|
||||||
|
{
|
||||||
|
static const Standard_Real THE_DEFAULT_GRID_STEP = 10.0;
|
||||||
|
#define MYFACTOR 50.
|
||||||
|
}
|
||||||
|
|
||||||
//! Dummy implementation of Graphic3d_Structure overriding ::Compute() method for handling Device Lost.
|
//! Dummy implementation of Graphic3d_Structure overriding ::Compute() method for handling Device Lost.
|
||||||
class V3d_RectangularGrid::RectangularGridStructure : public Graphic3d_Structure
|
class V3d_RectangularGrid::RectangularGridStructure : public Graphic3d_Structure
|
||||||
@ -57,7 +61,16 @@ V3d_RectangularGrid::V3d_RectangularGrid (const V3d_ViewerPointer& aViewer, cons
|
|||||||
: Aspect_RectangularGrid (1.,1.),
|
: Aspect_RectangularGrid (1.,1.),
|
||||||
myViewer (aViewer),
|
myViewer (aViewer),
|
||||||
myCurAreDefined (Standard_False),
|
myCurAreDefined (Standard_False),
|
||||||
myToComputePrs (Standard_True)
|
myToComputePrs (Standard_True),
|
||||||
|
myCurDrawMode (Aspect_GDM_Lines),
|
||||||
|
myCurXo (0.0),
|
||||||
|
myCurYo (0.0),
|
||||||
|
myCurAngle (0.0),
|
||||||
|
myCurXStep (0.0),
|
||||||
|
myCurYStep (0.0),
|
||||||
|
myXSize (0.5 * aViewer->DefaultViewSize()),
|
||||||
|
myYSize (0.5 * aViewer->DefaultViewSize()),
|
||||||
|
myOffSet (THE_DEFAULT_GRID_STEP / MYFACTOR)
|
||||||
{
|
{
|
||||||
myColor = aColor;
|
myColor = aColor;
|
||||||
myTenthColor = aTenthColor;
|
myTenthColor = aTenthColor;
|
||||||
@ -66,12 +79,8 @@ V3d_RectangularGrid::V3d_RectangularGrid (const V3d_ViewerPointer& aViewer, cons
|
|||||||
myGroup = myStructure->NewGroup();
|
myGroup = myStructure->NewGroup();
|
||||||
myStructure->SetInfiniteState (Standard_True);
|
myStructure->SetInfiniteState (Standard_True);
|
||||||
|
|
||||||
const Standard_Real step = 10.;
|
SetXStep (THE_DEFAULT_GRID_STEP);
|
||||||
const Standard_Real gstep = step/MYFACTOR;
|
SetYStep (THE_DEFAULT_GRID_STEP);
|
||||||
const Standard_Real size = 0.5*myViewer->DefaultViewSize();
|
|
||||||
SetGraphicValues (size, size, gstep);
|
|
||||||
SetXStep (step);
|
|
||||||
SetYStep (step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
V3d_RectangularGrid::~V3d_RectangularGrid()
|
V3d_RectangularGrid::~V3d_RectangularGrid()
|
||||||
@ -261,7 +270,7 @@ void V3d_RectangularGrid::DefineLines ()
|
|||||||
myGroup->AddPrimitiveArray(aPrims, Standard_False);
|
myGroup->AddPrimitiveArray(aPrims, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGroup->SetMinMaxValues(-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
|
myGroup->SetMinMaxValues(-myXSize, -myYSize, -myOffSet, myXSize, myYSize, -myOffSet);
|
||||||
myCurXStep = aXStep, myCurYStep = aYStep;
|
myCurXStep = aXStep, myCurYStep = aYStep;
|
||||||
|
|
||||||
// update bounding box
|
// update bounding box
|
||||||
@ -321,7 +330,7 @@ void V3d_RectangularGrid::DefinePoints ()
|
|||||||
myGroup->AddPrimitiveArray (Vertical, Standard_False);
|
myGroup->AddPrimitiveArray (Vertical, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGroup->SetMinMaxValues(-myXSize, -myYSize, 0.0, myXSize, myYSize, 0.0);
|
myGroup->SetMinMaxValues(-myXSize, -myYSize, -myOffSet, myXSize, myYSize, -myOffSet);
|
||||||
myCurXStep = aXStep, myCurYStep = aYStep;
|
myCurXStep = aXStep, myCurYStep = aYStep;
|
||||||
|
|
||||||
// update bounding box
|
// update bounding box
|
||||||
|
Loading…
x
Reference in New Issue
Block a user