Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/yacs.git] / src / genericgui / YACSGuiLoader.cxx
index a22c17a777d18d580842a57f8a33ff09963b9815..a800dc985a6f380ccc1e435ba7c1f299eb93db71 100644 (file)
@@ -1,3 +1,21 @@
+// Copyright (C) 2006-2012  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include "YACSGuiLoader.hxx"
 #include "Proc.hxx"
@@ -25,10 +43,15 @@ YACSGuiLoader::~YACSGuiLoader()
 {
 }
 
+void YACSGuiLoader::reset()
+{
+  _inputMap.clear();
+}
+
 YACS::ENGINE::Proc* YACSGuiLoader::load(const char *filename)
 {
   _inputMap.clear();
-  YACS::YACSLoader::load(filename);
+  return YACS::YACSLoader::load(filename);
 }
 
 std::map<YACS::ENGINE::Node*, PrsData> YACSGuiLoader::getPrsData(YACS::ENGINE::Proc* proc)
@@ -42,11 +65,19 @@ std::map<YACS::ENGINE::Node*, PrsData> YACSGuiLoader::getPrsData(YACS::ENGINE::P
     Node* node = 0;
     string name = (*it).first;
 
-    if (name != "__ROOT__")
-      node = proc->getChildByName(name);
-    else
+    if (name == "__ROOT__")
       node = proc;
-
+    else
+      {
+        try
+          {
+            node = proc->getChildByName(name);
+          }
+        catch(Exception& ex)
+          {
+            continue;
+          }
+      }
     _prsMap[node] = (*it).second;
   }
   return _prsMap;
@@ -59,8 +90,10 @@ void YACSGuiLoader::process(std::string theElement, bool theNewLink)
     if ( _defaultParsersMap["presentation"] )
     {
       presentationtype_parser* aP = (presentationtype_parser*)_defaultParsersMap["presentation"];
-      _inputMap[aP->name_] = PrsData(aP->x_, aP->y_, aP->width_, aP->height_);
-      DEBTRACE(aP->name_ << " " << aP->x_ << " " << aP->y_ << " " <<  aP->width_ << " " << aP->height_);
+      _inputMap[aP->name_] = PrsData(aP->x_, aP->y_, aP->width_, aP->height_, aP->expx_, aP->expy_,
+                                     aP->expWidth_, aP->expHeight_, aP->expanded_, aP->shownState_);
+      DEBTRACE(aP->name_ << " " << aP->x_ << " " << aP->y_ << " " <<  aP->width_ << " " << aP->height_ << " " 
+               << aP->expx_ << " " << aP->expy_ << " " << aP->expWidth_ << " " << aP->expHeight_ << " " << aP->expanded_ << " " << aP->shownState_);
     }
   }
 }