From: isn Date: Thu, 18 Jun 2015 08:52:35 +0000 (+0300) Subject: sinusX p.5 (Export / GUI Part) X-Git-Tag: v1.4.2~54^2~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=982c1e44246794c1eca6b536b4c2d08092f55054;p=modules%2Fhydro.git sinusX p.5 (Export / GUI Part) --- diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 82f38ca8..e576ac96 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -38,6 +38,8 @@ set(PROJECT_HEADERS HYDROGUI_ImportImageOp.h HYDROGUI_ImportPolylineOp.h HYDROGUI_ImportSinusXOp.h + HYDROGUI_ExportSinusXOp.h + HYDROGUI_ExportSinusXDlg.h HYDROGUI_InputPanel.h HYDROGUI_LocalCSDlg.h HYDROGUI_LocalCSOp.h @@ -163,6 +165,8 @@ set(PROJECT_SOURCES HYDROGUI_ImportImageOp.cxx HYDROGUI_ImportPolylineOp.cxx HYDROGUI_ImportSinusXOp.cxx + HYDROGUI_ExportSinusXOp.cxx + HYDROGUI_ExportSinusXDlg.cxx HYDROGUI_InputPanel.cxx HYDROGUI_LocalCSDlg.cxx HYDROGUI_LocalCSOp.cxx diff --git a/src/HYDROGUI/HYDROGUI_ExportSinusXDlg.cxx b/src/HYDROGUI/HYDROGUI_ExportSinusXDlg.cxx new file mode 100644 index 00000000..49f6711d --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ExportSinusXDlg.cxx @@ -0,0 +1,107 @@ +// Copyright (C) 2014-2015 EDF-R&D +// 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, or (at your option) any later version. +// +// 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 +#include +#include +#include +#include +#include +#include +#include "HYDROGUI_Module.h" +#include +#include +#include + + +HYDROGUI_ExportSinusXDlg::HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle ) +: HYDROGUI_InputPanel( theModule, theTitle, false ) +{ + QFrame* aFrame = new QFrame( mainFrame() ); + addWidget( aFrame, 1 ); + + QGridLayout* aLayout = new QGridLayout( aFrame ); + aLayout->setMargin( 5 ); + aLayout->setSpacing( 5 ); + + myQListW = new QListWidget(mainFrame()); + + myQListW->setSelectionMode(QAbstractItemView::ExtendedSelection); + aLayout->addWidget(myQListW, 0, 0, 1, 2); + + myIncludeBtn = new QPushButton( tr( "INCLUDE" ) ); + myExcludeBtn = new QPushButton( tr( "EXCLUDE" ) ); + aLayout->addWidget(myIncludeBtn, 1, 0 ); + aLayout->addWidget(myExcludeBtn, 1, 1 ); + + myExport = new QPushButton( tr( "EXPORT" ) ); + + QHBoxLayout* aBtnsLayout = qobject_cast(buttonFrame()->layout()); + aBtnsLayout->addWidget( myExport, 0 ); + aBtnsLayout->addWidget( myCancel, 0 ); + aBtnsLayout->addStretch( 1 ); + aBtnsLayout->addWidget( myHelp, 0 ); + + //TODO connect + //connect( myExport, SIGNAL( clicked() ), SLOT( onExport() ) ); + connect( myIncludeBtn, SIGNAL( clicked() ), SIGNAL( IncludeItems() ) ); + connect( myExcludeBtn, SIGNAL( clicked() ), SIGNAL( ExcludeItems() ) ); + + myEnt2WIMap.clear(); + +} + +HYDROGUI_ExportSinusXDlg::~HYDROGUI_ExportSinusXDlg() +{ +} + +void HYDROGUI_ExportSinusXDlg::addItems(const HYDROData_SequenceOfObjects& theSelectedItems) +{ + for (int i = 1; i <= theSelectedItems.Size(); i++) + { + QString anEntName = theSelectedItems.Value(i)->GetName(); + if (!myEnt2WIMap.contains(anEntName)) + { + QListWidgetItem* aWI = new QListWidgetItem(); + aWI->setText(anEntName); + myEnt2WIMap[anEntName] = aWI; ///TODO free this map + myQListW->addItem(aWI); + } + } + myQListW->update(); +} + +void HYDROGUI_ExportSinusXDlg::RemoveItems() +{ + for (int i = 0; i < myQListW->selectedItems().size(); i++) + { + QListWidgetItem* anItem = myQListW->selectedItems()[i]; + QMap::iterator aMapIt; + for (aMapIt = myEnt2WIMap.begin(); aMapIt != myEnt2WIMap.end(); ++aMapIt) + if (aMapIt.value() == anItem) + { + aMapIt = myEnt2WIMap.erase(aMapIt); + delete anItem; + //myQListW->takeItem(anItem); + } + else + ++aMapIt; + } + myQListW->update(); +} + diff --git a/src/HYDROGUI/HYDROGUI_ExportSinusXDlg.h b/src/HYDROGUI/HYDROGUI_ExportSinusXDlg.h new file mode 100644 index 00000000..648c0c08 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ExportSinusXDlg.h @@ -0,0 +1,57 @@ +// Copyright (C) 2014-2015 EDF-R&D +// 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, or (at your option) any later version. +// +// 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_ExportSinusXDlg_H +#define HYDROGUI_ExportSinusXDlg_H + +#include "HYDROGUI_InputPanel.h" +#include +#include + +class QtxDoubleSpinBox; +class QStackedWidget; +class QPushButton; +class QListWidget; +class QListWidgetItem; + + +class HYDROGUI_ExportSinusXDlg : public HYDROGUI_InputPanel +{ + Q_OBJECT + +public: + HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle ); + virtual ~HYDROGUI_ExportSinusXDlg(); + void addItems(const HYDROData_SequenceOfObjects& theSelectedItems); + void RemoveItems(); + +signals: + void IncludeItems(); + void ExcludeItems(); + +private: + + QPushButton* myExport; + QPushButton* myIncludeBtn; + QPushButton* myExcludeBtn; + QListWidget* myQListW; + QMap myEnt2WIMap; + +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx b/src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx new file mode 100644 index 00000000..ea53a0c6 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx @@ -0,0 +1,89 @@ +// Copyright (C) 2014-2015 EDF-R&D +// 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, or (at your option) any later version. +// +// 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 +#include +#include +#include +#include +#include +#include +#include +#include + + +HYDROGUI_ExportSinusXOp::HYDROGUI_ExportSinusXOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ) +{ + setName( tr( "EXPORT_SINUSX" ) ); +} + +HYDROGUI_ExportSinusXOp::~HYDROGUI_ExportSinusXOp() +{ +} + +void HYDROGUI_ExportSinusXOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return; +} + +HYDROGUI_InputPanel* HYDROGUI_ExportSinusXOp::createInputPanel() const +{ + HYDROGUI_ExportSinusXDlg* aPanel = new HYDROGUI_ExportSinusXDlg( module(), getName() ); + connect( aPanel, SIGNAL( IncludeItems() ), SLOT( onIncludeItems() ) ); + connect( aPanel, SIGNAL( ExcludeItems() ), SLOT( onExcludeItems() ) ); + return aPanel; +} + +void HYDROGUI_ExportSinusXOp::onIncludeItems() +{ + HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return; + + HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() ); + HYDROData_SequenceOfObjects aSelectedItems; + + if ( aSeq.IsEmpty()) + return; + + for( int i = 1; i <= aSeq.Length(); i++ ) + { + Handle_HYDROData_Entity anEnt = aSeq.Value( i ); + if (anEnt->IsKind( STANDARD_TYPE( HYDROData_Bathymetry)) || + anEnt->IsKind( STANDARD_TYPE( HYDROData_PolylineXY)) || + anEnt->IsKind( STANDARD_TYPE( HYDROData_Profile)) ) + aSelectedItems.Append(anEnt); + } + + aPanel->addItems( aSelectedItems ); + +} + +void HYDROGUI_ExportSinusXOp::onExcludeItems() +{ + HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return; + aPanel->RemoveItems( ); + +} diff --git a/src/HYDROGUI/HYDROGUI_ExportSinusXOp.h b/src/HYDROGUI/HYDROGUI_ExportSinusXOp.h new file mode 100644 index 00000000..3d1a6bf8 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ExportSinusXOp.h @@ -0,0 +1,43 @@ +// Copyright (C) 2014-2015 EDF-R&D +// 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, or (at your option) any later version. +// +// 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_EXPORTSINUSXOP_H +#define HYDROGUI_EXPORTSINUSXOP_H + +#include "HYDROGUI_Operation.h" + +class HYDROGUI_ExportSinusXOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_ExportSinusXOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_ExportSinusXOp(); + +protected: + virtual void startOperation(); + + virtual HYDROGUI_InputPanel* createInputPanel() const; + +protected slots: + void onIncludeItems(); + void onExcludeItems(); + +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index e5b411ec..aad39a09 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -63,6 +63,7 @@ #include "HYDROGUI_StricklerTableOp.h" #include "HYDROGUI_DuplicateOp.h" #include "HYDROGUI_LandCoverOp.h" +#include "HYDROGUI_ExportSinusXOp.h" #include #include @@ -126,6 +127,7 @@ void HYDROGUI_Module::createActions() createAction( ImportPolylineId, "IMPORT_POLYLINE", "IMPORT_POLYLINE_ICO" ); createAction( ImportSinusXId, "IMPORT_SINUSX", "IMPORT_SINUSX_ICO" ); + createAction( ExportSinusXId, "EXPORT_SINUSX", "EXPORT_LANDCOVER_ICO" ); createAction( CreatePolylineId, "CREATE_POLYLINE", "CREATE_POLYLINE_ICO" ); createAction( EditPolylineId, "EDIT_POLYLINE", "EDIT_POLYLINE_ICO" ); @@ -228,6 +230,7 @@ void HYDROGUI_Module::createMenus() createMenu( ImportImageId, aHydroId, -1, -1 ); createMenu( ImportPolylineId, aHydroId, -1, -1 ); createMenu( ImportSinusXId, aHydroId, -1, -1 ); + createMenu( ExportSinusXId, aHydroId, -1, -1 ); createMenu( ImportBathymetryId, aHydroId, -1, -1 ); createMenu( ImportStricklerTableFromFileId, aHydroId, -1, -1 ); @@ -277,6 +280,8 @@ void HYDROGUI_Module::createToolbars() createTool( ImportImageId, aToolBar ); createTool( ImportPolylineId, aToolBar ); createTool( ImportSinusXId, aToolBar ); + createTool( ExportSinusXId, aToolBar ); + createTool( ImportBathymetryId, aToolBar ); createTool( CreatePolylineId, aToolBar ); createTool( CreatePolyline3DId, aToolBar ); @@ -441,6 +446,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case ImportSinusXId: anOp = new HYDROGUI_ImportSinusXOp( aModule ); break; + case ExportSinusXId: + anOp = new HYDROGUI_ExportSinusXOp( aModule ); + break; case ObserveImageId: anOp = new HYDROGUI_ObserveImageOp( aModule ); break; diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index b22ca76e..9f54fe36 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -111,6 +111,8 @@ enum OperationId SubmersibleId, ImportPolylineId, ImportSinusXId, + ExportSinusXId, + ExportPolylineId, diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index f251d775..adf6d86c 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -910,6 +910,10 @@ Would you like to remove all references from the image? DSK_IMPORT_SINUSX Import from SinusX + + DSK_EXPORT_SINUSX + Export to SinusX + DSK_LOAD_VISUAL_STATE Load visual state @@ -1202,6 +1206,10 @@ Would you like to remove all references from the image? MEN_IMPORT_SINUSX Import from SinusX + + MEN_EXPORT_SINUSX + Export to SinusX + MEN_LOAD_VISUAL_STATE Load visual state @@ -1471,6 +1479,10 @@ Would you like to remove all references from the image? STB_IMPORT_SINUSX Import from SinusX + + STB_EXPORT_SINUSX + Export to SinusX + STB_LOAD_VISUAL_STATE Load visual state @@ -2134,6 +2146,22 @@ file cannot be correctly imported for an Obstacle definition. + + HYDROGUI_ExportSinusXOp + + EXPORT_SINUSX + Export to SinusX + + + SINUSX_FILTER + SinusX Files (*.sx) + + + NO_ONE_ENTITY_EXPORTED + Entities cant be write + + + HYDROGUI_GeoreferencementDlg