Salome HOME
Fix pyconfig redefined declarations for _XOPEN_SOURCE and _POSIX_C_SOURCE
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerFilters.cpp
index 4b6e571dfb1aa6b4fc9f696ea8117da97e2f1138..81f84dda6641d9c604cbac02c90ef19374fd4ecb 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        ModuleBase_ViewerFilters.cpp
 // Created:     07 Okt 2014
 // Author:      Vitaly SMETANNIKOV
@@ -8,6 +10,7 @@
 
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_ResultConstruction.h>
 
 #include <AIS_InteractiveObject.hxx>
 #include <AIS_Shape.hxx>
@@ -30,13 +33,17 @@ Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk(const Handle(SelectMgr_Ent
     Handle(AIS_InteractiveObject) aAisObj = 
       Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
     if (!aAisObj.IsNull()) {
-      boost::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+      std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
       aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
       ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
       if (aObj) {
         DocumentPtr aDoc = aObj->document();
         SessionPtr aMgr = ModelAPI_Session::get();
-        return (aDoc == aMgr->activeDocument()) || (aDoc == aMgr->moduleDocument());
+        return (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument());
+      }
+      else {
+        // This is not object controlled by the filter
+        return Standard_True;
       }
     }
   }
@@ -73,9 +80,15 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti
           bool aD3 = myPlane.Distance(aLastPnt) < Precision::Confusion();
           return aD1 && aD2 && aD3;
         }
+      default:
+        // This is not object controlled by the filter
+        return Standard_True;
+      break;
       }
+    } else {
+      // This is not object controlled by the filter
+      return Standard_True;
     }
   }
-  // This is not object controlled by the filter
-  return Standard_True;
+  return Standard_False;
 }