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 "HexDocument.hxx"
26 #include "HexEdge.hxx"
27 #include "HexXmlWriter.hxx"
35 const Edges& getEdges () { return prop_edges; }
37 bool getWay () { return prop_way; }
39 void setWay (bool sens) { prop_way = sens; }
40 int setLaw (Law* loi);
44 void saveXml (XmlWriter* xml);
45 void addEdge (Edge* arete);
53 // =========================================================== Constructeur
54 inline Propagation::Propagation ()
59 // =========================================================== getLaw
60 inline Law* Propagation::getLaw ()
63 /* ********************************** Modif Abu du 18/10/2010
67 if (prop_edges.size()==0)
70 Document* root = prop_edges[0]->dad();
71 return root->getLaw (0);
72 ********************************** */
74 // =========================================================== setLaw
75 inline int Propagation::setLaw (Law* loi)
81 // =========================================================== majLaw
82 inline void Propagation::majLaw ()
84 int nbre = prop_edges.size();
85 for (int nro=0 ; nro < nbre ; nro++)
86 prop_edges[0]->setLaw (prop_law);
88 // =========================================================== addEdge
89 inline void Propagation::addEdge (Edge* arete)
91 prop_edges.push_back (arete);
94 prop_law = arete->getLaw();
96 // =========================================================== saveXml
97 inline void Propagation::saveXml (XmlWriter* xml)
100 cpchar booleen [] = { "true", "false" };
101 cpchar law = prop_law == NULL ? "default" : prop_law->getName();
103 xml->openMark ("Propagation");
104 xml->addAttribute ("edge", prop_edges[0]->getName (buffer));
105 xml->addAttribute ("law", law);
106 xml->addAttribute ("way", booleen [prop_way]);