1 // Copyright (C) 2006-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "YACSGuiLoader.hxx"
25 #include "YacsTrace.hxx"
28 using namespace YACS::HMI;
29 using namespace YACS::ENGINE;
31 static presentationtype_parser presentation_parser;
33 YACSGuiLoader::YACSGuiLoader()
36 presentation_parser.collector_ = this;
37 _defaultParsersMap.insert(make_pair("presentation", &presentation_parser));
42 YACSGuiLoader::~YACSGuiLoader()
46 void YACSGuiLoader::reset()
51 YACS::ENGINE::Proc* YACSGuiLoader::load(const char *filename)
54 return YACS::YACSLoader::load(filename);
57 std::map<YACS::ENGINE::Node*, PrsData> YACSGuiLoader::getPrsData(YACS::ENGINE::Proc* proc)
61 if (_defaultParsersMap.empty()) return _prsMap;
63 for (map<string, PrsData>::iterator it = _inputMap.begin(); it != _inputMap.end(); ++it)
66 string name = (*it).first;
68 if (name == "__ROOT__")
74 node = proc->getChildByName(name);
81 _prsMap[node] = (*it).second;
86 void YACSGuiLoader::process(std::string theElement, bool theNewLink)
88 if(theElement == "presentation")
90 if ( _defaultParsersMap["presentation"] )
92 presentationtype_parser* aP = (presentationtype_parser*)_defaultParsersMap["presentation"];
93 _inputMap[aP->name_] = PrsData(aP->x_, aP->y_, aP->width_, aP->height_, aP->expx_, aP->expy_,
94 aP->expWidth_, aP->expHeight_, aP->expanded_, aP->shownState_);
95 DEBTRACE(aP->name_ << " " << aP->x_ << " " << aP->y_ << " " << aP->width_ << " " << aP->height_ << " "
96 << aP->expx_ << " " << aP->expy_ << " " << aP->expWidth_ << " " << aP->expHeight_ << " " << aP->expanded_ << " " << aP->shownState_);