]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
The initial implementation of Feature #84: Profiles georeferencement (12.4).
authormzn <mzn@opencascade.com>
Thu, 28 Nov 2013 06:57:29 +0000 (06:57 +0000)
committermzn <mzn@opencascade.com>
Thu, 28 Nov 2013 06:57:29 +0000 (06:57 +0000)
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_GeoreferencementDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_GeoreferencementOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 06a664cc595584fa67e1b87d59feaf44cf9c2f82..42b7be58571589a533629ad4bc9d481b61d80eca 100644 (file)
@@ -67,6 +67,8 @@ set(PROJECT_HEADERS
     HYDROGUI_SetColorOp.h
     HYDROGUI_ColorDlg.h
     HYDROGUI_ImportProfilesOp.h
+    HYDROGUI_GeoreferencementDlg.h
+    HYDROGUI_GeoreferencementOp.h
 )
 
 QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
@@ -135,6 +137,8 @@ set(PROJECT_SOURCES
     HYDROGUI_SetColorOp.cxx
     HYDROGUI_ColorDlg.cxx
     HYDROGUI_ImportProfilesOp.cxx
+    HYDROGUI_GeoreferencementDlg.cxx
+    HYDROGUI_GeoreferencementOp.cxx
 )
 
 add_definitions(
diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx
new file mode 100644 (file)
index 0000000..1e9db07
--- /dev/null
@@ -0,0 +1,193 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_GeoreferencementDlg.h"
+
+#include <QTableWidget>
+#include <QHeaderView>
+#include <QRadioButton>
+#include <QLineEdit>
+#include <QButtonGroup>
+#include <QGroupBox>
+#include <QLayout>
+
+HYDROGUI_GeoreferencementDlg::HYDROGUI_GeoreferencementDlg( HYDROGUI_Module* theModule, const QString& theTitle )
+: HYDROGUI_InputPanel( theModule, theTitle )
+{
+  // Mode selector (all/selected)
+  QGroupBox* aModeGroup = new QGroupBox( tr( "PROFILES" ), this );
+
+  QRadioButton* anAllRB = new QRadioButton( tr( "ALL_MODE" ), aModeGroup );
+  QRadioButton* aSelectedRB = new QRadioButton( tr( "SELECTED_MODE" ), aModeGroup );
+
+  myModeButtons = new QButtonGroup( aModeGroup );
+  myModeButtons->addButton( anAllRB, AllProfiles );
+  myModeButtons->addButton( aSelectedRB, SelectedProfiles );
+
+  QBoxLayout* aModeSelectorLayout = new QVBoxLayout( aModeGroup );
+  aModeSelectorLayout->setMargin( 5 );
+  aModeSelectorLayout->setSpacing( 5 );
+  aModeSelectorLayout->addWidget( anAllRB );
+  aModeSelectorLayout->addWidget( aSelectedRB );
+
+  // Table
+  myTable = new QTableWidget( mainFrame() );
+  myTable->verticalHeader()->setVisible( false );
+  myTable->setSelectionBehavior( QAbstractItemView::SelectItems );
+  myTable->setSelectionMode( QAbstractItemView::SingleSelection );
+  myTable->setColumnCount( 5 );
+  QStringList aColumnNames;
+  aColumnNames << tr( "PROFILE_HEADER" ) << tr( "XG_HEADER" ) << tr( "YG_HEADER" ) << 
+                                            tr( "XD_HEADER" ) << tr( "YD_HEADER" );
+  myTable->setHorizontalHeaderLabels( aColumnNames );
+
+  // Layout
+  addWidget( aModeGroup );
+  addWidget( myTable );
+
+  // Connect signals and slots
+  connect( myModeButtons, SIGNAL( buttonClicked( int ) ), this, SLOT( onModeActivated( int ) ) );
+}
+
+HYDROGUI_GeoreferencementDlg::~HYDROGUI_GeoreferencementDlg()
+{
+}
+
+void HYDROGUI_GeoreferencementDlg::onModeActivated( int theMode )
+{
+  emit modeActivated( theMode );
+}
+
+void HYDROGUI_GeoreferencementDlg::reset()
+{
+  // Activate the "All" mode
+  myModeButtons->button( AllProfiles )->setChecked( true );
+
+  // Clear the table widget
+  myTable->setRowCount( 0 );
+}
+
+void HYDROGUI_GeoreferencementDlg::onProfilesSelectionChanged()
+{
+  // MZN TODO
+}
+
+void HYDROGUI_GeoreferencementDlg::setMode( const int theMode )
+{
+  bool isBlocked = myModeButtons->blockSignals( true );
+
+  QAbstractButton* aModeButton = myModeButtons->button( theMode );
+  if ( aModeButton ) {
+    aModeButton->setChecked( true );
+  }
+
+  myModeButtons->blockSignals( isBlocked );
+}
+
+void HYDROGUI_GeoreferencementDlg::setData( const ProfilesGeoDataMap& theMap )
+{
+  myTable->setRowCount( 0 );
+
+  foreach ( const QString& aProfileName, theMap.keys() ) {
+    // Check the current profile name
+    if ( aProfileName.isEmpty() ) {
+      continue;
+    }
+
+    // Get georeferencement data for the current profile
+    ProfileGeoData aGeoData = theMap.value( aProfileName );
+    QString aXg, anYg, aXd, anYd;
+    if ( aGeoData.isValid ) {
+      aXg = QString::number( aGeoData.Xg );
+      anYg = QString::number( aGeoData.Yg );
+      aXd = QString::number( aGeoData.Xd );
+      anYd = QString::number( aGeoData.Yd );
+    }
+    
+    // Insert row with the data
+    int aRow = myTable->rowCount();
+    myTable->insertRow( aRow );
+
+    // "Profile" column
+    QTableWidgetItem* aNameItem = new QTableWidgetItem( aProfileName );
+    aNameItem->setFlags( Qt::ItemIsEnabled );
+    myTable->setItem( aRow, 0, aNameItem );
+
+    // "Xg" column
+    QLineEdit* aXgEdit = new QLineEdit( aXg );
+    aXgEdit->setValidator( new QDoubleValidator( aXgEdit ) );
+    myTable->setCellWidget( aRow, 1, aXgEdit );
+
+    // "Yg" column
+    QLineEdit* anYgEdit = new QLineEdit( anYg );
+    anYgEdit->setValidator( new QDoubleValidator( anYgEdit ) );
+    myTable->setCellWidget( aRow, 2, anYgEdit );
+
+    // "Xd" column
+    QLineEdit* aXdEdit = new QLineEdit( aXd );
+    aXdEdit->setValidator( new QDoubleValidator( aXdEdit ) );
+    myTable->setCellWidget( aRow, 3, aXdEdit );
+
+    // "Yd" column
+    QLineEdit* anYdEdit = new QLineEdit( anYd );
+    anYdEdit->setValidator( new QDoubleValidator( anYdEdit ) );
+    myTable->setCellWidget( aRow, 4, anYdEdit );
+  }
+}
+
+void HYDROGUI_GeoreferencementDlg::getData( ProfilesGeoDataMap& theMap )
+{
+  // Clear the map
+  theMap.clear();
+
+  // Fill the map
+  bool isOk = false;
+  for ( int aRow = 0; aRow < myTable->rowCount(); aRow++ ) {
+    QString aProfileName = myTable->item( aRow, 0 )->text();
+
+    theMap.insert( aProfileName, ProfileGeoData() );
+
+    double aXg, anYg, aXd, anYd;
+    
+    QLineEdit* aLineEdit = qobject_cast<QLineEdit*>( myTable->cellWidget( aRow, 1 ) );
+    QString aCellText = aLineEdit ? aLineEdit->text() : "";
+    aXg = aCellText.toDouble( &isOk );
+    if ( !isOk ) continue;
+
+    aLineEdit = qobject_cast<QLineEdit*>( myTable->cellWidget( aRow, 2 ) );
+    aCellText = aLineEdit ? aLineEdit->text() : "";
+    anYg = aCellText.toDouble( &isOk );
+    if ( !isOk ) continue;
+
+    aLineEdit = qobject_cast<QLineEdit*>( myTable->cellWidget( aRow, 3 ) );
+    aCellText = aLineEdit ? aLineEdit->text() : "";
+    aXd = aCellText.toDouble( &isOk );
+    if ( !isOk ) continue;
+
+    aLineEdit = qobject_cast<QLineEdit*>( myTable->cellWidget( aRow, 4 ) );
+    aCellText = aLineEdit ? aLineEdit->text() : "";
+    anYd = aCellText.toDouble( &isOk );
+    if ( !isOk ) continue;
+   
+    theMap[aProfileName] = ProfileGeoData( aXg, anYg, aXd, anYd );
+  }
+}
diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.h b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.h
new file mode 100644 (file)
index 0000000..a2a1c0b
--- /dev/null
@@ -0,0 +1,79 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_GEOREFERENCEMENT_H
+#define HYDROGUI_GEOREFERENCEMENT_H
+
+#include "HYDROGUI_InputPanel.h"
+
+class QGroupBox;
+class QButtonGroup;
+class QTableWidget;
+
+class HYDROGUI_GeoreferencementDlg : public HYDROGUI_InputPanel
+{
+  Q_OBJECT
+
+public:
+  enum ProfilesMode { AllProfiles, SelectedProfiles };
+
+  struct ProfileGeoData
+  {
+    double Xg;
+    double Yg;
+    double Xd;
+    double Yd;
+
+    bool isValid;
+
+    ProfileGeoData() :
+      isValid( false ) {}
+
+    ProfileGeoData( double theXg, double theYg, double theXd, double theYd ) :
+      Xg( theXg ), Yg( theYg ), Xd( theXd ), Yd( theYd ), isValid( true ) {}
+  };
+  typedef QMap< QString, ProfileGeoData > ProfilesGeoDataMap;
+
+public:
+  HYDROGUI_GeoreferencementDlg( HYDROGUI_Module* theModule, const QString& theTitle );
+  virtual ~HYDROGUI_GeoreferencementDlg();
+
+  void                       reset();
+
+  void                       setMode( const int theMode );
+
+  void                       setData( const ProfilesGeoDataMap& theMap );
+  void                       getData( ProfilesGeoDataMap& theMap );
+
+protected slots:
+  void                       onModeActivated( int );
+  void                       onProfilesSelectionChanged();
+
+signals:
+  void                       modeActivated( int );
+
+private:
+  QButtonGroup* myModeButtons;
+  QTableWidget* myTable;
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx
new file mode 100644 (file)
index 0000000..58e29d0
--- /dev/null
@@ -0,0 +1,171 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROGUI_GeoreferencementOp.h"
+
+#include "HYDROGUI_GeoreferencementDlg.h"
+#include "HYDROGUI_DataModel.h"
+#include "HYDROGUI_Module.h"
+#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_UpdateFlags.h"
+
+#include <HYDROData_Profile.h>
+#include <HYDROData_Iterator.h>
+#include <HYDROData_Entity.h>
+
+#include <LightApp_Application.h>
+#include <LightApp_UpdateFlags.h>
+
+#include <gp_XY.hxx>
+
+HYDROGUI_GeoreferencementOp::HYDROGUI_GeoreferencementOp( HYDROGUI_Module* theModule, const int theInitialMode )
+: HYDROGUI_Operation( theModule ),
+  myInitialMode( theInitialMode )
+{
+  setName( tr( "PROFILES_GEOREFERENCEMENT" ) );
+}
+
+HYDROGUI_GeoreferencementOp::~HYDROGUI_GeoreferencementOp()
+{
+}
+
+void HYDROGUI_GeoreferencementOp::startOperation()
+{
+  HYDROGUI_Operation::startOperation();
+
+  HYDROGUI_GeoreferencementDlg* aPanel = 
+    ::qobject_cast<HYDROGUI_GeoreferencementDlg*>( inputPanel() );
+  if ( !aPanel ) {
+    return;
+  }
+
+  aPanel->reset();
+
+  if ( myInitialMode == All ) {
+    int anAllMode = HYDROGUI_GeoreferencementDlg::AllProfiles;
+    aPanel->setMode( anAllMode );
+    onModeActivated( anAllMode );
+  } else if ( myInitialMode == Selected ) {
+    int aSelectionMode = HYDROGUI_GeoreferencementDlg::SelectedProfiles;
+    aPanel->setMode( aSelectionMode );
+    onModeActivated( aSelectionMode );
+  }
+}
+
+void HYDROGUI_GeoreferencementOp::abortOperation()
+{
+  HYDROGUI_Operation::abortOperation();
+}
+
+void HYDROGUI_GeoreferencementOp::commitOperation()
+{
+  HYDROGUI_Operation::commitOperation();
+}
+
+HYDROGUI_InputPanel* HYDROGUI_GeoreferencementOp::createInputPanel() const
+{
+  HYDROGUI_InputPanel* aPanel = new HYDROGUI_GeoreferencementDlg( module(), getName() );
+  connect( aPanel, SIGNAL( modeActivated( int ) ), SLOT( onModeActivated( int ) ) );
+
+  return aPanel;
+}
+
+bool HYDROGUI_GeoreferencementOp::processApply( int& theUpdateFlags,
+                                                QString& theErrorMsg )
+{
+  HYDROGUI_GeoreferencementDlg* aPanel = 
+    ::qobject_cast<HYDROGUI_GeoreferencementDlg*>( inputPanel() );
+  if ( !aPanel ) {
+    return false;
+  }
+
+  // Get georeferencement data from the panel
+  HYDROGUI_GeoreferencementDlg::ProfilesGeoDataMap aGeoDataMap;
+  aPanel->getData( aGeoDataMap );
+
+  // Set the data
+  foreach ( const QString& aProfileName, aGeoDataMap.keys() ) {
+    Handle(HYDROData_Profile) aProfile = 
+      Handle(HYDROData_Profile)::DownCast(
+        HYDROGUI_Tool::FindObjectByName( module(), aProfileName, KIND_PROFILE ) );
+    if ( !aProfile.IsNull() ) {
+      HYDROGUI_GeoreferencementDlg::ProfileGeoData aGeoData = 
+        aGeoDataMap.value( aProfileName );
+      if ( aGeoData.isValid ) {
+        aProfile->SetFirstPoint( gp_XY( aGeoData.Xg, aGeoData.Yg ) );
+        aProfile->SetLastPoint( gp_XY( aGeoData.Xd, aGeoData.Yd ) );
+      } else {
+        aProfile->Invalidate();
+      }
+    }
+  }
+  
+  theUpdateFlags = UF_Model;
+  return true;
+}
+
+void HYDROGUI_GeoreferencementOp::onModeActivated( const int theActualMode )
+{
+  HYDROGUI_GeoreferencementDlg* aPanel = 
+    ::qobject_cast<HYDROGUI_GeoreferencementDlg*>( inputPanel() );
+  if ( !aPanel ) {
+    return;
+  }
+
+  HYDROGUI_GeoreferencementDlg::ProfilesGeoDataMap aDataMap;
+  HYDROData_SequenceOfObjects aSeqOfProfiles;
+  
+  if( theActualMode == HYDROGUI_GeoreferencementDlg::AllProfiles ) {
+    HYDROData_Iterator aProfilesIter( doc(), KIND_PROFILE );
+    while ( aProfilesIter.More() ) {
+      aSeqOfProfiles.Append( aProfilesIter.Current() );
+      aProfilesIter.Next();
+    }
+  } else if ( theActualMode == HYDROGUI_GeoreferencementDlg::SelectedProfiles ) {
+    aSeqOfProfiles = HYDROGUI_Tool::GetSelectedObjects( module() );
+  }
+
+  HYDROData_SequenceOfObjects::Iterator anIter( aSeqOfProfiles );
+  for ( ; anIter.More(); anIter.Next() ) {
+    Handle(HYDROData_Profile) aProfile =
+        Handle(HYDROData_Profile)::DownCast( anIter.Value() );
+    if ( aProfile.IsNull() ) {
+      continue;
+    }
+
+    HYDROGUI_GeoreferencementDlg::ProfileGeoData aGeoData;
+
+    gp_XY aFirstPoint, aLastPoint;
+    if ( aProfile->GetFirstPoint( aFirstPoint ) && aProfile->GetLastPoint( aLastPoint ) ) {
+      aGeoData = 
+        HYDROGUI_GeoreferencementDlg::ProfileGeoData( aFirstPoint.X(), aFirstPoint.Y(),
+                                                      aLastPoint.X(), aLastPoint.Y() );
+    }
+   
+    aDataMap.insert( aProfile->GetName(), aGeoData );
+  }
+
+  aPanel->setData( aDataMap );
+}
+
+
+
diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h
new file mode 100644 (file)
index 0000000..4148435
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_GEOREFERENCEMENTOP_H
+#define HYDROGUI_GEOREFERENCEMENTOP_H
+
+#include "HYDROGUI_Operation.h"
+
+
+class HYDROGUI_GeoreferencementOp : public HYDROGUI_Operation
+{
+  Q_OBJECT
+
+public:
+  enum InitialMode { All, Selected };
+
+public:
+  HYDROGUI_GeoreferencementOp( HYDROGUI_Module* theModule, const int theInitialMode );
+  virtual ~HYDROGUI_GeoreferencementOp();
+
+protected:
+  virtual void                    startOperation();
+  virtual void                    abortOperation();
+  virtual void                    commitOperation();
+
+  virtual HYDROGUI_InputPanel*    createInputPanel() const;
+
+  virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg );
+
+protected slots:
+  void                            onModeActivated( const int theActualMode );
+
+private:
+  int myInitialMode;
+};
+
+#endif
index 8c413c578dadaab5aca8693882eff4d684580e52..c92f41b4718c3bb54e845a6e2d3c41010daadaa4 100644 (file)
@@ -225,6 +225,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsMustBeUpdatedImage = false;
   bool anIsPolyline = false;
   bool anIsProfile = false;
+  bool anAllAreProfiles = false;
   bool anIsBathymetry = false;
   bool anIsCalculation = false;
   bool anIsImmersibleZone = false;
@@ -242,6 +243,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 
   // check the selected data model objects
   HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
+  int aNbOfSelectedProfiles = 0;
   for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
   {
     Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
@@ -282,8 +284,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       }
       else if( anObject->GetKind() == KIND_POLYLINEXY )
         anIsPolyline = true;
-      else if( anObject->GetKind() == KIND_PROFILE )
+      else if( anObject->GetKind() == KIND_PROFILE ) {
         anIsProfile = true;
+        aNbOfSelectedProfiles++;
+      }
       else if( anObject->GetKind() == KIND_CALCULATION )
         anIsCalculation = true;
       else if( anObject->GetKind() == KIND_IMMERSIBLE_ZONE )
@@ -303,6 +307,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     anIsGeomObject = HYDROData_Tool::IsGeometryObject( anObject );
   }
 
