From 72829498140a21dbf2f5634f300afc75a2ab4b00 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 16 Jun 2016 18:54:55 +0300 Subject: [PATCH] Make highlight of points as a circle instead of + --- src/ModuleBase/ModuleBase_ResultPrs.cpp | 4 ++++ src/ModuleBase/ModuleBase_Tools.cpp | 14 ++++++++++++++ src/ModuleBase/ModuleBase_Tools.h | 5 +++++ src/PartSet/PartSet_ResultSketchPrs.cpp | 3 +++ src/XGUI/XGUI_Displayer.cpp | 5 +++++ 5 files changed, 31 insertions(+) diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 75c326a27..128770c2f 100755 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include IMPLEMENT_STANDARD_HANDLE(ModuleBase_BRepOwner, StdSelect_BRepOwner); IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_BRepOwner, StdSelect_BRepOwner); @@ -57,6 +59,8 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) // Activate individual repaintng if this is a part of compsolid ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult); SetAutoHilight(aCompSolid.get() == NULL); + + ModuleBase_Tools::setPointBallHighlighting(this); } void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 169f911d3..986d22d18 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -41,6 +41,9 @@ #include #include +#include +#include + #include #include #include @@ -1150,6 +1153,17 @@ void translate(const std::string& theContext, std::string& theMessage) } } +void setPointBallHighlighting(AIS_Shape* theAIS) +{ + Handle(Prs3d_Drawer) aDrawer = theAIS->HilightAttributes(); + if (aDrawer->HasOwnPointAspect()) { + Handle(Prs3d_PointAspect) aPntAspect = aDrawer->PointAspect(); + aPntAspect->Aspect()->SetType(Aspect_TOM_BALL); + aDrawer->SetPointAspect(aPntAspect); + theAIS->SetHilightAttributes(aDrawer); + } +} + } // namespace ModuleBase_Tools diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index ad735c09b..376337dc4 100755 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -311,6 +312,10 @@ void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects, std:: /// \param theParams a list of parameters (can be empty) void MODULEBASE_EXPORT translate(const std::string& theContext, std::string& theMessage); +/// Set Highlighting of points as a Ball shape +/// \param theAIS - the presentation +void MODULEBASE_EXPORT setPointBallHighlighting(AIS_Shape* theAIS); + } #endif diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index d23125683..ccf60f8ae 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #define DEBUG_WIRE @@ -61,6 +62,8 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) // Activate individual repaintng if this is a part of compsolid ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult); SetAutoHilight(aCompSolid.get() == NULL); + + ModuleBase_Tools::setPointBallHighlighting(this); } void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 48559568c..091cd446c 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -186,6 +186,11 @@ bool XGUI_Displayer::display(ObjectPtr theObject, bool theUpdateViewer) Handle(AIS_InteractiveObject) anAISPrs = myWorkshop->module()->createPresentation(aResult); if (anAISPrs.IsNull()) anAISPrs = new ModuleBase_ResultPrs(aResult); + else { + Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(anAISPrs); + if (!aShapePrs.IsNull()) + ModuleBase_Tools::setPointBallHighlighting((AIS_Shape*) aShapePrs.Access()); + } anAIS->setImpl(new Handle(AIS_InteractiveObject)(anAISPrs)); //anAIS->createShape(aShapePtr); isShading = true; -- 2.39.2