From dbba795b3b4b4fbefc9a0cf63a49a451f63737f7 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 1 Jul 2015 12:23:08 +0300 Subject: [PATCH] Set point presentation as '+' by default --- .../ConstructionPlugin_Point.cpp | 2 +- src/ModuleBase/ModuleBase_ResultPrs.cpp | 12 +++++++- src/SketchPlugin/SketchPlugin_SketchEntity.h | 6 ++-- .../SketcherPrs_Transformation.cpp | 30 +++++++++++++++++++ 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 9bca1063c..c164e44a4 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -52,6 +52,6 @@ bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult, { bool isCustomized = theDefaultPrs.get() != NULL && theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); - thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol + //thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol return true; } diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 29648d9b2..5dd2f536b 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -11,6 +11,8 @@ #include #include +#include +#include #include #include @@ -30,7 +32,15 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) myIsSketchMode = true; } } - Set(aShapePtr->impl()); + TopoDS_Shape aShape = aShapePtr->impl(); + Set(aShape); + if (aShape.ShapeType() == TopAbs_VERTEX) { + Handle(Prs3d_Drawer) aDrawer = Attributes(); + if (aDrawer->HasOwnPointAspect()) + aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS); + else + aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); + } } diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 19bc0428c..cffdee549 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -98,9 +98,9 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC isCustomized = thePrs->setLineStyle(0) || isCustomized; } } - else if (aShapeType == 7) { // otherwise this is a vertex - thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol - } + //else if (aShapeType == 7) { // otherwise this is a vertex + // thePrs->setPointMarker(1, 1.); // Set point as a '+' symbol + //} return isCustomized; } diff --git a/src/SketcherPrs/SketcherPrs_Transformation.cpp b/src/SketcherPrs/SketcherPrs_Transformation.cpp index dcbe96667..280d14e34 100644 --- a/src/SketcherPrs/SketcherPrs_Transformation.cpp +++ b/src/SketcherPrs/SketcherPrs_Transformation.cpp @@ -9,10 +9,16 @@ #include "SketcherPrs_PositionMgr.h" #include +#include +#include #include +#include #include #include +#include +#include +#include @@ -67,5 +73,29 @@ void SketcherPrs_Transformation::drawLines(const Handle(Prs3d_Presentation)& the aGroup->SetPrimitivesAspect(aLineAspect); drawListOfShapes(anAttrB, thePrs); + if (myConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) { + std::shared_ptr aStart = std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_MultiTranslation::START_POINT_ID())); + std::shared_ptr aEnd = std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_MultiTranslation::END_POINT_ID())); + + if (aStart.get() && aEnd.get() && aStart->isInitialized() && aEnd->isInitialized()) { + std::shared_ptr aPnt = myPlane->to3D(aStart->x(), aStart->y()); + Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); + StdPrs_Point::Add(thePrs, aPoint, myDrawer); + + aPnt = myPlane->to3D(aEnd->x(), aEnd->y()); + aPoint = new Geom_CartesianPoint(aPnt->impl()); + StdPrs_Point::Add(thePrs, aPoint, myDrawer); + } + } else if (myConstraint->getKind() == SketchPlugin_MultiRotation::ID()) { + std::shared_ptr aCenter = std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_MultiRotation::CENTER_ID())); + if (aCenter.get() && aCenter->isInitialized()) { + std::shared_ptr aPnt = myPlane->to3D(aCenter->x(), aCenter->y()); + Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl()); + StdPrs_Point::Add(thePrs, aPoint, myDrawer); + } + } } -- 2.39.2