+  // Check if all selected objects are profiles
+  anAllAreProfiles = ( aNbOfSelectedProfiles > 0 ) &&
+                     ( aNbOfSelectedProfiles == aSeq.Length() );
+
   // check the selected partitions
   if( !anIsSelectedDataObjects && anIsObjectBrowser )
   {
@@ -320,6 +328,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         case KIND_PROFILE:
           theMenu->addAction( action( CreateProfileId ) );
           theMenu->addAction( action( ImportProfilesId ) );
+          theMenu->addAction( action( AllGeoreferencementId ) );
           break;
         case KIND_VISUAL_STATE:
           theMenu->addAction( action( SaveVisualStateId ) );
@@ -390,6 +399,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       else if( anIsProfile )
       {
         theMenu->addAction( action( EditProfileId ) );
+        theMenu->addAction( action( SelectedGeoreferencementId ) );
         theMenu->addSeparator();
       }
       else if( anIsCalculation )
@@ -418,6 +428,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       }
     }
 
+    if ( anAllAreProfiles ) {
+      theMenu->addAction( action( SelectedGeoreferencementId ) );
+      theMenu->addSeparator();
+    }
+
     theMenu->addAction( action( DeleteId ) );
     theMenu->addSeparator();
 
index 8eeee9a60f733da982cf832c94be561a1824efda..2e08c26898336623dbcb2c31917c787d5e2eadb6 100644 (file)
@@ -46,6 +46,7 @@
 #include "HYDROGUI_ImportObstacleFromFileOp.h"
 #include "HYDROGUI_ExportCalculationOp.h"
 #include "HYDROGUI_ImportProfilesOp.h"
