]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
lot 15 :: updated gui
authorisn <isn@opencascade.com>
Wed, 16 Jan 2019 16:19:20 +0000 (19:19 +0300)
committerisn <isn@opencascade.com>
Thu, 17 Jan 2019 10:13:59 +0000 (13:13 +0300)
15 files changed:
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROData/HYDROData_CompleteCalcCase.cxx
src/HYDROData/HYDROData_CompleteCalcCase.h
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h
src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx
src/HYDROGUI/HYDROGUI_OrderedListWidget.h
src/HYDROGUI/HYDROGUI_Wizard.cxx
src/HYDROGUI/HYDROGUI_Wizard.h
src/HYDROGUI/resources/HYDROGUI_images.ts
src/HYDROGUI/resources/HYDROGUI_msg_en.ts
src/HYDROGUI/resources/icon_complete_calc.png [new file with mode: 0644]

index 9fb52a8f4081cbd14ed75a49545d58fad28effe2..8dcedb1ed41d7cff19150374a8901ab9fd233ac2 100755 (executable)
@@ -396,6 +396,8 @@ static void PerformEdgeReplInZones(const HYDROData_SplitToZonesTool::SplitDataLi
     {
       TopoDS_Shape K = ObjToRes.FindKey(i);
       TopoDS_Shape V = ObjToRes.FindFromIndex(i);
+      if (V.IsNull())
+        continue;
       if (V.ShapeType() != TopAbs_EDGE && V.ShapeType() != TopAbs_WIRE && V.ShapeType() != TopAbs_COMPOUND)
         continue;
       if (V.ShapeType() == TopAbs_COMPOUND)
index 2aa627b003070201f591a9808755292ab7a46898..01b83a90b138d52528362f228609a7fd9fc070e5 100644 (file)
@@ -90,7 +90,9 @@ static bool CheckIntersection(BOPAlgo_Builder& theAlgo, const std::vector<TopoDS
 bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& doc,
                                              Handle(HYDROData_CalculationCase)& theCalcCase, 
                                              NCollection_Sequence<Handle(HYDROData_Entity)> theNewObjects,
-                                             bool& IsIntersectionOfNewObj)
+                                             bool IsUseOrigNamingOfNewRegions,
+                                             bool& IsIntersectionOfNewObj,
+                                             NCollection_Sequence<Handle(HYDROData_Region)>& theNewRegions)
 {
   Handle(HYDROData_PolylineXY) aBndPolyline = theCalcCase->GetBoundaryPolyline();        
   TopoDS_Wire aBndWire;
@@ -307,10 +309,12 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
   {
     const std::vector<TopoDS_Shape>& sh_vec = NREGV[k];
     Handle(HYDROData_Region) aRegion = theCalcCase->addNewRegion( doc, aRegsPref );
+    theNewRegions.Append(aRegion);
+    QString OrigNameOfRegion = "";
     for (int i=0;i<sh_vec.size();i++)
     {
       TopoDS_Face nF = TopoDS::Face(sh_vec[i]);
-      QString zoneName = aZonesPref;
+      //QString zoneName = aZonesPref;
       QStringList refObjList;
       //
       const TopTools_ListOfShape* origLS = theModifToOrigMap.Seek(nF);
@@ -326,7 +330,13 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
       }
       //
       Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( doc, aZonesPref, nF, refObjList);
+
+      //try to get an origial name region (obtained from origin object)
+      if (IsUseOrigNamingOfNewRegions && !refObjList.empty() && OrigNameOfRegion == "") 
+        OrigNameOfRegion = refObjList.first();
     }
+    if (OrigNameOfRegion != "")
+      aRegion->SetName(OrigNameOfRegion + "_reg");
   }
 
   //GROUPS
@@ -418,6 +428,7 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
     TopTools_SequenceOfShape aSeqSh, ModifedGDefSeq;
     aGroup->GetShapes(aSeqSh);
     Handle(HYDROData_SplitShapesGroup) aSplitGroup = theCalcCase->addNewSplitGroup( aName );
+    theCalcCase->AddGeometryGroup( aSplitGroup );
 
     for (int i=1;i<=aSeqSh.Length();i++)
     {
@@ -431,5 +442,6 @@ bool HYDROData_CompleteCalcCase::AddObjects( const Handle(HYDROData_Document)& d
     }
     aSplitGroup->SetShapes(ModifedGDefSeq);
   }
+
   return true;
 }
