Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/yacs.git] / src / genericgui / VisitorSaveGuiSchema.cxx
index 335b5117cc1b2ab38a470fdccf51a5e5507bab50..d03ed8f37c7f646978e955c6d8845855467b060b 100644 (file)
@@ -1,26 +1,28 @@
-//  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+// 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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include "VisitorSaveGuiSchema.hxx"
 #include "Proc.hxx"
 #include "QtGuiContext.hxx"
 #include "guiObservers.hxx"
 #include "SceneItem.hxx"
+#include "SceneNodeItem.hxx"
 
 #include <cassert>
 
@@ -59,24 +61,34 @@ void VisitorSaveGuiSchema::writePresentation()
     Node* node = *iter;
     SubjectNode * snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
     SceneItem* item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
-    assert(item);
-    writeItem(_proc->getChildName(node), item);
+    YASSERT(item);
+    SceneNodeItem* inode = dynamic_cast<SceneNodeItem*>(item);
+    YASSERT(inode);
+    writeItem(_proc->getChildName(node), inode);
   }
 
   SubjectNode * sproc = QtGuiContext::getQtCurrent()->getSubjectProc();
   SceneItem* item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sproc];
-  assert(item);
-  writeItem("__ROOT__", item);
+  YASSERT(item);
+  SceneNodeItem* inode = dynamic_cast<SceneNodeItem*>(item);
+  YASSERT(inode);
+  writeItem("__ROOT__", inode);
 }
 
- void VisitorSaveGuiSchema::writeItem(std::string name, SceneItem* item)
+ void VisitorSaveGuiSchema::writeItem(std::string name, SceneNodeItem* item)
 {
   int depth = 1;
   _out << indent(depth) << "<presentation";
-  _out                  << " name=\""  << name               << "\"";
-  _out                  << " x=\""     << item->x()          << "\"";
-  _out                  << " y=\""     << item->y()          << "\"";
-  _out                  << " width=\"" << item->getWidth()   << "\"";
-  _out                  << " height=\""<< item->getHeight()  << "\"";
+  _out                  << " name=\""       << name                      << "\"";
+  _out                  << " x=\""          << item->x()                 << "\"";
+  _out                  << " y=\""          << item->y()                 << "\"";
+  _out                  << " width=\""      << item->getWidth()          << "\"";
+  _out                  << " height=\""     << item->getHeight()         << "\"";
+  _out                  << " expanded=\""   << item->isExpanded()        << "\"";
+  _out                  << " expx=\""       << item->getExpandedX()      << "\"";
+  _out                  << " expy=\""       << item->getExpandedY()      << "\"";
+  _out                  << " expWidth=\""   << item->getExpandedWidth()  << "\"";
+  _out                  << " expHeight=\""  << item->getExpandedHeight() << "\"";
+  _out                  << " shownState=\"" << item->getShownState()     << "\"";
   _out                  << "/>" << endl;
 }