+#include "HYDROGUI_GeoreferencementOp.h"
 #include "HYDROGUI_SetColorOp.h"
 
 #include "HYDROData_Document.h"
@@ -109,7 +110,9 @@ void HYDROGUI_Module::createActions()
   createAction( CreateProfileId, "CREATE_PROFILE" );
   createAction( ImportProfilesId, "IMPORT_PROFILES" );
   createAction( EditProfileId, "EDIT_PROFILE" ); 
-
+  createAction( AllGeoreferencementId, "GEOREFERENCEMENT" ); 
+  createAction( SelectedGeoreferencementId, "GEOREFERENCEMENT" ); 
+  
   createAction( ImportBathymetryId, "IMPORT_BATHYMETRY", "", Qt::CTRL + Qt::Key_B );
 
   createAction( CreateImmersibleZoneId, "CREATE_IMMERSIBLE_ZONE" );
@@ -168,6 +171,7 @@ void HYDROGUI_Module::createMenus()
   int aNewProfileId = createMenu( tr( "MEN_PROFILE" ), aHydroId, -1 );
   createMenu( CreateProfileId, aNewProfileId, -1, -1 );
   createMenu( ImportProfilesId, aNewProfileId, -1, -1 );
+  createMenu( AllGeoreferencementId, aNewProfileId, -1, -1 );
 
   createMenu( CreateImmersibleZoneId, aHydroId, -1, -1 );
 
