- Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
- aGroup->SetPrimitivesAspect(myAspect);
- myPntArray->SetVertice(1, aP1);
- aGroup->AddPrimitiveArray(myPntArray);
+bool SketcherPrs_Rigid::updateIfReadyToDisplay(double theStep, bool withColor) const
+{
+ if (!IsReadyToDisplay(myConstraint, plane()))
+ return false;
+
+ myPntArray = new Graphic3d_ArrayOfPoints(1, withColor);
+ std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ aData->refattr(SketchPlugin_Constraint::ENTITY_A());
+ AttributePtr aRefAttr = anAttr->attr();
+ if (anAttr->isObject()) {
+ // The constraint attached to an object
+ ObjectPtr aObj = anAttr->object();
+
+ SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
+ gp_Pnt aP1 = aMgr->getPosition(aObj, this, theStep);
+ myPntArray->AddVertex(aP1);
+ } else {
+ // The constraint attached to a point
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(myConstraint,
+ SketchPlugin_Constraint::ENTITY_A());
+ std::shared_ptr<GeomAPI_Pnt> aPoint = plane()->to3D(aPnt->x(), aPnt->y() + theStep);
+ myPntArray->AddVertex(aPoint->impl<gp_Pnt>());
+ }
+ return true;