]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #573, #574: implementation of ordered list widget and a table to define prioriti...
authormkr <mkr@opencascade.com>
Thu, 11 Jun 2015 14:56:06 +0000 (17:56 +0300)
committermkr <mkr@opencascade.com>
Thu, 11 Jun 2015 14:56:06 +0000 (17:56 +0300)
13 files changed:
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CalculationCase.h
src/HYDROData/HYDROData_PriorityQueue.cxx
src/HYDROData/HYDROData_PriorityQueue.h
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h
src/HYDROGUI/HYDROGUI_PriorityTableModel.cxx
src/HYDROGUI/HYDROGUI_PriorityTableModel.h
src/HYDROGUI/HYDROGUI_PriorityWidget.cxx
src/HYDROGUI/HYDROGUI_PriorityWidget.h
src/HYDROPy/HYDROData_CalculationCase.sip

index 8ef1bd1b1173c8e30e6c207fa20053c5770d1c3f..bfed4f10d357b74e775bfd9e9ad784c5cef330eb 100644 (file)
@@ -348,7 +348,7 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume
   QMap<QString, Handle(HYDROData_Region)> aRegionsMap; //object name to region
   QMap<QString, QString> aRegionNameToObjNameMap;
   QString aZonesPref = CALCULATION_ZONES_PREF;
-  HYDROData_PriorityQueue aPr( this );
+  HYDROData_PriorityQueue aPr( this, DataTag_CustomRules );
 
   // 1. First we create a default region for each object included into the calculation case
   HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects();
@@ -371,7 +371,8 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume
   {
     const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next();
     HYDROData_Zone::MergeAltitudesType aMergeType;
-    Handle(HYDROData_Object) aRegObj = aPr.GetMostPriorityObject( aSplitData.ObjectNames, aMergeType );
+    Handle(HYDROData_Object) aRegObj =
+      Handle(HYDROData_Object)::DownCast( aPr.GetMostPriorityObject( aSplitData.ObjectNames, aMergeType ) );
     if( aRegObj.IsNull() )
       continue;
     Handle(HYDROData_Region) aRegion = aRegionsMap[aRegObj->GetName()];
@@ -1237,9 +1238,10 @@ GEOM::GEOM_Object_ptr HYDROData_CalculationCase::publishShapeInGEOM(
   return aGeomObj._retn();
 }
 
-void HYDROData_CalculationCase::ClearRules( const bool theIsSetToUpdate )
+void HYDROData_CalculationCase::ClearRules( HYDROData_CalculationCase::DataTag theDataTag,
+                                            const bool theIsSetToUpdate )
 {
-  TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
+  TDF_Label aRulesLab = myLab.FindChild( theDataTag );
   HYDROData_PriorityQueue::ClearRules( aRulesLab );
 
   // Indicate model of the need to update splitting
@@ -1248,12 +1250,13 @@ void HYDROData_CalculationCase::ClearRules( const bool theIsSetToUpdate )
   }
 }
 
-void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Object)&    theObject1,
+void HYDROData_CalculationCase::AddRule( const Handle(HYDROData_Entity)&    theObject1,
                                          HYDROData_PriorityType             thePriority,
-                                         const Handle(HYDROData_Object)&    theObject2,
-                                         HYDROData_Zone::MergeAltitudesType theMergeType )
+                                         const Handle(HYDROData_Entity)&    theObject2,
+                                         HYDROData_Zone::MergeAltitudesType theMergeType,
+                                         HYDROData_CalculationCase::DataTag theDataTag )
 {
-  TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
+  TDF_Label aRulesLab = myLab.FindChild( theDataTag );
   HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
 
   // Indicate model of the need to update splitting
@@ -1304,12 +1307,13 @@ void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const
 }
 
 bool HYDROData_CalculationCase::GetRule( int theIndex, 
-                                         Handle(HYDROData_Object)&           theObject1,
+                                         Handle(HYDROData_Entity)&           theObject1,
                                          HYDROData_PriorityType&             thePriority,
-                                         Handle(HYDROData_Object)&           theObject2,
-                                         HYDROData_Zone::MergeAltitudesType& theMergeType ) const
+                                         Handle(HYDROData_Entity)&           theObject2,
+                                         HYDROData_Zone::MergeAltitudesType& theMergeType,
+                                         HYDROData_CalculationCase::DataTag& theDataTag) const
 {
-  TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );
+  TDF_Label aRulesLab = myLab.FindChild( theDataTag );
   return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
     theObject1, thePriority, theObject2, theMergeType );
 }
@@ -1332,41 +1336,3 @@ HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignme
   else
     return MANUAL;
 }
-
-void HYDROData_CalculationCase::ClearLandCoverRules( const bool theIsSetToUpdate )
-{
-  TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomLandCoverRules );
-  // TODO: adapt HYDROData_PriorityQueue to use with land covers
-  //HYDROData_PriorityQueue::ClearRules( aRulesLab );
-
-  // Indicate model of the need to update land covers partition
-  if ( theIsSetToUpdate ) {
-    SetToUpdate( true );
-  }
-}
-
-void HYDROData_CalculationCase::AddLandCoverRule( const Handle(HYDROData_LandCover)& theLandCover1,
-                                                  HYDROData_PriorityType             thePriority,
-                                                  const Handle(HYDROData_LandCover)& theLandCover2/*,
-                                                  HYDROData_LandCover::MergeStricklerCoefficientType theMergeType*/ )
-{
-  TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomLandCoverRules );
-  // TODO: adapt HYDROData_PriorityQueue to use with land covers
-  //HYDROData_PriorityQueue::AddRule( aRulesLab, theLandCover1, thePriority, theLandCover2, theMergeType );
-
-  // Indicate model of the need to update splitting
-  SetToUpdate( true );
-}
-
-bool HYDROData_CalculationCase::GetLandCoverRule( int theIndex, 
-                                                  Handle(HYDROData_LandCover)&        theLandCover1,
-                                                  HYDROData_PriorityType&             thePriority,
-                                                  Handle(HYDROData_LandCover)&        theLandCover2/*,
-                                                  HYDROData_LandCover::MergeStricklerCoefficientType& theMergeType*/ ) const
-{
-  TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomLandCoverRules );
-  // TODO: adapt HYDROData_PriorityQueue to use with land covers
-  //return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex,
-  //  theLandCover1, thePriority, theLandCover2, theMergeType );
-  return true;
-}
index d1a24b4db550ece6f64ae2f5069b7735e274642c..b40503ba9f2c42e33b41d3f1cc072e6e1f4f5ebe 100644 (file)
@@ -358,31 +358,23 @@ public:
   HYDRODATA_EXPORT void SetAssignmentMode( AssignmentMode theMode );
   HYDRODATA_EXPORT AssignmentMode GetAssignmentMode() const;
 