index 9f170c851552d8780630f579274eea2f85580442..6e76decb219099d687c1e9bc9fe2833cc6eefe3b 100644 (file)
@@ -27,6 +27,7 @@
 */
 
 #include <NCollection_Sequence.hxx>
+#include <NCollection_Map.hxx>
 #include <HYDROData_CalculationCase.h>
 #include <HYDROData_Document.h>
 
@@ -37,7 +38,9 @@ public:
   static bool AddObjects( const Handle(HYDROData_Document)& doc,
                           Handle(HYDROData_CalculationCase)& theCalcCase, 
                           NCollection_Sequence<Handle(HYDROData_Entity)> theNewObjects,
-                          bool& IsIntersectionOfNewObj);
+                          bool IsUseOrigNamingOfNewRegions,
+                          bool& IsIntersectionOfNewObj,
+                          NCollection_Sequence<Handle(HYDROData_Region)>& theNewRegions);
 
 };
 
index fff5820a2911a269a242fe163db466417f9faab3..c506dcf890df83ba532a7f6675ab084d09a63ec4 100644 (file)
@@ -183,10 +183,10 @@ bool HYDROData_PolylineOperator::Merge( const Handle( HYDROData_Document )& theD
       aNewPolyline->AddSection(aSectName, aSectType, aSectClosure);
       HYDROData_PolylineXY::PointsList aPointsList = aPolyline->GetPoints(i-1, false);
       QColor sectColor; 
-      aPolyline->getSectionColor(i-1, sectColor);
+      aPolyline->GetSectionColor(i-1, sectColor);
       aNewPolyline->SetPoints(ins, aPointsList);
       if (sectColor.isValid())
-        aNewPolyline->setSectionColor(ins, sectColor);
+        aNewPolyline->SetSectionColor(ins, sectColor);
       ins++;
     }
   }
index c4fd3ac7249a5962fdfedf688f1c39954741a910..0beb4d140bd5f2ffaf9315982749f0b1f254ccc4 100644 (file)
 #include <QWizardPage>
 
 
-HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle, bool IsComplete )
 : HYDROGUI_Wizard( theModule, theTitle )
 {
+  myIsComplete = IsComplete;
+  myAlreadyAddedGeomObjects = NULL;
+  myPolylineName = NULL;
+  myLandCoverMapName = NULL;
+  myStricklerTableName = NULL;
+  myAvailableGeomObjects = NULL;
   addPage( createObjectsPage() );
-  addPage( createGroupsPage() );
-  addPage( createBoundaryPolygonsPage() );
-
-  addPage( createLandCoverMapPage() );
+  if (!IsComplete)
+  {
+    addPage( createGroupsPage() );
+    addPage( createBoundaryPolygonsPage() );
+    addPage( createLandCoverMapPage() );
+  }
   addPage( createZonesPage() );
 }
 
@@ -86,10 +94,16 @@ void HYDROGUI_CalculationDlg::reset()
   myObjectName->clear();
   HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList;
   myGeomObjects->setObjects(anObject2VisibleList);
-  myPolylineName->clear();
-  myLandCoverMapName->clear();
-  myStricklerTableName->clear();
-  myAvailableGeomObjects->clear();
+  if (myAlreadyAddedGeomObjects)
+    myAlreadyAddedGeomObjects->clear();
+  if (myPolylineName)
+    myPolylineName->clear();
+  if (myLandCoverMapName)
+    myLandCoverMapName->clear();
+  if (myStricklerTableName)
+    myStricklerTableName->clear();
+  if (myAvailableGeomObjects)
+    myAvailableGeomObjects->clear();
 
   // Activate the automatic mode
   setMode( HYDROData_CalculationCase::AUTOMATIC );
@@ -149,6 +163,18 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
   myGeomObjects->setHiddenObjectsShown(true);
   myGeomObjects->setVisibilityIconShown(false);
   myGeomObjects->setContentsMargins(QMargins());
