From 41841a46398ba8796c8d5e826c7b4338f86e24dd Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 16 Apr 2015 11:43:45 +0300 Subject: [PATCH] Fix bug with pop-up menu --- src/ModuleBase/ModuleBase_ResultPrs.cpp | 2 +- src/PartSet/PartSet_MenuMgr.cpp | 6 +++++- src/XGUI/XGUI_Displayer.cpp | 6 ++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index d6bd0cde8..eb022a2bf 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -55,7 +55,7 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t } myOriginalShape = aShapePtr->impl(); if (!myOriginalShape.IsNull()) { - Set(aShapePtr->impl()); + Set(myOriginalShape); AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); } } diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 73e5e1214..0aa5faf3e 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -156,6 +156,7 @@ bool PartSet_MenuMgr::addViewerItems(QMenu* theMenu, const QMap aPrsList = aSelection->getSelected(); TopoDS_Shape aShape; ResultPtr aResult; + FeaturePtr aFeature; foreach(ModuleBase_ViewerPrs aPrs, aPrsList) { aResult = std::dynamic_pointer_cast(aPrs.object()); if (aResult.get() != NULL) { @@ -164,12 +165,15 @@ bool PartSet_MenuMgr::addViewerItems(QMenu* theMenu, const QMap(aPrs.object()); + hasFeature = (aFeature.get() != NULL); } } if (aPrsList.size() == 1) { TopoDS_Shape aShape = aPrsList.first().shape(); - if (aShape.ShapeType() == TopAbs_VERTEX) { + if ((!aShape.IsNull()) && aShape.ShapeType() == TopAbs_VERTEX) { // Find 2d coordinates FeaturePtr aSketchFea = myModule->sketchMgr()->activeSketch(); if (aSketchFea->getKind() == SketchPlugin_Sketch::ID()) { diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index c30e93d56..58e16daa2 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -240,10 +240,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer) if (!aShapePrs.IsNull()) { std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); if (aShapePtr.get()) { - const TopoDS_Shape& aShape = aShapePrs->Shape(); - std::shared_ptr anAISShapePtr(new GeomAPI_Shape()); - anAISShapePtr->setImpl(new TopoDS_Shape(aShape)); - isEqualShapes = aShapePtr->isEqual(anAISShapePtr); + const TopoDS_Shape& aOldShape = aShapePrs->Shape(); + isEqualShapes = aOldShape.IsEqual(aShapePtr->impl()); } } } -- 2.39.2