From: asl Date: Wed, 18 Nov 2015 07:00:48 +0000 (+0300) Subject: tools refactoring on two parts (OCCT/QT and other products dependencies) X-Git-Tag: v1.5~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9b21e2717ce72f6db93c0d49df13a0bd3943962e;p=modules%2Fhydro.git tools refactoring on two parts (OCCT/QT and other products dependencies) --- diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 549402ca..bcb457a4 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -96,6 +96,7 @@ set(PROJECT_HEADERS HYDROGUI_StricklerTypeComboBox.h HYDROGUI_SubmersibleOp.h HYDROGUI_Tool.h + HYDROGUI_Tool2.h HYDROGUI_TwoImagesDlg.h HYDROGUI_TwoImagesOp.h HYDROGUI_UpdateFlags.h @@ -240,6 +241,7 @@ set(PROJECT_SOURCES HYDROGUI_SplitPolylinesOp.cxx HYDROGUI_SubmersibleOp.cxx HYDROGUI_Tool.cxx + HYDROGUI_Tool2.cxx HYDROGUI_TwoImagesDlg.cxx HYDROGUI_TwoImagesOp.cxx HYDROGUI_UpdateObjectOp.cxx diff --git a/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx b/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx index 7ef7aec2..032c9d3f 100644 --- a/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include #include diff --git a/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx b/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx index 9369a4ae..2d2f03b7 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetryBoundsOp.cxx @@ -18,7 +18,7 @@ // #include -#include +#include #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index c1735274..778ac431 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_CalculationDlg.h" #include "HYDROGUI_ObjSelector.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_DataBrowser.h" #include "HYDROGUI_DataModel.h" #include "HYDROGUI_ListSelector.h" diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 01b65432..b85d4c13 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_CalculationDlg.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include "HYDROGUI_Zone.h" #include "HYDROGUI_Region.h" diff --git a/src/HYDROGUI/HYDROGUI_ChannelOp.cxx b/src/HYDROGUI/HYDROGUI_ChannelOp.cxx index f1613b07..99bf0cb7 100644 --- a/src/HYDROGUI/HYDROGUI_ChannelOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ChannelOp.cxx @@ -24,6 +24,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_Shape.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 5f7f4861..7f4db438 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -21,6 +21,7 @@ #include "HYDROGUI_DataObject.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Zone.h" #include "HYDROGUI_Region.h" diff --git a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx index deafdfff..8425cb1d 100644 --- a/src/HYDROGUI/HYDROGUI_DeleteOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DeleteOp.cxx @@ -21,6 +21,7 @@ #include "HYDROGUI_DeleteDlg.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include @@ -84,7 +85,7 @@ void HYDROGUI_DeleteOp::startOperation() // check the back-references QMap aBackObjects = - HYDROGUI_Tool::GetObjectsBackReferences( module(), anObjNames ); + HYDROGUI_Tool::GetObjectsBackReferences( doc(), anObjNames ); QMap::const_iterator anIt = aBackObjects.begin(), aLast = aBackObjects.end(); diff --git a/src/HYDROGUI/HYDROGUI_DigueOp.cxx b/src/HYDROGUI/HYDROGUI_DigueOp.cxx index 30e48c0b..a65db9cd 100644 --- a/src/HYDROGUI/HYDROGUI_DigueOp.cxx +++ b/src/HYDROGUI/HYDROGUI_DigueOp.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_DigueOp.h" #include "HYDROGUI_DigueDlg.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Shape.h" #include diff --git a/src/HYDROGUI/HYDROGUI_Displayer.cxx b/src/HYDROGUI/HYDROGUI_Displayer.cxx index c91247a5..64bbb6e4 100644 --- a/src/HYDROGUI/HYDROGUI_Displayer.cxx +++ b/src/HYDROGUI/HYDROGUI_Displayer.cxx @@ -24,7 +24,7 @@ #include "HYDROGUI_PrsImageDriver.h" #include "HYDROGUI_PrsPolylineDriver.h" #include "HYDROGUI_PrsZoneDriver.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx index c911f1d0..93467ea1 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ExportFileOp.cxx b/src/HYDROGUI/HYDROGUI_ExportFileOp.cxx index 9b17e6a7..e4bb9ee9 100644 --- a/src/HYDROGUI/HYDROGUI_ExportFileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportFileOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_UpdateFlags.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_ExportLandCoverMapDlg.h" #include #include diff --git a/src/HYDROGUI/HYDROGUI_ExportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ExportImageOp.cxx index 33d61ae3..e6e3c72e 100644 --- a/src/HYDROGUI/HYDROGUI_ExportImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportImageOp.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_ExportImageOp.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include diff --git a/src/HYDROGUI/HYDROGUI_GVSelector.cxx b/src/HYDROGUI/HYDROGUI_GVSelector.cxx index d43074e1..11a0e7cc 100644 --- a/src/HYDROGUI/HYDROGUI_GVSelector.cxx +++ b/src/HYDROGUI/HYDROGUI_GVSelector.cxx @@ -22,7 +22,7 @@ #include "HYDROGUI_DataObject.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Prs.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include #include diff --git a/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx b/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx index b20216e9..5180be14 100644 --- a/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_GeomObjectDlg.cxx @@ -18,7 +18,7 @@ #include "HYDROGUI_GeomObjectDlg.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include #include diff --git a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx index eb89f4c4..5713af10 100644 --- a/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx +++ b/src/HYDROGUI/HYDROGUI_GeoreferencementOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_GeoreferencementDlg.h" #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx index 6a3326a9..bf8ff273 100644 --- a/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImmersibleZoneOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_Shape.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include "HYDROGUI_DataObject.h" diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx index fb8e663a..d8b3abbc 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_ImportBathymetryDlg.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx index 70f4da94..02df17e1 100644 --- a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx index d68840a8..15c73fde 100644 --- a/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportImageOp.cxx @@ -23,7 +23,7 @@ #include "HYDROGUI_ImportImageDlg.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_PrsImage.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx index 5f35ec26..02c6d721 100644 --- a/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportLandCoverMapOp.cxx @@ -25,7 +25,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_UpdateFlags.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_ImportLandCoverMapDlg.h" #include "HYDROGUI_Shape.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx index 3ad303ca..5a639978 100644 --- a/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportObstacleFromFileOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index 1bf21c52..7cdbd1ed 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_UpdateFlags.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx index 6b3f9eb0..d5c37eb5 100644 --- a/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_UpdateFlags.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx index 2edb9481..2b17f3e8 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_Operations.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx b/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx index 213256f6..5db4f16b 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx @@ -22,7 +22,7 @@ #include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_Operations.h" #include "HYDROGUI_LandCoverMapDlg.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include "HYDROGUI_DataObject.h" #include "HYDROGUI_ShapeLandCoverMap.h" diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 1dec04cd..e46d12a9 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -30,6 +30,7 @@ #include "HYDROGUI_Operations.h" #include "HYDROGUI_PrsImage.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include "HYDROGUI_Shape.h" #include "HYDROGUI_VTKPrs.h" diff --git a/src/HYDROGUI/HYDROGUI_NameValidator.cxx b/src/HYDROGUI/HYDROGUI_NameValidator.cxx index 006710c0..64d45f2f 100644 --- a/src/HYDROGUI/HYDROGUI_NameValidator.cxx +++ b/src/HYDROGUI/HYDROGUI_NameValidator.cxx @@ -17,7 +17,7 @@ // #include "HYDROGUI_NameValidator.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Module.h" HYDROGUI_NameValidator::HYDROGUI_NameValidator( HYDROGUI_Module* theModule, QObject* parent ) diff --git a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx index acbfad37..5e75369f 100644 --- a/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include #include #include @@ -29,6 +29,7 @@ #include "HYDROGUI_ZLayers.h" #include +#include #include #include diff --git a/src/HYDROGUI/HYDROGUI_ObjComboBox.cxx b/src/HYDROGUI/HYDROGUI_ObjComboBox.cxx index 9b2dfc7a..8d2ef26e 100644 --- a/src/HYDROGUI/HYDROGUI_ObjComboBox.cxx +++ b/src/HYDROGUI/HYDROGUI_ObjComboBox.cxx @@ -18,7 +18,7 @@ #include "HYDROGUI_ObjComboBox.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Module.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ObjListBox.cxx b/src/HYDROGUI/HYDROGUI_ObjListBox.cxx index 8547e8fa..38ffb4c1 100644 --- a/src/HYDROGUI/HYDROGUI_ObjListBox.cxx +++ b/src/HYDROGUI/HYDROGUI_ObjListBox.cxx @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_ObjSelector.cxx b/src/HYDROGUI/HYDROGUI_ObjSelector.cxx index 22e672da..9f77261a 100644 --- a/src/HYDROGUI/HYDROGUI_ObjSelector.cxx +++ b/src/HYDROGUI/HYDROGUI_ObjSelector.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ObserveImageOp.cxx b/src/HYDROGUI/HYDROGUI_ObserveImageOp.cxx index af363c98..e1a70d13 100644 --- a/src/HYDROGUI/HYDROGUI_ObserveImageOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ObserveImageOp.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_PrsImage.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index aa689a83..04aa55f7 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -53,7 +53,7 @@ #include "HYDROGUI_GeoreferencementOp.h" #include "HYDROGUI_SetColorOp.h" #include "HYDROGUI_BathymetryBoundsOp.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_ZLevelsOp.h" #include "HYDROGUI_LocalCSOp.h" #include "HYDROGUI_RiverBottomOp.h" diff --git a/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx b/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx index 9c22b419..3c505853 100644 --- a/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx +++ b/src/HYDROGUI/HYDROGUI_Poly3DOp.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_Module.h" #include -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Poly3DDlg.h" #include "HYDROGUI_UpdateFlags.h" diff --git a/src/HYDROGUI/HYDROGUI_PolylineExtractionOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineExtractionOp.cxx index 591ae2de..76519f49 100644 --- a/src/HYDROGUI/HYDROGUI_PolylineExtractionOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineExtractionOp.cxx @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index 486b182e..9666cf7a 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -22,6 +22,7 @@ #include "HYDROGUI_DataObject.h" #include "HYDROGUI_PolylineDlg.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx b/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx index add3b8bb..70b3a7e2 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileInterpolateDlg.cxx @@ -18,7 +18,7 @@ #include "HYDROGUI_ProfileInterpolateDlg.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_ObjComboBox.h" #include "HYDROGUI_OCCSelector.h" diff --git a/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx index 3bfb2292..3ea3a5ea 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileInterpolateOp.cxx @@ -19,6 +19,7 @@ #include #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_DataObject.h" #include "HYDROGUI_UpdateFlags.h" diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index c4c822df..11a60f85 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx b/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx index c4961c39..834d344b 100644 --- a/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx +++ b/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_RecognizeContoursDlg.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Shape.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include "HYDROGUI_OCCSelector.h" #include "HYDROGUI_ZLayers.h" diff --git a/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx b/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx index b5e4bd88..0cf83987 100644 --- a/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx +++ b/src/HYDROGUI/HYDROGUI_RemoveImageRefsOp.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_RemoveImageRefsOp.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx b/src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx index aeaadfb5..8311fd7b 100644 --- a/src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx +++ b/src/HYDROGUI/HYDROGUI_RiverBottomOp.cxx @@ -24,7 +24,7 @@ #include "HYDROGUI_DataObject.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Shape.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_SetColorOp.cxx b/src/HYDROGUI/HYDROGUI_SetColorOp.cxx index 840d2194..73263527 100644 --- a/src/HYDROGUI/HYDROGUI_SetColorOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SetColorOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_ColorDlg.h" #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_SetTransparencyOp.cxx b/src/HYDROGUI/HYDROGUI_SetTransparencyOp.cxx index 85d9d68f..d3402089 100644 --- a/src/HYDROGUI/HYDROGUI_SetTransparencyOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SetTransparencyOp.cxx @@ -20,7 +20,7 @@ #include "HYDROGUI_TransparencyDlg.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx index c3185734..b5f3c595 100644 --- a/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ShowHideOp.cxx @@ -23,7 +23,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_Operations.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx b/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx index eec48af7..a6ce1887 100644 --- a/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesDlg.cxx @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/HYDROGUI/HYDROGUI_StreamDlg.cxx b/src/HYDROGUI/HYDROGUI_StreamDlg.cxx index 95f0750b..591e175e 100644 --- a/src/HYDROGUI/HYDROGUI_StreamDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_StreamDlg.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_ListSelector.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_OrderedListWidget.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include diff --git a/src/HYDROGUI/HYDROGUI_StreamOp.cxx b/src/HYDROGUI/HYDROGUI_StreamOp.cxx index a2072046..ca1f6e5d 100755 --- a/src/HYDROGUI/HYDROGUI_StreamOp.cxx +++ b/src/HYDROGUI/HYDROGUI_StreamOp.cxx @@ -23,6 +23,7 @@ #include "HYDROGUI_Shape.h" #include "HYDROGUI_StreamDlg.h" #include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_StricklerTableOp.cxx b/src/HYDROGUI/HYDROGUI_StricklerTableOp.cxx index 2433bca6..d47540a2 100644 --- a/src/HYDROGUI/HYDROGUI_StricklerTableOp.cxx +++ b/src/HYDROGUI/HYDROGUI_StricklerTableOp.cxx @@ -23,7 +23,7 @@ #include "HYDROGUI_Module.h" #include "HYDROGUI_OCCDisplayer.h" #include "HYDROGUI_Operations.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx b/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx index 630bf678..47ca42f6 100644 --- a/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SubmersibleOp.cxx @@ -17,7 +17,7 @@ // #include -#include +#include #include HYDROGUI_SubmersibleOp::HYDROGUI_SubmersibleOp( HYDROGUI_Module* theModule ) diff --git a/src/HYDROGUI/HYDROGUI_Tool2.cxx b/src/HYDROGUI/HYDROGUI_Tool2.cxx new file mode 100644 index 00000000..edcfd868 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_Tool2.cxx @@ -0,0 +1,498 @@ +// 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int HYDROGUI_Tool::GetActiveStudyId() +{ + if( SUIT_Session* aSession = SUIT_Session::session() ) + if( SUIT_Application* anApp = aSession->activeApplication() ) + if( SUIT_Study* aStudy = anApp->activeStudy() ) + return aStudy->id(); + return 0; +} + + + +void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule, + SUIT_ViewManager* theViewManager ) +{ + if( theViewManager ) + if( SUIT_ViewWindow* aViewWindow = theViewManager->getActiveView() ) + if( STD_TabDesktop* aTabDesktop = dynamic_cast( theModule->getApp()->desktop() ) ) + if( QtxWorkstack* aWorkstack = aTabDesktop->workstack() ) + aWorkstack->setActiveWindow( aViewWindow ); +} + + +bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& theObject, + const QString& theViewerType ) +{ + if ( theObject.IsNull() ) + return false; + + ObjectKind anObjectKind = theObject->GetKind(); + if ( theViewerType.isEmpty() || theViewerType == OCCViewer_Viewer::Type() ) + { + if ( anObjectKind == KIND_IMAGE || + anObjectKind == KIND_POLYLINEXY || + anObjectKind == KIND_POLYLINE || + anObjectKind == KIND_IMMERSIBLE_ZONE || + anObjectKind == KIND_REGION || + anObjectKind == KIND_ZONE || + anObjectKind == KIND_OBSTACLE || + anObjectKind == KIND_PROFILE || + anObjectKind == KIND_STREAM || + anObjectKind == KIND_CHANNEL || + anObjectKind == KIND_DIGUE || + anObjectKind == KIND_DUMMY_3D || + anObjectKind == KIND_BATHYMETRY || + anObjectKind == KIND_LAND_COVER_MAP +#ifdef DEB_GROUPS + || anObjectKind == KIND_SHAPES_GROUP || + anObjectKind == KIND_SPLITTED_GROUP +#endif + ) + { + return true; + } + } + + if ( theViewerType.isEmpty() || theViewerType == SVTK_Viewer::Type() ) + { + if ( anObjectKind == KIND_BATHYMETRY ) + return true; + } + + if ( theViewerType.isEmpty() || theViewerType == GraphicsView_Viewer::Type() ) + { + if ( anObjectKind == KIND_IMAGE || + anObjectKind == KIND_POLYLINEXY ) + return true; + } + + return false; +} + +void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule, + HYDROData_SequenceOfObjects& theSeq ) +{ + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); + if( !aDocument.IsNull() ) + { + HYDROData_Iterator anIterator( aDocument ); + for( ; anIterator.More(); anIterator.Next() ) + { + Handle(HYDROData_Entity) anObject = anIterator.Current(); + if ( !IsObjectHasPresentation( anObject ) ) + continue; + + theSeq.Append( anObject ); + } + } +} + +HYDROGUI_Prs* HYDROGUI_Tool::GetPresentation( const Handle(HYDROData_Entity)& theObj, + const GraphicsView_ObjectList& theObjects ) +{ + if( !theObj.IsNull() ) + { + GraphicsView_ObjectListIterator anIter( theObjects ); + while( anIter.hasNext() ) + { + if( HYDROGUI_Prs* aPrs = dynamic_cast( anIter.next() ) ) + { + Handle(HYDROData_Entity) anObj = aPrs->getObject(); + if( IsEqual( anObj, theObj ) ) + return aPrs; + } + } + } + return NULL; +} + +GraphicsView_ObjectList HYDROGUI_Tool::GetPrsList( GraphicsView_ViewPort* theViewPort ) +{ + GraphicsView_ObjectList aList; + if( theViewPort ) + { + GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() ); + while( anIter.hasNext() ) + if( HYDROGUI_Prs* aPrs = dynamic_cast( anIter.next() ) ) + aList.append( aPrs ); + } + return aList; +} + + + +HYDROData_SequenceOfObjects HYDROGUI_Tool::GetSelectedObjects( HYDROGUI_Module* theModule ) +{ + HYDROData_SequenceOfObjects aSeq; + + HYDROGUI_DataModel* aModel = theModule->getDataModel(); + + SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr(); + SUIT_DataOwnerPtrList anOwners; + aSelectionMgr->selected( anOwners ); + + QStringList aCollectedNameList; // to avoid duplication + foreach( SUIT_DataOwner* aSUITOwner, anOwners ) + { + if( LightApp_DataOwner* anOwner = dynamic_cast( aSUITOwner ) ) + { + Handle(HYDROData_Entity) anObject = aModel->objectByEntry( anOwner->entry() ); + if( !anObject.IsNull() ) + { + QString aName = anObject->GetName(); + if( !aCollectedNameList.contains( aName ) ) + { + aSeq.Append( anObject ); + aCollectedNameList.append( aName ); + } + } + } + } + return aSeq; +} + +Handle(HYDROData_Entity) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theModule ) +{ + HYDROData_SequenceOfObjects aSeq = GetSelectedObjects( theModule ); + if( !aSeq.IsEmpty() ) + return aSeq.First(); + return NULL; +} + +HYDROData_SequenceOfObjects HYDROGUI_Tool::GetGeometryObjects( HYDROGUI_Module* theModule ) +{ + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); + + HYDROData_SequenceOfObjects aResSeq; + + HYDROData_Iterator anIter( aDocument ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Entity) anObj = anIter.Current(); + if ( !HYDROData_Tool::IsGeometryObject( anObj ) ) + continue; + + aResSeq.Append( anObj ); + } + + return aResSeq; +} + +ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule ) +{ + HYDROGUI_DataModel* aModel = theModule->getDataModel(); + + SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr(); + SUIT_DataOwnerPtrList anOwners; + aSelectionMgr->selected( anOwners ); + + if( anOwners.size() != 1 ) + return KIND_UNKNOWN; + + if( LightApp_DataOwner* anOwner = dynamic_cast( anOwners.first().operator->() ) ) + { + QString anEntry = anOwner->entry(); + QString aPrefix = HYDROGUI_DataObject::entryPrefix(); + if( anEntry.left( aPrefix.length() ) == aPrefix ) + { + anEntry.remove( aPrefix ); + for( ObjectKind anObjectKind = KIND_UNKNOWN + 1; anObjectKind <= KIND_LAST; anObjectKind++ ) + if( HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( anObjectKind ).toAscii() ) == anEntry ) + return anObjectKind; + } + } + return KIND_UNKNOWN; +} + + + + +QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule, + QList theTypes ) +{ + QStringList anEntryList; + + // Get active SalomeApp_Study + SalomeApp_Study* aStudy = NULL; + if ( theModule && theModule->getApp() ) { + aStudy = dynamic_cast( theModule->getApp()->activeStudy() ); + } + if ( !aStudy ) { + return anEntryList; + } + + // Get selection + SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr(); + SUIT_DataOwnerPtrList anOwners; + aSelectionMgr->selected( anOwners ); + + // Check if the selected objects belong to GEOM and have a shape + foreach( SUIT_DataOwner* aSUITOwner, anOwners ) + { + if( LightApp_DataOwner* anOwner = dynamic_cast( aSUITOwner ) ) + { + QString anEntry = anOwner->entry(); + _PTR(SObject) aSObject( aStudy->studyDS()->FindObjectID(qPrintable(anEntry)) ); + if (aSObject) { + _PTR(SComponent) aSComponent = aSObject->GetFatherComponent(); + if ( aSComponent && aSComponent->ComponentDataType() == "GEOM" ) { + GEOM::GEOM_Object_var aGeomObj = + GEOMBase::GetObjectFromIOR( aSObject->GetIOR().c_str() ); + + if ( !aGeomObj->_is_nil() && aGeomObj->IsShape() && + theTypes.contains( aGeomObj->GetShapeType() ) ) { + anEntryList << anEntry; + } + } + } + } + } + + return anEntryList; +} + +Handle(HYDROData_Entity) HYDROGUI_Tool::FindObjectByName( HYDROGUI_Module* theModule, + const QString& theName, + const ObjectKind theObjectKind ) +{ + Handle(HYDROData_Entity) aResObj; + + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); + if ( !aDocument.IsNull() ) + aResObj = aDocument->FindObjectByName( theName, theObjectKind ); + + return aResObj; +} + +HYDROData_SequenceOfObjects HYDROGUI_Tool::FindObjectsByNames( HYDROGUI_Module* theModule, + const QStringList& theNames, + const ObjectKind theObjectKind ) +{ + HYDROData_SequenceOfObjects aResSeq; + + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); + if ( !aDocument.IsNull() ) + aResSeq = aDocument->FindObjectsByNames( theNames, theObjectKind ); + + return aResSeq; +} + +QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule, + const QString& thePrefix, + const QStringList& theUsedNames, + const bool theIsTryToUsePurePrefix) +{ + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); + return HYDROData_Tool::GenerateObjectName( aDocument, thePrefix, theUsedNames, theIsTryToUsePurePrefix ); +} + +size_t HYDROGUI_Tool::GetActiveViewId( HYDROGUI_Module* theModule, + const QString& theViewId ) +{ + size_t aViewId = 0; + SUIT_ViewManager* aViewMgr = theModule->getApp()->activeViewManager(); + if( !aViewMgr || ( !theViewId.isEmpty() && aViewMgr->getType() != theViewId ) ) + return aViewId; + + if( SUIT_ViewModel* aViewer = aViewMgr->getViewModel() ) + aViewId = (size_t)aViewer; + return aViewId; +} + +size_t HYDROGUI_Tool::GetActiveGraphicsViewId( HYDROGUI_Module* theModule ) +{ + return GetActiveViewId( theModule, GraphicsView_Viewer::Type() ); +} + +size_t HYDROGUI_Tool::GetActiveOCCViewId( HYDROGUI_Module* theModule ) +{ + return GetActiveViewId( theModule, OCCViewer_Viewer::Type() ); +} + +QList getViewIdList( HYDROGUI_Module* theModule, + const QString& theViewId ) +{ + QList aList; + ViewManagerList aViewMgrs; + theModule->getApp()->viewManagers( theViewId, aViewMgrs ); + QListIterator anIter( aViewMgrs ); + while( anIter.hasNext() ) + { + if( SUIT_ViewManager* aViewMgr = anIter.next() ) + { + if( SUIT_ViewModel* aViewer = aViewMgr->getViewModel() ) + aList.append( (size_t)aViewer ); + } + } + return aList; +} + +QList HYDROGUI_Tool::GetGraphicsViewIdList( HYDROGUI_Module* theModule ) +{ + return getViewIdList( theModule, GraphicsView_Viewer::Type() ); +} + +QList HYDROGUI_Tool::GetOCCViewIdList( HYDROGUI_Module* theModule ) +{ + return getViewIdList( theModule, OCCViewer_Viewer::Type() ); +} + +void HYDROGUI_Tool::setOCCActionShown( OCCViewer_ViewFrame* theViewFrame, + const int theActionId, + const bool isShown ) +{ + if ( !theViewFrame ) + return; + + OCCViewer_ViewWindow* aView = theViewFrame->getView( OCCViewer_ViewFrame::MAIN_VIEW ); + if ( aView ) { + aView->toolMgr()->setShown( theActionId, isShown ); + if ( theActionId == OCCViewer_ViewWindow::MaximizedId ) + theViewFrame->onMaximizedView( aView, true ); + } +} + +void HYDROGUI_Tool::setOCCActionShown( HYDROGUI_Module* theModule, + const int theActionId, + const bool isShown ) +{ + QList aList; + ViewManagerList aViewMgrs; + theModule->getApp()->viewManagers( OCCViewer_Viewer::Type(), aViewMgrs ); + QListIterator anIter( aViewMgrs ); + while( anIter.hasNext() ) + { + if( SUIT_ViewManager* aViewMgr = anIter.next() ) + { + OCCViewer_ViewFrame* aViewFrame = dynamic_cast + ( aViewMgr->getActiveView() ); + if ( aViewFrame ) + setOCCActionShown( aViewFrame, theActionId, isShown ); + } + } +} + + + +QColor HYDROGUI_Tool::GenerateFillingColor( HYDROGUI_Module* theModule, + const QStringList& theZoneNames ) +{ + Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); + return GenerateFillingColor( aDocument, theZoneNames ); +} + +QColor HYDROGUI_Tool::GenerateFillingColor( const Handle(HYDROData_Document)& theDoc, + const QStringList& theZoneNames ) +{ + QColor aFillingColor( Qt::darkBlue ); + + int aCounter = 0; + int aR = 0, aG = 0, aB = 0; + QStringListIterator aZoneNameIter( theZoneNames ); + while( aZoneNameIter.hasNext() ) + { + const QString& aZoneName = aZoneNameIter.next(); + Handle(HYDROData_ImmersibleZone) aRefZone = + Handle(HYDROData_ImmersibleZone)::DownCast( theDoc->FindObjectByName( aZoneName, KIND_IMMERSIBLE_ZONE ) ); + if( !aRefZone.IsNull() ) + { + QColor aRefColor = aRefZone->GetFillingColor(); + aR += aRefColor.red(); + aG += aRefColor.green(); + aB += aRefColor.blue(); + aCounter++; + } + } + + if( aCounter > 0 ) + { + aFillingColor = QColor( aR / aCounter, aG / aCounter, aB / aCounter ); + } + + return aFillingColor; +} + + + +void HYDROGUI_Tool::DeleteGeomObjects( HYDROGUI_Module* theModule, const QStringList& theEntries ) +{ + QStringList anEntryList; + + // Get active SalomeApp_Study + SalomeApp_Study* aStudy = NULL; + if ( theModule && theModule->getApp() ) { + aStudy = dynamic_cast( theModule->getApp()->activeStudy() ); + } + if ( !aStudy ) { + return; + } + + // Get GEOM engine + GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen(); + if ( aGeomEngine->_is_nil() ) { + return; + } + + // Delete GEOM objects + _PTR(StudyBuilder) aStudyBuilder( aStudy->studyDS()->NewBuilder() ); + foreach ( const QString anEntry, theEntries ) { + _PTR(SObject) aSObject( aStudy->studyDS()->FindObjectID( qPrintable(anEntry) ) ); + if ( aSObject ) { + GEOM::GEOM_Object_var aGeomObj = + GEOMBase::GetObjectFromIOR( aSObject->GetIOR().c_str() ); + + if ( !aGeomObj->_is_nil() ) { + aGeomEngine->RemoveObject( aGeomObj ); + } + + aStudyBuilder->RemoveObject( aSObject ); + } + } +} diff --git a/src/HYDROGUI/HYDROGUI_Tool2.h b/src/HYDROGUI/HYDROGUI_Tool2.h new file mode 100644 index 00000000..e39bc3f6 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_Tool2.h @@ -0,0 +1,105 @@ +// 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_TOOL2_H +#define HYDROGUI_TOOL2_H + +#include +#include +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) +#endif + +class HYDROGUI_Module; +class HYDROGUI_Prs; +class SUIT_ViewManager; +class GraphicsView_ViewPort; +class OCCViewer_ViewFrame; +class Handle_HYDROData_Document; + +namespace HYDROGUI_Tool +{ + int GetActiveStudyId(); + + void SetActiveViewManager( HYDROGUI_Module* theModule, + SUIT_ViewManager* theViewManager ); + + void GetPrsSubObjects( HYDROGUI_Module* theModule, + HYDROData_SequenceOfObjects& theSeq ); + + HYDROGUI_Prs* GetPresentation( const Handle(HYDROData_Entity)& theObj, + const GraphicsView_ObjectList& theObjects ); + + GraphicsView_ObjectList GetPrsList( GraphicsView_ViewPort* theViewPort ); + + HYDROData_SequenceOfObjects GetSelectedObjects( HYDROGUI_Module* theModule ); + + bool IsObjectHasPresentation( const Handle_HYDROData_Entity& theObject, + const QString& theViewerType = "" ); + + Handle(HYDROData_Entity) GetSelectedObject( HYDROGUI_Module* theModule ); + + HYDROData_SequenceOfObjects GetGeometryObjects( HYDROGUI_Module* theModule ); + + ObjectKind GetSelectedPartition( HYDROGUI_Module* theModule ); + + Handle(HYDROData_Entity) FindObjectByName( HYDROGUI_Module* theModule, + const QString& theName, + const ObjectKind theObjectKind = KIND_UNKNOWN ); + + HYDROData_SequenceOfObjects FindObjectsByNames( HYDROGUI_Module* theModule, + const QStringList& theNames, + const ObjectKind theObjectKind = KIND_UNKNOWN ); + + QString GenerateObjectName( HYDROGUI_Module* theModule, + const QString& thePrefix, + const QStringList& theUsedNames = QStringList(), + const bool theIsTryToUsePurePrefix = false ); + + size_t GetActiveViewId( HYDROGUI_Module* theModule, + const QString& theViewId = QString() ); + + size_t GetActiveGraphicsViewId( HYDROGUI_Module* theModule ); + + size_t GetActiveOCCViewId( HYDROGUI_Module* theModule ); + + QList GetGraphicsViewIdList( HYDROGUI_Module* theModule ); + + QList GetOCCViewIdList( HYDROGUI_Module* theModule ); + + void setOCCActionShown( OCCViewer_ViewFrame* theViewFrame, + const int theActionId, + const bool isShown ); + + void setOCCActionShown( HYDROGUI_Module* theModule, + const int theActionId, + const bool isShown ); + + QColor GenerateFillingColor( HYDROGUI_Module* theModule, const QStringList& theZoneNames ); + + QColor GenerateFillingColor( const Handle_HYDROData_Document& theDoc, + const QStringList& theZoneNames ); + + QStringList GetSelectedGeomObjects( HYDROGUI_Module* theModule, + QList theTypes ); + + void DeleteGeomObjects( HYDROGUI_Module* theModule, const QStringList& theEntries ); +}; diff --git a/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx b/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx index 11104c0b..f4bffe60 100644 --- a/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx +++ b/src/HYDROGUI/HYDROGUI_TranslateObstacleOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_TranslateObstacleDlg.h" #include "HYDROGUI_Module.h" #include "HYDROGUI_Shape.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx index ab3bbb12..7376c5b3 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_TwoImagesOp.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_TwoImagesOp.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_TwoImagesDlg.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_UpdateObjectOp.cxx b/src/HYDROGUI/HYDROGUI_UpdateObjectOp.cxx index 08a1de81..fb2d2666 100644 --- a/src/HYDROGUI/HYDROGUI_UpdateObjectOp.cxx +++ b/src/HYDROGUI/HYDROGUI_UpdateObjectOp.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_UpdateObjectOp.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx b/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx index ea619327..9c866b85 100644 --- a/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx +++ b/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx @@ -19,7 +19,7 @@ #include "HYDROGUI_VisualStateOp.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include diff --git a/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx b/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx index 64d3c157..91604426 100644 --- a/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ZLevelsOp.cxx @@ -21,7 +21,7 @@ #include "HYDROGUI_ZLevelsDlg.h" #include "HYDROGUI_DataModel.h" #include "HYDROGUI_Module.h" -#include "HYDROGUI_Tool.h" +#include "HYDROGUI_Tool2.h" #include "HYDROGUI_UpdateFlags.h" #include "HYDROGUI_ListSelector.h"