]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_WidgetConstraintShapeSelector.cpp
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
[modules/shaper.git] / src / PartSet / PartSet_WidgetConstraintShapeSelector.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetShapeSelector.cpp
4 // Created:     27 Nov 2014
5 // Author:      Vitaly Smetannikov
6
7 #include "PartSet_WidgetConstraintShapeSelector.h"
8
9 #include <ModelAPI_Session.h>
10 #include <ModelAPI_Validator.h>
11
12 #include <PartSet_Tools.h>
13 #include <SketchPlugin_Feature.h>
14
15 bool PartSet_WidgetConstraintShapeSelector::setObject(ObjectPtr theSelectedObject, GeomShapePtr theShape)
16 {
17   ObjectPtr aSelectedObject = theSelectedObject;
18
19   FeaturePtr aFeature = ModelAPI_Feature::feature(aSelectedObject);
20   if (aFeature) {
21     std::shared_ptr<SketchPlugin_Feature> aSPFeature = 
22             std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
23     if ((!aSPFeature) && (!theShape->isNull())) {
24       createExternal(theSelectedObject, theShape);
25
26       if (myExternalObject) {
27         aSelectedObject = myExternalObject;
28       } else 
29         return false;
30     }
31   }
32   return ModuleBase_WidgetShapeSelector::setObject(aSelectedObject, theShape);
33 }