1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_PriorityQueue_HeaderFile
20 #define HYDROData_PriorityQueue_HeaderFile
23 #include <HYDROData_Entity.h>
24 #include <HYDROData_Zone.h>
26 class HYDROData_CalculationCase;
28 enum HYDROData_PriorityType
34 struct HYDROData_CustomRule
36 Handle(HYDROData_Entity) Object1;
37 HYDROData_PriorityType Priority;
38 Handle(HYDROData_Entity) Object2;
39 HYDROData_Zone::MergeAltitudesType MergeType;
42 typedef QList<HYDROData_CustomRule> HYDROData_ListOfRules;
44 class HYDROData_PriorityQueue
47 HYDROData_PriorityQueue( HYDROData_CalculationCase* theCalcCase,
48 Standard_Integer aTag );
49 ~HYDROData_PriorityQueue();
51 Handle_HYDROData_Entity GetMostPriorityObject( const QStringList& theZoneObjects,
52 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
54 bool IsMorePriority( const Handle(HYDROData_Entity)& theObj1,
55 const Handle(HYDROData_Entity)& theObj2,
56 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
58 static void ClearRules( TDF_Label& theRulesLabel );
59 static void AddRule( TDF_Label& theRulesLabel,
60 const Handle(HYDROData_Entity)& theObject1,
61 HYDROData_PriorityType thePriority,
62 const Handle(HYDROData_Entity)& theObject2,
63 HYDROData_Zone::MergeAltitudesType theMergeType );
64 static HYDROData_ListOfRules GetRules( const TDF_Label& theRulesLabel );
65 static QString DumpRules( const TDF_Label& theRulesLab );
66 static void DumpRulesToPython( const TDF_Label& theRulesLab,
67 const QString& theCalcCaseName,
68 QStringList& theScript );
69 static bool GetRule( const TDF_Label& theRulesLab,
71 Handle(HYDROData_Entity)& theObject1,
72 HYDROData_PriorityType& thePriority,
73 Handle(HYDROData_Entity)& theObject2,
74 HYDROData_Zone::MergeAltitudesType& theMergeType );
76 typedef QMap<QString, Handle(HYDROData_Entity)> MapNameToObject;
78 HYDROData_SequenceOfObjects myGeomObjects; ///< the ordered list of objects (default priority)
79 MapNameToObject myNames; ///< the map of name to object
80 HYDROData_ListOfRules myRules; ///< the list of rules