From e31b7d2c433d4e27a4023d9a43b34cfc6f147aaf Mon Sep 17 00:00:00 2001 From: mtn Date: Thu, 8 Aug 2013 11:23:24 +0000 Subject: [PATCH] Create polyline operation was added --- src/HYDROGUI/CMakeLists.txt | 8 +++- src/HYDROGUI/HYDROGUI_DataModel.cxx | 11 ++++++ src/HYDROGUI/HYDROGUI_Operations.cxx | 7 ++++ src/HYDROGUI/HYDROGUI_Operations.h | 1 + src/HYDROGUI/HYDROGUI_PolylineDlg.cxx | 44 +++++++++++++++++++++ src/HYDROGUI/HYDROGUI_PolylineDlg.h | 44 +++++++++++++++++++++ src/HYDROGUI/HYDROGUI_PolylineOp.cxx | 47 +++++++++++++++++++++++ src/HYDROGUI/HYDROGUI_PolylineOp.h | 43 +++++++++++++++++++++ src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 12 ++++++ src/HYDROGUI/resources/LightApp.xml | 1 + 10 files changed, 217 insertions(+), 1 deletion(-) create mode 100755 src/HYDROGUI/HYDROGUI_PolylineDlg.cxx create mode 100755 src/HYDROGUI/HYDROGUI_PolylineDlg.h create mode 100755 src/HYDROGUI/HYDROGUI_PolylineOp.cxx create mode 100755 src/HYDROGUI/HYDROGUI_PolylineOp.h diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 26983785..f5cc14cf 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -10,6 +10,8 @@ set(PROJECT_HEADERS HYDROGUI_GVSelector.h HYDROGUI_ImportImageDlg.h HYDROGUI_ImportImageOp.h + HYDROGUI_PolylineOp.h + HYDROGUI_PolylineDlg.h HYDROGUI_InputPanel.h HYDROGUI_Module.h HYDROGUI_ObjSelector.h @@ -36,6 +38,8 @@ set(PROJECT_SOURCES HYDROGUI_GVSelector.cxx HYDROGUI_ImportImageDlg.cxx HYDROGUI_ImportImageOp.cxx + HYDROGUI_PolylineDlg.cxx + HYDROGUI_PolylineOp.cxx HYDROGUI_InputPanel.cxx HYDROGUI_Module.cxx HYDROGUI_ObjSelector.cxx @@ -56,19 +60,21 @@ add_definitions( ${CAS_DEFINITIONS} ${QT_DEFINITIONS} $(GUI_CXXFLAGS) + $(GEOM_CXXFLAGS) ) include_directories( ${CAS_INCLUDE_DIRS} ${QT_INCLUDES} ${GUI_ROOT_DIR}/include/salome + ${GEOM_ROOT_DIR}/include/salome ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROData ${CMAKE_CURRENT_SOURCE_DIR}/../HYDROOperations ) add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC}) -target_link_libraries(HYDROGUI ${CAS_OCAF} HYDROData HYDROOperations) +target_link_libraries(HYDROGUI ${CAS_OCAF} HYDROData HYDROOperations -L${GEOM_ROOT_DIR}/lib/salome/ -lCurveCreator) set(PROJECT_LIBRARIES HYDROGUI) diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 60952405..4108df40 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -195,6 +195,17 @@ void HYDROGUI_DataModel::update( const int theStudyId ) createObject( anImageRootObj, anImageObj ); } + LightApp_DataObject* aPolylineRootObj = createObject( aRootObj, "POLYLINES" ); + + HYDROData_Iterator aPolyIterator( aDocument, KIND_IMAGE ); + for( ; aPolyIterator.More(); aPolyIterator.Next() ) + { + Handle(HYDROData_Image) aPolylineObj = + Handle(HYDROData_Image)::DownCast( anIterator.Current() ); + if( !aPolylineObj.IsNull() ) + createObject( aPolylineRootObj, aPolylineObj ); + } + if( SUIT_DataBrowser* anObjectBrowser = anApp->objectBrowser() ) { anObjectBrowser->setAutoOpenLevel( 3 ); diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index b0714ecc..76724404 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -28,6 +28,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_ShowHideOp.h" #include "HYDROGUI_TwoImagesOp.h" +#include "HYDROGUI_PolylineOp.h" #include "HYDROGUI_UpdateFlags.h" #include @@ -65,6 +66,9 @@ void HYDROGUI_Module::createActions() createAction( FuseId, "FUSE_IMAGES" ); createAction( CutId, "CUT_IMAGES" ); + createAction( PolylineId, "POLYLINE" ); + + createAction( DeleteId, "DELETE", "", Qt::Key_Delete ); createAction( ShowId, "SHOW" ); @@ -85,6 +89,7 @@ void HYDROGUI_Module::createMenus() createMenu( ImportImageId, aHydroId, -1, -1 ); createMenu( FuseId, aHydroId, -1, -1 ); createMenu( CutId, aHydroId, -1, -1 ); + createMenu( PolylineId, aHydroId, -1, -1 ); } void HYDROGUI_Module::createPopups() @@ -216,6 +221,8 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case HideAllId: anOp = new HYDROGUI_ShowHideOp( aModule, theId ); break; + case PolylineId: + anOp = new HYDROGUI_PolylineOp( aModule ); } if( !anOp ) diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index 972bcfb5..632b0261 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -41,6 +41,7 @@ enum OperationId ShowAllId, HideId, HideAllId, + PolylineId, }; #endif diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx new file mode 100755 index 00000000..894bc23a --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx @@ -0,0 +1,44 @@ +// 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_PolylineDlg.h" +#include +#include + + +HYDROGUI_PolylineDlg::HYDROGUI_PolylineDlg( HYDROGUI_Module* theModule, const QString& theTitle ) +: HYDROGUI_InputPanel( theModule, theTitle ) +{ + CurveCreator_Curve *aStaticCurve = NULL; + + aStaticCurve = new CurveCreator_Curve(CurveCreator::Dim3d); + + CurveCreator_Widget *aWidget = + new CurveCreator_Widget( this, aStaticCurve); + + addWidget( aWidget, 0, 0 ); + setRowStretch(); +} + +HYDROGUI_PolylineDlg::~HYDROGUI_PolylineDlg() +{ +} diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.h b/src/HYDROGUI/HYDROGUI_PolylineDlg.h new file mode 100755 index 00000000..54c4ae25 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.h @@ -0,0 +1,44 @@ +// 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_POLYLINEDLG_H +#define HYDROGUI_POLYLINEDLG_H + +#include "HYDROGUI_InputPanel.h" + + +class HYDROGUI_PolylineDlg : public HYDROGUI_InputPanel +{ + Q_OBJECT + +public: + HYDROGUI_PolylineDlg( HYDROGUI_Module* theModule, const QString& theTitle ); + virtual ~HYDROGUI_PolylineDlg(); + +protected slots: + +signals: + void createPreview( QString ); + +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx new file mode 100755 index 00000000..cfe2c922 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -0,0 +1,47 @@ +// 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_PolylineOp.h" +#include "HYDROGUI_PolylineDlg.h" + +#include "HYDROGUI_Module.h" + + +HYDROGUI_PolylineOp::HYDROGUI_PolylineOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ) +{ + setName( tr("POLYLINE") ); +} + +HYDROGUI_PolylineOp::~HYDROGUI_PolylineOp() +{ +} + +HYDROGUI_InputPanel* HYDROGUI_PolylineOp::createInputPanel() const +{ + return new HYDROGUI_PolylineDlg( module(), getName() ); +} + +bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags ) +{ + return true; +} diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.h b/src/HYDROGUI/HYDROGUI_PolylineOp.h new file mode 100755 index 00000000..be473d97 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.h @@ -0,0 +1,43 @@ +// 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_POLYLINEOP_H +#define HYDROGUI_POLYLINEOP_H + +#include "HYDROGUI_Operation.h" + +class HYDROGUI_PolylineOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_PolylineOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_PolylineOp(); + +protected: + virtual HYDROGUI_InputPanel* createInputPanel() const; + + virtual bool processApply( int& theUpdateFlags ); + +}; + +#endif diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index b9ee02a2..46403e91 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -124,6 +124,10 @@ DSK_IMPORT_IMAGE Import image + + DSK_POLYLINE + Create polyline + DSK_REDO Redo @@ -176,6 +180,10 @@ MEN_IMPORT_IMAGE Import image + + MEN_POLYLINE + Create polyline + MEN_REDO Redo @@ -220,6 +228,10 @@ STB_IMPORT_IMAGE Import image + + STB_IMPORT_IMAGE + Create polyline + STB_REDO Redo diff --git a/src/HYDROGUI/resources/LightApp.xml b/src/HYDROGUI/resources/LightApp.xml index 5ae92965..1e8658d7 100644 --- a/src/HYDROGUI/resources/LightApp.xml +++ b/src/HYDROGUI/resources/LightApp.xml @@ -38,5 +38,6 @@
+
-- 2.39.2