1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketcherPrs_Transformation.cpp
4 // Created: 16 February 2015
5 // Author: Vitaly SMETANNIKOV
7 #include "SketcherPrs_Transformation.h"
8 #include "SketcherPrs_Tools.h"
9 #include "SketcherPrs_PositionMgr.h"
11 #include <SketchPlugin_Constraint.h>
12 #include <ModelAPI_AttributeRefList.h>
14 #include <Graphic3d_AspectLine3d.hxx>
15 #include <Prs3d_Root.hxx>
19 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Transformation, SketcherPrs_SymbolPrs);
20 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Transformation, SketcherPrs_SymbolPrs);
22 static Handle(Image_AlienPixMap) MyPixMap;
24 SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
25 const std::shared_ptr<GeomAPI_Ax3>& thePlane,
27 : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation)
31 bool SketcherPrs_Transformation::updatePoints(double theStep) const
33 std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
34 std::shared_ptr<ModelAPI_AttributeRefList> anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B());
35 if (anAttrB.get() == NULL)
38 int aNbB = anAttrB->size();
42 SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
43 myPntArray = new Graphic3d_ArrayOfPoints(aNbB);
48 for (i = 0; i < aNbB; i++) {
49 aObj = anAttrB->object(i);
50 aP1 = aMgr->getPosition(aObj, this, theStep);
51 myPntArray->SetVertice(i + 1, aP1);
57 void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const
59 std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
60 std::shared_ptr<ModelAPI_AttributeRefList> anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B());
61 if (anAttrB.get() == NULL)
64 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
66 Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
67 aGroup->SetPrimitivesAspect(aLineAspect);
69 drawListOfShapes(anAttrB, thePrs);