-  HYDRODATA_EXPORT void ClearRules( const bool theIsSetToUpdate = true );
-  HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)&    theObject1,
-                                 HYDROData_PriorityType             thePriority,
-                                 const Handle(HYDROData_Object)&    theObject2,
-                                 HYDROData_Zone::MergeAltitudesType theMergeType );
+  HYDRODATA_EXPORT void ClearRules( HYDROData_CalculationCase::DataTag theDataTag,
+                                    const bool theIsSetToUpdate = true );
+  HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Entity)&     theObject1,
+                                 HYDROData_PriorityType              thePriority,
+                                 const Handle(HYDROData_Entity)&     theObject2,
+                                 HYDROData_Zone::MergeAltitudesType  theMergeType,
+                                 HYDROData_CalculationCase::DataTag  theDataTag );
   HYDRODATA_EXPORT bool GetRule( int theIndex, 
-                                 Handle(HYDROData_Object)&           theObject1,
+                                 Handle(HYDROData_Entity)&           theObject1,
                                  HYDROData_PriorityType&             thePriority,
-                                 Handle(HYDROData_Object)&           theObject2,
-                                 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
+                                 Handle(HYDROData_Entity)&           theObject2,
+                                 HYDROData_Zone::MergeAltitudesType& theMergeType,
+                                 HYDROData_CalculationCase::DataTag& theDataTag ) const;
 
   HYDRODATA_EXPORT void SetAssignmentLandCoverMode( AssignmentMode theMode );
   HYDRODATA_EXPORT AssignmentMode GetAssignmentLandCoverMode() const;
 
-  HYDRODATA_EXPORT void ClearLandCoverRules( const bool theIsSetToUpdate = true );
-  HYDRODATA_EXPORT void AddLandCoverRule( const Handle(HYDROData_LandCover)& theLandCover1,
-                                          HYDROData_PriorityType             thePriority,
-                                          const Handle(HYDROData_LandCover)& theLandCover2/*,
-                                          HYDROData_LandCover::MergeStricklerCoefficientType theMergeType*/ );
-  HYDRODATA_EXPORT bool GetLandCoverRule( int theIndex, 
-                                          Handle(HYDROData_LandCover)&        theLandCover1,
-                                          HYDROData_PriorityType&             thePriority,
-                                          Handle(HYDROData_LandCover)&        theLandCover2/*,
-                                          HYDROData_LandCover::MergeStricklerCoefficientType& theMergeType*/ ) const;
-
   HYDRODATA_EXPORT QString DumpRules() const;
 
   HYDRODATA_EXPORT HYDROData_Warning GetLastWarning() const;
index 3e85dfd223f34002d161a43dbae78502281bd3ea..6dbb5daec91146ad68f85220ec7f615574270ed8 100644 (file)
 #include <HYDROData_PriorityQueue.h>
 #include <HYDROData_CalculationCase.h>
 #include <HYDROData_Iterator.h>
+#include <HYDROData_LandCover.h>
 #include <TDataStd_ReferenceList.hxx>
 #include <TDataStd_Integer.hxx>
 #include <TDF_ChildIterator.hxx>
 
