From 0bb80500c3d6c9121980867067f2342ca92478fa Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 30 Mar 2017 18:40:08 +0300 Subject: [PATCH] Issue #2069: Provide custom color for symbol based constraint --- src/SketcherPrs/SketcherPrs_Collinear.cpp | 10 ++++------ src/SketcherPrs/SketcherPrs_Collinear.h | 2 +- src/SketcherPrs/SketcherPrs_Equal.cpp | 11 +++++------ src/SketcherPrs/SketcherPrs_Equal.h | 2 +- src/SketcherPrs/SketcherPrs_HVDirection.cpp | 5 +++-- src/SketcherPrs/SketcherPrs_HVDirection.h | 2 +- src/SketcherPrs/SketcherPrs_Middle.cpp | 3 ++- src/SketcherPrs/SketcherPrs_Middle.h | 2 +- src/SketcherPrs/SketcherPrs_Mirror.cpp | 4 ++-- src/SketcherPrs/SketcherPrs_Mirror.h | 2 +- src/SketcherPrs/SketcherPrs_Parallel.cpp | 11 ++++------- src/SketcherPrs/SketcherPrs_Parallel.h | 2 +- src/SketcherPrs/SketcherPrs_Perpendicular.cpp | 11 ++++------- src/SketcherPrs/SketcherPrs_Perpendicular.h | 2 +- src/SketcherPrs/SketcherPrs_Rigid.cpp | 7 ++++--- src/SketcherPrs/SketcherPrs_Rigid.h | 2 +- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 10 +++++----- src/SketcherPrs/SketcherPrs_SymbolPrs.h | 3 +-- src/SketcherPrs/SketcherPrs_Tangent.cpp | 11 ++++------- src/SketcherPrs/SketcherPrs_Tangent.h | 2 +- src/SketcherPrs/SketcherPrs_Transformation.cpp | 4 ++-- src/SketcherPrs/SketcherPrs_Transformation.h | 2 +- 22 files changed, 50 insertions(+), 60 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_Collinear.cpp b/src/SketcherPrs/SketcherPrs_Collinear.cpp index e485076aa..ac28d6436 100755 --- a/src/SketcherPrs/SketcherPrs_Collinear.cpp +++ b/src/SketcherPrs/SketcherPrs_Collinear.cpp @@ -22,9 +22,6 @@ SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - myPntArray = new Graphic3d_ArrayOfPoints(2); - myPntArray->AddVertex(0., 0., 0.); - myPntArray->AddVertex(0., 0., 0.); } bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -43,7 +40,7 @@ bool SketcherPrs_Collinear::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -57,8 +54,9 @@ bool SketcherPrs_Collinear::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); - myPntArray->SetVertice(1, aP1); - myPntArray->SetVertice(2, aP2); + myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); + myPntArray->AddVertex(aP1); + myPntArray->AddVertex(aP2); return true; } diff --git a/src/SketcherPrs/SketcherPrs_Collinear.h b/src/SketcherPrs/SketcherPrs_Collinear.h index 99c3ac289..67a7a7aca 100755 --- a/src/SketcherPrs/SketcherPrs_Collinear.h +++ b/src/SketcherPrs/SketcherPrs_Collinear.h @@ -41,7 +41,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Equal.cpp b/src/SketcherPrs/SketcherPrs_Equal.cpp index b070c171d..fde149687 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.cpp +++ b/src/SketcherPrs/SketcherPrs_Equal.cpp @@ -22,9 +22,6 @@ SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - myPntArray = new Graphic3d_ArrayOfPoints(2); - myPntArray->AddVertex(0., 0., 0.); - myPntArray->AddVertex(0., 0., 0.); } bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -43,7 +40,7 @@ bool SketcherPrs_Equal::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -57,8 +54,10 @@ bool SketcherPrs_Equal::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); - myPntArray->SetVertice(1, aP1); - myPntArray->SetVertice(2, aP2); + + myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); + myPntArray->AddVertex(aP1); + myPntArray->AddVertex(aP2); return true; } diff --git a/src/SketcherPrs/SketcherPrs_Equal.h b/src/SketcherPrs/SketcherPrs_Equal.h index 5fd1c5519..07d77bd34 100644 --- a/src/SketcherPrs/SketcherPrs_Equal.h +++ b/src/SketcherPrs/SketcherPrs_Equal.h @@ -41,7 +41,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.cpp b/src/SketcherPrs/SketcherPrs_HVDirection.cpp index e1a7ed601..552da1a6c 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.cpp +++ b/src/SketcherPrs/SketcherPrs_HVDirection.cpp @@ -36,7 +36,7 @@ bool SketcherPrs_HVDirection::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -45,7 +45,8 @@ bool SketcherPrs_HVDirection::updateIfReadyToDisplay(double theStep) const ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep); - myPntArray->SetVertice(1, aP1); + myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); + myPntArray->AddVertex(aP1); return true; } diff --git a/src/SketcherPrs/SketcherPrs_HVDirection.h b/src/SketcherPrs/SketcherPrs_HVDirection.h index ffe541570..d304031fe 100644 --- a/src/SketcherPrs/SketcherPrs_HVDirection.h +++ b/src/SketcherPrs/SketcherPrs_HVDirection.h @@ -48,7 +48,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; private: bool myIsHorisontal; diff --git a/src/SketcherPrs/SketcherPrs_Middle.cpp b/src/SketcherPrs/SketcherPrs_Middle.cpp index af78d67e8..df7590a1c 100755 --- a/src/SketcherPrs/SketcherPrs_Middle.cpp +++ b/src/SketcherPrs/SketcherPrs_Middle.cpp @@ -42,13 +42,14 @@ bool SketcherPrs_Middle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Middle::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; ObjectPtr aPointObject; // find a line result to set middle symbol near it + myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); AttributePtr anAttribute = SketcherPrs_Tools::getAttribute(myConstraint, SketchPlugin_Constraint::ENTITY_A()); if (!anAttribute.get()) { diff --git a/src/SketcherPrs/SketcherPrs_Middle.h b/src/SketcherPrs/SketcherPrs_Middle.h index 25c97b430..e01aa66c1 100755 --- a/src/SketcherPrs/SketcherPrs_Middle.h +++ b/src/SketcherPrs/SketcherPrs_Middle.h @@ -41,7 +41,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; /// Draw shape of the object. Find shape result if the object is feature void drawLine(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor, diff --git a/src/SketcherPrs/SketcherPrs_Mirror.cpp b/src/SketcherPrs/SketcherPrs_Mirror.cpp index 28ecf09cd..e78dc668e 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.cpp +++ b/src/SketcherPrs/SketcherPrs_Mirror.cpp @@ -59,7 +59,7 @@ bool SketcherPrs_Mirror::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -79,7 +79,7 @@ bool SketcherPrs_Mirror::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); int aNb = anAttrB->size(); - myPntArray = new Graphic3d_ArrayOfPoints(2 * aNb); + myPntArray = new Graphic3d_ArrayOfPoints(2 * aNb, withColor); int i; ObjectPtr aObj; gp_Pnt aP1; diff --git a/src/SketcherPrs/SketcherPrs_Mirror.h b/src/SketcherPrs/SketcherPrs_Mirror.h index 3c57b95b0..4d7f7335e 100644 --- a/src/SketcherPrs/SketcherPrs_Mirror.h +++ b/src/SketcherPrs/SketcherPrs_Mirror.h @@ -40,7 +40,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Parallel.cpp b/src/SketcherPrs/SketcherPrs_Parallel.cpp index 430d8818a..770df4e2a 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.cpp +++ b/src/SketcherPrs/SketcherPrs_Parallel.cpp @@ -23,10 +23,6 @@ SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - // Create default array - myPntArray = new Graphic3d_ArrayOfPoints(2); - myPntArray->AddVertex(0., 0., 0.); - myPntArray->AddVertex(0., 0., 0.); } bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -44,7 +40,7 @@ bool SketcherPrs_Parallel::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -58,8 +54,9 @@ bool SketcherPrs_Parallel::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); - myPntArray->SetVertice(1, aP1); - myPntArray->SetVertice(2, aP2); + myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); + myPntArray->AddVertex(aP1); + myPntArray->AddVertex(aP2); return true; } diff --git a/src/SketcherPrs/SketcherPrs_Parallel.h b/src/SketcherPrs/SketcherPrs_Parallel.h index 83ff20bb8..2b2f7128f 100644 --- a/src/SketcherPrs/SketcherPrs_Parallel.h +++ b/src/SketcherPrs/SketcherPrs_Parallel.h @@ -41,7 +41,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp index a0bda9731..54d263498 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.cpp +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.cpp @@ -23,10 +23,6 @@ SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstr const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - // Create default array - myPntArray = new Graphic3d_ArrayOfPoints(2); - myPntArray->AddVertex(0., 0., 0.); - myPntArray->AddVertex(0., 0., 0.); } bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -44,7 +40,7 @@ bool SketcherPrs_Perpendicular::IsReadyToDisplay(ModelAPI_Feature* theConstraint return aReadyToDisplay; } -bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -58,8 +54,9 @@ bool SketcherPrs_Perpendicular::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); - myPntArray->SetVertice(1, aP1); - myPntArray->SetVertice(2, aP2); + myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); + myPntArray->AddVertex(aP1); + myPntArray->AddVertex(aP2); return true; } diff --git a/src/SketcherPrs/SketcherPrs_Perpendicular.h b/src/SketcherPrs/SketcherPrs_Perpendicular.h index 3b07a25e8..337f996be 100644 --- a/src/SketcherPrs/SketcherPrs_Perpendicular.h +++ b/src/SketcherPrs/SketcherPrs_Perpendicular.h @@ -46,7 +46,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index a430ef2c1..8b0ccb425 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -65,11 +65,12 @@ bool SketcherPrs_Rigid::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; + myPntArray = new Graphic3d_ArrayOfPoints(1, withColor); std::shared_ptr aData = myConstraint->data(); std::shared_ptr anAttr = aData->refattr(SketchPlugin_Constraint::ENTITY_A()); @@ -80,13 +81,13 @@ bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep); - myPntArray->SetVertice(1, aP1); + myPntArray->AddVertex(aP1); } else { // The constraint attached to a point std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(myConstraint, SketchPlugin_Constraint::ENTITY_A()); std::shared_ptr aPoint = myPlane->to3D(aPnt->x(), aPnt->y() + theStep); - myPntArray->SetVertice(1, aPoint->impl()); + myPntArray->AddVertex(aPoint->impl()); } return true; } diff --git a/src/SketcherPrs/SketcherPrs_Rigid.h b/src/SketcherPrs/SketcherPrs_Rigid.h index d43014855..c944297a1 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.h +++ b/src/SketcherPrs/SketcherPrs_Rigid.h @@ -47,7 +47,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index cc56dd55d..ac03445a0 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -63,7 +63,7 @@ public: Handle(OpenGl_View) aView = theWorkspace->View(); double aScale = aView->Camera()->Scale(); // Update points coordinate taking the viewer scale into account - myObj->updateIfReadyToDisplay(MyDist * aScale); + myObj->updateIfReadyToDisplay(MyDist * aScale, myObj->myIsCustomColor); if (myIsVboInit) { if (myVboAttribs) { const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext(); @@ -106,8 +106,6 @@ SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsCustomColor(false) { SetAutoHilight(Standard_False); - myPntArray = new Graphic3d_ArrayOfPoints(1); - myPntArray->AddVertex(0., 0., 0.); } //********************************************************************************* @@ -242,7 +240,7 @@ void SketcherPrs_SymbolPrs::Compute( // it updates array of points if the presentation is ready to display, or the array of points // contains the previous values - bool aReadyToDisplay = updateIfReadyToDisplay(20); + bool aReadyToDisplay = updateIfReadyToDisplay(20, myIsCustomColor); int aNbVertex = myPntArray->VertexNumber(); if (myOwner.IsNull()) { @@ -254,9 +252,11 @@ void SketcherPrs_SymbolPrs::Compute( for (int i = 1; i <= aNbVertex; i++) { Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, i); mySPoints.Append(aSP); + if (myIsCustomColor) + myPntArray->SetVertexColor(i, myCustomColor); } - Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast(thePresentation->NewGroup()); + Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast(Prs3d_Root::CurrentGroup (thePresentation)); aGroup->SetPrimitivesAspect(myAspect); // Recompute boundary box of the group diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index 8bbae4dda..c672b4ea7 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -111,7 +111,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const { return true; } + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const { return true; } /// Draw a shape into the given presentation scene /// \param theShape the shape to draw @@ -150,7 +150,6 @@ private: bool myIsCustomColor; /// state if the presentation is visualized in custom color Quantity_Color myCustomColor; /// the color of mid ring if there is a conflict - //Quantity_Color myIsCustomColor; //bool myIsConflicting; /// state if the presentation is visualized in error state Handle(Image_AlienPixMap) myErrorIcon; Handle(Graphic3d_MarkerImage) myErrorImage; diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index 5f657b8aa..7704d95cf 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -26,10 +26,6 @@ SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : SketcherPrs_SymbolPrs(theConstraint, thePlane) { - // Init default points - myPntArray = new Graphic3d_ArrayOfPoints(2); - myPntArray->AddVertex(0., 0., 0.); - myPntArray->AddVertex(0., 0., 0.); } bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -48,7 +44,7 @@ bool SketcherPrs_Tangent::IsReadyToDisplay(ModelAPI_Feature* theConstraint, return aReadyToDisplay; } -bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -62,8 +58,9 @@ bool SketcherPrs_Tangent::updateIfReadyToDisplay(double theStep) const SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); gp_Pnt aP1 = aMgr->getPosition(aObj1, this, theStep); gp_Pnt aP2 = aMgr->getPosition(aObj2, this, theStep); - myPntArray->SetVertice(1, aP1); - myPntArray->SetVertice(2, aP2); + myPntArray = new Graphic3d_ArrayOfPoints(2, withColor); + myPntArray->AddVertex(aP1); + myPntArray->AddVertex(aP2); return true; } diff --git a/src/SketcherPrs/SketcherPrs_Tangent.h b/src/SketcherPrs/SketcherPrs_Tangent.h index a3bdf4a44..00c3e9c2e 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.h +++ b/src/SketcherPrs/SketcherPrs_Tangent.h @@ -43,7 +43,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; }; #endif \ No newline at end of file diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index 285133c84..9d6061e26 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -71,7 +71,7 @@ bool SketcherPrs_Transformation::IsReadyToDisplay(ModelAPI_Feature* theConstrain return aReadyToDisplay; } -bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const +bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep, bool withColor) const { if (!IsReadyToDisplay(myConstraint, myPlane)) return false; @@ -91,7 +91,7 @@ bool SketcherPrs_Transformation::updateIfReadyToDisplay(double theStep) const } SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get(); - myPntArray = new Graphic3d_ArrayOfPoints(aNbB); + myPntArray = new Graphic3d_ArrayOfPoints(aNbB, withColor); int i; ObjectPtr aObj; diff --git a/src/SketcherPrs/SketcherPrs_Transformation.h b/src/SketcherPrs/SketcherPrs_Transformation.h index 7ac6360f7..e8cb4ab77 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.h +++ b/src/SketcherPrs/SketcherPrs_Transformation.h @@ -47,7 +47,7 @@ protected: /// Update myPntArray according to presentation positions /// \return true in case of success - virtual bool updateIfReadyToDisplay(double theStep) const; + virtual bool updateIfReadyToDisplay(double theStep, bool withColor) const; private: bool myIsTranslation; -- 2.30.2