#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Root.hxx>
+#include <Prs3d_LineAspect.hxx>
#include <Geom_CartesianPoint.hxx>
#include <gp_Pnt.hxx>
#include <StdPrs_Point.hxx>
bool SketcherPrs_Transformation::updatePoints(double theStep) const
{
std::shared_ptr<ModelAPI_Data> aData = myConstraint->data();
+ // Get transformated objects list
std::shared_ptr<ModelAPI_AttributeRefList> anAttrB = aData->reflist(SketchPlugin_Constraint::ENTITY_B());
if (anAttrB.get() == NULL)
return false;
int i;
ObjectPtr aObj;
gp_Pnt aP1;
+ // Compute points of symbols
for (i = 0; i < aNbB; i++) {
aObj = anAttrB->object(i);
+ if (SketcherPrs_Tools::getShape(aObj).get() == NULL)
+ continue;
aP1 = aMgr->getPosition(aObj, this, theStep);
myPntArray->SetVertice(i + 1, aP1);
}
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs);
- Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
- aGroup->SetPrimitivesAspect(aLineAspect);
+ //Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2);
+ //aGroup->SetPrimitivesAspect(aLineAspect);
+
+ // drawListOfShapes uses myDrawer for attributes definition
+ Handle(Prs3d_LineAspect) aLnAspect = new Prs3d_LineAspect(theColor, Aspect_TOL_SOLID, 1);
+ myDrawer->SetLineAspect(aLnAspect);
drawListOfShapes(anAttrB, thePrs);
if (myConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
- std::shared_ptr<GeomDataAPI_Point2D> aStart = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- aData->attribute(SketchPlugin_MultiTranslation::START_POINT_ID()));
- std::shared_ptr<GeomDataAPI_Point2D> aEnd = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- aData->attribute(SketchPlugin_MultiTranslation::END_POINT_ID()));
-
+ // If it is translation
+ AttributePoint2DPtr aStart = GeomDataAPI_Point2D::getPoint2D(aData,
+ SketchPlugin_MultiTranslation::START_POINT_ID());
+ AttributePoint2DPtr aEnd = GeomDataAPI_Point2D::getPoint2D(aData,
+ SketchPlugin_MultiTranslation::END_POINT_ID());
+
if (aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized()) {
+ // Add start point
std::shared_ptr<GeomAPI_Pnt> aPnt = myPlane->to3D(aStart->x(), aStart->y());
Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
StdPrs_Point::Add(thePrs, aPoint, myDrawer);
+ // Add end point
aPnt = myPlane->to3D(aEnd->x(), aEnd->y());
aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
StdPrs_Point::Add(thePrs, aPoint, myDrawer);
}
} else if (myConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
- std::shared_ptr<GeomDataAPI_Point2D> aCenter = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- aData->attribute(SketchPlugin_MultiRotation::CENTER_ID()));
+ // if it is rotation
+ AttributePoint2DPtr aCenter = GeomDataAPI_Point2D::getPoint2D(aData, SketchPlugin_MultiRotation::CENTER_ID());
if (aCenter.get() && aCenter->isInitialized()) {
+ // Show center of rotation
std::shared_ptr<GeomAPI_Pnt> aPnt = myPlane->to3D(aCenter->x(), aCenter->y());
Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
StdPrs_Point::Add(thePrs, aPoint, myDrawer);