1 // Copyright (C) 2009-2022 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, or (at your option) any later version.
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 "HexEltBase.hxx"
27 #include "HexDocument.hxx"
28 #include "HexEdge.hxx"
29 #include "HexXmlWriter.hxx"
31 #include "HexGlobale.hxx"
35 class HexaExport Propagation : public EltBase
38 const Edges& getEdges () { return prop_edges; }
40 bool getWay () { return prop_way; }
42 void setWay (bool sens) { prop_way = sens; }
43 int setLaw (Law* loi);
46 Propagation (Document* doc);
47 void saveXml (XmlWriter* xml);
48 void addEdge (Edge* arete);
56 // =========================================================== Constructeur
57 inline Propagation::Propagation (Document* doc)
58 : EltBase (doc, EL_PROPAGATION)
63 // =========================================================== getLaw
64 inline Law* Propagation::getLaw ()
67 /* ********************************** Modif Abu du 18/10/2010
71 if (prop_edges.size()==0)
74 Document* root = prop_edges[0]->dad();
75 return root->getLaw (0);
76 ********************************** */
78 // =========================================================== setLaw
79 inline int Propagation::setLaw (Law* loi)
84 DumpStart ("setLaw", loi);
88 // =========================================================== majLaw
89 inline void Propagation::majLaw ()
91 int nbre = prop_edges.size();
92 for (int nro=0 ; nro < nbre ; nro++)
93 prop_edges[0]->setLaw (prop_law);
95 // =========================================================== addEdge
96 inline void Propagation::addEdge (Edge* arete)
98 prop_edges.push_back (arete);
100 if (prop_law == NULL)
101 prop_law = arete->getLaw();
103 // =========================================================== saveXml
104 inline void Propagation::saveXml (XmlWriter* xml)
107 cpchar booleen [] = { "true", "false" };
108 cpchar law = prop_law == NULL ? "default" : prop_law->getName();
110 xml->openMark ("Propagation");
111 xml->addAttribute ("edge", prop_edges[0]->getName (buffer));
112 xml->addAttribute ("law", law);
113 xml->addAttribute ("way", booleen [prop_way]);