+
+  if (myIsComplete)
+  {
+    myAlreadyAddedGeomObjects = new QListWidget( aPage );
+    myAlreadyAddedGeomObjects->setSelectionMode( QListWidget::ExtendedSelection );
+    myAlreadyAddedGeomObjects->setEditTriggers( QListWidget::NoEditTriggers );
+    myAlreadyAddedGeomObjects->setViewMode( QListWidget::ListMode );
+  }
+  else
+  {
+    myAlreadyAddedGeomObjects = NULL;
+  }
  
   // included geometry objects
   QLabel* anIncludedLabel = new QLabel( tr( "INCLUDED_OBJECTS" ) );
@@ -185,9 +211,21 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
   // fill the objects frame with two lists, two labels and with buttons frame
   anObjsLayout->addWidget( anObjectsLabel, 0, 0, Qt::AlignHCenter );
   anObjsLayout->addWidget( anIncludedLabel, 0, 2, Qt::AlignHCenter );
-  anObjsLayout->addWidget( myAvailableGeomObjects, 1, 0 );
+  if (myIsComplete)
+  {
+    QLabel* anAlreadyIncludedLabel = new QLabel( tr( "ALREADY_INCLUDED_OBJECTS" ) );
+    anObjsLayout->addWidget( anAlreadyIncludedLabel, 2, 2, Qt::AlignHCenter );
+    anObjsLayout->addWidget( myAvailableGeomObjects, 1, 0, 3, 1 );
+  }
+  else
+    anObjsLayout->addWidget( myAvailableGeomObjects, 1, 0 );
+
   anObjsLayout->addWidget( aBtnsFrame, 1, 1, Qt::AlignHCenter );
   anObjsLayout->addWidget( myGeomObjects, 1, 2 );
+  if (myIsComplete)
+  {
+    anObjsLayout->addWidget( myAlreadyAddedGeomObjects, 3, 2 );  
+  }
   
   // fill the top of the page
   QGridLayout* aTopLayout = new QGridLayout;
@@ -229,6 +267,14 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
 
   aPage->setLayout( aPageLayout );
 
+  if (myIsComplete)
+  {
+    aLimitsLabel->setEnabled(false);
+    myPolylineName->setEnabled(false);
+    aModeGroup->setEnabled(false);
+    myPriorityWidget->setEnabled(false);
+  }
+
   // Create selector
   if ( module() ) {
     HYDROGUI_ListSelector* aListSelector = 
@@ -651,7 +697,32 @@ void HYDROGUI_CalculationDlg::includeGeomObjects( const QStringList& theObjects
     myGeomObjects->addObject( HYDROGUI_ListModel::Object2Visible( anObject, true ) );
   }
 
-  myPriorityWidget->setObjects( getGeometryObjects() );
+  if (!myIsComplete)
+    myPriorityWidget->setObjects( getGeometryObjects() );
+}
+
+void HYDROGUI_CalculationDlg::hideAvailableGeomObjects( const QStringList& theObjects )
+{
+  QList<QListWidgetItem*> aFoundItems;
+  foreach ( const QString& anObjName, theObjects ) 
+  {
+    aFoundItems = myAvailableGeomObjects->findItems( anObjName, Qt::MatchExactly );
+    foreach ( QListWidgetItem* anItem, aFoundItems ) 
+      anItem->setHidden( true );
+  }
+}
+
+void HYDROGUI_CalculationDlg::setAlreadyAddedGeomObjects( const QStringList& theObjects )
+{
+  myAlreadyAddedGeomObjects->addItems(theObjects);
+}
+
+ QStringList HYDROGUI_CalculationDlg::getAlreadyAddedGeomObjects()
+{
+  QStringList list;
+  for (int i = 0; i < myAlreadyAddedGeomObjects->count(); i++)
+    list << myAlreadyAddedGeomObjects->item(i)->text();
+  return list;
 }
 
 void HYDROGUI_CalculationDlg::excludeGeomObjects( const QStringList& theObjects )
@@ -904,6 +975,11 @@ void HYDROGUI_CalculationDlg::setMode( int theMode )
   }
 }
 