@@ -339,6 +343,12 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
   case ImportProfilesId:
     anOp = new HYDROGUI_ImportProfilesOp( aModule ) ;
     break;
+  case AllGeoreferencementId:
+    anOp = new HYDROGUI_GeoreferencementOp( aModule, HYDROGUI_GeoreferencementOp::All ) ;
+    break;
+  case SelectedGeoreferencementId:
+    anOp = new HYDROGUI_GeoreferencementOp( aModule, HYDROGUI_GeoreferencementOp::Selected ) ;
+    break;
   case ImportBathymetryId:
     anOp = new HYDROGUI_ImportBathymetryOp( aModule );
     break;
index f789e86c58034ae35b630ea94e52db4a7d2ba830..795fe283acb19e8983e334823272bb01f8c1ac1b 100644 (file)
@@ -49,7 +49,9 @@ enum OperationId
   ImportProfilesId,
   CreateProfileId,
   EditProfileId,
-  
+  AllGeoreferencementId,
+  SelectedGeoreferencementId,
+
   ImportBathymetryId,
   EditImportedBathymetryId,
 
index a1d64bb05f1a8852ab7153869ab2be1fcd705317..eeec7ed149617b519a9cb28b45513ba16031df78 100644 (file)
@@ -480,6 +480,10 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <source>DSK_IMPORT_PROFILES</source>
       <translation>Import profiles from file(s)</translation>
     </message>
