]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_Module.cpp
Salome HOME
Result attributes validators created
[modules/shaper.git] / src / PartSet / PartSet_Module.cpp
index b41cf30053ce1651c7b0a3bbc1115b6714ac8be0..6ddaeabe155a71db3cc1c02997f9671e7fa8fee8 100644 (file)
@@ -106,10 +106,6 @@ XGUI_Workshop* PartSet_Module::workshop() const
 
 void PartSet_Module::createFeatures()
 {
-  Config_ModuleReader aXMLReader = Config_ModuleReader();
-  aXMLReader.readAll();
-  myFeaturesInFiles = aXMLReader.featuresInFiles();
-
   //!! Test registering of validators
   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
@@ -118,6 +114,10 @@ void PartSet_Module::createFeatures()
   aFactory->registerValidator("PartSet_PerpendicularValidator", new PartSet_PerpendicularValidator);
   aFactory->registerValidator("PartSet_ParallelValidator", new PartSet_ParallelValidator);
   aFactory->registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator);
+
+  Config_ModuleReader aXMLReader = Config_ModuleReader();
+  aXMLReader.readAll();
+  myFeaturesInFiles = aXMLReader.featuresInFiles();
 }
 
 void PartSet_Module::featureCreated(QAction* theFeature)
@@ -344,24 +344,37 @@ void PartSet_Module::onCloseLocalContext()
 
 void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
 {
-  ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
-  PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
-  if (aPrevOp) {
-    std::list<FeaturePtr> aList = aPrevOp->subFeatures();
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
-    std::list<FeaturePtr>::iterator aSFIt; 
-    for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
-      std::list<ResultPtr> aResults = (*aSFIt)->results();
-      std::list<ResultPtr>::iterator aIt;
-      for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
-        aDisplayer->activateInLocalContext((*aIt), aModes, false);
+//  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
+//  if (isDisplay) {
+    ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
+    PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
+    if (aPrevOp) {
+      std::list<FeaturePtr> aList = aPrevOp->subFeatures();
+      XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+      std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
+      std::list<FeaturePtr>::iterator aSFIt; 
+      for (aSFIt = aList.begin(); aSFIt != aList.end(); ++aSFIt) {
+        std::list<ResultPtr> aResults = (*aSFIt)->results();
+        std::list<ResultPtr>::iterator aIt;
+        for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+          aDisplayer->activateInLocalContext((*aIt), aModes, false);
+        }
       }
     }
-  }
-  ModelAPI_EventCreator::get()->sendUpdated(theFeature, 
-      Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
-
+/*      FeaturePtr aFeature = aPrevOp->feature();
+      if (aFeature) {
+        std::list<ResultPtr> aResList = aFeature->results();
+        std::list<ResultPtr>::iterator aIt;
+        for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt) {
+          aDisplayer->deactivate((*aIt), false);
+        }
+      }
+    }*/
+    ModelAPI_EventCreator::get()->sendUpdated(theFeature, 
+        Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+//  }
+//  else
+//    ->erase(theFeature->firstResult(), true);
 /*  bool isDisplay = theMode != PartSet_OperationSketchBase::FM_Hide;
   // TODO visualizePreview(theFeature, isDisplay, false);
   if (!isDisplay) {
@@ -507,16 +520,8 @@ void PartSet_Module::activateFeature(ObjectPtr theFeature, const bool isUpdateVi
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
     XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    aDisplayer->activateInLocalContext(theFeature, aPreviewOp->getSelectionModes(theFeature),
-                                        isUpdateViewer);
-/*    FeaturePtr aFeature = aPreviewOp->feature();
-    if (aFeature) {
-      std::list<ResultPtr> aResList = aFeature->results();
-      std::list<ResultPtr>::iterator aIt;
-      for (aIt = aResList.begin(); aIt != aResList.end(); ++aIt) {
-        aDisplayer->deactivate((*aIt), false);
-      }
-    }*/
+    std::list<int> aModes = aPreviewOp->getSelectionModes(theFeature);
+    aDisplayer->activateInLocalContext(theFeature, aModes, isUpdateViewer);
   }
 }
 
@@ -608,7 +613,7 @@ QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget*
                          Config_WidgetAPI* theWidgetApi, QList<ModuleBase_ModelWidget*>& theModelWidgets)
 {
   if (theType == "sketch-start-label") {
-    PartSet_WidgetSketchLabel* aWgt = new PartSet_WidgetSketchLabel(theParent, theWidgetApi);
+    PartSet_WidgetSketchLabel* aWgt = new PartSet_WidgetSketchLabel(theParent, theWidgetApi, "");
     aWgt->setOperationsMgr(myWorkshop->operationMgr());
     theModelWidgets.append(aWgt);
     return aWgt->getControl();