+void HYDROGUI_CalculationDlg::setGeomOrderingEnabled( int enabled )
+{
+  myGeomObjects->setOrderingEnabled( enabled );
+}
+
 /**
   Enable/disable zones drag'n'drop and renaming.
   @param theIsEnabled if true - zones drag'n'drop and renaming will be enabled
index 07307c744ab465a48e758dcfdd7324779bd6e2e9..3353209c5cd8cc51ead29a0d60cfedfe61f3fd14 100644 (file)
@@ -48,7 +48,7 @@ class HYDROGUI_CalculationDlg : public HYDROGUI_Wizard
   Q_OBJECT
 
 public:
-  HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle, bool IsComplete );
   virtual ~HYDROGUI_CalculationDlg();
 
   void                       reset();
@@ -87,12 +87,19 @@ public:
 
 public slots:
   void                       setMode( int theMode );
+  void                       setGeomOrderingEnabled( int enabled );
+
   void                       setBoundary( const QString& theObjName );
   void                       includeGeomObjects( const QStringList& theObjects );
   void                       excludeGeomObjects( const QStringList& theObjects );
   void                       includeGroups( const QStringList& theObjects );
   void                       excludeGroups( const QStringList& theObjects );
 
+  void                       hideAvailableGeomObjects( const QStringList& theObjects );
+  void                       setAlreadyAddedGeomObjects( const QStringList& theObjects ); 
+  QStringList                getAlreadyAddedGeomObjects();
+
+
   void                       includeBoundaryPolygons( const QStringList& theObjects );
   void                       includeISBoundaryPolygons( const QStringList& theObjects );
 
@@ -184,6 +191,9 @@ private:
   QListWidget*               myAvailableGeomObjects;
   HYDROGUI_OrderedListWidget* myGeomObjects;
 
+  QListWidget*               myAlreadyAddedGeomObjects;
+
+
   HYDROGUI_PriorityWidget*   myPriorityWidget;
 
   QListWidget*               myAvailableGroups;
@@ -199,6 +209,8 @@ private:
   QComboBox*                 myBathymetryChoice;
   QLabel*                    myBathymetryLabel;
   HYDROGUI_Zone*             myCurrentZone;
+
+  bool                       myIsComplete;
 };
 
 #endif
index fca5ae8d7046fe97b995218400a2903712455a8d..551a991feb4e2e96d10f83a07914f611e7958064 100644 (file)
 #include <QApplication>
 #include <QKeySequence>
 #include <QShortcut>
+#include <QPushButton>
 #include <BRep_Builder.hxx>
 #include <TopoDS.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopExp.hxx>
 #include <TopoDS.hxx>
 
+#include <HYDROData_CompleteCalcCase.h>
+
+
 HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit, bool IsComplete )
 : HYDROGUI_Operation( theModule ),
   myIsEdit( theIsEdit ),
@@ -65,9 +69,14 @@ HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool
   myShowGeomObjects( true ),
   myShowLandCoverMap( false ),
   myShowZones( false ),
-  myDenyIncExcl (IsComplete)
+  myIsComplete (IsComplete)
 {
-  setName( myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" ) );
+  QString aDlgName;
+  if (myIsComplete)
+    aDlgName =  tr( "COMPLETE_CALCULATION" );
+  else
+    aDlgName = myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" );
+  setName( aDlgName );
 }
 
 HYDROGUI_CalculationOp::~HYDROGUI_CalculationOp()
@@ -143,6 +152,7 @@ void HYDROGUI_CalculationOp::startOperation()
   QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_CALCULATION_CASE_NAME" ) );
 
   myEditedObject.Nullify();
+
   if ( myIsEdit )
   {
     myEditedObject = Handle(HYDROData_CalculationCase)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
@@ -166,7 +176,16 @@ void HYDROGUI_CalculationOp::startOperation()
       aSeq.Append(anInterPolyList);
 
       getNamesAndEntries( aSeq, aList, anEntryList );
-      aPanel->includeGeomObjects( aList );
+      if (!myIsComplete)
+        aPanel->includeGeomObjects( aList );
+      else 
+      {
+        //aPanel->includeGeomObjects( aList );
+        aPanel->setAlreadyAddedGeomObjects( aList );
+        //myIncObjAtStart = aSeq;
+        aPanel->hideAvailableGeomObjects( aList );
+        aPanel->setGeomOrderingEnabled(true);
+      }
 
       // set rules
       setRules( HYDROData_CalculationCase::DataTag_CustomRules );      
@@ -182,10 +201,7 @@ void HYDROGUI_CalculationOp::startOperation()
 
   aPanel->setObjectName( anObjectName );
   aPanel->setEditedObject( myEditedObject );
-
-  myIncObjAtStart.clear();
-  myIncObjAtStart = aPanel->getGeometryObjects(false);
-
+  
   setGeomObjectsVisible( true );
 
   createPreview( false );
@@ -248,7 +264,7 @@ void HYDROGUI_CalculationOp::commitOperation()
 
 HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const
 {
-  HYDROGUI_CalculationDlg* aPanel = new HYDROGUI_CalculationDlg( module(), getName() );
+  HYDROGUI_CalculationDlg* aPanel = new HYDROGUI_CalculationDlg( module(), getName(), myIsComplete );
 
   // Connect signals and slots
   connect( aPanel, SIGNAL( changeMode( int ) ), SLOT( onChangeMode( int ) ) );  
@@ -581,16 +597,10 @@ void HYDROGUI_CalculationOp::onRemoveObjects()
 
   QStringList aSelectedList = aPanel->getSelectedGeomObjects();
 
-  if (myDenyIncExcl)
+  if (myIsComplete)
   {
     QSet<QString> selMap = aSelectedList.toSet();
-    myIncObjAtStart.toVector();
-    for (int i=0;i<myIncObjAtStart.size();i++)
-    {
-      QString str = myIncObjAtStart[i]->GetName();
-      if (selMap.contains(str))
-        return;
-    }
+
   }
 
 
@@ -632,11 +642,11 @@ bool HYDROGUI_CalculationOp::confirmRegionsChange() const
   if ( !isConfirmed )
   {
   
-   if (myDenyIncExcl)
+   if (myIsComplete)
    {
-     SUIT_MessageBox::information(module()->getApp()->desktop(),
-                              tr( "REGIONS_CHANGED" ),
-                              tr( "COMPLETE_OP_WILL_BE_PERFORMED" ));
+     //SUIT_MessageBox::information(module()->getApp()->desktop(),
+     //                         tr( "REGIONS_CHANGED" ),
+     //                         tr( "COMPLETE_OP_WILL_BE_PERFORMED" ));
      return true;
    }
 
@@ -846,18 +856,18 @@ void HYDROGUI_CalculationOp::onApply()
                                aMsg ); 
   }
 }
-#include <HYDROData_CompleteCalcCase.h>
+
 void HYDROGUI_CalculationOp::onNext( const int theIndex )
 {
-  if( theIndex==1 )
+  if( theIndex==1 && !myIsComplete)
   {
     setAvailableGroups();
   }
-  else if( theIndex==2 )
+  else if( theIndex==2 && !myIsComplete)
   {
     setAvailableBoundaryPolygons();
   }
-  else if( theIndex==3 )
+  else if( theIndex==3 && !myIsComplete)
   {
     // Land cover map panel
      HYDROGUI_CalculationDlg* aPanel = 
@@ -962,7 +972,7 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
     closePreview( false );
     createPreview( true );
   }
-  else if( theIndex==4 )
+  else if( theIndex==4 || myIsComplete)
   {
     HYDROGUI_CalculationDlg* aPanel = 
       ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
@@ -992,7 +1002,11 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
       if( myEditedObject->IsMustBeUpdated(  HYDROData_Entity::Geom_2d ) )
       {
         myEditedObject->RemoveGeometryObjects();
-        foreach ( const QString& aName, aPanel->getAllGeomObjects() )
+        QStringList aGeomObjNames;
+        if (myIsComplete) //erase objects ?
+          aGeomObjNames << aPanel->getAlreadyAddedGeomObjects();
+        aGeomObjNames << aPanel->getAllGeomObjects();
+        foreach ( const QString& aName, aGeomObjNames )
         {
           Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast( 
             HYDROGUI_Tool::FindObjectByName( module(), aName ) );
@@ -1003,48 +1017,65 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
           myEditedObject->AddGeometryObject( anObject );
         }
 
-        // Clear priority rules
-        //@ASL if ( myEditedObject->GetRulesCount() > 0 ) {
+        if (!myIsComplete)
+        {
+          // Clear priority rules
+          //@ASL if ( myEditedObject->GetRulesCount() > 0 ) {
           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,
-                                  HYDROData_CalculationCase::DataTag_CustomRules );
+          //@ASL }
+          // Set priority rules
+          foreach ( const HYDROData_CustomRule& aRule, aPanel->getRules() ) {
+            myEditedObject->AddRule( aRule.Object1, aRule.Priority,
+              aRule.Object2, aRule.MergeType,
+              HYDROData_CalculationCase::DataTag_CustomRules );
+          }
         }
       }
     }
     aPanel->setEditZonesEnabled( aMode == HYDROData_CalculationCase::MANUAL );
 
+    if (myIsComplete)
+      aPanel->BackButton()->setEnabled(false); //force disable; to prevent moving to the first page
+
     if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_All ) )
     {
       myShowZones = true;
       
-      if (myDenyIncExcl)
+      if (myIsComplete)
       {
-        QList<Handle(HYDROData_Entity)> ibcludedGeomObj = aPanel->getGeometryObjects(false);
+        //abortDocOperation();
+        //module()->getApp()->updateObjectBrowser();
+        QList<Handle(HYDROData_Entity)> newGeomObj = aPanel->getGeometryObjects(false);
         //QSet<Handle(HYDROData_Entity)> includedObjAtStartSet = myIncObjAtStart.toSet();
         NCollection_Sequence<Handle(HYDROData_Entity)> theNewObjects;
-        foreach (Handle(HYDROData_Entity) obj, ibcludedGeomObj)
-        {
-          if (!myIncObjAtStart.contains(obj))
-            theNewObjects.Append(obj);
-        }
+        foreach (Handle(HYDROData_Entity) obj, newGeomObj)
+          theNewObjects.Append(obj);
+
 
         bool is_int = false;
-        HYDROData_CompleteCalcCase::AddObjects(doc(), myEditedObject, theNewObjects, is_int);
+        bool UseOrigNamingOfNewRegions = true;
+        NCollection_Sequence<Handle(HYDROData_Region)> theNewRegions;
+        QSet<QString> newRegionEntries;
+        HYDROData_CompleteCalcCase::AddObjects(doc(), myEditedObject, theNewObjects, UseOrigNamingOfNewRegions, is_int, theNewRegions);
         if (is_int)        
           SUIT_MessageBox::information(module()->getApp()->desktop(),
           tr( "COMPLETE_CASE" ),
           tr( "There is an intersection(s) between new objects. result will be depend on order" ));
 
         myEditedObject->ClearChanged();
+        for (int k=1;k<=theNewRegions.Size();k++)
+        {
+          QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theNewRegions(k) );
+          newRegionEntries.insert(anEntry);
+        }
+        AssignDefaultZonesColors(&newRegionEntries);
       }
       else
+      {
         myEditedObject->Update();
+        AssignDefaultZonesColors(NULL);
+      }
       
-      AssignDefaultZonesColors();
 
       //aPanel->setEditedObject( myEditedObject );
       aPanel->refreshZonesBrowser();
@@ -1070,32 +1101,48 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex )
 
 void HYDROGUI_CalculationOp::onHideZones( const int theIndex )
 {
-  if( theIndex==1 )
-  {
-    setGeomObjectsVisible( true );
-
-    closePreview( false );
-    createPreview( false );
+  if (myIsComplete)
+  {
+    //theIndex == 0
+  //  setGeomObjectsVisible( true );
+  // // HYDROGUI_CalculationDlg* aPanel = ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+  // // QList<Handle(HYDROData_Entity)> geomObjList =  aPanel->getGeometryObjects(false);
+  // // foreach ( Handle(HYDROData_Entity) geomObj, geomObjList)
+  // //   setObjectVisibility( geomObj, true );
+  //
+  //  setZonesVisible( false );
+  //  closePreview( false );
+  //  createPreview( false );
   }
-  if( theIndex==3 )
+  else
   {
-    setLandCoverMapVisible( true );
+    if( theIndex==1 )
+    {
+      setGeomObjectsVisible( true );
 
-    closePreview( false );
-    createPreview( true );
+      closePreview( false );
+      createPreview( false );
+    }
+    if( theIndex==3 )
+    {
+      setLandCoverMapVisible( true );
 
-    // Hide zones
-    setZonesVisible( false );
-  }
-  else if( theIndex==4 )
-  {
-    AssignDefaultZonesColors();
+      closePreview( false );
+      createPreview( true );
 
-    closePreview( false );
-    createPreview( false );
+      // Hide zones
+      setZonesVisible( false );
+    }
+    else if( theIndex==4 )
+    {
+      AssignDefaultZonesColors();
+
+      closePreview( false );
+      createPreview( false );
 
-    // Show zones
-    setZonesVisible( true );
+      // Show zones
+      setZonesVisible( true );
+    }
   }
 }
 
@@ -1151,7 +1198,7 @@ void HYDROGUI_CalculationOp::setLandCoverMapVisible( bool theIsVisible )
   setObjectVisibility( myEditedObject->GetLandCoverMap(), theIsVisible );  
 }
 
-void HYDROGUI_CalculationOp::AssignDefaultZonesColors()
+void HYDROGUI_CalculationOp::AssignDefaultZonesColors(const QSet<QString>* theRegionsEntriesToColored)
 {
   HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions();
   HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
@@ -1167,6 +1214,11 @@ void HYDROGUI_CalculationOp::AssignDefaultZonesColors()
         for ( ; aRegionsIter.More(); aRegionsIter.Next() )
         {
           aRegion = Handle(HYDROData_Region)::DownCast( aRegionsIter.Value() );
+          QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aRegion );
+
+          if (theRegionsEntriesToColored && !theRegionsEntriesToColored->contains(anEntry))
+            continue;
+
           if ( !aRegion.IsNull() )
           {
             aZones = aRegion->GetZones();
index e2ba6d4cff3035b39731f0cbca1f3e80d4cce9fc..85183a961374dd4e085ca1aae328d7c360ce80e0 100644 (file)
@@ -148,7 +148,7 @@ private:
   /**
    * Internal method that used to assign unique default colors for zones
    */
