]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_ExternalObjectsMgr.cpp
Salome HOME
Preselection using in operations: using of external objects correction.
[modules/shaper.git] / src / PartSet / PartSet_ExternalObjectsMgr.cpp
index bf1eeb9b2b1180a5e3b099518b3c9a6fc5fb38c6..9c3e4105d942d5a35b2e153c57763e75881b8aa5 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <XGUI_Workshop.h>
 
+#include <SketchPlugin_Feature.h>
+
 #include <QString>
 
 PartSet_ExternalObjectsMgr::PartSet_ExternalObjectsMgr(const std::string& theExternal, const bool theDefaultValue)
@@ -21,6 +23,22 @@ PartSet_ExternalObjectsMgr::PartSet_ExternalObjectsMgr(const std::string& theExt
   }
 }
 
+bool PartSet_ExternalObjectsMgr::isValidObject(const ObjectPtr& theObject)
+{
+  bool aValid = true;
+  FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+  // Do check using of external feature
+  std::shared_ptr<SketchPlugin_Feature> aSPFeature = 
+          std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+
+  // Do check that we can use external feature
+  if (aSPFeature.get() != NULL && aSPFeature->isExternal() && !useExternal()) {
+    aValid = false;
+  }
+
+  return aValid;
+}
+
 ObjectPtr PartSet_ExternalObjectsMgr::externalObject(const ObjectPtr& theSelectedObject,
                                                      const GeomShapePtr& theShape,
                                                      const CompositeFeaturePtr& theSketch)