mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
cosmetics
This commit is contained in:
parent
2fa9309186
commit
7d0f638daa
@ -27,6 +27,8 @@
|
|||||||
#include <V3d_Viewer.hxx>
|
#include <V3d_Viewer.hxx>
|
||||||
#include <WNT_HIDSpaceMouse.hxx>
|
#include <WNT_HIDSpaceMouse.hxx>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : AIS_ViewController
|
// function : AIS_ViewController
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -2250,6 +2252,7 @@ void AIS_ViewController::handleCameraActions (const Handle(AIS_InteractiveContex
|
|||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const AIS_WalkDelta& theWalk)
|
const AIS_WalkDelta& theWalk)
|
||||||
{
|
{
|
||||||
|
std::cout << "handleCameraActions\n";
|
||||||
// apply view actions
|
// apply view actions
|
||||||
if (myGL.Orientation.ToSetViewOrient)
|
if (myGL.Orientation.ToSetViewOrient)
|
||||||
{
|
{
|
||||||
@ -2266,6 +2269,12 @@ void AIS_ViewController::handleCameraActions (const Handle(AIS_InteractiveContex
|
|||||||
myGL.Orientation.ToFitAll = false;
|
myGL.Orientation.ToFitAll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (theView->Viewer()->Grid()->IsActive()
|
||||||
|
&& theView->Viewer()->GridEcho())
|
||||||
|
{
|
||||||
|
theView->Viewer()->Grid()->Update();
|
||||||
|
}
|
||||||
|
|
||||||
if (myGL.IsNewGesture)
|
if (myGL.IsNewGesture)
|
||||||
{
|
{
|
||||||
if (myAnchorPointPrs1->HasInteractiveContext())
|
if (myAnchorPointPrs1->HasInteractiveContext())
|
||||||
@ -3101,6 +3110,7 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon
|
|||||||
void AIS_ViewController::handleMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
|
void AIS_ViewController::handleMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
|
||||||
const Handle(V3d_View)& theView)
|
const Handle(V3d_View)& theView)
|
||||||
{
|
{
|
||||||
|
std::cout << "handleMoveTo\n";
|
||||||
handleSelectionPick (theCtx, theView);
|
handleSelectionPick (theCtx, theView);
|
||||||
handleDynamicHighlight(theCtx, theView);
|
handleDynamicHighlight(theCtx, theView);
|
||||||
handleSelectionPoly (theCtx, theView);
|
handleSelectionPoly (theCtx, theView);
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient)
|
||||||
|
|
||||||
Aspect_Grid::Aspect_Grid (const Standard_Real theXOrigin,
|
Aspect_Grid::Aspect_Grid (const Standard_Real theXOrigin,
|
||||||
const Standard_Real theYOrigin,
|
const Standard_Real theYOrigin,
|
||||||
const Standard_Real theAngle,
|
const Standard_Real theAngle,
|
||||||
const Quantity_Color& theColor,
|
const Quantity_Color& theColor,
|
||||||
const Quantity_Color& theTenthColor)
|
const Quantity_Color& theTenthColor)
|
||||||
: myRotationAngle (theAngle),
|
: myRotationAngle (theAngle),
|
||||||
myXOrigin (theXOrigin),
|
myXOrigin (theXOrigin),
|
||||||
myYOrigin (theYOrigin),
|
myYOrigin (theYOrigin),
|
||||||
@ -60,7 +60,7 @@ void Aspect_Grid::Rotate (const Standard_Real theAngle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::Translate (const Standard_Real theDx,
|
void Aspect_Grid::Translate (const Standard_Real theDx,
|
||||||
const Standard_Real theDy)
|
const Standard_Real theDy)
|
||||||
{
|
{
|
||||||
myXOrigin += theDx;
|
myXOrigin += theDx;
|
||||||
myYOrigin += theDy;
|
myYOrigin += theDy;
|
||||||
@ -69,7 +69,7 @@ void Aspect_Grid::Translate (const Standard_Real theDx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::SetColors (const Quantity_Color& theColor,
|
void Aspect_Grid::SetColors (const Quantity_Color& theColor,
|
||||||
const Quantity_Color& theTenthColor)
|
const Quantity_Color& theTenthColor)
|
||||||
{
|
{
|
||||||
myColor = theColor;
|
myColor = theColor;
|
||||||
myTenthColor = theTenthColor;
|
myTenthColor = theTenthColor;
|
||||||
@ -77,16 +77,16 @@ void Aspect_Grid::SetColors (const Quantity_Color& theColor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::Colors (Quantity_Color& theColor,
|
void Aspect_Grid::Colors (Quantity_Color& theColor,
|
||||||
Quantity_Color& theTenthColor) const
|
Quantity_Color& theTenthColor) const
|
||||||
{
|
{
|
||||||
theColor = myColor;
|
theColor = myColor;
|
||||||
theTenthColor = myTenthColor;
|
theTenthColor = myTenthColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::Hit (const Standard_Real theX,
|
void Aspect_Grid::Hit (const Standard_Real theX,
|
||||||
const Standard_Real theY,
|
const Standard_Real theY,
|
||||||
Standard_Real& theGridX,
|
Standard_Real& theGridX,
|
||||||
Standard_Real& theGridY) const
|
Standard_Real& theGridY) const
|
||||||
{
|
{
|
||||||
if (myIsActive)
|
if (myIsActive)
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,9 @@ public:
|
|||||||
//! Display the grid at screen.
|
//! Display the grid at screen.
|
||||||
Standard_EXPORT virtual void Display() = 0;
|
Standard_EXPORT virtual void Display() = 0;
|
||||||
|
|
||||||
|
//!
|
||||||
|
Standard_EXPORT virtual void Update() = 0;
|
||||||
|
|
||||||
//! Erase the grid from screen.
|
//! Erase the grid from screen.
|
||||||
Standard_EXPORT virtual void Erase() const = 0;
|
Standard_EXPORT virtual void Erase() const = 0;
|
||||||
|
|
||||||
|
@ -27,31 +27,35 @@ Aspect_RectangularGrid::Aspect_RectangularGrid(
|
|||||||
const Standard_Real aFirstAngle,
|
const Standard_Real aFirstAngle,
|
||||||
const Standard_Real aSecondAngle,
|
const Standard_Real aSecondAngle,
|
||||||
const Standard_Real aRotationAngle)
|
const Standard_Real aRotationAngle)
|
||||||
:Aspect_Grid(anXOrigin,anYOrigin,aRotationAngle),myXStep(aXStep),myYStep(aYStep),myFirstAngle(aFirstAngle),mySecondAngle(aSecondAngle)
|
: Aspect_Grid (anXOrigin,anYOrigin,aRotationAngle),
|
||||||
|
myXStep (aXStep),
|
||||||
|
myYStep (aYStep),
|
||||||
|
myFirstAngle (aFirstAngle),
|
||||||
|
mySecondAngle (aSecondAngle)
|
||||||
{
|
{
|
||||||
Standard_NumericError_Raise_if(!CheckAngle (aFirstAngle,mySecondAngle),
|
Standard_NumericError_Raise_if (!CheckAngle (aFirstAngle, mySecondAngle),
|
||||||
"networks are parallel");
|
"networks are parallel");
|
||||||
|
Standard_NegativeValue_Raise_if (aXStep < 0.0, "invalid x step");
|
||||||
Standard_NegativeValue_Raise_if(aXStep < 0. , "invalid x step");
|
Standard_NegativeValue_Raise_if (aYStep < 0.0, "invalid y step");
|
||||||
Standard_NegativeValue_Raise_if(aYStep < 0. , "invalid y step");
|
Standard_NullValue_Raise_if (aXStep == 0.0, "invalid x step");
|
||||||
Standard_NullValue_Raise_if(aXStep == 0. , "invalid x step");
|
Standard_NullValue_Raise_if (aYStep == 0.0, "invalid y step");
|
||||||
Standard_NullValue_Raise_if(aYStep == 0. , "invalid y step");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Aspect_RectangularGrid::SetXStep(const Standard_Real aStep) {
|
void Aspect_RectangularGrid::SetXStep (const Standard_Real aStep)
|
||||||
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
|
{
|
||||||
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
|
Standard_NegativeValue_Raise_if (aStep < 0.0, "invalid x step");
|
||||||
|
Standard_NullValue_Raise_if (aStep == 0.0, "invalid y step");
|
||||||
myXStep = aStep;
|
myXStep = aStep;
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_RectangularGrid::SetYStep(const Standard_Real aStep) {
|
void Aspect_RectangularGrid::SetYStep (const Standard_Real aStep)
|
||||||
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
|
{
|
||||||
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
|
Standard_NegativeValue_Raise_if (aStep < 0.0, "invalid x step");
|
||||||
|
Standard_NullValue_Raise_if (aStep == 0.0, "invalid y step");
|
||||||
myYStep = aStep;
|
myYStep = aStep;
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
@ -60,67 +64,72 @@ void Aspect_RectangularGrid::SetYStep(const Standard_Real aStep) {
|
|||||||
void Aspect_RectangularGrid::SetAngle (const Standard_Real anAngle1,
|
void Aspect_RectangularGrid::SetAngle (const Standard_Real anAngle1,
|
||||||
const Standard_Real anAngle2)
|
const Standard_Real anAngle2)
|
||||||
{
|
{
|
||||||
Standard_NumericError_Raise_if(!CheckAngle (anAngle1,anAngle2 ),
|
Standard_NumericError_Raise_if (!CheckAngle (anAngle1,anAngle2),
|
||||||
"axis are parallel");
|
"axis are parallel");
|
||||||
myFirstAngle = anAngle1;
|
myFirstAngle = anAngle1;
|
||||||
mySecondAngle = anAngle2;
|
mySecondAngle = anAngle2;
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_RectangularGrid::SetGridValues(
|
void Aspect_RectangularGrid::SetGridValues (
|
||||||
const Standard_Real theXOrigin,
|
const Standard_Real theXOrigin,
|
||||||
const Standard_Real theYOrigin,
|
const Standard_Real theYOrigin,
|
||||||
const Standard_Real theXStep,
|
const Standard_Real theXStep,
|
||||||
const Standard_Real theYStep,
|
const Standard_Real theYStep,
|
||||||
const Standard_Real theRotationAngle) {
|
const Standard_Real theRotationAngle)
|
||||||
|
{
|
||||||
myXOrigin = theXOrigin;
|
myXOrigin = theXOrigin;
|
||||||
myYOrigin = theYOrigin;
|
myYOrigin = theYOrigin;
|
||||||
Standard_NegativeValue_Raise_if(theXStep < 0. , "invalid x step");
|
Standard_NegativeValue_Raise_if (theXStep < 0.0, "invalid x step");
|
||||||
Standard_NullValue_Raise_if(theXStep == 0. , "invalid x step");
|
Standard_NullValue_Raise_if (theXStep == 0.0, "invalid x step");
|
||||||
myXStep = theXStep;
|
myXStep = theXStep;
|
||||||
Standard_NegativeValue_Raise_if(theYStep < 0. , "invalid y step");
|
Standard_NegativeValue_Raise_if (theYStep < 0.0, "invalid y step");
|
||||||
Standard_NullValue_Raise_if(theYStep == 0. , "invalid y step");
|
Standard_NullValue_Raise_if (theYStep == 0.0, "invalid y step");
|
||||||
myYStep = theYStep;
|
myYStep = theYStep;
|
||||||
myRotationAngle = theRotationAngle;
|
myRotationAngle = theRotationAngle;
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_RectangularGrid::Compute(const Standard_Real X,
|
void Aspect_RectangularGrid::Compute (const Standard_Real X,
|
||||||
const Standard_Real Y,
|
const Standard_Real Y,
|
||||||
Standard_Real& gridX,
|
Standard_Real& gridX,
|
||||||
Standard_Real& gridY) const {
|
Standard_Real& gridY) const
|
||||||
|
{
|
||||||
Standard_Real D1 = b1 * X - a1 * Y - c1;
|
Standard_Real D1 = b1 * X - a1 * Y - c1;
|
||||||
Standard_Real D2 = b2 * X - a2 * Y - c2;
|
Standard_Real D2 = b2 * X - a2 * Y - c2;
|
||||||
Standard_Integer n1 = Standard_Integer ( Abs(D1)/myXStep + 0.5);
|
Standard_Integer n1 = Standard_Integer (Abs (D1) / myXStep + 0.5);
|
||||||
Standard_Integer n2 = Standard_Integer ( Abs(D2)/myYStep + 0.5);
|
Standard_Integer n2 = Standard_Integer (Abs (D2) / myYStep + 0.5);
|
||||||
Standard_Real offset1 = c1 + Standard_Real(n1) * Sign (myXStep , D1);
|
Standard_Real offset1 = c1 + Standard_Real(n1) * Sign (myXStep, D1);
|
||||||
Standard_Real offset2 = c2 + Standard_Real(n2) * Sign (myYStep , D2);
|
Standard_Real offset2 = c2 + Standard_Real(n2) * Sign (myYStep, D2);
|
||||||
Standard_Real Delta = a1*b2 - b1*a2;
|
Standard_Real Delta = a1 * b2 - b1 * a2;
|
||||||
gridX = ( offset2*a1 - offset1*a2) /Delta;
|
gridX = (offset2 * a1 - offset1 * a2) / Delta;
|
||||||
gridY = ( offset2*b1 - offset1*b2) /Delta;
|
gridY = (offset2 * b1 - offset1 * b2) / Delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real Aspect_RectangularGrid::XStep() const {
|
Standard_Real Aspect_RectangularGrid::XStep() const
|
||||||
|
{
|
||||||
return myXStep;
|
return myXStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real Aspect_RectangularGrid::YStep() const {
|
Standard_Real Aspect_RectangularGrid::YStep() const
|
||||||
|
{
|
||||||
return myYStep;
|
return myYStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real Aspect_RectangularGrid::FirstAngle() const {
|
Standard_Real Aspect_RectangularGrid::FirstAngle() const
|
||||||
|
{
|
||||||
return myFirstAngle;
|
return myFirstAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Real Aspect_RectangularGrid::SecondAngle() const {
|
Standard_Real Aspect_RectangularGrid::SecondAngle() const
|
||||||
|
{
|
||||||
return mySecondAngle;
|
return mySecondAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_RectangularGrid::Init () {
|
void Aspect_RectangularGrid::Init()
|
||||||
|
{
|
||||||
//+zov Fixing CTS17856
|
//+zov Fixing CTS17856
|
||||||
// a1 = Cos (myFirstAngle + RotationAngle() );
|
// a1 = Cos (myFirstAngle + RotationAngle() );
|
||||||
// b1 = Sin (myFirstAngle + RotationAngle() );
|
// b1 = Sin (myFirstAngle + RotationAngle() );
|
||||||
@ -132,28 +141,39 @@ void Aspect_RectangularGrid::Init () {
|
|||||||
|
|
||||||
Standard_Real angle1 = myFirstAngle + RotationAngle();
|
Standard_Real angle1 = myFirstAngle + RotationAngle();
|
||||||
Standard_Real angle2 = mySecondAngle + RotationAngle();
|
Standard_Real angle2 = mySecondAngle + RotationAngle();
|
||||||
if ( angle1 != 0. ) {
|
if (angle1 != 0.0)
|
||||||
|
{
|
||||||
a1 = -Sin (angle1);
|
a1 = -Sin (angle1);
|
||||||
b1 = Cos (angle1);
|
b1 = Cos (angle1);
|
||||||
c1 = XOrigin() * b1 - YOrigin() * a1;
|
c1 = XOrigin() * b1 - YOrigin() * a1;
|
||||||
} else {
|
}
|
||||||
a1 = 0.; b1 = 1.; c1 = XOrigin();
|
else
|
||||||
|
{
|
||||||
|
a1 = 0.0;
|
||||||
|
b1 = 1.0;
|
||||||
|
c1 = XOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( angle2 != 0. ) {
|
if (angle2 != 0.0)
|
||||||
angle2 += M_PI / 2.;
|
{
|
||||||
|
angle2 += M_PI / 2.0;
|
||||||
a2 = -Sin (angle2);
|
a2 = -Sin (angle2);
|
||||||
b2 = Cos (angle2);
|
b2 = Cos (angle2);
|
||||||
c2 = XOrigin() * b2 - YOrigin() * a2;
|
c2 = XOrigin() * b2 - YOrigin() * a2;
|
||||||
} else {
|
}
|
||||||
a2 = -1.; b2 = 0.; c2 = YOrigin();
|
else
|
||||||
|
{
|
||||||
|
a2 = -1.0;
|
||||||
|
b2 = 0.0;
|
||||||
|
c2 = YOrigin();
|
||||||
}
|
}
|
||||||
//-zov
|
//-zov
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
|
Standard_Boolean Aspect_RectangularGrid::CheckAngle (const Standard_Real alpha,
|
||||||
const Standard_Real beta) const {
|
const Standard_Real beta) const
|
||||||
return (Abs( Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0) ;
|
{
|
||||||
|
return (Abs (Sin (alpha) * Cos (beta + M_PI / 2.0) - Cos (alpha) * Sin (beta + M_PI / 2.0)) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -91,7 +91,8 @@ V3d_CircularGrid::~V3d_CircularGrid()
|
|||||||
|
|
||||||
void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
||||||
{
|
{
|
||||||
if( myColor != aColor || myTenthColor != aTenthColor ) {
|
if( myColor != aColor || myTenthColor != aTenthColor )
|
||||||
|
{
|
||||||
myColor = aColor;
|
myColor = aColor;
|
||||||
myTenthColor = aTenthColor;
|
myTenthColor = aTenthColor;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
@ -99,35 +100,40 @@ void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::Display ()
|
void V3d_CircularGrid::Display()
|
||||||
{
|
{
|
||||||
myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
|
myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
|
||||||
myStructure->Display();
|
myStructure->Display();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::Erase () const
|
void V3d_CircularGrid::Update()
|
||||||
{
|
{
|
||||||
myStructure->Erase ();
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean V3d_CircularGrid::IsDisplayed () const
|
void V3d_CircularGrid::Erase() const
|
||||||
{
|
{
|
||||||
return myStructure->IsDisplayed ();
|
myStructure->Erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::UpdateDisplay ()
|
Standard_Boolean V3d_CircularGrid::IsDisplayed() const
|
||||||
|
{
|
||||||
|
return myStructure->IsDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3d_CircularGrid::UpdateDisplay()
|
||||||
{
|
{
|
||||||
gp_Ax3 ThePlane = myViewer->PrivilegedPlane();
|
gp_Ax3 ThePlane = myViewer->PrivilegedPlane();
|
||||||
|
|
||||||
Standard_Real xl, yl, zl;
|
Standard_Real xl, yl, zl;
|
||||||
Standard_Real xdx, xdy, xdz;
|
Standard_Real xdx, xdy, xdz;
|
||||||
Standard_Real ydx, ydy, ydz;
|
Standard_Real ydx, ydy, ydz;
|
||||||
Standard_Real dx, dy, dz;
|
Standard_Real dx, dy, dz;
|
||||||
ThePlane.Location ().Coord (xl, yl, zl);
|
ThePlane.Location ().Coord (xl, yl, zl);
|
||||||
ThePlane.XDirection ().Coord (xdx, xdy, xdz);
|
ThePlane.XDirection().Coord (xdx, xdy, xdz);
|
||||||
ThePlane.YDirection ().Coord (ydx, ydy, ydz);
|
ThePlane.YDirection().Coord (ydx, ydy, ydz);
|
||||||
ThePlane.Direction ().Coord (dx, dy, dz);
|
ThePlane.Direction ().Coord (dx, dy, dz);
|
||||||
|
|
||||||
Standard_Boolean MakeTransform = !myCurAreDefined;
|
Standard_Boolean MakeTransform = !myCurAreDefined;
|
||||||
if (!MakeTransform)
|
if (!MakeTransform)
|
||||||
@ -135,26 +141,28 @@ void V3d_CircularGrid::UpdateDisplay ()
|
|||||||
MakeTransform = (RotationAngle() != myCurAngle || XOrigin() != myCurXo || YOrigin() != myCurYo);
|
MakeTransform = (RotationAngle() != myCurAngle || XOrigin() != myCurXo || YOrigin() != myCurYo);
|
||||||
if (!MakeTransform)
|
if (!MakeTransform)
|
||||||
{
|
{
|
||||||
Standard_Real curxl, curyl, curzl;
|
Standard_Real curxl, curyl, curzl;
|
||||||
Standard_Real curxdx, curxdy, curxdz;
|
Standard_Real curxdx, curxdy, curxdz;
|
||||||
Standard_Real curydx, curydy, curydz;
|
Standard_Real curydx, curydy, curydz;
|
||||||
Standard_Real curdx, curdy, curdz;
|
Standard_Real curdx, curdy, curdz;
|
||||||
myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
|
myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
|
||||||
myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
|
myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
|
||||||
myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
|
myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
|
||||||
myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
|
myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
|
||||||
if (xl != curxl || yl != curyl || zl != curzl ||
|
if (xl != curxl || yl != curyl || zl != curzl ||
|
||||||
xdx != curxdx || xdy != curxdy || xdz != curxdz ||
|
xdx != curxdx || xdy != curxdy || xdz != curxdz ||
|
||||||
ydx != curydx || ydy != curydy || ydz != curydz ||
|
ydx != curydx || ydy != curydy || ydz != curydz ||
|
||||||
dx != curdx || dy != curdy || dz != curdz)
|
dx != curdx || dy != curdy || dz != curdz)
|
||||||
|
{
|
||||||
MakeTransform = Standard_True;
|
MakeTransform = Standard_True;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MakeTransform)
|
if (MakeTransform)
|
||||||
{
|
{
|
||||||
const Standard_Real CosAlpha = Cos (RotationAngle ());
|
const Standard_Real CosAlpha = Cos (RotationAngle());
|
||||||
const Standard_Real SinAlpha = Sin (RotationAngle ());
|
const Standard_Real SinAlpha = Sin (RotationAngle());
|
||||||
|
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
// Translation
|
// Translation
|
||||||
@ -168,23 +176,24 @@ void V3d_CircularGrid::UpdateDisplay ()
|
|||||||
gp_Trsf aTrsf2;
|
gp_Trsf aTrsf2;
|
||||||
aTrsf2.SetValues ( CosAlpha, SinAlpha, 0.0, -XOrigin(),
|
aTrsf2.SetValues ( CosAlpha, SinAlpha, 0.0, -XOrigin(),
|
||||||
-SinAlpha, CosAlpha, 0.0, -YOrigin(),
|
-SinAlpha, CosAlpha, 0.0, -YOrigin(),
|
||||||
0.0, 0.0, 1.0, 0.0);
|
0.0, 0.0, 1.0, 0.0 );
|
||||||
aTrsf.Multiply (aTrsf2);
|
aTrsf.Multiply (aTrsf2);
|
||||||
myStructure->SetTransformation (new TopLoc_Datum3D (aTrsf));
|
myStructure->SetTransformation (new TopLoc_Datum3D (aTrsf));
|
||||||
|
|
||||||
myCurAngle = RotationAngle ();
|
myCurAngle = RotationAngle();
|
||||||
myCurXo = XOrigin (), myCurYo = YOrigin ();
|
myCurXo = XOrigin();
|
||||||
|
myCurYo = YOrigin();
|
||||||
myCurViewPlane = ThePlane;
|
myCurViewPlane = ThePlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (myDrawMode)
|
switch (myDrawMode)
|
||||||
{
|
{
|
||||||
case Aspect_GDM_Points:
|
case Aspect_GDM_Points:
|
||||||
DefinePoints ();
|
DefinePoints();
|
||||||
myCurDrawMode = Aspect_GDM_Points;
|
myCurDrawMode = Aspect_GDM_Points;
|
||||||
break;
|
break;
|
||||||
case Aspect_GDM_Lines:
|
case Aspect_GDM_Lines:
|
||||||
DefineLines ();
|
DefineLines();
|
||||||
myCurDrawMode = Aspect_GDM_Lines;
|
myCurDrawMode = Aspect_GDM_Lines;
|
||||||
break;
|
break;
|
||||||
case Aspect_GDM_None:
|
case Aspect_GDM_None:
|
||||||
@ -194,16 +203,15 @@ void V3d_CircularGrid::UpdateDisplay ()
|
|||||||
myCurAreDefined = Standard_True;
|
myCurAreDefined = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::DefineLines ()
|
void V3d_CircularGrid::DefineLines()
|
||||||
{
|
{
|
||||||
const Standard_Real aStep = RadiusStep ();
|
const Standard_Real aStep = RadiusStep();
|
||||||
const Standard_Real aDivision = DivisionNumber ();
|
const Standard_Real aDivision = DivisionNumber();
|
||||||
const Standard_Boolean toUpdate = !myCurAreDefined
|
const Standard_Boolean toUpdate = !myCurAreDefined
|
||||||
|| myCurDrawMode != Aspect_GDM_Lines
|
|| myCurDrawMode != Aspect_GDM_Lines
|
||||||
|| aDivision != myCurDivi
|
|| aDivision != myCurDivi
|
||||||
|| aStep != myCurStep;
|
|| aStep != myCurStep;
|
||||||
if (!toUpdate
|
if (!toUpdate && !myToComputePrs)
|
||||||
&& !myToComputePrs)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -214,33 +222,36 @@ void V3d_CircularGrid::DefineLines ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
myToComputePrs = Standard_False;
|
myToComputePrs = Standard_False;
|
||||||
myGroup->Clear ();
|
myGroup->Clear();
|
||||||
|
|
||||||
const Standard_Integer Division = (Standard_Integer )( (aDivision >= DIVISION ? aDivision : DIVISION));
|
const Standard_Integer Division = (Standard_Integer )((aDivision >= DIVISION ? aDivision : DIVISION));
|
||||||
|
|
||||||
Standard_Integer nbpnts = 2 * Division;
|
Standard_Integer nbpnts = 2 * Division;
|
||||||
// diametres
|
// diametres
|
||||||
Standard_Real alpha = M_PI / aDivision;
|
Standard_Real alpha = M_PI / aDivision;
|
||||||
|
|
||||||
myGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (myTenthColor, Aspect_TOL_SOLID, 1.0));
|
myGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (myTenthColor, Aspect_TOL_SOLID, 1.0));
|
||||||
Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments(2*nbpnts);
|
Handle(Graphic3d_ArrayOfSegments) aPrims1 = new Graphic3d_ArrayOfSegments (2 * nbpnts);
|
||||||
const gp_Pnt p0(0., 0., -myOffSet);
|
const gp_Pnt p0 (0.0, 0.0, -myOffSet);
|
||||||
for (Standard_Integer i=1; i<=nbpnts; i++) {
|
for (Standard_Integer i = 1; i <= nbpnts; i++)
|
||||||
aPrims1->AddVertex(p0);
|
{
|
||||||
aPrims1->AddVertex(Cos(alpha*i)*myRadius, Sin(alpha*i)*myRadius, -myOffSet);
|
aPrims1->AddVertex (p0);
|
||||||
|
aPrims1->AddVertex (Cos (alpha * i) * myRadius, Sin (alpha * i) * myRadius, -myOffSet);
|
||||||
}
|
}
|
||||||
myGroup->AddPrimitiveArray(aPrims1, Standard_False);
|
myGroup->AddPrimitiveArray (aPrims1, Standard_False);
|
||||||
|
|
||||||
// circles
|
// circles
|
||||||
nbpnts = 2 * Division + 1;
|
nbpnts = 2 * Division + 1;
|
||||||
alpha = M_PI / Division;
|
alpha = M_PI / Division;
|
||||||
Standard_Integer nblines = 0;
|
Standard_Integer nblines = 0;
|
||||||
TColgp_SequenceOfPnt aSeqLines, aSeqTenth;
|
TColgp_SequenceOfPnt aSeqLines, aSeqTenth;
|
||||||
for (Standard_Real r=aStep; r<=myRadius; r+=aStep, nblines++) {
|
for (Standard_Real r = aStep; r <= myRadius; r += aStep, nblines++)
|
||||||
const Standard_Boolean isTenth = (Modulus(nblines, 10) == 0);
|
{
|
||||||
for (Standard_Integer i=0; i<nbpnts; i++) {
|
const Standard_Boolean isTenth = (Modulus (nblines, 10) == 0);
|
||||||
const gp_Pnt pt(Cos(alpha*i)*r,Sin(alpha*i)*r,-myOffSet);
|
for (Standard_Integer i = 0; i < nbpnts; i++)
|
||||||
(isTenth? aSeqTenth : aSeqLines).Append(pt);
|
{
|
||||||
|
const gp_Pnt pt (Cos (alpha * i) * r, Sin (alpha * i) * r, -myOffSet);
|
||||||
|
(isTenth ? aSeqTenth : aSeqLines).Append (pt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aSeqTenth.Length())
|
if (aSeqTenth.Length())
|
||||||
@ -248,37 +259,44 @@ void V3d_CircularGrid::DefineLines ()
|
|||||||
myGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (myTenthColor, Aspect_TOL_SOLID, 1.0));
|
myGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectLine3d (myTenthColor, Aspect_TOL_SOLID, 1.0));
|
||||||
Standard_Integer n, np;
|
Standard_Integer n, np;
|
||||||
const Standard_Integer nbl = aSeqTenth.Length() / nbpnts;
|
const Standard_Integer nbl = aSeqTenth.Length() / nbpnts;
|
||||||
Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines(aSeqTenth.Length(),nbl);
|
Handle(Graphic3d_ArrayOfPolylines) aPrims2 = new Graphic3d_ArrayOfPolylines (aSeqTenth.Length(), nbl);
|
||||||
for (np = 1, n=0; n<nbl; n++) {
|
for (np = 1, n = 0; n < nbl; n++)
|
||||||
aPrims2->AddBound(nbpnts);
|
{
|
||||||
for (Standard_Integer i=0; i<nbpnts; i++, np++)
|
aPrims2->AddBound (nbpnts);
|
||||||
aPrims2->AddVertex(aSeqTenth(np));
|
for (Standard_Integer i = 0; i < nbpnts; i++, np++)
|
||||||
}
|
{
|
||||||
myGroup->AddPrimitiveArray(aPrims2, Standard_False);
|
aPrims2->AddVertex (aSeqTenth (np));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myGroup->AddPrimitiveArray (aPrims2, Standard_False);
|
||||||
}
|
}
|
||||||
if (aSeqLines.Length())
|
if (aSeqLines.Length())
|
||||||
{
|
{
|
||||||
myGroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (myColor, Aspect_TOL_SOLID, 1.0));
|
myGroup->SetPrimitivesAspect (new Graphic3d_AspectLine3d (myColor, Aspect_TOL_SOLID, 1.0));
|
||||||
Standard_Integer n, np;
|
Standard_Integer n, np;
|
||||||
const Standard_Integer nbl = aSeqLines.Length() / nbpnts;
|
const Standard_Integer nbl = aSeqLines.Length() / nbpnts;
|
||||||
Handle(Graphic3d_ArrayOfPolylines) aPrims3 = new Graphic3d_ArrayOfPolylines(aSeqLines.Length(),nbl);
|
Handle(Graphic3d_ArrayOfPolylines) aPrims3 = new Graphic3d_ArrayOfPolylines (aSeqLines.Length(), nbl);
|
||||||
for (np = 1, n=0; n<nbl; n++) {
|
for (np = 1, n = 0; n < nbl; n++)
|
||||||
|
{
|
||||||
aPrims3->AddBound(nbpnts);
|
aPrims3->AddBound(nbpnts);
|
||||||
for (Standard_Integer i=0; i<nbpnts; i++, np++)
|
for (Standard_Integer i = 0; i < nbpnts; i++, np++)
|
||||||
aPrims3->AddVertex(aSeqLines(np));
|
{
|
||||||
}
|
aPrims3->AddVertex (aSeqLines (np));
|
||||||
myGroup->AddPrimitiveArray(aPrims3, Standard_False);
|
}
|
||||||
|
}
|
||||||
|
myGroup->AddPrimitiveArray (aPrims3, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGroup->SetMinMaxValues (-myRadius, -myRadius, -myOffSet, myRadius, myRadius, -myOffSet);
|
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
|
||||||
myStructure->CalculateBoundBox();
|
myStructure->CalculateBoundBox();
|
||||||
myViewer->StructureManager()->Update (myStructure->GetZLayer());
|
myViewer->StructureManager()->Update (myStructure->GetZLayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::DefinePoints ()
|
void V3d_CircularGrid::DefinePoints()
|
||||||
{
|
{
|
||||||
const Standard_Real aStep = RadiusStep();
|
const Standard_Real aStep = RadiusStep();
|
||||||
const Standard_Real aDivision = DivisionNumber();
|
const Standard_Real aDivision = DivisionNumber();
|
||||||
@ -286,8 +304,7 @@ void V3d_CircularGrid::DefinePoints ()
|
|||||||
|| myCurDrawMode != Aspect_GDM_Points
|
|| myCurDrawMode != Aspect_GDM_Points
|
||||||
|| aDivision != myCurDivi
|
|| aDivision != myCurDivi
|
||||||
|| aStep != myCurStep;
|
|| aStep != myCurStep;
|
||||||
if (!toUpdate
|
if (!toUpdate && !myToComputePrs)
|
||||||
&& !myToComputePrs)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -298,39 +315,43 @@ void V3d_CircularGrid::DefinePoints ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
myToComputePrs = Standard_False;
|
myToComputePrs = Standard_False;
|
||||||
myGroup->Clear ();
|
myGroup->Clear();
|
||||||
|
|
||||||
Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d ();
|
Handle(Graphic3d_AspectMarker3d) MarkerAttrib = new Graphic3d_AspectMarker3d();
|
||||||
MarkerAttrib->SetColor (myColor);
|
MarkerAttrib->SetColor (myColor);
|
||||||
MarkerAttrib->SetType (Aspect_TOM_POINT);
|
MarkerAttrib->SetType (Aspect_TOM_POINT);
|
||||||
MarkerAttrib->SetScale (3.);
|
MarkerAttrib->SetScale (3.0);
|
||||||
|
|
||||||
const Standard_Integer nbpnts = Standard_Integer (2*aDivision);
|
const Standard_Integer nbpnts = Standard_Integer (2 * aDivision);
|
||||||
Standard_Real r, alpha = M_PI / aDivision;
|
Standard_Real alpha = M_PI / aDivision;
|
||||||
|
|
||||||
// diameters
|
// diameters
|
||||||
TColgp_SequenceOfPnt aSeqPnts;
|
TColgp_SequenceOfPnt aSeqPnts;
|
||||||
aSeqPnts.Append(gp_Pnt(0.0, 0.0, -myOffSet));
|
aSeqPnts.Append (gp_Pnt (0.0, 0.0, -myOffSet));
|
||||||
for (r=aStep; r<=myRadius; r+=aStep) {
|
for (Standard_Real r = aStep; r <= myRadius; r += aStep)
|
||||||
for (Standard_Integer i=0; i<nbpnts; i++)
|
{
|
||||||
aSeqPnts.Append(gp_Pnt(Cos(alpha*i)*r, Sin(alpha*i)*r, -myOffSet));
|
for (Standard_Integer i = 0; i < nbpnts; i++)
|
||||||
|
{
|
||||||
|
aSeqPnts.Append (gp_Pnt (Cos (alpha * i) * r, Sin (alpha * i) * r, -myOffSet));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
myGroup->SetGroupPrimitivesAspect (MarkerAttrib);
|
myGroup->SetGroupPrimitivesAspect (MarkerAttrib);
|
||||||
if (aSeqPnts.Length())
|
if (aSeqPnts.Length())
|
||||||
{
|
{
|
||||||
Standard_Real X,Y,Z;
|
Standard_Real X,Y,Z;
|
||||||
const Standard_Integer nbv = aSeqPnts.Length();
|
const Standard_Integer nbv = aSeqPnts.Length();
|
||||||
Handle(Graphic3d_ArrayOfPoints) Cercle = new Graphic3d_ArrayOfPoints (nbv);
|
Handle(Graphic3d_ArrayOfPoints) aCircle = new Graphic3d_ArrayOfPoints (nbv);
|
||||||
for (Standard_Integer i=1; i<=nbv; i++)
|
for (Standard_Integer i = 1; i <= nbv; i++)
|
||||||
{
|
{
|
||||||
aSeqPnts(i).Coord(X,Y,Z);
|
aSeqPnts (i).Coord (X,Y,Z);
|
||||||
Cercle->AddVertex (X,Y,Z);
|
aCircle->AddVertex (X,Y,Z);
|
||||||
}
|
}
|
||||||
myGroup->AddPrimitiveArray (Cercle, Standard_False);
|
myGroup->AddPrimitiveArray (aCircle, Standard_False);
|
||||||
}
|
}
|
||||||
myGroup->SetMinMaxValues (-myRadius, -myRadius, -myOffSet, myRadius, myRadius, -myOffSet);
|
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
|
||||||
myStructure->CalculateBoundBox();
|
myStructure->CalculateBoundBox();
|
||||||
@ -345,19 +366,22 @@ void V3d_CircularGrid::GraphicValues (Standard_Real& theRadius, Standard_Real& t
|
|||||||
|
|
||||||
void V3d_CircularGrid::SetGraphicValues (const Standard_Real theRadius, const Standard_Real theOffSet)
|
void V3d_CircularGrid::SetGraphicValues (const Standard_Real theRadius, const Standard_Real theOffSet)
|
||||||
{
|
{
|
||||||
if (! myCurAreDefined) {
|
if (!myCurAreDefined)
|
||||||
|
{
|
||||||
myRadius = theRadius;
|
myRadius = theRadius;
|
||||||
myOffSet = theOffSet;
|
myOffSet = theOffSet;
|
||||||
}
|
}
|
||||||
if (myRadius != theRadius) {
|
if (myRadius != theRadius)
|
||||||
|
{
|
||||||
myRadius = theRadius;
|
myRadius = theRadius;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
}
|
}
|
||||||
if (myOffSet != theOffSet) {
|
if (myOffSet != theOffSet)
|
||||||
|
{
|
||||||
myOffSet = theOffSet;
|
myOffSet = theOffSet;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
}
|
}
|
||||||
if( !myCurAreDefined ) UpdateDisplay();
|
if (!myCurAreDefined) { UpdateDisplay(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -41,6 +41,8 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT void Display() Standard_OVERRIDE;
|
Standard_EXPORT void Display() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT void Update() Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT void Erase() const Standard_OVERRIDE;
|
Standard_EXPORT void Erase() const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsDisplayed() const Standard_OVERRIDE;
|
Standard_EXPORT Standard_Boolean IsDisplayed() const Standard_OVERRIDE;
|
||||||
|
@ -91,7 +91,8 @@ V3d_RectangularGrid::~V3d_RectangularGrid()
|
|||||||
|
|
||||||
void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
||||||
{
|
{
|
||||||
if( myColor != aColor || myTenthColor != aTenthColor ) {
|
if( myColor != aColor || myTenthColor != aTenthColor )
|
||||||
|
{
|
||||||
myColor = aColor;
|
myColor = aColor;
|
||||||
myTenthColor = aTenthColor;
|
myTenthColor = aTenthColor;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
@ -99,55 +100,69 @@ void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::Display ()
|
void V3d_RectangularGrid::Display()
|
||||||
{
|
{
|
||||||
myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
|
myStructure->SetDisplayPriority (Graphic3d_DisplayPriority_AlmostBottom);
|
||||||
myStructure->Display();
|
myStructure->Display();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::Erase () const
|
void V3d_RectangularGrid::Update()
|
||||||
{
|
{
|
||||||
myStructure->Erase ();
|
SetXStep (XStep() + 1);
|
||||||
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean V3d_RectangularGrid::IsDisplayed () const
|
void V3d_RectangularGrid::Erase() const
|
||||||
{
|
{
|
||||||
return myStructure->IsDisplayed ();
|
myStructure->Erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::UpdateDisplay ()
|
Standard_Boolean V3d_RectangularGrid::IsDisplayed() const
|
||||||
{
|
{
|
||||||
gp_Ax3 ThePlane = myViewer->PrivilegedPlane ();
|
return myStructure->IsDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
void V3d_RectangularGrid::UpdateDisplay()
|
||||||
|
{
|
||||||
|
gp_Ax3 ThePlane = myViewer->PrivilegedPlane();
|
||||||
|
|
||||||
Standard_Boolean MakeTransform = Standard_False;
|
Standard_Boolean MakeTransform = Standard_False;
|
||||||
Standard_Real xl, yl, zl;
|
Standard_Real xl, yl, zl;
|
||||||
Standard_Real xdx, xdy, xdz;
|
Standard_Real xdx, xdy, xdz;
|
||||||
Standard_Real ydx, ydy, ydz;
|
Standard_Real ydx, ydy, ydz;
|
||||||
Standard_Real dx, dy, dz;
|
Standard_Real dx, dy, dz;
|
||||||
ThePlane.Location ().Coord (xl, yl, zl);
|
ThePlane.Location ().Coord (xl, yl, zl);
|
||||||
ThePlane.XDirection ().Coord (xdx, xdy, xdz);
|
ThePlane.XDirection().Coord (xdx, xdy, xdz);
|
||||||
ThePlane.YDirection ().Coord (ydx, ydy, ydz);
|
ThePlane.YDirection().Coord (ydx, ydy, ydz);
|
||||||
ThePlane.Direction ().Coord (dx, dy, dz);
|
ThePlane.Direction ().Coord (dx, dy, dz);
|
||||||
if (! myCurAreDefined)
|
if (!myCurAreDefined)
|
||||||
|
{
|
||||||
MakeTransform = Standard_True;
|
MakeTransform = Standard_True;
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (RotationAngle() != myCurAngle || XOrigin() != myCurXo || YOrigin() != myCurYo)
|
if (RotationAngle() != myCurAngle || XOrigin() != myCurXo || YOrigin() != myCurYo)
|
||||||
|
{
|
||||||
MakeTransform = Standard_True;
|
MakeTransform = Standard_True;
|
||||||
if (! MakeTransform) {
|
}
|
||||||
Standard_Real curxl, curyl, curzl;
|
if (!MakeTransform)
|
||||||
|
{
|
||||||
|
Standard_Real curxl, curyl, curzl;
|
||||||
Standard_Real curxdx, curxdy, curxdz;
|
Standard_Real curxdx, curxdy, curxdz;
|
||||||
Standard_Real curydx, curydy, curydz;
|
Standard_Real curydx, curydy, curydz;
|
||||||
Standard_Real curdx, curdy, curdz;
|
Standard_Real curdx, curdy, curdz;
|
||||||
myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
|
myCurViewPlane.Location ().Coord (curxl, curyl, curzl);
|
||||||
myCurViewPlane.XDirection ().Coord (curxdx, curxdy, curxdz);
|
myCurViewPlane.XDirection().Coord (curxdx, curxdy, curxdz);
|
||||||
myCurViewPlane.YDirection ().Coord (curydx, curydy, curydz);
|
myCurViewPlane.YDirection().Coord (curydx, curydy, curydz);
|
||||||
myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
|
myCurViewPlane.Direction ().Coord (curdx, curdy, curdz);
|
||||||
if (xl != curxl || yl != curyl || zl != curzl ||
|
if (xl != curxl || yl != curyl || zl != curzl ||
|
||||||
xdx != curxdx || xdy != curxdy || xdz != curxdz ||
|
xdx != curxdx || xdy != curxdy || xdz != curxdz ||
|
||||||
ydx != curydx || ydy != curydy || ydz != curydz ||
|
ydx != curydx || ydy != curydy || ydz != curydz ||
|
||||||
dx != curdx || dy != curdy || dz != curdz)
|
dx != curdx || dy != curdy || dz != curdz)
|
||||||
|
{
|
||||||
MakeTransform = Standard_True;
|
MakeTransform = Standard_True;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,33 +182,34 @@ void V3d_RectangularGrid::UpdateDisplay ()
|
|||||||
gp_Trsf aTrsf2;
|
gp_Trsf aTrsf2;
|
||||||
aTrsf2.SetValues ( CosAlpha, SinAlpha, 0.0, -XOrigin(),
|
aTrsf2.SetValues ( CosAlpha, SinAlpha, 0.0, -XOrigin(),
|
||||||
-SinAlpha, CosAlpha, 0.0, -YOrigin(),
|
-SinAlpha, CosAlpha, 0.0, -YOrigin(),
|
||||||
0.0, 0.0, 1.0, 0.0);
|
0.0, 0.0, 1.0, 0.0 );
|
||||||
aTrsf.Multiply (aTrsf2);
|
aTrsf.Multiply (aTrsf2);
|
||||||
myStructure->SetTransformation (new TopLoc_Datum3D (aTrsf));
|
myStructure->SetTransformation (new TopLoc_Datum3D (aTrsf));
|
||||||
|
|
||||||
myCurAngle = RotationAngle ();
|
myCurAngle = RotationAngle();
|
||||||
myCurXo = XOrigin (), myCurYo = YOrigin ();
|
myCurXo = XOrigin();
|
||||||
|
myCurYo = YOrigin();
|
||||||
myCurViewPlane = ThePlane;
|
myCurViewPlane = ThePlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (myDrawMode)
|
switch (myDrawMode)
|
||||||
{
|
{
|
||||||
case Aspect_GDM_Points:
|
case Aspect_GDM_Points:
|
||||||
DefinePoints ();
|
DefinePoints();
|
||||||
myCurDrawMode = Aspect_GDM_Points;
|
myCurDrawMode = Aspect_GDM_Points;
|
||||||
break;
|
break;
|
||||||
case Aspect_GDM_Lines:
|
case Aspect_GDM_Lines:
|
||||||
DefineLines ();
|
DefineLines();
|
||||||
myCurDrawMode = Aspect_GDM_Lines;
|
myCurDrawMode = Aspect_GDM_Lines;
|
||||||
break;
|
break;
|
||||||
case Aspect_GDM_None:
|
case Aspect_GDM_None:
|
||||||
myCurDrawMode = Aspect_GDM_None;
|
myCurDrawMode = Aspect_GDM_None;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
myCurAreDefined = Standard_True;
|
myCurAreDefined = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::DefineLines ()
|
void V3d_RectangularGrid::DefineLines()
|
||||||
{
|
{
|
||||||
const Standard_Real aXStep = XStep();
|
const Standard_Real aXStep = XStep();
|
||||||
const Standard_Real aYStep = YStep();
|
const Standard_Real aYStep = YStep();
|
||||||
@ -201,8 +217,7 @@ void V3d_RectangularGrid::DefineLines ()
|
|||||||
|| myCurDrawMode != Aspect_GDM_Lines
|
|| myCurDrawMode != Aspect_GDM_Lines
|
||||||
|| aXStep != myCurXStep
|
|| aXStep != myCurXStep
|
||||||
|| aYStep != myCurYStep;
|
|| aYStep != myCurYStep;
|
||||||
if (!toUpdate
|
if (!toUpdate && !myToComputePrs)
|
||||||
&& !myToComputePrs)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -221,27 +236,27 @@ void V3d_RectangularGrid::DefineLines ()
|
|||||||
TColgp_SequenceOfPnt aSeqLines, aSeqTenth;
|
TColgp_SequenceOfPnt aSeqLines, aSeqTenth;
|
||||||
|
|
||||||
// verticals
|
// verticals
|
||||||
aSeqTenth.Append(gp_Pnt(0., -myYSize, -zl));
|
aSeqTenth.Append (gp_Pnt (0.0, -myYSize, -zl));
|
||||||
aSeqTenth.Append(gp_Pnt(0., myYSize, -zl));
|
aSeqTenth.Append (gp_Pnt (0.0, myYSize, -zl));
|
||||||
for (nblines = 1, xl = aXStep; xl < myXSize; xl += aXStep, nblines++)
|
for (nblines = 1, xl = aXStep; xl < myXSize; xl += aXStep, nblines++)
|
||||||
{
|
{
|
||||||
TColgp_SequenceOfPnt &aSeq = (Modulus(nblines, 10) != 0)? aSeqLines : aSeqTenth;
|
TColgp_SequenceOfPnt &aSeq = (Modulus (nblines, 10) != 0) ? aSeqLines : aSeqTenth;
|
||||||
aSeq.Append(gp_Pnt( xl, -myYSize, -zl));
|
aSeq.Append (gp_Pnt ( xl, -myYSize, -zl));
|
||||||
aSeq.Append(gp_Pnt( xl, myYSize, -zl));
|
aSeq.Append (gp_Pnt ( xl, myYSize, -zl));
|
||||||
aSeq.Append(gp_Pnt(-xl, -myYSize, -zl));
|
aSeq.Append (gp_Pnt (-xl, -myYSize, -zl));
|
||||||
aSeq.Append(gp_Pnt(-xl, myYSize, -zl));
|
aSeq.Append (gp_Pnt (-xl, myYSize, -zl));
|
||||||
}
|
}
|
||||||
|
|
||||||
// horizontals
|
// horizontals
|
||||||
aSeqTenth.Append(gp_Pnt(-myXSize, 0., -zl));
|
aSeqTenth.Append (gp_Pnt (-myXSize, 0.0, -zl));
|
||||||
aSeqTenth.Append(gp_Pnt( myXSize, 0., -zl));
|
aSeqTenth.Append (gp_Pnt ( myXSize, 0.0, -zl));
|
||||||
for (nblines = 1, yl = aYStep; yl < myYSize; yl += aYStep, nblines++)
|
for (nblines = 1, yl = aYStep; yl < myYSize; yl += aYStep, nblines++)
|
||||||
{
|
{
|
||||||
TColgp_SequenceOfPnt &aSeq = (Modulus(nblines, 10) != 0)? aSeqLines : aSeqTenth;
|
TColgp_SequenceOfPnt &aSeq = (Modulus (nblines, 10) != 0) ? aSeqLines : aSeqTenth;
|
||||||
aSeq.Append(gp_Pnt(-myXSize, yl, -zl));
|
aSeq.Append (gp_Pnt (-myXSize, yl, -zl));
|
||||||
aSeq.Append(gp_Pnt( myXSize, yl, -zl));
|
aSeq.Append (gp_Pnt ( myXSize, yl, -zl));
|
||||||
aSeq.Append(gp_Pnt(-myXSize, -yl, -zl));
|
aSeq.Append (gp_Pnt (-myXSize, -yl, -zl));
|
||||||
aSeq.Append(gp_Pnt( myXSize, -yl, -zl));
|
aSeq.Append (gp_Pnt ( myXSize, -yl, -zl));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSeqLines.Length())
|
if (aSeqLines.Length())
|
||||||
@ -249,33 +264,36 @@ void V3d_RectangularGrid::DefineLines ()
|
|||||||
Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d (myColor, Aspect_TOL_SOLID, 1.0);
|
Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d (myColor, Aspect_TOL_SOLID, 1.0);
|
||||||
myGroup->SetPrimitivesAspect (aLineAspect);
|
myGroup->SetPrimitivesAspect (aLineAspect);
|
||||||
const Standard_Integer nbv = aSeqLines.Length();
|
const Standard_Integer nbv = aSeqLines.Length();
|
||||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(nbv);
|
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments (nbv);
|
||||||
Standard_Integer n = 1;
|
for (Standard_Integer n = 1; n <= nbv; n++)
|
||||||
while (n<=nbv)
|
{
|
||||||
aPrims->AddVertex(aSeqLines(n++));
|
aPrims->AddVertex (aSeqLines (n));
|
||||||
myGroup->AddPrimitiveArray(aPrims, Standard_False);
|
}
|
||||||
|
myGroup->AddPrimitiveArray (aPrims, Standard_False);
|
||||||
}
|
}
|
||||||
if (aSeqTenth.Length())
|
if (aSeqTenth.Length())
|
||||||
{
|
{
|
||||||
Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d (myTenthColor, Aspect_TOL_SOLID, 1.0);
|
Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d (myTenthColor, Aspect_TOL_SOLID, 1.0);
|
||||||
myGroup->SetPrimitivesAspect (aLineAspect);
|
myGroup->SetPrimitivesAspect (aLineAspect);
|
||||||
const Standard_Integer nbv = aSeqTenth.Length();
|
const Standard_Integer nbv = aSeqTenth.Length();
|
||||||
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(nbv);
|
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments (nbv);
|
||||||
Standard_Integer n = 1;
|
for (Standard_Integer n = 1; n <= nbv; n++)
|
||||||
while (n<=nbv)
|
{
|
||||||
aPrims->AddVertex(aSeqTenth(n++));
|
aPrims->AddVertex (aSeqTenth (n));
|
||||||
myGroup->AddPrimitiveArray(aPrims, Standard_False);
|
}
|
||||||
|
myGroup->AddPrimitiveArray (aPrims, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGroup->SetMinMaxValues(-myXSize, -myYSize, -myOffSet, myXSize, myYSize, -myOffSet);
|
myGroup->SetMinMaxValues (-myXSize, -myYSize, -myOffSet, myXSize, myYSize, -myOffSet);
|
||||||
myCurXStep = aXStep, myCurYStep = aYStep;
|
myCurXStep = aXStep;
|
||||||
|
myCurYStep = aYStep;
|
||||||
|
|
||||||
// update bounding box
|
// update bounding box
|
||||||
myStructure->CalculateBoundBox();
|
myStructure->CalculateBoundBox();
|
||||||
myViewer->StructureManager()->Update (myStructure->GetZLayer());
|
myViewer->StructureManager()->Update (myStructure->GetZLayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::DefinePoints ()
|
void V3d_RectangularGrid::DefinePoints()
|
||||||
{
|
{
|
||||||
const Standard_Real aXStep = XStep();
|
const Standard_Real aXStep = XStep();
|
||||||
const Standard_Real aYStep = YStep();
|
const Standard_Real aYStep = YStep();
|
||||||
@ -300,14 +318,16 @@ void V3d_RectangularGrid::DefinePoints ()
|
|||||||
// horizontals
|
// horizontals
|
||||||
Standard_Real xl, yl;
|
Standard_Real xl, yl;
|
||||||
TColgp_SequenceOfPnt aSeqPnts;
|
TColgp_SequenceOfPnt aSeqPnts;
|
||||||
for (xl = 0.0; xl <= myXSize; xl += aXStep) {
|
for (xl = 0.0; xl <= myXSize; xl += aXStep)
|
||||||
aSeqPnts.Append(gp_Pnt( xl, 0.0, -myOffSet));
|
{
|
||||||
aSeqPnts.Append(gp_Pnt(-xl, 0.0, -myOffSet));
|
aSeqPnts.Append (gp_Pnt ( xl, 0.0, -myOffSet));
|
||||||
for (yl = aYStep; yl <= myYSize; yl += aYStep) {
|
aSeqPnts.Append (gp_Pnt (-xl, 0.0, -myOffSet));
|
||||||
aSeqPnts.Append(gp_Pnt( xl, yl, -myOffSet));
|
for (yl = aYStep; yl <= myYSize; yl += aYStep)
|
||||||
aSeqPnts.Append(gp_Pnt( xl, -yl, -myOffSet));
|
{
|
||||||
aSeqPnts.Append(gp_Pnt(-xl, yl, -myOffSet));
|
aSeqPnts.Append (gp_Pnt ( xl, yl, -myOffSet));
|
||||||
aSeqPnts.Append(gp_Pnt(-xl, -yl, -myOffSet));
|
aSeqPnts.Append (gp_Pnt ( xl, -yl, -myOffSet));
|
||||||
|
aSeqPnts.Append (gp_Pnt (-xl, yl, -myOffSet));
|
||||||
|
aSeqPnts.Append (gp_Pnt (-xl, -yl, -myOffSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aSeqPnts.Length())
|
if (aSeqPnts.Length())
|
||||||
@ -316,9 +336,9 @@ void V3d_RectangularGrid::DefinePoints ()
|
|||||||
Standard_Real X,Y,Z;
|
Standard_Real X,Y,Z;
|
||||||
const Standard_Integer nbv = aSeqPnts.Length();
|
const Standard_Integer nbv = aSeqPnts.Length();
|
||||||
Handle(Graphic3d_ArrayOfPoints) Vertical = new Graphic3d_ArrayOfPoints (nbv);
|
Handle(Graphic3d_ArrayOfPoints) Vertical = new Graphic3d_ArrayOfPoints (nbv);
|
||||||
for (i=1; i<=nbv; i++)
|
for (i = 1; i <= nbv; i++)
|
||||||
{
|
{
|
||||||
aSeqPnts(i).Coord(X,Y,Z);
|
aSeqPnts (i).Coord (X,Y,Z);
|
||||||
Vertical->AddVertex (X,Y,Z);
|
Vertical->AddVertex (X,Y,Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,8 +347,9 @@ void V3d_RectangularGrid::DefinePoints ()
|
|||||||
myGroup->AddPrimitiveArray (Vertical, Standard_False);
|
myGroup->AddPrimitiveArray (Vertical, Standard_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
myGroup->SetMinMaxValues(-myXSize, -myYSize, -myOffSet, myXSize, myYSize, -myOffSet);
|
myGroup->SetMinMaxValues (-myXSize, -myYSize, -myOffSet, myXSize, myYSize, -myOffSet);
|
||||||
myCurXStep = aXStep, myCurYStep = aYStep;
|
myCurXStep = aXStep;
|
||||||
|
myCurYStep = aYStep;
|
||||||
|
|
||||||
// update bounding box
|
// update bounding box
|
||||||
myStructure->CalculateBoundBox();
|
myStructure->CalculateBoundBox();
|
||||||
@ -344,24 +365,28 @@ void V3d_RectangularGrid::GraphicValues (Standard_Real& theXSize, Standard_Real&
|
|||||||
|
|
||||||
void V3d_RectangularGrid::SetGraphicValues (const Standard_Real theXSize, const Standard_Real theYSize, const Standard_Real theOffSet)
|
void V3d_RectangularGrid::SetGraphicValues (const Standard_Real theXSize, const Standard_Real theYSize, const Standard_Real theOffSet)
|
||||||
{
|
{
|
||||||
if (! myCurAreDefined) {
|
if (! myCurAreDefined)
|
||||||
|
{
|
||||||
myXSize = theXSize;
|
myXSize = theXSize;
|
||||||
myYSize = theYSize;
|
myYSize = theYSize;
|
||||||
myOffSet = theOffSet;
|
myOffSet = theOffSet;
|
||||||
}
|
}
|
||||||
if (myXSize != theXSize) {
|
if (myXSize != theXSize)
|
||||||
|
{
|
||||||
myXSize = theXSize;
|
myXSize = theXSize;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
}
|
}
|
||||||
if (myYSize != theYSize) {
|
if (myYSize != theYSize)
|
||||||
|
{
|
||||||
myYSize = theYSize;
|
myYSize = theYSize;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
}
|
}
|
||||||
if (myOffSet != theOffSet) {
|
if (myOffSet != theOffSet)
|
||||||
|
{
|
||||||
myOffSet = theOffSet;
|
myOffSet = theOffSet;
|
||||||
myCurAreDefined = Standard_False;
|
myCurAreDefined = Standard_False;
|
||||||
}
|
}
|
||||||
if( !myCurAreDefined ) UpdateDisplay();
|
if (!myCurAreDefined) { UpdateDisplay(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT virtual void Display() Standard_OVERRIDE;
|
Standard_EXPORT virtual void Display() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void Update() Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual void Erase() const Standard_OVERRIDE;
|
Standard_EXPORT virtual void Erase() const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const Standard_OVERRIDE;
|
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const Standard_OVERRIDE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user