X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Module.cpp;h=2b92c351a5ec2fdf8a88d31fd0c77168050d70cb;hb=6f84fd29d85b783864cdbb3ac9fdd6a3ad3cbb7c;hp=b05715c3847463a83df72c4fdda44ae894ae3c8d;hpb=a2686c838648dcf05659df3c31d9b90aca42b792;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index b05715c38..2b92c351a 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -51,6 +52,7 @@ //#include #include +#include #include #include @@ -115,6 +117,7 @@ void PartSet_Module::registerValidators() aFactory->registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator); aFactory->registerValidator("PartSet_RigidValidator", new PartSet_RigidValidator); aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator); + aFactory->registerValidator("PartSet_DifferentShapes", new ModelAPI_ShapeValidator); aFactory->registerValidator("PartSet_SketchValidator", new PartSet_SketchValidator); } @@ -132,6 +135,14 @@ void PartSet_Module::registerFilters() new ModuleBase_FilterCustom(aSelectFilter)); } +void PartSet_Module::registerProperties() +{ + Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double, + PLANE_SIZE); + Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness", + Config_Prop::Integer, SKETCH_WIDTH); +} + void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) { if (theOperation->isEditOperation()) @@ -190,15 +201,28 @@ void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const { bool aCanDisplay = false; - if (mySketchMgr->activeSketch()) { + CompositeFeaturePtr aSketchFeature = mySketchMgr->activeSketch(); + if (aSketchFeature.get() != NULL) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); - if (aFeature.get() != NULL) { - if (aFeature == mySketchMgr->activeSketch()) { + // MPV: the second and third conditions to avoid crash on exit for application + if (aFeature.get() != NULL && aFeature->data().get() && aFeature->data()->isValid()) { + if (aFeature == aSketchFeature) { aCanDisplay = false; } - else { - aCanDisplay = mySketchMgr->sketchOperationIdList().contains(aFeature->getKind().c_str()); + else if (aSketchFeature.get() && aSketchFeature->data().get() && + aSketchFeature->data()->isValid()) { + for (int i = 0; i < aSketchFeature->numberOfSubs() && !aCanDisplay; i++) { + FeaturePtr aSubFeature = aSketchFeature->subFeature(i); + std::list aResults = aSubFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.begin(); aIt != aResults.end() && !aCanDisplay; ++aIt) { + if (theObject == (*aIt)) + aCanDisplay = true; + } + if (aSubFeature == theObject) + aCanDisplay = true; + } } } }