-  void                            AssignDefaultZonesColors();
+  void                            AssignDefaultZonesColors(const QSet<QString>* theRegionsEntriesToColored = NULL);
   void                            setRules( HYDROData_CalculationCase::DataTag theDataTag );
 
   bool                            createRegion( const QList<SUIT_DataObject*>& theZonesList );
@@ -170,9 +170,8 @@ private:
 
   SUIT_ViewManager*               myActiveViewManager;
   OCCViewer_ViewManager*          myPreviewViewManager;
-  QList<Handle(HYDROData_Entity)> myIncObjAtStart;
 
-  bool myDenyIncExcl;
+  bool myIsComplete;
 };
 
 #endif
index a6ef3229b156335e7ff510b9012524bdf408058c..f66e800965f70d7cf2517966f758516788441425 100644 (file)
@@ -112,12 +112,21 @@ HYDROGUI_OrderedListWidget::HYDROGUI_OrderedListWidget( QWidget* theParent, int
 
   connect ( myList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), 
             this, SIGNAL( selectionChanged() ) );
+  
+  connect ( myList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), 
+            this, SLOT( onSelectionChanged() ) );
 
   // Initialize
   setHiddenObjectsShown( true );
   setVisibilityIconShown( true );
 }
 
+void HYDROGUI_OrderedListWidget::onSelectionChanged()
+{
+  QStringList selectedEntries = getSelectedEntries();
+
+}
+
 /**
   Destructor.
 */
