]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_PriorityQueue.h
Salome HOME
methods for getting rules are implemented
[modules/hydro.git] / src / HYDROData / HYDROData_PriorityQueue.h
1
2 #ifndef HYDROData_PriorityQueue_HeaderFile
3 #define HYDROData_PriorityQueue_HeaderFile
4
5 #include <QMap>
6 #include <HYDROData_Object.h>
7 #include <HYDROData_Zone.h>
8
9 class HYDROData_CalculationCase;
10
11 enum HYDROData_PriorityType
12 {
13   LESS,
14   GREATER,
15 };
16
17 struct HYDROData_CustomRule
18 {
19   Handle(HYDROData_Object)           Object1;
20   HYDROData_PriorityType             Priority;
21   Handle(HYDROData_Object)           Object2;
22   HYDROData_Zone::MergeAltitudesType MergeType;
23 };
24
25 typedef QList<HYDROData_CustomRule> HYDROData_ListOfRules;
26
27 class HYDROData_PriorityQueue
28 {
29 public:
30   HYDROData_PriorityQueue( HYDROData_CalculationCase* );
31   ~HYDROData_PriorityQueue();
32
33   Handle_HYDROData_Object GetMostPriorityObject( const QStringList& theZoneObjects,
34                                                  HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
35
36   bool IsMorePriority( const Handle(HYDROData_Object)& theObj1,
37                        const Handle(HYDROData_Object)& theObj2,
38                        HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
39
40   static void ClearRules( TDF_Label& theRulesLabel );
41   static void AddRule( TDF_Label& theRulesLabel,
42                        const Handle(HYDROData_Object)&    theObject1,
43                        HYDROData_PriorityType             thePriority,
44                        const Handle(HYDROData_Object)&    theObject2,
45                        HYDROData_Zone::MergeAltitudesType theMergeType );
46   static HYDROData_ListOfRules GetRules( const TDF_Label& theRulesLabel );
47   static QString DumpRules( const TDF_Label& theRulesLab );
48   static void DumpRulesToPython( const TDF_Label& theRulesLab,
49                                  const QString& theCalcCaseName,
50                                  QStringList& theScript );
51   static int GetRulesCount( const TDF_Label& theRulesLab );
52   static bool GetRule( const TDF_Label& theRulesLab,
53                        int theIndex, 
54                        Handle(HYDROData_Object)&           theObject1,
55                        HYDROData_PriorityType&             thePriority,
56                        Handle(HYDROData_Object)&           theObject2,
57                        HYDROData_Zone::MergeAltitudesType& theMergeType );
58 private:
59   typedef QMap<QString, Handle(HYDROData_Object)> MapNameToObject;
60
61   HYDROData_SequenceOfObjects myGeomObjects;  ///< the ordered list of objects (default priority)
62   MapNameToObject             myNames;        ///< the map of name to object
63   HYDROData_ListOfRules       myRules;        ///< the list of rules
64 };
65
66 #endif
67