-HYDROData_PriorityQueue::HYDROData_PriorityQueue( HYDROData_CalculationCase* theCalcCase )
+HYDROData_PriorityQueue::HYDROData_PriorityQueue( HYDROData_CalculationCase* theCalcCase,
+                                                  Standard_Integer aTag )
 {
   myGeomObjects = theCalcCase->GetGeometryObjects();
   for( int i=myGeomObjects.Lower(), n=myGeomObjects.Upper(); i<=n; i++ )
   {
-    Handle(HYDROData_Object) anObj = Handle(HYDROData_Object)::DownCast( myGeomObjects.Value( i ) );
+    Handle(HYDROData_Entity) anObj = myGeomObjects.Value( i );
     if( !anObj.IsNull() )
     {
       QString anObjName = anObj->GetName();
@@ -36,14 +38,14 @@ HYDROData_PriorityQueue::HYDROData_PriorityQueue( HYDROData_CalculationCase* the
     }
   }
 
-  myRules = GetRules( theCalcCase->Label().FindChild( HYDROData_CalculationCase::DataTag_CustomRules ) );
+  myRules = GetRules( theCalcCase->Label().FindChild( aTag ) );
 }
 
 HYDROData_PriorityQueue::~HYDROData_PriorityQueue()
 {
 }
 
-Handle(HYDROData_Object) HYDROData_PriorityQueue::GetMostPriorityObject( const QStringList& theZoneObjects,
+Handle(HYDROData_Entity) HYDROData_PriorityQueue::GetMostPriorityObject( const QStringList& theZoneObjects,
                                                                          HYDROData_Zone::MergeAltitudesType& theMergeType ) const
 {
   QStringList aSortedZoneObjects;
@@ -54,13 +56,13 @@ Handle(HYDROData_Object) HYDROData_PriorityQueue::GetMostPriorityObject( const Q
       aSortedZoneObjects.append( aName );
   }
 
-  Handle(HYDROData_Object) aMostPriorityObj;
+  Handle(HYDROData_Entity) aMostPriorityObj;
   theMergeType = HYDROData_Zone::Merge_UNKNOWN;
   QStringList::const_iterator anIt = aSortedZoneObjects.begin(), aLast = aSortedZoneObjects.end();
   for( ; anIt!=aLast; anIt++ )
   {
     HYDROData_Zone::MergeAltitudesType aLocalMerge = HYDROData_Zone::Merge_UNKNOWN;
-    Handle(HYDROData_Object) anObj = myNames[*anIt];
+    Handle(HYDROData_Entity) anObj = myNames[*anIt];
     if( !anObj.IsNull() )
     {
       if( aMostPriorityObj.IsNull() )
@@ -82,8 +84,8 @@ Handle(HYDROData_Object) HYDROData_PriorityQueue::GetMostPriorityObject( const Q
   return aMostPriorityObj;
 }
 
-bool HYDROData_PriorityQueue::IsMorePriority( const Handle(HYDROData_Object)& theObj1,
-                                              const Handle(HYDROData_Object)& theObj2,
+bool HYDROData_PriorityQueue::IsMorePriority( const Handle(HYDROData_Entity)& theObj1,
+                                              const Handle(HYDROData_Entity)& theObj2,
                                               HYDROData_Zone::MergeAltitudesType& theMergeType ) const
 {
   // 1. First we check custom rules
@@ -133,9 +135,9 @@ enum HYDROData_PriorityQueueTag
 };
 
 void HYDROData_PriorityQueue::AddRule( TDF_Label&                         theRulesLabel,
-                                       const Handle(HYDROData_Object)&    theObject1,
+                                       const Handle(HYDROData_Entity)&    theObject1,
                                        HYDROData_PriorityType             thePriority,
-                                       const Handle(HYDROData_Object)&    theObject2,
+                                       const Handle(HYDROData_Entity)&    theObject2,
                                        HYDROData_Zone::MergeAltitudesType theMergeType )
 {
   // Get the last rule index
@@ -185,9 +187,9 @@ HYDROData_ListOfRules HYDROData_PriorityQueue::GetRules( const TDF_Label& theRul
     if( isObj1OK && isPriorityOK && isObj2OK && isMergeOK )
     {
       HYDROData_CustomRule aRule;
-      aRule.Object1 = Handle_HYDROData_Object::DownCast( HYDROData_Iterator::Object( aRefs1->First() ) );
+      aRule.Object1 = HYDROData_Iterator::Object( aRefs1->First() );
       aRule.Priority = ( HYDROData_PriorityType ) aPriorityAttr->Get();
-      aRule.Object2 = Handle_HYDROData_Object::DownCast( HYDROData_Iterator::Object( aRefs2->First() ) );
+      aRule.Object2 = HYDROData_Iterator::Object( aRefs2->First() );
       aRule.MergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
       aRules.append( aRule );
     }
@@ -240,6 +242,12 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab,
     QString aPriority = anIt->Priority == LESS ? "LESS" : "GREATER";
     QString aMergeType;
 
+    HYDROData_CalculationCase::DataTag aDataTag = HYDROData_CalculationCase::DataTag_CustomRules;
+    Handle(HYDROData_LandCover) aLandCover1 = Handle(HYDROData_LandCover)::DownCast( anIt->Object1 );
+    Handle(HYDROData_LandCover) aLandCover2 = Handle(HYDROData_LandCover)::DownCast( anIt->Object2 );
+    if ( !aLandCover1.IsNull() && !aLandCover2.IsNull() )
+      aDataTag = HYDROData_CalculationCase::DataTag_CustomLandCoverRules;
+
     switch( anIt->MergeType )
     {
     case HYDROData_Zone::Merge_UNKNOWN:
@@ -256,8 +264,8 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab,
       break;
     }
 
-    QString aRule = QString( "%0.AddRule( %1, %2, %3, %4 )" ).
-      arg( theCalcCaseName ).arg( anObj1 ).arg( aPriority ).arg( anObj2 ).arg( aMergeType );
+    QString aRule = QString( "%0.AddRule( %1, %2, %3, %4, %5 )" ).
+      arg( theCalcCaseName ).arg( anObj1 ).arg( aPriority ).arg( anObj2 ).arg( aMergeType ).arg( aDataTag );
 
     theScript << aRule;
   }
@@ -265,9 +273,9 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab,
 
 bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab,
                                        int theIndex, 
-                                       Handle(HYDROData_Object)&           theObject1,
+                                       Handle(HYDROData_Entity)&           theObject1,
                                        HYDROData_PriorityType&             thePriority,
-                                       Handle(HYDROData_Object)&           theObject2,
+                                       Handle(HYDROData_Entity)&           theObject2,
                                        HYDROData_Zone::MergeAltitudesType& theMergeType )
 {
   TDF_Label aRuleLabel = theRulesLab.FindChild( theIndex );
@@ -283,9 +291,9 @@ bool HYDROData_PriorityQueue::GetRule( const TDF_Label& theRulesLab,
   bool isOK = isObj1OK && isPriorityOK && isObj2OK && isMergeOK;
   if( isOK )
   {
-    theObject1   = Handle_HYDROData_Object::DownCast( HYDROData_Iterator::Object( aRefs1->First() ) );
+    theObject1   = HYDROData_Iterator::Object( aRefs1->First() );
     thePriority  = ( HYDROData_PriorityType ) aPriorityAttr->Get();
-    theObject2   = Handle_HYDROData_Object::DownCast( HYDROData_Iterator::Object( aRefs2->First() ) );
+    theObject2   = HYDROData_Iterator::Object( aRefs2->First() );
     theMergeType = ( HYDROData_Zone::MergeAltitudesType ) aMergeAttr->Get();
   }
   return isOK;
index 87ae4d607b618d4a371627c4a1836144999cf3b6..80d1b652a134b1550d6dcdabc46dc49f5207d883 100644 (file)
@@ -20,7 +20,7 @@
 #define HYDROData_PriorityQueue_HeaderFile
 
 #include <QMap>
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
 #include <HYDROData_Zone.h>
 
 class HYDROData_CalculationCase;
@@ -33,9 +33,9 @@ enum HYDROData_PriorityType
 
 struct HYDROData_CustomRule
 {
-  Handle(HYDROData_Object)           Object1;
+  Handle(HYDROData_Entity)           Object1;
   HYDROData_PriorityType             Priority;
-  Handle(HYDROData_Object)           Object2;
+  Handle(HYDROData_Entity)           Object2;
   HYDROData_Zone::MergeAltitudesType MergeType;
 };
 
@@ -44,21 +44,22 @@ typedef QList<HYDROData_CustomRule> HYDROData_ListOfRules;
 class HYDROData_PriorityQueue
 {
 public:
-  HYDROData_PriorityQueue( HYDROData_CalculationCase* );
+  HYDROData_PriorityQueue( HYDROData_CalculationCase* theCalcCase,
+                           Standard_Integer aTag );
   ~HYDROData_PriorityQueue();
 
-  Handle_HYDROData_Object GetMostPriorityObject( const QStringList& theZoneObjects,
+  Handle_HYDROData_Entity GetMostPriorityObject( const QStringList& theZoneObjects,
                                                  HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
 
-  bool IsMorePriority( const Handle(HYDROData_Object)& theObj1,
-                       const Handle(HYDROData_Object)& theObj2,
+  bool IsMorePriority( const Handle(HYDROData_Entity)& theObj1,
+                       const Handle(HYDROData_Entity)& theObj2,
                        HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
 
   static void ClearRules( TDF_Label& theRulesLabel );
   static void AddRule( TDF_Label& theRulesLabel,
-                       const Handle(HYDROData_Object)&    theObject1,
+                       const Handle(HYDROData_Entity)&    theObject1,
                        HYDROData_PriorityType             thePriority,
-                       const Handle(HYDROData_Object)&    theObject2,
+                       const Handle(HYDROData_Entity)&    theObject2,
                        HYDROData_Zone::MergeAltitudesType theMergeType );
   static HYDROData_ListOfRules GetRules( const TDF_Label& theRulesLabel );
   static QString DumpRules( const TDF_Label& theRulesLab );
@@ -67,12 +68,12 @@ public:
                                  QStringList& theScript );
   static bool GetRule( const TDF_Label& theRulesLab,
                        int theIndex, 
-                       Handle(HYDROData_Object)&           theObject1,
+                       Handle(HYDROData_Entity)&           theObject1,
                        HYDROData_PriorityType&             thePriority,
-                       Handle(HYDROData_Object)&           theObject2,
+                       Handle(HYDROData_Entity)&           theObject2,
                        HYDROData_Zone::MergeAltitudesType& theMergeType );
 private:
-  typedef QMap<QString, Handle(HYDROData_Object)> MapNameToObject;
+  typedef QMap<QString, Handle(HYDROData_Entity)> MapNameToObject;
 
   HYDROData_SequenceOfObjects myGeomObjects;  ///< the ordered list of objects (default priority)
   MapNameToObject             myNames;        ///< the map of name to object
index 889e811462ce568708534b5a5a5693d765d837f1..9e97678e013444cdf67e1a623779faa183daf595 100644 (file)
@@ -30,6 +30,7 @@
 #include "HYDROGUI_Zone.h"
 #include "HYDROGUI_OrderedListWidget.h"
 #include "HYDROGUI_PriorityWidget.h"
+#include "HYDROGUI_PriorityTableModel.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Entity.h>
@@ -95,8 +96,9 @@ void HYDROGUI_CalculationDlg::reset()
   setLandCoverMode( HYDROData_CalculationCase::AUTOMATIC );
 
   // Reset the priority widget state
-  QList<Handle(HYDROData_Object)> anObjects;
+  QList<Handle(HYDROData_Entity)> anObjects;
   myPriorityWidget->setObjects( anObjects );
+  myLandCoverPriorityWidget->setObjects( anObjects );
 }
 
 QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
@@ -405,6 +407,10 @@ QWizardPage* HYDROGUI_CalculationDlg::createLandCoversPage() {
 
   // Bottom of the page
   myLandCoverPriorityWidget = new HYDROGUI_PriorityWidget( mainFrame() );
+  HYDROGUI_PriorityTableModel* aModel = 
+    dynamic_cast<HYDROGUI_PriorityTableModel*>( myLandCoverPriorityWidget->getTable()->model() );
+  if ( aModel )
+    aModel->setColumnCount( 3 );
 
   QGroupBox* aPriorityGroup = new QGroupBox( tr( "PRIORITY" ) );
   QBoxLayout* aPriorityLayout = new QHBoxLayout;
@@ -935,10 +941,10 @@ void HYDROGUI_CalculationDlg::setEditLandCoversEnabled( const bool theIsEnabled
   Get included geometry objects.
   @return the list of geometry objects
  */
-QList<Handle(HYDROData_Object)> HYDROGUI_CalculationDlg::getGeometryObjects()
+QList<Handle(HYDROData_Entity)> HYDROGUI_CalculationDlg::getGeometryObjects()
 {
   QList<Handle(HYDROData_Entity)> anEntities = myGeomObjects->getObjects();
-  QList<Handle(HYDROData_Object)> anObjects;
+  QList<Handle(HYDROData_Entity)> anObjects;
 
   foreach ( Handle(HYDROData_Entity) anEntity, anEntities ) {
     Handle(HYDROData_Object) anObj = Handle(HYDROData_Object)::DownCast( anEntity );
@@ -956,10 +962,10 @@ QList<Handle(HYDROData_Object)> HYDROGUI_CalculationDlg::getGeometryObjects()
   Get included land covers.
   @return the list of land covers
  */
-QList<Handle(HYDROData_LandCover)> HYDROGUI_CalculationDlg::getLandCovers()
+QList<Handle(HYDROData_Entity)> HYDROGUI_CalculationDlg::getLandCovers()
 {
   QList<Handle(HYDROData_Entity)> anEntities = myLandCovers->getObjects();
-  QList<Handle(HYDROData_LandCover)> aLandCovers;
+  QList<Handle(HYDROData_Entity)> aLandCovers;
 
   foreach ( Handle(HYDROData_Entity) anEntity, anEntities ) {
     Handle(HYDROData_LandCover) aLandCover = Handle(HYDROData_LandCover)::DownCast( anEntity );
@@ -991,6 +997,24 @@ void  HYDROGUI_CalculationDlg::setRules( const HYDROData_ListOfRules& theRules )
   myPriorityWidget->setRules( theRules );
 }
 
+/**
+  Get rules defined for land covers.
+  @return the list of rules
+ */
+HYDROData_ListOfRules HYDROGUI_CalculationDlg::getLandCoverRules() const
+{
+  return myLandCoverPriorityWidget->getRules();
+}
+
+/**
+  Set rules for land covers.
+  @param theRules the list of rules
+ */
+void  HYDROGUI_CalculationDlg::setLandCoverRules( const HYDROData_ListOfRules& theRules ) const
+{
+  myLandCoverPriorityWidget->setRules( theRules );
+}
+
 /**
   Slot called when objects order is changed.
  */
@@ -1004,15 +1028,28 @@ void HYDROGUI_CalculationDlg::onOrderChanged()
     myGeomObjects->undoLastMove();
 }
 
-void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName )
+void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals )
 {
-  bool isBlocked = myStricklerTableName->blockSignals( true );
+  bool isBlocked;
+  if ( theBlockSignals )
+    isBlocked = myStricklerTableName->blockSignals( true );
+  
   myStricklerTableName->setCurrentIndex( myStricklerTableName->findText( theStricklerTableName ) );
-  myStricklerTableName->blockSignals( isBlocked );
+
+  if ( theBlockSignals )
+    myStricklerTableName->blockSignals( isBlocked );
+  else
+    emit StricklerTableSelected( theStricklerTableName );
 }
 
-void HYDROGUI_CalculationDlg::includeLandCovers( const QStringList& theLandCovers )
+void HYDROGUI_CalculationDlg::includeLandCovers( const QStringList& theLandCovers, bool theReset )
 {
+  if ( theReset )
+  {
+    HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList;
+    myLandCovers->setObjects(anObject2VisibleList);
+  }
+        
   HYDROGUI_ListModel::Object2VisibleList anObjectsToInclude;
   QList<QListWidgetItem*> aFoundItems;
   foreach ( const QString& anObjName, theLandCovers ) {
@@ -1028,8 +1065,7 @@ void HYDROGUI_CalculationDlg::includeLandCovers( const QStringList& theLandCover
     myLandCovers->addObject( HYDROGUI_ListModel::Object2Visible( anObject, true ) );
   }
 
-  // TODO: adapt HYDROGUI_PriorityWidget to process land covers
-  //myLandCoverPriorityWidget->setObjects( getLandCovers() );
+  myLandCoverPriorityWidget->setObjects( getLandCovers() );
 }
 
 void HYDROGUI_CalculationDlg::excludeLandCovers( const QStringList& theLandCovers )
@@ -1046,8 +1082,7 @@ void HYDROGUI_CalculationDlg::excludeLandCovers( const QStringList& theLandCover
     myLandCovers->removeObjectByName( anObjName );
   }
 
-  // TODO: adapt HYDROGUI_PriorityWidget to process land covers
-  //myLandCoverPriorityWidget->setObjects( getLandCovers() );
+  myLandCoverPriorityWidget->setObjects( getLandCovers() );
 }
 
 /**
@@ -1057,9 +1092,8 @@ void HYDROGUI_CalculationDlg::onOrderLandCoverChanged()
 {
   bool isConfirmed = true;
   emit orderLandCoverChanged( isConfirmed );
-  // TODO: adapt HYDROGUI_PriorityWidget to process land covers
-  /*if( isConfirmed )
+  if( isConfirmed )
     myLandCoverPriorityWidget->setObjects( getLandCovers() );
-  else*/
+  else
     myLandCovers->undoLastMove();  
 }
index 9bcdfd8aa4d2ad8055953fef5867a0b406805beb..f4ee385fd047cbee7db7f1c5bf57e309f9554612 100644 (file)
@@ -83,6 +83,9 @@ public:
   HYDROData_ListOfRules      getRules() const;
   void                       setRules( const HYDROData_ListOfRules& theRules ) const;
 
+  HYDROData_ListOfRules      getLandCoverRules() const;
+  void                       setLandCoverRules( const HYDROData_ListOfRules& theRules ) const;
+
 public slots:
   void                       setMode( int theMode );
   void                       setBoundary( const QString& theObjName );
@@ -97,8 +100,8 @@ public slots:
   void                       onOrderChanged();
 
   void                       setLandCoverMode( int theMode );
-  void                       setStricklerTable( const QString& theStricklerTableName );
-  void                       includeLandCovers( const QStringList& theLandCovers );
+  void                       setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals = true );
+  void                       includeLandCovers( const QStringList& theLandCovers, bool theReset );
   void                       excludeLandCovers( const QStringList& theLandCovers );
   void                       onOrderLandCoverChanged();
 
@@ -151,8 +154,8 @@ protected slots:
   void OnNewRegion();
 
 private:
-  QList<Handle(HYDROData_Object)> getGeometryObjects();
-  QList<Handle(HYDROData_LandCover)> getLandCovers();
+  QList<Handle(HYDROData_Entity)> getGeometryObjects();
+  QList<Handle(HYDROData_Entity)> getLandCovers();
 
   QWizardPage*               createObjectsPage();
   QWizardPage*               createGroupsPage();
index 8ace99e3218493a22b31b33848d9e366e47780c7..f8311d5a4f90c45bb0ef1dfa8626dd9995559e35 100644 (file)
@@ -149,25 +149,7 @@ void HYDROGUI_CalculationOp::startOperation()
       aPanel->includeGeomObjects( aList );
 
       // set rules
-      HYDROData_ListOfRules aRules;
-      Handle(HYDROData_Object) anObject1, anObject2;
-      HYDROData_PriorityType aPriority;
-      HYDROData_Zone::MergeAltitudesType aMergeType;
-      for ( int anIndex = 0; ; anIndex++ )
-      {
-        if ( myEditedObject->GetRule( anIndex, anObject1, aPriority, anObject2, aMergeType ) ) {
-          HYDROData_CustomRule aRule;
-          aRule.Object1 = anObject1;
-          aRule.Object2 = anObject2;
-          aRule.Priority = aPriority;
-          aRule.MergeType = aMergeType;
-
-          aRules << aRule;
-        }
-        else
-          break;
-      }
-      aPanel->setRules( aRules );
+      setRules( HYDROData_CalculationCase::DataTag_CustomRules );      
     }
   }
   else
@@ -783,10 +765,10 @@ bool HYDROGUI_CalculationOp::processApply( int&     theUpdateFlags,
 
   // For manual mode priority rules are redundant
   if ( aPanel->getMode() == HYDROData_CalculationCase::MANUAL ) {
-    myEditedObject->ClearRules( false );
+    myEditedObject->ClearRules( HYDROData_CalculationCase::DataTag_CustomRules, false );
   }
   if ( aPanel->getLandCoverMode() == HYDROData_CalculationCase::MANUAL ) {
-    myEditedObject->ClearLandCoverRules( false );
+    myEditedObject->ClearRules( HYDROData_CalculationCase::DataTag_CustomLandCoverRules, false );
   }
  
   theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init;
@@ -869,13 +851,15 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
 
     QStringList aList;
     QStringList anEntryList;
+    HYDROData_SequenceOfObjects aSeq;
+
+    Handle(HYDROData_StricklerTable) aStricklerTableObj;
+    QString aStricklerTableName;
 
     // Get all Strickler table objects to fill in combo-box
     aList.clear();
     anEntryList.clear();
-    HYDROData_Iterator anIter( doc(), KIND_STRICKLER_TABLE );
-    Handle(HYDROData_StricklerTable) aStricklerTableObj;
-    QString aStricklerTableName;
+    HYDROData_Iterator anIter( doc(), KIND_STRICKLER_TABLE );      
     for ( ; anIter.More(); anIter.Next() )
     {
       aStricklerTableObj = Handle(HYDROData_StricklerTable)::DownCast( anIter.Current() );
@@ -891,11 +875,18 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
       }
     }
     aPanel->setStricklerTableNames( aList, anEntryList );
+    if ( !aList.isEmpty() )
+      aPanel->setStricklerTable( aList.at( 0 ), false );
 
     // Fill in list widget with all available land covers
-    HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetLandCovers( module() );
+    aSeq = HYDROGUI_Tool::GetLandCovers( module() );
     getNamesAndEntries( aSeq, aList, anEntryList );
     aPanel->setAllLandCovers( aList, anEntryList );
+
+    // Set list of included land covers
+    aSeq = myEditedObject->GetLandCovers();
+    getNamesAndEntries( aSeq, aList, anEntryList );
+    aPanel->includeLandCovers( aList, true );
     
     if ( !myEditedObject.IsNull() )
     {
@@ -915,6 +906,9 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
 
         // Set mode (Auto or Manual) to defined priority of land covers
         aPanel->setLandCoverMode( myEditedObject->GetAssignmentLandCoverMode() );
+
+        // Set rules defined on land covers
+        setRules( HYDROData_CalculationCase::DataTag_CustomLandCoverRules );
       }
       else
       {
@@ -962,12 +956,13 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
 
         // Clear priority rules
         //@ASL if ( myEditedObject->GetRulesCount() > 0 ) {
-          myEditedObject->ClearRules( true );
+          myEditedObject->ClearRules( HYDROData_CalculationCase::DataTag_CustomRules, true );
         //@ASL }
         // Set priority rules
         foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) {
           myEditedObject->AddRule( aRule.Object1, aRule.Priority,
-                                  aRule.Object2, aRule.MergeType );
+                                  aRule.Object2, aRule.MergeType,
+                                  HYDROData_CalculationCase::DataTag_CustomRules );
         }
       }
     }
@@ -987,6 +982,8 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
       createPreview();
 
       anIsToUpdateOb = true;
+
+      myEditedObject->SetToUpdate( true );
     }
     else
     {
@@ -997,6 +994,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
       }
     }
 
+    // Move this code to processing od the last panel (see below)
     if ( anIsToUpdateOb ) {
       SUIT_DataBrowser* anObjBrowser = ((LightApp_Application*)module()->application())->objectBrowser();
       if ( anObjBrowser ) {
@@ -1016,8 +1014,6 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
 
     QApplication::setOverrideCursor( Qt::WaitCursor );
 
-    //...
-
     // Set parameters for automatic mode
     int aMode = aPanel->getLandCoverMode();
     if ( aMode == HYDROData_CalculationCase::AUTOMATIC )
@@ -1038,11 +1034,13 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
         }
 
         // Clear priority rules
-        myEditedObject->ClearLandCoverRules( true );
-        // TODO: Set priority rules
-        //foreach ( const HYDROData_CustomRule& aRule, aPanel->getLandCoverRules() ) {
-        //  myEditedObject->AddLandCoverRule( aRule.Object1, aRule.Priority,
-        //                                    aRule.Object2, aRule.MergeType );                
+        myEditedObject->ClearRules( HYDROData_CalculationCase::DataTag_CustomLandCoverRules, true );
+        // Set priority rules
+        foreach ( const HYDROData_CustomRule& aRule, aPanel->getLandCoverRules() ) {
+          myEditedObject->AddRule( aRule.Object1, aRule.Priority,
+                                   aRule.Object2, HYDROData_Zone::Merge_Object,
+                                   HYDROData_CalculationCase::DataTag_CustomLandCoverRules );
+        }
       }
     }
     aPanel->setEditLandCoversEnabled( aMode == HYDROData_CalculationCase::MANUAL );
@@ -1161,6 +1159,39 @@ QColor HYDROGUI_CalculationOp::GenerateDefaultZonesColor( int theIndex,
   return ( aColor.isValid() ? aColor : HYDROData_ImmersibleZone::DefaultFillingColor() );
 }
 
+void HYDROGUI_CalculationOp::setRules( HYDROData_CalculationCase::DataTag theDataTag )
+{
+  HYDROGUI_CalculationDlg* aPanel = 
+    ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+  if ( !aPanel )
+    return;
+
+  HYDROData_ListOfRules aRules;
+  Handle(HYDROData_Entity) anObject1, anObject2;
+  HYDROData_PriorityType aPriority;
+  HYDROData_Zone::MergeAltitudesType aMergeType;
+  HYDROData_CalculationCase::DataTag aDataTag = HYDROData_CalculationCase::DataTag_CustomRules;
+  for ( int anIndex = 0; ; anIndex++ )
+  {
+    if ( myEditedObject->GetRule( anIndex, anObject1, aPriority, anObject2, aMergeType, theDataTag ) ) {
+      HYDROData_CustomRule aRule;
+      aRule.Object1 = anObject1;
+      aRule.Object2 = anObject2;
+      aRule.Priority = aPriority;
+      aRule.MergeType = aMergeType;
+
+      aRules << aRule;
+    }
+    else
+      break;
+  }
+
+  if ( theDataTag == HYDROData_CalculationCase::DataTag_CustomRules )
+    aPanel->setRules( aRules );
+  else if ( theDataTag == HYDROData_CalculationCase::DataTag_CustomLandCoverRules )
+    aPanel->setLandCoverRules( aRules );
+}
+
 void HYDROGUI_CalculationOp::createPreview()
 {
   LightApp_Application* anApp = module()->getApp();
@@ -1437,7 +1468,7 @@ void HYDROGUI_CalculationOp::onAddLandCovers()
 
   if ( !anAddedList.isEmpty() )
   {
-    aPanel->includeLandCovers( anAddedList );
+    aPanel->includeLandCovers( anAddedList, false );
     // TODO: create preview of included land covers
     //createPreview();
   }
index cf6a52a025b9b4d0074bd9f5c4cae1e0dc351729..4966ee3cde0e3152a198dea7285e69dc59a822e4 100644 (file)
@@ -169,6 +169,8 @@ private:
                                                              float theSaturation = 0.5,
                                                              float theValue = 0.95 ) const;
 
+  void                            setRules( HYDROData_CalculationCase::DataTag theDataTag );
+
   bool confirmRegionsChange() const;
   bool confirmModeChange() const;
   bool confirmOrderChange() const;
index fe83e5d50134098d23a815138f97984f5ffd6863..6e2e46cd14efa289ff6f55974fd52cf78f5d89bd 100644 (file)
 
 #include "HYDROGUI_PriorityTableModel.h"
 
+#include <HYDROData_LandCover.h>
 
 /**
   Constructor.
   @param theParent the parent object
 */
 HYDROGUI_PriorityTableModel::HYDROGUI_PriorityTableModel( QObject* theParent )
- : QAbstractTableModel( theParent )
+ : QAbstractTableModel( theParent ),
+   myColumnCount( 4 )
 {
 }
 
@@ -83,7 +85,7 @@ QVariant HYDROGUI_PriorityTableModel::data( const QModelIndex &theIndex, int the
     if ( aColumn == 0 || aColumn == 2 ) {
       QStringList aNames;
       HYDROData_CustomRule aRule = myRules.at( aRow );
-      Handle(HYDROData_Object) aUsedObject = aColumn == 0 ? aRule.Object2 : aRule.Object1;
+      Handle(HYDROData_Entity) aUsedObject = aColumn == 0 ? aRule.Object2 : aRule.Object1;
       if ( !aUsedObject.IsNull() ) {
         aNames = getAvailablePairs( aUsedObject );
       }
@@ -122,9 +124,9 @@ bool HYDROGUI_PriorityTableModel::setData( const QModelIndex & theIndex, const Q
     int aColumn = theIndex.column();
 
     if ( aColumn == 0 || aColumn == 2 ) {
-      Handle(HYDROData_Object) anObject;
+      Handle(HYDROData_Entity) anObject;
       QString anObjName = theValue.toString();
-      foreach ( const Handle(HYDROData_Object) anObj, myObjects ) {
+      foreach ( const Handle(HYDROData_Entity) anObj, myObjects ) {
         if ( anObj->GetName() == anObjName ) {
           anObject = anObj;
           break;
@@ -167,7 +169,7 @@ int HYDROGUI_PriorityTableModel::rowCount( const QModelIndex &theParent ) const
  */
 int HYDROGUI_PriorityTableModel::columnCount( const QModelIndex &theParent ) const
 {
-  return 4;
+  return myColumnCount;
 }
 
 /**
@@ -215,7 +217,10 @@ QVariant HYDROGUI_PriorityTableModel::headerData( int theSection,
       aData = tr( "OBJECT2" );
       break;
     case 3:
-      aData = tr( "BATHYMETRY" );
+      {
+        if ( getObjectsKind() != KIND_LAND_COVER )
+          aData = tr( "BATHYMETRY" );
+      }
       break;
     };
   } else if ( theOrientation == Qt::Vertical ) {
@@ -229,7 +234,7 @@ QVariant HYDROGUI_PriorityTableModel::headerData( int theSection,
   Set objects which could be used for rules definition.
   @param theObjects the ordered list of objects
  */
-void HYDROGUI_PriorityTableModel::setObjects( const QList<Handle(HYDROData_Object)>& theObjects )
+void HYDROGUI_PriorityTableModel::setObjects( const QList<Handle(HYDROData_Entity)>& theObjects )
 {
   myObjects = theObjects;
     
@@ -274,7 +279,7 @@ bool HYDROGUI_PriorityTableModel::createNewRule()
   // Try to find:
   // 1. the new pair of objects 
   // 2. the priority type corresponding to the objects order
-  Handle(HYDROData_Object) anObject1, anObject2;
+  Handle(HYDROData_Entity) anObject1, anObject2;
   HYDROData_PriorityType aPriorityType = GREATER;
 
   int aNbObjects = myObjects.count();
@@ -372,7 +377,7 @@ bool HYDROGUI_PriorityTableModel::removeAll()
  @param theObject the object
  @return the list of object names
  */
-QStringList HYDROGUI_PriorityTableModel::getAvailablePairs(  const Handle(HYDROData_Object)& theObject ) const
+QStringList HYDROGUI_PriorityTableModel::getAvailablePairs(  const Handle(HYDROData_Entity)& theObject ) const
 {
   QStringList aNames;
 
@@ -446,8 +451,8 @@ QString HYDROGUI_PriorityTableModel::mergeTypeToString( const int theMergeType )
   Check if the given pair of objects is already used.
   @return true if the pair is used
  */
-bool HYDROGUI_PriorityTableModel::isUsed( const Handle(HYDROData_Object)& theObj1, 
-                                          const Handle(HYDROData_Object)& theObj2 ) const
+bool HYDROGUI_PriorityTableModel::isUsed( const Handle(HYDROData_Entity)& theObj1, 
+                                          const Handle(HYDROData_Entity)& theObj2 ) const
 {
   bool isUsed = false;
 
@@ -472,11 +477,33 @@ QStringList HYDROGUI_PriorityTableModel::getAvailableObjectNames() const
 {
   QStringList aNames;
 
-  foreach ( const Handle(HYDROData_Object) anObj, myObjects ) {
+  foreach ( const Handle(HYDROData_Entity) anObj, myObjects ) {
     if ( !anObj.IsNull() ) {
       aNames << anObj->GetName();
     }
   }
 
   return aNames;
-}
\ No newline at end of file
+}
+
+/**
+  Set number of columns in the table.
+  @param theColumnCount the number of columns
+ */
+void HYDROGUI_PriorityTableModel::setColumnCount( int theColumnCount )
+{
+  myColumnCount = theColumnCount;
+}
+
+/**
+  Get type of objects for which rules are defined assuming,
+  that all objects in the list have the same type.
+  @return the type of objects
+ */
+const ObjectKind HYDROGUI_PriorityTableModel::getObjectsKind() const
+{
+  if ( myObjects.isEmpty() )
+    return KIND_UNKNOWN;
+  
+  return myObjects.at( 0 )->GetKind();
+}
index 28b058db7993addbe4f636131d6d3a3fd170f2fd..9133843769deec66b81c69263f3be4624c7aaed7 100644 (file)
@@ -58,19 +58,21 @@ public:
   bool removeRows( const QList<int> theRows );
   bool removeAll();
 
-  void setObjects( const QList<Handle(HYDROData_Object)>& theObjects );
+  void setObjects( const QList<Handle(HYDROData_Entity)>& theObjects );
 
   void setRules( const HYDROData_ListOfRules& theObjects );
   HYDROData_ListOfRules getRules() const;
 
   bool createNewRule();
   bool canCreateNewRule() const;
+
+  void setColumnCount( int theColumnCount );
   
 protected:
-  bool isUsed( const Handle(HYDROData_Object)& theObj1, 
-               const Handle(HYDROData_Object)& theObj2 ) const;
+  bool isUsed( const Handle(HYDROData_Entity)& theObj1, 
+               const Handle(HYDROData_Entity)& theObj2 ) const;
 
-  QStringList getAvailablePairs( const Handle(HYDROData_Object)& theObject ) const;
+  QStringList getAvailablePairs( const Handle(HYDROData_Entity)& theObject ) const;
   QStringList getAvailableObjectNames() const;
 
   QString priorityToString( const int thePriority ) const;
@@ -80,12 +82,16 @@ signals:
   void showError( const QString& theMsg );
 
 private:
+  const ObjectKind getObjectsKind() const;
+
   friend class test_HYDROGUI_PriorityTableModel;
 
   HYDROGUI_Module* myModule;
 
   HYDROData_ListOfRules myRules;
-  QList<Handle(HYDROData_Object)> myObjects;
+  QList<Handle(HYDROData_Entity)> myObjects;
+
+  int myColumnCount;
 };
 
 #endif
\ No newline at end of file
index f4c9fb7ea9f73e9d8b2095a54039254a79cc336a..7175941cca187d7ede319a448db90aa92afa00e5 100644 (file)
@@ -246,7 +246,7 @@ void HYDROGUI_PriorityWidget::onClearRules()
   Set objects which could be used for rules definition.
   @param theObjects the ordered list of objects
  */
-void HYDROGUI_PriorityWidget::setObjects( const QList<Handle(HYDROData_Object)>& theObjects )
+void HYDROGUI_PriorityWidget::setObjects( const QList<Handle(HYDROData_Entity)>& theObjects )
 {
   HYDROGUI_PriorityTableModel* aModel = 
     dynamic_cast<HYDROGUI_PriorityTableModel*>( myTable->model() );
@@ -287,6 +287,15 @@ void HYDROGUI_PriorityWidget::setRules( const HYDROData_ListOfRules& theRules )
   }
 }
 
+/**
+  Get table view.
+  @return the table view
+ */
+QTableView* HYDROGUI_PriorityWidget::getTable() const
+{
+  return myTable;
+}
+
 /**
  Slot called on table selection change.
 */
index 7d5828f75a1369c3ff1f78232dbd1fd01c17bf74..bbc6c9edf86a43bea946d1f8f5098a50a8897e7c 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <HYDROGUI.h>
 
-#include <HYDROData_Object.h>
+#include <HYDROData_Entity.h>
 #include <HYDROData_PriorityQueue.h>
 
 #include <QStyledItemDelegate>
@@ -47,11 +47,13 @@ public:
   HYDROGUI_PriorityWidget( QWidget* theParent );
   virtual ~HYDROGUI_PriorityWidget();
 
-  void setObjects( const QList<Handle(HYDROData_Object)>& theObjects );
+  void setObjects( const QList<Handle(HYDROData_Entity)>& theObjects );
 
   HYDROData_ListOfRules getRules() const;
   void setRules( const HYDROData_ListOfRules& theRules );
 
+  QTableView* getTable() const;
+
 protected:
   void updateControls();
 
index 1e9ae57392e5f86da8f7406086e4a8bac0504fc1..7a2eeeafb60b8e821d1e2396c1c7ae10c532a19f 100644 (file)
@@ -62,6 +62,25 @@ public:
     AUTOMATIC,
   };
 
+public:
+
+  enum DataTag
+  {
+    DataTag_First = 100,               ///< first tag, to reserve
+    DataTag_GeometryObject,            ///< reference geometry objects
+    DataTag_ChildRegion,               ///< child regions
+    DataTag_Region,                    ///< reference regions
+    DataTag_Polyline,                  ///< reference boundary polyline
+    DataTag_GeometryGroup,             ///< reference geometry groups
+    DataTag_SplittedGroups,            ///< reference splitted groups
+    DataTag_CustomRules,               ///< custom rules
+    DataTag_AssignmentMode,            ///< assignment mode
+    DataTag_StricklerTable,            ///< reference Strickler table
+    DataTag_LandCover,                 ///< reference land covers
+    DataTag_CustomLandCoverRules,      ///< custom rules for land covers priority
+    DataTag_AssignmentLandCoverMode    ///< assignment mode of land covers priority
+  };
+
 public:      
   /**
    * Add new one reference geometry object for calculation case.
@@ -484,22 +503,23 @@ public:
   %End
 
 
-  void ClearRules();
+  void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
 
-  void AddRule( HYDROData_Object                   theObject1,
+  void AddRule( HYDROData_Entity                   theObject1,
                 HYDROData_PriorityType             thePriority,
-                HYDROData_Object                   theObject2,
-                HYDROData_Zone::MergeAltitudesType theMergeType )
-  [void ( const Handle_HYDROData_Object&, HYDROData_PriorityType, const Handle_HYDROData_Object&, HYDROData_Zone::MergeAltitudesType )];
+                HYDROData_Entity                   theObject2,
+                HYDROData_Zone::MergeAltitudesType theMergeType,
+                               HYDROData_CalculationCase::DataTag theDataTag )
+  [void ( const Handle_HYDROData_Entity&, HYDROData_PriorityType, const Handle_HYDROData_Entity&, HYDROData_Zone::MergeAltitudesType, HYDROData_CalculationCase::DataTag )];
   %MethodCode
-    Handle(HYDROData_Object) anObject1 =
-      Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
-    Handle(HYDROData_Object) anObject2 =
-      Handle(HYDROData_Object)::DownCast( createHandle( a2 ) );
+    Handle(HYDROData_Entity) anObject1 =
+      Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
+    Handle(HYDROData_Entity) anObject2 =
+      Handle(HYDROData_Entity)::DownCast( createHandle( a2 ) );
 
     Py_BEGIN_ALLOW_THREADS
-    sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3 ) : 
-                    sipCpp->AddRule( anObject1, a1, anObject2, a3 );
+    sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) : 
+                    sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
     Py_END_ALLOW_THREADS
   %End