Salome HOME
Send switch id in a attribute message as the case id
authorsbh <sergey.belash@opencascade.com>
Mon, 22 Dec 2014 11:07:42 +0000 (14:07 +0300)
committersbh <sergey.belash@opencascade.com>
Fri, 27 Feb 2015 14:01:39 +0000 (17:01 +0300)
src/Config/Config_AttributeMessage.cpp
src/Config/Config_AttributeMessage.h
src/Config/Config_FeatureReader.cpp

index 8009b12e49514ad900f7b43d5ca27d181415dc66..973dd3930e2fb272d2157cad99cfc1882c0d7ce3 100644 (file)
@@ -62,7 +62,17 @@ const std::string& Config_AttributeMessage::caseId() const
   return myCaseId;
 }
 
+const std::string& Config_AttributeMessage::switchId() const
+{
+  return mySwitchId;
+}
+
 void Config_AttributeMessage::setCaseId(const std::string& theId)
 {
   this->myCaseId = theId;
 }
+
+void Config_AttributeMessage::setSwitchId(const std::string& theId)
+{
+  this->mySwitchId = theId;
+}
index 7b2bd12b6014c223bd1f7161fd5ca4b5986706d4..e9ab250ea633cbeddab9e34fc07f74f3bac6da1a 100644 (file)
@@ -23,6 +23,7 @@ class Config_AttributeMessage : public Events_Message
   bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
   bool myIsConcealment; ///< If true, conceals features used as input
   std::string myCaseId; ///< Attribute's case's id, if it placed inside a paged containers
+  std::string mySwitchId; ///< Attribute's switch id, if it placed inside a paged containers
 
  public:
   /// Same event as Config_FeatureMessage::MODEL_EVENT()
@@ -48,6 +49,8 @@ class Config_AttributeMessage : public Events_Message
   CONFIG_EXPORT bool isConcealment() const;
   /// Returns id of a case which contain the attribute
   CONFIG_EXPORT const std::string& caseId() const;
+  /// Returns id of a switch which contain the attribute
+  CONFIG_EXPORT const std::string& switchId() const;
 
   /// Set attribute's unique id
   CONFIG_EXPORT void setAttributeId(const std::string& theId);
@@ -59,7 +62,8 @@ class Config_AttributeMessage : public Events_Message
   CONFIG_EXPORT void setObligatory(bool isObligatory);
   /// Set attribute's case
   CONFIG_EXPORT void setCaseId(const std::string& id);
-
+  /// Set attribute's switch
+  CONFIG_EXPORT void setSwitchId(const std::string& id);
 };
 
 #endif // ATTRIBUTE_MESSAGE_H
index adf8f5e7abb8623d3edc81e1f442ec2393ef7835..05091fb2f04e8b50138751eeaecd81e504c420da 100644 (file)
@@ -76,12 +76,16 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
           const char* kWdgCase = hasParent(theNode, WDG_SWITCH_CASE, NULL)
                                  ? WDG_SWITCH_CASE
                                  : WDG_TOOLBOX_BOX;
+          const char* kWdgSwitch = hasParent(theNode, WDG_SWITCH_CASE, NULL)
+                                   ? WDG_SWITCH
+                                   : WDG_TOOLBOX;
           aMessage->setCaseId(restoreAttribute(kWdgCase, _ID));
+          aMessage->setSwitchId(restoreAttribute(kWdgSwitch, _ID));
         }
         Events_Loop::loop()->send(aMessage);
       }
     // container pages, like "case" or "box"
-    } else if (isCaseNode(theNode)) {
+    } else if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_SWITCH, WDG_TOOLBOX, NULL)) {
       storeAttribute(theNode, _ID); // save case:caseId (or box:boxId)
     }
   }
@@ -91,7 +95,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
 
 void Config_FeatureReader::cleanup(xmlNodePtr theNode)
 {
-  if (isCaseNode(theNode)) {
+  if (isNode(theNode, WDG_SWITCH, WDG_SWITCH_CASE, WDG_SWITCH, WDG_TOOLBOX, NULL)) {
     // cleanup id of cases when leave case node
     cleanupAttribute(theNode, _ID);
   }