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_Object.h>
24 #include <HYDROData_Zone.h>
26 class HYDROData_CalculationCase;
28 enum HYDROData_PriorityType
34 struct HYDROData_CustomRule
36 Handle(HYDROData_Object) Object1;
37 HYDROData_PriorityType Priority;
38 Handle(HYDROData_Object) Object2;
39 HYDROData_Zone::MergeAltitudesType MergeType;
42 typedef QList<HYDROData_CustomRule> HYDROData_ListOfRules;
44 class HYDROData_PriorityQueue
47 HYDROData_PriorityQueue( HYDROData_CalculationCase* );
48 ~HYDROData_PriorityQueue();
50 Handle_HYDROData_Object GetMostPriorityObject( const QStringList& theZoneObjects,
51 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
53 bool IsMorePriority( const Handle(HYDROData_Object)& theObj1,
54 const Handle(HYDROData_Object)& theObj2,
55 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
57 static void ClearRules( TDF_Label& theRulesLabel );
58 static void AddRule( TDF_Label& theRulesLabel,
59 const Handle(HYDROData_Object)& theObject1,
60 HYDROData_PriorityType thePriority,
61 const Handle(HYDROData_Object)& theObject2,
62 HYDROData_Zone::MergeAltitudesType theMergeType );
63 static HYDROData_ListOfRules GetRules( const TDF_Label& theRulesLabel );
64 static QString DumpRules( const TDF_Label& theRulesLab );
65 static void DumpRulesToPython( const TDF_Label& theRulesLab,
66 const QString& theCalcCaseName,
67 QStringList& theScript );
68 static bool GetRule( const TDF_Label& theRulesLab,
70 Handle(HYDROData_Object)& theObject1,
71 HYDROData_PriorityType& thePriority,
72 Handle(HYDROData_Object)& theObject2,
73 HYDROData_Zone::MergeAltitudesType& theMergeType );
75 typedef QMap<QString, Handle(HYDROData_Object)> MapNameToObject;
77 HYDROData_SequenceOfObjects myGeomObjects; ///< the ordered list of objects (default priority)
78 MapNameToObject myNames; ///< the map of name to object
79 HYDROData_ListOfRules myRules; ///< the list of rules