From 76b254e749b5fcb49f860cbdaa69e7bdd239a587 Mon Sep 17 00:00:00 2001 From: mzn Date: Thu, 28 Nov 2013 06:57:29 +0000 Subject: [PATCH] The initial implementation of Feature #84: Profiles georeferencement (12.4). --- src/HYDROGUI/CMakeLists.txt | 4 + src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx | 193 ++++++++++++++++++ src/HYDROGUI/HYDROGUI_GeoreferencementDlg.h | 79 +++++++ src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx | 171 ++++++++++++++++ src/HYDROGUI/HYDROGUI_GeoreferencementOp.h | 56 +++++ src/HYDROGUI/HYDROGUI_Module.cxx | 17 +- src/HYDROGUI/HYDROGUI_Operations.cxx | 12 +- src/HYDROGUI/HYDROGUI_Operations.h | 4 +- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 58 +++++- 9 files changed, 590 insertions(+), 4 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx create mode 100644 src/HYDROGUI/HYDROGUI_GeoreferencementDlg.h create mode 100644 src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_GeoreferencementOp.h diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 06a664cc..42b7be58 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -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 index 00000000..1e9db073 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.cxx @@ -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 +#include +#include +#include +#include +#include +#include + +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( myTable->cellWidget( aRow, 1 ) ); + QString aCellText = aLineEdit ? aLineEdit->text() : ""; + aXg = aCellText.toDouble( &isOk ); + if ( !isOk ) continue; + + aLineEdit = qobject_cast( myTable->cellWidget( aRow, 2 ) ); + aCellText = aLineEdit ? aLineEdit->text() : ""; + anYg = aCellText.toDouble( &isOk ); + if ( !isOk ) continue; + + aLineEdit = qobject_cast( myTable->cellWidget( aRow, 3 ) ); + aCellText = aLineEdit ? aLineEdit->text() : ""; + aXd = aCellText.toDouble( &isOk ); + if ( !isOk ) continue; + + aLineEdit = qobject_cast( 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 index 00000000..a2a1c0bd --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementDlg.h @@ -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 index 00000000..58e29d0e --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx @@ -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 +#include +#include + +#include +#include + +#include + +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( 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( 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( 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 index 00000000..41484355 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.h @@ -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 diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 8c413c57..c92f41b4 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -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(); diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index 8eeee9a6..2e08c268 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -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; diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index f789e86c..795fe283 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -49,7 +49,9 @@ enum OperationId ImportProfilesId, CreateProfileId, EditProfileId, - + AllGeoreferencementId, + SelectedGeoreferencementId, + ImportBathymetryId, EditImportedBathymetryId, diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index a1d64bb0..eeec7ed1 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -480,6 +480,10 @@ file cannot be correctly imported for a Bathymetry definition. DSK_IMPORT_PROFILES Import profiles from file(s) + + DSK_GEOREFERENCEMENT + Profile(s) georeferencement + DSK_CREATE_IMMERSIBLE_ZONE Create immersible zone @@ -636,6 +640,10 @@ file cannot be correctly imported for a Bathymetry definition. MEN_IMPORT_PROFILES Import profiles + + MEN_GEOREFERENCEMENT + Georeferencement + MEN_CREATE_ZONE Create zone @@ -808,6 +816,10 @@ file cannot be correctly imported for a Bathymetry definition. STB_IMPORT_PROFILES Import profiles from file(s) + + STB_GEOREFERENCEMENT + Profile(s) georeferencement + STB_CREATE_IMMERSIBLE_ZONE Create immersible zone @@ -1296,7 +1308,51 @@ file cannot be correctly imported for an Obstacle definition. - + + + HYDROGUI_GeoreferencementDlg + + PROFILES + Profiles + + + ALL_MODE + All + + + SELECTED_MODE + Selected + + + PROFILE_HEADER + Profile + + + XG_HEADER + Xg + + + YG_HEADER + Yg + + + XD_HEADER + Xd + + + YD_HEADER + Yd + + + + + HYDROGUI_GeoreferencementOp + + PROFILES_GEOREFERENCEMENT + Profiles georeferencement + + + HYDROGUI_SetColorOp -- 2.39.2