]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix bug with pop-up menu
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 16 Apr 2015 08:43:45 +0000 (11:43 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 16 Apr 2015 08:43:45 +0000 (11:43 +0300)
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/PartSet/PartSet_MenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp

index d6bd0cde8de26c65ad5b9724683b1612ec4e7ced..eb022a2bf0d853202e1a3180a9dee43da9aade9b 100644 (file)
@@ -55,7 +55,7 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
   }
   myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
   if (!myOriginalShape.IsNull()) {
-    Set(aShapePtr->impl<TopoDS_Shape>());
+    Set(myOriginalShape);
     AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
   }
 }
index 73e5e121447a73e35c1f3c3266e00d934ae7adac..0aa5faf3eeb4ccff5ad0897b4d8a6164c7e93f26 100644 (file)
@@ -156,6 +156,7 @@ bool PartSet_MenuMgr::addViewerItems(QMenu* theMenu, const QMap<QString, QAction
   QList<ModuleBase_ViewerPrs> aPrsList = aSelection->getSelected();
   TopoDS_Shape aShape;
   ResultPtr aResult;
+  FeaturePtr aFeature;
   foreach(ModuleBase_ViewerPrs aPrs, aPrsList) {
     aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
     if (aResult.get() != NULL) {
@@ -164,12 +165,15 @@ bool PartSet_MenuMgr::addViewerItems(QMenu* theMenu, const QMap<QString, QAction
         hasFeature = true;
       else
         hasAttribute = true;
+    } else {
+      aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(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()) {
index c30e93d56f11d84742e596fcf9566716b6674fa2..58e16daa26a1ed1a44e45e49badd85efea9821ce 100644 (file)
@@ -240,10 +240,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
       if (!aShapePrs.IsNull()) {
         std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
         if (aShapePtr.get()) {
-          const TopoDS_Shape& aShape = aShapePrs->Shape();
-          std::shared_ptr<GeomAPI_Shape> 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<TopoDS_Shape>());
         }
       }
     }