]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
sinusX p.5 (Export / GUI Part)
authorisn <isn@opencascade.com>
Thu, 18 Jun 2015 08:52:35 +0000 (11:52 +0300)
committerisn <isn@opencascade.com>
Thu, 18 Jun 2015 11:10:33 +0000 (14:10 +0300)
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_ExportSinusXDlg.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ExportSinusXDlg.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ExportSinusXOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 82f38ca817590d46e3ea437999c47c87f0ee0c33..e576ac966ae17b9ea9405921d510008e3ba9db23 100644 (file)
@@ -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 (file)
index 0000000..49f6711
--- /dev/null
@@ -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 <HYDROGUI_ExportSinusXDlg.h>
+#include <HYDROGUI_Module.h>
+#include <QtxDoubleSpinBox.h>
+#include <QLayout>
+#include <QLabel>
+#include <QStackedWidget>
+#include <QPushButton>
+#include "HYDROGUI_Module.h"
+#include <CAM_Application.h>
+#include <SUIT_Desktop.h>
+#include <QListWidget.h>
+
+
+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<QHBoxLayout*>(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<QString, QListWidgetItem*>::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 (file)
index 0000000..648c0c0
--- /dev/null
@@ -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 <HYDROData_Entity.h>
+#include <QMap>
+
+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<QString, QListWidgetItem*> myEnt2WIMap;
+
+};
+
+#endif
diff --git a/src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx b/src/HYDROGUI/HYDROGUI_ExportSinusXOp.cxx
new file mode 100644 (file)
index 0000000..ea53a0c
--- /dev/null
@@ -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 <HYDROGUI_ExportSinusXOp.h>
+#include <HYDROGUI_ExportSinusXDlg.h>
+#include <HYDROData_Document.h>
+#include <HYDROGUI_UpdateFlags.h>
+#include <HYDROGUI_Tool.h>
+#include <HYDROData_Bathymetry.h>
+#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Profile.h>
+#include <HYDROData_Entity.h>
+
+
+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<HYDROGUI_ExportSinusXDlg*>( 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<HYDROGUI_ExportSinusXDlg*>( 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<HYDROGUI_ExportSinusXDlg*>( inputPanel() );
+  if ( !aPanel )
+    return;
+  aPanel->RemoveItems( );
+
+}
diff --git a/src/HYDROGUI/HYDROGUI_ExportSinusXOp.h b/src/HYDROGUI/HYDROGUI_ExportSinusXOp.h
new file mode 100644 (file)
index 0000000..3d1a6bf
--- /dev/null
@@ -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
index e5b411ec62be3d522d399daa9dc3cc7b52ed3b57..aad39a09737a508645f83936fd16f4f79c8552a9 100644 (file)
@@ -63,6 +63,7 @@
 #include "HYDROGUI_StricklerTableOp.h"
 #include "HYDROGUI_DuplicateOp.h"
 #include "HYDROGUI_LandCoverOp.h"
+#include "HYDROGUI_ExportSinusXOp.h"
 
 #include <HYDROData_Document.h>
 #include <HYDROData_Obstacle.h>
@@ -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;
index b22ca76e93df79f895b19c9b56a72746d0b4e045..9f54fe36bdaca24a529cc3be706055fc6841d433 100644 (file)
@@ -111,6 +111,8 @@ enum OperationId
   SubmersibleId,
   ImportPolylineId,
   ImportSinusXId,
+  ExportSinusXId,
+
     
   ExportPolylineId,
 
index f251d775d75e1a873ee8b218526fa4f3479de596..adf6d86c558d695752cd3683c619dc5f480004af 100644 (file)
@@ -910,6 +910,10 @@ Would you like to remove all references from the image?</translation>
       <source>DSK_IMPORT_SINUSX</source>
       <translation>Import from SinusX</translation>
     </message>
+    <message>
+      <source>DSK_EXPORT_SINUSX</source>
+      <translation>Export to SinusX</translation>
+    </message>
     <message>
       <source>DSK_LOAD_VISUAL_STATE</source>
       <translation>Load visual state</translation>
@@ -1202,6 +1206,10 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_IMPORT_SINUSX</source>
       <translation>Import from SinusX</translation>
     </message>
+    <message>
+      <source>MEN_EXPORT_SINUSX</source>
+      <translation>Export to SinusX</translation>
+    </message>
     <message>
       <source>MEN_LOAD_VISUAL_STATE</source>
       <translation>Load visual state</translation>
@@ -1471,6 +1479,10 @@ Would you like to remove all references from the image?</translation>
       <source>STB_IMPORT_SINUSX</source>
       <translation>Import from SinusX</translation>
     </message>
+    <message>
+      <source>STB_EXPORT_SINUSX</source>
+      <translation>Export to SinusX</translation>
+    </message>
     <message>
       <source>STB_LOAD_VISUAL_STATE</source>
       <translation>Load visual state</translation>
@@ -2134,6 +2146,22 @@ file cannot be correctly imported for an Obstacle definition.</translation>
     </message>
   </context>
 
+  <context>
+    <name>HYDROGUI_ExportSinusXOp</name>
+    <message>
+      <source>EXPORT_SINUSX</source>
+      <translation>Export to SinusX</translation>
+    </message>
+    <message>
+      <source>SINUSX_FILTER</source>
+      <translation>SinusX Files (*.sx)</translation>
+    </message>
+    <message>
+      <source>NO_ONE_ENTITY_EXPORTED</source>
+      <translation>Entities cant be write</translation>
+    </message>
+  </context>
+
    
   <context>
     <name>HYDROGUI_GeoreferencementDlg</name>