Salome HOME
Issue #2069: Provide custom color for symbol based constraint
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Tangent.cpp
index 5f657b8aacf660a4f364f405ba28ff5b3624eff2..7704d95cffa51766b87b7326797ded96457b92a4 100644 (file)
@@ -26,10 +26,6 @@ SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
                                            const std::shared_ptr<GeomAPI_Ax3>& 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;
 }