X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_Rigid.cpp;h=9c3d812ea7cb26a15695642e78e66fb9a1946ca3;hb=7f873aed4bae5a98dca078209699b54276b46fce;hp=099096c202c60ef6f2d4962b6a35fbd319409351;hpb=e7f1ac7ab6a29efa09daecae84b2add0ff630c8d;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 099096c20..9c3d812ea 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -9,31 +9,24 @@ #include "SketcherPrs_PositionMgr.h" #include +#include +#include +#include #include #include #include -#include -#include -#include - -#include -#include #include -#include - -#include -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include -extern std::shared_ptr getFeaturePoint(DataPtr theData, - const std::string& theAttribute); IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Rigid, SketcherPrs_SymbolPrs); @@ -56,7 +49,7 @@ void SketcherPrs_Rigid::Compute(const Handle(PrsMgr_PresentationManager3d)& theP prepareAspect(); ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); - std::shared_ptr aLine1 = SketcherPrs_Tools::getLine(aObj1); + std::shared_ptr aLine1 = SketcherPrs_Tools::getShape(aObj1); if (aLine1.get() == NULL) return; @@ -71,11 +64,31 @@ void SketcherPrs_Rigid::Compute(const Handle(PrsMgr_PresentationManager3d)& theP void SketcherPrs_Rigid::drawLines(const Handle(Prs3d_Presentation)& thePrs, Quantity_Color theColor) const { - Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); - - Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); - aGroup->SetPrimitivesAspect(aLineAspect); + ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + std::shared_ptr aShape = SketcherPrs_Tools::getShape(aObj); + if (aShape.get() == NULL) + return; - addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); + Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePrs); + if (aShape->isEdge()) { + Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); + aGroup->SetPrimitivesAspect(aLineAspect); + std::shared_ptr aCurve = std::shared_ptr(new GeomAPI_Curve(aShape)); + if (aCurve->isLine()) { + addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); + } else { + GeomAdaptor_Curve aAdaptor(aCurve->impl(), aCurve->startParam(), aCurve->endParam()); + StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer); + } + } else { + // This is a point + Handle(Prs3d_PointAspect) aPntAspect = new Prs3d_PointAspect(Aspect_TOM_PLUS, theColor, 1); + myDrawer->SetPointAspect(aPntAspect); + + std::shared_ptr aVertex = std::shared_ptr(new GeomAPI_Vertex(aShape)); + std::shared_ptr aPnt = aVertex->point(); + Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); + StdPrs_Point::Add(thePrs, aPoint, myDrawer); + } }