index 7b1feab744aa72fa372ea22fc7f0eb759f777d5a..fd272a293cc78dcab427162c85ec2e5956e4f3c1 100644 (file)
@@ -70,6 +70,7 @@ signals:
 
 private slots:
   void onMove( int theType );
+  void onSelectionChanged();
 
 private:
   HYDROGUI_ListModel* getSourceModel() const;
index 7ad59940233f81c734ac11014124b0197d77cbe9..c6d9397d2faa264dd2bba9c8a4628e773b278411 100644 (file)
@@ -190,4 +190,9 @@ void HYDROGUI_Wizard::SetButtonsState (bool IsLastPage)
     myNext->setVisible( false );
     myFinish->setVisible( true );
   }
-}
\ No newline at end of file
+}
+
+QPushButton* HYDROGUI_Wizard::BackButton()
+{
+   return myBack;
+}
index 8269950c1624932052583bbfdc8e8c11d39301e2..333f146043927ef91ad9736c5307644c99195d71 100644 (file)
@@ -40,6 +40,8 @@ public:
   int              addPage( QWizardPage* thePage );
   QStackedWidget*  wizard() const;
 
+  QPushButton*     BackButton();
+
 public slots:
   void             onNext();
   void             onBack();
index ba88e887ebd96aa84beed6a2135500334f8dd167..03993d96c3b4376dd5e1efebc731f61a6a97b5a2 100644 (file)
       <source>EDIT_CALCULATION_ICO</source>
       <translation>icon_edit_calc.png</translation>
     </message>
