Version: 9.16.0
YACSGuiLoader.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
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, or (at your option) any later version.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "YACSGuiLoader.hxx"
21#include "Proc.hxx"
22#include "Node.hxx"
23
24//#define _DEVDEBUG_
25#include "YacsTrace.hxx"
26
27using namespace std;
28using namespace YACS::HMI;
29using namespace YACS::ENGINE;
30
32
33YACSGuiLoader::YACSGuiLoader()
34 : YACSLoader()
35{
37 _defaultParsersMap.insert(make_pair("presentation", &presentation_parser));
38 _inputMap.clear();
39 _prsMap.clear();
40}
41
43{
44}
45
47{
48 _inputMap.clear();
49}
50
52{
53 _inputMap.clear();
54 return YACS::YACSLoader::load(filename);
55}
56
57std::map<YACS::ENGINE::Node*, PrsData> YACSGuiLoader::getPrsData(YACS::ENGINE::Proc* proc)
58{
59 _prsMap.clear();
60
61 if (_defaultParsersMap.empty()) return _prsMap;
62
63 for (map<string, PrsData>::iterator it = _inputMap.begin(); it != _inputMap.end(); ++it)
64 {
65 Node* node = 0;
66 string name = (*it).first;
67
68 if (name == "__ROOT__")
69 node = proc;
70 else
71 {
72 try
73 {
74 node = proc->getChildByName(name);
75 }
76 catch(Exception& ex)
77 {
78 continue;
79 }
80 }
81 _prsMap[node] = (*it).second;
82 }
83 return _prsMap;
84}
85
86void YACSGuiLoader::process(std::string theElement, bool theNewLink)
87{
88 if(theElement == "presentation")
89 {
90 if ( _defaultParsersMap["presentation"] )
91 {
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_);
97 }
98 }
99}
static presentationtype_parser presentation_parser
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Node * getChildByName(const std::string &name) const
Base class for all nodes.
Definition: Node.hxx:70
Base class for all schema objects.
Definition: Proc.hxx:44
std::map< YACS::ENGINE::Node *, PrsData > _prsMap
void process(std::string element, bool newLink=false)
std::map< std::string, PrsData > _inputMap
std::map< YACS::ENGINE::Node *, PrsData > getPrsData(YACS::ENGINE::Proc *proc)
virtual YACS::ENGINE::Proc * load(const char *filename)
virtual YACS::ENGINE::Proc * load(const char *filename)
Definition: parsers.cxx:63
std::map< std::string, parser * > _defaultParsersMap
Definition: parsers.hxx:44