]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
- Geometry objects selected in Calculation case wizard are highlighted now in the...
authorrkv <rkv@opencascade.com>
Wed, 6 Nov 2013 10:12:52 +0000 (10:12 +0000)
committerrkv <rkv@opencascade.com>
Wed, 6 Nov 2013 10:12:52 +0000 (10:12 +0000)
src/HYDROGUI/HYDROGUI_CalculationDlg.cxx
src/HYDROGUI/HYDROGUI_CalculationDlg.h
src/HYDROGUI/HYDROGUI_CalculationOp.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.h

index 0c83743c7ac595964a30f54cb92504e4f9100488..6345e5f5b94f704fbacb4c469d3309c7b48878c7 100644 (file)
@@ -90,8 +90,8 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
   myValidator = new HYDROGUI_NameValidator(module(), myObjectName);
   myObjectName->setValidator( myValidator );
 
-  connect( myValidator, SIGNAL( emptyName() ), this, SLOT( onEmptyName() ) );
-  connect( myValidator, SIGNAL( alreadyExists( QString ) ), this, SLOT( onAlreadyExists( QString ) ) );
+  connect( myValidator, SIGNAL( emptyName() ), SLOT( onEmptyName() ) );
+  connect( myValidator, SIGNAL( alreadyExists( QString ) ), SLOT( onAlreadyExists( QString ) ) );
 
   myGeomObjects = new QListWidget( aPage );
   myGeomObjects->setSelectionMode( QListWidget::SingleSelection );
@@ -99,6 +99,9 @@ QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
   myGeomObjects->setViewMode( QListWidget::ListMode );
   myGeomObjects->setSortingEnabled( true );
 
+  connect( myGeomObjects, SIGNAL( currentTextChanged( const QString & ) ), 
+    SIGNAL( objectSelected( const QString & ) ) );
+
   QFrame* aBtnsFrame = new QFrame( aPage );
   QVBoxLayout* aBtnsLayout = new QVBoxLayout( aBtnsFrame );
   aBtnsLayout->setMargin( 5 );
@@ -278,10 +281,6 @@ QString HYDROGUI_CalculationDlg::getObjectName() const
 }
 
 void HYDROGUI_CalculationDlg::setGeomObjects( const QStringList& theObjects )
-{
-}
-
-void HYDROGUI_CalculationDlg::setSelectedGeomObjects( const QStringList& theObjects )
 {
   myGeomObjects->clear();
 
index 6c533e701fff08e6c297c814ddefe2d009383218..11d38363ba97aa92df0abc70e6bd42ac659f64f9 100644 (file)
@@ -54,7 +54,6 @@ public:
   void                       setEditedObject( const Handle(HYDROData_CalculationCase) theCase );
 
   void                       setGeomObjects( const QStringList& theObjects );
-  void                       setSelectedGeomObjects( const QStringList& theObjects );
   QStringList                getSelectedGeomObjects() const;
   HYDROGUI_Zone*             getCurrentZone() const;
 
@@ -79,6 +78,7 @@ public slots:
 signals:
   void                       addObjects();
   void                       removeObjects();
+  void                       objectSelected( const QString & theObjName );
   void                       splitZones();
   void                       hideZones();
   void                       setMergeType( int theMergeType, QString& theBathymetryName );
index e826fb926f4e15ae7ff317c182ecc64c7b156502..5607f4f435345d96cf037b983f7e82508c690ac1 100644 (file)
@@ -124,7 +124,7 @@ void HYDROGUI_CalculationOp::updateGeomObjectsList( HYDROGUI_CalculationDlg* the
       }
     }
   }
-  thePanel->setSelectedGeomObjects( aList );
+  thePanel->setGeomObjects( aList );
 }
 
 void HYDROGUI_CalculationOp::abortOperation()
@@ -160,10 +160,57 @@ HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const
     SLOT( onCreateRegion( const QList<SUIT_DataObject*>& ) ) );
   connect( aPanel, SIGNAL( clickedInZonesBrowser( SUIT_DataObject* ) ),
     SLOT( onClickedInZonesBrowser( SUIT_DataObject* ) ) );
+  connect( aPanel, SIGNAL( objectSelected( const QString & ) ), 
+    SLOT( onObjectSelected( const QString & ) ) );
 
   return aPanel;
 }
 
+void HYDROGUI_CalculationOp::onObjectSelected ( const QString & theObjName )
+{
+  // Select the appropriate geometry object shape in the viewer
+  selectionMgr()->clearSelected();
+
+  // Unhighlight all objects except selected
+  HYDROGUI_Shape* aShape;
+  HYDROGUI_Shape* aSelectedShape = 0;
+  Handle(HYDROData_Entity) anEntity;
+  HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
+  HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
+  bool isSelected;
+  QString aName;
+  for ( ; anIter.More(); anIter.Next() )
+  {
+    anEntity = anIter.Value();
+    if ( !anEntity.IsNull() )
+    {
+      aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anEntity );
+      if ( aShape )
+      {
+        aName = anEntity->GetName();
+        isSelected = ( aName == theObjName );
+        if ( isSelected )
+        {
+          aSelectedShape = aShape;
+        }
+        if ( aShape->isHighlighted() != isSelected )
+        {
+          if ( !isSelected )
+          {
+            aShape->highlight( isSelected );
+            aShape->update();
+          }
+        }
+      }
+    }
+  }
+  if ( aSelectedShape )
+  {
+    aSelectedShape->highlight( true );
+    aSelectedShape->update();
+  }
+}
+
 void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
 {
   HYDROGUI_Region* aRegionItem = dynamic_cast<HYDROGUI_Region*>(theItem);
index b5dec9d6bcd54909178c464e1f3885cb750c0052..cba6529c74a4573a2b920d04186d015fb1d902e0 100644 (file)
@@ -67,13 +67,32 @@ protected slots:
    * Set the given bathymetry merge type to the current zone.
    */
   void                            onSetMergeType( int theMergeType, QString& theBathymetryName );
+  /**
+   * Selected zones are moved to the existing region.
+   */
   void                            onMoveZones( SUIT_DataObject* theRegionItem, 
                                                const QList<SUIT_DataObject*>& theZonesList );
+  /**
+   * Selected zones are moved to the new region to be created.
+   */
   void                            onCreateRegion( const QList<SUIT_DataObject*>& theZonesList );
+  /**
+   * Case objects must be splitted to zones if the case has been modified or new.
+   */
   void                            onSplitZones();
   void                            onLastViewClosed( SUIT_ViewManager* );
+  /**
+   * The zone is selected in the browser on the second page of the wizard.
+   */
   void                            onClickedInZonesBrowser( SUIT_DataObject* theItem );
+  /**
+   * Hide zones in the viewer.
+   */
   void                            onHideZones();
+  /** 
+   * Geometry object is selected in the list on the first wizard page
+   */
+  void                            onObjectSelected ( const QString & theObjName );
 
 private:
   void                            createPreview();