Salome HOME
Fix the revolution algorithm revolving an edge between faces.
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
index e29ed81222fe651ac132be23f1193f157d9b37a2..d34ec9da4ad89d898b489a9db2725f8cc6bb9550 100644 (file)
@@ -56,7 +56,6 @@
 #include <AIS_InteractiveContext.hxx>
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <AIS_DimensionSelectionMode.hxx>
 #include <AIS_Shape.hxx>
 #include <AIS_Dimension.hxx>
 #include <AIS_Trihedron.hxx>
 
 #include <set>
 
+#ifdef _MSC_VER
+#pragma warning(disable: 4702)
+#endif
+
 /// defines the local context mouse selection sensitivity
 const int MOUSE_SENSITIVITY_IN_PIXEL = 10;
 
@@ -1038,9 +1041,9 @@ void XGUI_Displayer::getPresentations(const ObjectPtr& theObject,
     ModelAPI_Tools::allResults(aFeature, aResults);
     std::list<ResultPtr>::const_iterator anIt = aResults.begin(), aLast = aResults.end();
     for (; anIt != aLast; ++anIt) {
-      AISObjectPtr aAISObj = getAISObject(*anIt);
-      if (aAISObj.get() != NULL) {
-        Handle(AIS_InteractiveObject) anAIS = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+      AISObjectPtr aCurAISObj = getAISObject(*anIt);
+      if (aCurAISObj.get() != NULL) {
+        Handle(AIS_InteractiveObject) anAIS = aCurAISObj->impl<Handle(AIS_InteractiveObject)>();
         if (!anAIS.IsNull() && !thePresentations.Contains(anAIS))
           thePresentations.Add(anAIS);
       }
@@ -1111,6 +1114,14 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th
     Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast(anOwner);
     if (!BROwnr.IsNull() && BROwnr->HasShape()) {
       const TopoDS_Shape& aShape = BROwnr->Shape();
+
+      Handle(ModuleBase_ResultPrs) aResPrs =
+          Handle(ModuleBase_ResultPrs)::DownCast(BROwnr->Selectable());
+      TopoDS_Shape aRealShape;
+      if (!aResPrs.IsNull()) {
+        aRealShape = aResPrs->originalShape();
+      }
+
       if (aShape.IsNull())
         continue;
 
@@ -1127,7 +1138,15 @@ void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) th
           // isSame should be used here as it does not check orientation of shapes
           // despite on isEqual of shapes or IsBound for shape in QMap. Orientation is
           // different for Edges shapes in model shape and owner even if this is the same shape
-        if (ModuleBase_Tools::isSameShape(aParameterShape, aShape)) {
+        bool isSame = ModuleBase_Tools::isSameShape(aParameterShape, aShape);
+        if (!isSame) {
+          // In case of using HideFaces panel we can have instead of an original shape
+          // a compaund of faces which represent original shape with hidden faces.
+          // So, we have to compare the parameter with original shape
+          if (!aRealShape.IsNull())
+            isSame = ModuleBase_Tools::isSameShape(aParameterShape, aRealShape);
+        }
+        if (isSame) {
           Handle(AIS_InteractiveObject) anOwnerPresentation =
             Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
           NCollection_Map<Handle(AIS_InteractiveObject)> aPresentations =