Salome HOME
Merge remote-tracking branch 'origin/Dev_PluginPathExtension'
[modules/shaper.git] / src / PartSet / PartSet_ExternalObjectsMgr.cpp
index bc0412047a433984eea80cc684ffd4624fc4a983..a33d6c39168c31af1885e267f36d7d9930e9ef39 100755 (executable)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_ExternalObjectsMgr.cpp
-// Created:     15 Apr 2015
-// Author:      Natalia Ermolaeva
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include "PartSet_ExternalObjectsMgr.h"
 #include "PartSet_Tools.h"
@@ -58,22 +72,13 @@ ObjectPtr PartSet_ExternalObjectsMgr::externalObject(const ObjectPtr& theSelecte
 {
   ObjectPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal(
                                   theShape->impl<TopoDS_Shape>(), theSelectedObject, theSketch);
-  FeaturePtr aFeature = ModelAPI_Feature::feature(aSelectedObject);
-  if (aFeature.get()) {
-    std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
-                            std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
-    /// some sketch entities should be never shown, e.g. projection feature
-    /// such external features should not be used in selection
-    if (aSketchFeature.get() && !aSketchFeature->canBeDisplayed())
-      return ObjectPtr();
-  }
-
   if (!aSelectedObject.get()) {
     // Processing of external (non-sketch) object
-    aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
-                                                    theSelectedObject, theSketch, theTemporary);
+    FeaturePtr aCreatedFeature;
+    aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape,
+      theSelectedObject, theSketch, theTemporary, aCreatedFeature);
     if (aSelectedObject.get() && theTemporary)
-        myExternalObjectValidated = aSelectedObject;
+        myExternalObjectValidated = aCreatedFeature;
   }
   return aSelectedObject;
 }