]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Debug of the case-validation
authormpv <mpv@opencascade.com>
Fri, 27 Feb 2015 14:47:10 +0000 (17:47 +0300)
committermpv <mpv@opencascade.com>
Fri, 27 Feb 2015 14:47:10 +0000 (17:47 +0300)
src/Config/Config_FeatureReader.cpp
src/ConstructionPlugin/axis_widget.xml
src/Model/Model_Update.cpp
src/Model/Model_Validator.h
src/ModelAPI/ModelAPI_Validator.h

index 05091fb2f04e8b50138751eeaecd81e504c420da..dea07dfc7420203fffaa8da699e8ddd36fc3220d 100644 (file)
@@ -85,7 +85,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
         Events_Loop::loop()->send(aMessage);
       }
     // container pages, like "case" or "box"
-    } else if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_SWITCH, WDG_TOOLBOX, NULL)) {
+    } else if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) {
       storeAttribute(theNode, _ID); // save case:caseId (or box:boxId)
     }
   }
@@ -95,7 +95,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
 
 void Config_FeatureReader::cleanup(xmlNodePtr theNode)
 {
-  if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_SWITCH, WDG_TOOLBOX, NULL)) {
+  if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) {
     // cleanup id of cases when leave case node
     cleanupAttribute(theNode, _ID);
   }
index 5b554016697664cabf3ca0a9c1e41229a0205338..7173f114c221a717744fadfb16b72a478dd964e9 100644 (file)
@@ -20,7 +20,7 @@
       </shape_selector>
     </box>
     <box id="AxisByCylindricalFaceCase" title="As axis of cylindrical face">
-      <shape_selector id="main_object
+      <shape_selector id="cylindricalFace
         label="Main object" 
         icon=":icons/circle.png" 
         tooltip="Select a cylindrical object"
index d6f02c5f79f2bf3eae4970f4042fa91e4b40f390..2c32f0467ca08193e9a33f916d8e0796e3e42522 100644 (file)
@@ -256,7 +256,8 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
                 std::shared_ptr<ModelAPI_AttributeSelection> aSel =
                   std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
                 if (!aSel->update()) { // this must be done on execution since it may be long operation
-                  if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel)))
+                  if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel)) &&
+                      aFactory->isCase(theFeature, theFeature->data()->id(aSel)))
                     aState = ModelAPI_StateInvalidArgument;
                 }
               }
@@ -270,7 +271,8 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
                   if (aSelAttr) {
                     if (!aSelAttr->update()) {
                       if (!aFactory->isNotObligatory(
-                          theFeature->getKind(), theFeature->data()->id(aSel)))
+                            theFeature->getKind(), theFeature->data()->id(aSel)) &&
+                          aFactory->isCase(theFeature, theFeature->data()->id(aSel)))
                         aState = ModelAPI_StateInvalidArgument;
                     }
                   }
index b3324c45862a0703a711823bd145063cbb681c92..0bd242ad202e0e06828f0240a6192a9df831bf13 100644 (file)
@@ -9,7 +9,6 @@
 
 #include <Model.h>
 #include <ModelAPI_Validator.h>
-#include <ModelAPI_Feature.h>
 #include <map>
 #include <set>
 
index 42662b10d4e6adfd7db9ccdae6992a6bee9427df..926ae886c1c9787b2374749efda0a127f091ecd0 100644 (file)
@@ -8,6 +8,7 @@
 #define ModelAPI_Validator_H_
 
 #include <ModelAPI.h>
+#include <ModelAPI_Feature.h>
 #include <memory>
 #include <list>
 
@@ -99,6 +100,9 @@ class MODELAPI_EXPORT ModelAPI_ValidatorsFactory
   virtual void registerCase(std::string theFeature, std::string theAttribute,
     std::string theSwitchId, std::string theCaseId) = 0;
 
+ /// Returns true if the attribute must be checked (the case is selected)
+  virtual bool isCase(FeaturePtr theFeature, std::string theAttribute) = 0;
+
  protected:
   /// Get instance from Session
   ModelAPI_ValidatorsFactory()