1 // Copyright (C) 2009-2013 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 // class : Ensembles de propagation
22 #ifndef __PROPAGATION_H
23 #define __PROPAGATION_H
25 #include "Hex_defines.hxx"
26 #include "HexEltBase.hxx"
28 #include "HexDocument.hxx"
29 #include "HexEdge.hxx"
30 #include "HexXmlWriter.hxx"
32 #include "HexGlobale.hxx"
36 class HEXABLOCKENGINE_EXPORT Propagation : public EltBase
39 const Edges& getEdges () { return prop_edges; }
41 bool getWay () { return prop_way; }
43 void setWay (bool sens) { prop_way = sens; }
44 int setLaw (Law* loi);
47 Propagation (Document* doc);
48 void saveXml (XmlWriter* xml);
49 void addEdge (Edge* arete);
57 // =========================================================== Constructeur
58 inline Propagation::Propagation (Document* doc)
59 : EltBase (doc, EL_PROPAGATION)
64 // =========================================================== getLaw
65 inline Law* Propagation::getLaw ()
68 /* ********************************** Modif Abu du 18/10/2010
72 if (prop_edges.size()==0)
75 Document* root = prop_edges[0]->dad();
76 return root->getLaw (0);
77 ********************************** */
79 // =========================================================== setLaw
80 inline int Propagation::setLaw (Law* loi)
85 DumpStart ("setLaw", loi);
89 // =========================================================== majLaw
90 inline void Propagation::majLaw ()
92 int nbre = prop_edges.size();
93 for (int nro=0 ; nro < nbre ; nro++)
94 prop_edges[0]->setLaw (prop_law);
96 // =========================================================== addEdge
97 inline void Propagation::addEdge (Edge* arete)
99 prop_edges.push_back (arete);
101 if (prop_law == NULL)
102 prop_law = arete->getLaw();
104 // =========================================================== saveXml
105 inline void Propagation::saveXml (XmlWriter* xml)
108 cpchar booleen [] = { "true", "false" };
109 cpchar law = prop_law == NULL ? "default" : prop_law->getName();
111 xml->openMark ("Propagation");
112 xml->addAttribute ("edge", prop_edges[0]->getName (buffer));
113 xml->addAttribute ("law", law);
114 xml->addAttribute ("way", booleen [prop_way]);