From c46fa6f178bf824f147f41ca3bc8bc98b8def0ef Mon Sep 17 00:00:00 2001 From: asl Date: Thu, 18 Jun 2015 09:03:43 +0300 Subject: [PATCH] refs #585: draft version of GUI for polylines operations --- src/HYDROGUI/CMakeLists.txt | 10 ++ src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx | 55 ++++++++ src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h | 43 +++++++ src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx | 60 +++++++++ src/HYDROGUI/HYDROGUI_MergePolylinesOp.h | 41 ++++++ src/HYDROGUI/HYDROGUI_ObjListBox.cxx | 133 ++++++++++++++++++++ src/HYDROGUI/HYDROGUI_ObjListBox.h | 64 ++++++++++ src/HYDROGUI/HYDROGUI_Operations.cxx | 10 ++ src/HYDROGUI/HYDROGUI_Operations.h | 5 +- src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx | 37 ++++++ src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.h | 33 +++++ src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx | 60 +++++++++ src/HYDROGUI/HYDROGUI_SplitPolylinesOp.h | 41 ++++++ 13 files changed, 591 insertions(+), 1 deletion(-) create mode 100644 src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx create mode 100644 src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h create mode 100644 src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_MergePolylinesOp.h create mode 100644 src/HYDROGUI/HYDROGUI_ObjListBox.cxx create mode 100644 src/HYDROGUI/HYDROGUI_ObjListBox.h create mode 100644 src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx create mode 100644 src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.h create mode 100644 src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_SplitPolylinesOp.h diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 5a463d1c..091f8ca3 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -40,6 +40,8 @@ set(PROJECT_HEADERS HYDROGUI_InputPanel.h HYDROGUI_LocalCSDlg.h HYDROGUI_LocalCSOp.h + HYDROGUI_MergePolylinesDlg.h + HYDROGUI_MergePolylinesOp.h HYDROGUI_Module.h HYDROGUI_NameValidator.h HYDROGUI_ObjSelector.h @@ -72,6 +74,8 @@ set(PROJECT_HEADERS HYDROGUI_ShapeBathymetry.h HYDROGUI_ShapeImage.h HYDROGUI_ShowHideOp.h + HYDROGUI_SplitPolylinesDlg.h + HYDROGUI_SplitPolylinesOp.h HYDROGUI_StreamDlg.h HYDROGUI_StreamOp.h HYDROGUI_LineEditDoubleValidator.h @@ -120,6 +124,7 @@ set(PROJECT_HEADERS HYDROGUI_RiverBottomOp.h HYDROGUI_ViewerDlg.h HYDROGUI_ObjComboBox.h + HYDROGUI_ObjListBox.h HYDROGUI_RecognizeContoursDlg.h HYDROGUI_RecognizeContoursOp.h ) @@ -164,6 +169,8 @@ set(PROJECT_SOURCES HYDROGUI_InputPanel.cxx HYDROGUI_LocalCSDlg.cxx HYDROGUI_LocalCSOp.cxx + HYDROGUI_MergePolylinesDlg.cxx + HYDROGUI_MergePolylinesOp.cxx HYDROGUI_Module.cxx HYDROGUI_NameValidator.cxx HYDROGUI_ObjSelector.cxx @@ -203,6 +210,8 @@ set(PROJECT_SOURCES HYDROGUI_StricklerTableOp.cxx HYDROGUI_LandCoverDlg.cxx HYDROGUI_LandCoverOp.cxx + HYDROGUI_SplitPolylinesDlg.cxx + HYDROGUI_SplitPolylinesOp.cxx HYDROGUI_SubmersibleOp.cxx HYDROGUI_Tool.cxx HYDROGUI_TwoImagesDlg.cxx @@ -245,6 +254,7 @@ set(PROJECT_SOURCES HYDROGUI_RiverBottomOp.cxx HYDROGUI_ViewerDlg.cxx HYDROGUI_ObjComboBox.cxx + HYDROGUI_ObjListBox.cxx HYDROGUI_RecognizeContoursDlg.cxx HYDROGUI_RecognizeContoursOp.cxx ) diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx new file mode 100644 index 00000000..39bbcc1a --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.cxx @@ -0,0 +1,55 @@ +// 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 + +HYDROGUI_MergePolylinesDlg::HYDROGUI_MergePolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle ) +: HYDROGUI_InputPanel( theModule, theTitle ) +{ + QFrame* aFrame = new QFrame( mainFrame() ); + addWidget( aFrame, 1 ); + + QGridLayout* aLayout = new QGridLayout( aFrame ); + aLayout->setMargin( 5 ); + aLayout->setSpacing( 5 ); + + myList = new HYDROGUI_ObjListBox( theModule, tr( "POLYLINES" ), KIND_POLYLINEXY, mainFrame() ); + aLayout->addWidget( myList, 0, 0 ); +} + +HYDROGUI_MergePolylinesDlg::~HYDROGUI_MergePolylinesDlg() +{ +} + +HYDROData_SequenceOfObjects HYDROGUI_MergePolylinesDlg::selectedPolylines() const +{ + return myList->selectedObjects(); +} + +void HYDROGUI_MergePolylinesDlg::setSelectedPolylines( const HYDROData_SequenceOfObjects& theObjects ) +{ + return myList->setSelectedObjects( theObjects ); +} + +void HYDROGUI_MergePolylinesDlg::setPolylinesFromSelection() +{ + return myList->setObjectsFromSelection(); +} diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.h new file mode 100644 index 00000000..874f0225 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesDlg.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_MergePolylinesDlg_H +#define HYDROGUI_MergePolylinesDlg_H + +#include +#include + +class HYDROGUI_ObjListBox; + +class HYDROGUI_MergePolylinesDlg : public HYDROGUI_InputPanel +{ + Q_OBJECT + +public: + HYDROGUI_MergePolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle ); + virtual ~HYDROGUI_MergePolylinesDlg(); + + HYDROData_SequenceOfObjects selectedPolylines() const; + void setSelectedPolylines( const HYDROData_SequenceOfObjects& ); + void setPolylinesFromSelection(); + +private: + HYDROGUI_ObjListBox* myList; +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx b/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx new file mode 100644 index 00000000..dd1c271f --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesOp.cxx @@ -0,0 +1,60 @@ +// 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 + +HYDROGUI_MergePolylinesOp::HYDROGUI_MergePolylinesOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ) +{ + setName( tr( "MERGE_POLYLINES" ) ); +} + +HYDROGUI_MergePolylinesOp::~HYDROGUI_MergePolylinesOp() +{ +} + +void HYDROGUI_MergePolylinesOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + //TODO +} + +HYDROGUI_InputPanel* HYDROGUI_MergePolylinesOp::createInputPanel() const +{ + return new HYDROGUI_MergePolylinesDlg( module(), getName() ); +} + +bool HYDROGUI_MergePolylinesOp::processApply( int& theUpdateFlags, + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) +{ + /* TODO: + HYDROGUI_LocalCSDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return false; + + double aLX = aPanel->GetLocalX(); + double aLY = aPanel->GetLocalY(); + doc()->SetLocalCS( aLX, aLY ); + + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; + */ + return true; +} diff --git a/src/HYDROGUI/HYDROGUI_MergePolylinesOp.h b/src/HYDROGUI/HYDROGUI_MergePolylinesOp.h new file mode 100644 index 00000000..b9348839 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_MergePolylinesOp.h @@ -0,0 +1,41 @@ +// 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_MergePolylinesOp_H +#define HYDROGUI_MergePolylinesOp_H + +#include "HYDROGUI_Operation.h" + +class HYDROGUI_MergePolylinesOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_MergePolylinesOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_MergePolylinesOp(); + +protected: + virtual void startOperation(); + + virtual HYDROGUI_InputPanel* createInputPanel() const; + + virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ); +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_ObjListBox.cxx b/src/HYDROGUI/HYDROGUI_ObjListBox.cxx new file mode 100644 index 00000000..513e08a4 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ObjListBox.cxx @@ -0,0 +1,133 @@ +// 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 + +HYDROGUI_ObjListBox::HYDROGUI_ObjListBox( HYDROGUI_Module* theModule, const QString& theTitle, const ObjectKind& theType, QWidget* theParent ) +: QWidget( theParent ), + myType( theType ), + myModule( theModule ), + myFilter( 0 ) +{ + QGridLayout* aBase = new QGridLayout( this ); + aBase->setMargin( 0 ); + + QPushButton* anInclude = new QPushButton( tr( "INCLUDE" ), this ); + QPushButton* anExclude = new QPushButton( tr( "EXCLUDE" ), this ); + + aBase->addWidget( anInclude, 0, 0 ); + aBase->addWidget( anExclude, 0, 1 ); + if( !theTitle.isEmpty() ) + aBase->addWidget( new QLabel( theTitle, this ), 1, 0 ); + aBase->addWidget( myList = new QListWidget( this ), 1, 1, 1, 2 ); + aBase->setColumnStretch( 0, 0 ); + aBase->setColumnStretch( 1, 0 ); + aBase->setColumnStretch( 2, 1 ); + + myList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); + myList->setSelectionMode( QListWidget::ExtendedSelection ); + + connect( anInclude, SIGNAL( clicked() ), this, SLOT( OnInclude() ) ); + connect( anExclude, SIGNAL( clicked() ), this, SLOT( OnExclude() ) ); +} + +HYDROGUI_ObjListBox::~HYDROGUI_ObjListBox() +{ +} + +HYDROGUI_Module* HYDROGUI_ObjListBox::module() const +{ + return myModule; +} + +ObjectKind HYDROGUI_ObjListBox::objectType() const +{ + return myType; +} + +HYDROGUI_ObjComboBoxFilter* HYDROGUI_ObjListBox::objectFilter() const +{ + return myFilter; +} + +void HYDROGUI_ObjListBox::setObjectFilter( HYDROGUI_ObjComboBoxFilter* filter ) +{ + myFilter = filter; +} + +void HYDROGUI_ObjListBox::reset() +{ + myList->clear(); + mySelection.Clear(); +} + +void HYDROGUI_ObjListBox::setSelectedObjects( const HYDROData_SequenceOfObjects& theObjects ) +{ + reset(); + Append( theObjects ); +} + +void HYDROGUI_ObjListBox::setObjectsFromSelection() +{ + setSelectedObjects( HYDROGUI_Tool::GetSelectedObjects( module() ) ); +} + +HYDROData_SequenceOfObjects HYDROGUI_ObjListBox::selectedObjects() const +{ + return mySelection; +} + +void HYDROGUI_ObjListBox::OnInclude() +{ + Append( HYDROGUI_Tool::GetSelectedObjects( module() ) ); +} + +void HYDROGUI_ObjListBox::OnExclude() +{ + QList aSelection = myList->selectedItems(); + foreach( QListWidgetItem* anItem, aSelection ) + { + int anIndex = myList->row( anItem ); + myList->takeItem( anIndex ); + mySelection.Remove( anIndex, anIndex ); + } +} + +void HYDROGUI_ObjListBox::Append( const HYDROData_SequenceOfObjects& theObjects ) +{ + for( int i=theObjects.Lower(), n=theObjects.Upper(); i<=n; i++ ) + { + Handle( HYDROData_Entity ) anObject = theObjects.Value( i ); + bool isOK = !anObject.IsNull() && anObject->GetKind()==myType; + if( myFilter && isOK ) + isOK = myFilter->isOk( anObject ); + + if( isOK ) + { + QString aName = anObject->GetName(); + myList->addItem( aName ); + mySelection.Append( anObject ); + } + } +} diff --git a/src/HYDROGUI/HYDROGUI_ObjListBox.h b/src/HYDROGUI/HYDROGUI_ObjListBox.h new file mode 100644 index 00000000..a31cf26d --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ObjListBox.h @@ -0,0 +1,64 @@ +// 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_OBJLISTBOX_H +#define HYDROGUI_OBJLISTBOX_H + +#include +#include + +class HYDROGUI_Module; +class HYDROGUI_ObjComboBoxFilter; +class QListWidget; + +class HYDROGUI_ObjListBox : public QWidget +{ + Q_OBJECT + +public: + HYDROGUI_ObjListBox( HYDROGUI_Module* theModule, const QString& theTitle, + const ObjectKind& = KIND_UNKNOWN, QWidget* = 0 ); + virtual ~HYDROGUI_ObjListBox(); + + HYDROGUI_Module* module() const; + ObjectKind objectType() const; + + HYDROGUI_ObjComboBoxFilter* objectFilter() const; + void setObjectFilter( HYDROGUI_ObjComboBoxFilter* ); + + HYDROData_SequenceOfObjects selectedObjects() const; + void setSelectedObjects( const HYDROData_SequenceOfObjects& ); + void setObjectsFromSelection(); + void reset(); + +private slots: + void OnInclude(); + void OnExclude(); + +private: + void Append( const HYDROData_SequenceOfObjects& ); + +private: + ObjectKind myType; + QListWidget* myList; + HYDROGUI_Module* myModule; + HYDROGUI_ObjComboBoxFilter* myFilter; + HYDROData_SequenceOfObjects mySelection; +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index 3ebae572..b3bebbf0 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -62,6 +62,8 @@ #include "HYDROGUI_StricklerTableOp.h" #include "HYDROGUI_DuplicateOp.h" #include "HYDROGUI_LandCoverOp.h" +#include "HYDROGUI_MergePolylinesOp.h" +#include "HYDROGUI_SplitPolylinesOp.h" #include #include @@ -257,6 +259,8 @@ void HYDROGUI_Module::createMenus() createMenu( CutImagesId, aHydroId, -1, -1 ); createMenu( SplitImageId, aHydroId, -1, -1 ); createMenu( separator(), aHydroId ); + createMenu( SplitPolylinesId, aHydroId, -1, -1 ); + createMenu( MergePolylinesId, aHydroId, -1, -1 ); } void HYDROGUI_Module::createPopups() @@ -579,6 +583,12 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case SubmersibleId: anOp = new HYDROGUI_SubmersibleOp( aModule ); break; + case SplitPolylinesId: + anOp = new HYDROGUI_SplitPolylinesOp( aModule ); + break; + case MergePolylinesId: + anOp = new HYDROGUI_MergePolylinesOp( aModule ); + break; } if( !anOp ) diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index 2669cae2..cb90dd25 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -118,7 +118,10 @@ enum OperationId DuplicateStricklerTableId, CreateLandCoverId, - EditLandCoverId + EditLandCoverId, + + SplitPolylinesId, + MergePolylinesId, }; #endif diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx b/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx new file mode 100644 index 00000000..47b52138 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx @@ -0,0 +1,37 @@ +// 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 + +HYDROGUI_SplitPolylinesDlg::HYDROGUI_SplitPolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle ) +: HYDROGUI_InputPanel( theModule, theTitle ) +{ + QFrame* aFrame = new QFrame( mainFrame() ); + addWidget( aFrame, 1 ); + + QGridLayout* aLayout = new QGridLayout( aFrame ); + aLayout->setMargin( 5 ); + aLayout->setSpacing( 5 ); +} + +HYDROGUI_SplitPolylinesDlg::~HYDROGUI_SplitPolylinesDlg() +{ +} + diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.h b/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.h new file mode 100644 index 00000000..3dca4fba --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.h @@ -0,0 +1,33 @@ +// 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_SplitPolylinesDlg_H +#define HYDROGUI_SplitPolylinesDlg_H + +#include "HYDROGUI_InputPanel.h" + +class HYDROGUI_SplitPolylinesDlg : public HYDROGUI_InputPanel +{ + Q_OBJECT + +public: + HYDROGUI_SplitPolylinesDlg( HYDROGUI_Module* theModule, const QString& theTitle ); + virtual ~HYDROGUI_SplitPolylinesDlg(); +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx new file mode 100644 index 00000000..233e79a3 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx @@ -0,0 +1,60 @@ +// 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 + +HYDROGUI_SplitPolylinesOp::HYDROGUI_SplitPolylinesOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ) +{ + setName( tr( "SPLIT_POLYLINES" ) ); +} + +HYDROGUI_SplitPolylinesOp::~HYDROGUI_SplitPolylinesOp() +{ +} + +void HYDROGUI_SplitPolylinesOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + //TODO +} + +HYDROGUI_InputPanel* HYDROGUI_SplitPolylinesOp::createInputPanel() const +{ + return new HYDROGUI_SplitPolylinesDlg( module(), getName() ); +} + +bool HYDROGUI_SplitPolylinesOp::processApply( int& theUpdateFlags, + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) +{ + /*TODO: + HYDROGUI_LocalCSDlg* aPanel = ::qobject_cast( inputPanel() ); + if ( !aPanel ) + return false; + + double aLX = aPanel->GetLocalX(); + double aLY = aPanel->GetLocalY(); + doc()->SetLocalCS( aLX, aLY ); + + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; + */ + return true; +} diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.h b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.h new file mode 100644 index 00000000..e2454a54 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.h @@ -0,0 +1,41 @@ +// 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_SplitPolylinesOp_H +#define HYDROGUI_SplitPolylinesOp_H + +#include "HYDROGUI_Operation.h" + +class HYDROGUI_SplitPolylinesOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_SplitPolylinesOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_SplitPolylinesOp(); + +protected: + virtual void startOperation(); + + virtual HYDROGUI_InputPanel* createInputPanel() const; + + virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ); +}; + +#endif -- 2.39.2