+    <message>
+      <source>COMPLETE_CALCULATION_ICO</source>
+      <translation>icon_complete_calc.png</translation>
+    </message>
+
     <message>
       <source>EXPORT_CALCULATION_ICO</source>
       <translation>icon_export_calc.png</translation>
index 3b654ee684a5f49ca59ae42fb6efef2a74770cf3..48bfb0a42a524358b203ca5ff87e416adb858755 100755 (executable)
@@ -337,7 +337,11 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
     <message>\r
       <source>INCLUDED_OBJECTS</source>\r
       <translation>Included objects</translation>\r
-    </message>\r
+    </message> \r
+    <message>\r
+      <source>ALREADY_INCLUDED_OBJECTS</source>\r
+      <translation>Already included objects (can't be excluded)</translation>\r
+    </message> \r
     <message>\r
       <source>AVAILABLE_GROUPS</source>\r
       <translation>Available groups</translation>\r
@@ -439,6 +443,10 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
       <translation>Edit calculation case</translation>\r
     </message>\r
     <message>\r
+      <source>COMPLETE_CALCULATION</source>
+      <translation>Fast update of calculation case</translation>
+    </message>
+    <message>
       <source>PREVIEW_CASE_ZONES</source>\r
       <translation>Preview case zones</translation>\r
     </message>\r
@@ -948,6 +956,10 @@ Would you like to remove all references from the image?</translation>
       <translation>Edit calculation case</translation>\r
     </message>\r
     <message>\r
+      <source>DSK_COMPLETE_CALCULATION</source>
+      <translation>Complete calculation case</translation>
+    </message>
+    <message>
       <source>DSK_EXPORT_CALCULATION</source>\r
       <translation>Export calculation case to GEOM</translation>\r
     </message>\r
@@ -1333,6 +1345,10 @@ Would you like to remove all references from the image?</translation>
       <translation>Edit calculation case</translation>\r
     </message>\r
     <message>\r
+      <source>MEN_COMPLETE_CALCULATION</source>
+      <translation>Complete calculation case</translation>
+    </message>
+    <message>
       <source>MEN_EXPORT_CALCULATION</source>\r
       <translation>Export calculation case</translation>\r
     </message>\r
@@ -1713,6 +1729,10 @@ Would you like to remove all references from the image?</translation>
       <translation>Edit calculation case</translation>\r
     </message>\r
     <message>\r
+      <source>STB_COMPLETE_CALCULATION</source>
+      <translation>Complete calculation case</translation>
+    </message>
+    <message>
       <source>STB_EXPORT_CALCULATION</source>\r
       <translation>Export calculation case to GEOM</translation>\r
     </message>\r
diff --git a/src/HYDROGUI/resources/icon_complete_calc.png b/src/HYDROGUI/resources/icon_complete_calc.png
new file mode 100644 (file)
index 0000000..703e197
Binary files /dev/null and b/src/HYDROGUI/resources/icon_complete_calc.png differ