+    <message>
+      <source>DSK_GEOREFERENCEMENT</source>
+      <translation>Profile(s) georeferencement</translation>
+    </message>
     <message>
       <source>DSK_CREATE_IMMERSIBLE_ZONE</source>
       <translation>Create immersible zone</translation>
@@ -636,6 +640,10 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <source>MEN_IMPORT_PROFILES</source>
       <translation>Import profiles</translation>
     </message>
+    <message>
+      <source>MEN_GEOREFERENCEMENT</source>
+      <translation>Georeferencement</translation>
+    </message>
     <message>
       <source>MEN_CREATE_ZONE</source>
       <translation>Create zone</translation>
@@ -808,6 +816,10 @@ file cannot be correctly imported for a Bathymetry definition.</translation>
       <source>STB_IMPORT_PROFILES</source>
       <translation>Import profiles from file(s)</translation>
     </message>
+    <message>
+      <source>STB_GEOREFERENCEMENT</source>
+      <translation>Profile(s) georeferencement</translation>
+    </message>
     <message>
       <source>STB_CREATE_IMMERSIBLE_ZONE</source>
       <translation>Create immersible zone</translation>
@@ -1296,7 +1308,51 @@ file cannot be correctly imported for an Obstacle definition.</translation>
 </translation>
     </message>
   </context>
-
+   
+  <context>
+    <name>HYDROGUI_GeoreferencementDlg</name>
+    <message>
+      <source>PROFILES</source>
+      <translation>Profiles</translation>
+    </message>
+    <message>
+      <source>ALL_MODE</source>
+      <translation>All</translation>
+    </message>
+    <message>
+      <source>SELECTED_MODE</source>
+      <translation>Selected</translation>
+    </message>
+    <message>
+      <source>PROFILE_HEADER</source>
+      <translation>Profile</translation>
+    </message>
+    <message>
+      <source>XG_HEADER</source>
+      <translation>Xg</translation>
+    </message>
+    <message>
+      <source>YG_HEADER</source>
+      <translation>Yg</translation>
+    </message>
+    <message>
+      <source>XD_HEADER</source>
+      <translation>Xd</translation>
+    </message>
+    <message>
+      <source>YD_HEADER</source>
+      <translation>Yd</translation>
+    </message>
+  </context>
+  <context>
+    <name>HYDROGUI_GeoreferencementOp</name>
+    <message>
+      <source>PROFILES_GEOREFERENCEMENT</source>
+      <translation>Profiles georeferencement</translation>
+    </message>
+  </context>
   <context>
     <name>HYDROGUI_SetColorOp</name>
     <message>