1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROData_PriorityQueue_HeaderFile
24 #define HYDROData_PriorityQueue_HeaderFile
27 #include <HYDROData_Object.h>
28 #include <HYDROData_Zone.h>
30 class HYDROData_CalculationCase;
32 enum HYDROData_PriorityType
38 struct HYDROData_CustomRule
40 Handle(HYDROData_Object) Object1;
41 HYDROData_PriorityType Priority;
42 Handle(HYDROData_Object) Object2;
43 HYDROData_Zone::MergeAltitudesType MergeType;
46 typedef QList<HYDROData_CustomRule> HYDROData_ListOfRules;
48 class HYDROData_PriorityQueue
51 HYDROData_PriorityQueue( HYDROData_CalculationCase* );
52 ~HYDROData_PriorityQueue();
54 Handle_HYDROData_Object GetMostPriorityObject( const QStringList& theZoneObjects,
55 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
57 bool IsMorePriority( const Handle(HYDROData_Object)& theObj1,
58 const Handle(HYDROData_Object)& theObj2,
59 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
61 static void ClearRules( TDF_Label& theRulesLabel );
62 static void AddRule( TDF_Label& theRulesLabel,
63 const Handle(HYDROData_Object)& theObject1,
64 HYDROData_PriorityType thePriority,
65 const Handle(HYDROData_Object)& theObject2,
66 HYDROData_Zone::MergeAltitudesType theMergeType );
67 static HYDROData_ListOfRules GetRules( const TDF_Label& theRulesLabel );
68 static QString DumpRules( const TDF_Label& theRulesLab );
69 static void DumpRulesToPython( const TDF_Label& theRulesLab,
70 const QString& theCalcCaseName,
71 QStringList& theScript );
72 static bool GetRule( const TDF_Label& theRulesLab,
74 Handle(HYDROData_Object)& theObject1,
75 HYDROData_PriorityType& thePriority,
76 Handle(HYDROData_Object)& theObject2,
77 HYDROData_Zone::MergeAltitudesType& theMergeType );
79 typedef QMap<QString, Handle(HYDROData_Object)> MapNameToObject;
81 HYDROData_SequenceOfObjects myGeomObjects; ///< the ordered list of objects (default priority)
82 MapNameToObject myNames; ///< the map of name to object
83 HYDROData_ListOfRules myRules; ///< the list of rules