From 732211808796539fcf1de34e06038e7fb015ece9 Mon Sep 17 00:00:00 2001 From: smh Date: Thu, 2 Jun 2005 07:17:09 +0000 Subject: [PATCH] SMH: Merged GEOM (NEWGUI, HEAD, POLYWORK) --- INSTALL | 4 +- adm_local/unix/make_commence.in | 7 +- bin/VERSION | 2 +- configure.in.base | 18 +- .../GEOM/changing_displaying_parameters.htm | 18 +- doc/salome/gui/GEOM/ehlpdhtm.js | 8 +- .../salome2_sp3_geomtoolsgui_functions.htm | 27 +- .../salome2_sp3_measuregui_functions.htm | 118 +- .../salome2_sp3_operationgui_functions.htm | 146 ++- .../files/salome2_sp3_repairgui_functions.htm | 84 +- ...alome2_sp3_transformationgui_functions.htm | 113 +- doc/salome/gui/GEOM/image13.jpg | Bin 9820 -> 22439 bytes doc/salome/gui/GEOM/image15.jpg | Bin 7742 -> 12330 bytes doc/salome/gui/GEOM/image16.jpg | Bin 8530 -> 6259 bytes doc/salome/gui/GEOM/newentity_blocks.htm | 59 +- doc/salome/gui/GEOM/sketcher.htm | 18 +- doc/salome/gui/GEOM/webhelp.cab | Bin 89619 -> 89619 bytes doc/salome/gui/GEOM/webhelp.jar | Bin 134517 -> 134517 bytes doc/salome/gui/GEOM/whdata/whfts.htm | 4 +- doc/salome/gui/GEOM/whdata/whfwdata0.htm | 536 +++++++- doc/salome/gui/GEOM/whgdata/whlstf0.htm | 6 +- doc/salome/gui/GEOM/whgdata/whlstf1.htm | 8 +- doc/salome/gui/GEOM/whgdata/whlstf2.htm | 10 +- doc/salome/gui/GEOM/whgdata/whlstf3.htm | 12 +- doc/salome/gui/GEOM/whgdata/whlstf4.htm | 8 +- doc/salome/gui/GEOM/whgdata/whlstf5.htm | 12 +- doc/salome/gui/GEOM/whgdata/whlstfl15.htm | 2 +- doc/salome/gui/GEOM/whgdata/whlstfl17.htm | 2 +- doc/salome/gui/GEOM/whgdata/whlstfl18.htm | 2 +- doc/salome/gui/GEOM/whgdata/whlstfl5.htm | 2 +- doc/salome/gui/GEOM/whgdata/whlstfl6.htm | 2 +- doc/salome/gui/GEOM/whgdata/whlsti0.htm | 2 - doc/salome/gui/GEOM/whgdata/whnvl31.htm | 29 - doc/salome/gui/GEOM/whgdata/whnvt30.htm | 2 +- doc/salome/gui/GEOM/whgdata/whnvt31.htm | 2 +- doc/salome/gui/GEOM/whgdata/whnvt32.htm | 2 +- doc/salome/gui/GEOM/whgdata/whnvt33.htm | 2 +- doc/salome/gui/GEOM/whproj.htm | 2 +- doc/salome/gui/GEOM/whproj.xml | 2 +- doc/salome/gui/GEOM/whres.xml | 1 - doc/salome/gui/GEOM/whskin_info.htm | 4 +- doc/salome/gui/GEOM/whskin_papplet.htm | 1 - doc/salome/gui/GEOM/whskin_pdhtml.htm | 1 - doc/salome/gui/GEOM/whskin_tbars.htm | 1 - doc/salome/gui/GEOM/whstart.js | 2 +- doc/salome/gui/GEOM/whxdata/whfts.xml | 4 +- doc/salome/gui/GEOM/whxdata/whfwdata0.xml | 536 +++++++- doc/salome/gui/GEOM/working_with_groups.htm | 21 +- idl/GEOM_Gen.idl | 12 + resources/GEOMCatalog.xml | 4 +- src/BasicGUI/BasicGUI.cxx | 101 +- src/BasicGUI/BasicGUI.h | 9 +- src/BasicGUI/BasicGUI_ArcDlg.cxx | 49 +- src/BasicGUI/BasicGUI_ArcDlg.h | 4 +- src/BasicGUI/BasicGUI_CircleDlg.cxx | 118 +- src/BasicGUI/BasicGUI_CircleDlg.h | 8 +- src/BasicGUI/BasicGUI_CurveDlg.cxx | 50 +- src/BasicGUI/BasicGUI_CurveDlg.h | 6 +- src/BasicGUI/BasicGUI_EllipseDlg.cxx | 48 +- src/BasicGUI/BasicGUI_EllipseDlg.h | 8 +- src/BasicGUI/BasicGUI_LineDlg.cxx | 49 +- src/BasicGUI/BasicGUI_LineDlg.h | 4 +- src/BasicGUI/BasicGUI_MarkerDlg.cxx | 130 +- src/BasicGUI/BasicGUI_MarkerDlg.h | 6 +- src/BasicGUI/BasicGUI_PlaneDlg.cxx | 60 +- src/BasicGUI/BasicGUI_PlaneDlg.h | 4 +- src/BasicGUI/BasicGUI_PointDlg.cxx | 201 +-- src/BasicGUI/BasicGUI_PointDlg.h | 4 +- src/BasicGUI/BasicGUI_VectorDlg.cxx | 55 +- src/BasicGUI/BasicGUI_VectorDlg.h | 6 +- src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx | 68 +- src/BasicGUI/BasicGUI_WorkingPlaneDlg.h | 4 +- src/BasicGUI/Makefile.in | 8 +- src/BlocksGUI/BlocksGUI.cxx | 48 +- src/BlocksGUI/BlocksGUI.h | 6 +- src/BlocksGUI/BlocksGUI_BlockDlg.cxx | 28 +- src/BlocksGUI/BlocksGUI_BlockDlg.h | 1 - src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx | 44 +- src/BlocksGUI/BlocksGUI_ExplodeDlg.h | 1 - src/BlocksGUI/BlocksGUI_PropagateDlg.cxx | 32 +- src/BlocksGUI/BlocksGUI_PropagateDlg.h | 2 +- src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx | 30 +- src/BlocksGUI/BlocksGUI_QuadFaceDlg.h | 1 - src/BlocksGUI/BlocksGUI_TrsfDlg.cxx | 35 +- src/BlocksGUI/BlocksGUI_TrsfDlg.h | 1 - src/BlocksGUI/Makefile.in | 6 +- src/BooleanGUI/BooleanGUI.cxx | 22 +- src/BooleanGUI/BooleanGUI.h | 6 +- src/BooleanGUI/BooleanGUI_Dialog.cxx | 30 +- src/BooleanGUI/BooleanGUI_Dialog.h | 2 +- src/BooleanGUI/Makefile.in | 6 +- src/BuildGUI/BuildGUI.cxx | 41 +- src/BuildGUI/BuildGUI.h | 6 +- src/BuildGUI/BuildGUI_CompoundDlg.cxx | 25 +- src/BuildGUI/BuildGUI_CompoundDlg.h | 2 +- src/BuildGUI/BuildGUI_EdgeDlg.cxx | 25 +- src/BuildGUI/BuildGUI_EdgeDlg.h | 2 +- src/BuildGUI/BuildGUI_FaceDlg.cxx | 24 +- src/BuildGUI/BuildGUI_FaceDlg.h | 2 +- src/BuildGUI/BuildGUI_ShellDlg.cxx | 28 +- src/BuildGUI/BuildGUI_ShellDlg.h | 2 +- src/BuildGUI/BuildGUI_SolidDlg.cxx | 25 +- src/BuildGUI/BuildGUI_SolidDlg.h | 2 +- src/BuildGUI/BuildGUI_WireDlg.cxx | 29 +- src/BuildGUI/BuildGUI_WireDlg.h | 2 +- src/BuildGUI/Makefile.in | 6 +- src/DisplayGUI/DisplayGUI.cxx | 254 ++-- src/DisplayGUI/DisplayGUI.h | 25 +- src/DisplayGUI/Makefile.in | 8 +- src/DlgRef/DlgRef_SpinBox.cxx | 2 +- src/DlgRef/DlgRef_SpinBox.h | 4 +- src/DlgRef/Makefile.in | 4 +- src/EntityGUI/EntityGUI.cxx | 101 +- src/EntityGUI/EntityGUI.h | 10 +- src/EntityGUI/EntityGUI_SketcherDlg.cxx | 126 +- src/EntityGUI/EntityGUI_SketcherDlg.h | 9 +- src/EntityGUI/EntityGUI_SubShapeDlg.cxx | 52 +- src/EntityGUI/EntityGUI_SubShapeDlg.h | 1 - src/EntityGUI/Makefile.in | 8 +- src/GEOM/GEOM_Engine.cxx | 350 ++++- src/GEOM/GEOM_Engine.hxx | 25 +- src/GEOM/GEOM_Function.cxx | 5 +- src/GEOM/GEOM_Function.hxx | 2 +- src/GEOM/GEOM_Object.cxx | 12 +- src/GEOM/GEOM_Object.hxx | 2 +- src/GEOM/Makefile.in | 4 +- src/GEOMBase/GEOMBase.cxx | 348 ++--- src/GEOMBase/GEOMBase.h | 8 +- src/GEOMBase/GEOMBase_Helper.cxx | 307 +++-- src/GEOMBase/GEOMBase_Helper.h | 29 +- src/GEOMBase/GEOMBase_Skeleton.cxx | 64 +- src/GEOMBase/GEOMBase_Skeleton.h | 6 +- src/GEOMBase/GEOMBase_aParameterDlg.cxx | 7 +- src/GEOMBase/GEOMBase_aParameterDlg.h | 4 +- src/GEOMBase/GEOM_Operation.cxx | 34 +- src/GEOMBase/GEOM_Operation.h | 18 +- src/GEOMBase/Makefile.in | 6 +- src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx | 57 +- src/GEOMFiltersSelection/GEOM_FaceFilter.cxx | 57 +- .../GEOM_LogicalFilter.cxx | 157 +-- .../GEOM_PreviewFilter.cxx | 55 +- src/GEOMFiltersSelection/GEOM_TypeFilter.cxx | 140 +- src/GEOMFiltersSelection/Makefile.in | 37 +- src/GEOMGUI/GEOMGUI.cxx | 34 +- src/GEOMGUI/GEOMGUI.h | 27 +- src/GEOMGUI/GEOM_Displayer.cxx | 521 ++++---- src/GEOMGUI/GEOM_Displayer.h | 31 +- src/GEOMGUI/GEOM_msg_en.po | 904 ++++++++++++- src/GEOMGUI/GeometryGUI.cxx | 1150 ++++++++++++----- src/GEOMGUI/GeometryGUI.h | 112 +- src/GEOMGUI/GeometryGUI_Swig.cxx | 337 ----- src/GEOMGUI/Makefile.in | 30 +- src/GEOMImpl/GEOMImpl_Block6Explorer.cxx | 6 +- src/GEOMImpl/GEOMImpl_BlockDriver.cxx | 11 +- src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx | 198 +-- src/GEOMImpl/GEOMImpl_IBasicOperations.cxx | 130 +- src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx | 408 ++---- src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx | 69 +- src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx | 140 +- src/GEOMImpl/GEOMImpl_IGroupOperations.cxx | 84 +- src/GEOMImpl/GEOMImpl_IHealingOperations.cxx | 124 +- src/GEOMImpl/GEOMImpl_IInsertOperations.cxx | 28 +- src/GEOMImpl/GEOMImpl_ILocalOperations.cxx | 120 +- src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx | 12 +- src/GEOMImpl/GEOMImpl_IShapesOperations.cxx | 329 ++--- .../GEOMImpl_ITransformOperations.cxx | 257 +--- src/GEOMToolsGUI/GEOMToolsGUI.cxx | 183 +-- src/GEOMToolsGUI/GEOMToolsGUI.h | 12 +- src/GEOMToolsGUI/GEOMToolsGUI_1.cxx | 342 +++-- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx | 50 +- src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h | 29 +- .../GEOMToolsGUI_TransparencyDlg.cxx | 208 +-- .../GEOMToolsGUI_TransparencyDlg.h | 54 +- src/GEOMToolsGUI/Makefile.in | 22 +- src/GEOM_I/GEOM_Gen_i.cc | 15 +- src/GEOM_I/GEOM_Gen_i.hh | 12 +- src/GEOM_I/GEOM_I3DPrimOperations_i.cc | 4 +- src/GEOM_I/GEOM_IOperations_i.cc | 2 +- src/GEOM_I/GEOM_Object_i.cc | 6 +- src/GEOM_I/Makefile.in | 8 +- src/GEOM_I_Superv/GEOM_Superv_i.cc | 1 + src/GEOM_I_Superv/GEOM_Superv_i.hh | 4 - src/GEOM_SWIG/Makefile.in | 2 +- src/GEOM_SWIG/batchmode_geompy.py | 68 +- src/GEOM_SWIG/geompy.py | 77 +- src/GenerationGUI/GenerationGUI.cxx | 33 +- src/GenerationGUI/GenerationGUI.h | 6 +- .../GenerationGUI_FillingDlg.cxx | 36 +- src/GenerationGUI/GenerationGUI_FillingDlg.h | 4 +- src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 26 +- src/GenerationGUI/GenerationGUI_PipeDlg.h | 2 +- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 32 +- src/GenerationGUI/GenerationGUI_PrismDlg.h | 4 +- src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 27 +- src/GenerationGUI/GenerationGUI_RevolDlg.h | 4 +- src/GenerationGUI/Makefile.in | 6 +- src/GroupGUI/GroupGUI.cxx | 70 +- src/GroupGUI/GroupGUI.h | 6 +- src/GroupGUI/GroupGUI_GroupDlg.cxx | 81 +- src/GroupGUI/GroupGUI_GroupDlg.h | 4 +- src/GroupGUI/Makefile.in | 6 +- src/Makefile.in | 2 +- src/MeasureGUI/Makefile.in | 6 +- src/MeasureGUI/MeasureGUI.cxx | 49 +- src/MeasureGUI/MeasureGUI.h | 6 +- src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx | 21 +- src/MeasureGUI/MeasureGUI_BndBoxDlg.h | 6 +- src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx | 35 +- src/MeasureGUI/MeasureGUI_CenterMassDlg.h | 5 +- .../MeasureGUI_CheckCompoundOfBlocksDlg.cxx | 24 +- .../MeasureGUI_CheckCompoundOfBlocksDlg.h | 6 +- src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx | 21 +- src/MeasureGUI/MeasureGUI_CheckShapeDlg.h | 6 +- src/MeasureGUI/MeasureGUI_DistanceDlg.cxx | 42 +- src/MeasureGUI/MeasureGUI_DistanceDlg.h | 6 +- src/MeasureGUI/MeasureGUI_InertiaDlg.cxx | 21 +- src/MeasureGUI/MeasureGUI_InertiaDlg.h | 6 +- src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx | 21 +- src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h | 6 +- src/MeasureGUI/MeasureGUI_PointDlg.cxx | 26 +- src/MeasureGUI/MeasureGUI_PointDlg.h | 6 +- src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx | 24 +- src/MeasureGUI/MeasureGUI_PropertiesDlg.h | 6 +- src/MeasureGUI/MeasureGUI_Skeleton.cxx | 90 +- src/MeasureGUI/MeasureGUI_Skeleton.h | 12 +- src/MeasureGUI/MeasureGUI_WhatisDlg.cxx | 21 +- src/MeasureGUI/MeasureGUI_WhatisDlg.h | 6 +- src/OBJECT/Makefile.in | 6 +- src/OperationGUI/Makefile.in | 6 +- src/OperationGUI/OperationGUI.cxx | 34 +- src/OperationGUI/OperationGUI.h | 6 +- .../OperationGUI_ArchimedeDlg.cxx | 50 +- src/OperationGUI/OperationGUI_ArchimedeDlg.h | 8 +- src/OperationGUI/OperationGUI_ChamferDlg.cxx | 65 +- src/OperationGUI/OperationGUI_ChamferDlg.h | 5 +- src/OperationGUI/OperationGUI_ClippingDlg.cxx | 73 +- src/OperationGUI/OperationGUI_ClippingDlg.h | 2 +- src/OperationGUI/OperationGUI_FilletDlg.cxx | 50 +- src/OperationGUI/OperationGUI_FilletDlg.h | 5 +- src/OperationGUI/OperationGUI_MaterialDlg.cxx | 25 +- src/OperationGUI/OperationGUI_MaterialDlg.h | 3 +- .../OperationGUI_PartitionDlg.cxx | 42 +- src/OperationGUI/OperationGUI_PartitionDlg.h | 2 +- src/PrimitiveGUI/Makefile.in | 6 +- src/PrimitiveGUI/PrimitiveGUI.cxx | 34 +- src/PrimitiveGUI/PrimitiveGUI.h | 6 +- src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx | 46 +- src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h | 4 +- src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx | 53 +- src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h | 4 +- src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx | 45 +- src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h | 4 +- src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx | 43 +- src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h | 4 +- src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx | 45 +- src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h | 4 +- src/RepairGUI/Makefile.in | 6 +- src/RepairGUI/RepairGUI.cxx | 45 +- src/RepairGUI/RepairGUI.h | 6 +- src/RepairGUI/RepairGUI_CloseContourDlg.cxx | 37 +- src/RepairGUI/RepairGUI_CloseContourDlg.h | 2 +- src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx | 84 +- src/RepairGUI/RepairGUI_DivideEdgeDlg.h | 8 +- src/RepairGUI/RepairGUI_FreeBoundDlg.cxx | 67 +- src/RepairGUI/RepairGUI_FreeBoundDlg.h | 10 +- src/RepairGUI/RepairGUI_FreeFacesDlg.cxx | 64 +- src/RepairGUI/RepairGUI_FreeFacesDlg.h | 12 +- src/RepairGUI/RepairGUI_GlueDlg.cxx | 109 +- src/RepairGUI/RepairGUI_GlueDlg.h | 6 +- src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx | 40 +- src/RepairGUI/RepairGUI_RemoveHolesDlg.h | 2 +- src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx | 77 +- src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h | 2 +- src/RepairGUI/RepairGUI_SewingDlg.cxx | 40 +- src/RepairGUI/RepairGUI_SewingDlg.h | 8 +- src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx | 79 +- src/RepairGUI/RepairGUI_ShapeProcessDlg.h | 26 +- src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx | 41 +- src/RepairGUI/RepairGUI_SuppressFacesDlg.h | 2 +- src/SKETCHER/Makefile.in | 2 +- src/TransformationGUI/Makefile.in | 6 +- src/TransformationGUI/TransformationGUI.cxx | 38 +- src/TransformationGUI/TransformationGUI.h | 6 +- .../TransformationGUI_MirrorDlg.cxx | 37 +- .../TransformationGUI_MirrorDlg.h | 2 +- .../TransformationGUI_MultiRotationDlg.cxx | 53 +- .../TransformationGUI_MultiRotationDlg.h | 4 +- .../TransformationGUI_MultiTranslationDlg.cxx | 57 +- .../TransformationGUI_MultiTranslationDlg.h | 4 +- .../TransformationGUI_OffsetDlg.cxx | 36 +- .../TransformationGUI_OffsetDlg.h | 2 +- .../TransformationGUI_PositionDlg.cxx | 43 +- .../TransformationGUI_PositionDlg.h | 2 +- .../TransformationGUI_RotationDlg.cxx | 35 +- .../TransformationGUI_RotationDlg.h | 4 +- .../TransformationGUI_ScaleDlg.cxx | 38 +- .../TransformationGUI_ScaleDlg.h | 4 +- .../TransformationGUI_TranslationDlg.cxx | 57 +- .../TransformationGUI_TranslationDlg.h | 4 +- 299 files changed, 8527 insertions(+), 6066 deletions(-) diff --git a/INSTALL b/INSTALL index 957ed266f..d00a2239a 100644 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,3 @@ -This is the version 2.2.0 of GEOM +This is the version 3.0.0 of GEOM Compatible with : - - KERNEL 2.2.0 + - KERNEL 3.0.0 only! diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 55a110fa8..ce50b9e5c 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -10,7 +10,7 @@ HAVE_SSTREAM=@HAVE_SSTREAM@ LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker $(top_builddir)/lib/salome +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome # add libstdc++ to link c++ library with libtool ! LDFLAGS+= -lstdc++ @@ -34,6 +34,10 @@ CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ +# BOOST Library + +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ + # JAVA JAVA_INCLUDES = @JAVA_INCLUDES@ @@ -60,6 +64,7 @@ QT_MT_LIBS = @QT_MT_LIBS@ MOC = @MOC@ UIC = @UIC@ +MSG2QM = @MSG2QM@ #QWT diff --git a/bin/VERSION b/bin/VERSION index f2ab43933..9eeab0f4d 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME - GEOM VERSION: 2.2.0 +THIS IS SALOME - GEOM VERSION: 2.2.2 diff --git a/configure.in.base b/configure.in.base index 7e3acdc86..8bbb9e639 100644 --- a/configure.in.base +++ b/configure.in.base @@ -210,6 +210,14 @@ echo CHECK_QT +echo +echo --------------------------------------------- +echo testing MSG2QM +echo --------------------------------------------- +echo + +CHECK_MSG2QM + echo echo --------------------------------------------- echo testing VTK @@ -234,6 +242,14 @@ echo CHECK_MED2 +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + echo echo --------------------------------------------- echo Testing OpenCascade @@ -265,7 +281,7 @@ echo --------------------------------------------- echo echo Configure -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" +variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" for var in $variables do diff --git a/doc/salome/gui/GEOM/changing_displaying_parameters.htm b/doc/salome/gui/GEOM/changing_displaying_parameters.htm index fe76d2a52..05c0c3cb5 100755 --- a/doc/salome/gui/GEOM/changing_displaying_parameters.htm +++ b/doc/salome/gui/GEOM/changing_displaying_parameters.htm @@ -15,20 +15,20 @@ if (navigator.appName !="Netscape") + diff --git a/doc/salome/gui/GEOM/whgdata/whlstf0.htm b/doc/salome/gui/GEOM/whgdata/whlstf0.htm index 812f35024..936cdd86b 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstf0.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstf0.htm @@ -36,11 +36,11 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; } 1d 1 2
1st 1 2 3 4 5
2d 1 2 3 4 5 6
2nd 1 2 3 4 5
2st
3d 1 2 3 4 5 6 7 8 9
3rd 1 2
3st


-able
absolute
accordance
according 1 2
achieve
add
added 1 2
addobject
adjustment
advanced 1 2
aimed
algorithm
allowing 1 2
allows 1 2 3 4 5
along 1 2 3
angle 1 2 3 4
another
any
applicable
applied
apply 1 2
applying
approximation
arc 1 2
archimede
argument
arguments 1 2 3 4 5 6 7 8 9 10 11 12 13
around
associated
attributes
automatically 1 2
available 1 2
axes
axis 1 2 3 4 5
+able
absolute
accessible
accordance
according 1 2
achieve
add
added 1 2
addobject
adjustment
advanced 1 2
aimed
algorithm
allowing 1 2
allows 1 2 3 4 5
along 1 2 3
angle 1 2 3 4
another
any
applicable
applied
apply 1 2
applying
approximation
arc 1 2
archimede
argument
arguments 1 2 3 4 5 6 7 8 9 10 11 12 13
around
associated
attributes
automatically 1 2
available 1 2 3 4 5
axes
axis 1 2 3 4 5


-b
base 1 2
based
baseshape
basic 1 2 3 4 5 6
basicproperties
basing
basis
before 1 2
below
bezier 1 2
block 1 2
blocks 1 2 3
boolean 1 2 3 4
both
boundaries
boundary
bounding
boundingbox
box 1 2 3 4 5 6 7 8 9 10 11 12 13 14
brep 1 2
browser 1 2 3
bspline
bsplinerestriction
bsplines
build 1 2
building 1 2 3 4
builds 1 2
button 1 2
bypassing
+b
background
base 1 2
based
baseshape
basic 1 2 3 4 5 6
basicproperties
basing
basis
before 1 2
below
bezier 1 2
block 1 2 3
blocks 1 2 3 4
boolean 1 2 3 4
both
boundaries
boundary
bounding
boundingbox
box 1 2 3 4 5 6 7 8 9 10 11 12 13 14
breaks
brep 1 2
browser 1 2 3
bspline
bsplinerestriction
bsplines
build 1 2 3
building 1 2 3 4
builds 1 2
button 1 2
bypassing


-cad
camera
case 1 2 3
center 1 2 3 4 5
centerofscale
central
chamfer
change
changes
changing
check 1 2
checkbox 1 2
checked 1 2
checking 1 2
checkshape
choose 1 2 3
circle
click 1 2 3
close
closecontour
closed 1 2
closedwires
closes
closure
coincident
color
command 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
common 1 2
complex 1 2 3 4
components 1 2 3
composed
composing
compound 1 2 3 4 5 6
compsolid
compute
computed
concerning
cone
confirm
conical
connected 1 2
considered
constraints
construct
constructed 1 2
constructing
construction 1 2
constructor 1 2 3 4 5
containing
contains 1 2
contents
continuities
continuity
continuity2d
continuity3d
contour
conversion
coordinate 1 2 3
coordinates 1 2 3 4 5
copy
corners
correction
correspond
corresponding 1 2
correspondingly 1 2 3 4 5
coupled


>> +cad
camera
case 1 2 3
center 1 2 3 4 5
centerofscale
central
chamfer
change
changes
changing
check 1 2
checkbox 1 2
checkcompoundofblocks
checked 1 2
checking 1 2
checks
checkshape
choose 1 2 3
circle
click 1 2 3
close
closecontour
closed 1 2
closedwires
closes
closure
coincident
color
command 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
common 1 2
complex 1 2 3 4
components 1 2 3
composed
composing
compound 1 2 3 4 5 6 7
compsolid
compute
computed
concerning
conditions
cone
confirm
conical
connected 1 2 3
connection
considered 1 2
console
constraints
construct
constructed 1 2
constructing
construction 1 2
constructor 1 2 3 4 5
contain
contained
containing
contains 1 2
contents
continuities
continuity
continuity2d
continuity3d
contour
conversion
coordinate 1 2 3
coordinates 1 2 3 4 5
copy
corners
correction
correspond
corresponding 1 2
correspondingly 1 2 3 4 5
coupled


>> diff --git a/doc/salome/gui/GEOM/whgdata/whlstf1.htm b/doc/salome/gui/GEOM/whgdata/whlstf1.htm index 3d29e7fd6..ea24344b2 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstf1.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstf1.htm @@ -33,13 +33,13 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }

<<

-create 1 2 3 4 5 6 7 8
created 1 2 3 4 5 6 7
creategroup
creates 1 2 3 4 5 6 7 8 9
creating
creation 1 2 3 4
current 1 2
curve 1 2 3
curve2dmode
curve3dmode
curvecontinuity
curves 1 2 3
curving
cut
cuts
cutting 1 2
cylinder
cylindrical
+create 1 2 3 4 5 6 7 8
created 1 2 3 4 5 6 7
creategroup
creates 1 2 3 4 5 6 7 8 9
creating
creation 1 2 3 4 5
current 1 2
curve 1 2 3
curve2dmode
curve3dmode
curvecontinuity
curves 1 2 3
curving
cut
cuts
cutting 1 2
cylinder
cylindrical


-d1
d2
data
default
define 1 2 3
defined
defines 1 2
defining 1 2 3
definite 1 2
definition 1 2
deflection
degree 1 2
degrees
deleted
density
depending
describes
description 1 2 3 4 5 6 7 8 9 10 11 12 13 14
desired
destination
destined
detect
detection
detects
diagonal
dialog 1 2 3 4 5 6 7 8 9 10 11 12 13 14
differ
different 1 2 3 4
dimension 1 2
dimensions 1 2 3
dir
dir1
dir2
direction 1 2 3 4 5 6
directions 1 2
dirface1v
dirfaceid1
dirfaceid1u
dirfaceid1v
dirfaceid2
dirfaceid2u
dirfaceid2v
display 1 2 3 4
displayall
displayed 1 2 3 4
displaying 1 2
displayonly
displays 1 2
distance 1 2 3
divided
divideedge
dividing
done 1 2
double
doubles
dropsmalledges
dx 1 2
dy 1 2
dz
+d1
d2
data
default 1 2
define 1 2 3
defined
defines 1 2
defining 1 2 3
definite 1 2
definition 1 2
deflection
degenerated
degree 1 2
degrees
deleted
density
depending
describes
description 1 2 3 4 5 6 7 8 9 10 11 12 13 14
desired
destination
destined
detect
detection
detects
diagonal
dialog 1 2 3 4 5 6 7 8 9 10 11 12 13 14
differ
different 1 2 3 4
dimension 1 2
dimensions 1 2 3
dir
dir1
dir2
direction 1 2 3 4 5 6
directions 1 2
dirface1v
dirfaceid1
dirfaceid1u
dirfaceid1v
dirfaceid2
dirfaceid2u
dirfaceid2v
display 1 2 3 4
displayall
displayed 1 2 3 4
displaying 1 2
displayonly
displays 1 2
distance 1 2 3
divided
divideedge
dividing
done 1 2
double
doubles
dropsmalledges
dx 1 2
dy 1 2
dz


-e
e1
e2
e3
e4
edge 1 2 3 4 5
edgeid
edges 1 2 3 4 5
edit
egdemaxtol
egdemintol
either
element 1 2 3 4
elementary
elements 1 2 3 4 5 6
ellipse
empty
end 1 2 3
ending
ends
enter 1 2
entity 1 2 3 4 5 6
equal
erase
eraseall
eraseonly
erases
error
etc 1 2
example 1 2 3 4 5 6 7 8 9 10 11 12
except
existing 1 2
explode 1 2 3
exploded 1 2
export 1 2
exportation
exported
exporting
extracted
extruded
extrusion
+e
e1
e2
e3
e4
easier
edge 1 2 3 4 5 6
edgeid
edges 1 2 3 4 5 6
edit
editing
egdemaxtol
egdemintol
either
element 1 2 3 4 5
elementary
elements 1 2 3 4 5 6
ellipse
empty
encountered
end 1 2 3
ending
ends
enter 1 2
entire
entity 1 2 3 4 5 6 7
equal
erase
eraseall
eraseonly
erases
error
errors
etc 1 2
example 1 2 3 4 5 6 7 8 9 10 11 12
except
existing 1 2
explode 1 2 3
exploded 1 2
export 1 2
exportation
exported
exporting
extra
extracted
extruded
extrusion


-f1
f2
f3
f4
f5
f6
face 1 2 3 4 5 6 7
face1
face2
facemaxtol
facemintol
faces 1 2 3 4 5
factor
false
fields
file
filename
files
fill 1 2
filled
fillet
fillets
filling
first 1 2 3 4 5 6
fix
fixfacesize
fixing
fixshape


>> +f1
f2
f3
f4
f5
f6
face 1 2 3 4 5 6 7 8
face1
face2
facemaxtol
facemintol
faces 1 2 3 4 5 6
factor
false


>> diff --git a/doc/salome/gui/GEOM/whgdata/whlstf2.htm b/doc/salome/gui/GEOM/whgdata/whlstf2.htm index b27093280..645eb909d 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstf2.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstf2.htm @@ -33,13 +33,13 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }

<<

-following 1 2 3 4
format
formatname
formats
four
free
functions 1 2
fuse
fuses
+fields
file
filename
files
fill 1 2
filled
fillet
fillets
filling
first 1 2 3 4 5 6
fix
fixfacesize
fixing
fixshape
flag
following 1 2 3 4
format
formatname
formats
four
free
functionalities
functionality 1 2
functions 1 2
fuse
fuses


-gap
general
generating
generation 1 2
geom 1 2 3 4 5 6 7 8 9 10 11 12
geom_object 1 2 3 4 5 6 7 8 9 10 11 12
geom_objects
geometric
geometrical 1 2 3 4 5 6 7 8 9 10 11 12 13 14
geometry
geompy 1 2 3 4 5 6 7 8 9 10 11 12 13
get
getfreeboundary
getobjectids
gets
getsubshapeid
getting
gg
given 1 2 3 4 5
gives
glue 1 2
glued
glues
graphic
gravity
group
groups
gui
+gap
general
generating
generation 1 2
geom 1 2 3 4 5 6 7 8 9 10 11 12
geom_object 1 2 3 4 5 6 7 8 9 10 11 12
geom_objects 1 2
geometric
geometrical 1 2 3 4 5 6 7 8 9 10 11 12 13 14
geometry
geompy 1 2 3 4 5 6 7 8 9 10 11 12 13
get
getfreeboundary
getfreefacesids
getobjectids
gets
getsubshapeid
getting
gg
given 1 2 3 4 5 6
gives
glue 1 2
glued 1 2
glues
graphic
gravity
group 1 2
groups 1 2
gui


-half
having 1 2
height 1 2
hexahedral 1 2
hexahedron
hide
hiding
highlights
hole
holes
+half
handling
having 1 2
height 1 2
hexahedral 1 2
hexahedron
hide
hiding
highlight
highlights
hole
holes


-i
i11
i12
i13
i21
i22
i23
i31
i32
i33
id 1 2 3 4 5 6
ids 1 2 3
if 1 2 3 4
iges 1 2
image
import 1 2
importation
imported 1 2 3
importing
increased
independent
independently
indices
inertia
initial
inner
inquired
inretia
inserted
inside
integer
integers
intended
interactively
intermediate
internal
intersect
intersected
intersection
introduction 1 2
invalid
isbyparameter
iscommonvertex
isolines
isos
iterations
itself
ix
iy
iz
+i
i11
i12
i13
i21
i22
i23
i31
i32
i33
id 1 2 3 4 5 6
ids 1 2 3 4
if 1 2 3 4 5
iges 1 2
image
import 1 2
importation
imported 1 2 3
importing
increased
independent
independently
indices
inertia
informs
initial
inner
inquired
inretia
inserted
inside
integer
integers
intended
interactively
intermediate
internal
intersect
intersected
intersection
introduction 1 2
invalid
investigated
isbyparameter
iscommonvertex
isolines
isos
iterations
itself
ix
iy
iz


just


@@ -47,7 +47,7 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }

last 1 2
lcs
least
length 1 2 3
less
limit
line 1 2 3
list 1 2 3 4 5 6 7
listoffaceid
listofgeomshapes
listofid 1 2
listofkeepinside
listofmaterials
listofremoveinside
listofshape 1 2 3
listofshapeid
listofshapes 1 2
listoftools
listofwireid
local 1 2 3
located
location 1 2 3
lwp
lying 1 2


-main 1 2 3 4 5 6 7 8 9 10 11
mainshape
major 1 2
make
makearc
makebezier
makeblockexplode
makeboolean
makebox
makecdg
makechamferedge
makechamferface
makecircle
makecompound
makecone
makecylinder
makeedge
makeellipse
makeface
makefillet
makefilling
makegluefaces
makehexasolid
makehexasolidtwofaces
makeinterpol
makeline
makemarker
makemirrorbyplane
makemultirotation1d
makemultirotation2d
makemultitransformation1d
makemultitransformation2d
makemultitranslation1d
makemultitranslation2d
makeoffset
makepartition
makepipe
makeplane
makepolyline
makeposition
makeprism
makequadface
makequadfaceedges
makequadfacevertices
makerevolution
makerotation
makes 1 2
makescaletransform
makesewing
makeshell
makesketcher
makesolid
makesphere
maketorus
maketranslation
makevector
makevertex
makewire
manually
mass
materials
matrix
max 1 2 3
maxdegree
maximal 1 2 3 4
maximum 1 2
maxnbfaces
maxtolerance
maxtolerance3d


>> +main 1 2 3 4 5 6 7 8 9 10 11 12 13 14
mainshape
major 1 2
make
makearc
makebezier
makeblockexplode
makeboolean
makebox
makecdg
makechamferedge
makechamferface
makecircle
makecompound
makecone
makecylinder
makeedge
makeellipse
makeface
makefillet
makefilling
makegluefaces
makehexasolid
makehexasolidtwofaces
makeinterpol
makeline
makemarker
makemirrorbyplane
makemultirotation1d
makemultirotation2d
makemultitransformation1d
makemultitransformation2d
makemultitranslation1d
makemultitranslation2d
makeoffset
makepartition
makepipe
makeplane
makepolyline
makeposition
makeprism
makequadface
makequadfaceedges
makequadfacevertices
makerevolution
makerotation
makes 1 2 3
makescaletransform
makesewing
makeshell
makesketcher
makesolid
makesphere
maketorus
maketranslation
makevector
makevertex
makewire
manually
mass
materials
matrix
max 1 2 3
maxdegree
maximal 1 2 3 4
maximum 1 2
maxnbfaces
maxtolerance
maxtolerance3d


>> diff --git a/doc/salome/gui/GEOM/whgdata/whlstf3.htm b/doc/salome/gui/GEOM/whgdata/whlstf3.htm index ec4482be0..511fd4483 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstf3.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstf3.htm @@ -33,17 +33,17 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }

<<

-meaning
means
measurement
measures
mentioned
menu 1 2 3 4 5 6 7 8 9 10 11 12 13
merging
mesh
meshing 1 2
meshingdeflection
method
middle
min 1 2 3
mindegree
mindistance
minimal 1 2 3
minimum
minnbfaces
minor 1 2
mirror
mirrored
mode 1 2
modeled
models
modes
modification 1 2
modified
modifies 1 2
modify
module 1 2
moment
moments
move
moved
multi 1 2 3
must 1 2
+meaning
means
measurement
measures
mentioned
menu 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
merging
mesh
meshing 1 2
meshingdeflection
method
middle
min 1 2 3
mindegree
mindistance
minimal 1 2 3
minimum
minnbfaces
minor 1 2
mirror
mirrored
mode 1 2
modeled
models
modes
modification 1 2
modified
modifies 1 2
modify
module 1 2
moment
moments
move
moved
much
multi 1 2 3
multitude
must 1 2 3


-name 1 2 3 4 5 6 7 8 9 10
names
nbiter
nbsplitpoints
nbtimes 1 2
nbtimes1
nbtimes2
nbtimesu
nbtimesv
necessary 1 2 3 4
needed
negative
neigbour
new 1 2 3 4 5 6 7
nodes
noerror
normal 1 2 3
notions
number 1 2 3 4 5
numbers
numeber
+name 1 2 3 4 5 6 7 8 9 10
names
nbiter
nbsplitpoints
nbtimes 1 2
nbtimes1
nbtimes2
nbtimesu
nbtimesv
necessary 1 2 3 4
needed
negative
neigbour
new 1 2 3 4 5 6 7 8
nodes
noerror
normal 1 2 3
notions
number 1 2 3 4 5
numbers
numeber


-object 1 2 3 4 5 6 7 8 9 10 11
objects 1 2 3 4 5 6 7 8 9 10 11 12 13
occ 1 2 3
occurred
offset
ok 1 2
one 1 2 3 4 5 6 7
ones
open
openwires
operation 1 2 3 4
operations 1 2 3 4 5 6 7 8
operator
operators
opposite
optimization
options
order
oriented 1 2
origin 1 2
otherwise 1 2
outside
ox 1 2
oy
oz 1 2
+object 1 2 3 4 5 6 7 8 9 10 11
objects 1 2 3 4 5 6 7 8 9 10 11 12 13
occ 1 2 3 4
occurred
offers
offset
ok 1 2
one 1 2 3 4 5 6 7
ones
open
openwires
operation 1 2 3 4
operations 1 2 3 4 5 6 7 8
operator
operators
opposite
optimization
options
order 1 2
oriented 1 2
origin 1 2
otherwise 1 2
outside
ox 1 2
oy
oz 1 2


-parameter 1 2 3
parameters 1 2 3 4 5
paramter
part 1 2
partition
passes
path
pathshape
pattern
perform 1 2
performed
perpendicular
pipe
planar 1 2 3
plane 1 2 3 4
plunged
point 1 2 3 4 5 6
point1
point2
point3
pointcoordinates
points 1 2 3 4 5
polyline
pop 1 2
position 1 2
possibility
possible 1 2
precision
predefined
presses
preview
previous
primitive
primitives 1 2
prism
problems
processed 1 2
processes
processing
processshape
properties 1 2
put
python
+parameter 1 2 3
parameters 1 2 3 4 5
paramter
part 1 2
partition
passes
path
pathshape
pattern
perform 1 2
performed
perpendicular
pipe
planar 1 2 3
plane 1 2 3 4
platform
plunged
point 1 2 3 4 5 6
point1
point2
point3
pointcoordinates
points 1 2 3 4 5
polyline
pop 1 2
position 1 2
possibility
possible 1 2 3 4
precision
predefined
preferences
presses
preview
previous
primitive
primitives 1 2
printed
prism
problems
processed 1 2
processes
processing
processshape
project
propagate
propagation
properties 1 2
put
python


-quadrangle 1 2
+quadrangle 1 2 3


-radians
radius 1 2 3 4
radius1
radius2
radiuses 1 2
radiusmajor 1 2
radiusminor 1 2
range 1 2
re
reasonable
reconstruction
reference
regarding
relative
remove
removed 1 2 3
removeobject
removes
removewebs
removing
repair
repairing 1 2
repetition
repetitions
representing
requested
required 1 2 3
requireddegree
requirednbsegments
respect 1 2
restriction
result 1 2 3 4 5 6 7 8 9 10 11 12
resultant
resulting 1 2 3
results
retrieved
return
returned 1 2
returns 1 2 3 4
reverse
revolution 1 2


>> +radians
radius 1 2 3 4
radius1
radius2
radiuses 1 2
radiusmajor 1 2
radiusminor 1 2
range 1 2


>> diff --git a/doc/salome/gui/GEOM/whgdata/whlstf4.htm b/doc/salome/gui/GEOM/whgdata/whlstf4.htm index 821d17538..4f38f02f6 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstf4.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstf4.htm @@ -33,13 +33,11 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }

<<

-right 1 2
rotate
rotated 1 2
rotates
rotation
+re
reasonable
reconstruction
reference
regarding
relative
remove
removed 1 2 3
removeobject
removes
removewebs
removing
repair
repairing 1 2
repetition
repetitions
representing
requested
required 1 2 3
requireddegree
requirednbsegments
respect 1 2
restriction
result 1 2 3 4 5 6 7 8 9 10 11 12
resultant
resulting 1 2 3
results
retrieved
retrieves
return
returned 1 2
returns 1 2 3 4 5
reverse
revolution 1 2
right 1 2
rotate
rotated 1 2
rotates
rotation


-s 1 2 3 4 5 6
salome
same 1 2
sameparameter
scale
scaled
search
second 1 2 3 4
section 1 2
see
segment
segments
select 1 2 3 4 5 6 7 8 9 10 11 12 13 14
selected 1 2 3 4
selection 1 2 3
sense
serve
serving
set 1 2 3
setcolor
setdisplaymode
sets
setting 1 2
settransparency
sew
sewed
sewing
sg
shading
shape 1 2 3 4 5 6 7 8 9 10 11
shape1 1 2
shape2 1 2
shapes 1 2 3 4 5 6 7 8
shapesto
shapetype 1 2
shell 1 2 3 4
shells 1 2
short
should
shown
side
signed
six
size 1 2 3
sketch
sketcher
small 1 2
solid 1 2 3 4 5 6
solids
soon
space 1 2
specific
specified 1 2 3
specifies
specify
specifying
sphere
spline
splitangle
splitclosedfaces
splitcontinuity
splits
splitting
spot
stage
standard
started
starting 1 2 3
step 1 2 3
step1
step2
steps
string 1 2
strip
study
sub 1 2 3
submenu 1 2 3 4
subshape 1 2 3
subshapeall
subshapeid
subshapes 1 2
suppress
suppresses
suppressfaces
suppressholes
suppressinternalwires
surface 1 2
surfacecontinuity
surfacemode
surfaces
symmetrical
symmetry 1 2
system 1 2
+s 1 2 3 4 5 6
salome 1 2
same 1 2
sameparameter
satisfy
scale
scaled
search
second 1 2 3 4
section 1 2
see 1 2
segment
segments
select 1 2 3 4 5 6 7 8 9 10 11 12 13 14
selected 1 2 3 4
selection 1 2 3
sense
serve
serving
set 1 2 3
setcolor
setdisplaymode
sets
setting 1 2
settransparency
sew
sewed
sewing
sg
shading
shape 1 2 3 4 5 6 7 8 9 10 11
shape1 1 2
shape2 1 2
shapes 1 2 3 4 5 6 7 8
shapesto
shapetype 1 2
shared
shell 1 2 3 4
shells 1 2 3
short
should 1 2
shown
side
signed
six
size 1 2 3
sketch
sketcher
small 1 2
solid 1 2 3 4 5 6
solids
soon
space 1 2
specific
specified 1 2 3
specifies
specify
specifying
sphere
spline
splitangle
splitclosedfaces
splitcontinuity
splits
splitting
spot
stage
standard
started
starting 1 2 3
step 1 2 3
step1
step2
string 1 2
strip
study
sub 1 2 3
submenu 1 2 3 4
subshape 1 2 3
subshapeall
subshapeid
subshapes 1 2
suppress
suppresses
suppressfaces
suppressholes
suppressinternalwires
surface 1 2
surfacecontinuity
surfacemode
surfaces
symmetrical
symmetry 1 2
system 1 2


-take
tangent
target 1 2
tetrahedral
theendlcs
them
theobject
therefore
theshape
thestartlcs
thetolerance
times
tobezier
tol2d
tol3d
tolerance 1 2 3
tolerance2d
tolerance3d
tolerances
tools
torus
transform
transformation 1 2 3
transformations 1 2
transformed 1 2
translated
translation
translations 1 2
transparency
trihedron
trimsize
true 1 2 3
tui 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
tuple
two 1 2 3 4 5 6
type 1 2 3 4 5 6
typeofshape
types 1 2 3
-

-underlying
up 1 2 3
updated
upper
used 1 2 3
user 1 2 3 4
using 1 2 3 4 5 6 7 8 9 10


>> +tangent
target 1 2
tetrahedral
theendlcs
them
theobject
therefore
theshape
thestartlcs
thetolerance
times
tobezier
toggle
tol2d
tol3d
tolerance 1 2 3
tolerance2d
tolerance3d
tolerances
tools
torus


>> diff --git a/doc/salome/gui/GEOM/whgdata/whlstf5.htm b/doc/salome/gui/GEOM/whgdata/whlstf5.htm index 36d2e9ba8..833aebc0e 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstf5.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstf5.htm @@ -33,15 +33,17 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }

<<

- - -v1
v2
v3
v4
val
valid
validity
value 1 2 3 4 5 6 7
values 1 2 3 4 5 6 7
various
vector 1 2 3 4 5
vectors 1 2
vertex 1 2 3 4 5 6 7
vertex1
vertex2
vertexmaxtol
vertexmintol
vertices 1 2 3 4 5 6
view
viewer 1 2 3 4
viewers
visibility
visualization 1 2
volume
vtk
vx
+transform
transformation 1 2 3
transformations 1 2
transformed 1 2
translated
translation
translations 1 2
transparency
trihedron
trimsize
true 1 2 3
tui 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
tuple
two 1 2 3 4 5 6 7
type 1 2 3 4 5 6
typeofshape
types 1 2 3
+

+underlying
up 1 2 3
updated
upper
used 1 2 3 4
useful
user 1 2 3
using 1 2 3 4 5 6 7 8 9 10
+

+v1
v2
v3
v4
val
valid
validity
value 1 2 3 4 5 6 7
values 1 2 3 4 5 6 7
various
vector 1 2 3 4 5
vectors 1 2
vertex 1 2 3 4 5 6 7
vertex1
vertex2
vertexmaxtol
vertexmintol
vertices 1 2 3 4 5 6
via 1 2 3 4
view
viewer 1 2 3 4 5 6
viewers
visibility
visualization 1 2
volume
vtk
vx


-wantplanarface
water
waterdensity
weight
whatis
while
whose 1 2
wide
will 1 2 3 4 5
wire 1 2 3
wireframe
wires 1 2 3
within 1 2
work 1 2
working 1 2 3
+wantplanarface
water
waterdensity
weight
whatis
whether
while
whose 1 2
wide
will 1 2 3 4 5
wire 1 2 3
wireframe
wires 1 2 3
wish
within 1 2
work 1 2
working 1 2 3


x 1 2 3
x1
x2
xdx
xdy
xdz
xmax
xmin
xoy
xyz


-y 1 2 3
y1
y2
ydx
ydy
ydz
ymax
ymin
your 1 2 3
+y 1 2 3
y1
y2
ydx
ydy
ydz
ymax
ymin
your 1 2 3 4


z 1 2 3
z1
z2
zmax
zmin


diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl15.htm b/doc/salome/gui/GEOM/whgdata/whlstfl15.htm index 94e8a7bb0..4dadf293b 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstfl15.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstfl15.htm @@ -37,7 +37,7 @@ body {background-color:White; } -

^ RA RE RI RO ^

+

^ RA RE RI RO ^

diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl17.htm b/doc/salome/gui/GEOM/whgdata/whlstfl17.htm index 3943f8ecc..f42dc77f8 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstfl17.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstfl17.htm @@ -37,7 +37,7 @@ body {background-color:White; } -

^ TA TE TH TI TO TR TU TW TY ^

+

^ TA TE TH TI TO TR TU TW TY ^

diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl18.htm b/doc/salome/gui/GEOM/whgdata/whlstfl18.htm index d7e63c2f2..712520b5b 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstfl18.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstfl18.htm @@ -37,7 +37,7 @@ body {background-color:White; } -

^ UN UP US ^

+

^ UN UP US ^

diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl5.htm b/doc/salome/gui/GEOM/whgdata/whlstfl5.htm index 9385aa6eb..79523e7fb 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstfl5.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstfl5.htm @@ -37,7 +37,7 @@ body {background-color:White; } -

^ E ED EG EI EL EM EN EQ ER ET EX ^

+

^ E EA ED EG EI EL EM EN EQ ER ET EX ^

diff --git a/doc/salome/gui/GEOM/whgdata/whlstfl6.htm b/doc/salome/gui/GEOM/whgdata/whlstfl6.htm index 315a1ab33..01c54a6d8 100755 --- a/doc/salome/gui/GEOM/whgdata/whlstfl6.htm +++ b/doc/salome/gui/GEOM/whgdata/whlstfl6.htm @@ -37,7 +37,7 @@ body {background-color:White; } -

^ F FA FI FO FR FU ^

+

^ F FA FI FL FO FR FU ^

diff --git a/doc/salome/gui/GEOM/whgdata/whlsti0.htm b/doc/salome/gui/GEOM/whgdata/whlsti0.htm index 48844c087..a3aec907a 100755 --- a/doc/salome/gui/GEOM/whgdata/whlsti0.htm +++ b/doc/salome/gui/GEOM/whgdata/whlsti0.htm @@ -32,8 +32,6 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; } -

-

diff --git a/doc/salome/gui/GEOM/whgdata/whnvl31.htm b/doc/salome/gui/GEOM/whgdata/whnvl31.htm index 73da95b63..870e98ef4 100755 --- a/doc/salome/gui/GEOM/whgdata/whnvl31.htm +++ b/doc/salome/gui/GEOM/whgdata/whnvl31.htm @@ -37,35 +37,6 @@ body {background-color:White; } -

- # - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z -

diff --git a/doc/salome/gui/GEOM/whgdata/whnvt30.htm b/doc/salome/gui/GEOM/whgdata/whnvt30.htm index 04b361145..35e6ef5b8 100755 --- a/doc/salome/gui/GEOM/whgdata/whnvt30.htm +++ b/doc/salome/gui/GEOM/whgdata/whnvt30.htm @@ -37,7 +37,7 @@ img {vertial-align:middle;}
- +
diff --git a/doc/salome/gui/GEOM/whgdata/whnvt31.htm b/doc/salome/gui/GEOM/whgdata/whnvt31.htm index 5ffc8f328..53dd7e91c 100755 --- a/doc/salome/gui/GEOM/whgdata/whnvt31.htm +++ b/doc/salome/gui/GEOM/whgdata/whnvt31.htm @@ -35,7 +35,7 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }
- +
diff --git a/doc/salome/gui/GEOM/whgdata/whnvt32.htm b/doc/salome/gui/GEOM/whgdata/whnvt32.htm index 3caac9e94..464a4cc4a 100755 --- a/doc/salome/gui/GEOM/whgdata/whnvt32.htm +++ b/doc/salome/gui/GEOM/whgdata/whnvt32.htm @@ -35,7 +35,7 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }
- +
diff --git a/doc/salome/gui/GEOM/whgdata/whnvt33.htm b/doc/salome/gui/GEOM/whgdata/whnvt33.htm index 286463871..eb46f192b 100755 --- a/doc/salome/gui/GEOM/whgdata/whnvt33.htm +++ b/doc/salome/gui/GEOM/whgdata/whnvt33.htm @@ -35,7 +35,7 @@ A:hover {color:Navy; } A:hover {font-family:Tahoma; } A:hover {font-size:8pt; }
- +
diff --git a/doc/salome/gui/GEOM/whproj.htm b/doc/salome/gui/GEOM/whproj.htm index cb9a087dc..821daea24 100755 --- a/doc/salome/gui/GEOM/whproj.htm +++ b/doc/salome/gui/GEOM/whproj.htm @@ -14,7 +14,7 @@ setLangId("1033"); setDataPath("whdata"); addToc("whtoc.htm"); - addIdx("whidx.htm"); + addFts("whfts.htm"); addGlo("whglo.htm"); diff --git a/doc/salome/gui/GEOM/whproj.xml b/doc/salome/gui/GEOM/whproj.xml index 8125375e4..4bd4a8de7 100755 --- a/doc/salome/gui/GEOM/whproj.xml +++ b/doc/salome/gui/GEOM/whproj.xml @@ -1,3 +1,3 @@ - + diff --git a/doc/salome/gui/GEOM/whres.xml b/doc/salome/gui/GEOM/whres.xml index d47a2b7c8..f3f010a3f 100755 --- a/doc/salome/gui/GEOM/whres.xml +++ b/doc/salome/gui/GEOM/whres.xml @@ -81,7 +81,6 @@ - diff --git a/doc/salome/gui/GEOM/whskin_info.htm b/doc/salome/gui/GEOM/whskin_info.htm index f99a2d5e7..e8423087a 100755 --- a/doc/salome/gui/GEOM/whskin_info.htm +++ b/doc/salome/gui/GEOM/whskin_info.htm @@ -9,10 +9,10 @@ - + - +
Start Page geom.htm
Skin Name Default
Generating Time 16:19 11/25/2004
Generating Time 13:16 03/01/2005
Language ID 1033
Compile Script webhelp5_compile_script.xml
Compile Build Version 13.00.584
Compile Build Version 13.10.606
Product Name WebHelp 5.50
Authoring Tool Name RoboHelp X5
diff --git a/doc/salome/gui/GEOM/whskin_papplet.htm b/doc/salome/gui/GEOM/whskin_papplet.htm index 86eb2290d..5f8296ad6 100755 --- a/doc/salome/gui/GEOM/whskin_papplet.htm +++ b/doc/salome/gui/GEOM/whskin_papplet.htm @@ -36,7 +36,6 @@ function setShowPane(sName) gsInitPane=sName; } addPane("toc","whtdhtml.htm"); - addPane("idx","whidhtml.htm"); addPane("fts","whfdhtml.htm"); addPane("glo","whgdhtml.htm"); setShowPane("toc"); diff --git a/doc/salome/gui/GEOM/whskin_pdhtml.htm b/doc/salome/gui/GEOM/whskin_pdhtml.htm index eaf5c6d67..763aa1429 100755 --- a/doc/salome/gui/GEOM/whskin_pdhtml.htm +++ b/doc/salome/gui/GEOM/whskin_pdhtml.htm @@ -53,7 +53,6 @@ function writeWebHelpPane() var strProjectFileHTM = "whproj.htm"; addProject(bPreferXML, strProjectFileXML, strProjectFileHTM); addPane("toc","whtdhtml.htm"); - addPane("idx","whidhtml.htm"); addPane("fts","whfdhtml.htm"); addPane("glo","whgdhtml.htm"); setShowPane("toc"); diff --git a/doc/salome/gui/GEOM/whskin_tbars.htm b/doc/salome/gui/GEOM/whskin_tbars.htm index ecec5c12d..6cb490239 100755 --- a/doc/salome/gui/GEOM/whskin_tbars.htm +++ b/doc/salome/gui/GEOM/whskin_tbars.htm @@ -83,7 +83,6 @@ setButtonBgColor("searchform","", true); setButtonBgColor("banner","", true); addButton("toc",BTN_TEXT|BTN_IMG,"Contents","","","","",0,0,"","","","","",""); -addButton("idx",BTN_TEXT|BTN_IMG,"Index","","","","",0,0,"","","","","",""); addButton("fts",BTN_TEXT|BTN_IMG,"Search","","","","",0,0,"","","","","",""); addButton("glo",BTN_TEXT|BTN_IMG,"Glossary","","","","",0,0,"","","","","",""); addButton("searchform",BTN_TEXT,"","","","","",0,0,"","","","","",""); diff --git a/doc/salome/gui/GEOM/whstart.js b/doc/salome/gui/GEOM/whstart.js index 95ea404a0..7448a4792 100755 --- a/doc/salome/gui/GEOM/whstart.js +++ b/doc/salome/gui/GEOM/whstart.js @@ -31,7 +31,7 @@ function delayReload() } } -var gsToolbarOrder = "toc|idx|fts|glo|blankblock|searchform|banner"; +var gsToolbarOrder = "toc|fts|glo|blankblock|searchform|banner"; var gsMinibarOrder = "blankblock|hide2|"; var gsTopic = "files/introduction_to_geom.htm"; diff --git a/doc/salome/gui/GEOM/whxdata/whfts.xml b/doc/salome/gui/GEOM/whxdata/whfts.xml index 1b9c3053b..e57bfb026 100755 --- a/doc/salome/gui/GEOM/whxdata/whfts.xml +++ b/doc/salome/gui/GEOM/whxdata/whfts.xml @@ -1,8 +1,6 @@ - - - + diff --git a/doc/salome/gui/GEOM/whxdata/whfwdata0.xml b/doc/salome/gui/GEOM/whxdata/whfwdata0.xml index 51e07108d..6706ec0f9 100755 --- a/doc/salome/gui/GEOM/whxdata/whfwdata0.xml +++ b/doc/salome/gui/GEOM/whxdata/whfwdata0.xml @@ -2,6 +2,7 @@ 1,12, 1,15,3,4,7,5,11,12,13,10,9,16, + 9, 3,10, 3,11,12,13,10, 14,1,15,3,4,5,11,12,13,10,9, @@ -14,13 +15,14 @@ 13, 14,15,4,12,10, 15,7,12, - 14,12, + 14,12,9, 12, 12, 15,12, 15, 15, 15, + 13, 3,12, 12, 12, @@ -48,10 +50,11 @@ 6, 6, 14,3, - 6,12, + 14,15,6,12,16, 3, 3,7,11,13,9, 3, + 16, 7,11,12,13, 7, 7, @@ -60,7 +63,7 @@ 15,12, 14, 3,12, - 14,0,10, + 14,0,10,9, 2,4,5,9, 6, 9, @@ -68,6 +71,7 @@ 12, 9, 14,1,15,3,4,8,7,5,11,12,13,10,9,16, + 10, 2,8, 3,6,8, 12, @@ -85,6 +89,7 @@ 1, 12,10,9, 12,13, + 9, 9, 6,8,10, 3, @@ -100,20 +105,23 @@ 2,4,7,10, 15,3,13, 14,9, - 14,4,5,12,13,10, + 14,4,5,12,13,10,9, 7, 10,9, 11, 9, + 9, 8, 12, - 5,10, - 12, + 5,10,9, + 9, + 12,9, + 9, 14, 14,5,11, 2,4, 3,11,12,13,10, - 15,8,12, + 15,8,12,10, 8, 12, 12, @@ -129,7 +137,7 @@ 15, 14,15,3,6,7,5,11,12,13,10,9,16, 16, - 2,7,12,10, + 2,7,12,10,16, 15,6, 15,3,7,12, 12, @@ -141,11 +149,12 @@ 10, 10, 9, - 15, + 15,16, 15,3,11,12,13,10, 12,9, 7,12, 10, + 9, 15,7,12, 10, 10, @@ -190,7 +199,8 @@ 14, 14, 14, - 14,3,7,5,12,10, + 16, + 14,3,7,5,12,10,9, 12, 16, 9, @@ -200,14 +210,16 @@ 14, 3, 12, + 9, 15,3,12,13, 3,8, - 15,3,7,5,11,16, + 9, + 14,15,3,7,5,11,16, 15, 6, 6, 6, - 12, + 12,9, 5,12, 14,1,15,3,4,7,5,11,12,13,10,16, 12, @@ -215,6 +227,7 @@ 0,5,10, 2,8, 8, + 9, 10, 7, 7, @@ -224,7 +237,7 @@ 14, 14, 14, - 14,3,7,5,12,13,10, + 14,3,7,5,12,13,10,9, 10, 10, 9, @@ -240,12 +253,15 @@ 12, 12, 12, - 14,4,6,5, + 9, + 4,6,5,9, 2,8, 8, 14, 12, 2,5, + 14, + 15,16, 4, 12, 14, @@ -256,5 +272,497 @@ 14, 1,2,3,4,6,8,7,5,11,12,13,10,9,16, 12, + 14,15,3,4,8,7,5,11,12,13,10,9,16, + 4,5,9, + 12, + 12, + 16, + 5, + 1, + 3, + 3,5,12,13,10,9, + 12,10,9, + 6, + 9, + 10,16, + 10, + 3, + 16, + 5,12, + 7,11, + 14,10, + 14, + 6, + 12,9, + 12, + 6, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 9, + 1,6,5,12,10,16, + 5,12,10,9,16, + 2,8, + 13, + 2,6,8,9, + 8, + 13, + 12, + 4,6, + 10, + 9, + 9, + 13, + 9, + 9, + 12, + 10, + 10, + 10, + 12, + 10, + 14, + 12, + 10, + 10, + 14,2, + 12, + 9, + 12, + 12, + 1, + 1, + 7, + 12, + 9, + 9, + 9, + 14, + 13, + 3,5, + 3, + 3, + 15,12,9, + 12, + 10, + 15,3,10, + 15,3,7,5,12,10,16, + 10, + 12, + 5,12, + 10, + 10, + 10, + 3,5,12,10, + 10, + 10, + 12, + 15,3,13, + 3, + 3,8,13, + 15, + 15,12, + 14,0,15,3,4,6,7,5,11,12,13,10,9,16, + 16, + 3,11, + 13,10,16, + 3, + 3, + 10, + 4, + 11, + 9, + 10, + 10, + 3, + 5, + 11, + 11, + 5, + 3, + 5, + 7, + 10, + 12, + 14, + 14, + 3, + 3, + 3, + 13, + 13, + 13, + 10, + 10, + 13, + 13, + 13, + 10, + 7, + 3, + 3, + 13, + 7, + 14, + 14, + 14, + 7, + 13, + 13, + 12, + 5, + 15, + 5, + 11, + 11, + 13, + 3, + 3, + 5, + 3, + 9, + 10, + 9, + 7,12,10, + 7, + 7,12,10,9, + 12,10, + 10, + 12, + 12, + 15,13, + 9, + 9, + 14, + 14,0,1,15,3,4,6,8,7,5,11,12,13,10,9,16, + 12, + 14,10, + 10, + 5, + 3, + 7,10,9, + 7, + 9, + 7,10,9, + 10, + 10, + 3,11, + 13, + 1,12, + 2,10, + 3,12,13, + 12,13, + 13, + 2,6, + 9, + 13, + 16, + 0,13,10, + 10, + 12,13,9, + 14,3,4,8,7,5,11,12,13,10, + 7, + 12, + 13,10, + 13, + 13, + 10, + 10, + 15,6,12,9, + 12, + 13, + 12, + 14,15,3,7,5,11,12,16, + 3, + 12, + 3,7,13, + 14, + 1,7,12,13,10, + 10, + 10, + 1,2,3,4,6,8,7,5,11,12,13,10,9,16, + 1,6,12,16, + 12, + 16, + 13, + 3,8, + 15,3,4,6,12,13,10, + 12, + 12, + 14,2,4,6,7,12,13,10,16, + 12, + 11, + 2, + 0, + 12,9, + 14,3, + 3,11, + 12,13, + 10, + 15,3, + 3, + 15,3, + 3,5,12, + 1,15,3,7,12, + 12, + 4,11, + 10, + 3, + 7, + 7, + 13, + 10,16, + 15, + 7, + 15,3,13,10, + 15,3,5, + 16, + 10, + 14,15,3,11,12,13,9, + 3, + 3, + 3, + 9, + 3, + 1,6, + 3,12, + 12, + 6,12,10,9, + 12, + 15, + 16, + 3, + 3, + 15, + 2,11, + 9, + 7, + 12, + 12,10, + 12, + 16, + 10, + 10, + 1,9, + 10, + 9, + 14,3,9, + 12, + 15,3,11,10, + 3,11, + 11, + 11, + 3,11, + 3,11, + 2,12, + 12, + 6, + 10, + 3, + 3, + 15, + 12,13,16, + 16, + 10, + 2,12, + 13, + 3, + 5, + 6,8,12, + 12, + 12, + 15,12, + 12, + 14,15,3,4,7,5,11,12,13,10,9,16, + 12, + 5,12, + 5,12,10,9,16, + 13, + 7,12, + 1,6, + 7,13, + 13, + 3,5,12,13,10,16, + 2,16, + 15,12, + 12, + 9, + 13, + 8,9, + 8, + 4,11,13,10, + 4,10, + 15,12, + 0,1,15,3,4,6,8,7,5,11,12,10,9,16, + 15,3,10, + 10, + 3,7, + 1,3,12,13,10, + 1, + 1, + 1, + 12, + 6, + 1, + 1,2,4,6,8,7,5,12,13,10,9,16, + 4,9, + 4,9, + 12, + 10,16, + 12, + 5,12,13, + 14,7,5,13, + 1, + 12,9, + 3, + 3, + 13, + 14, + 3,12,10, + 15, + 3,12, + 14,7,5,11,13,10, + 3, + 3,9, + 3,12,10, + 14, + 12,13, + 11, + 3, + 12, + 12, + 12, + 12, + 12, + 14, + 8, + 15,3,13, + 2,8,13, + 13, + 13, + 15,8, + 12, + 6, + 5,12,16, + 0,5,12,9, + 5,10,16, + 5, + 16, + 12, + 12, + 12, + 12, + 12,13,9, + 12, + 12, + 13, + 11,13, + 3,13, + 15, + 15,10, + 14, + 13, + 12, + 13, + 15, + 12, + 13, + 12, + 13, + 12, + 16, + 7, + 7, + 7,12,9, + 12, + 12, + 9, + 11, + 4,13,10, + 0,2,13,10, + 13, + 13,10, + 1, + 3, + 3, + 12,10,9, + 14,1,15,3,4,6,8,7,5,11,12,13,10,9,16, + 9, + 14,4,11,12,13,10,9, + 15,4,5,11,12,10,9,16, + 5, + 12, + 1,6,11,10, + 3, + 14,2,15,3,4,6,7,5,12,13,10,9,16, + 16, + 14, + 14, + 14, + 14, + 12, + 9, + 9, + 1,15,3,7,11,12,13,10,9, + 12, + 15,3,7,11,13, + 3,7,5,11,12,13,9, + 5, + 5, + 9, + 9, + 14,3,5,11,12,13, + 14,15,13,16, + 1,3,6,12,9,16, + 6, + 6, + 1,6, + 9, + 6, + 15, + 5, + 10, + 10, + 10, + 9, + 9, + 12, + 5,9, + 2, + 3,8,12,13,10, + 14,7,5,12, + 1, + 8, + 1,12, + 15,3,6,12,16, + 15,3,9, + 11, + 11, + 3, + 3, + 3, + 9, + 9, + 15, + 3, + 15,3,9, + 11, + 11, + 3, + 3, + 3, + 9, + 9, + 8,12,9,16, + 3,10,9, + 11, + 11, + 9, + 9, diff --git a/doc/salome/gui/GEOM/working_with_groups.htm b/doc/salome/gui/GEOM/working_with_groups.htm index c5b89f8df..09f15c3e1 100755 --- a/doc/salome/gui/GEOM/working_with_groups.htm +++ b/doc/salome/gui/GEOM/working_with_groups.htm @@ -81,12 +81,21 @@ else

Working with groups

+

The Salome platform offers + such a useful functionality as creation and editing groups of subshapes + of a geometrical object which makes handling subshapes much easier. However + the functionality is available in the OCC viewer only. If other viewer + is used in your project by default, you can toggle the OCC viewer via + Preferences / Viewer background / OCC viewer.  

+ +

 

+

To perform operations with groups:

 

In the main menu select New - entity > Groups.

+ entity > Group.

 

@@ -104,9 +113,10 @@ else

 

-

TUI Command: geompy.CreateGroup(MainShape, - ShapeType), where MainShape is a shape for which the group is created, - ShapeType is a type of shapes in the created group.

+

TUI Command: + geompy.CreateGroup(MainShape, ShapeType), + where MainShape is a shape for which the group is created, ShapeType is + a type of shapes in the created group.

 

@@ -149,7 +159,8 @@ else

 

-

TUI Command:

+

TUI Command: +

    diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 4e948ae5e..5615e85fc 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -2046,6 +2046,18 @@ module GEOM * \param theObject is a GEOM object which IOR is requested */ string GetStringFromIOR (in GEOM_Object theObject); + + /*! + * Returns a name with which a GEOM object was dumped into python script + * \param theStudyEntry is an entry of the GEOM object in the study + */ + string GetDumpName (in string theStudyEntry); + + /*! + * Returns all names with which a GEOM objects was dumped + * into python script to avoid the same names in SMESH script + */ + string_array GetAllDumpNames(); }; }; diff --git a/resources/GEOMCatalog.xml b/resources/GEOMCatalog.xml index b4afaf626..7d301670e 100644 --- a/resources/GEOMCatalog.xml +++ b/resources/GEOMCatalog.xml @@ -16,7 +16,7 @@ Geometry Geom NRI - 2.2.0 + 2.2.2 Geometry component 1 ModuleGeom.png @@ -526,7 +526,7 @@ GEOM_Superv OTHER mkr - 2.2.0 + 2.2.2 Supervision wrapper for Geometry component 1 diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index b01d6c7ae..b7ffcbf18 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -30,14 +30,13 @@ using namespace std; #include "BasicGUI.h" #include "GeometryGUI.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include "OCCViewer_AISSelector.h" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" +#include "SUIT_ViewWindow.h" +#include "OCCViewer_ViewWindow.h" +#include "OCCViewer_ViewModel.h" +#include "OCCViewer_ViewManager.h" #include "OCCViewer_ViewPort3d.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" - #include "utilities.h" #include @@ -63,10 +62,10 @@ BasicGUI* BasicGUI::myGUIObject = 0; // function : GetBasicGUI() // purpose : Get the only BasicGUI object [ static ] //======================================================================= -BasicGUI* BasicGUI::GetBasicGUI() +BasicGUI* BasicGUI::GetBasicGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { - myGUIObject = new BasicGUI(); + myGUIObject = new BasicGUI( parent ); } return myGUIObject; } @@ -75,8 +74,8 @@ BasicGUI* BasicGUI::GetBasicGUI() // function : BasicGUI() // purpose : Constructor //======================================================================= -BasicGUI::BasicGUI() : - GEOMGUI() +BasicGUI::BasicGUI( GeometryGUI* parent ) : + GEOMGUI(parent) { } @@ -94,55 +93,45 @@ BasicGUI::~BasicGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool BasicGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; switch ( theCommandID ) { case 4011: // POINT - { - Handle(AIS_InteractiveContext) ic; - QAD_StudyFrame* aFrame = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame(); - if ( aFrame->getTypeView() == VIEW_OCC) - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)aFrame->getRightFrame()->getViewFrame())->getViewer(); - ic = v3d->getAISContext(); - } - aDlg = new BasicGUI_PointDlg( parent, "", Sel ); - break; - } + aDlg = new BasicGUI_PointDlg( getGeometryGUI(), parent, "" ); + break; case 4012: // LINE - aDlg = new BasicGUI_LineDlg(parent, "", Sel); + aDlg = new BasicGUI_LineDlg( getGeometryGUI(), parent, "" ); break; case 4013: // CIRCLE - aDlg = new BasicGUI_CircleDlg(parent, "", Sel); + aDlg = new BasicGUI_CircleDlg( getGeometryGUI(), parent, ""); break; case 4014: // ELLIPSE - aDlg = new BasicGUI_EllipseDlg(parent, "", Sel); + aDlg = new BasicGUI_EllipseDlg( getGeometryGUI(), parent, "" ); break; case 4015: // ARC - aDlg = new BasicGUI_ArcDlg(parent, "", Sel); + aDlg = new BasicGUI_ArcDlg( getGeometryGUI(), parent, "" ); break ; case 4016: // VECTOR - aDlg = new BasicGUI_VectorDlg(parent, "", Sel); + aDlg = new BasicGUI_VectorDlg( getGeometryGUI(), parent, "" ); break; case 4017: // PLANE - aDlg = new BasicGUI_PlaneDlg(parent, "", Sel); + aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent, ""); break; case 4018: // WORKING PLANE - aDlg = new BasicGUI_WorkingPlaneDlg(parent, "", Sel); + aDlg = new BasicGUI_WorkingPlaneDlg( getGeometryGUI(), parent, "" ); break; case 4019: // CURVE - aDlg = new BasicGUI_CurveDlg( parent, "", Sel ); + aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent, "" ); break; case 4020: // REPAIR - aDlg = new BasicGUI_MarkerDlg( parent, Sel ); + aDlg = new BasicGUI_MarkerDlg( getGeometryGUI(), parent ); break; default: - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } @@ -157,42 +146,42 @@ bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) // function : 0nMousePress() // purpose : [static] manage mouse events //================================================================================= -bool BasicGUI::OnMousePress( QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* theFrame ) +bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow ) { - QDialog* aDlg = GeometryGUI::GetGeomGUI()->GetActiveDialogBox(); + QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox(); // Create Point dialog, OCC viewer - if ( aDlg && aDlg->isA( "BasicGUI_PointDlg" ) && theFrame->getTypeView() == VIEW_OCC && pe->state() != Qt::ControlButton ) + if ( aDlg && aDlg->isA( "BasicGUI_PointDlg" ) && theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() && pe->state() != Qt::ControlButton ) { BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg; if ( aPntDlg->acceptMouseEvent() ) - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)theFrame->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - + { + OCCViewer_Viewer* anOCCViewer = ((OCCViewer_ViewManager*)(theViewWindow->getViewManager()))->getOCCViewer(); + Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); + gp_Pnt aPnt; ic->InitSelected(); if( pe->state() == Qt::ShiftButton ) - v3d->getAISSelector()->shiftSelect(); // Append selection + ic->ShiftSelect(); // Append selection else - v3d->getAISSelector()->select(); // New selection + ic->Select(); // New selection ic->InitSelected(); if( ic->MoreSelected() ) - { - TopoDS_Shape aShape = ic->SelectedShape(); - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) - aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); - } + { + TopoDS_Shape aShape = ic->SelectedShape(); + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); + } else - { - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)theFrame->getRightFrame()->getViewFrame())->getViewPort(); - aPnt = ConvertClickToPoint( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() ); - } + { + OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort(); + aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() ); + } aPntDlg->OnPointSelected( aPnt ); // "feed" the point to point construction dialog - } // acceptMouseEvent() + } // acceptMouseEvent() } return false; } @@ -229,8 +218,8 @@ gp_Pnt BasicGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return BasicGUI::GetBasicGUI(); + return BasicGUI::GetBasicGUI( parent ); } } diff --git a/src/BasicGUI/BasicGUI.h b/src/BasicGUI/BasicGUI.h index 418f446ed..29fbf1fe3 100644 --- a/src/BasicGUI/BasicGUI.h +++ b/src/BasicGUI/BasicGUI.h @@ -33,6 +33,7 @@ #include "GEOMBase.h" #include + //================================================================================= // class : BasicGUI // purpose : @@ -40,16 +41,16 @@ class BasicGUI : public GEOMGUI { protected: - BasicGUI(); // hide constructor to avoid direct creation + BasicGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~BasicGUI(); // Get the only BasicGUI object - static BasicGUI* GetBasicGUI(); + static BasicGUI* GetBasicGUI( GeometryGUI* parent ); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); + bool OnMousePress(QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow); gp_Pnt ConvertClickToPoint( int x, int y, Handle(V3d_View) aView ); diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 2c1dbc537..06ed13b55 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -28,7 +28,13 @@ #include "BasicGUI_ArcDlg.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + #include #include #include @@ -47,11 +53,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_ArcDlg::BasicGUI_ArcDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_ArcDlg::BasicGUI_ArcDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI() { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARC"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_ARC_TITLE")); @@ -97,7 +104,7 @@ BasicGUI_ArcDlg::~BasicGUI_ArcDlg() void BasicGUI_ArcDlg::Init() { /* init variables */ - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); globalSelection( GEOM_POINT ); myEditCurrentArgument = Group3Pnts->LineEdit1; @@ -107,8 +114,8 @@ void BasicGUI_ArcDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -121,7 +128,8 @@ void BasicGUI_ArcDlg::Init() connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_ARC" ) ); } @@ -176,7 +184,7 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); @@ -186,7 +194,7 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -240,9 +248,10 @@ void BasicGUI_ArcDlg::LineEditReturnPressed() void BasicGUI_ArcDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); globalSelection( GEOM_POINT ); myEditCurrentArgument = Group3Pnts->LineEdit1; @@ -260,7 +269,7 @@ void BasicGUI_ArcDlg::ActivateThisDialog() //================================================================================= void BasicGUI_ArcDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -280,7 +289,7 @@ void BasicGUI_ArcDlg::enterEvent(QEvent* e) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation() { - return getGeomEngine()->GetICurvesOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); } //================================================================================= @@ -289,7 +298,7 @@ GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation() //================================================================================= static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) { - return thePnt1->_is_equivalent( thePnt2 ); + return thePnt1->_is_equivalent( thePnt2 ); } //================================================================================= @@ -299,7 +308,7 @@ static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje bool BasicGUI_ArcDlg::isValid( QString& msg ) { return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); } //================================================================================= @@ -309,8 +318,8 @@ bool BasicGUI_ArcDlg::isValid( QString& msg ) bool BasicGUI_ArcDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArc( myPoint1, myPoint2, myPoint3 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); return true; } @@ -320,6 +329,6 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_ArcDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_ArcDlg.h b/src/BasicGUI/BasicGUI_ArcDlg.h index b34721521..f57313872 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.h +++ b/src/BasicGUI/BasicGUI_ArcDlg.h @@ -41,7 +41,7 @@ class BasicGUI_ArcDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_ArcDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~BasicGUI_ArcDlg(); protected: @@ -56,6 +56,8 @@ private : void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; DlgRef_3Sel_QTD* Group3Pnts; diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 105e3becd..503489d1b 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -28,8 +28,12 @@ #include "BasicGUI_CircleDlg.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -42,12 +46,13 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_CircleDlg::BasicGUI_CircleDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_CircleDlg::BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PV"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PNTS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PV"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CIRCLE_PNTS"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_CIRCLE_TITLE")); @@ -110,11 +115,11 @@ void BasicGUI_CircleDlg::Init() myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double aStep = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ GroupPntVecR->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, aStep, 3); @@ -122,8 +127,8 @@ void BasicGUI_CircleDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -139,9 +144,10 @@ void BasicGUI_CircleDlg::Init() connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPntVecR->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntVecR->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntVecR->SpinBox_DX, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_CIRCLE" ) ); @@ -155,39 +161,40 @@ void BasicGUI_CircleDlg::Init() //================================================================================= void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) { - disconnect( mySelection, 0, this, 0 ); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); switch ( constructorId ) { case 0: { - Group3Pnts->hide(); - resize(0, 0); - GroupPntVecR->show(); - - myEditCurrentArgument = GroupPntVecR->LineEdit1; - GroupPntVecR->LineEdit1->setText(""); - GroupPntVecR->LineEdit2->setText(""); - break; + Group3Pnts->hide(); + resize(0, 0); + GroupPntVecR->show(); + + myEditCurrentArgument = GroupPntVecR->LineEdit1; + GroupPntVecR->LineEdit1->setText(""); + GroupPntVecR->LineEdit2->setText(""); + break; } - case 1: - { - GroupPntVecR->hide(); - resize( 0, 0 ); - Group3Pnts->show(); - - myEditCurrentArgument = Group3Pnts->LineEdit1; - Group3Pnts->LineEdit1->setText(""); - Group3Pnts->LineEdit2->setText(""); - Group3Pnts->LineEdit3->setText(""); - break; + case 1: + { + GroupPntVecR->hide(); + resize( 0, 0 ); + Group3Pnts->show(); + + myEditCurrentArgument = Group3Pnts->LineEdit1; + Group3Pnts->LineEdit1->setText(""); + Group3Pnts->LineEdit2->setText(""); + Group3Pnts->LineEdit3->setText(""); + break; } } myEditCurrentArgument->setFocus(); - globalSelection( GEOM_POINT ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + globalSelection( GEOM_POINT ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } //================================================================================= @@ -231,7 +238,7 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); @@ -243,7 +250,7 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -308,9 +315,10 @@ void BasicGUI_CircleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_POINT ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); ConstructorsClicked( getConstructorId() ); } @@ -332,7 +340,7 @@ void BasicGUI_CircleDlg::enterEvent(QEvent* e) //================================================================================= void BasicGUI_CircleDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -360,7 +368,7 @@ double BasicGUI_CircleDlg::getRadius() const //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_CircleDlg::createOperation() { - return getGeomEngine()->GetICurvesOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); } //================================================================================= @@ -369,7 +377,7 @@ GEOM::GEOM_IOperations_ptr BasicGUI_CircleDlg::createOperation() //================================================================================= static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 ) { - return thePnt1->_is_equivalent( thePnt2 ); + return thePnt1->_is_equivalent( thePnt2 ); } //================================================================================= @@ -378,13 +386,13 @@ static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje //================================================================================= bool BasicGUI_CircleDlg::isValid( QString& msg ) { - const int id = getConstructorId(); - if ( id == 0 ) - return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; - else if ( id == 1 ) - return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && - !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); - return false; + const int id = getConstructorId(); + if ( id == 0 ) + return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0; + else if ( id == 1 ) + return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() && + !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ); + return false; } //================================================================================= @@ -394,9 +402,9 @@ bool BasicGUI_CircleDlg::isValid( QString& msg ) bool BasicGUI_CircleDlg::execute( ObjectList& objects ) { bool res = false; - + GEOM::GEOM_Object_var anObj; - + switch ( getConstructorId() ) { case 0 : @@ -408,10 +416,10 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) res = true; break; } - + if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } @@ -421,7 +429,7 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_CircleDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_CircleDlg.h b/src/BasicGUI/BasicGUI_CircleDlg.h index a44c5df83..69fc638b1 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.h +++ b/src/BasicGUI/BasicGUI_CircleDlg.h @@ -35,8 +35,8 @@ #include "BasicGUI.h" -#include "GEOM_EdgeFilter.hxx" -#include "GEOM_ShapeTypeFilter.hxx" +//#include "GEOM_EdgeFilter.hxx" +//#include "GEOM_ShapeTypeFilter.hxx" #include @@ -49,7 +49,7 @@ class BasicGUI_CircleDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_CircleDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_CircleDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_CircleDlg(); protected: @@ -65,6 +65,8 @@ private : void enterEvent(QEvent* e); double getRadius() const; + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3; DlgRef_2Sel1Spin* GroupPntVecR; diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 245fe07a8..e5c92ee2e 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -27,8 +27,13 @@ #include "BasicGUI_CurveDlg.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + #include "utilities.h" #include "SALOME_ListIteratorOfListIO.hxx" @@ -45,14 +50,15 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_CurveDlg::BasicGUI_CurveDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_CurveDlg::BasicGUI_CurveDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POLYLINE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPLINE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER"))); - - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POLYLINE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPLINE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER"))); + + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_CURVE_TITLE")); @@ -100,8 +106,8 @@ void BasicGUI_CurveDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -110,7 +116,8 @@ void BasicGUI_CurveDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_CURVE" ) ); ConstructorsClicked( 0 ); @@ -201,22 +208,22 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() Standard_Boolean aRes = Standard_False; int i = 0; - myPoints->length( mySelection->IObjectCount() ); // this length may be greater than number of objects, + myPoints->length( IObjectCount() ); // this length may be greater than number of objects, // that will actually be put into myPoints - for ( SALOME_ListIteratorOfListIO anIt( mySelection->StoredIObjects() ); anIt.More(); anIt.Next() ) + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) { GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { //TopoDS_Shape aPointShape; //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) ) - myPoints[i++] = aSelectedObject; + myPoints[i++] = aSelectedObject; } } myPoints->length( i ); // this is the right length, smaller of equal to the previously set if ( i ) GroupPoints->LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) ); - + displayPreview(); } @@ -228,9 +235,10 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() void BasicGUI_CurveDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); globalSelection( GEOM_POINT ); ConstructorsClicked( getConstructorId() ); @@ -242,7 +250,7 @@ void BasicGUI_CurveDlg::ActivateThisDialog() //================================================================================= void BasicGUI_CurveDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -262,7 +270,7 @@ void BasicGUI_CurveDlg::enterEvent(QEvent* e) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation() { - return getGeomEngine()->GetICurvesOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); } //================================================================================= @@ -312,7 +320,7 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_CurveDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_CurveDlg.h b/src/BasicGUI/BasicGUI_CurveDlg.h index 24cee9eaf..a54e07dd4 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.h +++ b/src/BasicGUI/BasicGUI_CurveDlg.h @@ -33,7 +33,7 @@ #include "BasicGUI.h" -#include "GEOM_ShapeTypeFilter.hxx" +//#include "GEOM_ShapeTypeFilter.hxx" //================================================================================= // class : BasicGUI_CurveDlg @@ -44,7 +44,7 @@ class BasicGUI_CurveDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_CurveDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_CurveDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_CurveDlg(); protected: @@ -59,6 +59,8 @@ private : void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + DlgRef_1Sel_QTD* GroupPoints; GEOM::ListOfGO_var myPoints; diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 9f8d5bb90..85cf7a7e1 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -26,8 +26,13 @@ // $Header$ #include "BasicGUI_EllipseDlg.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -42,11 +47,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ELLIPSE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ELLIPSE_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_ELLIPSE_TITLE")); @@ -96,11 +101,12 @@ void BasicGUI_EllipseDlg::Init() myPoint = myDir = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double aMajorR( 200. ), aMinorR( 100. ); /* min, max, step and decimals for spin boxes & initial values */ @@ -111,8 +117,8 @@ void BasicGUI_EllipseDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -126,10 +132,11 @@ void BasicGUI_EllipseDlg::Init() connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_ELLIPSE" ) ); } @@ -184,7 +191,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); @@ -192,7 +199,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() } Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -246,7 +253,8 @@ void BasicGUI_EllipseDlg::LineEditReturnPressed() void BasicGUI_EllipseDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -264,7 +272,7 @@ void BasicGUI_EllipseDlg::ActivateThisDialog() //================================================================================= void BasicGUI_EllipseDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -293,7 +301,7 @@ void BasicGUI_EllipseDlg::ValueChangedInSpinBox(double newValue) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_EllipseDlg::createOperation() { - return getGeomEngine()->GetICurvesOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetICurvesOperations( getStudyId() ); } //================================================================================= @@ -334,7 +342,7 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_EllipseDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.h b/src/BasicGUI/BasicGUI_EllipseDlg.h index 21491d29e..8a1dcf841 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.h +++ b/src/BasicGUI/BasicGUI_EllipseDlg.h @@ -33,8 +33,8 @@ #include "BasicGUI.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" +//#include "GEOM_ShapeTypeFilter.hxx" +//#include "GEOM_EdgeFilter.hxx" #include //================================================================================= @@ -46,7 +46,7 @@ class BasicGUI_EllipseDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_EllipseDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_EllipseDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_EllipseDlg(); protected: @@ -61,6 +61,8 @@ private : void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myPoint, myDir; DlgRef_2Sel2Spin* GroupPoints; diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index fe435dc53..308f66146 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -28,7 +28,12 @@ #include "BasicGUI_LineDlg.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -43,11 +48,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_LineDlg::BasicGUI_LineDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_LineDlg::BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_2P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_LINE_TITLE")); @@ -94,13 +99,13 @@ void BasicGUI_LineDlg::Init() myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); globalSelection( GEOM_POINT ); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -111,8 +116,9 @@ void BasicGUI_LineDlg::Init() connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + initName( tr("GEOM_LINE") ); } @@ -144,7 +150,7 @@ bool BasicGUI_LineDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); return true; } @@ -158,7 +164,7 @@ void BasicGUI_LineDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil(); @@ -167,14 +173,14 @@ void BasicGUI_LineDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject; else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject; } - + displayPreview(); } @@ -214,9 +220,10 @@ void BasicGUI_LineDlg::LineEditReturnPressed() void BasicGUI_LineDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); globalSelection( GEOM_POINT ); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -233,7 +240,7 @@ void BasicGUI_LineDlg::ActivateThisDialog() //================================================================================= void BasicGUI_LineDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -253,7 +260,7 @@ void BasicGUI_LineDlg::enterEvent(QEvent* e) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_LineDlg::createOperation() { - return getGeomEngine()->GetIBasicOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); } //================================================================================= @@ -272,8 +279,8 @@ bool BasicGUI_LineDlg::isValid( QString& msg ) bool BasicGUI_LineDlg::execute( ObjectList& objects ) { GEOM::GEOM_Object_var anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakeLineTwoPnt( myPoint1, myPoint2 ); - if ( !anObj->_is_nil() ) - objects.push_back( anObj._retn() ); + if ( !anObj->_is_nil() ) + objects.push_back( anObj._retn() ); return true; } @@ -283,7 +290,7 @@ bool BasicGUI_LineDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_LineDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_LineDlg.h b/src/BasicGUI/BasicGUI_LineDlg.h index 82daf2f61..92d373c99 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.h +++ b/src/BasicGUI/BasicGUI_LineDlg.h @@ -42,7 +42,7 @@ class BasicGUI_LineDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_LineDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_LineDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_LineDlg(); protected: @@ -57,6 +57,8 @@ private : void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myPoint1; GEOM::GEOM_Object_var myPoint2; diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 3cabd35f8..a276a0655 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -28,11 +28,14 @@ #include "BasicGUI_MarkerDlg.h" #include "DlgRef_SpinBox.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "VTKViewer_ViewFrame.h" -#include "OCCViewer_ViewFrame.h" -#include "QAD_Config.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + #include "GEOMImpl_Types.hxx" #include "utilities.h" @@ -54,14 +57,14 @@ // class : BasicGUI_MarkerDlg() // purpose : Constructor //================================================================================= -BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( QWidget* theParent, SALOME_Selection* theSel ) -: GEOMBase_Skeleton( theParent, "BasicGUI_MarkerDlg", theSel, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* theParent ) +: GEOMBase_Skeleton( theParent, "BasicGUI_MarkerDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap iconCS1 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) ); - QPixmap iconCS2 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) ); - QPixmap iconCS3 ( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) ); - QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap iconCS1 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER" ) ) ); + QPixmap iconCS2 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER2" ) ) ); + QPixmap iconCS3 ( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_MARKER3" ) ) ); + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); setCaption( tr( "CAPTION" ) ); @@ -116,7 +119,7 @@ BasicGUI_MarkerDlg::BasicGUI_MarkerDlg( QWidget* theParent, SALOME_Selection* th Layout1->addWidget( Group1, 2, 0 ); Layout1->addWidget( Group2, 2, 0 ); - Init( theSel ); + Init(); } @@ -133,7 +136,7 @@ BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg() // function : Init() // purpose : //================================================================================= -void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel ) +void BasicGUI_MarkerDlg::Init() { myBlockPreview = false; myConstructorId = -1; @@ -142,9 +145,7 @@ void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel ) Group2->LineEdit1->setReadOnly( true ); Group2->LineEdit2->setReadOnly( true ); Group2->LineEdit3->setReadOnly( true ); - - GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI(); - + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -157,20 +158,23 @@ void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel ) connect(Group2->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( onClose() ) ); - connect( aGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); - connect( aGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) ); + connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ); + connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onClose() ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( onOk() ) ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) ); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); initName( tr( "LCS_NAME" ) ); - QString aStr = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter ) { - anIter.data()->RangeStepAndValidator( -999.999, 999.999, aStr.toDouble(), 3 ); + anIter.data()->RangeStepAndValidator( -999.999, 999.999, step, 3 ); connect( anIter.data(), SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged( double ) ) ); } @@ -184,6 +188,9 @@ void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel ) ConstructorsClicked( 0 ); + + //@ + /* QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); @@ -197,6 +204,7 @@ void BasicGUI_MarkerDlg::Init( SALOME_Selection* theSel ) OCCViewer_ViewFrame* aOCCFrame = dynamic_cast( aFrame ); if ( aOCCFrame ) aOCCFrame->AdjustTrihedrons( true ); + */ } //================================================================================= @@ -215,7 +223,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) myConstructorId = constructorId; - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); switch (constructorId) { @@ -257,7 +265,8 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) } } - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionDone())); onSelectionDone(); } @@ -301,11 +310,11 @@ bool BasicGUI_MarkerDlg::onApply() //================================================================================= void BasicGUI_MarkerDlg::onSelectionDone0() { - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { Standard_Boolean aRes = Standard_False; - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( aRes && !aSelectedObj->_is_nil() ) @@ -336,24 +345,22 @@ void BasicGUI_MarkerDlg::onSelectionDone0() myData[ DX2 ]->SetValue( aYDir.X() ); myData[ DY2 ]->SetValue( aYDir.Y() ); myData[ DZ2 ]->SetValue( aYDir.Z() ); - //mySelection->ClearIObjects(); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected(); } } else { - if ( mySelection->HasIndex( anIO ) ) + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + if ( aMap.Extent() == 1 ) { - TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); - if ( aMap.Extent() == 1 ) - { - int anIndex = aMap( 1 ); - TopTools_IndexedMapOfShape aShapes; - TopExp::MapShapes( aShape, aShapes ); - aShape = aShapes.FindKey( anIndex ); - //mySelection->ClearIObjects(); - } - } + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected(); + } + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { @@ -387,9 +394,9 @@ void BasicGUI_MarkerDlg::onSelectionDone() myEditCurrentArgument->setText(""); QString aName; - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aRes = Standard_False; - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( aSelectedObj ) && aRes ) { @@ -397,16 +404,18 @@ void BasicGUI_MarkerDlg::onSelectionDone() TopoDS_Shape aShape; if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) { GEOM::short_array anIndexes; - if ( mySelection->HasIndex( anIO ) ) { - TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); + + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) { int anIndex = aMap( 1 ); TopTools_IndexedMapOfShape aShapes; TopExp::MapShapes( aShape, aShapes ); aShape = aShapes.FindKey( anIndex ); } - if ( getConstructorId() == 1 ) { + if ( getConstructorId() == 1 ) { if ( !aShape.IsNull() ) { gp_Pnt aPnt; if (aShape.ShapeType() == TopAbs_VERTEX) { @@ -423,7 +432,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() aPnt = aSystem.CentreOfMass(); } - + gp_Ax3 anAx3; anAx3.Transform(aShape.Location().Transformation()); if(aShape.ShapeType() == TopAbs_FACE) { @@ -434,33 +443,33 @@ void BasicGUI_MarkerDlg::onSelectionDone() anAx3 = aPln.Position(); } } - + gp_Dir aDirX = anAx3.XDirection(); gp_Dir aDirY = anAx3.YDirection(); - + myData[ X ]->SetValue( aPnt.X() ); myData[ Y ]->SetValue( aPnt.Y() ); myData[ Z ]->SetValue( aPnt.Z() ); - + myData[ DX1 ]->SetValue( aDirX.X() ); myData[ DY1 ]->SetValue( aDirX.Y() ); myData[ DZ1 ]->SetValue( aDirX.Z() ); - + myData[ DX2 ]->SetValue( aDirY.X() ); myData[ DY2 ]->SetValue( aDirY.Y() ); myData[ DZ2 ]->SetValue( aDirY.Z() ); - + myEditCurrentArgument->setText( aName ); } else { myData[ X ]->SetValue( 0 ); myData[ Y ]->SetValue( 0 ); myData[ Z ]->SetValue( 0 ); - + myData[ DX1 ]->SetValue( 0 ); myData[ DY1 ]->SetValue( 0 ); myData[ DZ1 ]->SetValue( 0 ); - + myData[ DX2 ]->SetValue( 0 ); myData[ DY2 ]->SetValue( 0 ); myData[ DZ2 ]->SetValue( 0 ); @@ -486,7 +495,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); gp_Dir aDir(gp_Vec(aP1, aP2)); - + myData[ DX1 ]->SetValue( aDir.X() ); myData[ DY1 ]->SetValue( aDir.Y() ); myData[ DZ1 ]->SetValue( aDir.Z() ); @@ -503,7 +512,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(aShape))); gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(aShape))); gp_Dir aDir(gp_Vec(aP1, aP2)); - + myData[ DX2 ]->SetValue( aDir.X() ); myData[ DY2 ]->SetValue( aDir.Y() ); myData[ DZ2 ]->SetValue( aDir.Z() ); @@ -524,11 +533,11 @@ void BasicGUI_MarkerDlg::onSelectionDone() myData[ X ]->SetValue( 0 ); myData[ Y ]->SetValue( 0 ); myData[ Z ]->SetValue( 0 ); - + myData[ DX1 ]->SetValue( 0 ); myData[ DY1 ]->SetValue( 0 ); myData[ DZ1 ]->SetValue( 0 ); - + myData[ DX2 ]->SetValue( 0 ); myData[ DY2 ]->SetValue( 0 ); myData[ DZ2 ]->SetValue( 0 ); @@ -551,7 +560,7 @@ void BasicGUI_MarkerDlg::onSelectionDone() } } } - + displayPreview(); } @@ -603,7 +612,8 @@ void BasicGUI_MarkerDlg::LineEditReturnPressed() void BasicGUI_MarkerDlg::onActivate() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionDone() ) ); ConstructorsClicked( getConstructorId() ); } @@ -633,7 +643,7 @@ void BasicGUI_MarkerDlg::enterEvent(QEvent* e) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation() { - return getGeomEngine()->GetIBasicOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.h b/src/BasicGUI/BasicGUI_MarkerDlg.h index 127685c42..2f76d8063 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.h +++ b/src/BasicGUI/BasicGUI_MarkerDlg.h @@ -46,9 +46,9 @@ private: typedef QMap< int, DlgRef_SpinBox* > DataMap; public: - BasicGUI_MarkerDlg( QWidget*, SALOME_Selection* ); + BasicGUI_MarkerDlg( GeometryGUI* theGeometryGUI, QWidget* ); virtual ~BasicGUI_MarkerDlg(); - void Init( SALOME_Selection* ); + void Init(); protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); @@ -64,6 +64,8 @@ private : void enterEvent( QEvent* e ); void onSelectionDone0(); + GeometryGUI* myGeometryGUI; + private slots: void onOk(); void onClose(); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index a8298c652..eee53f1d4 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -27,8 +27,13 @@ // $Header$ #include "BasicGUI_PlaneDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -41,13 +46,13 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_PlaneDlg::BasicGUI_PlaneDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_PlaneDlg::BasicGUI_PlaneDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_3PNTS"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_3PNTS"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_PLANE_TITLE")); @@ -118,11 +123,12 @@ void BasicGUI_PlaneDlg::Init() myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double aStep = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double aStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double aTrimSize = 2000.0; /* min, max, step and decimals for spin boxes */ @@ -135,8 +141,8 @@ void BasicGUI_PlaneDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -160,11 +166,11 @@ void BasicGUI_PlaneDlg::Init() connect(Group3Pnts->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupFace->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntDir->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPntDir->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Pnts->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_PLANE" ) ); @@ -180,7 +186,7 @@ void BasicGUI_PlaneDlg::Init() //================================================================================= void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil(); switch ( constructorId ) @@ -233,7 +239,8 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) } myEditCurrentArgument->setFocus(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -279,7 +286,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir = GEOM::GEOM_Object::_nil(); @@ -292,7 +299,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -363,9 +370,10 @@ void BasicGUI_PlaneDlg::LineEditReturnPressed() void BasicGUI_PlaneDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); ConstructorsClicked( getConstructorId() ); } @@ -376,7 +384,7 @@ void BasicGUI_PlaneDlg::ActivateThisDialog() //================================================================================= void BasicGUI_PlaneDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -421,7 +429,7 @@ double BasicGUI_PlaneDlg::getSize() const //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_PlaneDlg::createOperation() { - return getGeomEngine()->GetIBasicOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); } //================================================================================= @@ -493,7 +501,7 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_PlaneDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.h b/src/BasicGUI/BasicGUI_PlaneDlg.h index e333a91d8..ba4f50f05 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.h +++ b/src/BasicGUI/BasicGUI_PlaneDlg.h @@ -44,7 +44,7 @@ class BasicGUI_PlaneDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_PlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_PlaneDlg(); protected: @@ -60,6 +60,8 @@ private : void enterEvent(QEvent* e); double getSize() const; + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace; DlgRef_2Sel1Spin* GroupPntDir; diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index d5f72b81b..7b349ef0a 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -29,13 +29,14 @@ using namespace std; #include "BasicGUI_PointDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "OCCViewer_Viewer3d.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include "GEOMImpl_Types.hxx" +#include + #include "utilities.h" #include @@ -54,13 +55,13 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_PointDlg::BasicGUI_PointDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, fl ) +BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl ), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POINT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POINT_EDGE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_EDGE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POINT_REF"))); setCaption(tr("GEOM_POINT_TITLE")); @@ -146,12 +147,12 @@ void BasicGUI_PointDlg::Init() myEditCurrentArgument = 0; - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + /* min, max, step and decimals for spin boxes */ GroupXYZ->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); GroupXYZ->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); @@ -173,8 +174,8 @@ void BasicGUI_PointDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -191,18 +192,19 @@ void BasicGUI_PointDlg::Init() connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double))); - - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupOnCurve->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupXYZ->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupRefPoint->SpinBox_DZ, SLOT(SetStep(double))); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + initName( tr("GEOM_VERTEX") ); - + ConstructorsClicked( 0 ); } @@ -292,7 +294,7 @@ bool BasicGUI_PointDlg::ClickOnApply() { if ( !onAccept() ) return false; - + initName(); ConstructorsClicked( getConstructorId() ); return true; @@ -315,49 +317,48 @@ void BasicGUI_PointDlg::ClickOnCancel() //================================================================================= void BasicGUI_PointDlg::SelectionIntoArgument() { - const int id = getConstructorId(); + const int id = getConstructorId(); if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) - { - myEditCurrentArgument->setText(""); - myX->setText( "" ); - myY->setText( "" ); - myZ->setText( "" ); - myRefPoint = myEdge = GEOM::GEOM_Object::_nil(); - } + { + myEditCurrentArgument->setText(""); + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + myRefPoint = myEdge = GEOM::GEOM_Object::_nil(); + } - if ( mySelection->IObjectCount() == 1 ) - { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) + if ( IObjectCount() == 1 ) + { + Standard_Boolean aRes = Standard_False; + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { - if ( id == 0 ) - { - // get CORBA reference to data object - TopoDS_Shape aShape = GeometryGUI::GetGeomGUI()->GetShapeReader().GetShape( - GeometryGUI::GetGeomGUI()->GetGeomGen(), aSelectedObject ); - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) - { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); - GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() ); - GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() ); - } - } - else if ( id == 1 ) - { - myRefPoint = aSelectedObject; - GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); - } - else if ( id == 2 ) - { - myEdge = aSelectedObject; - GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); - } + if ( id == 0 ) + { + // get CORBA reference to data object + TopoDS_Shape aShape = myGeometryGUI->GetShapeReader().GetShape( myGeometryGUI->GetGeomGen(), aSelectedObject ); + if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); + GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() ); + GroupXYZ->SpinBox_DZ->SetValue( aPnt.Z() ); + } + } + else if ( id == 1 ) + { + myRefPoint = aSelectedObject; + GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + } + else if ( id == 2 ) + { + myEdge = aSelectedObject; + GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) ); + } } - } - + } + displayPreview(); } @@ -370,10 +371,10 @@ void BasicGUI_PointDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 ) - { - myEditCurrentArgument = send; - GEOMBase_Skeleton::LineEditReturnPressed(); - } + { + myEditCurrentArgument = send; + GEOMBase_Skeleton::LineEditReturnPressed(); + } } @@ -396,7 +397,7 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() { GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; - + globalSelection( GEOM_EDGE ); } } @@ -420,7 +421,7 @@ void BasicGUI_PointDlg::enterEvent(QEvent* e) void BasicGUI_PointDlg::ActivateThisDialog( ) { GEOMBase_Skeleton::ActivateThisDialog(); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); ConstructorsClicked( getConstructorId() ); } @@ -431,7 +432,7 @@ void BasicGUI_PointDlg::ActivateThisDialog( ) //================================================================================= void BasicGUI_PointDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -476,7 +477,7 @@ void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt ) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation() { - return getGeomEngine()->GetIBasicOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); } //================================================================================= @@ -485,14 +486,14 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation() //================================================================================= bool BasicGUI_PointDlg::isValid( QString& msg ) { - const int id = getConstructorId(); - if ( id == 0 ) - return true; - else if ( id == 1 ) - return !myRefPoint->_is_nil(); - else if ( id == 2 ) - return !myEdge->_is_nil(); - return false; + const int id = getConstructorId(); + if ( id == 0 ) + return true; + else if ( id == 1 ) + return !myRefPoint->_is_nil(); + else if ( id == 2 ) + return !myEdge->_is_nil(); + return false; } //================================================================================= @@ -523,8 +524,8 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) double dy = GroupRefPoint->SpinBox_DY->GetValue(); double dz = GroupRefPoint->SpinBox_DZ->GetValue(); - anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointWithReference( myRefPoint, dx, dy, dz ); - res = true; + anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePointWithReference( myRefPoint, dx, dy, dz ); + res = true; break; } case 2 : @@ -534,26 +535,26 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) } if ( getConstructorId() == 1 || getConstructorId() == 2 ) - { - TopoDS_Shape aShape; - if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - myX->setText( QString( "%1" ).arg( aPnt.X() ) ); - myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); - myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + TopoDS_Shape aShape; + if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + { + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + myX->setText( QString( "%1" ).arg( aPnt.X() ) ); + myY->setText( QString( "%1" ).arg( aPnt.Y() ) ); + myZ->setText( QString( "%1" ).arg( aPnt.Z() ) ); + } + else + { + myX->setText( "" ); + myY->setText( "" ); + myZ->setText( "" ); + } } - else - { - myX->setText( "" ); - myY->setText( "" ); - myZ->setText( "" ); - } - } - + if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() ); - + return res; } @@ -563,6 +564,6 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects ) //================================================================================= void BasicGUI_PointDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index 48b248db8..f149f816a 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -46,7 +46,7 @@ class BasicGUI_PointDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_PointDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_PointDlg(); @@ -66,6 +66,8 @@ private : void enterEvent(QEvent* e); double getParameter() const; + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myEdge; GEOM::GEOM_Object_var myRefPoint; diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 0af637cb3..2dc5bd6e1 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -29,8 +29,12 @@ using namespace std; #include "BasicGUI_VectorDlg.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -43,15 +47,15 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_VectorDlg::BasicGUI_VectorDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, fl ) +BasicGUI_VectorDlg::BasicGUI_VectorDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl ), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_DXYZ"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_2P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_VECTOR_TITLE")); - + /***************************************************************/ GroupConstructors->setTitle(tr("GEOM_VECTOR")); RadioButton1->setPixmap(image0); @@ -106,9 +110,9 @@ void BasicGUI_VectorDlg::Init() myPoint2 = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + /* min, max, step and decimals for spin boxes */ GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); @@ -123,8 +127,8 @@ void BasicGUI_VectorDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -140,13 +144,14 @@ void BasicGUI_VectorDlg::Init() connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); connect(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr("GEOM_VECTOR") ); @@ -161,7 +166,7 @@ void BasicGUI_VectorDlg::Init() //================================================================================= void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); myPoint1 = GEOM::GEOM_Object::_nil(); myPoint2 = GEOM::GEOM_Object::_nil(); @@ -178,7 +183,8 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) GroupPoints->LineEdit2->setText(""); globalSelection( GEOM_POINT ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: @@ -246,7 +252,7 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil(); @@ -257,7 +263,7 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -304,7 +310,8 @@ void BasicGUI_VectorDlg::LineEditReturnPressed() void BasicGUI_VectorDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -315,7 +322,7 @@ void BasicGUI_VectorDlg::ActivateThisDialog() //================================================================================= void BasicGUI_VectorDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -361,7 +368,7 @@ void BasicGUI_VectorDlg::ReverseVector(int state) //================================================================================= GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation() { - return getGeomEngine()->GetIBasicOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetIBasicOperations( getStudyId() ); } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_VectorDlg.h b/src/BasicGUI/BasicGUI_VectorDlg.h index 02c5e0ef2..76bd9b8be 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.h +++ b/src/BasicGUI/BasicGUI_VectorDlg.h @@ -34,7 +34,7 @@ #include "DlgRef_3Spin1Check.h" #include "BasicGUI.h" -#include "GEOM_ShapeTypeFilter.hxx" +//#include "GEOM_ShapeTypeFilter.hxx" //================================================================================= // class : BasicGUI_VectorDlg @@ -45,7 +45,7 @@ class BasicGUI_VectorDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_VectorDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BasicGUI_VectorDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BasicGUI_VectorDlg(); protected: @@ -58,6 +58,8 @@ private : void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myPoint1; GEOM::GEOM_Object_var myPoint2; diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 991fc997a..7aa6b1a30 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -30,11 +30,10 @@ using namespace std; #include "GEOMBase.h" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewPort3d.h" -#include "QAD_StudyFrame.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include #include @@ -52,6 +51,7 @@ using namespace std; #include "GEOMImpl_Types.hxx" #include +#include //================================================================================= // class : BasicGUI_WorkingPlaneDlg() @@ -60,13 +60,13 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg(GeometryGUI* theGeometryGUI , QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_FACE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_VECTOR"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_ORIGIN"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_FACE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_VECTOR"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_WPLANE_ORIGIN"))); setCaption(tr("GEOM_WPLANE_TITLE")); @@ -121,9 +121,9 @@ void BasicGUI_WorkingPlaneDlg::Init() { /* init variables */ myEditCurrentArgument = Group1->LineEdit1; - myWPlane = GeometryGUI::GetGeomGUI()->GetWorkingPlane(); + myWPlane = myGeometryGUI->GetWorkingPlane(); - myGeomGUI->SetState( 0 ); + // myGeometryGUI->SetState( 0 ); myFace = GEOM::GEOM_Object::_nil(); myVectX = GEOM::GEOM_Object::_nil(); @@ -136,8 +136,8 @@ void BasicGUI_WorkingPlaneDlg::Init() /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -153,7 +153,8 @@ void BasicGUI_WorkingPlaneDlg::Init() connect(Group3->GroupBox1, SIGNAL(clicked(int)), this, SLOT(GroupClicked(int))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_WPLANE" ) ); ConstructorsClicked(0); @@ -165,8 +166,8 @@ void BasicGUI_WorkingPlaneDlg::Init() //================================================================================= void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); - myGeomGUI->SetState( 0 ); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + // myGeometryGUI->SetState( 0 ); switch (constructorId) { @@ -183,7 +184,8 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) Group1->LineEdit1->setText(""); myFace = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: @@ -201,7 +203,8 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) myVectX = GEOM::GEOM_Object::_nil(); myVectZ = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 2: @@ -245,7 +248,7 @@ void BasicGUI_WorkingPlaneDlg::ClickOnOk() bool BasicGUI_WorkingPlaneDlg::ClickOnApply() { buttonApply->setFocus(); - QAD_Application::getDesktop()->putInfo(tr("")); + myGeometryGUI->application()->putInfo(tr("")); const int id = getConstructorId(); if (id == 0) { @@ -258,8 +261,8 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply() gp_Pln aPln = aGPlane->Pln(); myWPlane = aPln.Position(); - GeometryGUI::GetGeomGUI()->SetWorkingPlane(myWPlane); - GeometryGUI::GetGeomGUI()->ActiveWorkingPlane(); + myGeometryGUI->SetWorkingPlane(myWPlane); + myGeometryGUI->ActiveWorkingPlane(); return true; } } @@ -301,8 +304,8 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply() myWPlane = gp_Ax3(BRep_Tool::Pnt(V1), aDirZ, aDirX); - GeometryGUI::GetGeomGUI()->SetWorkingPlane(myWPlane); - GeometryGUI::GetGeomGUI()->ActiveWorkingPlane(); + myGeometryGUI->SetWorkingPlane(myWPlane); + myGeometryGUI->ActiveWorkingPlane(); return true; } } else if (id == 2) { @@ -324,8 +327,8 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply() myWPlane = gp_Ax3(P1, aDirZ, aDirX); - GeometryGUI::GetGeomGUI()->SetWorkingPlane(myWPlane); - GeometryGUI::GetGeomGUI()->ActiveWorkingPlane(); + myGeometryGUI->SetWorkingPlane(myWPlane); + myGeometryGUI->ActiveWorkingPlane(); return true; } return false; @@ -340,7 +343,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); const int id = getConstructorId(); - if ( mySelection->IObjectCount() != 1 ) { + if ( IObjectCount() != 1 ) { if(id == 0) myFace = GEOM::GEOM_Object::_nil(); else if(id == 1) { @@ -354,7 +357,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), aRes); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aRes); if(!aRes || CORBA::is_nil( aSelectedObject )) return; @@ -417,7 +420,8 @@ void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed() void BasicGUI_WorkingPlaneDlg::ActivateThisDialog( ) { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -429,7 +433,7 @@ void BasicGUI_WorkingPlaneDlg::ActivateThisDialog( ) //================================================================================= void BasicGUI_WorkingPlaneDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -458,6 +462,6 @@ void BasicGUI_WorkingPlaneDlg::enterEvent(QEvent* e) //================================================================================= void BasicGUI_WorkingPlaneDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeometryGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h index ba4bf98ed..522631f57 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h @@ -43,7 +43,7 @@ class BasicGUI_WorkingPlaneDlg : public GEOMBase_Skeleton Q_OBJECT public: - BasicGUI_WorkingPlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + BasicGUI_WorkingPlaneDlg( GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~BasicGUI_WorkingPlaneDlg(); virtual void closeEvent( QCloseEvent* e ); @@ -52,6 +52,8 @@ private: void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myFace; GEOM::GEOM_Object_var myVectX; GEOM::GEOM_Object_var myVectZ; diff --git a/src/BasicGUI/Makefile.in b/src/BasicGUI/Makefile.in index dfc9c8a84..4bbaaa7f6 100644 --- a/src/BasicGUI/Makefile.in +++ b/src/BasicGUI/Makefile.in @@ -64,15 +64,15 @@ LIB_MOC = \ BasicGUI_CurveDlg.h \ BasicGUI_MarkerDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl +LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Exception.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMFiltersSelection -lGEOMBase -lGEOMGUI +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase -lGEOM @CONCLUDE@ diff --git a/src/BlocksGUI/BlocksGUI.cxx b/src/BlocksGUI/BlocksGUI.cxx index e2707c163..0b42de719 100644 --- a/src/BlocksGUI/BlocksGUI.cxx +++ b/src/BlocksGUI/BlocksGUI.cxx @@ -34,10 +34,11 @@ #include "BlocksGUI_ExplodeDlg.h" #include "BlocksGUI_PropagateDlg.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "GeometryGUI.h" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" +#include "SUIT_Desktop.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Session.h" BlocksGUI* BlocksGUI::myGUIObject = 0; @@ -45,10 +46,10 @@ BlocksGUI* BlocksGUI::myGUIObject = 0; // function : GetBlocksGUI() // purpose : Get the only BlocksGUI object [ static ] //======================================================================= -BlocksGUI* BlocksGUI::GetBlocksGUI() +BlocksGUI* BlocksGUI::GetBlocksGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) - myGUIObject = new BlocksGUI(); + myGUIObject = new BlocksGUI( parent ); return myGUIObject; } @@ -57,8 +58,8 @@ BlocksGUI* BlocksGUI::GetBlocksGUI() // function : BlocksGUI() // purpose : Constructor //======================================================================= -BlocksGUI::BlocksGUI() - : GEOMGUI() +BlocksGUI::BlocksGUI( GeometryGUI* parent ) + : GEOMGUI( parent ) { } @@ -74,46 +75,43 @@ BlocksGUI::~BlocksGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool BlocksGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +bool BlocksGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - - SALOME_Selection* Sel = SALOME_Selection::Selection - (QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; switch (theCommandID) { case 9999: - aDlg = new BlocksGUI_BlockDlg (parent, Sel); + aDlg = new BlocksGUI_BlockDlg (parent); break; case 9998: - aDlg = new BlocksGUI_TrsfDlg (parent, Sel); + aDlg = new BlocksGUI_TrsfDlg (parent); break; case 9997: - aDlg = new BlocksGUI_QuadFaceDlg (parent, Sel); + aDlg = new BlocksGUI_QuadFaceDlg (parent); break; case 9996: // aDlg = new BlocksGUI_CheckMultiBlockDlg (parent, Sel); - QAD_MessageBox::warn1 (parent, - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_NOT_IMPLEMENTED"), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warn1 (parent, + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_NOT_IMPLEMENTED"), + QObject::tr("BUT_OK")); break; - + case 9995: - aDlg = new BlocksGUI_ExplodeDlg (parent, Sel); + aDlg = new BlocksGUI_ExplodeDlg (parent); break; case 99991: - aDlg = new BlocksGUI_PropagateDlg (parent, "", Sel); + aDlg = new BlocksGUI_PropagateDlg (parent, ""); break; default: - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } @@ -128,8 +126,8 @@ bool BlocksGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return BlocksGUI::GetBlocksGUI(); + return BlocksGUI::GetBlocksGUI( parent ); } } diff --git a/src/BlocksGUI/BlocksGUI.h b/src/BlocksGUI/BlocksGUI.h index 513b8accf..eab79022e 100644 --- a/src/BlocksGUI/BlocksGUI.h +++ b/src/BlocksGUI/BlocksGUI.h @@ -37,15 +37,15 @@ class BlocksGUI : public GEOMGUI { protected: - BlocksGUI(); // hide constructor to avoid direct creation + BlocksGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public: ~BlocksGUI(); // Get the only BuildGUI object - static BlocksGUI* GetBlocksGUI(); + static BlocksGUI* GetBlocksGUI( GeometryGUI* parent ); - bool OnGUIEvent (int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent (int theCommandID, SUIT_Desktop* parent); private: static BlocksGUI* myGUIObject; // the only BlocksGUI object diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx index 888ee3a63..059c8facd 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx @@ -27,25 +27,28 @@ #include "BlocksGUI_BlockDlg.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include "GEOMImpl_Types.hxx" using namespace std; +#include + //================================================================================= // class : BlocksGUI_BlockDlg() // purpose : Constructs a BlocksGUI_BlockDlg which is a child of 'parent'. //================================================================================= BlocksGUI_BlockDlg::BlocksGUI_BlockDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal) - : GEOMBase_Skeleton(parent, "BlockDlg", Sel, modal, + : GEOMBase_Skeleton(parent, "BlockDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_2F"))); - QPixmap image1 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_6F"))); - QPixmap imageS (QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_2F"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BLOCK_6F"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); setCaption(tr("GEOM_BLOCK_TITLE")); @@ -129,7 +132,8 @@ void BlocksGUI_BlockDlg::Init() connect(Group6F->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group6F->PushButton6, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; // init controls and fields initName(tr("GEOM_BLOCK")); @@ -182,7 +186,8 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId) globalSelection(GEOM_FACE); SelectionIntoArgument(); -// connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } //================================================================================= @@ -217,7 +222,7 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if (mySelection->IObjectCount() != 1) + if (IObjectCount() != 1) { if (myEditCurrentArgument == Group2F->LineEdit1 || myEditCurrentArgument == Group6F->LineEdit1) @@ -239,7 +244,7 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if (!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -304,7 +309,8 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument() void BlocksGUI_BlockDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection(GEOM_FACE); diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.h b/src/BlocksGUI/BlocksGUI_BlockDlg.h index 91f98567b..567538c32 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.h +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.h @@ -43,7 +43,6 @@ class BlocksGUI_BlockDlg : public GEOMBase_Skeleton public: BlocksGUI_BlockDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal = FALSE); ~BlocksGUI_BlockDlg(); diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index 30a03c621..ac63e4135 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -31,7 +31,10 @@ #include "GEOM_Displayer.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "utilities.h" @@ -41,19 +44,19 @@ #include #include #include +#include //================================================================================= // class : BlocksGUI_ExplodeDlg() // purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'. //================================================================================= BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal) - : GEOMBase_Skeleton(parent, "ExplodeDlg", Sel, modal, + : GEOMBase_Skeleton(parent, "ExplodeDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image1 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_EXPLODE"))); - QPixmap imageS (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_EXPLODE"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_BLOCK_EXPLODE_TITLE")); @@ -129,7 +132,8 @@ void BlocksGUI_ExplodeDlg::Init() mySpinBoxMin->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); mySpinBoxMax->RangeStepAndValidator(0.0, 999.0, SpecificStep, 3); - if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) myCheckBtn->setEnabled(false); // signals and slots connections @@ -143,7 +147,8 @@ void BlocksGUI_ExplodeDlg::Init() connect(myCheckBtn, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; myConstructorId = -1; ConstructorsClicked(0); @@ -194,7 +199,7 @@ void BlocksGUI_ExplodeDlg::ClickOnOk() //================================================================================= bool BlocksGUI_ExplodeDlg::ClickOnApply() { - QAD_Application::getDesktop()->putInfo(tr("")); + SUIT_Session::session()->activeApplication()->putInfo(tr("")); // Explode all sub shapes if (isAllSubShapes()) { @@ -230,10 +235,10 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument() myObject = GEOM::GEOM_Object::_nil(); mySelName->setText(""); - if (mySelection->IObjectCount() == 1) { + if (IObjectCount() == 1) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), aResult); + GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { myObject = anObj; @@ -268,7 +273,8 @@ void BlocksGUI_ExplodeDlg::SetEditCurrentArgument() void BlocksGUI_ExplodeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; activateSelection(); } @@ -315,12 +321,14 @@ void BlocksGUI_ExplodeDlg::activateSelection() erasePreview(true); if (isAllSubShapes()) { // Sub-shapes selection disabled - disconnect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; globalSelection( GEOM_ALLSHAPES ); if (myObject->_is_nil()) { SelectionIntoArgument(); } - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; } else { displayPreview(true, true, false); globalSelection(GEOM_PREVIEW); @@ -333,8 +341,8 @@ void BlocksGUI_ExplodeDlg::activateSelection() //================================================================================= void BlocksGUI_ExplodeDlg::updateButtonState() { - if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || - myObject->_is_nil()) { + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() || myObject->_is_nil()) { myCheckBtn->setChecked(FALSE); myCheckBtn->setEnabled(FALSE); } else { @@ -387,7 +395,7 @@ bool BlocksGUI_ExplodeDlg::isValid (QString&) if (IsPreview()) return !myObject->_is_nil(); else - return !myObject->_is_nil() && (isAllSubShapes() || mySelection->IObjectCount()); + return !myObject->_is_nil() && (isAllSubShapes() || IObjectCount()); default: return false; } @@ -434,7 +442,7 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects) QMap selected; // Get names of selected objects - SALOME_ListIteratorOfListIO it (mySelection->StoredIObjects()); + SALOME_ListIteratorOfListIO it (selectedIO()); for (; it.More(); it.Next()) { selected.insert(it.Value()->getName(), 0); } @@ -443,7 +451,7 @@ bool BlocksGUI_ExplodeDlg::execute (ObjectList& objects) ObjectList toRemoveFromEnggine; ObjectList::iterator anIter; for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter) { - if (selected.contains(GeometryGUI::GetORB()->object_to_string(*anIter))) + if (selected.contains(myGeomGUI->getApp()->orb()->object_to_string(*anIter))) objects.push_back(*anIter); else toRemoveFromEnggine.push_back(*anIter); diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.h b/src/BlocksGUI/BlocksGUI_ExplodeDlg.h index 73c44136c..53b55e8c3 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.h +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.h @@ -44,7 +44,6 @@ class BlocksGUI_ExplodeDlg : public GEOMBase_Skeleton public: BlocksGUI_ExplodeDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal = FALSE); ~BlocksGUI_ExplodeDlg(); diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx index 2e50ec031..5f6590153 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx @@ -28,10 +28,15 @@ using namespace std; #include "BlocksGUI_PropagateDlg.h" - -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + +#include //================================================================================= // class : BlocksGUI_PropagateDlg() @@ -40,11 +45,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BlocksGUI_PropagateDlg::BlocksGUI_PropagateDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PROPAGATE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PROPAGATE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_PROPAGATE_TITLE")); @@ -93,7 +98,7 @@ void BlocksGUI_PropagateDlg::Init() myObject = GEOM::GEOM_Object::_nil(); ResultName->setText( "" ); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); @@ -161,8 +166,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument() mySelName->setText(""); myObject = GEOM::GEOM_Object::_nil(); - if ( mySelection->IObjectCount() == 1 ) { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + if ( IObjectCount() == 1 ) { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( aRes ) @@ -203,7 +208,7 @@ void BlocksGUI_PropagateDlg::LineEditReturnPressed() //================================================================================= void BlocksGUI_PropagateDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -219,7 +224,7 @@ void BlocksGUI_PropagateDlg::ActivateThisDialog() mySelName->setText(""); myObject = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); activateSelection(); } @@ -241,7 +246,7 @@ void BlocksGUI_PropagateDlg::enterEvent(QEvent* e) //================================================================================= void BlocksGUI_PropagateDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } @@ -297,7 +302,8 @@ void BlocksGUI_PropagateDlg::activateSelection() if (myObject->_is_nil()) { SelectionIntoArgument(); } - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; } //================================================================ diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.h b/src/BlocksGUI/BlocksGUI_PropagateDlg.h index 230db75d2..db860194b 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.h +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.h @@ -41,7 +41,7 @@ class BlocksGUI_PropagateDlg : public GEOMBase_Skeleton Q_OBJECT public: - BlocksGUI_PropagateDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BlocksGUI_PropagateDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BlocksGUI_PropagateDlg(); protected: diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx index c95296207..72f017df2 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx @@ -26,27 +26,29 @@ // $Header$ #include "BlocksGUI_QuadFaceDlg.h" - -#include "QAD_Desktop.h" - #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + //using namespace std; +#include + //================================================================================= // class : BlocksGUI_QuadFaceDlg() // purpose : Constructs a BlocksGUI_QuadFaceDlg which is a child of 'parent'. //================================================================================= BlocksGUI_QuadFaceDlg::BlocksGUI_QuadFaceDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal) - : GEOMBase_Skeleton(parent, "QuadFaceDlg", Sel, modal, + : GEOMBase_Skeleton(parent, "QuadFaceDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image1 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_VERT"))); - QPixmap image2 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_2_EDGE"))); - QPixmap image3 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_EDGE"))); - QPixmap imageS (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_VERT"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_2_EDGE"))); + QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_QUAD_FACE_4_EDGE"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_QUAD_FACE_TITLE")); @@ -127,7 +129,8 @@ void BlocksGUI_QuadFaceDlg::Init() for (anIterBtn = mySelBtn.begin(); anIterBtn != mySelBtn.end(); ++anIterBtn) connect(anIterBtn.data(), SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; // init controls and fields initName(tr("GEOM_QUAD_FACE")); @@ -226,8 +229,8 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument() GEOM::GEOM_Object_var anObj; Standard_Boolean aResult = Standard_False; - if (mySelection->IObjectCount() == 1) { - anObj = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), aResult); + if (IObjectCount() == 1) { + anObj = GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); if (aResult) { if (anObj->_is_nil()) { aResult = Standard_False; @@ -280,7 +283,8 @@ void BlocksGUI_QuadFaceDlg::SetEditCurrentArgument() void BlocksGUI_QuadFaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; activateSelection(); displayPreview(); diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h index bd7150e4c..0df8ae01c 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.h @@ -44,7 +44,6 @@ class BlocksGUI_QuadFaceDlg : public GEOMBase_Skeleton public: BlocksGUI_QuadFaceDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal = FALSE); ~BlocksGUI_QuadFaceDlg(); diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx index 959df91a6..0820f30d6 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -29,23 +29,27 @@ #include "DlgRef_SpinBox.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" #include +#include + //================================================================================= // class : BlocksGUI_TrsfDlg() // purpose : Constructs a BlocksGUI_TrsfDlg which is a child of 'parent'. //================================================================================= BlocksGUI_TrsfDlg::BlocksGUI_TrsfDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal) - : GEOMBase_Skeleton(parent, "TrsfDlg", Sel, modal, + : GEOMBase_Skeleton(parent, "TrsfDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image1 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_MULTITRSF_SIMPLE"))); - QPixmap image2 (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_MULTITRSF_DOUBLE"))); - QPixmap imageS (QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_MULTITRSF_SIMPLE"))); + QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BLOCK_MULTITRSF_DOUBLE"))); + QPixmap imageS (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_BLOCK_MULTITRSF_TITLE")); @@ -153,7 +157,8 @@ void BlocksGUI_TrsfDlg::Init() for (anIterSpin = mySpinBox.begin(); anIterSpin != mySpinBox.end(); ++anIterSpin) connect(anIterSpin.data(), SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; // init controls and fields initName(tr("GEOM_BLOCK_MULTITRSF")); @@ -254,10 +259,10 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() // If selection of main object is activated if (aCurrFocus == MainObj1 || aCurrFocus == MainObj2) { - if (mySelection->IObjectCount() == 1) { + if (IObjectCount() == 1) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), aResult); + GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); if (aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { myShape = anObj; @@ -274,14 +279,14 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() else if (aCurrFocus == Face1 || aCurrFocus == Face2 || aCurrFocus == Face1U || aCurrFocus == Face2U || aCurrFocus == Face1V || aCurrFocus == Face2V) { - if (mySelection->IObjectCount() == 1) { + if (IObjectCount() == 1) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), aResult); + GEOMBase::ConvertIOinGEOMObject(firstIObject(), aResult); if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { TColStd_IndexedMapOfInteger anIndexes; - mySelection->GetIndex(mySelection->firstIObject(), anIndexes); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); if (anIndexes.Extent() == 1) { int anIndex = anIndexes(1); @@ -325,7 +330,8 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument() void BlocksGUI_TrsfDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; activateSelection(); displayPreview(); @@ -391,7 +397,8 @@ void BlocksGUI_TrsfDlg::activateSelection() myEditCurrentArgument == mySelName[ Face2V ])) { // Local selection is available only in the OCC Viewer - if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) { localSelection(myShape, TopAbs_FACE); } else { return; diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.h b/src/BlocksGUI/BlocksGUI_TrsfDlg.h index 1b3b782ff..a5bdc30d6 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.h +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.h @@ -45,7 +45,6 @@ class BlocksGUI_TrsfDlg : public GEOMBase_Skeleton public: BlocksGUI_TrsfDlg (QWidget* parent, - SALOME_Selection* Sel, bool modal = FALSE); ~BlocksGUI_TrsfDlg(); diff --git a/src/BlocksGUI/Makefile.in b/src/BlocksGUI/Makefile.in index 46fda7cb1..99cbd1e09 100644 --- a/src/BlocksGUI/Makefile.in +++ b/src/BlocksGUI/Makefile.in @@ -54,14 +54,14 @@ LIB_MOC = \ BlocksGUI_PropagateDlg.h \ BlocksGUI_TrsfDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMFiltersSelection -lGEOMBase diff --git a/src/BooleanGUI/BooleanGUI.cxx b/src/BooleanGUI/BooleanGUI.cxx index 0e6c813d6..98df1e213 100644 --- a/src/BooleanGUI/BooleanGUI.cxx +++ b/src/BooleanGUI/BooleanGUI.cxx @@ -29,21 +29,22 @@ using namespace std; #include "BooleanGUI.h" -#include "QAD_Desktop.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SUIT_Desktop.h" #include "BooleanGUI_Dialog.h" +#include "GeometryGUI.h" + BooleanGUI* BooleanGUI::myGUIObject = 0; //======================================================================= // function : GetBooleanGUI() // purpose : Get the only BooleanGUI object [ static ] //======================================================================= -BooleanGUI* BooleanGUI::GetBooleanGUI() +BooleanGUI* BooleanGUI::GetBooleanGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init BooleanGUI only once - myGUIObject = new BooleanGUI(); + myGUIObject = new BooleanGUI( parent ); } return myGUIObject; } @@ -52,7 +53,7 @@ BooleanGUI* BooleanGUI::GetBooleanGUI() // function : BooleanGUI() // purpose : Constructor //======================================================================= -BooleanGUI::BooleanGUI() : GEOMGUI() +BooleanGUI::BooleanGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { } @@ -70,10 +71,9 @@ BooleanGUI::~BooleanGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool BooleanGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); int anOperation = 0; if ( theCommandID == 5011 ) @@ -87,7 +87,7 @@ bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) else return false; - QDialog* aDlg = new BooleanGUI_Dialog( anOperation, parent, "", Sel); + QDialog* aDlg = new BooleanGUI_Dialog( anOperation, parent, ""); aDlg->show(); return true; @@ -98,8 +98,8 @@ bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return BooleanGUI::GetBooleanGUI(); + return BooleanGUI::GetBooleanGUI( parent ); } } diff --git a/src/BooleanGUI/BooleanGUI.h b/src/BooleanGUI/BooleanGUI.h index d7773d16a..a0fdf6c23 100644 --- a/src/BooleanGUI/BooleanGUI.h +++ b/src/BooleanGUI/BooleanGUI.h @@ -38,7 +38,7 @@ class BooleanGUI : public GEOMGUI { protected: - BooleanGUI(); // hide constructor to avoid direct creation + BooleanGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public: enum BooleanOperation { COMMON = 1, CUT = 2, FUSE = 3, SECTION = 4 }; @@ -46,9 +46,9 @@ public: ~BooleanGUI(); // Get the only BooleanGUI object - static BooleanGUI* GetBooleanGUI(); + static BooleanGUI* GetBooleanGUI( GeometryGUI* parent ); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); private: static BooleanGUI* myGUIObject; // the only BooleanGUI object diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 68bd77be8..7944e5116 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -31,7 +31,11 @@ using namespace std; #include "BooleanGUI.h" #include "DlgRef_2Sel_QTD.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include //================================================================================= // class : BooleanGUI_Dialog() @@ -40,8 +44,8 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, fl), +BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl), myOperation( theOperation ) { QPixmap image0; @@ -49,27 +53,27 @@ BooleanGUI_Dialog::BooleanGUI_Dialog( const int theOperation, QWidget* parent, c switch ( myOperation ) { case BooleanGUI::COMMON: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_COMMON"))); + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_COMMON"))); aTitle = tr("GEOM_COMMON"); aCaption = tr("GEOM_COMMON_TITLE"); break; case BooleanGUI::CUT: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CUT"))); + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CUT"))); aTitle = tr("GEOM_CUT"); aCaption = tr("GEOM_CUT_TITLE"); break; case BooleanGUI::FUSE: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_FUSE"))); aTitle = tr("GEOM_FUSE"); aCaption = tr("GEOM_FUSE_TITLE"); break; case BooleanGUI::SECTION: - image0 = QPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SECTION"))); + image0 = QPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SECTION"))); aTitle = tr("GEOM_SECTION"); aCaption = tr("GEOM_SECTION_TITLE"); break; } - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption( aCaption ); @@ -134,7 +138,8 @@ void BooleanGUI_Dialog::Init() connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( GroupConstructors->title() ); @@ -175,7 +180,7 @@ void BooleanGUI_Dialog::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { if ( myEditCurrentArgument == myGroup->LineEdit1 ) myObject1 = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == myGroup->LineEdit2 ) myObject2 = GEOM::GEOM_Object::_nil(); @@ -184,7 +189,7 @@ void BooleanGUI_Dialog::SelectionIntoArgument() // nbSel == 1 Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes && GEOMBase::IsShape( aSelectedObject ) ) { myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) ); @@ -234,7 +239,8 @@ void BooleanGUI_Dialog::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; } diff --git a/src/BooleanGUI/BooleanGUI_Dialog.h b/src/BooleanGUI/BooleanGUI_Dialog.h index e9483dd39..70f6c4b75 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.h +++ b/src/BooleanGUI/BooleanGUI_Dialog.h @@ -42,7 +42,7 @@ class BooleanGUI_Dialog : public GEOMBase_Skeleton Q_OBJECT public: - BooleanGUI_Dialog( const int theOperation, QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BooleanGUI_Dialog( const int theOperation, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BooleanGUI_Dialog(); protected: diff --git a/src/BooleanGUI/Makefile.in b/src/BooleanGUI/Makefile.in index 61467e6d7..f90b5d458 100644 --- a/src/BooleanGUI/Makefile.in +++ b/src/BooleanGUI/Makefile.in @@ -46,14 +46,14 @@ LIB_SRC = BooleanGUI.cxx \ LIB_MOC = \ BooleanGUI_Dialog.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMBase diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx index d361dde5e..97a38e990 100644 --- a/src/BuildGUI/BuildGUI.cxx +++ b/src/BuildGUI/BuildGUI.cxx @@ -28,8 +28,8 @@ #include "BuildGUI.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" #include "BuildGUI_EdgeDlg.h" // Method EDGE #include "BuildGUI_WireDlg.h" // Method WIRE @@ -38,16 +38,18 @@ #include "BuildGUI_SolidDlg.h" // Method SOLID #include "BuildGUI_CompoundDlg.h" // Method COMPOUND +#include "GeometryGUI.h" + BuildGUI* BuildGUI::myGUIObject = 0; //======================================================================= // function : GetBuildGUI() // purpose : Get the only BuildGUI object [ static ] //======================================================================= -BuildGUI* BuildGUI::GetBuildGUI() +BuildGUI* BuildGUI::GetBuildGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) - myGUIObject = new BuildGUI(); + myGUIObject = new BuildGUI( parent ); return myGUIObject; } @@ -56,8 +58,8 @@ BuildGUI* BuildGUI::GetBuildGUI() // function : BuildGUI() // purpose : Constructor //======================================================================= -BuildGUI::BuildGUI() -: GEOMGUI() +BuildGUI::BuildGUI( GeometryGUI* parent ) +: GEOMGUI( parent ) { } @@ -75,25 +77,24 @@ BuildGUI::~BuildGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool BuildGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +bool BuildGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); + getGeometryGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); - QDialog* aDlg = NULL; switch ( theCommandID ) { - case 4081: aDlg = new BuildGUI_EdgeDlg ( parent, "", Sel ); break; - case 4082: aDlg = new BuildGUI_WireDlg ( parent, "", Sel ); break; - case 4083: aDlg = new BuildGUI_FaceDlg ( parent, "", Sel ); break; - case 4084: aDlg = new BuildGUI_ShellDlg ( parent, "", Sel ); break; - case 4085: aDlg = new BuildGUI_SolidDlg ( parent, "", Sel ); break; - case 4086: aDlg = new BuildGUI_CompoundDlg( parent, "", Sel ); break; + case 4081: aDlg = new BuildGUI_EdgeDlg ( parent, "" ); break; + case 4082: aDlg = new BuildGUI_WireDlg ( parent, "" ); break; + case 4083: aDlg = new BuildGUI_FaceDlg ( parent, "" ); break; + case 4084: aDlg = new BuildGUI_ShellDlg ( parent, "" ); break; + case 4085: aDlg = new BuildGUI_SolidDlg ( parent, "" ); break; + case 4086: aDlg = new BuildGUI_CompoundDlg( parent, "" ); break; - default: parent->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; + default: + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; } if ( aDlg != NULL ) @@ -107,8 +108,8 @@ bool BuildGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return BuildGUI::GetBuildGUI(); + return BuildGUI::GetBuildGUI( parent ); } } diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h index d7818c5a4..25b11cfa8 100644 --- a/src/BuildGUI/BuildGUI.h +++ b/src/BuildGUI/BuildGUI.h @@ -38,15 +38,15 @@ class BuildGUI : public GEOMGUI { protected: - BuildGUI(); // hide constructor to avoid direct creation + BuildGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~BuildGUI(); // Get the only BuildGUI object - static BuildGUI* GetBuildGUI(); + static BuildGUI* GetBuildGUI( GeometryGUI* parent ); - bool OnGUIEvent( int theCommandID, QAD_Desktop* parent ); + bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); private: static BuildGUI* myGUIObject; // the only BuildGUI object diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.cxx b/src/BuildGUI/BuildGUI_CompoundDlg.cxx index b6f9f06b6..df8814144 100644 --- a/src/BuildGUI/BuildGUI_CompoundDlg.cxx +++ b/src/BuildGUI/BuildGUI_CompoundDlg.cxx @@ -27,9 +27,14 @@ // $Header$ #include "BuildGUI_CompoundDlg.h" -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + //================================================================================= // class : BuildGUI_CompoundDlg() // purpose : Constructs a BuildGUI_CompoundDlg which is a child of 'parent', with the @@ -37,11 +42,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_COMPOUND"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_COMPOUND"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_COMPOUND_TITLE")); @@ -91,7 +96,8 @@ void BuildGUI_CompoundDlg::Init() connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupShapes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; globalSelection( GEOM_ALLSHAPES ); @@ -134,13 +140,13 @@ void BuildGUI_CompoundDlg::SelectionIntoArgument() QString aString = ""; /* name of selection */ myOkShapes = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects( mySelection, aString, true ); + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); if ( nbSel == 0 ) return; if ( nbSel != 1 ) aString = QString( "%1_objects").arg( nbSel ); - GEOMBase::ConvertListOfIOInListOfGO( mySelection->StoredIObjects(), myShapes, true ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myShapes, true ); myEditCurrentArgument->setText( aString ); myOkShapes = true; } @@ -171,7 +177,8 @@ void BuildGUI_CompoundDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; } diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.h b/src/BuildGUI/BuildGUI_CompoundDlg.h index 848556ded..eef0b2fb1 100644 --- a/src/BuildGUI/BuildGUI_CompoundDlg.h +++ b/src/BuildGUI/BuildGUI_CompoundDlg.h @@ -41,7 +41,7 @@ class BuildGUI_CompoundDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_CompoundDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BuildGUI_CompoundDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BuildGUI_CompoundDlg(); protected: diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index 33518dc5c..ae8150407 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -32,9 +32,14 @@ #include #include "utilities.h" -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + //================================================================================= // class : BuildGUI_EdgeDlg() // purpose : Constructs a BuildGUI_EdgeDlg which is a child of 'parent', with the @@ -42,11 +47,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BuildGUI_EdgeDlg::BuildGUI_EdgeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BuildGUI_EdgeDlg::BuildGUI_EdgeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_EDGE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_EDGE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_EDGE_TITLE")); @@ -109,7 +114,8 @@ void BuildGUI_EdgeDlg::Init() connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_EDGE") ); } @@ -149,7 +155,7 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkPoint1 = false; else if(myEditCurrentArgument == GroupPoints->LineEdit2) @@ -159,7 +165,7 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult) return; @@ -225,7 +231,8 @@ void BuildGUI_EdgeDlg::SetEditCurrentArgument() void BuildGUI_EdgeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; globalSelection( GEOM_POINT ); displayPreview(); } diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.h b/src/BuildGUI/BuildGUI_EdgeDlg.h index b86590bff..2d3af1aba 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.h +++ b/src/BuildGUI/BuildGUI_EdgeDlg.h @@ -41,7 +41,7 @@ class BuildGUI_EdgeDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_EdgeDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BuildGUI_EdgeDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BuildGUI_EdgeDlg(); protected: diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index 2b76cc7cf..dc1d3cd4e 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -28,11 +28,15 @@ using namespace std; #include "BuildGUI_FaceDlg.h" -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + //Qt includes #include +#include //================================================================================= // class : BuildGUI_FaceDlg() @@ -41,11 +45,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_FACE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_FACE_TITLE")); @@ -98,7 +102,8 @@ void BuildGUI_FaceDlg::Init() connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupWire->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupWire->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName(tr("GEOM_FACE")); } @@ -138,7 +143,7 @@ void BuildGUI_FaceDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); QString aName; - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if(aNbSel < 1) { @@ -146,7 +151,7 @@ void BuildGUI_FaceDlg::SelectionIntoArgument() return; } - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myWires); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myWires); if (!myWires.length()) return; if(aNbSel != 1) @@ -183,7 +188,8 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument() void BuildGUI_FaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; globalSelection( GEOM_WIRE ); } diff --git a/src/BuildGUI/BuildGUI_FaceDlg.h b/src/BuildGUI/BuildGUI_FaceDlg.h index d91ba714c..f59189fd6 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.h +++ b/src/BuildGUI/BuildGUI_FaceDlg.h @@ -41,7 +41,7 @@ class BuildGUI_FaceDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_FaceDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BuildGUI_FaceDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BuildGUI_FaceDlg(); protected: diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index ff65505a6..5972e2994 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -27,10 +27,16 @@ // $Header: #include "BuildGUI_ShellDlg.h" - -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include "TColStd_MapOfInteger.hxx" + +#include + //================================================================================= // class : BuildGUI_ShellDlg() // purpose : Constructs a BuildGUI_ShellDlg which is a child of 'parent', with the @@ -38,11 +44,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BuildGUI_ShellDlg::BuildGUI_ShellDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BuildGUI_ShellDlg::BuildGUI_ShellDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SHELL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SHELL"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); setCaption(tr("GEOM_SHELL_TITLE")); @@ -99,7 +105,8 @@ void BuildGUI_ShellDlg::Init() connect(GroupShell->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName(tr("GEOM_SHELL")); } @@ -140,13 +147,13 @@ void BuildGUI_ShellDlg::SelectionIntoArgument() QString aString; myOkFacesAndShells = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects( mySelection, aString, true ); + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); if ( nbSel == 0 ) return; if ( nbSel != 1 ) aString = QString( "%1_objects ").arg( nbSel ); - GEOMBase::ConvertListOfIOInListOfGO( mySelection->StoredIObjects(), myFacesAndShells, true ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myFacesAndShells, true ); if ( !myFacesAndShells.length() ) return; @@ -183,7 +190,8 @@ void BuildGUI_ShellDlg::SetEditCurrentArgument() void BuildGUI_ShellDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; TColStd_MapOfInteger aMap; aMap.Add(GEOM_SHELL); aMap.Add(GEOM_FACE); diff --git a/src/BuildGUI/BuildGUI_ShellDlg.h b/src/BuildGUI/BuildGUI_ShellDlg.h index 3c3c57c0b..c9f0282a5 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.h +++ b/src/BuildGUI/BuildGUI_ShellDlg.h @@ -41,7 +41,7 @@ class BuildGUI_ShellDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_ShellDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BuildGUI_ShellDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BuildGUI_ShellDlg(); protected: diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx index cdd99d738..f871dbf79 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.cxx +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -27,12 +27,15 @@ // $Header: #include "BuildGUI_SolidDlg.h" - -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + //Qt includes #include +#include //================================================================================= // class : BuildGUI_SolidDlg() @@ -41,11 +44,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BuildGUI_SolidDlg::BuildGUI_SolidDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BuildGUI_SolidDlg::BuildGUI_SolidDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SOLID"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_SOLID"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); setCaption(tr("GEOM_SOLID_TITLE")); @@ -102,7 +105,8 @@ void BuildGUI_SolidDlg::Init() connect(GroupSolid->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupSolid->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(EnableNameField(bool))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName(tr("GEOM_SOLID")); } @@ -142,13 +146,13 @@ void BuildGUI_SolidDlg::SelectionIntoArgument() QString aString = ""; myOkShells = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aString); if (nbSel == 0) return; if(nbSel != 1) aString = tr("%1_objects").arg(nbSel); - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myShells); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myShells); if (!myShells.length()) return; @@ -181,7 +185,8 @@ void BuildGUI_SolidDlg::SetEditCurrentArgument() void BuildGUI_SolidDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; globalSelection( GEOM_SHELL ); } diff --git a/src/BuildGUI/BuildGUI_SolidDlg.h b/src/BuildGUI/BuildGUI_SolidDlg.h index a767fba68..02bf806d6 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.h +++ b/src/BuildGUI/BuildGUI_SolidDlg.h @@ -41,7 +41,7 @@ class BuildGUI_SolidDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_SolidDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BuildGUI_SolidDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BuildGUI_SolidDlg(); protected: diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx index f7f52d8ad..425cb14a0 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.cxx +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -27,9 +27,16 @@ // $Header$ #include "BuildGUI_WireDlg.h" -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include "TColStd_MapOfInteger.hxx" + +#include + //================================================================================= // class : BuildGUI_WireDlg() // purpose : Constructs a BuildGUI_WireDlg which is a child of 'parent', with the @@ -37,11 +44,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -BuildGUI_WireDlg::BuildGUI_WireDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +BuildGUI_WireDlg::BuildGUI_WireDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_WIRE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_WIRE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_WIRE_TITLE")); @@ -96,8 +103,9 @@ void BuildGUI_WireDlg::Init() connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + initName(tr("GEOM_WIRE")); } @@ -137,14 +145,14 @@ void BuildGUI_WireDlg::SelectionIntoArgument() QString aString = ""; /* name of selection */ myOkEdgesAndWires = false; - int nbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aString); if(nbSel == 0) return; if(nbSel != 1) aString = tr("%1_objects").arg(nbSel); - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myEdgesAndWires); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myEdgesAndWires); if (!myEdgesAndWires.length()) return; @@ -181,7 +189,8 @@ void BuildGUI_WireDlg::SetEditCurrentArgument() void BuildGUI_WireDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; TColStd_MapOfInteger aMap; aMap.Add(GEOM_WIRE); aMap.Add(GEOM_EDGE); diff --git a/src/BuildGUI/BuildGUI_WireDlg.h b/src/BuildGUI/BuildGUI_WireDlg.h index 4fa20d828..2f53e2534 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.h +++ b/src/BuildGUI/BuildGUI_WireDlg.h @@ -41,7 +41,7 @@ class BuildGUI_WireDlg : public GEOMBase_Skeleton Q_OBJECT public: - BuildGUI_WireDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + BuildGUI_WireDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~BuildGUI_WireDlg(); protected: diff --git a/src/BuildGUI/Makefile.in b/src/BuildGUI/Makefile.in index abf7e06ca..36d4f80de 100644 --- a/src/BuildGUI/Makefile.in +++ b/src/BuildGUI/Makefile.in @@ -56,14 +56,14 @@ LIB_MOC = \ BuildGUI_SolidDlg.h \ BuildGUI_CompoundDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMFiltersSelection -lGEOMBase diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 1f496edb0..7ceed3f63 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -30,20 +30,32 @@ #include "GeometryGUI.h" #include "GEOM_Displayer.h" -#include "QAD_RightFrame.h" -#include "QAD_WaitCursor.h" -#include "QAD_Desktop.h" -#include "VTKViewer_ViewFrame.h" -#include "VTKViewer_RenderWindowInteractor.h" -#include "OCCViewer_ViewFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "VTKViewer_Prs.h" -#include "OCCViewer_Prs.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include #include -using namespace std; +#include + DisplayGUI* DisplayGUI::myGUIObject = 0; @@ -51,11 +63,11 @@ DisplayGUI* DisplayGUI::myGUIObject = 0; // function : DisplayGUI::GetDisplayGUI() // purpose : Get the only DisplayGUI object [ static ] //======================================================================= -DisplayGUI* DisplayGUI::GetDisplayGUI() +DisplayGUI* DisplayGUI::GetDisplayGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init DisplayGUI only once - myGUIObject = new DisplayGUI(); + myGUIObject = new DisplayGUI( parent ); } return myGUIObject; } @@ -64,7 +76,7 @@ DisplayGUI* DisplayGUI::GetDisplayGUI() // function : DisplayGUI::DisplayGUI() // purpose : Constructor //======================================================================= -DisplayGUI::DisplayGUI() : GEOMGUI() +DisplayGUI::DisplayGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { } @@ -82,16 +94,17 @@ DisplayGUI::~DisplayGUI() // function : DisplayGUI::OnGUIEvent() // purpose : Dispatch menu command //======================================================================= -bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - DisplayGUI* myDisplayGUI = GetDisplayGUI(); + DisplayGUI* myDisplayGUI = GetDisplayGUI( getGeometryGUI() ); switch (theCommandID) { case 211: // MENU VIEW - WIREFRAME/SHADING { myDisplayGUI->InvertDisplayMode(); int newMode = myDisplayGUI->GetDisplayMode(); - QAD_Application::getDesktop()->menuBar()->changeItem( 211, newMode == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") ); + SUIT_Session::session()->activeApplication()->desktop()->menuBar()-> + changeItem( 211, newMode == 1 ? tr( "GEOM_MEN_WIREFRAME" ) : tr("GEOM_MEN_SHADING") ); break; } case 212: // MENU VIEW - DISPLAY ALL @@ -131,7 +144,7 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } default: { - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } } @@ -144,24 +157,29 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //===================================================================================== void DisplayGUI::DisplayAll() { - QAD_WaitCursor wc; - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SComponent_var SC = aStudy->FindComponent( "GEOM" ); - if ( SC->_is_nil() ) + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return; + _PTR(Study) aStudy = appStudy->studyDS(); + if ( !aStudy ) return; + _PTR(SComponent) SC ( aStudy->FindComponent( "GEOM" ) ); + if ( !SC ) return; SALOME_ListIO listIO; - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( SC ); + _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( SC ) ); anIter->InitEx( true ); + + SUIT_OverrideCursor(); + while( anIter->More() ) { - SALOMEDS::SObject_var valSO = anIter->Value(); - SALOMEDS::SObject_var refSO; + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; if ( !valSO->ReferencedObject( refSO ) ) { - listIO.Append( new SALOME_InteractiveObject( valSO->GetID(), SC->ComponentDataType() ,valSO->GetName()) ); + listIO.Append( new SALOME_InteractiveObject( valSO->GetID().c_str(), SC->ComponentDataType().c_str() ,valSO->GetName().c_str() ) ); } anIter->Next(); } - GEOM_Displayer().Display( listIO, true ); + GEOM_Displayer( appStudy ).Display( listIO, true ); } //===================================================================================== @@ -170,10 +188,20 @@ void DisplayGUI::DisplayAll() //===================================================================================== void DisplayGUI::EraseAll() { - QAD_WaitCursor wc; - QAD_ViewFrame* vf = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); - if ( vf->getTypeView() == VIEW_OCC || vf->getTypeView() == VIEW_VTK ) - vf->EraseAll(); + SUIT_OverrideCursor(); + + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if ( app ) { + SUIT_ViewWindow* vw = app->desktop()->activeWindow(); + if ( vw ) { + SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + SUIT_ViewManager* vman = vw->getViewManager(); + if ( vman->getType() == OCCViewer_Viewer::Type() || + vman->getType() == VTKViewer_Viewer::Type() ) { + GEOM_Displayer( appStudy ).EraseAll(); + } + } + } } //===================================================================================== @@ -192,27 +220,39 @@ void DisplayGUI::DisplayOnly() //===================================================================================== void DisplayGUI::Display() { - QAD_WaitCursor wc; SALOME_ListIO listIO; + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + + SalomeApp_Study* anActiveStudy = dynamic_cast( app->activeStudy() ); + if ( !anActiveStudy ) return; + + //get SalomeApp selection manager + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; + + SALOME_ListIO aList; + aSelMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO It( aList ); + + SUIT_OverrideCursor(); - QAD_Study* anActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); for( ;It.More();It.Next() ) { Handle(SALOME_InteractiveObject) anIObject = It.Value(); if ( anIObject->hasEntry() ) { - SALOMEDS::SObject_var SO = anActiveStudy->getStudyDocument()->FindObjectID( anIObject->getEntry() ); - if ( !SO->_is_nil() && QString( SO->GetID() ) == QString( SO->GetFatherComponent()->GetID() ) ) { - SALOMEDS::SComponent_var SC = SO->GetFatherComponent(); + _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) ); + if ( SO && QString( SO->GetID().c_str() ) == QString( SO->GetFatherComponent()->GetID().c_str() ) ) { + _PTR(SComponent) SC ( SO->GetFatherComponent() ); // if component is selected listIO.Clear(); - SALOMEDS::ChildIterator_var anIter = anActiveStudy->getStudyDocument()->NewChildIterator( SO ); + _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) ); anIter->InitEx( true ); while( anIter->More() ) { - SALOMEDS::SObject_var valSO = anIter->Value(); - SALOMEDS::SObject_var refSO; + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; if ( !valSO->ReferencedObject( refSO ) ) { - listIO.Append( new SALOME_InteractiveObject( valSO->GetID(), SC->ComponentDataType() ,valSO->GetName()) ); + listIO.Append( new SALOME_InteractiveObject( valSO->GetID().c_str(), SC->ComponentDataType().c_str() ,valSO->GetName().c_str() ) ); } anIter->Next(); } @@ -226,7 +266,7 @@ void DisplayGUI::Display() listIO.Append( anIObject ); } } - GEOM_Displayer().Display( listIO, true ); + GEOM_Displayer( anActiveStudy ).Display( listIO, true ); } @@ -236,27 +276,39 @@ void DisplayGUI::Display() //===================================================================================== void DisplayGUI::Erase() { - QAD_WaitCursor wc; SALOME_ListIO listIO; - QAD_Study* anActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + + SalomeApp_Study* anActiveStudy = dynamic_cast( app->activeStudy() ); + if ( !anActiveStudy ) return; + + //get SalomeApp selection manager + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; + + SALOME_ListIO aList; + aSelMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO It( aList ); + + SUIT_OverrideCursor(); + for( ;It.More();It.Next() ) { Handle(SALOME_InteractiveObject) anIObject = It.Value(); if ( anIObject->hasEntry() ) { - SALOMEDS::SObject_var SO = anActiveStudy->getStudyDocument()->FindObjectID( anIObject->getEntry() ); - if ( !SO->_is_nil() && QString( SO->GetID() ) == QString( SO->GetFatherComponent()->GetID() ) ) { - SALOMEDS::SComponent_var SC = SO->GetFatherComponent(); + _PTR(SObject) SO ( anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ) ); + if ( SO && QString( SO->GetID().c_str() ) == QString( SO->GetFatherComponent()->GetID().c_str() ) ) { + _PTR(SComponent) SC ( SO->GetFatherComponent() ); // if component is selected listIO.Clear(); - SALOMEDS::ChildIterator_var anIter = anActiveStudy->getStudyDocument()->NewChildIterator( SO ); + _PTR(ChildIterator) anIter ( anActiveStudy->studyDS()->NewChildIterator( SO ) ); anIter->InitEx( true ); while( anIter->More() ) { - SALOMEDS::SObject_var valSO = anIter->Value(); - SALOMEDS::SObject_var refSO; + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; if ( !valSO->ReferencedObject( refSO ) ) { - listIO.Append( new SALOME_InteractiveObject( valSO->GetID(), SC->ComponentDataType() ,valSO->GetName()) ); + listIO.Append( new SALOME_InteractiveObject( valSO->GetID().c_str(), SC->ComponentDataType().c_str() ,valSO->GetName().c_str() ) ); } anIter->Next(); } @@ -270,25 +322,26 @@ void DisplayGUI::Erase() listIO.Append( anIObject ); } } - GEOM_Displayer().Erase( listIO, true ); - Sel->ClearIObjects(); + GEOM_Displayer(anActiveStudy).Erase( listIO, true ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->clearSelected(); } //===================================================================================== // function : DisplayGUI::SetDisplayMode() -// purpose : Set display mode for the viewer (current viewer if - 0 ) +// purpose : Set display mode for the viewer (current viewer if - 0 ) //===================================================================================== -void DisplayGUI::SetDisplayMode( const int mode, QAD_ViewFrame* viewFrame ) +void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ) { - QAD_WaitCursor wc; - if ( !viewFrame ) - viewFrame = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); - if( viewFrame->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)viewFrame)->getRWInteractor(); + SUIT_OverrideCursor(); + + if ( !viewWindow ) + viewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if ( viewWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewWindow*)viewWindow)->getRWInteractor(); myRenderInter->SetDisplayMode( mode ); } - else if( viewFrame->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)viewFrame)->getViewer(); + else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_DisplayMode newmode = (mode == 1 ? AIS_Shaded : AIS_WireFrame); AIS_ListOfInteractive List; @@ -312,19 +365,19 @@ void DisplayGUI::SetDisplayMode( const int mode, QAD_ViewFrame* viewFrame ) //===================================================================================== // function : DisplayGUI::GetDisplayMode() -// purpose : Get display mode of the viewer (current viewer if - 0 ) +// purpose : Get display mode of the viewer (current viewer if - 0 ) //===================================================================================== -int DisplayGUI::GetDisplayMode( QAD_ViewFrame* viewFrame ) +int DisplayGUI::GetDisplayMode( SUIT_ViewWindow* viewWindow ) { int dispMode = 0; - if ( !viewFrame ) - viewFrame = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); - if( viewFrame->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)viewFrame)->getRWInteractor(); + if ( !viewWindow ) + viewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if ( viewWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewWindow*)viewWindow)->getRWInteractor(); dispMode = myRenderInter->GetDisplayMode(); } - else if( viewFrame->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)viewFrame)->getViewer(); + else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode(); dispMode = (mode == AIS_WireFrame ? 0 : 1 ); @@ -335,29 +388,42 @@ int DisplayGUI::GetDisplayMode( QAD_ViewFrame* viewFrame ) //===================================================================================== // function : DisplayGUI::InvertDisplayMode() // purpose : Invert display mode ( shadin <-> wireframe ) for the viewer -// (current viewer if = 0 ) +// (current viewer if = 0 ) //===================================================================================== -void DisplayGUI::InvertDisplayMode( QAD_ViewFrame* viewFrame ) +void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow ) { - SetDisplayMode( 1 - GetDisplayMode( viewFrame ) ); + SetDisplayMode( 1 - GetDisplayMode( viewWindow ) ); } //===================================================================================== // function : DisplayGUI::ChangeDisplayMode() // purpose : Set display mode for selected objects in the viewer given -// (current viewer if = 0 ) +// (current viewer if = 0 ) //===================================================================================== -void DisplayGUI::ChangeDisplayMode( const int mode, QAD_ViewFrame* viewFrame ) +void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ) { - QAD_WaitCursor wc; - if ( !viewFrame ) - viewFrame = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - if ( viewFrame->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)viewFrame)->getRWInteractor(); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + if ( !viewWindow ) + viewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; + + SUIT_OverrideCursor(); + + SALOME_ListIO aList; + + if ( viewWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) { + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewWindow*)viewWindow)->getRWInteractor(); + + aSelMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO It( aList ); + for( ;It.More(); It.Next() ) { - VTKViewer_Prs* vtkPrs = dynamic_cast( viewFrame->CreatePrs( It.Value()->getEntry() ) ); + SVTK_Viewer* stvkViewer = (SVTK_Viewer*)(viewWindow->getViewManager()->getViewModel()); + SVTK_Prs* vtkPrs = dynamic_cast( stvkViewer->CreatePrs( It.Value()->getEntry() ) ); if ( vtkPrs && !vtkPrs->IsNull() ) { if ( mode == 0 ) myRenderInter->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); @@ -367,12 +433,16 @@ void DisplayGUI::ChangeDisplayMode( const int mode, QAD_ViewFrame* viewFrame ) } myRenderInter->Render(); } - else if ( viewFrame->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)viewFrame)->getViewer(); + else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + + aSelMgr->selectedObjects( aList ); + SALOME_ListIteratorOfListIO It( aList ); + for( ;It.More(); It.Next() ) { - OCCViewer_Prs* occPrs = dynamic_cast( viewFrame->CreatePrs( It.Value()->getEntry() ) ); + SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel()); + SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( It.Value()->getEntry() ) ); if ( occPrs && !occPrs->IsNull() ) { AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); AIS_ListIteratorOfListOfInteractive interIter( shapes ); @@ -393,8 +463,8 @@ void DisplayGUI::ChangeDisplayMode( const int mode, QAD_ViewFrame* viewFrame ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return DisplayGUI::GetDisplayGUI(); + return DisplayGUI::GetDisplayGUI( parent ); } } diff --git a/src/DisplayGUI/DisplayGUI.h b/src/DisplayGUI/DisplayGUI.h index bf2b57ac1..10f53a97b 100644 --- a/src/DisplayGUI/DisplayGUI.h +++ b/src/DisplayGUI/DisplayGUI.h @@ -36,20 +36,21 @@ // class : GEOMBase_Display // purpose : //================================================================================= -class QAD_ViewFrame; +//class QAD_ViewFrame; +class SUIT_ViewWindow; class DisplayGUI : public GEOMGUI { protected: - DisplayGUI(); // hide constructor to avoid direct creation + DisplayGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~DisplayGUI(); // Get the only DisplayGUI object - static DisplayGUI* GetDisplayGUI(); + static DisplayGUI* GetDisplayGUI( GeometryGUI* parent ); // Dispatch menu command - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); // Display all GEOM objects void DisplayAll(); @@ -63,17 +64,17 @@ public : void Erase(); // DISPLAY MODE methods : 0 - wireframe, 1 - shading - // Set display mode for the viewer (current viewer if - 0 ) - void SetDisplayMode( const int mode, QAD_ViewFrame* viewFrame = 0 ); - // Get display mode of the viewer (current viewer if - 0 ) - int GetDisplayMode( QAD_ViewFrame* viewFrame = 0 ); + // Set display mode for the viewer (current viewer if - 0 ) + void SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow = 0 ); + // Get display mode of the viewer (current viewer if - 0 ) + int GetDisplayMode( SUIT_ViewWindow* viewWindow = 0 ); // Invert display mode ( shadin <-> wireframe ) for the viewer - // (current viewer if = 0 ) - void InvertDisplayMode( QAD_ViewFrame* viewFrame = 0 ); + // (current viewer if = 0 ) + void InvertDisplayMode( SUIT_ViewWindow* viewWindow = 0 ); // Set display mode for selected objects in the viewer given - // (current viewer if = 0 ) - void ChangeDisplayMode( const int mode, QAD_ViewFrame* viewFrame = 0 ); + // (current viewer if = 0 ) + void ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindo = 0 ); private: static DisplayGUI* myGUIObject; // the only DisplayGUI object diff --git a/src/DisplayGUI/Makefile.in b/src/DisplayGUI/Makefile.in index 8d0958981..59d22518b 100644 --- a/src/DisplayGUI/Makefile.in +++ b/src/DisplayGUI/Makefile.in @@ -44,15 +44,15 @@ LIB_SRC = DisplayGUI.cxx LIB_MOC = -LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMGUI +LDFLAGS += -lGEOM @CONCLUDE@ diff --git a/src/DlgRef/DlgRef_SpinBox.cxx b/src/DlgRef/DlgRef_SpinBox.cxx index 5dc0e0463..418be2d55 100644 --- a/src/DlgRef/DlgRef_SpinBox.cxx +++ b/src/DlgRef/DlgRef_SpinBox.cxx @@ -36,7 +36,7 @@ using namespace std; // purpose : constructor of specific widget accepting floats in double precision. //================================================================================= DlgRef_SpinBox::DlgRef_SpinBox(QWidget* parent, const char* name) -: QAD_SpinBoxDbl(parent, name) + : QtxDblSpinBox(parent, name) { } diff --git a/src/DlgRef/DlgRef_SpinBox.h b/src/DlgRef/DlgRef_SpinBox.h index eec1c40e5..a2659a6f4 100644 --- a/src/DlgRef/DlgRef_SpinBox.h +++ b/src/DlgRef/DlgRef_SpinBox.h @@ -29,13 +29,13 @@ #ifndef GEOMSPINBOX_H #define GEOMSPINBOX_H -#include "QAD_SpinBoxDbl.h" +#include "QtxDblSpinBox.h" //================================================================================= // class : DlgRef_SpinBox // purpose : Derivated from QSpinBox class and modified to accept floats //================================================================================= -class DlgRef_SpinBox : public QAD_SpinBoxDbl +class DlgRef_SpinBox : public QtxDblSpinBox { Q_OBJECT diff --git a/src/DlgRef/Makefile.in b/src/DlgRef/Makefile.in index a986c83f6..546df1fff 100644 --- a/src/DlgRef/Makefile.in +++ b/src/DlgRef/Makefile.in @@ -149,8 +149,8 @@ LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx index 28765de1f..104dfd303 100644 --- a/src/EntityGUI/EntityGUI.cxx +++ b/src/EntityGUI/EntityGUI.cxx @@ -28,15 +28,17 @@ #include "EntityGUI.h" #include "GeometryGUI.h" - -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include "VTKViewer_ViewFrame.h" #include "GEOM_AssemblyBuilder.h" -#include "SALOMEGUI_ImportOperation.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "OCCViewer_ViewModel.h" +#include "OCCViewer_ViewManager.h" +#include "VTKViewer_ViewModel.h" +#include "SalomeApp_Study.h" +#include "SalomeApp_Tools.h" +//#include "SALOMEGUI_ImportOperation.h" #include #include @@ -47,6 +49,7 @@ #include "utilities.h" +using namespace boost; using namespace std; EntityGUI* EntityGUI::myGUIObject = 0; @@ -55,11 +58,11 @@ EntityGUI* EntityGUI::myGUIObject = 0; // function : GetEntityGUI() // purpose : Get the only EntityGUI object [ static ] //======================================================================= -EntityGUI* EntityGUI::GetEntityGUI() +EntityGUI* EntityGUI::GetEntityGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init EntityGUI only once - myGUIObject = new EntityGUI(); + myGUIObject = new EntityGUI( parent ); } return myGUIObject; } @@ -68,10 +71,10 @@ EntityGUI* EntityGUI::GetEntityGUI() // function : EntityGUI() // purpose : Constructor //======================================================================= -EntityGUI::EntityGUI() : GEOMGUI() +EntityGUI::EntityGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { myGeomBase = new GEOMBase(); - myGeom = GEOM::GEOM_Gen::_duplicate( GeometryGUI::GetGeomGUI()->GetGeomGen() ); + myGeom = GEOM::GEOM_Gen::_duplicate( GeometryGUI::GetGeomGen() ); mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); @@ -91,23 +94,22 @@ EntityGUI::~EntityGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; switch (theCommandID) { case 404: // SKETCHER - GeometryGUI::GetGeomGUI()->ActiveWorkingPlane(); - aDlg = new EntityGUI_SketcherDlg(parent, "", Sel); + getGeometryGUI()->ActiveWorkingPlane(); + aDlg = new EntityGUI_SketcherDlg(getGeometryGUI(), parent, ""); break; case 407: // EXPLODE : use ic - aDlg = new EntityGUI_SubShapeDlg(parent, "", Sel); + aDlg = new EntityGUI_SubShapeDlg(parent, ""); break; default: - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } if ( aDlg ) @@ -137,7 +139,7 @@ void EntityGUI::OnSketchEnd(const char *Cmd) QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); + SalomeApp_Tools::QtCatchCorbaException(S_ex); } */ return; @@ -151,10 +153,12 @@ void EntityGUI::OnSketchEnd(const char *Cmd) void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2) { //NRI DEBUG : 14/02/2002 - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) return; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + + OCCViewer_Viewer* v3d = + ((OCCViewer_ViewManager*)(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); try { if(!S1.IsNull()) { @@ -197,10 +201,18 @@ void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shap //================================================================================== void EntityGUI::EraseSimulationShape() { - int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); - for(int i = 0; i < count; i++) { - if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + // get all view windows at the desktop + QPtrList aWndLst = SUIT_Session::session()->activeApplication()->desktop()->windows(); + //get all view windows, which belong to the active study + QPtrList aWndLstAS; + SUIT_ViewWindow* vw; + for ( vw = aWndLst.first(); vw; vw = aWndLst.next() ) + if ( vw->getViewManager()->study() == SUIT_Session::session()->activeApplication()->activeStudy() ) + aWndLstAS.append( vw ); + + for ( vw = aWndLstAS.first(); vw; vw = aWndLstAS.next() ) { + if ( vw->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(vw->getViewManager()))->getOCCViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); ic->Erase(mySimulationShape1, Standard_True, Standard_False); ic->ClearPrs(mySimulationShape1); @@ -215,24 +227,25 @@ void EntityGUI::EraseSimulationShape() // function : SObjectExist() // purpose : //===================================================================================== -bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) +bool EntityGUI::SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR) { - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject); - SALOMEDS::SObject_var RefSO; - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + _PTR(ChildIterator) it ( aStudy->NewChildIterator(theFatherObject) ); + _PTR(SObject) RefSO; + _PTR(GenericAttribute) anAttr; for(; it->More();it->Next()) { - SALOMEDS::SObject_var SO= it->Value(); + _PTR(SObject) SO ( it->Value() ); if(SO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - if(strcmp( anIOR->Value(), IOR ) == 0) + _PTR(AttributeIOR) anIOR ( anAttr ); + if(strcmp( anIOR->Value().c_str(), IOR ) == 0) return true; } if(SO->ReferencedObject(RefSO)) { if(RefSO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - if(strcmp(anIOR->Value(), IOR) == 0) + _PTR(AttributeIOR) anIOR ( anAttr ); + if(strcmp(anIOR->Value().c_str(), IOR) == 0) return true; } } @@ -247,7 +260,7 @@ bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* //===================================================================================== bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) { - QAD_Application::getDesktop()->putInfo("OnSubShapeGetAll method from EntityGUI should be reimplemented ..."); + SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetAll method from EntityGUI should be reimplemented ..."); /* SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); @@ -277,7 +290,7 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap } } catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); + SalomeApp_Tools::QtCatchCorbaException(S_ex); } // open transaction @@ -467,7 +480,7 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap //===================================================================================== bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) { - QAD_Application::getDesktop()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ..."); + SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ..."); // //* Test the type of viewer */ // if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) // return false; @@ -532,7 +545,7 @@ bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* // aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID); // } // catch (const SALOME::SALOME_Exception& S_ex) { -// QtCatchCorbaException(S_ex); +// SalomeApp_Tools::QtCatchCorbaException(S_ex); // } // /* local context from DialogBox */ @@ -655,8 +668,8 @@ bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return EntityGUI::GetEntityGUI(); + return EntityGUI::GetEntityGUI( parent ); } } diff --git a/src/EntityGUI/EntityGUI.h b/src/EntityGUI/EntityGUI.h index bc0fdadc4..fe2f7d816 100644 --- a/src/EntityGUI/EntityGUI.h +++ b/src/EntityGUI/EntityGUI.h @@ -32,6 +32,8 @@ #include "GEOMGUI.h" #include "GEOMBase.h" +#include "SALOMEDSClient.hxx" + //================================================================================= // class : EntityGUI // purpose : @@ -39,15 +41,15 @@ class EntityGUI : public GEOMGUI { protected: - EntityGUI(); // hide constructor to avoid direct creation + EntityGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~EntityGUI(); // Get the only EntityGUI object - static EntityGUI* GetEntityGUI(); + static EntityGUI* GetEntityGUI( GeometryGUI* parent ); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); void OnSketchEnd(const char *Cmd); @@ -58,7 +60,7 @@ public : void MakeBezierAndDisplay(GEOM::string_array& listShapesIOR); /* Methods for sub shapes explode */ - bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); + bool SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR); bool OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType); bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext); diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index bd150b1ad..0ac078075 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -29,11 +29,16 @@ #include "EntityGUI_SketcherDlg.h" #include "Sketcher_Profile.hxx" #include "GEOM_Displayer.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include +#include #include #include @@ -56,11 +61,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) -:EntityGUI_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), GEOMBase_Helper(), myIsAllAdded( false ) +EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :EntityGUI_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), GEOMBase_Helper(), myIsAllAdded( false ), + myGeometryGUI( GUI ) { - mySelection = Sel; - GeometryGUI::GetGeomGUI()->SetActiveDialogBox(this); + myGeometryGUI->SetActiveDialogBox(this); if ( !name ) setName("EntityGUI_SketcherDlg"); @@ -72,9 +77,9 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(QWidget* parent, const char* name, GroupDest2->close(TRUE); GroupDest3->close(TRUE); - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_UNDO"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_REDO"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_UNDO"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REDO"))); setCaption(tr("GEOM_SKETCHER_TITLE")); @@ -191,19 +196,19 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(QWidget* parent, const char* name, connect(Group4Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(Group4Spin->SpinBox_DS, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group1Spin->SpinBox_DX, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DX, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DY, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DX, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DY, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DZ, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DX, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DY, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DZ, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DS, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DS, SLOT(SetStep(double))); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(GeometryGUI::GetGeomGUI(), SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(myGeometryGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeometryGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); Init(); } @@ -215,7 +220,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(QWidget* parent, const char* name, //================================================================================= EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() { - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( 0 ); + myGeometryGUI->SetActiveDialogBox( 0 ); } @@ -239,8 +244,7 @@ void EntityGUI_SketcherDlg::Init() myLastY2 = 0.0; /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 ); /* min, max, step and decimals for spin boxes */ Group1Spin->SpinBox_DX->RangeStepAndValidator(-999999.999, 999999.999, step, 3); @@ -275,7 +279,7 @@ void EntityGUI_SketcherDlg::Init() //================================================================================= void EntityGUI_SketcherDlg::InitClick() { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); Group1Sel->hide(); Group1Spin->hide(); @@ -383,7 +387,8 @@ void EntityGUI_SketcherDlg::PointClicked(int constructorId) { // Selection mySketchType = PT_SEL; myEditCurrentArgument = Group1Sel->LineEdit1; - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; Group1Sel->show(); Group1Sel->buttonApply->setFocus(); SelectionIntoArgument(); @@ -632,8 +637,8 @@ void EntityGUI_SketcherDlg::ClickOnEnd() // Verify validity of commands if ( myCommand.count() <= 2 ) { - QAD_MessageBox::error1( QAD_Application::getDesktop(), - tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) ); + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), + tr( "GEOM_ERROR_STATUS" ), tr( "CANNOT_CLOSE" ), tr( "BUT_OK" ) ); return; } @@ -763,16 +768,16 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() myX = myLastX1; myY = myLastY1; - int nbSel = mySelection->IObjectCount(); + int nbSel = IObjectCount(); if ( nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1 ) { Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aRes ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_VERTEX ) ) { gp_Trsf aTrans; - gp_Ax3 aWPlane = GeometryGUI::GetGeomGUI()->GetWorkingPlane(); + gp_Ax3 aWPlane = myGeometryGUI->GetWorkingPlane(); aTrans.SetTransformation(aWPlane); BRepBuilderAPI_Transform aTransformation(aShape, aTrans, Standard_False); @@ -822,7 +827,7 @@ void EntityGUI_SketcherDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text(); QWidget* thisWidget = (QWidget*)this; - if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, mySelection)) + if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, selectedIO())) myEditCurrentArgument->setText(objectUserName); } } @@ -834,12 +839,12 @@ void EntityGUI_SketcherDlg::LineEditReturnPressed() //================================================================================= void EntityGUI_SketcherDlg::DeactivateActiveDialog() { - GeometryGUI::GetGeomGUI()->SetState( -1 ); + //myGeometryGUI->SetState( -1 ); setEnabled( false ); globalSelection(); - disconnect(mySelection, 0, this, 0); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox(0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + myGeometryGUI->SetActiveDialogBox(0); } @@ -849,13 +854,14 @@ void EntityGUI_SketcherDlg::DeactivateActiveDialog() //================================================================================= void EntityGUI_SketcherDlg::ActivateThisDialog() { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); + myGeometryGUI->EmitSignalDeactivateDialog(); setEnabled(true); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox((QDialog*)this); + myGeometryGUI->SetActiveDialogBox((QDialog*)this); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - GeometryGUI::GetGeomGUI()->SetState( 0 ); + //myGeometryGUI->SetState( 0 ); globalSelection( GEOM_POINT ); myEditCurrentArgument = Group1Sel->LineEdit1; @@ -882,8 +888,8 @@ void EntityGUI_SketcherDlg::enterEvent(QEvent* e) //================================================================================= void EntityGUI_SketcherDlg::closeEvent(QCloseEvent* e) { - GeometryGUI::GetGeomGUI()->SetState( -1 ); - disconnect(mySelection, 0, this, 0); + //myGeometryGUI->SetState( -1 ); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); QDialog::closeEvent( e ); } @@ -1279,7 +1285,7 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects ) } } - gp_Ax3 myWPlane = GeometryGUI::GetGeomGUI()->GetWorkingPlane(); + gp_Ax3 myWPlane = myGeometryGUI->GetWorkingPlane(); GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble; WPlane->length(9); WPlane[0] = myWPlane.Location().X(); @@ -1323,7 +1329,7 @@ void EntityGUI_SketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object, getDisplayer()->SetToActivate( activate ); // Make a reference to GEOM_Object - getDisplayer()->SetName( GeometryGUI::GetORB()->object_to_string( object ) ); + getDisplayer()->SetName( myGeometryGUI->getApp()->orb()->object_to_string( object ) ); // Create wire from applayed object TopoDS_Shape anApplyedWire, aLastSegment; @@ -1390,30 +1396,14 @@ bool EntityGUI_SketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject, return true; } - - - - - - - - - - - - - - - - - - - - - - - - +//================================================================================= +// function : getDesktop() +// purpose : +//================================================================================= +SUIT_Desktop* EntityGUI_SketcherDlg::getDesktop() const +{ + return dynamic_cast( parentWidget() ); +} diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h index d7c287d79..4fc1149d5 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.h +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -45,8 +45,6 @@ #include "EntityGUI.h" #include "GeometryGUI.h" -#include "GEOM_ShapeTypeFilter.hxx" - #include #include @@ -65,7 +63,7 @@ class EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QTD, public GEOMBase_Hel Q_OBJECT public: - EntityGUI_SketcherDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + EntityGUI_SketcherDlg(GeometryGUI* GUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~EntityGUI_SketcherDlg(); protected: @@ -76,6 +74,8 @@ protected: void closeEvent( QCloseEvent* e ); + virtual SUIT_Desktop* getDesktop() const; + private : void Init(); void enterEvent(QEvent* e); @@ -93,7 +93,6 @@ private : bool myIsAllAdded; QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - SALOME_Selection* mySelection; /* User shape selection */ QStringList myCommand; QStringList myUndoCommand; @@ -113,6 +112,8 @@ private : EntityGUI_3Spin* Group3Spin; EntityGUI_4Spin* Group4Spin; + GeometryGUI* myGeometryGUI; + enum SketchState {FIRST_POINT, NEXT_POINT}; enum SketchType {PT_ABS, PT_RELATIVE, PT_SEL, diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index ff6304c63..4fbbd78f6 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -29,8 +29,11 @@ #include "EntityGUI_SubShapeDlg.h" #include "GEOM_Displayer.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "OCCViewer_ViewModel.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include "SALOME_ListIteratorOfListIO.hxx" #include @@ -39,6 +42,8 @@ #include #include +#include +#include //================================================================================= // class : EntityGUI_SubShapeDlg @@ -47,11 +52,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, fl) +EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, fl) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SUBSHAPE_TITLE")); @@ -108,7 +113,8 @@ void EntityGUI_SubShapeDlg::Init() GroupPoints->ComboBox1->insertItem("Vertex"); GroupPoints->ComboBox1->insertItem("Shape"); - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) + if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type()) GroupPoints->CheckButton1->setEnabled(false); /* signals and slots connections */ @@ -125,8 +131,9 @@ void EntityGUI_SubShapeDlg::Init() connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(SubShapeToggled())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + updateButtonState(); SelectionIntoArgument(); @@ -150,7 +157,7 @@ void EntityGUI_SubShapeDlg::ClickOnOk() //================================================================================= bool EntityGUI_SubShapeDlg::ClickOnApply() { - QAD_Application::getDesktop()->putInfo(tr("")); + SUIT_Session::session()->activeApplication()->putInfo(tr("")); /* Explode all sub shapes */ if( isAllSubShapes() ) { @@ -185,20 +192,20 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() QString aString = ""; /* name of selection */ - int nbSel = GEOMBase::GetNameOfSelectedIObjects( mySelection, aString, true ); + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); if( nbSel != 1 ) return; TopoDS_Shape S; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) IO = firstIObject(); if ( !IO->hasEntry() ) { - QAD_Application::getDesktop()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); updateButtonState(); return; } - if ( !myGeomBase->GetTopoFromSelection( mySelection, S ) || + if ( !myGeomBase->GetTopoFromSelection( selectedIO(), S ) || S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { @@ -332,7 +339,8 @@ void EntityGUI_SubShapeDlg::DeactivateActiveDialog() void EntityGUI_SubShapeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; SubShapeToggled(); updateButtonState(); } @@ -456,7 +464,7 @@ unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes (const TopoDS_Shape& S, //================================================================================= void EntityGUI_SubShapeDlg::updateButtonState() { - if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() != OCCViewer_Viewer::Type() || myObject->_is_nil() || shapeType() == TopAbs_SHAPE || shapeType() == TopAbs_COMPOUND ) { GroupPoints->CheckButton1->setChecked( FALSE ); GroupPoints->CheckButton1->setEnabled( FALSE ); @@ -514,14 +522,14 @@ bool EntityGUI_SubShapeDlg::isValid( QString& msg ) if ( !myObject->_is_nil() ) { if ( isAllSubShapes() ) isOk = true; - else if ( mySelection->IObjectCount() == 1 ) { + else if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); isOk = aMapIndex.Extent() > 0; if ( !isOk ) msg += tr( "NO_SUBSHAPES_SELECTED" ); @@ -547,14 +555,14 @@ bool EntityGUI_SubShapeDlg::execute( ObjectList& objects ) // and manual selection is active if ( !isAllSubShapes() ) { - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() ); diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.h b/src/EntityGUI/EntityGUI_SubShapeDlg.h index 3baba6c6c..ba1658a24 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.h +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.h @@ -44,7 +44,6 @@ class EntityGUI_SubShapeDlg : public GEOMBase_Skeleton public: EntityGUI_SubShapeDlg( QWidget* parent = 0, const char* name = 0, - SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); ~EntityGUI_SubShapeDlg(); diff --git a/src/EntityGUI/Makefile.in b/src/EntityGUI/Makefile.in index 2fd741ec5..720b6f7e9 100644 --- a/src/EntityGUI/Makefile.in +++ b/src/EntityGUI/Makefile.in @@ -74,15 +74,15 @@ LIB_MOC = \ EntityGUI_SketcherDlg.h \ EntityGUI_SubShapeDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMFiltersSelection -lGEOMSketcher -lGEOMBase -lGEOMGUI +LDFLAGS += -lGEOMFiltersSelection -lGEOMSketcher -lGEOMBase -lGEOM @CONCLUDE@ diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 46726dcea..705f9c0e6 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -5,13 +5,13 @@ #include "GEOM_ISubShape.hxx" #include "GEOM_SubShapeDriver.hxx" #include "GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient.hxx" +#include "GEOM_PythonDump.hxx" #include "utilities.h" -#include - #include #include +#include #include #include #include @@ -23,6 +23,14 @@ #include #include #include +#include +#include + +#include +#include + +#include +#include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -50,6 +58,12 @@ static Standard_Integer ExtractDocID(TCollection_AsciiString& theID) return aDocID.IntegerValue(); } +void ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TColStd_MapOfTransient& theProcessed); + +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString); + //============================================================================= /*! * GetEngine @@ -157,7 +171,9 @@ Handle(GEOM_Object) GEOM_Engine::AddObject(int theDocID, int theType) * AddSubShape */ //============================================================================= -Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices) +Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation) { if(theMainShape.IsNull() || theIndices.IsNull()) return NULL; @@ -192,19 +208,18 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, H if(_objects.IsBound(anID)) _objects.UnBind(anID); _objects.Bind(anID, anObject); - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(anObject->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = geom.AddSubShape("; - TDF_Tool::Entry(theMainShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (", ["); - for(Standard_Integer i=theIndices->Lower(); i<=theIndices->Upper(); i++) { - aDescr += (TCollection_AsciiString(theIndices->Value(i))+", "); + GEOM::TPythonDump pd (aFunction); + + if (isStandaloneOperation) { + pd << anObject << " = geompy.GetSubShape(" << theMainShape << ", ["; + Standard_Integer i = theIndices->Lower(), up = theIndices->Upper(); + for (; i <= up - 1; i++) { + pd << theIndices->Value(i) << ", "; + } + pd << theIndices->Value(up) << "])"; } - aDescr.Trunc(aDescr.Length()-1); - aDescr += "])"; - aFunction->SetDescription(aDescr); + else + pd << "None"; return anObject; } @@ -222,6 +237,14 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject) TCollection_AsciiString anID = BuildIDFromObject(theObject); if(_objects.IsBound(anID)) _objects.UnBind(anID); + int nb = theObject->GetNbFunctions(); + Handle(TDataStd_TreeNode) aNode; + for(int i = 1; i<=nb; i++) { + Handle(GEOM_Function) aFunction = theObject->GetFunction(i); + if(aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) + aNode->Remove(); + } + TDF_Label aLabel = theObject->GetEntry(); aLabel.ForgetAllAttributes(Standard_True); @@ -273,7 +296,9 @@ bool GEOM_Engine::Save(int theDocID, char* theFileName) bool GEOM_Engine::Load(int theDocID, char* theFileName) { Handle(TDocStd_Document) aDoc; - if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) return false; + if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) { + return false; + } aDoc->SetUndoLimit(_UndoLimit); @@ -282,6 +307,8 @@ bool GEOM_Engine::Load(int theDocID, char* theFileName) TDataStd_Integer::Set(aDoc->Main(), theDocID); + _OCAFApp->SaveAs(aDoc, "/dn05/salome/srn/Test.sdg"); + return true; } @@ -310,3 +337,294 @@ void GEOM_Engine::Close(int theDocID) aDoc.Nullify(); } } + +//============================================================================= +/*! + * DumpPython + */ +//============================================================================= +TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID, + Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + bool isPublished, + bool& aValidScript) +{ + TCollection_AsciiString aScript; + Handle(TDocStd_Document) aDoc = GetDocument(theDocID); + + if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n"); + + aScript = "import geompy\n"; + aScript += "import math\n\n"; + aScript += "def RebuildData(theStudy):"; + aScript += "\n\tgeompy.init_geom(theStudy)"; + + Standard_Integer posToInertGlobalVars = aScript.Length() + 1; + + Handle(TDataStd_TreeNode) aNode, aRoot; + Handle(GEOM_Function) aFunction; + TColStd_MapOfTransient aMap; + + if(aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) { + TDataStd_ChildNodeIterator Itr(aRoot); + for(; Itr.More(); Itr.Next()) { + aNode = Itr.Value(); + aFunction = GEOM_Function::GetFunction(aNode->Label()); + if(aFunction.IsNull()) { + cout << "Null function !!!!" << endl; + continue; + } + ProcessFunction(aFunction, aScript, aMap); + } + } + + Resource_DataMapOfAsciiStringAsciiString aEntry2StEntry, aStEntry2Entry; + Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString anEntryToNameIt; + // build maps entry <-> studyEntry + for (anEntryToNameIt.Initialize( theObjectNames ); + anEntryToNameIt.More(); + anEntryToNameIt.Next()) + { + const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); + // look for an object by entry + TDF_Label L; + TDF_Tool::Label( aDoc->GetData(), aEntry, L ); + if ( L.IsNull() ) continue; + Handle(GEOM_Object) obj = GEOM_Object::GetObject( L ); + // fill maps + if ( !obj.IsNull() ) { + TCollection_AsciiString aStudyEntry (obj->GetAuxData()); + aEntry2StEntry.Bind( aEntry, aStudyEntry); + aStEntry2Entry.Bind( aStudyEntry, aEntry ); + } + } + + Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript); + Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = aScript.Length(); + Resource_DataMapOfAsciiStringAsciiString aNameToEntry, anEntryToBadName; + + //Replace entries by the names + TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_"), + allowedChars ("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_"); + if(aLen == 0) anUpdatedScript = aScript; + + for(Standard_Integer i = 1; i <= aLen; i+=2) { + anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1); + anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1)); + if(theObjectNames.IsBound(anEntry)) { + aName = theObjectNames.Find(anEntry); + // check validity of aName + bool isValidName = true; + if ( aName.IsIntegerValue() ) { // aName must not start with a digit + aName.Insert( 1, 'a' ); + isValidName = false; + } + int p, p2=1; // replace not allowed chars + while ((p = aName.FirstLocationNotInSet(allowedChars, p2, aName.Length()))) { + aName.SetValue(p, '_'); + p2=p; + isValidName = false; + } + if ( aNameToEntry.IsBound( aName ) && anEntry != aNameToEntry( aName )) + { // diff objects have same name - make a new name by appending a digit + TCollection_AsciiString aName2; + Standard_Integer i = 0; + do { + aName2 = aName + "_" + ++i; + } while ( aNameToEntry.IsBound( aName2 ) && anEntry != aNameToEntry( aName2 )); + aName = aName2; + isValidName = false; + } + if ( !isValidName ) { + if ( isPublished ) + anEntryToBadName.Bind( anEntry, theObjectNames.Find(anEntry) ); + theObjectNames( anEntry ) = aName; + } + } + else { + do { + aName = aBaseName + TCollection_AsciiString(++objectCounter); + } while(aNameToEntry.IsBound(aName)); + theObjectNames.Bind(anEntry, aName); + } + aNameToEntry.Bind(aName, anEntry); // to detect same name of diff objects + + anUpdatedScript += aName; + aStart = aSeq->Value(i+1) + 1; + } + + //Add final part of the script + if(aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength); + + // Make script to publish in study + if ( isPublished ) + { + map< int, string > anEntryToCommandMap; // sort publishing commands by object entry + for (anEntryToNameIt.Initialize( theObjectNames ); + anEntryToNameIt.More(); + anEntryToNameIt.Next()) + { + const TCollection_AsciiString& aEntry = anEntryToNameIt.Key(); + const TCollection_AsciiString& aName = anEntryToNameIt.Value(); + if ( !aEntry2StEntry.IsBound( aEntry )) + continue; // was not published + TCollection_AsciiString aCommand("\n\tgeompy."), aFatherEntry; + + // find a father entry + const TCollection_AsciiString& aStudyEntry = aEntry2StEntry( aEntry ); + TCollection_AsciiString aFatherStudyEntry = + aStudyEntry.SubString( 1, aStudyEntry.SearchFromEnd(":") - 1 ); + if ( aStEntry2Entry.IsBound( aFatherStudyEntry )) + aFatherEntry = aStEntry2Entry( aFatherStudyEntry ); + + // make a command + if ( !aFatherEntry.IsEmpty() && theObjectNames.IsBound( aFatherEntry )) { + aCommand += "addToStudyInFather( "; + aCommand += theObjectNames( aFatherEntry ) + ", "; + } + else + aCommand += "addToStudy( "; + if ( anEntryToBadName.IsBound( aEntry )) + aCommand += aName + ", \"" + anEntryToBadName( aEntry ) + "\" )"; + else + aCommand += aName + ", \"" + aName + "\" )"; + + // bind a command to the last digit of the entry + int tag = + aEntry.SubString( aEntry.SearchFromEnd(":")+1, aEntry.Length() ).IntegerValue(); + anEntryToCommandMap.insert( make_pair( tag, aCommand.ToCString() )); + } + + // add publishing commands to the script + map< int, string >::iterator anEntryToCommand = anEntryToCommandMap.begin(); + for ( ; anEntryToCommand != anEntryToCommandMap.end(); ++anEntryToCommand ) { + anUpdatedScript += (char*)anEntryToCommand->second.c_str(); + } + } + + anUpdatedScript += "\n\tpass\n"; + aValidScript = true; + + // fill _studyEntry2NameMap and build globalVars + TCollection_AsciiString globalVars; + _studyEntry2NameMap.Clear(); + Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString aStEntryToEntryIt; + for (aStEntryToEntryIt.Initialize( aStEntry2Entry ); + aStEntryToEntryIt.More(); + aStEntryToEntryIt.Next() ) + { + const TCollection_AsciiString & name = theObjectNames( aStEntryToEntryIt.Value() ); + _studyEntry2NameMap.Bind (aStEntryToEntryIt.Key(), name ); + if ( !globalVars.IsEmpty() ) + globalVars += ", "; + globalVars += name; + } + if ( !globalVars.IsEmpty() ) { + globalVars.Insert( 1, "\n\tglobal " ); + anUpdatedScript.Insert( posToInertGlobalVars, globalVars ); + } + + return anUpdatedScript; +} + +//======================================================================= +//function : GetDumpName +//purpose : +//======================================================================= + +const char* GEOM_Engine::GetDumpName (const char* theStudyEntry) const +{ + if ( _studyEntry2NameMap.IsBound( (char*)theStudyEntry )) + return _studyEntry2NameMap( (char*)theStudyEntry ).ToCString(); + + return NULL; +} + +//======================================================================= +//function : GetAllDumpNames +//purpose : +//======================================================================= + +Handle(TColStd_HSequenceOfAsciiString) GEOM_Engine::GetAllDumpNames() const +{ + Handle(TColStd_HSequenceOfAsciiString) aRetSeq = new TColStd_HSequenceOfAsciiString; + + Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString it (_studyEntry2NameMap); + for (; it.More(); it.Next()) { + aRetSeq->Append(it.Value()); + } + + return aRetSeq; +} + + +//=========================================================================== +// Internal functions +//=========================================================================== +void ProcessFunction(Handle(GEOM_Function)& theFunction, + TCollection_AsciiString& theScript, + TColStd_MapOfTransient& theProcessed) +{ + if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return; + +/* + TDF_LabelSequence aSeq; + theFunction->GetDependency(aSeq); + Standard_Integer aLen = aSeq.Length(); + for(Standard_Integer i = 1; i<= aLen; i++) { + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i)); + if(aFunction.IsNull()) continue; + ProcessFunction(aFunction, theScript, theProcessed); + } +*/ + + TCollection_AsciiString aDescr = theFunction->GetDescription(); + if(aDescr.Length() == 0) { + //cout << "Warning: the function has no description" << endl; + return; + } + //Check if its internal function which doesn't requires dumping + if(aDescr == "None") return; + + theScript += "\n\t"; + theScript += aDescr; + + theProcessed.Add(theFunction); + return; +} + +//============================================================================= +/*! + * FindEntries: Returns a sequence of start/end positions of entries in the string + */ +//============================================================================= +Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString) +{ + Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger; + Standard_Integer aLen = theString.Length(); + Standard_Boolean isFound = Standard_False; + + char* arr = theString.ToCString(); + Standard_Integer i = 0, j; + + while(i < aLen) { + int c = (int)arr[i]; + j = i+1; + if(c >= 48 && c <= 57) { //Is digit? + + isFound = Standard_False; + while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry + c = (int)arr[j++]; + if(c == 58) isFound = Standard_True; + } + + if(isFound && arr[j-2] != 58) { // last char should be a diggit + aSeq->Append(i+1); // +1 because AsciiString starts from 1 + aSeq->Append(j-1); + } + } + + i = j; + } + + return aSeq; +} diff --git a/src/GEOM/GEOM_Engine.hxx b/src/GEOM/GEOM_Engine.hxx index 3db976f6e..b5ea794e3 100644 --- a/src/GEOM/GEOM_Engine.hxx +++ b/src/GEOM/GEOM_Engine.hxx @@ -3,14 +3,14 @@ #define _GEOM_Engine_HXX_ #include "GEOM_Application.hxx" +#include "GEOM_Object.hxx" +#include "GEOM_DataMapOfAsciiStringTransient.hxx" + #include -#include +#include #include -#include "GEOM_Object.hxx" #include -#include - -#include "GEOM_DataMapOfAsciiStringTransient.hxx" +#include class GEOM_Engine { @@ -58,7 +58,18 @@ class GEOM_Engine void Redo(int theDocID); //Adds a new sub shape object of the MainShape object - Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices); + Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, + Handle(TColStd_HArray1OfInteger) theIndices, + bool isStandaloneOperation = false); + + TCollection_AsciiString DumpPython(int theDocID, + Resource_DataMapOfAsciiStringAsciiString& theObjectNames, + bool isPublished, + bool& aValidScript); + + const char* GetDumpName (const char* theStudyEntry) const; + + Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const; protected: static void SetEngine(GEOM_Engine* theEngine); @@ -69,6 +80,8 @@ class GEOM_Engine Interface_DataMapOfIntegerTransient _mapIDDocument; int _UndoLimit; GEOM_DataMapOfAsciiStringTransient _objects; + + Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap; }; #endif diff --git a/src/GEOM/GEOM_Function.cxx b/src/GEOM/GEOM_Function.cxx index 4112c03ad..0f42f76c3 100644 --- a/src/GEOM/GEOM_Function.cxx +++ b/src/GEOM/GEOM_Function.cxx @@ -218,10 +218,11 @@ TCollection_AsciiString GEOM_Function::GetDescription() * SetDescription */ //============================================================================= -void GEOM_Function::SetDescription(TCollection_AsciiString& theDescription) +void GEOM_Function::SetDescription(const TCollection_AsciiString& theDescription) { TDF_Label aChild = _label.FindChild(DESCRIPTION_LABEL); - Handle(TDataStd_Comment) aComment = TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription)); + Handle(TDataStd_Comment) aComment = + TDataStd_Comment::Set(aChild, TCollection_ExtendedString(theDescription)); } //============================================================================= diff --git a/src/GEOM/GEOM_Function.hxx b/src/GEOM/GEOM_Function.hxx index 92879bf0c..f5b21c02d 100644 --- a/src/GEOM/GEOM_Function.hxx +++ b/src/GEOM/GEOM_Function.hxx @@ -165,7 +165,7 @@ public: TCollection_AsciiString GetDescription(); //Sets aPython description of the function - void SetDescription(TCollection_AsciiString& theDescription); + void SetDescription(const TCollection_AsciiString& theDescription); //Access to arguments diff --git a/src/GEOM/GEOM_Object.cxx b/src/GEOM/GEOM_Object.cxx index 0fbfacbc7..e36de6cf1 100644 --- a/src/GEOM/GEOM_Object.cxx +++ b/src/GEOM/GEOM_Object.cxx @@ -220,13 +220,15 @@ void GEOM_Object::SetAuxData(const char* theData) * GetAuxData */ //============================================================================= -char* GEOM_Object::GetAuxData() +TCollection_AsciiString GEOM_Object::GetAuxData() { + TCollection_AsciiString aData; + Handle(TDataStd_Comment) aCommentAttr; - if(!_label.FindAttribute(TDataStd_Comment::GetID(), aCommentAttr)) return NULL; - - TCollection_AsciiString aData(aCommentAttr->Get()); - return aData.ToCString(); + if (_label.FindAttribute(TDataStd_Comment::GetID(), aCommentAttr)) + aData = aCommentAttr->Get(); + + return aData; } diff --git a/src/GEOM/GEOM_Object.hxx b/src/GEOM/GEOM_Object.hxx index 0d1571d71..3f90453d9 100644 --- a/src/GEOM/GEOM_Object.hxx +++ b/src/GEOM/GEOM_Object.hxx @@ -178,7 +178,7 @@ class GEOM_Object : public MMgt_TShared void SetAuxData(const char* theData); //Returns an auxiliary data - char* GetAuxData(); + TCollection_AsciiString GetAuxData(); //########################################################### // Sub shape methods diff --git a/src/GEOM/Makefile.in b/src/GEOM/Makefile.in index d61a7fa10..ab77d8d57 100644 --- a/src/GEOM/Makefile.in +++ b/src/GEOM/Makefile.in @@ -17,6 +17,7 @@ LIB_SRC = GEOM_Application.cxx \ GEOM_IOperations.cxx \ GEOM_Solver.cxx \ GEOM_SubShapeDriver.cxx \ + GEOM_PythonDump.cxx \ GEOM_DataMapNodeOfDataMapOfAsciiStringTransient_0.cxx \ GEOM_DataMapIteratorOfDataMapOfAsciiStringTransient_0.cxx \ GEOM_DataMapOfAsciiStringTransient_0.cxx @@ -39,13 +40,14 @@ EXPORT_HEADERS= GEOM_Application.hxx \ GEOM_IOperations.hxx \ GEOM_ISubShape.hxx \ GEOM_Solver.hxx \ + GEOM_PythonDump.hxx \ GEOM_DataMapOfAsciiStringTransient.hxx \ Handle_GEOM_DataMapNodeOfDataMapOfAsciiStringTransient.hxx # additionnal information to compil and link file CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_LDPATH) -lTKCAF +LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_LDPATH) $(CAS_OCAF) # additional file to be cleaned diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 878cf93e9..f76cbb0d3 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -30,30 +30,32 @@ #include "GeometryGUI.h" #include "GEOMBase_aParameterDlg.h" +#include "GEOM_Client.hxx" + //// SALOME Includes #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" -#include "QAD_Config.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "QAD_MessageBox.h" -#include "QAD_Resource.h" -#include "QAD_MessageBox.h" -#include "SALOME_Selection.h" +#include "SALOME_LifeCycleCORBA.hxx" #include "GEOM_AssemblyBuilder.h" #include "GEOM_Actor.h" -#include "VTKViewer_ViewFrame.h" #include "VTKViewer_RenderWindowInteractor.h" +#include "VTKViewer_ViewModel.h" +#include "VTKViewer_ViewWindow.h" #include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" +#include "OCCViewer_ViewModel.h" +#include "OCCViewer_ViewWindow.h" +#include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOM_AISTrihedron.hxx" -#include "SALOMEGUI_ImportOperation.h" -#include "SALOMEGUI_NameDlg.h" + +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "SUIT_MessageBox.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" // // Open CASCADE Includes #include @@ -84,6 +86,11 @@ using namespace std; +#include "SALOMEDSClient.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDS_Study.hxx" + + //======================================================================= // function : GEOMBase() // purpose : Constructor @@ -111,14 +118,14 @@ TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) if(IOR.stripWhiteSpace().isEmpty()) return result; - CORBA::Object_var obj = GeometryGUI::GetORB()->string_to_object((char*)(IOR.latin1())); + CORBA::Object_var obj = SalomeApp_Application::orb()->string_to_object((char*)(IOR.latin1())); if(CORBA::is_nil(obj)) return result; GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj ); if (GeomObject->_is_nil()) return result; - - result = GeometryGUI::GetGeomGUI()->GetShapeReader().GetShape(GeometryGUI::GetGeomGUI()->GetGeomGen(), GeomObject); + + result = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), GeomObject); return result; } @@ -144,22 +151,24 @@ int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, // function : GetTopoFromSelection() // purpose : Define tds from a single selection and retuen true //======================================================================= -bool GEOMBase::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) +bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds) { - if(Sel->IObjectCount() != 1) + if(aList.Extent() != 1) return false; - Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); + Handle(SALOME_InteractiveObject) IO = aList.First(); /* case SObject */ if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if(!obj->_is_nil()) { + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if( obj ) { if(obj->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - tds = GetShapeFromIOR(anIOR->Value()); + _PTR(AttributeIOR) anIOR ( anAttr ); + tds = GetShapeFromIOR(anIOR->Value().c_str()); if(tds.IsNull()) return false; else @@ -167,7 +176,7 @@ bool GEOMBase::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) } } } - + return false; } @@ -175,35 +184,48 @@ bool GEOMBase::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) // function : GetNameOfSelectedIObjects() // purpose : Define the name geom++ or other name of mono or multi sel. //======================================================================= -int GEOMBase::GetNameOfSelectedIObjects( SALOME_Selection* theSel, +int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, QString& theName, const bool theShapesOnly ) { if ( !theShapesOnly ) - { - int nbSel = theSel->IObjectCount(); - if ( nbSel == 1 ) { - Handle(SALOME_InteractiveObject) anIObj = theSel->firstIObject(); - theName = anIObj->getName(); - } - else - theName = QObject::tr("%1_objects").arg(nbSel); + int nbSel = aList.Extent(); + if ( nbSel == 1 ) + { + Handle(SALOME_InteractiveObject) anIObj = aList.First(); + if(anIObj->hasEntry()) { + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return nbSel; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) ); + + _PTR(GenericAttribute) anAttr; + + if ( obj && obj->FindAttribute( anAttr, "AttributeName") ) + { + _PTR(AttributeName) aNameAttr ( anAttr ); + theName = aNameAttr->Value().c_str(); + } + } + } + else + theName = QObject::tr("%1_objects").arg(nbSel); - return nbSel; - } + return nbSel; + } else - { - QStringList aNames; - GEOM::ListOfGO anObjs; - ConvertListOfIOInListOfGO( theSel->StoredIObjects(), anObjs, theShapesOnly ); - if ( anObjs.length() == 1 ) - theName = GetName( anObjs[ 0 ] ); - else - theName = QString( "%1_objects" ).arg( anObjs.length() ); - - return anObjs.length(); - } + { + GEOM::ListOfGO anObjs; + ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly ); + if ( anObjs.length() == 1 ) + theName = GetName( anObjs[ 0 ] ); + else + theName = QString( "%1_objects" ).arg( anObjs.length() ); + + return anObjs.length(); + } } @@ -318,18 +340,20 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand Handle(GEOM_AISShape) resultShape; testResult = false; - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var anObj = aStudy->FindObjectIOR( IOR ); - if ( anObj->_is_nil() ) + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return resultShape; + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !anObj ) return resultShape; + + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); - for(int i = 0; i < nbSf; i++) { - QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); - if(sf->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { + Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + AIS_ListOfInteractive List; ic->DisplayedObjects(List); AIS_ListOfInteractive List1; @@ -342,9 +366,9 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); if(aSh->hasIO()) { Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); - if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID()) == 0) { + if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { if(!onlyInActiveView || - sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { testResult = true; resultShape = aSh; return resultShape; @@ -368,16 +392,20 @@ GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& t { testResult = false; - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var anObj = aStudy->FindObjectIOR( IOR ); - if ( anObj->_is_nil() ) + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return GEOM_Actor::New(); + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !anObj ) return GEOM_Actor::New(); - int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); - for(int i = 0; i < nbSf; i++) { - QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); - if(sf->getTypeView() == VIEW_VTK) { - vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() == VTKViewer_Viewer::Type()) { + VTKViewer_ViewWindow* aVTKViewWindow = (VTKViewer_ViewWindow*)it.current(); + vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); vtkActorCollection* theActors = Renderer->GetActors(); theActors->InitTraversal(); vtkActor *ac = theActors->GetNextActor(); @@ -386,9 +414,9 @@ GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& t GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); if(anActor->hasIO()) { Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(anActor->getIO()); - if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID()) == 0) { + if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { if(!onlyInActiveView || - sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { testResult = true; return anActor; } @@ -413,21 +441,13 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO if ( theIO.IsNull() || !theIO->hasEntry() ) return Handle(AIS_InteractiveObject)(); - int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - for ( int i = 0; i < nbSf; i++ ) - { - QAD_StudyFrame* aStudyFrame = - QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame( i ); - - if ( aStudyFrame->getTypeView() != VIEW_OCC ) + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() != OCCViewer_Viewer::Type()) continue; - - OCCViewer_Viewer3d* v3d = - ((OCCViewer_ViewFrame*)aStudyFrame->getRightFrame()->getViewFrame())->getViewer(); - - Handle(AIS_InteractiveContext) anIC = v3d->getAISContext(); - + Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + AIS_ListOfInteractive aList; anIC->DisplayedObjects( aList ); anIC->ObjectsInCollector( aList ); @@ -442,7 +462,7 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO { if( isOnlyInActiveView ) { - if ( aStudyFrame == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame() ) + if ( it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ) return anIter.Value(); } else @@ -469,13 +489,12 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte return res; } - int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); - for(int i = 0; i < nbSf; i++) { - QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); - if(sf->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) { + if (it.current()->getViewManager()->getType() == OCCViewer_Viewer::Type()) { + Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)it.current()->getViewManager()->getViewModel())->getAISContext(); + AIS_ListOfInteractive List; ic->DisplayedObjects(List); AIS_ListOfInteractive List1; @@ -494,7 +513,7 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte { if(onlyInActiveView) { - if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) + if(it.current() == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { testResult = true; return aSh; @@ -528,14 +547,16 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interac /* case SObject */ if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if(!obj->_is_nil()) { + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return GEOM::GEOM_Object::_nil(); + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if(obj) { if(obj->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - aShape = GeometryGUI::GetGeomGUI()->GetGeomGen()->GetIORFromString(anIOR->Value()); + _PTR(AttributeIOR) anIOR ( anAttr ); + aShape = GeometryGUI::GetGeomGen()->GetIORFromString(anIOR->Value().c_str()); if(!CORBA::is_nil(aShape)) testResult = true; return aShape._retn(); @@ -556,21 +577,20 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::stri listIOR.length(nbSel); int j=0; SALOME_ListIteratorOfListIO It(aList); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return; + _PTR(Study) aStudy = appStudy->studyDS(); + for(int i=0; It.More(); It.Next(), i++) { Handle(SALOME_InteractiveObject) IObject = It.Value(); if(IObject->hasEntry()) { - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if(!obj->_is_nil() && obj->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - ORB_INIT &init = *SINGLETON_::Instance(); - CORBA::ORB_var& _orb = init.orb(); - CORBA::String_var theValue = anIOR->Value(); - CORBA::Object_var theObj = _orb->string_to_object(theValue); + _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if(obj && obj->FindAttribute(anAttr, "AttributeIOR")) { + _PTR(AttributeIOR) anIOR (anAttr); + CORBA::Object_var theObj = dynamic_cast(aStudy.get())->ConvertIORToObject(anIOR->Value()); if(theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) { - listIOR[j] = CORBA::string_dup(theValue); + listIOR[j] = CORBA::string_dup(anIOR->Value().c_str()); j++; } } @@ -592,10 +612,16 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter if ( !theIO.IsNull() ) { const char* anEntry = theIO->getEntry(); - SALOMEDS::SObject_var aSObj = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->FindObjectID( anEntry ); - if ( !CORBA::is_nil( aSObj ) ) + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return GEOM::GEOM_Object::_nil(); + _PTR(Study) aStudy = appStudy->studyDS(); + + _PTR(SObject) aSObj ( aStudy->FindObjectID( anEntry ) ); + + if ( aSObj ) { - aReturnObject = GEOM::GEOM_Object::_narrow( aSObj->GetObject() ); + aReturnObject = GEOM::GEOM_Object::_narrow( dynamic_cast(aSObj.get())->GetObject() ); theResult = !CORBA::is_nil( aReturnObject ); } } @@ -614,16 +640,21 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList, int nbSel = theList.Extent(); theListGO.length( nbSel ); SALOME_ListIteratorOfListIO anIter( theList ); - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return; + _PTR(Study) aStudy = appStudy->studyDS(); + int j = 0; for ( int i=0; anIter.More(); anIter.Next(), i++ ) { Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); - SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( anIObj->getEntry() ); + _PTR(SObject) aSObj ( aStudy->FindObjectID( anIObj->getEntry() ) ); - if ( !aSObj->_is_nil() ) + if ( aSObj ) { - GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(aSObj->GetObject()); + GEOM::GEOM_Object_var aGeomObj = + GEOM::GEOM_Object::_narrow(dynamic_cast(aSObj.get())->GetObject()); if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) ) theListGO[ j++ ] = aGeomObj; } @@ -639,11 +670,12 @@ void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList, //================================================================================= bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) { - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE) + if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE) return false; - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); - Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); + OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort(); + Handle( V3d_View) view3d = vp3d->getView(); Standard_Real Width, Height; view3d->Size(Width, Height); const Standard_Real aHeight = (Width + Height) / 50.0; @@ -744,7 +776,8 @@ bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& //======================================================================= double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const char* aTitle1, const char* aTitle, const double bottom, const double top, const int decimals) { - GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, QAD_Application::getDesktop(), aTitle, TRUE, 0, bottom, top, decimals); + GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, SUIT_Session::session()->activeApplication()->desktop(), + aTitle, TRUE, 0, bottom, top, decimals); int r = Dialog->exec(); float X = 0.0; if(r == QDialog::Accepted) { @@ -764,41 +797,44 @@ double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const cha // : The selection is changed. Dialog box will receive the // : corresponding signal to manage this event. //======================================================================= -bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, SALOME_Selection* Sel) +bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList) { /* Find SObject with name in component GEOM */ - SALOMEDS::Study_var ST = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject; - listSO = ST->FindObjectByName(objectUserName, "GEOM"); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) ST = appStudy->studyDS(); + + std::vector<_PTR(SObject)> listSO; + listSO = ST->FindObjectByName(objectUserName.latin1(), "GEOM"); - if(listSO->length() < 1) { + if(listSO.size() < 1) { const QString caption = QObject::tr("GEOM_WRN_WARNING"); const QString text = QObject::tr("GEOM_NAME_INCORRECT"); const QString button0 = QObject::tr("GEOM_BUT_OK"); - QAD_MessageBox::error1(aWidget, caption, text, button0); + SUIT_MessageBox::error1(aWidget, caption, text, button0); return false; } /* More than one object with same name */ - if(listSO->length() > 1) { + if(listSO.size() > 1) { const QString caption = QObject::tr("GEOM_WRN_WARNING"); const QString text = QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); const QString button0 = QObject::tr("GEOM_BUT_OK") ; - QAD_MessageBox::error1(aWidget, caption, text, button0) ; + SUIT_MessageBox::error1(aWidget, caption, text, button0) ; + listSO.clear(); return false; } - SALOMEDS::SObject_var theObj = listSO[0]; + _PTR(SObject) theObj ( listSO[0] ); /* Create a SALOME_InteractiveObject with a SALOME::SObject */ - Standard_CString anEntry = theObj->GetID(); char* aCopyobjectUserName = CORBA::string_dup(objectUserName); - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", aCopyobjectUserName); + Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(theObj->GetID().c_str(), "GEOM", aCopyobjectUserName); delete(aCopyobjectUserName); /* Add as a selected object */ /* Clear any previous selection : */ /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */ - Sel->ClearIObjects(); - Sel->AddIObject(SI); + // Sel->ClearIObjects(); //mzn + // Sel->AddIObject(SI); //mzn return true; } @@ -810,7 +846,7 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) { /* Here the position is on the bottom right corner - 10 */ - QAD_Desktop* PP = QAD_Application::getDesktop(); + SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop(); x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); return true; @@ -823,18 +859,21 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) //======================================================================= QString GEOMBase::GetDefaultName(const QString& theOperation) { - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - int aNumber = 0; - QString aName; - SALOMEDS::SObject_var obj; + QString aName = ""; + + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return aName; + _PTR(Study) aStudy = appStudy->studyDS(); + int aNumber = 0; + _PTR(SObject) obj; do { aName = theOperation+"_"+QString::number(++aNumber); - obj = aStudy->FindObject(aName); + obj = aStudy->FindObject(aName.latin1()); } - while (!obj->_is_nil()); - + while (obj); + return aName; } @@ -854,8 +893,8 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment if (!aComment.isEmpty()) aText.append("\n" + QString(theComment)); - QAD_MessageBox::error1( QAD_Application::getDesktop(), QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); } @@ -869,7 +908,7 @@ GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const char* theIOR ) if ( theIOR == NULL || strlen( theIOR ) == 0 ) return anObject._retn(); // returning nil object - anObject = GEOM::GEOM_Object::_narrow( GeometryGUI::GetORB()->string_to_object( theIOR ) ); + anObject = GEOM::GEOM_Object::_narrow( SalomeApp_Application::orb()->string_to_object( theIOR ) ); return anObject._retn(); } @@ -882,7 +921,7 @@ char* GEOMBase::GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject ) if ( CORBA::is_nil( theObject ) ) return NULL; - return GeometryGUI::GetORB()->object_to_string( theObject ); + return SalomeApp_Application::orb()->object_to_string( theObject ); } //======================================================================= @@ -893,7 +932,7 @@ bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& t { if ( !CORBA::is_nil( theObject ) ) { - TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( GeometryGUI::GetGeomGUI()->GetGeomGen(), theObject ); + TopoDS_Shape aTopoDSShape = GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObject ); if ( !aTopoDSShape.IsNull() && ( theType == TopAbs_SHAPE || theType == aTopoDSShape.ShapeType() ) ) { theShape = aTopoDSShape; @@ -909,20 +948,21 @@ bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& t //======================================================================= const char* GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) { - QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy(); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( aStudy ) + if ( appStudy ) { - string anIOR = GeometryGUI::GetORB()->object_to_string( theObj ); + string anIOR = SalomeApp_Application::orb()->object_to_string( theObj ); if ( anIOR != "" ) { - SALOMEDS::SObject_var aSObj = aStudy->getStudyDocument()->FindObjectIOR( anIOR.c_str() ); - SALOMEDS::GenericAttribute_var anAttr; + _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( anIOR ) ); + + _PTR(GenericAttribute) anAttr; - if ( !aSObj->_is_nil() && aSObj->FindAttribute( anAttr, "AttributeName") ) + if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) { - SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); - return aNameAttr->Value(); + _PTR(AttributeName) aNameAttr ( anAttr ); + return aNameAttr->Value().c_str(); } } } diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index 3a829a819..018c5c259 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -42,9 +42,7 @@ #include class GEOM_Actor; -class SALOME_Selection; class SALOME_ListIO; -class QAD_Desktop; class TColStd_MapOfInteger; class QWidget; @@ -70,8 +68,8 @@ public : static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType); static TopoDS_Shape GetShapeFromIOR(QString IOR); static bool GetShape( const GEOM::GEOM_Object_ptr&, TopoDS_Shape&, const TopAbs_ShapeEnum = TopAbs_SHAPE ); - static bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds); - static int GetNameOfSelectedIObjects(SALOME_Selection* Sel, QString& aName, const bool theShapesOnly = false ); + static bool GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds); + static int GetNameOfSelectedIObjects(const SALOME_ListIO& aList, QString& aName, const bool theShapesOnly = false ); static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString); /* Convertions */ @@ -120,7 +118,7 @@ public : static bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone); /* Generates default names */ - static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); + static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, const SALOME_ListIO& aList); /* Shows message box with error code */ static bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 69196f3aa..8809a521c 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -26,39 +26,55 @@ // Module : GEOM // $Header$ +#include + #include "GEOMBase_Helper.h" #include "GEOMBase.h" #include "GEOM_Operation.h" #include "GeometryGUI.h" #include "GEOM_Displayer.h" #include "GEOMImpl_Types.hxx" -#include "QAD_Study.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" -#include "QAD_ViewFrame.h" -#include "QAD_RightFrame.h" -#include "QAD_WaitCursor.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include #include #include using namespace std; +#include +#include +#include + + + + //================================================================ // Function : getActiveView -// Purpose : Get active study frame, returns 0 if no open study frame +// Purpose : Get active view window, returns 0 if no open study frame //================================================================ -static QAD_ViewFrame* getActiveView() +static SUIT_ViewWindow* getActiveView() { - QAD_Study* activeStudy = QAD_Application::getDesktop()->getActiveStudy(); - if ( activeStudy ) { - QAD_StudyFrame* sf = activeStudy->getActiveStudyFrame(); - if ( sf ) { - return sf->getRightFrame()->getViewFrame(); - } - } + SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); + if ( activeStudy ) + return SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + return 0; } @@ -69,8 +85,7 @@ static QAD_ViewFrame* getActiveView() //================================================================ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine() { - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - return GEOM::GEOM_Gen::_narrow(comp); + return GeometryGUI::GetGeomGen(); } //================================================================ @@ -78,7 +93,7 @@ GEOM::GEOM_Gen_ptr GEOMBase_Helper::getGeomEngine() // Purpose : //================================================================ GEOMBase_Helper::GEOMBase_Helper() - : myViewFrame( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ) + : myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ) { } @@ -88,7 +103,7 @@ GEOMBase_Helper::GEOMBase_Helper() //================================================================ GEOMBase_Helper::~GEOMBase_Helper() { - if ( !QAD_Application::getDesktop() ) + if ( !SUIT_Session::session()->activeApplication()->desktop() ) return; if ( myPreview.size() ) @@ -199,14 +214,14 @@ void GEOMBase_Helper::redisplay( GEOM::GEOM_Object_ptr object, } if ( withChildren ) { - QAD_Study* aDoc = getStudy(); - if ( aDoc && !CORBA::is_nil( aDoc->getStudyDocument() ) ) { - SALOMEDS::Study_var aStudy = aDoc->getStudyDocument(); - SALOMEDS::SObject_var aSObj = aStudy->FindObjectIOR( GeometryGUI::GetORB()->object_to_string( object ) ); - if ( !CORBA::is_nil( aSObj ) ) { - SALOMEDS::ChildIterator_var anIt = aStudy->NewChildIterator( aSObj ); + SalomeApp_Study* aDoc = getStudy(); + if ( aDoc && aDoc->studyDS() ) { + _PTR(Study) aStudy = aDoc->studyDS(); + _PTR(SObject) aSObj ( aStudy->FindObjectIOR( SalomeApp_Application::orb()->object_to_string( object ) ) ); + if ( aSObj ) { + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { - GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow( anIt->Value()->GetObject() ); + GEOM::GEOM_Object_var aChild = GEOM::GEOM_Object::_narrow( dynamic_cast(anIt->Value().get())->GetObject() ); if ( !CORBA::is_nil( aChild ) ) { if ( !aChild->_is_nil() ) { string entry = getEntry( aChild ); @@ -244,10 +259,10 @@ void GEOMBase_Helper::displayPreview( const bool activate, erasePreview( false ); try { - QAD_WaitCursor wc; + SUIT_OverrideCursor wc; ObjectList objects; if ( !execute( objects ) || !getOperation()->IsDone() ) { - wc.stop(); + wc.suspend(); } else { for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) @@ -259,7 +274,7 @@ void GEOMBase_Helper::displayPreview( const bool activate, } } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); } isPreview = false; @@ -288,7 +303,7 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object, getDisplayer()->SetToActivate( activate ); // Make a reference to GEOM_Object - getDisplayer()->SetName( GeometryGUI::GetORB()->object_to_string( object ) ); + getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) ); // Build prs SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object ); @@ -316,20 +331,28 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs, erasePreview( false ); // remember current view frame to make correct erase preview later - myViewFrame = getActiveView(); + myViewWindow = getActiveView(); - if ( myViewFrame == 0 ) + if ( myViewWindow == 0 ) return; // Display prs - ( (SALOME_View*)myViewFrame )->Display( prs ); - + SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); + if ( aViewManager->getType() == OCCViewer_Viewer::Type() || + aViewManager->getType() == VTKViewer_Viewer::Type() ) + { + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView) + aView->Display( prs ); + } + // Add prs to the preview list myPreview.push_back( (SALOME_Prs*)prs ); // Update viewer if ( update ) - myViewFrame->Repaint(); + getDisplayer()->UpdateViewer(); } //================================================================ @@ -339,11 +362,21 @@ void GEOMBase_Helper::displayPreview( const SALOME_Prs* prs, void GEOMBase_Helper::erasePreview( const bool update ) { // check view frame where the preview was displayed - bool vfOK = checkViewFrame() && myViewFrame; + bool vfOK = checkViewWindow() && myViewWindow; // Iterate through presentations and delete them for ( PrsList::iterator anIter = myPreview.begin(); anIter != myPreview.end(); ++anIter ) { if ( vfOK ) - ( (SALOME_View*)myViewFrame )->Erase( *anIter, true ); + { + SUIT_ViewManager* aViewManager = myViewWindow->getViewManager(); + if ( aViewManager->getType() == OCCViewer_Viewer::Type() || + aViewManager->getType() == VTKViewer_Viewer::Type() ) + { + SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); + SALOME_View* aView = dynamic_cast(aViewModel); + if (aView) + aView->Erase( *anIter, true ); + } + } delete *anIter; } myPreview.clear(); @@ -360,29 +393,30 @@ void GEOMBase_Helper::erasePreview( const bool update ) //================================================================ void GEOMBase_Helper::activate( const int theType ) { - SALOMEDS::Study_var aStudy = getStudy()->getStudyDocument(); - SALOMEDS::SComponent_var aGeom = aStudy->FindComponent( "GEOM" ); - if ( aGeom->_is_nil() ) + if (!getStudy()) return; + _PTR(Study) aStudy = getStudy()->studyDS(); + _PTR(SComponent) aGeom ( aStudy->FindComponent( "GEOM" ) ); + if ( !aGeom ) return; SALOME_ListIO aList; - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator( aGeom ); + _PTR(ChildIterator) anIter ( aStudy->NewChildIterator( aGeom ) ); for ( ; anIter->More(); anIter->Next() ) { - SALOMEDS::SObject_var aSO = anIter->Value(); - if ( !aSO->_is_nil() ) + _PTR(SObject) aSO ( anIter->Value() ); + if ( aSO ) { - SALOMEDS::SObject_var aRefSO; + _PTR(SObject) aRefSO; if ( !aSO->ReferencedObject( aRefSO ) ) { - GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow( aSO->GetObject() ); + GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow( dynamic_cast(aSO.get())->GetObject() ); if ( !anObj->_is_nil() && anObj->GetType() == theType ) - aList.Append( new SALOME_InteractiveObject( aSO->GetID(), "GEOM", aSO->GetName()) ); + aList.Append( new SALOME_InteractiveObject( aSO->GetID().c_str(), "GEOM", aSO->GetName().c_str()) ); } } } - myDisplayer->LocalSelection( aList, 0 ); + getDisplayer()->LocalSelection( aList, 0 ); } //================================================================ @@ -406,7 +440,7 @@ void GEOMBase_Helper::localSelection( const ObjectList& theObjs, const int theMo aEntry.c_str(), "GEOM", strdup( GEOMBase::GetName( anObj ) ) ) ); } - myDisplayer->LocalSelection( aListOfIO, theMode ); + getDisplayer()->LocalSelection( aListOfIO, theMode ); } //================================================================ @@ -418,7 +452,7 @@ void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode { // If object is null local selection for all objects is activated if ( obj->_is_nil() ) { - myDisplayer->LocalSelection( Handle(SALOME_InteractiveObject)(), mode ); + getDisplayer()->LocalSelection( Handle(SALOME_InteractiveObject)(), mode ); return; } @@ -435,7 +469,7 @@ void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode //================================================================ void GEOMBase_Helper::globalSelection( const int theMode, const bool update ) { - myDisplayer->GlobalSelection( theMode, update ); + getDisplayer()->GlobalSelection( theMode, update ); } //================================================================ @@ -446,7 +480,7 @@ void GEOMBase_Helper::globalSelection( const int theMode, const bool update ) void GEOMBase_Helper::globalSelection( const TColStd_MapOfInteger& theModes, const bool update ) { - myDisplayer->GlobalSelection( theModes, update ); + getDisplayer()->GlobalSelection( theModes, update ); } //================================================================ @@ -458,13 +492,13 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN if ( !hasCommand() ) return; - SALOMEDS::Study_var aStudy = getStudy()->getStudyDocument(); - if ( aStudy->_is_nil() || theObj->_is_nil() ) + _PTR(Study) aStudy = getStudy()->studyDS(); + if ( !aStudy || theObj->_is_nil() ) return; GEOM::GEOM_Object_ptr aFatherObj = getFather( theObj ); - GeometryGUI::GetGeomGUI()->GetGeomGen()->AddInStudy( aStudy, theObj, theName, aFatherObj ); + getGeomEngine()->AddInStudy( dynamic_cast(aStudy.get())->GetStudy(), theObj, theName, aFatherObj ); } //================================================================ @@ -473,7 +507,14 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN //================================================================ void GEOMBase_Helper::updateObjBrowser() const { - getStudy()->updateObjBrowser(); + SalomeApp_Application* app = dynamic_cast(SUIT_Session::session()->activeApplication()); + if (app) { + CAM_Module* module = app->module( "Geometry" ); + SalomeApp_Module* appMod = dynamic_cast( module ); + if ( appMod ) { + appMod->updateObjBrowser( true ); + } + } } //================================================================ @@ -493,7 +534,7 @@ int GEOMBase_Helper::getStudyId() const { int anId = -1; if ( getStudy() ) - anId = getStudy()->getStudyId(); + anId = getStudy()->id(); return anId; } @@ -502,10 +543,23 @@ int GEOMBase_Helper::getStudyId() const // Purpose : Returns the active study. It is recommended to use // this method instead of direct desktop->getActiveStudy() calls //================================================================ -QAD_Study* GEOMBase_Helper::getStudy() const +SalomeApp_Study* GEOMBase_Helper::getStudy() const { - // Probably, it would be better to rememeber the active study in helper... - return QAD_Application::getDesktop()->getActiveStudy(); + SUIT_Desktop* aDesktop = getDesktop(); + if (!aDesktop) + return 0; + + QPtrList anAppList = SUIT_Session::session()->applications(); + + SUIT_Application* anApp = 0; + for ( QPtrListIterator it( anAppList ); it.current() ; ++it ) + { + anApp = it.current(); + if ( anApp->desktop() == aDesktop ) + break; + } + + return dynamic_cast(anApp->activeStudy()); } //================================================================ @@ -514,13 +568,13 @@ QAD_Study* GEOMBase_Helper::getStudy() const //================================================================ char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const { - QAD_Study* study = getStudy(); + SalomeApp_Study* study = getStudy(); if ( study ) { string IOR = GEOMBase::GetIORFromObject( object); if ( IOR != "" ) { - SALOMEDS::SObject_var SO = study->getStudyDocument()->FindObjectIOR( IOR.c_str() ); - if ( !SO->_is_nil() ) { - return SO->GetID(); + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) { + return TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString(); } } } @@ -534,7 +588,7 @@ char* GEOMBase_Helper::getEntry( GEOM::GEOM_Object_ptr object ) const GEOM_Displayer* GEOMBase_Helper::getDisplayer() { if ( !myDisplayer ) - myDisplayer = new GEOM_Displayer(); + myDisplayer = new GEOM_Displayer( getStudy() ); return myDisplayer; } @@ -547,25 +601,25 @@ void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) if ( CORBA::is_nil( theObj ) ) return; - string IOR = GeometryGUI::GetORB()->object_to_string( theObj ); + string IOR = SalomeApp_Application::orb()->object_to_string( theObj ); TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) ); - GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); - if ( !getStudy() || CORBA::is_nil( getStudy()->getStudyDocument() ) ) + if ( !getStudy() || !getStudy()->studyDS() ) return; - SALOMEDS::Study_var aStudy = getStudy()->getStudyDocument(); - SALOMEDS::SObject_var aSObj = aStudy->FindObjectIOR( IOR.c_str() ); - if ( CORBA::is_nil( aSObj ) ) + _PTR(Study) aStudy = getStudy()->studyDS(); + _PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !aSObj ) return; - SALOMEDS::ChildIterator_var anIt = aStudy->NewChildIterator( aSObj ); + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { - SALOMEDS::GenericAttribute_var anAttr; + _PTR(GenericAttribute) anAttr; if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - TCollection_AsciiString asciiIOR( anIOR->Value() ); - GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + _PTR(AttributeIOR) anIOR ( anAttr ); + TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); + GEOM_Client().RemoveShapeFromBuffer( asciiIOR ); } } } @@ -582,7 +636,7 @@ bool GEOMBase_Helper::openCommand() GEOM::GEOM_IOperations_var anOp = GEOM::GEOM_IOperations::_narrow( getOperation() ); if ( !anOp->_is_nil() ) { - myCommand = new GEOM_Operation( getStudy(), anOp.in() ); + myCommand = new GEOM_Operation( SUIT_Session::session()->activeApplication(), anOp.in() ); myCommand->start(); res = true; } @@ -614,7 +668,7 @@ bool GEOMBase_Helper::commitCommand( const char* ) if ( !hasCommand() ) return false; - myCommand->finish(); + myCommand->commit(); myCommand = 0; return true; @@ -644,22 +698,20 @@ GEOM::GEOM_IOperations_ptr GEOMBase_Helper::getOperation() //================================================================ -// Function : checkViewFrame +// Function : checkViewWindow // Purpose : //================================================================ -bool GEOMBase_Helper::checkViewFrame() +bool GEOMBase_Helper::checkViewWindow() { - if ( myViewFrame ){ - QListIterator it( QAD_Application::getDesktop()->getActiveApp()->getStudies() ); - for ( ; it.current(); ++it ) { - QListIterator it1( it.current()->getStudyFrames() ); - for ( ; it1.current(); ++it1 ) { - if ( myViewFrame == it1.current()->getRightFrame()->getViewFrame() ) + if ( myViewWindow ){ + QPtrList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); + for ( QPtrListIterator it( aViewWindowsList ); it.current(); ++it ) + { + if ( myViewWindow == it.current() ) return true; } - } } - myViewFrame = 0; + myViewWindow = 0; return false; } @@ -671,13 +723,14 @@ bool GEOMBase_Helper::checkViewFrame() //================================================================ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) { - QAD_Study* aDoc = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = aDoc->getStudyDocument(); - - bool aLocked = aStudy->GetProperties()->IsLocked(); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + + bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); - QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), + SUIT_MessageBox::warn1 ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") ); @@ -694,11 +747,11 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) try { if ( ( !publish && !useTransaction ) || openCommand() ) { - QAD_WaitCursor wc; - QAD_Application::getDesktop()->putInfo( "" ); + SUIT_OverrideCursor wc; + SUIT_Session::session()->activeApplication()->putInfo( "" ); ObjectList objects; if ( !execute( objects ) || !getOperation()->IsDone() ) { - wc.stop(); + wc.suspend(); abortCommand(); showError(); } @@ -731,7 +784,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) if ( nbObjs ) { commitCommand(); updateObjBrowser(); - QAD_Application::getDesktop()->putInfo( QObject::tr("GEOM_PRP_DONE") ); + SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); } else abortCommand(); @@ -739,7 +792,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction ) } } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); abortCommand(); } @@ -762,10 +815,10 @@ void GEOMBase_Helper::showError() if ( msg.isEmpty() ) msg = QObject::tr( "GEOM_PRP_ABORT" ); - QAD_MessageBox::error1( QAD_Application::getDesktop(), - QObject::tr( "GEOM_ERROR_STATUS" ), - msg, - QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr( "GEOM_ERROR_STATUS" ), + msg, + QObject::tr( "BUT_OK" ) ); } //================================================================ @@ -777,7 +830,7 @@ void GEOMBase_Helper::showError( const QString& msg ) QString str( QObject::tr( "GEOM_INCORRECT_INPUT" ) ); if ( !msg.isEmpty() ) str += "\n" + msg; - QAD_MessageBox::error1( QAD_Application::getDesktop(), QObject::tr( "GEOM_ERROR" ), str, QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::error1(SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), str, QObject::tr( "BUT_OK" ) ); } ////////////////////////////////////////////////////////////////// @@ -863,4 +916,50 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const } } +//================================================================ +// Function : selectedIO +// Purpose : Return the list of selected SALOME_InteractiveObject's +//================================================================ +const SALOME_ListIO& GEOMBase_Helper::selectedIO() +{ + mySelected.Clear(); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( aSelMgr ) + aSelMgr->selectedObjects( mySelected ); + } + + return mySelected; +} + +//================================================================ +// Function : IObjectCount +// Purpose : Return the number of selected objects +//================================================================ +int GEOMBase_Helper::IObjectCount() +{ + return selectedIO().Extent(); +} + +//================================================================ +// Function : firstIObject +// Purpose : Return the first selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) GEOMBase_Helper::firstIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Function : lastIObject +// Purpose : Return the last selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) GEOMBase_Helper::lastIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.Last() : Handle(SALOME_InteractiveObject)(); +} diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index 64dbd4d22..1667958df 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -31,6 +31,7 @@ #include "GEOM_Displayer.h" #include "SALOME_Prs.h" +#include "SALOME_ListIO.hxx" #include #include CORBA_CLIENT_HEADER(GEOM_Gen) @@ -40,10 +41,11 @@ typedef std::list ObjectList; +class SalomeApp_Study; +class SUIT_Desktop; +class SUIT_ViewWindow; class GEOM_Operation; -class QAD_Study; class TopoDS_Shape; -class QAD_ViewFrame; class TColStd_MapOfInteger; //================================================================ @@ -105,8 +107,8 @@ protected: void updateObjBrowser() const; int getStudyId () const; - QAD_Study* getStudy () const; - bool checkViewFrame (); + SalomeApp_Study* getStudy () const; + bool checkViewWindow (); bool onAccept( const bool publish = true, const bool useTransaction = true ); // This method should be called from "OK" button handler. @@ -126,6 +128,21 @@ protected: inline void setPrefix( const QString& prefix ) { myPrefix = prefix; } QString getPrefix( GEOM::GEOM_Object_ptr = GEOM::GEOM_Object::_nil() ) const; + const SALOME_ListIO& selectedIO(); + // Function returns a list of SALOME_InteractiveObject's from + // selection manager in GUI + + int IObjectCount() ; + // Function returns the number of selected objects + + Handle(SALOME_InteractiveObject) firstIObject() ; + // Function returns the first selected object in the list + // of selected objects + + Handle(SALOME_InteractiveObject) lastIObject() ; + // Function returns the last selected object in the list + // of selected objects + //////////////////////////////////////////////////////////////////////////// // Virtual methods, to be redefined in dialog classes //////////////////////////////////////////////////////////////////////////// @@ -154,6 +171,7 @@ protected: bool IsPreview() {return isPreview;} GEOM_Displayer* getDisplayer(); + virtual SUIT_Desktop* getDesktop() const = 0; private: char* getEntry ( GEOM::GEOM_Object_ptr ) const; @@ -166,9 +184,10 @@ private: GEOM_Displayer* myDisplayer; GEOM_Operation* myCommand; GEOM::GEOM_IOperations_var myOperation; - QAD_ViewFrame* myViewFrame; + SUIT_ViewWindow* myViewWindow; QString myPrefix; bool isPreview; + SALOME_ListIO mySelected; }; diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 7ab20a236..8e3b36185 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -29,7 +29,10 @@ using namespace std; #include "GEOMBase_Skeleton.h" #include "GeometryGUI.h" -#include "SALOME_Selection.h" + +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include @@ -40,7 +43,7 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) +GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, bool modal, WFlags fl) :DlgRef_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), GEOMBase_Helper() { if (!name) @@ -53,7 +56,7 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_S GroupMedium->close(TRUE); resize(0, 0); - Init(Sel); + Init(); } @@ -63,7 +66,8 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_S //================================================================================= GEOMBase_Skeleton::~GEOMBase_Skeleton() { - myGeomGUI->SetActiveDialogBox( 0 ); + if (myGeomGUI) + myGeomGUI->SetActiveDialogBox( 0 ); } @@ -71,21 +75,29 @@ GEOMBase_Skeleton::~GEOMBase_Skeleton() // function : Init() // purpose : //================================================================================= -void GEOMBase_Skeleton::Init(SALOME_Selection* Sel) +void GEOMBase_Skeleton::Init() { - myGeomGUI = GeometryGUI::GetGeomGUI(); - + myGeomGUI = 0; + SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + { + SalomeApp_Module* module = dynamic_cast(app->loadModule("Geometry")); + if (module) + myGeomGUI = dynamic_cast(module); + } + /* init variables */ - mySelection = Sel; - myGeomBase = new GEOMBase(); // SAN -- TO BE REMOVED !!! myGeomGUI->SetActiveDialogBox(this); - + /* signals and slots connections */ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - + if (myGeomGUI) + { + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + } + /* Move widget on the botton right corner of main widget */ // int x, y; // myGeomBase->DefineDlgPosition( this, x, y ); @@ -122,8 +134,9 @@ void GEOMBase_Skeleton::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text(); QWidget* thisWidget = (QWidget*)this; - if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, mySelection)) - myEditCurrentArgument->setText(objectUserName); + + if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, selectedIO())) + myEditCurrentArgument->setText(objectUserName); return; } @@ -137,9 +150,9 @@ void GEOMBase_Skeleton::DeactivateActiveDialog() { this->setEnabled(false); globalSelection(); - //myGeomGUI->ResetState(); - disconnect(mySelection, 0, this, 0); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox(0); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); + if (myGeomGUI) myGeomGUI->SetActiveDialogBox(0); + return; } @@ -151,9 +164,9 @@ void GEOMBase_Skeleton::DeactivateActiveDialog() void GEOMBase_Skeleton::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); + if (myGeomGUI) myGeomGUI->EmitSignalDeactivateDialog(); this->setEnabled(true); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox((QDialog*)this); + if (myGeomGUI) myGeomGUI->SetActiveDialogBox((QDialog*)this); return; } @@ -164,7 +177,7 @@ void GEOMBase_Skeleton::ActivateThisDialog() //================================================================================= void GEOMBase_Skeleton::closeEvent(QCloseEvent* e) { - disconnect(mySelection, 0, this, 0); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); QDialog::closeEvent( e ); } @@ -198,3 +211,12 @@ int GEOMBase_Skeleton::getConstructorId() const return GroupConstructors->id( GroupConstructors->selected() ); return -1; } + +//================================================================================= +// function : getDesktop() +// purpose : +//================================================================================= +SUIT_Desktop* GEOMBase_Skeleton::getDesktop() const +{ + return dynamic_cast( parentWidget() ); +} diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 30d30ec24..450dc6079 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -48,11 +48,11 @@ class GEOMBase_Skeleton : public DlgRef_Skeleton_QTD, public GEOMBase_Helper Q_OBJECT public: - GEOMBase_Skeleton(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + GEOMBase_Skeleton(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~GEOMBase_Skeleton(); private : - void Init(SALOME_Selection* Sel); + void Init(); protected: void closeEvent(QCloseEvent* e); @@ -60,9 +60,9 @@ protected: void initName( const char* thePrefix = 0 ); // initialize "Name" field with a string "thePrefix_X" (Vertex_3) const char* getNewObjectName() const; // returns contents of "Name" field int getConstructorId() const; // returns id of a selected "constructor" radio button or '-1' in case of error + virtual SUIT_Desktop* getDesktop() const; QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - SALOME_Selection* mySelection; /* User shape selection */ GEOMBase* myGeomBase; // SAN -- TO BE REMOVED !!! GeometryGUI* myGeomGUI; /* reference GEOM GUI */ diff --git a/src/GEOMBase/GEOMBase_aParameterDlg.cxx b/src/GEOMBase/GEOMBase_aParameterDlg.cxx index 8f7b87797..fc8a07343 100644 --- a/src/GEOMBase/GEOMBase_aParameterDlg.cxx +++ b/src/GEOMBase/GEOMBase_aParameterDlg.cxx @@ -28,8 +28,7 @@ using namespace std; #include "GEOMBase_aParameterDlg.h" -#include "QAD_SpinBoxDbl.h" -#include "QAD_Tools.h" +#include "QtxDblSpinBox.h" #include @@ -85,7 +84,7 @@ GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char * TextLabel1->setText(tr(aTitle1)); mainGrpLayout->addWidget(TextLabel1, 0, 0); - mySpinBox = new QAD_SpinBoxDbl(mainGrp, "mySpinBox"); + mySpinBox = new QtxDblSpinBox(mainGrp, "mySpinBox"); mySpinBox->setPrecision(12); mySpinBox->setRange(bottom, top); ((QDoubleValidator*)(mySpinBox->validator()))->setRange(bottom, top, decimals); @@ -122,7 +121,7 @@ GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char * connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject())); /* Move widget on the botton right corner of main widget */ - QAD_Tools::centerWidget(this, parent); + //mzn: QAD_Tools::centerWidget(this, parent); } diff --git a/src/GEOMBase/GEOMBase_aParameterDlg.h b/src/GEOMBase/GEOMBase_aParameterDlg.h index e14d9dbda..1e5c529b5 100644 --- a/src/GEOMBase/GEOMBase_aParameterDlg.h +++ b/src/GEOMBase/GEOMBase_aParameterDlg.h @@ -32,7 +32,7 @@ #include class QPushButton; -class QAD_SpinBoxDbl; +class QtxDblSpinBox; //================================================================================= // class : GEOMBase_aParameterDlg @@ -52,7 +52,7 @@ public: private: QPushButton* myButtonOk; QPushButton* myButtonCancel; - QAD_SpinBoxDbl* mySpinBox; + QtxDblSpinBox* mySpinBox; }; diff --git a/src/GEOMBase/GEOM_Operation.cxx b/src/GEOMBase/GEOM_Operation.cxx index a1804d491..2846c8f66 100644 --- a/src/GEOMBase/GEOM_Operation.cxx +++ b/src/GEOMBase/GEOM_Operation.cxx @@ -28,14 +28,16 @@ #include "GEOM_Operation.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SUIT_Application.h" +#include "SalomeApp_Tools.h" + //================================================================ // Function : GEOM_Operation // Purpose : //================================================================ -GEOM_Operation::GEOM_Operation( QAD_Study* doc, GEOM::GEOM_IOperations_ptr oper ) -: QAD_Operation( doc ) +GEOM_Operation::GEOM_Operation( SUIT_Application* app, GEOM::GEOM_IOperations_ptr oper ) +: SUIT_Operation( app ) { myIOperation = GEOM::GEOM_IOperations::_narrow( oper ); } @@ -52,16 +54,16 @@ GEOM_Operation::~GEOM_Operation() // Function : onStartOperation() // Purpose : Opens an internal transaction in GEOM engine //================================================================ -void GEOM_Operation::onStartOperation() +void GEOM_Operation::startOperation() { - QAD_Operation::onStartOperation(); + SUIT_Operation::startOperation(); if ( !myIOperation->_is_nil() ) { try { myIOperation->StartOperation(); } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools:: QtCatchCorbaException( e ); } } } @@ -70,16 +72,16 @@ void GEOM_Operation::onStartOperation() // Function : onFinishOperation // Purpose : Commits an internal transaction in GEOM engine //================================================================ -void GEOM_Operation::onFinishOperation() +void GEOM_Operation::commitOperation() { - QAD_Operation::onFinishOperation(); + SUIT_Operation::commitOperation(); if ( !myIOperation->_is_nil() ) { try { myIOperation->FinishOperation(); } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools:: QtCatchCorbaException( e ); } } } @@ -88,34 +90,34 @@ void GEOM_Operation::onFinishOperation() // Function : onSuspendOperation // Purpose : //================================================================ -void GEOM_Operation::onSuspendOperation() +void GEOM_Operation::suspendOperation() { - QAD_Operation::onSuspendOperation(); + SUIT_Operation::suspendOperation(); } //================================================================ // Function : onResumeOperation // Purpose : //================================================================ -void GEOM_Operation::onResumeOperation() +void GEOM_Operation::resumeOperation() { - QAD_Operation::onResumeOperation(); + SUIT_Operation::resumeOperation(); } //================================================================ // Function : onAbortOperation // Purpose : Aborts an internal transaction in GEOM engine //================================================================ -void GEOM_Operation::onAbortOperation() +void GEOM_Operation::abortOperation() { - QAD_Operation::onAbortOperation(); + SUIT_Operation::abortOperation(); if ( !myIOperation->_is_nil() ) { try { myIOperation->AbortOperation(); } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); } } } diff --git a/src/GEOMBase/GEOM_Operation.h b/src/GEOMBase/GEOM_Operation.h index 8c051e011..6145a31d4 100644 --- a/src/GEOMBase/GEOM_Operation.h +++ b/src/GEOMBase/GEOM_Operation.h @@ -29,23 +29,23 @@ #ifndef GEOM_OPERATION_H #define GEOM_OPERATION_H -#include "QAD_Operation.h" +#include "SUIT_Operation.h" #include #include CORBA_CLIENT_HEADER(GEOM_Gen) -class GEOM_Operation : public QAD_Operation +class GEOM_Operation : public SUIT_Operation { public: - GEOM_Operation( QAD_Study*, GEOM::GEOM_IOperations_ptr ); + GEOM_Operation( SUIT_Application*, GEOM::GEOM_IOperations_ptr ); virtual ~GEOM_Operation(); protected: - // Reimplemented from QAD_Operation - virtual void onStartOperation(); - virtual void onFinishOperation(); - virtual void onSuspendOperation(); - virtual void onResumeOperation(); - virtual void onAbortOperation(); + // Reimplemented from SUIT_Operation + virtual void startOperation(); + virtual void commitOperation(); + virtual void suspendOperation(); + virtual void resumeOperation(); + virtual void abortOperation(); private: GEOM::GEOM_IOperations_var myIOperation; diff --git a/src/GEOMBase/Makefile.in b/src/GEOMBase/Makefile.in index 9dff7f68d..cdec8fff2 100644 --- a/src/GEOMBase/Makefile.in +++ b/src/GEOMBase/Makefile.in @@ -63,9 +63,9 @@ LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -LDFLAGS += -lDlgRef -lGEOMGUI +LDFLAGS += -L$(GUI_ROOT_DIR)/lib/salome -lDlgRef -lGEOM -lsuit -lOCCViewer -lVTKViewer @CONCLUDE@ diff --git a/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx b/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx index 94729c71d..4004ebe40 100644 --- a/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_EdgeFilter.cxx @@ -1,54 +1,34 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : GEOM_EdgeFilter.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_EdgeFilter.ixx" +#include "GEOM_EdgeFilter.h" #include #include #include +#include +//======================================================================= +// function : GEOM_EdgeFilter +// purpose : +//======================================================================= +GEOM_EdgeFilter::GEOM_EdgeFilter( SalomeApp_Study* study, const int kind ) +: GEOM_SelectionFilter( study ), +myKind( kind ) +{ + add( TopAbs_EDGE ); +} //======================================================================= -// function : IsShapeOk -// purpose : enumeration TypeOfEdge is AnyEdge,Line,Circle; +// function : ~GEOM_SelectionFilter +// purpose : //======================================================================= -GEOM_EdgeFilter::GEOM_EdgeFilter( const StdSelect_TypeOfEdge theKind ) -: GEOM_ShapeTypeFilter( TopAbs_EDGE ) +GEOM_EdgeFilter::~GEOM_EdgeFilter() { - myKind = theKind; } //======================================================================= -// function : IsShapeOk +// function : isShapeOk // purpose : //======================================================================= -Standard_Boolean GEOM_EdgeFilter::IsShapeOk( const TopoDS_Shape& theShape ) const +bool GEOM_EdgeFilter::isShapeOk( const TopoDS_Shape& theShape ) const { if ( !theShape.IsNull() && theShape.ShapeType() == TopAbs_EDGE ) { @@ -62,5 +42,6 @@ Standard_Boolean GEOM_EdgeFilter::IsShapeOk( const TopoDS_Shape& theShape ) cons case StdSelect_Circle: return ( aType == GeomAbs_Circle ); } } - return Standard_False; + return false; } + diff --git a/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx b/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx index 5fbaf1743..57b7bb3a0 100644 --- a/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_FaceFilter.cxx @@ -1,54 +1,34 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : GEOM_FaceFilter.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_FaceFilter.ixx" +#include "GEOM_FaceFilter.h" #include #include #include +#include +//======================================================================= +// function : GEOM_FaceFilter +// purpose : +//======================================================================= +GEOM_FaceFilter::GEOM_FaceFilter( SalomeApp_Study* study, const int kind ) +: GEOM_SelectionFilter( study ), +myKind( kind ) +{ + add( TopAbs_FACE ); +} //======================================================================= -// function : IsShapeOk -// purpose : enumeration TypeOfFace is AnyFace,Plane,Cylinder,Sphere,Torus,Revol,Cone; +// function : ~GEOM_SelectionFilter +// purpose : //======================================================================= -GEOM_FaceFilter::GEOM_FaceFilter( const StdSelect_TypeOfFace theKind ) -: GEOM_ShapeTypeFilter( TopAbs_FACE ) +GEOM_FaceFilter::~GEOM_FaceFilter() { - myKind = theKind; } //======================================================================= -// function : IsShapeOk +// function : isShapeOk // purpose : //======================================================================= -Standard_Boolean GEOM_FaceFilter::IsShapeOk( const TopoDS_Shape& theShape ) const +bool GEOM_FaceFilter::isShapeOk( const TopoDS_Shape& theShape ) const { if ( !theShape.IsNull() && theShape.ShapeType() == TopAbs_FACE ) { @@ -70,5 +50,6 @@ Standard_Boolean GEOM_FaceFilter::IsShapeOk( const TopoDS_Shape& theShape ) cons case StdSelect_Cone: return ( aType == GeomAbs_Cone); } } - return Standard_False; + return false; } + diff --git a/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx b/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx index 39c11dfbb..22ca76a26 100644 --- a/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_LogicalFilter.cxx @@ -1,161 +1,76 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : GEOM_LogicalFilter.cxx -// Author : Sergey LITONIN -// Module : GEOM - -#include "GEOM_LogicalFilter.hxx" - -/* - Class : GEOM_LogicalFilter - Description : Filter for combaining several filters with logical operation (OR or AND) -*/ - -IMPLEMENT_STANDARD_HANDLE( GEOM_LogicalFilter, SALOME_Filter ) -IMPLEMENT_STANDARD_RTTIEXT( GEOM_LogicalFilter, SALOME_Filter ) +#include "GEOM_LogicalFilter.h" //======================================================================= -// name : GEOM_LogicalFilter::GEOM_LogicalFilter -// Purpose : Constructor +// function : GEOM_LogicalFilter +// purpose : //======================================================================= -GEOM_LogicalFilter::GEOM_LogicalFilter( const GEOM_ListOfFilter& theFilters, - const int theLogOp ) +GEOM_LogicalFilter::GEOM_LogicalFilter( const QPtrList& lst, const int op ) +: SUIT_SelectionFilter() { - myFilters = theFilters; - myLogOp = theLogOp; + setFilters( lst ); + setOperation( op ); } //======================================================================= -// name : GEOM_LogicalFilter::GEOM_LogicalFilter -// Purpose : Constructor -//======================================================================= -GEOM_LogicalFilter::GEOM_LogicalFilter( const Handle(SALOME_Filter)& theFilter, - const int theLogOp ) -{ - myFilters.Append( theFilter ); - myLogOp = theLogOp; -} - -//======================================================================= -// name : GEOM_LogicalFilter::~GEOM_LogicalFilter -// Purpose : Destructor +// function : ~GEOM_LogicalFilter +// purpose : //======================================================================= GEOM_LogicalFilter::~GEOM_LogicalFilter() { } //======================================================================= -// name : GEOM_LogicalFilter::IsOk -// Purpose : Verify validity of entry object +// function : isOk +// purpose : //======================================================================= -Standard_Boolean GEOM_LogicalFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const +bool GEOM_LogicalFilter::isOk( const SUIT_DataOwner* owner ) const { - GEOM_ListOfFilter::Iterator anIter( myFilters ); - for ( ; anIter.More(); anIter.Next() ) + GEOM_LogicalFilter* non_const_this = (GEOM_LogicalFilter*)this; + for ( SUIT_SelectionFilter* filter = non_const_this->myFilters.first(); filter; filter = non_const_this->myFilters.next() ) { - Handle(SALOME_Filter) aFilter = anIter.Value(); - if ( !aFilter.IsNull() ) - { - if ( myLogOp == LO_OR && anIter.Value()->IsOk( theIO ) ) - return true; - if ( myLogOp == LO_AND && !anIter.Value()->IsOk( theIO ) ) - return false; - if ( myLogOp == LO_NOT ) - return !anIter.Value()->IsOk( theIO ); - } + if ( myOperation == LO_OR && filter->isOk( owner ) ) + return true; + if ( myOperation == LO_AND && !filter->isOk( owner ) ) + return false; + if ( myOperation == LO_NOT ) + return !filter->isOk( owner ); } - return myLogOp == LO_OR ? false : true; + return ( myOperation != LO_OR ); } //======================================================================= -// name : GEOM_LogicalFilter::SetFilters -// Purpose : Set new list of filters. Old wilters are removed +// function : setFilters +// purpose : //======================================================================= -void GEOM_LogicalFilter::SetFilters( const GEOM_ListOfFilter& theFilters ) +void GEOM_LogicalFilter::setFilters( const QPtrList& lst ) { - myFilters = theFilters; + myFilters = lst; } //======================================================================= -// name : GEOM_LogicalFilter::SetLogOp -// Purpose : Set logical operation +// function : setOperation +// purpose : //======================================================================= -void GEOM_LogicalFilter::SetLogOp( const int theLogOp ) +void GEOM_LogicalFilter::setOperation( const int op ) { - myLogOp = theLogOp; + myOperation = op; } //======================================================================= -// name : GEOM_LogicalFilter::GetFilters -// Purpose : Get list of filters +// function : getFilters +// purpose : //======================================================================= -const GEOM_ListOfFilter& GEOM_LogicalFilter::GetFilters() const +QPtrList GEOM_LogicalFilter::getFilters() const { return myFilters; } //======================================================================= -// name : GEOM_LogicalFilter::GetLogOp -// Purpose : Get logical operation +// function : getOperation +// purpose : //======================================================================= -int GEOM_LogicalFilter::GetLogOp() const +int GEOM_LogicalFilter::getOperation() const { - return myLogOp; + return myOperation; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx b/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx index e9766b88e..815ff81cb 100644 --- a/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_PreviewFilter.cxx @@ -1,42 +1,31 @@ -// GEOM GEOMFiltersSelection : filter selector for the viewer -// -// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : GEOM_PreviewFilter.cxx -// Author : Sergey ANIKIN -// Module : GEOM -// $Header$ +#include "GEOM_PreviewFilter.h" -#include "GEOM_PreviewFilter.ixx" -#include "SALOME_InteractiveObject.hxx" +#include -using namespace std; +//======================================================================= +// function : GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_PreviewFilter::GEOM_PreviewFilter( SalomeApp_Study* study ) +: SalomeApp_Filter( study ) +{ +} -GEOM_PreviewFilter::GEOM_PreviewFilter() +//======================================================================= +// function : ~GEOM_SelectionFilter +// purpose : +//======================================================================= +GEOM_PreviewFilter::~GEOM_PreviewFilter() { } -Standard_Boolean GEOM_PreviewFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const +//======================================================================= +// function : isOk +// purpose : +//======================================================================= +bool GEOM_PreviewFilter::isOk( const SUIT_DataOwner* sOwner ) const { - return ( !anObj.IsNull() && anObj->hasEntry() && strstr( anObj->getEntry(), "TEMP" ) ); + const SalomeApp_DataOwner* owner = dynamic_cast ( sOwner ); + return ( owner && strstr( owner->entry(), "TEMP" ) ); } diff --git a/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx b/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx index 26df6985e..d5785f513 100644 --- a/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx +++ b/src/GEOMFiltersSelection/GEOM_TypeFilter.cxx @@ -1,145 +1,41 @@ -// GEOM GEOMGUI : Implementation of selection filters for GEOM module -// -// Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : GEOM_TypeFilter.cxx -// Author : Sergey LITONIN -// Module : GEOM - -#include "GEOM_TypeFilter.hxx" -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_Client.hxx" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -static GEOM::GEOM_Object_ptr convertIOinGEOMObject( - const Handle(SALOME_InteractiveObject)& theIO, Standard_Boolean& theResult ) -{ - theResult = Standard_False; - GEOM::GEOM_Object_var aReturnObject; - if ( !theIO.IsNull() ) - { - const char* anEntry = theIO->getEntry(); - SALOMEDS::SObject_var aSObj = - QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->FindObjectID( anEntry ); - if ( !CORBA::is_nil( aSObj ) ) - { - aReturnObject = GEOM::GEOM_Object::_narrow( aSObj->GetObject() ); - theResult = !CORBA::is_nil( aReturnObject ); - } - } - return aReturnObject._retn(); -} - -/* - Class : GEOM_TypeFilter - Description : Filter for combaining several filters with logical operation (OR or AND) -*/ - -IMPLEMENT_STANDARD_HANDLE( GEOM_TypeFilter, SALOME_TypeFilter ) -IMPLEMENT_STANDARD_RTTIEXT( GEOM_TypeFilter, SALOME_TypeFilter ) +#include "GEOM_TypeFilter.h" //======================================================================= -// name : GEOM_TypeFilter::GEOM_TypeFilter -// Purpose : Constructor +// function : GEOM_TypeFilter +// purpose : //======================================================================= -GEOM_TypeFilter::GEOM_TypeFilter( const int theType ) -: SALOME_TypeFilter( "GEOM" ) +GEOM_TypeFilter::GEOM_TypeFilter( SalomeApp_Study* study, const int type ) +:GEOM_SelectionFilter( study ), +myType( type ) { - myType = theType; } //======================================================================= -// name : GEOM_TypeFilter::~GEOM_TypeFilter -// Purpose : Destructor +// function : ~GEOM_TypeFilter +// purpose : //======================================================================= GEOM_TypeFilter::~GEOM_TypeFilter() { } //======================================================================= -// name : GEOM_TypeFilter::IsOk -// Purpose : Verify validity of entry object +// function : isOk +// purpose : //======================================================================= -Standard_Boolean GEOM_TypeFilter::IsOk( const Handle(SALOME_InteractiveObject)& theIO ) const +bool GEOM_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const { - if ( SALOME_TypeFilter::IsOk( theIO ) ) - { - Standard_Boolean aTestRes = Standard_False; - GEOM::GEOM_Object_var anObj = convertIOinGEOMObject( theIO, aTestRes ); - if ( aTestRes && !anObj->_is_nil() ) - return anObj->GetType() == myType; - } - + GEOM::GEOM_Object_var obj = getObject( sOwner ); + if ( !CORBA::is_nil( obj ) ) + return obj->GetType() == type(); + return false; } //======================================================================= -// name : GEOM_TypeFilter::SetType -// Purpose : Set type of object -//======================================================================= -void GEOM_TypeFilter::SetType( const int theType ) -{ - myType = theType; -} - -//======================================================================= -// name : GEOM_TypeFilter::GetType -// Purpose : Get type of object +// function : type +// purpose : //======================================================================= -int GEOM_TypeFilter::GetType() const +int GEOM_TypeFilter::type() const { return myType; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/GEOMFiltersSelection/Makefile.in b/src/GEOMFiltersSelection/Makefile.in index 7857d21cf..745ff6720 100644 --- a/src/GEOMFiltersSelection/Makefile.in +++ b/src/GEOMFiltersSelection/Makefile.in @@ -37,31 +37,30 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMFiltersSelection.la -LIB_SRC = GEOM_ShapeTypeFilter.cxx \ - GEOM_FaceFilter.cxx \ +LIB_SRC = GEOM_SelectionFilter.cxx \ GEOM_EdgeFilter.cxx \ - GEOM_PreviewFilter.cxx \ + GEOM_FaceFilter.cxx \ + GEOM_TypeFilter.cxx \ + GEOM_PreviewFilter.cxx \ GEOM_LogicalFilter.cxx \ - GEOM_TypeFilter.cxx - -LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl GEOM_Gen.idl SALOME_GenericObj.idl + GEOM_OCCFilter.cxx # header files -EXPORT_HEADERS= GEOM_ShapeTypeFilter.hxx \ - Handle_GEOM_ShapeTypeFilter.hxx \ - GEOM_FaceFilter.hxx \ - Handle_GEOM_FaceFilter.hxx \ - GEOM_EdgeFilter.hxx \ - Handle_GEOM_EdgeFilter.hxx \ - GEOM_TypeFilter.hxx \ - GEOM_LogicalFilter.hxx \ - GEOM_PreviewFilter.hxx \ - Handle_GEOM_PreviewFilter.hxx +EXPORT_HEADERS= GEOM_SelectionFilter.h \ + GEOM_EdgeFilter.h \ + GEOM_FaceFilter.h \ + GEOM_TypeFilter.h \ + GEOM_PreviewFilter.h \ + GEOM_LogicalFilter.h \ + GEOM_OCCFilter.h + +LIB_CLIENT_IDL= GEOM_Gen.idl SALOMEDS.idl SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl + # additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lSalomeGUI -L${KERNEL_ROOT_DIR}/lib/salome +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I$(GUI_ROOT_DIR)/include/salome -I$(KERNEL_ROOT_DIR)/include/salome +CXXFLAGS += $(QT_INCLUDES) $(BOOST_CPPFLAGS) -I$(GUI_ROOT_DIR)/include/salome -I$(KERNEL_ROOT_DIR)/include/salome +LDFLAGS += -L$(GUI_ROOT_DIR)/lib/salome -L$(KERNEL_ROOT_DIR)/lib/salome -lsuit # additional file to be cleaned MOSTLYCLEAN = diff --git a/src/GEOMGUI/GEOMGUI.cxx b/src/GEOMGUI/GEOMGUI.cxx index 815927875..97fc874aa 100644 --- a/src/GEOMGUI/GEOMGUI.cxx +++ b/src/GEOMGUI/GEOMGUI.cxx @@ -28,17 +28,20 @@ #include "GEOMGUI.h" -#include "QAD_Desktop.h" -#include "QAD_StudyFrame.h" -#include "QAD_Application.h" +#include "SUIT_Desktop.h" +#include "SUIT_ViewWindow.h" + +#include "GeometryGUI.h" + #include //================================================================================= // class : GEOMGUI::GEOMGUI // purpose : Constructor //================================================================================= -GEOMGUI::GEOMGUI( QObject* parent ) : - QObject ( parent ) +GEOMGUI::GEOMGUI( GeometryGUI* parent ) : +QObject ( parent ), +myGeometryGUI( parent ) { } @@ -54,7 +57,7 @@ GEOMGUI::~GEOMGUI() // class : GEOMGUI::OnGUIEvent // purpose : Main/popup menu events processing //================================================================================= -bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, QAD_Desktop* /*parent*/ ) +bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, SUIT_Desktop* /*parent*/ ) { return TRUE; } @@ -64,7 +67,7 @@ bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, QAD_Desktop* /*parent*/ ) // purpose : Mouse press event processing. Should return FALSE to let the event // be processed further. //================================================================================= -bool GEOMGUI::OnMousePress( QMouseEvent* /*pe*/, QAD_Desktop* /*parent*/, QAD_StudyFrame* /*studyFrame*/ ) +bool GEOMGUI::OnMousePress( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ ) { return FALSE; } @@ -73,7 +76,7 @@ bool GEOMGUI::OnMousePress( QMouseEvent* /*pe*/, QAD_Desktop* /*parent*/, QAD_St // class : GEOMGUI::OnMouseMove // purpose : Mouse move event processing //================================================================================= -bool GEOMGUI::OnMouseMove( QMouseEvent* /*pe*/, QAD_Desktop* /*parent*/, QAD_StudyFrame* /*studyFrame*/ ) +bool GEOMGUI::OnMouseMove( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ ) { return TRUE; } @@ -82,7 +85,7 @@ bool GEOMGUI::OnMouseMove( QMouseEvent* /*pe*/, QAD_Desktop* /*parent*/, QAD_Stu // class : GEOMGUI::OnKeyPress // purpose : Key press event processing //================================================================================= -bool GEOMGUI::OnKeyPress( QKeyEvent* /*pe*/, QAD_Desktop* /*parent*/, QAD_StudyFrame* /*studyFrame*/ ) +bool GEOMGUI::OnKeyPress( QKeyEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ ) { return TRUE; } @@ -91,25 +94,24 @@ bool GEOMGUI::OnKeyPress( QKeyEvent* /*pe*/, QAD_Desktop* /*parent*/, QAD_StudyF // class : GEOMGUI::SetSettings // purpose : Called when GEOM component is activated //================================================================================= -bool GEOMGUI::SetSettings( QAD_Desktop* /*parent*/ ) +void GEOMGUI::activate( SUIT_Desktop* /*parent*/ ) { - return TRUE; } //================================================================================= // class : GEOMGUI::Deactivate // purpose : Called when GEOM component is deactivated //================================================================================= -void GEOMGUI::Deactivate() +void GEOMGUI::deactivate() { } //================================================================================= -// class : GEOMGUI::ActiveStudyChanged -// purpose : Called when active study changed +// class : GEOMGUI::Deactivate +// purpose : Called when GEOM component is deactivated //================================================================================= -bool GEOMGUI::ActiveStudyChanged( QAD_Desktop* /*parent*/ ) +GeometryGUI* GEOMGUI::getGeometryGUI() { - return TRUE; + return myGeometryGUI; } diff --git a/src/GEOMGUI/GEOMGUI.h b/src/GEOMGUI/GEOMGUI.h index bd0520027..d0a740f4b 100644 --- a/src/GEOMGUI/GEOMGUI.h +++ b/src/GEOMGUI/GEOMGUI.h @@ -31,10 +31,11 @@ #include -class QAD_Desktop; -class QAD_StudyFrame; +class SUIT_Desktop; +class SUIT_ViewWindow; class QMouseEvent; class QKeyEvent; +class GeometryGUI; //================================================================================= // class : GEOMGUI @@ -44,18 +45,24 @@ class GEOMGUI : public QObject { public : // Constructor - GEOMGUI( QObject* parent = 0 ); + GEOMGUI( GeometryGUI* parent ); // Destructor virtual ~GEOMGUI(); // Each of this methods can be redifined by descendants - virtual bool OnGUIEvent( int theCommandID, QAD_Desktop* parent ); - virtual bool OnMousePress( QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame ); - virtual bool OnMouseMove( QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame ); - virtual bool OnKeyPress( QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame ); - virtual bool SetSettings( QAD_Desktop* parent ); - virtual void Deactivate(); - virtual bool ActiveStudyChanged( QAD_Desktop* parent ); + virtual bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); + + virtual bool OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); + virtual bool OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); + virtual bool OnKeyPress( QKeyEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* ); + + virtual void activate( SUIT_Desktop* parent ); + virtual void deactivate(); + + GeometryGUI* getGeometryGUI(); + +private: + GeometryGUI* myGeometryGUI; }; #endif // __GEOMGUI_H diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index f518e4ecb..06d24894c 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -26,38 +26,51 @@ // Module : GEOM // $Header$ +#include + #include "GEOM_Displayer.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_TypeFilter.hxx" -#include "QAD_Desktop.h" -#include "QAD_Application.h" -#include "QAD_Study.h" -#include "QAD_StudyFrame.h" -#include "QAD_RightFrame.h" -#include "QAD_ViewFrame.h" -#include "QAD_Config.h" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "OCCViewer_Prs.h" -#include "OCCViewer_ViewFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "VTKViewer_Prs.h" -#include "VTKViewer_ViewFrame.h" #include "GEOMImpl_Types.hxx" -#include "TColStd_MapOfInteger.hxx" -#include "TColStd_MapIteratorOfMapOfInteger.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GEOM_FaceFilter.hxx" -#include "GEOM_PreviewFilter.hxx" -#include "GEOM_LogicalFilter.hxx" + +#include "GEOM_TypeFilter.h" +#include "GEOM_EdgeFilter.h" +#include "GEOM_FaceFilter.h" +#include "GEOM_PreviewFilter.h" +#include "GEOM_LogicalFilter.h" +#include "GEOM_OCCFilter.h" + #include "GEOM_AssemblyBuilder.h" #include "GEOM_Actor.h" #include "GEOM_AISTrihedron.hxx" #include "GEOM_VTKTrihedron.hxx" +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include + #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) -#include "GeometryGUI.h" -#include "GEOM_AISShape.hxx" +#include +#include #include #include #include @@ -67,7 +80,8 @@ #include #include #include - +#include +#include #include #include @@ -78,14 +92,12 @@ using namespace std; // Function : getActiveStudy // Purpose : Get active study, returns 0 if no open study frame //================================================================ -static inline QAD_Study* getActiveStudy() +static inline SalomeApp_Study* getActiveStudy() { - QAD_Desktop* desktop = QAD_Application::getDesktop(); - if ( desktop ) { - QAD_Application* app = desktop->getActiveApp(); - if ( app ) - return app->getActiveStudy(); - } + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) + return ( SalomeApp_Study* )app->activeStudy(); return 0; } @@ -110,38 +122,38 @@ static inline int getTopAbsMode( const int implType ) } //================================================================ -// Function : getTopAbsMode +// Function : getFilter // Purpose : Get filter corresponding to the type of object // from GEOMImpl_Types.h //================================================================ -static inline Handle(SALOME_Filter) getFilter( const int theMode ) +SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode ) { - Handle(SALOME_Filter) aFilter; + SUIT_SelectionFilter* aFilter; int aTopAbsMode = getTopAbsMode( theMode ); if ( aTopAbsMode != -1 ) - aFilter = new GEOM_ShapeTypeFilter( ( TopAbs_ShapeEnum )aTopAbsMode ); + aFilter = new GEOM_TypeFilter( getStudy(), theMode ); //@ aFilter = new GEOM_TypeFilter( ( TopAbs_ShapeEnum )aTopAbsMode ); else switch ( theMode ) - { - case GEOM_LINE : aFilter = new GEOM_EdgeFilter( StdSelect_Line ); break; - case GEOM_CIRCLE : aFilter = new GEOM_EdgeFilter( StdSelect_Circle ); break; - - case GEOM_PLANE : aFilter = new GEOM_FaceFilter( StdSelect_Plane ); break; - case GEOM_CYLINDER : aFilter = new GEOM_FaceFilter( StdSelect_Cylinder ); break; - case GEOM_SPHERE : aFilter = new GEOM_FaceFilter( StdSelect_Sphere ); break; - case GEOM_TORUS : aFilter = new GEOM_FaceFilter( StdSelect_Torus ); break; - case GEOM_REVOLUTION: aFilter = new GEOM_FaceFilter( StdSelect_Revol ); break; - case GEOM_CONE : aFilter = new GEOM_FaceFilter( StdSelect_Cone ); break; - - case GEOM_PREVIEW : aFilter = new GEOM_PreviewFilter(); break; - - case GEOM_ALLSHAPES : aFilter = new GEOM_ShapeTypeFilter( -1, true ); break; - case GEOM_ALLGEOM : aFilter = new SALOME_TypeFilter( "GEOM" ); break; - - default : aFilter = new GEOM_TypeFilter( theMode ); break; - } - + { + case GEOM_LINE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Line ); break; + case GEOM_CIRCLE : aFilter = new GEOM_EdgeFilter( getStudy(), StdSelect_Circle ); break; + + case GEOM_PLANE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Plane ); break; + case GEOM_CYLINDER : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cylinder ); break; + case GEOM_SPHERE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Sphere ); break; + case GEOM_TORUS : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Torus ); break; + case GEOM_REVOLUTION: aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Revol ); break; + case GEOM_CONE : aFilter = new GEOM_FaceFilter( getStudy(), StdSelect_Cone ); break; + + case GEOM_PREVIEW : aFilter = new GEOM_PreviewFilter( getStudy() ); break; + + case GEOM_ALLSHAPES : aFilter = new GEOM_SelectionFilter(getStudy(), true ); break; + case GEOM_ALLGEOM : aFilter = new SalomeApp_TypeFilter( getStudy(), "GEOM" ); break; + + default : aFilter = new GEOM_TypeFilter( getStudy(), theMode ); break; + } + return aFilter; } @@ -151,14 +163,17 @@ static inline Handle(SALOME_Filter) getFilter( const int theMode ) //================================================================ static char* getEntry( GEOM::GEOM_Object_ptr object ) { - QAD_Study* study = getActiveStudy(); - if ( study ) { - string IOR = GeometryGUI::GetORB()->object_to_string( object ); - if ( IOR != "" ) { - SALOMEDS::SObject_var SO = study->getStudyDocument()->FindObjectIOR( IOR.c_str() ); - if ( !SO->_is_nil() ) { - return SO->GetID(); - } + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) + { + string IOR = app->orb()->object_to_string( object ); + if ( IOR != "" ) + { + SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) + return (char*)(SO->GetID().c_str()); } } return ""; @@ -168,22 +183,24 @@ static char* getEntry( GEOM::GEOM_Object_ptr object ) // Function : getName // Purpose : //================================================================ -static const char* getName( GEOM::GEOM_Object_ptr theObj ) +static const char* getName( GEOM::GEOM_Object_ptr object ) { - QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy(); - - if ( aStudy ) + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) { - string anIOR = GeometryGUI::GetORB()->object_to_string( theObj ); - if ( anIOR != "" ) + string IOR = app->orb()->object_to_string( object ); + if ( IOR != "" ) { - SALOMEDS::SObject_var aSObj = aStudy->getStudyDocument()->FindObjectIOR( anIOR.c_str() ); - SALOMEDS::GenericAttribute_var anAttr; + SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy(); + _PTR(SObject) aSObj ( study->studyDS()->FindObjectIOR( IOR ) ); - if ( !aSObj->_is_nil() && aSObj->FindAttribute( anAttr, "AttributeName") ) + _PTR(GenericAttribute) anAttr; + + if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) { - SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); - return aNameAttr->Value(); + _PTR(AttributeName) aNameAttr( anAttr ); + return aNameAttr->Value().c_str(); } } } @@ -197,17 +214,18 @@ static const char* getName( GEOM::GEOM_Object_ptr theObj ) * Constructor */ //================================================================= -GEOM_Displayer::GEOM_Displayer() +GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* study ) { + myStudy = study; + /* Shading Color */ - QString SCr = QAD_CONFIG->getSetting( "Geometry:SettingsShadingColorRed" ); - QString SCg = QAD_CONFIG->getSetting( "Geometry:SettingsShadingColorGreen" ); - QString SCb = QAD_CONFIG->getSetting( "Geometry:SettingsShadingColorBlue" ); - if ( !SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty() ) - myShadingColor = Quantity_Color( - SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255., Quantity_TOC_RGB ); - else - myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); + SUIT_Session* session = SUIT_Session::session(); + SUIT_ResourceMgr* resMgr = session->resourceMgr(); + QColor col = resMgr->colorValue( "Geometry", "SettingsShadingColor", QColor( "goldenrod" ) ); + +// TO DO: make some utility method to convert QColor into Quantity_Color +// myShadingColor = SUIT_Tools::color( col ); + myShadingColor = Quantity_NOC_RED; myColor = -1; // This color is used for shape displaying. If it is equal -1 then @@ -238,15 +256,29 @@ GEOM_Displayer::~GEOM_Displayer() * Get active study frame, returns 0 if no open study frame */ //================================================================= -QAD_ViewFrame* GEOM_Displayer::GetActiveView() +SALOME_View* GEOM_Displayer::GetActiveView() { - QAD_Study* activeStudy = getActiveStudy(); - if ( activeStudy ) + SUIT_Session* session = SUIT_Session::session(); + SUIT_Application* app = session->activeApplication(); + if ( app ) { - QAD_StudyFrame* sf = activeStudy->getActiveStudyFrame(); - if ( sf ) + SUIT_Desktop* desk = app->desktop(); + if ( desk ) { - return sf->getRightFrame()->getViewFrame(); + SUIT_ViewWindow* win = desk->activeWindow(); + if ( win ) + { + SUIT_ViewManager* vman = win->getViewManager(); + if ( vman ) + { + SUIT_ViewModel* vmodel = vman->getViewModel(); + if ( vmodel ) + { + SALOME_View* view = dynamic_cast(vmodel); + return view; + } + } + } } } return 0; @@ -258,30 +290,21 @@ QAD_ViewFrame* GEOM_Displayer::GetActiveView() * Display interactive object in the current viewer */ //================================================================= -void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer, - QAD_ViewFrame* theViewFrame ) +void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO, + const bool updateViewer, + SALOME_View* theViewFrame ) { - QAD_ViewFrame* vf = theViewFrame; - if ( !vf ) - vf = GetActiveView(); - + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); if ( vf ) { - if ( vf->inherits( "VTKViewer_ViewFrame" ) ) - { - SALOME_Prs* prs = vf->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 ); - ((SALOME_View*)vf)->Erase( prs, true ); - delete prs; - } - SALOME_Prs* prs = buildPresentation( theIO, vf ); if ( prs ) { vf->BeforeDisplay( this ); - ((SALOME_View*)vf)->Display( prs ); + vf->Display( prs ); vf->AfterDisplay( this ); - + if ( updateViewer ) vf->Repaint(); @@ -318,19 +341,17 @@ void GEOM_Displayer::Display( GEOM::GEOM_Object_ptr theObj, const bool updateVie void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO, const bool forced, const bool updateViewer, - QAD_ViewFrame* theViewFrame ) + SALOME_View* theViewFrame ) { if ( theIO.IsNull() ) return; - QAD_ViewFrame* vf = theViewFrame; - if ( !vf ) - vf = GetActiveView(); + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); if ( vf ) { SALOME_Prs* prs = vf->CreatePrs( theIO->getEntry() ); if ( prs ) { - ((SALOME_View*)vf)->Erase( prs, forced ); + vf->Erase( prs, forced ); if ( updateViewer ) vf->Repaint(); delete prs; // delete presentation because displayer is its owner @@ -356,6 +377,25 @@ void GEOM_Displayer::Erase( GEOM::GEOM_Object_ptr theObj, } } +//================================================================= +/*! + * GEOM_Displayer::EraseAll + * Erase all objects in the current viewer + */ +//================================================================= +void GEOM_Displayer::EraseAll ( const bool forced, + const bool updateViewer, + SALOME_View* theViewFrame ) +{ + SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); + + if ( vf ) { + vf->EraseAll( forced ); + if ( updateViewer ) + vf->Repaint(); + } +} + //================================================================= /*! * GEOM_Displayer::Redisplay @@ -367,28 +407,34 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer ) { // Remove the object permanently ( == true) - - QAD_Study* activeStudy = getActiveStudy(); - if ( !activeStudy ) - return; - - int aNbFrames = activeStudy->getStudyFramesCount(); - for (int i = 0; i < aNbFrames; i++) + SUIT_Session* ses = SUIT_Session::session(); + SUIT_Application* app = ses->activeApplication(); + if ( app ) + { + SUIT_Desktop* desk = app->desktop(); + QPtrList wnds = desk->windows(); + SUIT_ViewWindow* wnd; + for ( wnd = wnds.first(); wnd; wnd = wnds.next() ) { - QAD_StudyFrame* sf = activeStudy->getStudyFrame(i); - if ( !sf ) - continue; - - QAD_ViewFrame* vf = sf->getRightFrame()->getViewFrame(); - if ( !vf ) - continue; - - if ( vf->isVisible(theIO) || vf == GetActiveView() ) + SUIT_ViewManager* vman = wnd->getViewManager(); + if ( vman ) + { + SUIT_ViewModel* vmodel = vman->getViewModel(); + if ( vmodel ) { - Erase( theIO, true, false, vf ); - Display( theIO, updateViewer, vf ); + SALOME_View* view = dynamic_cast(vmodel); + if ( view ) + { + if ( view->isVisible( theIO ) || view == GetActiveView() ) + { + Erase( theIO, true, false, view ); + Display( theIO, updateViewer, view ); + } + } } + } } + } } //================================================================= @@ -434,9 +480,9 @@ void GEOM_Displayer::Erase( const SALOME_ListIO& theIOList, void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList, const bool updateViewer ) { SALOME_ListIteratorOfListIO Iter( theIOList ); - for ( ; Iter.More(); Iter.Next() ) { + for ( ; Iter.More(); Iter.Next() ) Redisplay( Iter.Value(), false ); - } + if ( updateViewer ) UpdateViewer(); } @@ -449,7 +495,7 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList, const bool updat //================================================================= void GEOM_Displayer::UpdateViewer() { - QAD_ViewFrame* vf = GetActiveView(); + SALOME_View* vf = GetActiveView(); if ( vf ) vf->Repaint(); } @@ -463,14 +509,10 @@ void GEOM_Displayer::UpdateViewer() //================================================================= void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) { - OCCViewer_Prs* occPrs = dynamic_cast( prs ); + SOCC_Prs* occPrs = dynamic_cast( prs ); if ( !occPrs ) return; - OCCViewer_ViewFrame* vf = dynamic_cast( myViewFrame ); - if ( !vf ) - return; - if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE ) { TopoDS_Face aFace = TopoDS::Face( myShape ); @@ -611,7 +653,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) //================================================================= void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) { - VTKViewer_Prs* vtkPrs = dynamic_cast( prs ); + SVTK_Prs* vtkPrs = dynamic_cast( prs ); if ( !vtkPrs || myShape.IsNull() ) return; @@ -636,8 +678,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) gp_Ax2 anAx2 = aPlane->Pln().Position().Ax2(); aTrh->SetPlacement( new Geom_Axis2Placement( anAx2 ) ); - if ( VTKViewer_ViewFrame* vf = dynamic_cast( GetActiveView() ) ) - aTrh->SetSize( 0.5 * vf->GetTrihedronSize() ); +// if ( SVTK_Viewer* vf = dynamic_cast( GetActiveView() ) ) +// aTrh->SetSize( 0.5 * vf->GetTrihedronSize() ); vtkPrs->AddObject( aTrh ); @@ -716,8 +758,6 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) if ( theObj->_is_nil() ) return 0; - GeometryGUI* geomGUI = GeometryGUI::GetGeomGUI(); - myViewFrame = GetActiveView(); if ( myViewFrame == 0 ) return 0; @@ -727,7 +767,7 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) return 0; internalReset(); - setShape( geomGUI->GetShapeReader().GetShape( geomGUI->GetGeomGen(), theObj ) ); + setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), theObj ) ); myType = theObj->GetType(); // Update presentation @@ -770,35 +810,46 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape ) */ //================================================================= SALOME_Prs* GEOM_Displayer::buildPresentation( const Handle(SALOME_InteractiveObject)& theIO, - QAD_ViewFrame* theViewFrame ) + SALOME_View* theViewFrame ) { SALOME_Prs* prs = 0; internalReset(); - GeometryGUI* geomGUI = GeometryGUI::GetGeomGUI(); - - myViewFrame = theViewFrame; // no dynamic_cast here to use double dispatch - if ( !myViewFrame ) - myViewFrame = GetActiveView(); + myViewFrame = theViewFrame ? theViewFrame : GetActiveView(); - if ( myViewFrame ) { + if ( myViewFrame ) + { prs = myViewFrame->CreatePrs( !theIO.IsNull() ? theIO->getEntry() : 0 ); - if ( prs ) { - if ( !theIO.IsNull() ) { + if ( prs ) + { + if ( !theIO.IsNull() ) + { // set interactive object setIO( theIO ); // Find SOBject (because shape should be published previously) - SALOMEDS::SObject_var SO = getActiveStudy()->getStudyDocument()->FindObjectID( theIO->getEntry() ); - if ( !SO->_is_nil() ) { - // get CORBA reference to data object - CORBA::Object_var object = SO->GetObject(); - if ( !CORBA::is_nil( object ) ) { - // downcast to GEOM object - GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object ); - if ( !GeomObject->_is_nil() ) { - // finally set shape - setShape( geomGUI->GetShapeReader().GetShape( geomGUI->GetGeomGen(), GeomObject ) ); - myType = GeomObject->GetType(); + SUIT_Session* session = SUIT_Session::session(); + SUIT_Application* app = session->activeApplication(); + if ( app ) + { + SalomeApp_Study* study = dynamic_cast( app->activeStudy() ); + if ( study ) + { + _PTR(SObject) SO ( study->studyDS()->FindObjectID( theIO->getEntry() ) ); + if ( SO ) + { + // get CORBA reference to data object + CORBA::Object_var object = dynamic_cast(SO.get())->GetObject(); + if ( !CORBA::is_nil( object ) ) + { + // downcast to GEOM object + GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( object ); + if ( !GeomObject->_is_nil() ) + { + // finally set shape + setShape( GEOM_Client().GetShape( GeometryGUI::GetGeomGen(), GeomObject ) ); + myType = GeomObject->GetType(); + } + } } } } @@ -831,19 +882,23 @@ void GEOM_Displayer::internalReset() //================================================================= void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode ) { - // remove all filters from selection - SALOME_Selection* aSel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( !app ) + return; - aSel->ClearFilters(); + SalomeApp_SelectionMgr* sm = app->selectionMgr(); + + // remove all filters from selection + sm->clearFilters(); - QAD_ViewFrame* vf = GetActiveView(); + SALOME_View* vf = GetActiveView(); if ( vf ) - { - SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() ); - ((SALOME_View*)vf)->LocalSelection( prs, theMode ); - delete prs; // delete presentation because displayer is its owner - } + { + SALOME_Prs* prs = vf->CreatePrs( theIO.IsNull() ? 0 : theIO->getEntry() ); + vf->LocalSelection( prs, theMode ); + delete prs; // delete presentation because displayer is its owner + } } //================================================================= @@ -870,53 +925,76 @@ void GEOM_Displayer::GlobalSelection( const int theMode, const bool update ) void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, const bool update ) { - QAD_ViewFrame* vf = GetActiveView(); + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( !app ) + return; + + SALOME_View* vf = GetActiveView(); if ( vf == 0 ) return; - + // Close local context vf->GlobalSelection( update ); // Set selection filters in accordance with current mode - SALOME_Selection* aSel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + SalomeApp_SelectionMgr* sm = app->selectionMgr(); + if ( !sm ) + return; // Remove from selection temporary objects if necessary if ( !theModes.Contains( GEOM_PREVIEW ) ) - clearTemporary( aSel ); + clearTemporary( sm ); - aSel->ClearIndex(); + //@ aSel->ClearIndex(); - aSel->ClearFilters(); - + sm->clearFilters(); + + // Remove filters from AIS_InteractiveContext + Handle(AIS_InteractiveContext) ic; + SOCC_Viewer* viewer = dynamic_cast( vf ); + if ( viewer ) + { + ic = viewer->getAISContext(); + if ( !ic.IsNull() ) + ic->RemoveFilters(); + } + if ( theModes.Contains( GEOM_ALLOBJECTS ) ) return; - Handle(SALOME_Filter) aFilter; + SUIT_SelectionFilter* aFilter; if ( theModes.Extent() == 1 ) - { - int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key(); - aFilter = getFilter( aMode ); - } + { + int aMode = TColStd_MapIteratorOfMapOfInteger( theModes ).Key(); + aFilter = getFilter( aMode ); + } else if ( theModes.Extent() > 1 ) - { - TColStd_MapOfInteger aTopAbsModes; - TColStd_MapIteratorOfMapOfInteger anIter( theModes ); - GEOM_ListOfFilter aListOfFilters; - for ( ; anIter.More(); anIter.Next() ) { - Handle(SALOME_Filter) aFilter = getFilter( anIter.Key() ); - if ( !aFilter.IsNull() ) - aListOfFilters.Append( aFilter ); + TColStd_MapOfInteger aTopAbsModes; + TColStd_MapIteratorOfMapOfInteger anIter( theModes ); + QPtrList aListOfFilters; + for ( ; anIter.More(); anIter.Next() ) + { + SUIT_SelectionFilter* aFilter = getFilter( anIter.Key() ); + if ( aFilter ) + aListOfFilters.append( aFilter ); + } + + aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); } - - aFilter = new GEOM_LogicalFilter( aListOfFilters, GEOM_LogicalFilter::LO_OR ); - } else return; - if ( !aFilter.IsNull() ) - aSel->AddFilter( aFilter ); + if ( aFilter ) + { + sm->installFilter( aFilter ); + if ( !ic.IsNull() ) + { + Handle(GEOM_OCCFilter) anOCCFilter = new GEOM_OCCFilter( sm ); + ic->AddFilter( anOCCFilter ); + } + } } //================================================================= @@ -942,10 +1020,10 @@ void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int t //================================================================= void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCViewType& ) { - OCCViewer_ViewFrame* vf = dynamic_cast( v ); + SOCC_Viewer* vf = dynamic_cast( v ); if ( vf ) { - Handle(AIS_InteractiveContext) ic = vf->getViewer()->getAISContext(); + Handle(AIS_InteractiveContext) ic = vf->getAISContext(); if ( !ic.IsNull() ) { if ( ic->HasOpenedContext() ) @@ -1033,42 +1111,19 @@ bool GEOM_Displayer::ToActivate() const * Removes from selection temporary objects */ //================================================================= -void GEOM_Displayer::clearTemporary( SALOME_Selection* theSel ) +void GEOM_Displayer::clearTemporary( SalomeApp_SelectionMgr* theSelMgr ) { - SALOME_ListIO toBeRemoved; - SALOME_ListIteratorOfListIO anIter( theSel->StoredIObjects() ); + SALOME_ListIO toBeSelected; + theSelMgr->selectedObjects(toBeSelected) +; + SALOME_ListIteratorOfListIO anIter( toBeSelected ); for ( ; anIter.More(); anIter.Next() ) - { - Handle(SALOME_InteractiveObject) anIO = anIter.Value(); - if ( anIO->hasEntry() && ( strncmp( anIO->getEntry(), "TEMP_", 5 ) == 0 ) ) - toBeRemoved.Append( anIO ); - } - - SALOME_ListIteratorOfListIO anIter2( toBeRemoved ); - for ( ; anIter2.More(); anIter2.Next() ) - theSel->RemoveIObject( anIter2.Value(), false ); + { + Handle(SALOME_InteractiveObject) anIO = anIter.Value(); + if ( !(anIO->hasEntry()) || ( strncmp( anIO->getEntry(), "TEMP_", 5 ) != 0 ) ) + toBeSelected.Remove( anIter ); + } + + theSelMgr->setSelectedObjects( toBeSelected, true ); } - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 45a1e4f41..40f4a7d23 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -48,15 +48,17 @@ typedef std::list ObjectList; class TColStd_MapOfInteger; -class QAD_ViewFrame; -class SALOME_Selection; +class SalomeApp_SelectionMgr; +class SalomeApp_Study; +class SUIT_SelectionFilter; +//class SALOME_Selection; class GEOM_Displayer : public SALOME_Displayer { public: /* Constructor */ - GEOM_Displayer(); + GEOM_Displayer( SalomeApp_Study* study ); /* Destructor */ virtual ~GEOM_Displayer(); @@ -64,7 +66,7 @@ public: void Display ( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer = true, - QAD_ViewFrame* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); // This overloaded Display() method can be useful for operations // not using dialog boxes. @@ -77,7 +79,7 @@ public: void Erase ( const Handle(SALOME_InteractiveObject)& theIO, const bool forced = false, const bool updateViewer = true, - QAD_ViewFrame* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); void Erase ( GEOM::GEOM_Object_ptr theObj, const bool forced = false, @@ -95,6 +97,11 @@ public: void Redisplay ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); + /* Erase all objects displayed in the given or active view */ + void EraseAll ( const bool forced = false, + const bool updateViewer = true, + SALOME_View* theViewFrame = 0 ); + /* Update current viewer */ void UpdateViewer(); @@ -136,13 +143,14 @@ public: void GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); void GlobalSelection( const TColStd_MapOfInteger&, const bool = false ); - static QAD_ViewFrame* GetActiveView(); + static SALOME_View* GetActiveView(); + SalomeApp_Study* getStudy() const {return myStudy;} protected: /* internal methods */ /* Builds presentation accordint to the current viewer type */ SALOME_Prs* buildPresentation( const Handle(SALOME_InteractiveObject)& theIO, - QAD_ViewFrame* theViewFrame = 0 ); + SALOME_View* theViewFrame = 0 ); /* Sets interactive object */ void setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; } @@ -153,20 +161,25 @@ protected: /* Resets internal data */ void internalReset(); - void clearTemporary( SALOME_Selection* ); + void clearTemporary( SalomeApp_SelectionMgr* theSelMgr ); + SUIT_SelectionFilter* getFilter( const int theMode ); + protected: Handle(SALOME_InteractiveObject) myIO; TopoDS_Shape myShape; string myName; int myType; - QAD_ViewFrame* myViewFrame; + SALOME_View* myViewFrame; // Attributes Quantity_Color myShadingColor; int myColor; double myWidth; bool myToActivate; + +private: + SalomeApp_Study* myStudy; }; #endif // __GEOM_DISPLAYER_H diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 27b5ffcf9..68c7e3310 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -1973,4 +1973,906 @@ msgstr "Propagate" msgid "GEOM_PROPAGATE" msgstr "Propagate" -### +### Menu of GEOM module ### +msgid "MEN_FILE" +msgstr "File" + +msgid "TOP_IMPORT" +msgstr "Import geometry from BREP file" + +msgid "MEN_IMPORT" +msgstr "Import..." + +msgid "STB_IMPORT" +msgstr "Import geometry from BREP file" + +msgid "TOP_EXPORT" +msgstr "Export geometry to BREP file" + +msgid "MEN_EXPORT" +msgstr "Export..." + +msgid "STB_EXPORT" +msgstr "Export geometry to BREP file" + +msgid "MEN_EDIT" +msgstr "Edit" + +msgid "TOP_DELETE" +msgstr "Delete object" + +msgid "MEN_DELETE" +msgstr "Delete" + +msgid "STB_DELETE" +msgstr "Delete object" + +msgid "MEN_NEW_ENTITY" +msgstr "New Entity" + +msgid "MEN_BASIC" +msgstr "Basic" + +msgid "TOP_POINT" +msgstr "Create a point" + +msgid "MEN_POINT" +msgstr "Point" + +msgid "STB_POINT" +msgstr "Create a point" + +msgid "TOP_LINE" +msgstr "Create a line" + +msgid "MEN_LINE" +msgstr "Line" + +msgid "STB_LINE" +msgstr "Create a line" + +msgid "TOP_CIRCLE" +msgstr "Create a circle" + +msgid "MEN_CIRCLE" +msgstr "Circle" + +msgid "STB_CIRCLE" +msgstr "Create a circle" + +msgid "TOP_ELLIPSE" +msgstr "Create a ellipse" + +msgid "MEN_ELLIPSE" +msgstr "Ellipse" + +msgid "STB_ELLIPSE" +msgstr "Create a ellipse" + +msgid "TOP_ARC" +msgstr "Create a arc" + +msgid "MEN_ARC" +msgstr "Arc" + +msgid "STB_ARC" +msgstr "Create a arc" + +msgid "TOP_CURVE" +msgstr "Create a curve" + +msgid "MEN_CURVE" +msgstr "Curve" + +msgid "STB_CURVE" +msgstr "Create a curve" + +msgid "TOP_VECTOR" +msgstr "Create a vector" + +msgid "MEN_VECTOR" +msgstr "Vector" + +msgid "STB_VECTOR" +msgstr "Create a vector" + +msgid "TOP_PLANE" +msgstr "Create a plane" + +msgid "MEN_PLANE" +msgstr "Plane" + +msgid "STB_PLANE" +msgstr "Create a plane" + +msgid "TOP_WORK_PLANE" +msgstr "Create a working plane" + +msgid "MEN_WORK_PLANE" +msgstr "Working plane" + +msgid "STB_WORK_PLANE" +msgstr "Create a working plane" + +msgid "TOP_LOCAL_CS" +msgstr "Create a local coordinate system" + +msgid "MEN_LOCAL_CS" +msgstr "Local coordinate system" + +msgid "STB_LOCAL_CS" +msgstr "Create a local coordinate system" + +msgid "MEN_PRIMITIVES" +msgstr "Primitives" + +msgid "TOP_BOX" +msgstr "Create a box" + +msgid "MEN_BOX" +msgstr "Box" + +msgid "STB_BOX" +msgstr "Create a box" + +msgid "TOP_CYLINDER" +msgstr "Create a cyliner" + +msgid "MEN_CYLINDER" +msgstr "Cyliner" + +msgid "STB_CYLINDER" +msgstr "Create a cylinder" + +msgid "TOP_SPHERE" +msgstr "Create a sphere" + +msgid "MEN_SPHERE" +msgstr "Sphere" + +msgid "STB_SPHERE" +msgstr "Create a sphere" + +msgid "TOP_TORUS" +msgstr "Create a torus" + +msgid "MEN_TORUS" +msgstr "Torus" + +msgid "STB_TORUS" +msgstr "Create a torus" + +msgid "TOP_CONE" +msgstr "Create a cone" + +msgid "MEN_CONE" +msgstr "Cone" + +msgid "STB_CONE" +msgstr "Create a cone" + +msgid "MEN_GENERATION" +msgstr "Generation" + +msgid "TOP_EXTRUSION" +msgstr "Create an extrusion" + +msgid "MEN_EXTRUSION" +msgstr "Extrusion" + +msgid "STB_EXTRUSION" +msgstr "Create an extrusion" + +msgid "TOP_REVOLUTION" +msgstr "Create a revolution" + +msgid "MEN_REVOLUTION" +msgstr "Revolution" + +msgid "STB_REVOLUTION" +msgstr "Create a revolution" + +msgid "TOP_FILLING" +msgstr "Create a filling" + +msgid "MEN_FILLING" +msgstr "Filling" + +msgid "STB_FILLING" +msgstr "Create a filling" + +msgid "TOP_PIPE" +msgstr "Create a pipe" + +msgid "MEN_PIPE" +msgstr "Pipe" + +msgid "STB_PIPE" +msgstr "Create a pipe" + +msgid "MEN_GROUP" +msgstr "Group" + +msgid "TOP_GROUP_CREATE" +msgstr "Create a group" + +msgid "MEN_GROUP_CREATE" +msgstr "Create" + +msgid "STB_GROUP_CREATE" +msgstr "Create a group" + +msgid "TOP_GROUP_EDIT" +msgstr "Edit a group" + +msgid "MEN_GROUP_EDIT" +msgstr "Edit" + +msgid "STB_GROUP_EDIT" +msgstr "Edit a group" + +msgid "MEN_BLOCKS" +msgstr "Blocks" + +msgid "TOP_Q_FACE" +msgstr "Quadrangle Face" + +msgid "MEN_Q_FACE" +msgstr "Quadrangle Face" + +msgid "STB_Q_FACE" +msgstr "Quadrangle Face" + +msgid "TOP_HEX_SOLID" +msgstr "Hexahedral Solid" + +msgid "MEN_HEX_SOLID" +msgstr "Hexahedral Solid" + +msgid "STB_HEX_SOLID" +msgstr "Hexahedral Solid" + +msgid "TOP_SKETCH" +msgstr "Sketch" + +msgid "MEN_SKETCH" +msgstr "Sketch" + +msgid "STB_SKETCH" +msgstr "Sketch" + +msgid "TOP_EXPLODE" +msgstr "Explode" + +msgid "MEN_EXPLODE" +msgstr "Explode" + +msgid "STB_EXPLODE" +msgstr "Explode" + +msgid "MEN_BUILD" +msgstr "Build" + +msgid "TOP_EDGE" +msgstr "Build an edge" + +msgid "MEN_EDGE" +msgstr "Edge" + +msgid "STB_EDGE" +msgstr "Build an edge" + +msgid "TOP_WIRE" +msgstr "Build a wire" + +msgid "MEN_WIRE" +msgstr "Wire" + +msgid "STB_WIRE" +msgstr "Build a wire" + +msgid "TOP_FACE" +msgstr "Build a face" + +msgid "MEN_FACE" +msgstr "Face" + +msgid "STB_FACE" +msgstr "Build a face" + +msgid "TOP_SHELL" +msgstr "Build a shell" + +msgid "MEN_SHELL" +msgstr "Shell" + +msgid "STB_SHELL" +msgstr "Build a shell" + +msgid "TOP_SOLID" +msgstr "Build a solid" + +msgid "MEN_SOLID" +msgstr "Solid" + +msgid "STB_SOLID" +msgstr "Build a solid" + +msgid "TOP_COMPOUND" +msgstr "Build a compound" + +msgid "MEN_COMPOUND" +msgstr "Compound" + +msgid "STB_COMPOUND" +msgstr "Build a compound" + +msgid "MEN_OPERATIONS" +msgstr "Operations" + +msgid "MEN_BOOLEAN" +msgstr "Boolean" + +msgid "TOP_FUSE" +msgstr "Fuse" + +msgid "MEN_FUSE" +msgstr "Fuse" + +msgid "STB_FUSE" +msgstr "Fuse" + +msgid "TOP_COMMON" +msgstr "Common" + +msgid "MEN_COMMON" +msgstr "Common" + +msgid "STB_COMMON" +msgstr "Common" + +msgid "TOP_CUT" +msgstr "Cut" + +msgid "MEN_CUT" +msgstr "Cut" + +msgid "STB_CUT" +msgstr "Cut" + +msgid "TOP_SECTION" +msgstr "Section" + +msgid "MEN_SECTION" +msgstr "Section" + +msgid "STB_SECTION" +msgstr "Section" + +msgid "MEN_TRANSFORMATION" +msgstr "Transformation" + +msgid "TOP_TRANSLATION" +msgstr "Translation" + +msgid "MEN_TRANSLATION" +msgstr "Translation" + +msgid "STB_TRANSLATION" +msgstr "Translation" + +msgid "TOP_ROTATION" +msgstr "Rotation" + +msgid "MEN_ROTATION" +msgstr "Rotation" + +msgid "STB_ROTATION" +msgstr "Rotation" + +msgid "TOP_MODIFY_LOCATION" +msgstr "Modify the Location" + +msgid "MEN_MODIFY_LOCATION" +msgstr "Modify the Location" + +msgid "STB_MODIFY_LOCATION" +msgstr "Modify the Location" + +msgid "TOP_MIRROR" +msgstr "Mirror image" + +msgid "MEN_MIRROR" +msgstr "Mirror image" + +msgid "STB_MIRROR" +msgstr "Mirror image" + +msgid "TOP_SCALE" +msgstr "Scale transform" + +msgid "MEN_SCALE" +msgstr "Scale transform" + +msgid "STB_SCALE" +msgstr "Scale transform" + +msgid "TOP_OFFSET" +msgstr "Offset surface" + +msgid "MEN_OFFSET" +msgstr "Offset surface" + +msgid "STB_OFFSET" +msgstr "Offset surface" + +msgid "TOP_MUL_TRANSLATION" +msgstr "Multi-Translation" + +msgid "MEN_MUL_TRANSLATION" +msgstr "Multi-Translation" + +msgid "STB_MUL_TRANSLATION" +msgstr "Multi-Translation" + +msgid "TOP_MUL_ROTATION" +msgstr "Multi-Rotation" + +msgid "MEN_MUL_ROTATION" +msgstr "Multi-Rotation" + +msgid "STB_MUL_ROTATION" +msgstr "Multi-Rotation" + +msgid "TOP_PARTITION" +msgstr "Partition" + +msgid "MEN_PARTITION" +msgstr "Partition" + +msgid "STB_PARTITION" +msgstr "Partition" + +msgid "TOP_ARCHIMEDE" +msgstr "Archimede" + +msgid "MEN_ARCHIMEDE" +msgstr "Archimede" + +msgid "STB_ARCHIMEDE" +msgstr "Archimede" + +msgid "TOP_FILLET" +msgstr "Fillet" + +msgid "MEN_FILLET" +msgstr "Fillet" + +msgid "STB_FILLET" +msgstr "Fillet" + +msgid "TOP_CHAMFER" +msgstr "Chamfer" + +msgid "MEN_CHAMFER" +msgstr "Chamfer" + +msgid "STB_CHAMFER" +msgstr "Chamfer" + +msgid "TOP_CLIPPING" +msgstr "Clipping range" + +msgid "MEN_CLIPPING" +msgstr "Clipping range" + +msgid "STB_CLIPPING" +msgstr "Clipping range" + +msgid "TOP_MUL_TRANSFORM" +msgstr "Multi-transformation" + +msgid "MEN_MUL_TRANSFORM" +msgstr "Multi-transformation" + +msgid "STB_MUL_TRANSFORM" +msgstr "Multi-transformation" + +msgid "TOP_EXPLODE_BLOCKS" +msgstr "Expload on Blocks" + +msgid "MEN_EXPLODE_BLOCKS" +msgstr "Expload on Blocks" + +msgid "STB_EXPLODE_BLOCKS" +msgstr "Expload on Blocks" + +msgid "TOP_PROPAGATE" +msgstr "Propagate" + +msgid "MEN_PROPAGATE" +msgstr "Propagate" + +msgid "STB_PROPAGATE" +msgstr "Propagate" + +msgid "MEN_REPAIR" +msgstr "Repair" + +msgid "TOP_SHAPE_PROCESS" +msgstr "Perform shape processing" + +msgid "MEN_SHAPE_PROCESS" +msgstr "Shape processing" + +msgid "STB_SHAPE_PROCESS" +msgstr "Perform shape processing " + +msgid "TOP_SUPPRESS_FACES" +msgstr "Perform suppress faces" + +msgid "MEN_SUPPRESS_FACES" +msgstr "Suppress faces" + +msgid "STB_SUPPRESS_FACES" +msgstr "Perform suppress faces" + +msgid "TOP_CLOSE_CONTOUR" +msgstr "Perform close contour" + +msgid "MEN_CLOSE_CONTOUR" +msgstr "Close contour" + +msgid "STB_CLOSE_CONTOUR" +msgstr "Perform close contour" + +msgid "TOP_SUPPRESS_INT_WIRES" +msgstr "Perform suppress internal wires" + +msgid "MEN_SUPPRESS_INT_WIRES" +msgstr "Suppress internal wires" + +msgid "STB_SUPPRESS_INT_WIRES" +msgstr "Perform suppress internal wires" + +msgid "TOP_SUPPERSS_HOLES" +msgstr "Perform suppress holes" + +msgid "MEN_SUPPERSS_HOLES" +msgstr "Suppress holes" + +msgid "STB_SUPPERSS_HOLES" +msgstr "Perform suppress holes" + +msgid "TOP_SEWING" +msgstr "Perform sewing" + +msgid "MEN_SEWING" +msgstr "Sewing" + +msgid "STB_SEWING" +msgstr "Perform sewing" + +msgid "TOP_GLUE_FACES" +msgstr "Perform glue faces" + +msgid "MEN_GLUE_FACES" +msgstr "Glue faces" + +msgid "STB_GLUE_FACES" +msgstr "Perform glue faces" + +msgid "TOP_POINT_ON_EDGE" +msgstr "Add point on edge" + +msgid "MEN_POINT_ON_EDGE" +msgstr "Add point on edge" + +msgid "STB_POINT_ON_EDGE" +msgstr "Add point on edge" + +msgid "TOP_CHECK_FREE_BNDS" +msgstr "Check free boundaries" + +msgid "MEN_CHECK_FREE_BNDS" +msgstr "Check free boundaries" + +msgid "STB_CHECK_FREE_BNDS" +msgstr "Check free boundaries" + +msgid "TOP_CHECK_FREE_FACES" +msgstr "Check free faces" + +msgid "MEN_CHECK_FREE_FACES" +msgstr "Check free faces" + +msgid "STB_CHECK_FREE_FACES" +msgstr "Check free faces" + +msgid "MEN_MEASURES" +msgstr "Measures" + +msgid "TOP_POINT_COORDS" +msgstr "Point corrdinates" + +msgid "MEN_POINT_COORDS" +msgstr "Point corrdinates" + +msgid "STB_POINT_COORDS" +msgstr "Point corrdinates" + +msgid "TOP_BASIC_PROPS" +msgstr "Basic properties" + +msgid "MEN_BASIC_PROPS" +msgstr "Basic properties" + +msgid "STB_BASIC_PROPS" +msgstr "Basic properties" + +msgid "TOP_MASS_CENTER" +msgstr "Compute center of mass" + +msgid "MEN_MASS_CENTER" +msgstr "Center of mass" + +msgid "STB_MASS_CENTER" +msgstr "Compute center of mass" + +msgid "TOP_INERTIA" +msgstr "Compute intertia" + +msgid "MEN_INERTIA" +msgstr "Inertia" + +msgid "STB_INERTIA" +msgstr "Compute intertia" + +msgid "MEN_DIMENSIONS" +msgstr "Dimensions" + +msgid "TOP_BND_BOX" +msgstr "Compute bounding box" + +msgid "MEN_BND_BOX" +msgstr "Bounding box" + +msgid "STB_BND_BOX" +msgstr "Compute bounding box" + +msgid "TOP_MIN_DIST" +msgstr "Compute minimum distance" + +msgid "MEN_MIN_DIST" +msgstr "Min distance" + +msgid "STB_MIN_DIST" +msgstr "Compute minimum distance" + +msgid "TOP_TOLERANCE" +msgstr "Compute tolerance" + +msgid "MEN_TOLERANCE" +msgstr "Compute tolerance" + +msgid "STB_TOLERANCE" +msgstr "Compute tolerance" + +msgid "TOP_WHAT_IS" +msgstr "What is" + +msgid "MEN_WHAT_IS" +msgstr "What is" + +msgid "STB_WHAT_IS" +msgstr "What is" + +msgid "TOP_CHECK" +msgstr "Check" + +msgid "MEN_CHECK" +msgstr "Check" + +msgid "STB_CHECK" +msgstr "Check" + +msgid "TOP_CHECK_COMPOUND" +msgstr "Check compound of blocks" + +msgid "MEN_CHECK_COMPOUND" +msgstr "Check compound of blocks" + +msgid "STB_CHECK_COMPOUND" +msgstr "Check compound of blocks" + +msgid "MEN_TOOLS" +msgstr "Tools" + +msgid "TOP_CHECK_GEOMETRY" +msgstr "Check Geometry" + +msgid "MEN_CHECK_GEOMETRY" +msgstr "Check Geometry" + +msgid "STB_CHECK_GEOMETRY" +msgstr "Check Geometry" + +msgid "TOP_LOAD_SCRIPT" +msgstr "Load script" + +msgid "MEN_LOAD_SCRIPT" +msgstr "Load script" + +msgid "STB_LOAD_SCRIPT" +msgstr "Load script" + +msgid "MEN_PREFERENCES" +msgstr "Preferences" + +msgid "MEN_PREFERENCES_GEOM" +msgstr "Geometry" + +msgid "TOP_SHADING_COLOR" +msgstr "Set shading color" + +msgid "MEN_SHADING_COLOR" +msgstr "Shading color" + +msgid "STB_SHADING_COLOR" +msgstr "Set shading color" + +msgid "TOP_ISOS" +msgstr "Set number of isolines" + +msgid "MEN_ISOS" +msgstr "Isos" + +msgid "STB_ISOS" +msgstr "Set number of isolines" + +msgid "TOP_STEP_VALUE" +msgstr "Set step value" + +msgid "MEN_STEP_VALUE" +msgstr "Step value" + +msgid "STB_STEP_VALUE" +msgstr "Set step value" + +msgid "MEN_VIEW" +msgstr "View" + +msgid "MEN_DISPLAY_MODE" +msgstr "Display mode" + +msgid "TOP_SHADING" +msgstr "Shading" + +msgid "MEN_SHADING" +msgstr "Shading" + +msgid "STB_SHADING" +msgstr "Shading" + +msgid "TOP_DISPLAY_ALL" +msgstr "Display all" + +msgid "MEN_DISPLAY_ALL" +msgstr "Display all" + +msgid "STB_DISPLAY_ALL" +msgstr "Display all" + +msgid "TOP_ERASE_ALL" +msgstr "Erase all" + +msgid "MEN_ERASE_ALL" +msgstr "Erase all" + +msgid "STB_ERASE_ALL" +msgstr "Erase all" + +msgid "TOP_DISPLAY" +msgstr "Display" + +msgid "MEN_DISPLAY" +msgstr "Display" + +msgid "STB_DISPLAY" +msgstr "Display" + +msgid "TOP_DISPLAY_ONLY" +msgstr "Display only" + +msgid "MEN_DISPLAY_ONLY" +msgstr "Display only" + +msgid "STB_DISPLAY_ONLY" +msgstr "Display only" + +msgid "TOP_ERASE" +msgstr "Erase" + +msgid "MEN_ERASE" +msgstr "Erase" + +msgid "STB_ERASE" +msgstr "Erase" + +msgid "TOP_POP_RENAME" +msgstr "Rename" + +msgid "MEN_POP_RENAME" +msgstr "Rename" + +msgid "STB_POP_RENAME" +msgstr "Rename" + +msgid "TOP_POP_WIREFRAME" +msgstr "Wireframe" + +msgid "MEN_POP_WIREFRAME" +msgstr "Wireframe" + +msgid "STB_POP_WIREFRAME" +msgstr "Wireframe" + +msgid "TOP_POP_SHADING" +msgstr "Shading" + +msgid "MEN_POP_SHADING" +msgstr "Shading" + +msgid "STB_POP_SHADING" +msgstr "Shading" + +msgid "TOP_POP_COLOR" +msgstr "Color" + +msgid "MEN_POP_COLOR" +msgstr "Color" + +msgid "STB_POP_COLOR" +msgstr "Color" + +msgid "TOP_POP_TRANSPARENCY" +msgstr "Trancparency" + +msgid "MEN_POP_TRANSPARENCY" +msgstr "Trancparency" + +msgid "STB_POP_TRANSPARENCY" +msgstr "Trancparency" + +msgid "TOP_POP_ISOS" +msgstr "Isolines" + +msgid "MEN_POP_ISOS" +msgstr "Isos" + +msgid "STB_POP_ISOS" +msgstr "Isolines" + +msgid "TOP_POP_CREATE_GROUP" +msgstr "Create Group" + +msgid "MEN_POP_CREATE_GROUP" +msgstr "Create Group" + +msgid "STB_POP_CREATE_GROUP" +msgstr "Create Group" + +msgid "TOOL_BASIC" +msgstr "Basic" + +msgid "TOOL_PRIMITIVES" +msgstr "Primitives" + +msgid "TOOL_BOOLEAN" +msgstr "Boolean operations" + +msgid "TOOL_GENERATION" +msgstr "Generation" + +msgid "TOOL_TRANSFORMATION" +msgstr "Transformation" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 58841200b..ac147d58c 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -27,57 +27,51 @@ // $Header$ #include "GeometryGUI.h" - -// SALOME Includes -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" - -#include "QAD_Desktop.h" -#include "QAD_Application.h" -#include "QAD_RightFrame.h" -#include "QAD_Config.h" -#include "QAD_Tools.h" -#include "QAD_MessageBox.h" -#include "QAD_Resource.h" -#include "SALOMEGUI_Desktop.h" - -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_Prs.h" - -#include "VTKViewer_ViewFrame.h" -#include "VTKViewer_RenderWindowInteractor.h" -#include "VTKViewer_InteractorStyleSALOME.h" -#include "VTKViewer_Prs.h" -#include "SALOME_Actor.h" - -#include "SALOME_Selection.h" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "GEOM_AISShape.hxx" -#include "GEOM_Displayer.h" - -#include "GEOMImpl_Types.hxx" +#include "GEOMGUI_OCCSelector.h" +#include "GEOMGUI_Selection.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include // External includes #include +#include + #include #include #include -#include "utilities.h" +#include #include #include -using namespace std; - extern "C" { - Standard_EXPORT SALOMEGUI* GetComponentGUI() { - return GeometryGUI::GetGeomGUI(); + Standard_EXPORT CAM_Module* createModule() { + return new GeometryGUI(); } } +GEOM::GEOM_Gen_var GeometryGUI::myComponentGeom = GEOM::GEOM_Gen::_nil(); + //================================================================================= // class : CustomItem // purpose : Set Font to a text. @@ -113,37 +107,20 @@ private: QFont myFont; }; -//======================================================================= -// function : GeometryGUI::GetGeomGUI() -// purpose : Gets the only object of GeometryGUI [ static ] -//======================================================================= -GeometryGUI* GeometryGUI::GetGeomGUI() -{ - static GeometryGUI myContext; - return &myContext; -} - -//======================================================================= -// function : GetORB -// purpose : Returns a reference to ORB [ static ] -//======================================================================= -CORBA::ORB_var GeometryGUI::GetORB() -{ - ORB_INIT& init = *SINGLETON_::Instance(); - return init.orb(); -} - //======================================================================= // function : GeometryGUI::GeometryGUI() // purpose : Constructor //======================================================================= GeometryGUI::GeometryGUI() : - SALOMEGUI() + SalomeApp_Module( "GEOM" ) { - QAD_Desktop* desktop = QAD_Application::getDesktop(); - Engines::Component_var comp = desktop->getEngine( "FactoryServer", "GEOM" ); + if ( CORBA::is_nil( myComponentGeom ) ) + { + SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( getApp()->namingService() ); + Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" ); + myComponentGeom = GEOM::GEOM_Gen::_narrow( comp ); + } - myComponentGeom = GEOM::GEOM_Gen::_narrow( comp ); myState = -1; myActiveDialogBox = 0; myFatherior = ""; @@ -151,6 +128,9 @@ GeometryGUI::GeometryGUI() : gp_Pnt origin = gp_Pnt(0., 0., 0.); gp_Dir direction = gp_Dir(0., 0., 1.); myWorkingPlane = gp_Ax3(origin, direction); + + myOCCSelectors.setAutoDelete( true ); + myVTKSelectors.setAutoDelete( true ); } //======================================================================= @@ -165,7 +145,7 @@ GeometryGUI::~GeometryGUI() // function : GeometryGUI::getLibrary() // purpose : get or load GUI library by name [ internal ] //======================================================================= -typedef GEOMGUI* (*LibraryGUI)(); +typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* ); GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) { if ( !myGUIMap.contains( libraryName ) ) { @@ -175,7 +155,7 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) QStringList dirList = QStringList::split( ":", libs, false ); // skip empty entries for( int i = dirList.count()-1; i >= 0; i-- ) { QString dir = dirList[ i ]; - QFileInfo fi( QAD_Tools::addSlash( dirList[ i ] ) + libraryName ); + QFileInfo fi( Qtx::addSlash( dirList[ i ] ) + libraryName ); if( fi.exists() ) { OSD_SharedLibrary aSharedLibrary( (char*)fi.fileName().latin1() ); bool res = aSharedLibrary.DlOpen( OSD_RTLD_LAZY ); @@ -185,8 +165,8 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) } OSD_Function osdF = aSharedLibrary.DlSymb( "GetLibGUI" ); if ( osdF != NULL ) { - LibraryGUI func = (GEOMGUI* (*) ())osdF; - GEOMGUI* libGUI = (*func)(); + LibraryGUI func = (GEOMGUI* (*) (GeometryGUI*))osdF; + GEOMGUI* libGUI = (*func)(this); if ( libGUI ) { myGUIMap[ libraryName ] = libGUI; break; // found and loaded! @@ -211,26 +191,33 @@ void GeometryGUI::ActiveWorkingPlane() gp_Dir DZ = myWorkingPlane.Direction(); gp_Dir DY = myWorkingPlane.YDirection(); - if( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); - Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); + SUIT_ViewWindow* window = application()->desktop()->activeWindow(); + bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool ViewVTK = ( window && window->getViewManager()->getType() == VTKViewer_Viewer::Type() ); + + if( ViewOCC ) { + OCCViewer_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + Handle(V3d_View) view3d = vw->getViewPort()->getView(); - view3d->SetProj(DZ.X(), DZ.Y(), DZ.Z()); - view3d->SetUp(DY.X(), DY.Y(), DY.Z()); + view3d->SetProj(DZ.X(), DZ.Y(), DZ.Z()); + view3d->SetUp(DY.X(), DY.Y(), DY.Z()); - ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewFitAll(); + vw->onViewFitAll(); + } } - else if( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - vtkRenderer* myRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + else if( ViewVTK ) { + VTKViewer_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + vtkCamera* camera = vw->getRenderer()->GetActiveCamera(); - vtkCamera* camera = myRenderer->GetActiveCamera(); - camera->SetPosition(DZ.X(), DZ.Y(), DZ.Z()); - camera->SetViewUp(DY.X(), DY.Y(), DY.Z()); - camera->SetFocalPoint(0,0,0); + camera->SetPosition(DZ.X(), DZ.Y(), DZ.Z()); + camera->SetViewUp(DY.X(), DY.Y(), DY.Z()); + camera->SetFocalPoint(0,0,0); - ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewFitAll(); + vw->onFitAll(); + } } - } //======================================================================= @@ -272,173 +259,169 @@ void GeometryGUI::EmitSignalDefaultStepValueChanged(double newVal) //======================================================================= // function : GeometryGUI::OnGUIEvent() -// purpose : manage all events on GUI [static] +// purpose : common slot for all menu/toolbar actions //======================================================================= -bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +void GeometryGUI::OnGUIEvent() { - GeometryGUI* geomGUI = GeometryGUI::GetGeomGUI(); + const QObject* obj = sender(); + if ( !obj || !obj->inherits( "QAction" ) ) + return; + int id = actionId((QAction*)obj); + if ( id != -1 ) + OnGUIEvent( id ); +} - // get main menu - QMenuBar* Mb = parent->getMainMenuBar(); +//======================================================================= +// function : GeometryGUI::OnGUIEvent() +// purpose : manage all events on GUI [static] +//======================================================================= +void GeometryGUI::OnGUIEvent( int id ) +{ + SUIT_Desktop* desk = application()->desktop(); // check if current viewframe is of OCC type - bool ViewOCC = parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC; + SUIT_ViewWindow* window = desk->activeWindow(); + bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool ViewVTK = ( window && window->getViewManager()->getType() == VTKViewer_Viewer::Type() ); // if current viewframe is not of OCC and not of VTK type - return immediately - if( !ViewOCC && parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) - return false; - - // disable non-OCC viewframe menu commands - //Mb->setItemEnabled( 404, ViewOCC ); // SKETCHER - Mb->setItemEnabled( 603, ViewOCC ); // SuppressFace - Mb->setItemEnabled( 604, ViewOCC ); // SuppressHole - Mb->setItemEnabled( 606, ViewOCC ); // CloseContour - Mb->setItemEnabled( 607, ViewOCC ); // RemoveInternalWires - Mb->setItemEnabled( 608, ViewOCC ); // AddPointOnEdge - //Mb->setItemEnabled( 609, ViewOCC ); // Free boundaries - Mb->setItemEnabled( 413, ViewOCC ); // Isos Settings - - Mb->setItemEnabled( 800, ViewOCC ); // Create Group - Mb->setItemEnabled( 801, ViewOCC ); // Edit Group - - Mb->setItemEnabled(9998, ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION + if( !ViewOCC && !ViewVTK ) + return; GEOMGUI* library = 0; // try to get-or-load corresponding GUI library - if( theCommandID == 111 || // MENU FILE - IMPORT BREP - theCommandID == 112 || // MENU FILE - IMPORT IGES - theCommandID == 113 || // MENU FILE - IMPORT STEP - theCommandID == 121 || // MENU FILE - EXPORT BREP - theCommandID == 122 || // MENU FILE - EXPORT IGES - theCommandID == 123 || // MENU FILE - EXPORT STEP - theCommandID == 31 || // MENU EDIT - COPY - theCommandID == 33 || // MENU EDIT - DELETE - theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY - theCommandID == 412 || // MENU SETTINGS - SHADING COLOR - theCommandID == 413 || // MENU SETTINGS - ISOS - theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES - theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY - theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT - theCommandID == 8032 || // POPUP VIEWER - COLOR - theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY - theCommandID == 8034 || // POPUP VIEWER - ISOS - theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY - theCommandID == 901 || // OBJECT BROWSER - RENAME - theCommandID == 9024 ) { // OBJECT BROWSER - OPEN - library = geomGUI->getLibrary( "libGEOMToolsGUI.so" ); - } - else if( theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING - theCommandID == 212 || // MENU VIEW - DISPLAY ALL - theCommandID == 213 || // MENU VIEW - DISPLAY ONLY - theCommandID == 214 || // MENU VIEW - ERASE ALL - theCommandID == 215 || // MENU VIEW - ERASE - theCommandID == 216 || // MENU VIEW - DISPLAY - theCommandID == 80311 || // POPUP VIEWER - WIREFRAME - theCommandID == 80312 ) { // POPUP VIEWER - SHADING - library = geomGUI->getLibrary( "libDisplayGUI.so" ); - } - else if( theCommandID == 4011 || // MENU BASIC - POINT - theCommandID == 4012 || // MENU BASIC - LINE - theCommandID == 4013 || // MENU BASIC - CIRCLE - theCommandID == 4014 || // MENU BASIC - ELLIPSE - theCommandID == 4015 || // MENU BASIC - ARC - theCommandID == 4016 || // MENU BASIC - VECTOR - theCommandID == 4017 || // MENU BASIC - PLANE - theCommandID == 4018 || // MENU BASIC - WPLANE - theCommandID == 4019 || // MENU BASIC - CURVE - theCommandID == 4020 ) { // MENU BASIC - REPAIR - library = geomGUI->getLibrary( "libBasicGUI.so" ); - } - else if( theCommandID == 4021 || // MENU PRIMITIVE - BOX - theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER - theCommandID == 4023 || // MENU PRIMITIVE - SPHERE - theCommandID == 4024 || // MENU PRIMITIVE - TORUS - theCommandID == 4025 ) { // MENU PRIMITIVE - CONE - library = geomGUI->getLibrary( "libPrimitiveGUI.so" ); - } - else if( theCommandID == 4031 || // MENU GENERATION - PRISM - theCommandID == 4032 || // MENU GENERATION - REVOLUTION - theCommandID == 4033 || // MENU GENERATION - FILLING - theCommandID == 4034 ) { // MENU GENERATION - PIPE - library = geomGUI->getLibrary( "libGenerationGUI.so" ); - } - else if( theCommandID == 404 || // MENU ENTITY - SKETCHER - theCommandID == 407 ) { // MENU ENTITY - EXPLODE - library = geomGUI->getLibrary( "libEntityGUI.so" ); - } - else if( theCommandID == 4081 || // MENU BUILD - EDGE - theCommandID == 4082 || // MENU BUILD - WIRE - theCommandID == 4083 || // MENU BUILD - FACE - theCommandID == 4084 || // MENU BUILD - SHELL - theCommandID == 4085 || // MENU BUILD - SOLID - theCommandID == 4086 ) { // MENU BUILD - COMPUND - library = geomGUI->getLibrary( "libBuildGUI.so" ); - } - else if( theCommandID == 5011 || // MENU BOOLEAN - FUSE - theCommandID == 5012 || // MENU BOOLEAN - COMMON - theCommandID == 5013 || // MENU BOOLEAN - CUT - theCommandID == 5014 ) { // MENU BOOLEAN - SECTION - library = geomGUI->getLibrary( "libBooleanGUI.so" ); - } - else if( theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION - theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION - theCommandID == 5023 || // MENU TRANSFORMATION - LOCATION - theCommandID == 5024 || // MENU TRANSFORMATION - MIRROR - theCommandID == 5025 || // MENU TRANSFORMATION - SCALE - theCommandID == 5026 || // MENU TRANSFORMATION - OFFSET - theCommandID == 5027 || // MENU TRANSFORMATION - MULTI-TRANSLATION - theCommandID == 5028 ) { // MENU TRANSFORMATION - MULTI-ROTATION - library = geomGUI->getLibrary( "libTransformationGUI.so" ); - } - else if( theCommandID == 503 || // MENU OPERATION - PARTITION - theCommandID == 504 || // MENU OPERATION - ARCHIMEDE - theCommandID == 505 || // MENU OPERATION - FILLET - theCommandID == 506 || // MENU OPERATION - CHAMFER - theCommandID == 507 ) { // MENU OPERATION - CLIPPING RANGE - library = geomGUI->getLibrary( "libOperationGUI.so" ); - } - else if( theCommandID == 601 || // MENU REPAIR - SEWING - theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES - theCommandID == 604 || // MENU REPAIR - SUPPRESS HOLE - theCommandID == 605 || // MENU REPAIR - SHAPE PROCESSING - theCommandID == 606 || // MENU REPAIR - CLOSE CONTOUR - theCommandID == 607 || // MENU REPAIR - REMOVE INTERNAL WIRES - theCommandID == 608 || // MENU REPAIR - ADD POINT ON EDGE - theCommandID == 609 || // MENU REPAIR - FREE BOUNDARIES - theCommandID == 610 || // MENU REPAIR - FREE FACES - theCommandID == 602 ) { // MENU REPAIR - GLUE FACES - library = geomGUI->getLibrary( "libRepairGUI.so" ); - } - else if( theCommandID == 701 || // MENU MEASURE - PROPERTIES - theCommandID == 702 || // MENU MEASURE - CDG - theCommandID == 703 || // MENU MEASURE - INERTIA - theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX - theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE - theCommandID == 705 || // MENU MEASURE - TOLERANCE - theCommandID == 706 || // MENU MEASURE - WHATIS - theCommandID == 707 || // MENU MEASURE - CHECK - theCommandID == 7072 || // MENU MEASURE - CHECK COMPOUND OF BLOCKS - theCommandID == 708 ) { // MENU MEASURE - POINT COORDINATES - library = geomGUI->getLibrary( "libMeasureGUI.so" ); - } - else if( theCommandID == 800 || // MENU GROUP - CREATE - theCommandID == 801 ) { // MENU GROUP - EDIT - library = geomGUI->getLibrary( "libGroupGUI.so" ); - } - else if( theCommandID == 9999 || // MENU BLOCKS - HEXAHEDRAL SOLID - theCommandID == 9998 || // MENU BLOCKS - MULTI-TRANSFORMATION - theCommandID == 9997 || // MENU BLOCKS - QUADRANGLE FACE - theCommandID == 99991 || // MENU BLOCKS - PROPAGATE - theCommandID == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS - library = geomGUI->getLibrary( "libBlocksGUI.so" ); + if( id == 111 || // MENU FILE - IMPORT BREP + id == 112 || // MENU FILE - IMPORT IGES + id == 113 || // MENU FILE - IMPORT STEP + id == 121 || // MENU FILE - EXPORT BREP + id == 122 || // MENU FILE - EXPORT IGES + id == 123 || // MENU FILE - EXPORT STEP + id == 31 || // MENU EDIT - COPY + id == 33 || // MENU EDIT - DELETE + id == 411 || // MENU SETTINGS - ADD IN STUDY + id == 412 || // MENU SETTINGS - SHADING COLOR + id == 413 || // MENU SETTINGS - ISOS + id == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + id == 5103 || // MENU TOOLS - CHECK GEOMETRY + id == 5104 || // MENU TOOLS - LOAD SCRIPT + id == 8032 || // POPUP VIEWER - COLOR + id == 8033 || // POPUP VIEWER - TRANSPARENCY + id == 8034 || // POPUP VIEWER - ISOS + id == 804 || // POPUP VIEWER - ADD IN STUDY + id == 901 || // OBJECT BROWSER - RENAME + id == 9024 ) { // OBJECT BROWSER - OPEN + library = getLibrary( "libGEOMToolsGUI.so" ); } - - // call method of corresponding GUI library - if ( library ) { - return library->OnGUIEvent( theCommandID, parent ); + else if( id == 211 || // MENU VIEW - WIREFRAME/SHADING + id == 212 || // MENU VIEW - DISPLAY ALL + id == 213 || // MENU VIEW - DISPLAY ONLY + id == 214 || // MENU VIEW - ERASE ALL + id == 215 || // MENU VIEW - ERASE + id == 216 || // MENU VIEW - DISPLAY + id == 80311 || // POPUP VIEWER - WIREFRAME + id == 80312 ) { // POPUP VIEWER - SHADING + library = getLibrary( "libDisplayGUI.so" ); } - else { - QAD_MessageBox::error1( parent, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) ); + else if( id == 4011 || // MENU BASIC - POINT + id == 4012 || // MENU BASIC - LINE + id == 4013 || // MENU BASIC - CIRCLE + id == 4014 || // MENU BASIC - ELLIPSE + id == 4015 || // MENU BASIC - ARC + id == 4016 || // MENU BASIC - VECTOR + id == 4017 || // MENU BASIC - PLANE + id == 4018 || // MENU BASIC - WPLANE + id == 4019 || // MENU BASIC - CURVE + id == 4020 ) { // MENU BASIC - REPAIR + library = getLibrary( "libBasicGUI.so" ); } - return false; + else if( id == 4021 || // MENU PRIMITIVE - BOX + id == 4022 || // MENU PRIMITIVE - CYLINDER + id == 4023 || // MENU PRIMITIVE - SPHERE + id == 4024 || // MENU PRIMITIVE - TORUS + id == 4025 ) { // MENU PRIMITIVE - CONE + library = getLibrary( "libPrimitiveGUI.so" ); + } + else if( id == 4031 || // MENU GENERATION - PRISM + id == 4032 || // MENU GENERATION - REVOLUTION + id == 4033 || // MENU GENERATION - FILLING + id == 4034 ) { // MENU GENERATION - PIPE + library = getLibrary( "libGenerationGUI.so" ); + } + else if( id == 404 || // MENU ENTITY - SKETCHER + id == 407 ) { // MENU ENTITY - EXPLODE + library = getLibrary( "libEntityGUI.so" ); + } + else if( id == 4081 || // MENU BUILD - EDGE + id == 4082 || // MENU BUILD - WIRE + id == 4083 || // MENU BUILD - FACE + id == 4084 || // MENU BUILD - SHELL + id == 4085 || // MENU BUILD - SOLID + id == 4086 ) { // MENU BUILD - COMPUND + library = getLibrary( "libBuildGUI.so" ); + } + else if( id == 5011 || // MENU BOOLEAN - FUSE + id == 5012 || // MENU BOOLEAN - COMMON + id == 5013 || // MENU BOOLEAN - CUT + id == 5014 ) { // MENU BOOLEAN - SECTION + library = getLibrary( "libBooleanGUI.so" ); + } + else if( id == 5021 || // MENU TRANSFORMATION - TRANSLATION + id == 5022 || // MENU TRANSFORMATION - ROTATION + id == 5023 || // MENU TRANSFORMATION - LOCATION + id == 5024 || // MENU TRANSFORMATION - MIRROR + id == 5025 || // MENU TRANSFORMATION - SCALE + id == 5026 || // MENU TRANSFORMATION - OFFSET + id == 5027 || // MENU TRANSFORMATION - MULTI-TRANSLATION + id == 5028 ) { // MENU TRANSFORMATION - MULTI-ROTATION + library = getLibrary( "libTransformationGUI.so" ); + } + else if( id == 503 || // MENU OPERATION - PARTITION + id == 504 || // MENU OPERATION - ARCHIMEDE + id == 505 || // MENU OPERATION - FILLET + id == 506 || // MENU OPERATION - CHAMFER + id == 507 ) { // MENU OPERATION - CLIPPING RANGE + library = getLibrary( "libOperationGUI.so" ); + } + else if( id == 601 || // MENU REPAIR - SEWING + id == 603 || // MENU REPAIR - SUPPRESS FACES + id == 604 || // MENU REPAIR - SUPPRESS HOLE + id == 605 || // MENU REPAIR - SHAPE PROCESSING + id == 606 || // MENU REPAIR - CLOSE CONTOUR + id == 607 || // MENU REPAIR - REMOVE INTERNAL WIRES + id == 608 || // MENU REPAIR - ADD POINT ON EDGE + id == 609 || // MENU REPAIR - FREE BOUNDARIES + id == 610 || // MENU REPAIR - FREE FACES + id == 602 ) { // MENU REPAIR - GLUE FACES + library = getLibrary( "libRepairGUI.so" ); + } + else if( id == 701 || // MENU MEASURE - PROPERTIES + id == 702 || // MENU MEASURE - CDG + id == 703 || // MENU MEASURE - INERTIA + id == 7041 || // MENU MEASURE - BOUNDING BOX + id == 7042 || // MENU MEASURE - MIN DISTANCE + id == 705 || // MENU MEASURE - TOLERANCE + id == 706 || // MENU MEASURE - WHATIS + id == 707 || // MENU MEASURE - CHECK + id == 7072 || // MENU MEASURE - CHECK COMPOUND OF BLOCKS + id == 708 ) { // MENU MEASURE - POINT COORDINATES + library = getLibrary( "libMeasureGUI.so" ); + } + else if( id == 800 || // MENU GROUP - CREATE + id == 8001 || // POPUP MENU - CREATE GROUP + id == 801 ) { // MENU GROUP - EDIT + library = getLibrary( "libGroupGUI.so" ); + } + else if( id == 9999 || // MENU BLOCKS - HEXAHEDRAL SOLID + id == 9998 || // MENU BLOCKS - MULTI-TRANSFORMATION + id == 9997 || // MENU BLOCKS - QUADRANGLE FACE + id == 99991 || // MENU BLOCKS - PROPAGATE + id == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS + library = getLibrary( "libBlocksGUI.so" ); + } + + // call method of corresponding GUI library + if ( library ) + library->OnGUIEvent( id, desk ); + else + SUIT_MessageBox::error1( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) ); } @@ -446,13 +429,12 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) // function : GeometryGUI::OnKeyPress() // purpose : Called when any key is pressed by user [static] //================================================================================= -bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win ) { - GeometryGUI* geomGUI = GeometryGUI::GetGeomGUI(); GUIMap::Iterator it; bool bOk = true; - for ( it = geomGUI->myGUIMap.begin(); it != geomGUI->myGUIMap.end(); ++it ) - bOk = bOk && it.data()->OnKeyPress( pe, parent, studyFrame ); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win ); return bOk; } @@ -461,13 +443,12 @@ bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* // function : GeometryGUI::OnMouseMove() // purpose : Manages mouse move events [static] //================================================================================= -bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) -{ - GeometryGUI* geomGUI = GeometryGUI::GetGeomGUI(); +bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win ) +{ GUIMap::Iterator it; bool bOk = true; - for ( it = geomGUI->myGUIMap.begin(); it != geomGUI->myGUIMap.end(); ++it ) - bOk = bOk && it.data()->OnMouseMove( pe, parent, studyFrame ); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win ); return bOk; } @@ -476,34 +457,30 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra // function : GeometryGUI::0nMousePress() // purpose : Manage mouse press events [static] //================================================================================= -bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win ) { - GeometryGUI* geomGUI = GeometryGUI::GetGeomGUI(); GUIMap::Iterator it; // OnMousePress() should return false if this event should be processed further // (see OCCViewer_Viewer3d::onMousePress() for explanation) bool processed = false; - for ( it = geomGUI->myGUIMap.begin(); it != geomGUI->myGUIMap.end(); ++it ) - processed = processed || it.data()->OnMousePress( pe, parent, studyFrame ); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win ); return processed; } -static void UpdateVtkSelection(QAD_Desktop* parent) +/* +static void UpdateVtkSelection() { - if (!parent->getActiveStudy()) return; - - QList aFrameList = parent->getActiveStudy()->getStudyFrames(); - - for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) { - if (aStudyFrame->getTypeView() == VIEW_VTK) { - QAD_ViewFrame* aViewFrame = aStudyFrame->getRightFrame()->getViewFrame(); - VTKViewer_ViewFrame* aVtkViewFrame = dynamic_cast(aViewFrame); - if (!aVtkViewFrame) continue; - VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor(); - if (anInteractor) { + QPtrList winList = application()->desktop()->windows(); + SUIT_ViewWindow* win = 0; + for ( win = winList.first(); win; win = winList.next() ) { + if ( win->getViewManager()->getTypeView() == VIEW_VTK ) { + VTKViewer_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + VTKViewer_RenderWindowInteractor* anInteractor = vw->getRWInteractor(); anInteractor->SetSelectionProp(); anInteractor->SetSelectionTolerance(); - VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME(); + SVTK_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME(); if (aStyle) { aStyle->setPreselectionProp(); } @@ -516,50 +493,54 @@ static void UpdateVtkSelection(QAD_Desktop* parent) // function : GeometryGUI::SetSettings() // purpose : Called when GEOM module is activated [static] //================================================================================= -bool GeometryGUI::SetSettings(QAD_Desktop* parent) +bool GeometryGUI::SetSettings() { - GeometryGUI* geomGUI = GetGeomGUI(); - QMenuBar* Mb = parent->getMainMenuBar(); - QAD_Study* ActiveStudy = parent->getActiveStudy(); + QMenuBar* Mb = parent->getMainMenuBar(); + SUIT_Study* ActiveStudy = application()->activeStudy(); - - - /* Wireframe or Shading */ +// Wireframe or Shading int DisplayMode = 0; - bool ViewOCC = false; - if ( ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - DisplayMode = ic->DisplayMode(); - ViewOCC = true; + SUIT_ViewWindow* window = application()->desktop()->activeWindow(); + bool ViewOCC = ( window && window->getViewManager()->getType() == VIEW_OCC ); + bool ViewVTK = ( window && window->getViewManager()->getType() == VIEW_VTK ); + if ( ViewOCC ) { + OCCViewer_ViewManager* vm = dynamic_cast( window->getViewManager() ); + if ( vm ) { + Handle(AIS_InteractiveContext) ic = vm->getOCCViewer()->getAISContext(); + DisplayMode = ic->DisplayMode(); + } } - else if (ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - DisplayMode = myRenderInter->GetDisplayMode(); + else if ( ViewVTK ) { + VTKViewer_ViewWindow* vw = dynamic_cast( window ); + if ( vw ) { + VTKViewer_RenderWindowInteractor* myRenderInter = vw->getRWInteractor(); + DisplayMode = myRenderInter->GetDisplayMode(); + } } if( DisplayMode == 1 ) + getApp()-> Mb->changeItem( 211, tr( "GEOM_MEN_WIREFRAME" ) ); else Mb->changeItem( 211, tr( "GEOM_MEN_SHADING" ) ); - /* Add in Study - !!!ALWAYS TRUE!!! */ /////// VSR : TO BE REMOVED + // Add in Study - !!!ALWAYS TRUE!!! /////// VSR : TO BE REMOVED QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); int Settings_AddInStudy; - /*if(!AddInStudy.isEmpty()) - Settings_AddInStudy = AddInStudy.toInt(); - else - */ + // if(!AddInStudy.isEmpty()) + // Settings_AddInStudy = AddInStudy.toInt(); + // else + Settings_AddInStudy = 1; Mb->setItemChecked(411, Settings_AddInStudy); - /* step value */ + // step value QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); if(S.isEmpty()) QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100"); - /* isos */ + // isos int count = ActiveStudy->getStudyFramesCount(); for(int i = 0; i < count; i++) { if(ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC) { @@ -575,26 +556,13 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) } } - //Mb->setItemEnabled(404, ViewOCC); // SKETCHER - Mb->setItemEnabled(603, ViewOCC); // SuppressFace - Mb->setItemEnabled(604, ViewOCC); // SuppressHole - Mb->setItemEnabled(606, ViewOCC); // CloseContour - Mb->setItemEnabled(607, ViewOCC); // RemoveInternalWires - Mb->setItemEnabled(608, ViewOCC); // AddPointOnEdge -// Mb->setItemEnabled(609, ViewOCC); // Free boundaries - Mb->setItemEnabled(413, ViewOCC); // Isos Settings - - Mb->setItemEnabled( 800, ViewOCC ); // Create Group - Mb->setItemEnabled( 801, ViewOCC ); // Edit Group - - Mb->setItemEnabled(9998, ViewOCC); // MENU BLOCKS - MULTI-TRANSFORMATION + setActionsEnabled(); - // PAL5356: update VTK selection - ::UpdateVtkSelection(parent); + ::UpdateVtkSelection(); bool bOk = true; GUIMap::Iterator it; - for ( it = geomGUI->myGUIMap.begin(); it != geomGUI->myGUIMap.end(); ++it ) + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) bOk = bOk && it.data()->SetSettings( parent ); // MZN: Enable/disable "Clipping range" menu item(from GEOM_CLIPPING variable) @@ -607,27 +575,456 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) return bOk; } +*/ + +//======================================================================= +// function : createGeomAction +// purpose : +//======================================================================= +void GeometryGUI::createGeomAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle ) +{ + QIconSet icon; + QWidget* parent = application()->desktop(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QPixmap pix; + if ( icon_id.length() ) + pix = resMgr->loadPixmap( "GEOM", tr( icon_id ) ); + else + pix = resMgr->loadPixmap( "GEOM", tr( QString( "ICO_" )+po_id ) ); + if ( !pix.isNull() ) + icon = QIconSet( pix ); + + QString tooltip = tr( QString( "TOP_" )+po_id ), + menu = tr( QString( "MEN_" )+po_id ), + status_bar = tr( QString( "STB_" )+po_id ); + + createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) ); +} + + //======================================================================= // function : GeometryGUI::Deactivate() // purpose : Called when GEOM module is deactivated [ static ] //======================================================================= -void GeometryGUI::Deactivate() +void GeometryGUI::initialize( CAM_Application* app ) { - GeometryGUI* geomGUI = GetGeomGUI(); - GetGeomGUI()->EmitSignalCloseAllDialogs(); + SalomeApp_Module::initialize( app ); + + // ----- create actions -------------- + + createGeomAction( 111, "IMPORT", "", (CTRL + Key_I) ); + createGeomAction( 121, "EXPORT", "", (CTRL + Key_E) ); + + createGeomAction( 33, "DELETE" ); + + createGeomAction( 4011, "POINT" ); + createGeomAction( 4012, "LINE" ); + createGeomAction( 4013, "CIRCLE" ); + createGeomAction( 4014, "ELLIPSE" ); + createGeomAction( 4015, "ARC" ); + createGeomAction( 4019, "CURVE" ); + createGeomAction( 4016, "VECTOR" ); + createGeomAction( 4017, "PLANE" ); + createGeomAction( 4018, "WORK_PLANE" ); + createGeomAction( 4020, "LOCAL_CS" ); + + createGeomAction( 4021, "BOX" ); + createGeomAction( 4022, "CYLINDER" ); + createGeomAction( 4023, "SPHERE" ); + createGeomAction( 4024, "TORUS" ); + createGeomAction( 4025, "CONE" ); + + createGeomAction( 4031, "EXTRUSION" ); + createGeomAction( 4032, "REVOLUTION" ); + createGeomAction( 4033, "FILLING" ); + createGeomAction( 4034, "PIPE" ); + + createGeomAction( 800, "GROUP_CREATE" ); + createGeomAction( 801, "GROUP_EDIT" ); + + createGeomAction( 9997, "Q_FACE" ); + createGeomAction( 9999, "HEX_SOLID" ); + + createGeomAction( 404, "SKETCH" ); + createGeomAction( 407, "EXPLODE" ); + + createGeomAction( 4081, "EDGE" ); + createGeomAction( 4082, "WIRE" ); + createGeomAction( 4083, "FACE" ); + createGeomAction( 4084, "SHELL" ); + createGeomAction( 4085, "SOLID" ); + createGeomAction( 4086, "COMPOUND" ); + + createGeomAction( 5011, "FUSE" ); + createGeomAction( 5012, "COMMON" ); + createGeomAction( 5013, "CUT" ); + createGeomAction( 50114, "SECTION" ); + + createGeomAction( 5021, "TRANSLATION" ); + createGeomAction( 5022, "ROTATION" ); + createGeomAction( 5023, "MODIFY_LOCATION" ); + createGeomAction( 5024, "MIRROR" ); + createGeomAction( 5025, "SCALE" ); + createGeomAction( 5026, "OFFSET" ); + createGeomAction( 5027, "MUL_TRANSLATION" ); + createGeomAction( 5028, "MUL_ROTATION" ); + + createGeomAction( 503, "PARTITION" ); + createGeomAction( 504, "ARCHIMEDE" ); + createGeomAction( 505, "FILLET" ); + createGeomAction( 506, "CHAMFER" ); + createGeomAction( 507, "CLIPPING" ); + + createGeomAction( 9998, "MUL_TRANSFORM" ); + createGeomAction( 9995, "EXPLODE_BLOCKS" ); + createGeomAction( 99991, "PROPAGATE" ); + + createGeomAction( 601, "SEWING" ); + createGeomAction( 602, "GLUE_FACES" ); + createGeomAction( 603, "SUPPRESS_FACES" ); + createGeomAction( 604, "SUPPERSS_HOLES" ); + createGeomAction( 605, "SHAPE_PROCESS" ); + createGeomAction( 606, "CLOSE_CONTOUR" ); + createGeomAction( 607, "SUPPRESS_INT_WIRES" ); + createGeomAction( 608, "POINT_ON_EDGE" ); + createGeomAction( 609, "CHECK_FREE_BNDS" ); + createGeomAction( 610, "CHECK_FREE_FACES" ); + + createGeomAction( 708, "POINT_COORDS" ); + createGeomAction( 701, "BASIC_PROPS" ); + createGeomAction( 702, "MASS_CENTER" ); + createGeomAction( 703, "INERTIA" ); + createGeomAction( 7041, "BND_BOX" ); + createGeomAction( 7042, "MIN_DIST" ); + + createGeomAction( 705, "TOLERANCE" ); + createGeomAction( 706, "WHAT_IS" ); + createGeomAction( 707, "CHECK" ); + createGeomAction( 7072, "CHECK_COMPOUND" ); + + createGeomAction( 5103, "CHECK_GEOMETRY" ); + createGeomAction( 5104, "LOAD_SCRIPT" ); + + createGeomAction( 412, "SHADING_COLOR" ); + createGeomAction( 413, "ISOS" ); + createGeomAction( 414, "STEP_VALUE" ); + + createGeomAction( 211, "SHADING" ); + createGeomAction( 212, "DISPLAY_ALL" ); + createGeomAction( 214, "ERASE_ALL" ); + createGeomAction( 216, "DISPLAY" ); + createGeomAction( 213, "DISPLAY_ONLY" ); + createGeomAction( 215, "ERASE" ); + + createGeomAction( 901, "POP_RENAME" ); + createGeomAction( 80311, "POP_WIREFRAME", "", 0, true ); + createGeomAction( 80312, "POP_SHADING", "", 0, true ); + createGeomAction( 8032, "POP_COLOR" ); + createGeomAction( 8033, "POP_TRANSPARENCY" ); + createGeomAction( 8034, "POP_ISOS" ); + createGeomAction( 8001, "POP_CREATE_GROUP" ); + + // make wireframe-shading items to be exclusive (only one at a time is selected) + //QActionGroup* dispModeGr = new QActionGroup( this, "", true ); + //dispModeGr->add( action( 80311 ) ); + //dispModeGr->add( action( 80312 ) ); + // ---- create menu -------------------------- + + int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 ); + createMenu( separator(), fileId, 10 ); + createMenu( 111, fileId, 10 ); + createMenu( 121, fileId, 10 ); + createMenu( separator(), fileId, -1 ); + + int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 ); + createMenu( 33, editId, -1 ); + + int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 ); + + int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 ); + createMenu( 4011, basicId, -1 ); + createMenu( 4012, basicId, -1 ); + createMenu( 4013, basicId, -1 ); + createMenu( 4014, basicId, -1 ); + createMenu( 4015, basicId, -1 ); + createMenu( 4019, basicId, -1 ); + createMenu( separator(), basicId, -1 ); + createMenu( 4016, basicId, -1 ); + createMenu( 4017, basicId, -1 ); + createMenu( 4018, basicId, -1 ); + createMenu( 4020, basicId, -1 ); + + int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 ); + createMenu( 4021, primId, -1 ); + createMenu( 4022, primId, -1 ); + createMenu( 4023, primId, -1 ); + createMenu( 4024, primId, -1 ); + createMenu( 4025, primId, -1 ); + + int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 ); + createMenu( 4031, genId, -1 ); + createMenu( 4032, genId, -1 ); + createMenu( 4033, genId, -1 ); + createMenu( 4034, genId, -1 ); + createMenu( separator(), newEntId, -1 ); + + int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 ); + createMenu( 800, groupId, -1 ); + createMenu( 801, groupId, -1 ); + createMenu( separator(), newEntId, -1 ); + + int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 ); + createMenu( 9997, blocksId, -1 ); + createMenu( 9999, blocksId, -1 ); + + createMenu( separator(), newEntId, -1 ); + createMenu( 404, newEntId, -1 ); + createMenu( separator(), newEntId, -1 ); + createMenu( 407, newEntId, -1 ); + + int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 ); + createMenu( 4081, buildId, -1 ); + createMenu( 4082, buildId, -1 ); + createMenu( 4083, buildId, -1 ); + createMenu( 4084, buildId, -1 ); + createMenu( 4085, buildId, -1 ); + createMenu( 4086, buildId, -1 ); + + int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 ); + + int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 ); + createMenu( 5011, boolId, -1 ); + createMenu( 5012, boolId, -1 ); + createMenu( 5013, boolId, -1 ); + createMenu( 5014, boolId, -1 ); + + int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 ); + createMenu( 5021, transId, -1 ); + createMenu( 5022, transId, -1 ); + createMenu( 5023, transId, -1 ); + createMenu( 5024, transId, -1 ); + createMenu( 5025, transId, -1 ); + createMenu( 5026, transId, -1 ); + createMenu( separator(), transId, -1 ); + createMenu( 5027, transId, -1 ); + createMenu( 5028, transId, -1 ); + + createMenu( 503, operId, -1 ); + createMenu( 504, operId, -1 ); + createMenu( separator(), operId, -1 ); + createMenu( 505, transId, -1 ); + createMenu( 506, transId, -1 ); + createMenu( 507, transId, -1 ); + + int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 ); + createMenu( 9998, blockId, -1 ); + createMenu( 9995, blockId, -1 ); + createMenu( 99991, blockId, -1 ); + + int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 ); + createMenu( 605, repairId, -1 ); + createMenu( 603, repairId, -1 ); + createMenu( 606, repairId, -1 ); + createMenu( 607, repairId, -1 ); + createMenu( 604, repairId, -1 ); + createMenu( 601, repairId, -1 ); + createMenu( 602, repairId, -1 ); + createMenu( 608, repairId, -1 ); + createMenu( 609, repairId, -1 ); + createMenu( 610, repairId, -1 ); + + int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 ); + createMenu( 708, measurId, -1 ); + createMenu( 701, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( 702, measurId, -1 ); + createMenu( 703, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + + int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 ); + createMenu( 7041, dimId, -1 ); + createMenu( 7042, dimId, -1 ); + createMenu( separator(), measurId, -1 ); + + createMenu( 705, measurId, -1 ); + createMenu( separator(), measurId, -1 ); + createMenu( 706, measurId, -1 ); + createMenu( 707, measurId, -1 ); + createMenu( 7072, measurId, -1 ); + + int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 10 ); + createMenu( separator(), toolsId, -1 ); + createMenu( 5103, toolsId, -1 ); + createMenu( 5104, toolsId, -1 ); + + int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 10 ); + createMenu( separator(), prefId, -1 ); + + int geomId = createMenu( tr( "MEN_PREFERENCES_GEOM" ), prefId, -1 ); + createMenu( 412, geomId, -1 ); + createMenu( 413, geomId, -1 ); + createMenu( 414, geomId, -1 ); + createMenu( separator(), prefId, -1 ); + + int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 ); + createMenu( separator(), viewId, -1 ); + + int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 ); + createMenu( 211, dispmodeId, -1 ); + + createMenu( separator(), viewId, -1 ); + createMenu( 212, viewId, -1 ); + createMenu( 214, viewId, -1 ); + createMenu( separator(), viewId, -1 ); + createMenu( 216, viewId, -1 ); + createMenu( 213, viewId, -1 ); + createMenu( 215, viewId, -1 ); + + // ---- create toolbars -------------------------- + + int basicTbId = createTool( tr( "TOOL_BASIC" ) ); + createTool( 4011, basicTbId ); + createTool( 4012, basicTbId ); + createTool( 4013, basicTbId ); + createTool( 4014, basicTbId ); + createTool( 4015, basicTbId ); + createTool( 4019, basicTbId ); + createTool( 4016, basicTbId ); + createTool( 4017, basicTbId ); + createTool( 4018, basicTbId ); + createTool( 4020, basicTbId ); + + int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) ); + createTool( 4021, primTbId ); + createTool( 4022, primTbId ); + createTool( 4023, primTbId ); + createTool( 4024, primTbId ); + createTool( 4025, primTbId ); + + int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) ); + createTool( 5011, boolTbId ); + createTool( 5012, boolTbId ); + createTool( 5013, boolTbId ); + createTool( 5014, boolTbId ); + + int genTbId = createTool( tr( "TOOL_GENERATION" ) ); + createTool( 4031, genTbId ); + createTool( 4032, genTbId ); + createTool( 4033, genTbId ); + createTool( 4034, genTbId ); + + int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) ); + createTool( 5021, transTbId ); + createTool( 5022, transTbId ); + createTool( 5023, transTbId ); + createTool( 5024, transTbId ); + createTool( 5025, transTbId ); + createTool( 5026, transTbId ); + createTool( separator(), transTbId ); + createTool( 5027, transTbId ); + createTool( 5028, transTbId ); + + QtxPopupMgr* mgr = popupMgr(); + mgr->insert( action( 901 ), -1, -1 ); // rename + mgr->setRule( action( 901 ), "$type in {'Shape' 'Group'} and selcount=1", true ); + mgr->insert( action( 8001 ), -1, -1 ); // create group + mgr->setRule( action( 8001 ), "$client in {'ObjectBrowser'} and $type in {'Shape'} and selcount=1 and isOCC", true ); + mgr->insert( action( 801 ), -1, -1 ); // edit group + mgr->setRule( action( 801 ), "$client in {'ObjectBrowser'} and $type in {'Group'} and selcount=1 and isOCC", true ); + mgr->insert( separator(), -1, -1 ); // ----------- + mgr->insert( action( 216 ), -1, -1 ); // display + mgr->setRule( action( 216 ), "$client in {'ObjectBrowser'} and selcount>0 and (($type in {'Shape' 'Group'} and ($isVisible in {false})) or $type in {'Component'})", true ); + mgr->insert( action( 215 ), -1, -1 ); // erase + mgr->setRule( action( 215 ), "$client in {'ObjectBrowser'} and ((($type in {'Shape' 'Group'}) and ($isVisible in {true})) or ($type in {'Component'} and selcount=1))", true ); + mgr->insert( action( 213 ), -1, -1 ); // display only + mgr->setRule( action( 213 ), "$client in {'ObjectBrowser'} and ($type in {'Shape' 'Group'} or ($type in {'Component'} and selcount=1))", true ); + mgr->insert( separator(), -1, -1 ); + dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu + mgr->insert( action( 80311 ), dispmodeId, -1 ); // wireframe + mgr->setRule( action( 80311 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true ); + mgr->setRule( action( 80311 ), "$displaymode in {'Wireframe'}", false ); + mgr->insert( action( 80312 ), dispmodeId, -1 ); // shading + mgr->setRule( action( 80312 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true ); + mgr->setRule( action( 80312 ), "$displaymode in {'Shading'}", false ); + mgr->insert( action( 8032 ), -1, -1 ); // color + mgr->setRule( action( 8032 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true ); + mgr->insert( action( 8033 ), -1, -1 ); // transparency + mgr->setRule( action( 8033 ), "$client in {'OCCViewer' 'VTKViewer'} and selcount>0", true ); + mgr->insert( action( 8034 ), -1, -1 ); // isos + mgr->setRule( action( 8034 ), "$client in {'OCCViewer'} and selcount>0", true ); + mgr->insert( separator(), -1, -1 ); // ----------- +} + +//======================================================================= +// function : GeometryGUI::Deactivate() +// purpose : Called when GEOM module is deactivated [ static ] +//======================================================================= +void GeometryGUI::activateModule( SUIT_Study* study ) +{ + SalomeApp_Module::activateModule( study ); + + setMenuShown( true ); + setToolShown( true ); + + connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + connect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), + this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) ); + GUIMap::Iterator it; - for ( it = geomGUI->myGUIMap.begin(); it != geomGUI->myGUIMap.end(); ++it ) - it.data()->Deactivate(); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + it.data()->activate( application()->desktop() ); + + SalomeApp_SelectionMgr* sm = getApp()->selectionMgr(); + SUIT_ViewManager* vm; + ViewManagerList OCCViewManagers, VTKViewManagers; + application()->viewManagers( OCCViewer_Viewer::Type(), OCCViewManagers ); + for ( vm = OCCViewManagers.first(); vm; vm = OCCViewManagers.next() ) + myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); + application()->viewManagers( VTKViewer_Viewer::Type(), VTKViewManagers ); + for ( vm = VTKViewManagers.first(); vm; vm = VTKViewManagers.next() ) + myVTKSelectors.append( new SalomeApp_VTKSelector( (SVTK_Viewer*)vm->getViewModel(), sm ) ); + + // SetSettings() ????????????? +} + + +//======================================================================= +// function : GeometryGUI::Deactivate() +// purpose : Called when GEOM module is deactivated [ static ] +//======================================================================= +void GeometryGUI::deactivateModule( SUIT_Study* study ) +{ + setMenuShown( false ); + setToolShown( false ); + + disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) ); + disconnect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), + this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) ); + + EmitSignalCloseAllDialogs(); + + GUIMap::Iterator it; + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) + it.data()->deactivate(); + + myOCCSelectors.clear(); + getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() ); + + myVTKSelectors.clear(); + + SalomeApp_Module::deactivateModule( study ); } //================================================================================= // function : GeometryGUI::DefinePopup() // purpose : Called from desktop to define popup menu [static] //================================================================================= +/* void GeometryGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) { - GeometryGUI* geomGUI = GetGeomGUI(); QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection()); @@ -698,7 +1095,7 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr if( nbSel == 0 ) { ////// NOTHING SELECTED popup->clear(); - } + } else if ( nbSel == 1 ) { ////// SINGLE OBJECT SELECTION if ( parentComponent != parent->getActiveComponent() ) { @@ -921,68 +1318,107 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr return false; } -//================================================================================= -// function : GeometryGUI::ActiveStudyChanged() -// purpose : static -//================================================================================= -bool GeometryGUI::ActiveStudyChanged(QAD_Desktop* parent) +*/ + +//======================================================================= +// function : GeometryGUI::BuildPresentation() +// purpose : +//======================================================================= +void GeometryGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& io, SUIT_ViewWindow* win ) { - GeometryGUI* geomGUI = GetGeomGUI(); - QAD_Study* ActiveStudy = parent->getActiveStudy(); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - int DisplayMode = 0; - bool ViewOCC = false; + //GEOM_Displayer().Display( io, false, win ); +} - if( ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - DisplayMode = ic->DisplayMode(); - ViewOCC = true; - } - else if( ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - DisplayMode = myRenderInter->GetDisplayMode(); - } +//======================================================================= +// function : setCommandsEnabled() +// purpose : update menu items' status - disable non-OCC-viewer-compatible actions +//======================================================================= +void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) +{ + if ( !win ) + return; - if( DisplayMode == 1 ) - Mb->changeItem( 211, tr( "GEOM_MEN_WIREFRAME" ) ); - else - Mb->changeItem( 211, tr( "GEOM_MEN_SHADING" ) ); + const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() ); +// const bool ViewVTK = ( win->getViewManager()->getType() == VTKViewer_Viewer::Type() ); - //Mb->setItemEnabled( 404, ViewOCC ); // SKETCHER - Mb->setItemEnabled( 603, ViewOCC ); // SuppressFace - Mb->setItemEnabled( 604, ViewOCC ); // SuppressHole - Mb->setItemEnabled( 606, ViewOCC ); // CloseContour - Mb->setItemEnabled( 413, ViewOCC ); // Isos Settings - Mb->setItemEnabled( 800, ViewOCC ); // Create Group - Mb->setItemEnabled( 801, ViewOCC ); // Edit Group - Mb->setItemEnabled(9998, ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION + // disable OCC selectors + getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() ) + sr->setEnabled(true); + + // disable non-OCC viewframe menu commands +// action( 404 )->setEnabled( ViewOCC ); // SKETCHER + action( 603 )->setEnabled( ViewOCC ); // SuppressFace + action( 604 )->setEnabled( ViewOCC ); // SuppressHole + action( 606 )->setEnabled( ViewOCC ); // CloseContour + action( 607 )->setEnabled( ViewOCC ); // RemoveInternalWires + action( 608 )->setEnabled( ViewOCC ); // AddPointOnEdge +// action( 609 )->setEnabled( ViewOCC ); // Free boundaries + action( 413 )->setEnabled( ViewOCC ); // Isos Settings + + action( 800 )->setEnabled( ViewOCC ); // Create Group + action( 801 )->setEnabled( ViewOCC ); // Edit Group + + action( 9998 )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION +} - geomGUI->EmitSignalCloseAllDialogs(); +void GeometryGUI::windows( QMap& mappa ) const +{ + mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft ); + mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom ); +} - // PAL5356: update VTK selection - ::UpdateVtkSelection( parent ); +void GeometryGUI::viewManagers( QStringList& lst ) const +{ + lst.append( OCCViewer_Viewer::Type() ); +} - bool bOk = true; - GUIMap::Iterator it; - for ( it = geomGUI->myGUIMap.begin(); it != geomGUI->myGUIMap.end(); ++it ) - bOk = bOk && it.data()->ActiveStudyChanged( parent ); - return bOk; +void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) +{ + if ( vm->getType() == OCCViewer_Viewer::Type() ) + { + SalomeApp_SelectionMgr* sm = getApp()->selectionMgr(); + myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); + } + else if ( vm->getType() == VTKViewer_Viewer::Type() ) + { + SalomeApp_SelectionMgr* sm = getApp()->selectionMgr(); + myVTKSelectors.append( new SalomeApp_VTKSelector( (SVTK_Viewer*)vm->getViewModel(), sm ) ); + } } -//======================================================================= -// function : GeometryGUI::BuildPresentation() -// purpose : static -//======================================================================= -void GeometryGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& theIO, - QAD_ViewFrame* theViewFrame ) +void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm ) +{ + SUIT_ViewModel* viewer = vm->getViewModel(); + if ( vm->getType() == OCCViewer_Viewer::Type() ) + { + for ( GEOMGUI_OCCSelector* sr = myOCCSelectors.first(); sr; sr = myOCCSelectors.next() ) + if ( sr->viewer() == viewer ) + { + myOCCSelectors.remove( sr ); + break; + } + } + if ( vm->getType() == VTKViewer_Viewer::Type() ) + { + for ( SalomeApp_VTKSelector* sr = myVTKSelectors.first(); sr; sr = myVTKSelectors.next() ) + if ( sr->viewer() == viewer ) + { + myVTKSelectors.remove( sr ); + break; + } + } +} + +QString GeometryGUI::engineIOR() const { - GEOM_Displayer().Display( theIO, false, theViewFrame ); + if ( !CORBA::is_nil( GetGeomGen() ) ) + return QString( getApp()->orb()->object_to_string( GetGeomGen() ) ); + return QString( "" ); } -void GeometryGUI::SupportedViewType(int* buffer, int bufferSize) +SalomeApp_Selection* GeometryGUI::createSelection() const { - if(!buffer || !bufferSize) return; - buffer[0] = (int)VIEW_OCC; - if (--bufferSize) buffer[1] = (int)VIEW_VTK; + return new GEOMGUI_Selection(); } + diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 255c46f12..968f7798c 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -29,7 +29,7 @@ #ifndef GEOMETRYGUI_H #define GEOMETRYGUI_H -#include "SALOMEGUI.h" +#include "SalomeApp_Module.h" #include "GEOMGUI.h" #include "GEOM_Client.hxx" @@ -42,35 +42,35 @@ typedef QMap GUIMap; class QDialog; class QPopupMenu; +class GEOMGUI_OCCSelector; +class SalomeApp_VTKSelector; +class SUIT_ViewManager; + //================================================================================= // class : GeometryGUI // purpose : //================================================================================= -class GeometryGUI : public SALOMEGUI +class GeometryGUI : public SalomeApp_Module { Q_OBJECT; -protected: +public: // Constructor - GeometryGUI(); // hide constructor to avoid direct creation - // get or load GUI library by name - GEOMGUI* getLibrary( const QString& libraryName ); + GeometryGUI(); -public: // Destructor ~GeometryGUI(); - // Get the only GeometryGUI object - static GeometryGUI* GetGeomGUI(); - - static CORBA::ORB_var GetORB(); + virtual void initialize( CAM_Application* ); + virtual QString engineIOR() const; - GEOM::GEOM_Gen_ptr GetGeomGen() { return myComponentGeom; } + static GEOM::GEOM_Gen_var GetGeomGen() { return myComponentGeom; } + GEOM_Client& GetShapeReader() { return myShapeReader; } Standard_CString& GetFatherior() { return myFatherior; } - void SetState( const int state ) { myState = state; } - int GetState() const { return myState; } + //void SetState( const int state ) { myState = state; } + //int GetState() const { return myState; } // Get active dialog box QDialog* GetActiveDialogBox(){ return myActiveDialogBox; } @@ -82,41 +82,67 @@ public: void EmitSignalCloseAllDialogs(); void EmitSignalDefaultStepValueChanged( double newVal ); - // The following methods are called from IAPP - virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - virtual bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - virtual bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - virtual bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - virtual bool SetSettings(QAD_Desktop* parent); - virtual bool ActiveStudyChanged(QAD_Desktop* parent); - virtual void Deactivate(); - virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, - QAD_ViewFrame* = 0 ); - virtual void SupportedViewType (int* buffer, int bufferSize); - virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject); - virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, - const QString& theParent, const QString& theObject); + void OnGUIEvent( int id ); + + virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* ); + virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* ); + virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* ); + +// virtual bool SetSettings(); +// virtual void SupportedViewType ( int* buffer, int bufferSize ); + virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 ); + +// virtual void DefinePopup( QString & theContext, QString & theParent, QString & theObject); +// virtual bool CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, +// const QString& theParent, const QString& theObject ); // The Working Plane management - void SetWorkingPlane(gp_Ax3 WorkingPlane) { myWorkingPlane = WorkingPlane; }; - gp_Ax3 GetWorkingPlane() { return myWorkingPlane; }; - void ActiveWorkingPlane(); + void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; } + gp_Ax3 GetWorkingPlane() { return myWorkingPlane; } + void ActiveWorkingPlane(); + + virtual void windows( QMap& ) const; + virtual void viewManagers( QStringList& ) const; + + +public slots: + virtual void deactivateModule( SUIT_Study* ); + virtual void activateModule( SUIT_Study* ); + +private slots: + void OnGUIEvent(); + void onViewManagerAdded( SUIT_ViewManager* ); + void onViewManagerRemoved( SUIT_ViewManager* ); + void onWindowActivated( SUIT_ViewWindow* ); signals : - void SignalDeactivateActiveDialog(); - void SignalCloseAllDialogs(); - void SignalDefaultStepValueChanged( double newVal ); + void SignalDeactivateActiveDialog(); + void SignalCloseAllDialogs(); + void SignalDefaultStepValueChanged( double newVal ); + +protected: + virtual SalomeApp_Selection* createSelection() const; + +private: + GEOMGUI* getLibrary( const QString& libraryName ); + void createGeomAction( const int id, const QString& po_id, const QString& icon_id = QString(""), const int key = 0, const bool toggle = false ); + void createPopupItem( const int, const QString& clients, const QString& types, + const bool isSingle = false, const int isVisible = -1, + const bool isExpandAll = false, const bool isOCC = false, const int parentId = -1 ); private: - static GeometryGUI* myContext; // the only GeometryGUI object - - GUIMap myGUIMap; // GUI libraries map - QDialog* myActiveDialogBox; // active dialog box - GEOM_Client myShapeReader; // geom shape reader - Standard_CString myFatherior; - GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine - int myState; // identify a method - gp_Ax3 myWorkingPlane; + static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine + + GUIMap myGUIMap; // GUI libraries map + QDialog* myActiveDialogBox; // active dialog box + GEOM_Client myShapeReader; // geom shape reader + Standard_CString myFatherior; + int myState; // identify a method + gp_Ax3 myWorkingPlane; + QMap myRules; // popup rules + + QPtrList myOCCSelectors; + QPtrList myVTKSelectors; }; #endif diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index 662231158..975cc9cd4 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -29,35 +29,6 @@ #include "GeometryGUI_Swig.hxx" #include "SALOMEGUI_Swig.hxx" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Study.h" -#include "QAD_StudyFrame.h" -#include "QAD_RightFrame.h" -#include "SALOMEGUI_ImportOperation.h" - -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "SALOME_Event.hxx" - -#include "VTKViewer_RenderWindowInteractor.h" -#include "VTKViewer_ViewFrame.h" #include "GEOM_Actor.h" #include "GEOM_Client.hxx" @@ -72,11 +43,6 @@ using namespace std; static GEOM_Client ShapeReader; -template inline TViewFrame* GetFrame(QAD_Study* theStudy){ - return dynamic_cast(SALOME::GetViewFrame(theStudy)); -} - - GEOM_Swig::GEOM_Swig() { // MESSAGE("Constructeur"); @@ -90,339 +56,36 @@ GEOM_Swig::~GEOM_Swig() void GEOM_Swig::createAndDisplayGO(const char* Entry) { // MESSAGE("createAndDisplayGO"); - QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - CORBA::String_var aFatherIOR; - SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - aStudyBuilder->DefineComponentInstance( father, Geom ); - father->ComponentIOR(aFatherIOR); - - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(ActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::SObject_var obj = aStudy->FindObjectID(Entry); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - // Create new actor - if ( !obj->FindAttribute(anAttr, "AttributeIOR")) - return; - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - CORBA::String_var anIORValue = anIOR->Value(); - - GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue); - TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape); - - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeName")) { - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - CORBA::String_var aNameValue = aName->Value(); - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( ActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - - Handle(GEOM_InteractiveObject) anIO = new GEOM_InteractiveObject(const_cast(anIORValue.in()), - const_cast(aFatherIOR.in()), - "GEOM", - const_cast(obj->GetID())); - - class TEvent: public SALOME_Event{ - QAD_Study* myStudy; - TopoDS_Shape myShape; - Handle(SALOME_InteractiveObject) myIO; - const char* myName; - public: - TEvent(QAD_Study* theStudy, TopoDS_Shape theShape, - const Handle(SALOME_InteractiveObject)& theIO, - const char* theName): - myStudy(theStudy), myShape(theShape), - myIO(theIO), myName(theName) - {} - virtual void Execute(){ - if(VTKViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - VTKViewer_RenderWindowInteractor* myRenderInter= aViewFrame->getRWInteractor(); - int aMode = myRenderInter->GetDisplayMode(); - - vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(myShape,0,aMode,true); - theActors->InitTraversal(); - while(vtkActor* anActor = theActors->GetNextActor()){ - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); - GActor->setName(const_cast(myName)); - GActor->setIO(myIO); - myRenderInter->Display(GActor); - } - myRenderInter->Update(); - }else if(OCCViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - Handle(AIS_InteractiveContext) ic = aViewFrame->getViewer()->getAISContext(); - Handle(GEOM_AISShape) aSh = new GEOM_AISShape(myShape,const_cast(myName)); - aSh->setName(const_cast(myName)); - aSh->setIO(myIO); - ic->Display(aSh); - ic->AddOrRemoveCurrentObject(aSh,true); - } - myStudy->updateObjBrowser(true); - } - }; - ProcessVoidEvent(new TEvent(ActiveStudy,Shape,anIO,aNameValue.in())); - } - } } int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR) { - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - GEOM::GEOM_Object_var aMainShape = Geom->GetIORFromString(IOR); - TopoDS_Shape shape = ShapeReader.GetShape(Geom, aMainShape); - GEOM::GEOM_Object_var aSubShape = Geom->GetIORFromString(SubIOR); - TopoDS_Shape subshape = ShapeReader.GetShape(Geom, aSubShape); - - int index = 1; - if(subshape.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator it; - TopTools_ListOfShape CL; - CL.Append(shape); - TopTools_ListIteratorOfListOfShape itC; - for(itC.Initialize(CL); itC.More(); itC.Next()) { - for(it.Initialize(itC.Value()); it.More(); it.Next()) { - if (it.Value().ShapeType() == TopAbs_COMPOUND) { - if (it.Value().IsSame(subshape)) - return index; - else - index++; - CL.Append(it.Value()); - } - } - } - } - else { - TopExp_Explorer Exp(shape, subshape.ShapeType()); - TopTools_MapOfShape M; - while(Exp.More()) { - if(M.Add(Exp.Current())) { - if(Exp.Current().IsSame(subshape)) - return index; - index++; - } - Exp.Next(); - } - } return -1; } const char* GEOM_Swig::getShapeTypeString(const char* IOR) { - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR); - TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape); - - if( shape.IsNull() ) { - return "Null Shape" ; - } - switch (shape.ShapeType() ) - { - case TopAbs_COMPOUND: - { return "Compound" ;} - case TopAbs_COMPSOLID: - { return "Compound Solid" ;} - case TopAbs_SOLID: - { return "Solid" ;} - case TopAbs_SHELL: - { return "Shell" ;} - case TopAbs_FACE: - { - BRepAdaptor_Surface surf(TopoDS::Face(shape)); - if ( surf.GetType() == GeomAbs_Plane ) { - return "Plane" ; - } else if ( surf.GetType() == GeomAbs_Cylinder ) { - return "Cylindrical Face" ; - } else if ( surf.GetType() == GeomAbs_Sphere ) { - return "Spherical Face" ; - } else if ( surf.GetType() == GeomAbs_Torus ) { - return "Toroidal Face" ; - } else if ( surf.GetType() == GeomAbs_Cone ) { - return "Conical Face" ; - } else { - return "GEOM::FACE" ; - } - } - case TopAbs_WIRE: - { return "Wire" ;} - case TopAbs_EDGE: - { - BRepAdaptor_Curve curv(TopoDS::Edge(shape)); - if ( curv.GetType() == GeomAbs_Line ) { - if ( (Abs(curv.FirstParameter()) >= 1E6 ) || - (Abs(curv.LastParameter()) >= 1E6 )) { - return "Line" ; - } else - return "Edge" ; - } else if ( curv.GetType() == GeomAbs_Circle ) { - if ( curv.IsClosed() ) - return "Circle" ; - else - return "Arc" ; - } else { - return "Edge" ; - } - } - case TopAbs_VERTEX: - { return "Vertex" ;} - case TopAbs_SHAPE: - { return "Shape" ;} - } return 0; } const char* GEOM_Swig::getShapeTypeIcon(const char* IOR) { - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - GEOM::GEOM_Gen_var Geom = GEOM::GEOM_Gen::_narrow(comp); - - GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR); - TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape); - - if( shape.IsNull() ) { - return "None" ; - } - - switch (shape.ShapeType() ) - { - case TopAbs_COMPOUND: - { return "ICON_OBJBROWSER_COMPOUND" ;} - case TopAbs_COMPSOLID: - { return "ICON_OBJBROWSER_COMPSOLID" ;} - case TopAbs_SOLID: - { return "ICON_OBJBROWSER_SOLID" ;} - case TopAbs_SHELL: - { return "ICON_OBJBROWSER_SHELL" ;} - case TopAbs_FACE: - { return "ICON_OBJBROWSER_FACE" ;} - case TopAbs_WIRE: - { return "ICON_OBJBROWSER_WIRE" ;} - case TopAbs_EDGE: - { return "ICON_OBJBROWSER_EDGE" ;} - case TopAbs_VERTEX: - { return "ICON_OBJBROWSER_VERTEX" ;} - } return "None"; } void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode) { - QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy(); - Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(aStudy,theEntry); - - class TEvent: public SALOME_Event{ - QAD_Study* myStudy; - Handle(SALOME_InteractiveObject) myIO; - int myParam; - public: - TEvent(QAD_Study* theStudy, const Handle(SALOME_InteractiveObject)& theIO, int theParam): - myStudy(theStudy), myIO(theIO), myParam(theParam) - {} - virtual void Execute(){ - if(VTKViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - VTKViewer_RenderWindowInteractor* myRenderInter= aViewFrame->getRWInteractor(); - myRenderInter->SetDisplayMode(myIO,myParam); - myRenderInter->Update(); - }else if(OCCViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - OCCViewer_Viewer3d* v3d = aViewFrame->getViewer(); - v3d->SwitchRepresentation(myIO,myParam); - } - } - }; - - ProcessVoidEvent(new TEvent(aStudy,anIO,theMode)); } void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue) { - QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy(); - Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(aStudy,theEntry); - QColor aColor(red,green,blue); - - class TEvent: public SALOME_Event{ - QAD_Study* myStudy; - Handle(SALOME_InteractiveObject) myIO; - QColor myParam; - public: - TEvent(QAD_Study* theStudy, const Handle(SALOME_InteractiveObject)& theIO, const QColor& theParam): - myStudy(theStudy), myIO(theIO), myParam(theParam) - {} - virtual void Execute(){ - if(VTKViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - VTKViewer_RenderWindowInteractor* myRenderInter= aViewFrame->getRWInteractor(); - myRenderInter->SetColor(myIO,myParam); - myRenderInter->Update(); - }else if(OCCViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - OCCViewer_Viewer3d* v3d = aViewFrame->getViewer(); - Handle(AIS_InteractiveContext) ic = aViewFrame->getViewer()->getAISContext(); - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListIteratorOfListOfInteractive ite(List); - for ( ; ite.More(); ite.Next() ) { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( myIO ) ) { - Quantity_Color CSFColor = Quantity_Color ( myParam.red() / 255., - myParam.green() / 255., - myParam.blue() / 255., - Quantity_TOC_RGB ); - ite.Value()->SetColor( CSFColor ); - if ( ite.Value()->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) - Handle(GEOM_AISShape)::DownCast( ite.Value() )->SetShadingColor( CSFColor ); - ite.Value()->Redisplay( Standard_True ); - v3d->getViewer3d()->Update(); - break; - } - } - } - } - }; - - ProcessVoidEvent(new TEvent(aStudy,anIO,aColor)); } void GEOM_Swig::setTransparency(const char* theEntry, float transp) { - QAD_Study* aStudy = QAD_Application::getDesktop()->getActiveStudy(); - Handle(SALOME_InteractiveObject) anIO = SALOME::FindIObject(aStudy,theEntry); - - class TEvent: public SALOME_Event{ - QAD_Study* myStudy; - Handle(SALOME_InteractiveObject) myIO; - float myParam; - public: - TEvent(QAD_Study* theStudy, const Handle(SALOME_InteractiveObject)& theIO, float theParam): - myStudy(theStudy), myIO(theIO), myParam(theParam) - {} - virtual void Execute(){ - if(VTKViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - VTKViewer_RenderWindowInteractor* myRenderInter= aViewFrame->getRWInteractor(); - myRenderInter->SetTransparency(myIO,myParam); - myRenderInter->Update(); - }else if(OCCViewer_ViewFrame* aViewFrame = GetFrame(myStudy)){ - OCCViewer_Viewer3d* v3d = aViewFrame->getViewer(); - v3d->SetTransparency(myIO,myParam); - } - } - }; - - ProcessVoidEvent(new TEvent(aStudy,anIO,transp)); } diff --git a/src/GEOMGUI/Makefile.in b/src/GEOMGUI/Makefile.in index bd17ccd48..6a3fb5ed6 100644 --- a/src/GEOMGUI/Makefile.in +++ b/src/GEOMGUI/Makefile.in @@ -36,39 +36,43 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # ressources files PO_FILES = \ - GEOM_icons.po \ + GEOM_images.po \ GEOM_msg_en.po \ GEOM_msg_fr.po # header files EXPORT_HEADERS= GeometryGUI.h \ GEOMGUI.h \ + GEOM_Displayer.h \ + GEOMGUI_OCCSelector.h \ + GEOMGUI_Selection.h \ GeometryGUI_Swig.hxx \ - GeometryGUI_Swig.i \ - GEOM_Displayer.h + GeometryGUI_Swig.i # Libraries targets -LIB = libGEOMGUI.la +LIB = libGEOM.la LIB_SRC = GeometryGUI.cxx \ - GeometryGUI_Swig.cxx \ - GEOM_Displayer.cxx \ - GEOMGUI.cxx + GEOMGUI.cxx \ + GEOM_Displayer.cxx \ + GEOMGUI_OCCSelector.cxx \ + GEOMGUI_Selection.cxx \ + GeometryGUI_Swig.cxx -LIB_MOC = \ - GeometryGUI.h \ +LIB_MOC = GeometryGUI.h \ LIB_CLIENT_IDL = SALOME_Exception.idl \ SALOMEDS.idl \ SALOMEDS_Attributes.idl \ - SALOME_GenericObj.idl + SALOME_GenericObj.idl \ + SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(GUI_ROOT_DIR)/include/salome +CXXFLAGS += $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(GUI_ROOT_DIR)/include/salome -LDFLAGS += -L$(KERNEL_ROOT_DIR)/lib/salome -lOCCViewer -lVTKViewer -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection +LDFLAGS += -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome -lOCCViewer -lVTKViewer -lSalomeApp -lCAM -lGEOMClient -lSOCC -lSVTK -lGEOMObject -lToolsGUI @CONCLUDE@ diff --git a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx index 71987a990..1e73a5d33 100644 --- a/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx +++ b/src/GEOMImpl/GEOMImpl_Block6Explorer.cxx @@ -1181,10 +1181,10 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire, Standard_Real aTol = MF.G0Error(); TColgp_Array1OfPnt aPnts (1,nbEdges); // points of the given wire - aWE = BRepTools_WireExplorer(theWire); + BRepTools_WireExplorer aWE1 (theWire); Standard_Integer vi = 1; - for (; aWE.More() && vi <= nbEdges; aWE.Next(), vi++) { - aPnts(vi) = BRep_Tool::Pnt(TopoDS::Vertex(aWE.CurrentVertex())); + for (; aWE1.More() && vi <= nbEdges; aWE1.Next(), vi++) { + aPnts(vi) = BRep_Tool::Pnt(TopoDS::Vertex(aWE1.CurrentVertex())); } // Find maximum deviation in vertices diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index cad20102e..65cdc29b2 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -201,17 +201,18 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const } // build wire in right order, corresponding to edges connexity - BRepBuilderAPI_MakeWire MW; + BRepBuilderAPI_MakeWire* MW; if (isConnected12) - MW = BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3, anEdge4); + MW = new BRepBuilderAPI_MakeWire(anEdge1, anEdge2, anEdge3, anEdge4); else - MW = BRepBuilderAPI_MakeWire(anEdge1, anEdge3, anEdge2, anEdge4); + MW = new BRepBuilderAPI_MakeWire(anEdge1, anEdge3, anEdge2, anEdge4); - if (!MW.IsDone()) { + if (!MW->IsDone()) { Standard_ConstructionError::Raise ("Impossible to build a connected wire from the given edges"); } - TopoDS_Wire aWire = MW; + TopoDS_Wire aWire = *MW; + delete MW; if (!aWire.Closed()) { Standard_ConstructionError::Raise ("Impossible to build a closed wire from the given edges"); diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 56eb0762b..eb733fdb4 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -12,6 +12,8 @@ using namespace std; #include #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + #include "GEOMImpl_Types.hxx" #include "GEOMImpl_BoxDriver.hxx" @@ -99,15 +101,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxDXDYDZ (double theDX, dou } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aBox->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeBoxDXDYDZ("; - aDescr += (TCollection_AsciiString(theDX)+", "); - aDescr += (TCollection_AsciiString(theDY)+", "); - aDescr += (TCollection_AsciiString(theDZ)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxDXDYDZ(" + << theDX << ", " << theDY << ", " << theDZ << ")"; SetErrorCode(OK); return aBox; @@ -160,16 +155,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeBoxTwoPnt (Handle(GEOM_Objec } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aBox->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeBoxTwoPnt("; - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aBox << " = geompy.MakeBoxTwoPnt(" + << thePnt1 << ", " << thePnt2 << ")"; SetErrorCode(OK); return aBox; @@ -214,14 +201,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aCylinder->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeCylinderRH("; - aDescr += (TCollection_AsciiString(theR)+", "); - aDescr += (TCollection_AsciiString(theH)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCylinder + << " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")"; SetErrorCode(OK); return aCylinder; @@ -278,18 +259,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aCylinder->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeCylinderPntVecRH("; - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+", "); - aDescr += (TCollection_AsciiString(theH)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder(" + << thePnt << ", " << theVec << ", " << theR << ", " << theH << ")"; SetErrorCode(OK); return aCylinder; @@ -337,15 +308,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConeR1R2H (double theR1, dou } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aCone->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeConeR1R2H("; - aDescr += (TCollection_AsciiString(theR1)+", "); - aDescr += (TCollection_AsciiString(theR2)+", "); - aDescr += (TCollection_AsciiString(theH)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeConeR1R2H(" + << theR1 << ", " << theR2 << ", " << theH << ")"; SetErrorCode(OK); return aCone; @@ -404,19 +368,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeConePntVecR1R2H (Handle(GEOM } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aCone->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeConePntVecR1R2H("; - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR1)+", "); - aDescr += (TCollection_AsciiString(theR2)+", "); - aDescr += (TCollection_AsciiString(theH)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCone << " = geompy.MakeCone(" << thePnt + << ", " << theVec << ", " << theR1 << ", " << theR2 << ", " << theH << ")"; SetErrorCode(OK); return aCone; @@ -460,13 +413,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSphereR (double theR) } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aSphere->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeSphereR("; - aDescr += (TCollection_AsciiString(theR)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aSphere << " = geompy.MakeSphereR(" << theR << ")"; SetErrorCode(OK); return aSphere; @@ -518,15 +465,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSpherePntR (Handle(GEOM_Obje } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aSphere->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeSpherePntR("; - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aSphere + << " = geompy.MakeSpherePntR(" << thePnt << ", " << theR << ")"; SetErrorCode(OK); return aSphere; @@ -573,14 +513,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusRR } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(anEll->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeTorusRR("; - aDescr += (TCollection_AsciiString(theRMajor)+", "); - aDescr += (TCollection_AsciiString(theRMinor)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorusRR(" + << theRMajor << ", " << theRMinor << ")"; SetErrorCode(OK); return anEll; @@ -636,18 +570,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(anEll->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeTorusPntVecRR("; - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theRMajor)+", "); - aDescr += (TCollection_AsciiString(theRMinor)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeTorus(" << thePnt + << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; SetErrorCode(OK); return anEll; @@ -703,17 +627,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aPrism->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakePrismVecH("; - TDF_Tool::Entry(theBase->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theH)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH(" + << theBase << ", " << theVec << ", " << theH << ")"; SetErrorCode(OK); return aPrism; @@ -769,18 +684,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aPrism->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakePrismVecH("; - TDF_Tool::Entry(theBase->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism(" + << theBase << ", " << thePoint1 << ", " << thePoint2 << ")"; SetErrorCode(OK); return aPrism; @@ -834,15 +739,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipe (Handle(GEOM_Object) th } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPipe->GetEntry(), anEntry); - aDescr += (anEntry + " = I3DPrimOperations.MakePipe("); - TDF_Tool::Entry(theBase->GetEntry(), anEntry); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(thePath->GetEntry(), anEntry); - aDescr += (anEntry + ")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPipe << " = geompy.MakePipe(" + << theBase << ", " << thePath << ")"; SetErrorCode(OK); return aPipe; @@ -898,17 +796,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle( } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aRevolution->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeRevolutionAxisAngle("; - TDF_Tool::Entry(theBase->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theAngle)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution(" + << theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; SetErrorCode(OK); return aRevolution; @@ -959,14 +848,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Obje } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aSolid->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = I3DPrimOperations.MakeSolidShell("; - TDF_Tool::Entry(theShell->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aSolid << " = geompy.MakeSolid(" << theShell << ")"; SetErrorCode(OK); return aSolid; @@ -977,7 +859,9 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeSolidShell (Handle(GEOM_Obje * MakeFilling */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, double theTol2D, double theTol3D, int theNbIter) +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling + (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, + double theTol2D, double theTol3D, int theNbIter) { SetErrorCode(KO); @@ -1020,19 +904,9 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aFilling->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeFilling("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theMinDeg)+", "); - aDescr += (TCollection_AsciiString(theMaxDeg)+", "); - aDescr += (TCollection_AsciiString(theTol2D)+", "); - aDescr += (TCollection_AsciiString(theTol3D)+", "); - aDescr += (TCollection_AsciiString(theNbIter)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aFilling << " = geompy.MakeFilling(" + << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " + << theTol2D << ", " << theTol3D << ", " << theNbIter << ")"; SetErrorCode(OK); return aFilling; diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx index a0225ef9c..3178373b5 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -12,6 +12,7 @@ using namespace std; #include #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" #include "GEOMImpl_PointDriver.hxx" #include "GEOMImpl_VectorDriver.hxx" @@ -92,14 +93,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPoint->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePointXYZ("); - aDescr += (TCollection_AsciiString(theX)+", "); - aDescr += (TCollection_AsciiString(theY)+", "); - aDescr += (TCollection_AsciiString(theZ)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertex(" + << theX << ", " << theY << ", " << theZ << ")"; SetErrorCode(OK); return aPoint; @@ -150,16 +145,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPoint->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePointReference("); - TDF_Tool::Entry(theReference->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theX)+", "); - aDescr += (TCollection_AsciiString(theY)+", "); - aDescr += (TCollection_AsciiString(theZ)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexWithRef(" + << theReference << ", " << theX << ", " << theY << ", " << theZ << ")"; SetErrorCode(OK); return aPoint; @@ -208,14 +195,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPoint->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePointReference("); - TDF_Tool::Entry(theCurve->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theParameter)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve(" + << theCurve << ", " << theParameter << ")"; SetErrorCode(OK); return aPoint; @@ -263,14 +244,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aVector->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeVectorDXDYDZ("); - aDescr += (TCollection_AsciiString(theDX)+", "); - aDescr += (TCollection_AsciiString(theDY)+", "); - aDescr += (TCollection_AsciiString(theDZ)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVectorDXDYDZ(" + << theDX << ", " << theDY << ", " << theDZ << ")"; SetErrorCode(OK); return aVector; @@ -321,15 +296,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aVector->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeVectorTwoPnt("); - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aVector << " = geompy.MakeVector(" + << thePnt1 << ", " << thePnt2 << ")"; SetErrorCode(OK); return aVector; @@ -381,15 +349,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aLine->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeLine("); - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theDir->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLine(" + << thePnt << ", " << theDir << ")"; SetErrorCode(OK); return aLine; @@ -440,15 +401,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aLine->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakeLineTwoPnt("); - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aLine << " = geompy.MakeLineTwoPnt(" + << thePnt1 << ", " << thePnt2 << ")"; SetErrorCode(OK); return aLine; @@ -504,18 +458,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPlane->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePlaneThreePnt("); - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt3->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theSize) + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneThreePnt(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << theSize << ")"; SetErrorCode(OK); return aPlane; @@ -568,16 +512,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPlane->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePlanePntVec("); - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theSize) + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlane(" + << thePnt << ", " << theVec << ", " << theSize << ")"; SetErrorCode(OK); return aPlane; @@ -627,14 +563,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPlane->GetEntry(), anEntry); - aDescr += (anEntry+" = IBasicOperations.MakePlaneFace("); - TDF_Tool::Entry(theFace->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theSize) + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPlane << " = geompy.MakePlaneFace(" + << theFace << ", " << theSize << ")"; SetErrorCode(OK); return aPlane; @@ -684,20 +614,10 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aMarker->GetEntry(), anEntry); - aDescr += anEntry + " = IBasicOperations.MakeMarker("; - aDescr += TCollection_AsciiString(theOX) + ", "; - aDescr += TCollection_AsciiString(theOY) + ", "; - aDescr += TCollection_AsciiString(theOZ) + ", "; - aDescr += TCollection_AsciiString(theXDX) + ", "; - aDescr += TCollection_AsciiString(theXDY) + ", "; - aDescr += TCollection_AsciiString(theXDZ) + ", "; - aDescr += TCollection_AsciiString(theYDX) + ", "; - aDescr += TCollection_AsciiString(theYDY) + ", "; - aDescr += TCollection_AsciiString(theYDZ) + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aMarker << " = geompy.MakeMarker(" + << theOX << ", " << theOY << ", " << theOZ << ", " + << theXDX << ", " << theXDY << ", " << theXDZ << ", " + << theYDX << ", " << theYDY << ", " << theYDZ << ")"; SetErrorCode(OK); return aMarker; diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index 1f433c622..afc0223b6 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -11,6 +11,7 @@ using namespace std; #include "GEOMImpl_Block6Explorer.hxx" #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" #include "GEOMAlgo_GlueAnalyser.hxx" #include "GEOMAlgo_CoupleOfShapes.hxx" @@ -149,19 +150,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeQuad("; - TDF_Tool::Entry(theEdge1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theEdge2->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theEdge3->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theEdge4->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad(" + << theEdge1 << ", " << theEdge2 << ", " << theEdge3 << ", " << theEdge4 << ")"; SetErrorCode(OK); return aFace; @@ -215,15 +205,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad2Edges } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeQuad2Edges("; - TDF_Tool::Entry(theEdge1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theEdge2->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad2Edges(" + << theEdge1 << ", " << theEdge2 << ")"; SetErrorCode(OK); return aFace; @@ -284,19 +267,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeQuad4Vertices } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeQuad4Vertices("; - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePnt3->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePnt4->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad4Vertices(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << thePnt4 << ")"; SetErrorCode(OK); return aFace; @@ -364,23 +336,9 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aBlock->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeHexa("; - TDF_Tool::Entry(theFace1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace2->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace3->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace4->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace5->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace6->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa(" + << theFace1 << ", " << theFace2 << ", " << theFace3 << ", " + << theFace4 << ", " << theFace5 << ", " << theFace6 << ")"; SetErrorCode(OK); return aBlock; @@ -434,15 +392,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeHexa2Faces } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aBlock->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeHexa2Faces("; - TDF_Tool::Entry(theFace1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace2->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa2Faces(" + << theFace1 << ", " << theFace2 << ")"; SetErrorCode(OK); return aBlock; @@ -494,13 +445,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeBlockCompound } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aBlockComp->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeBlockCompound("; - TDF_Tool::Entry(theCompound->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aBlockComp + << " = geompy.MakeBlockCompound(" << theCompound << ")"; SetErrorCode(OK); return aBlockComp; @@ -574,21 +520,12 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint //The GetPoint() doesn't change object so no new function is required. Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetPoint("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theX) + ", "; - aDescr += TCollection_AsciiString(theY) + ", "; - aDescr += TCollection_AsciiString(theZ) + ", "; - aDescr += TCollection_AsciiString(theEpsilon) + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" + << aResult << " = geompy.GetPoint(" << theShape << ", " + << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")"; SetErrorCode(OK); return aResult; @@ -696,23 +633,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdge return NULL; } - //The GetEdge() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetEdge("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint2->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdge(" + << theShape << ", " << thePoint1 << ", " << thePoint2 << ")"; SetErrorCode(OK); return aResult; @@ -826,21 +751,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdgeNearPoint return NULL; } - //The GetEdgeNearPoint() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetEdgeNearPoint("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdgeNearPoint(" + << theShape << ", " << thePoint << ")"; SetErrorCode(OK); return aResult; @@ -982,27 +897,12 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByPoints return NULL; } - //The GetFaceByPoints() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceByPoints("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint2->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint3->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint4->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByPoints(" + << theShape << ", " << thePoint1 << ", " << thePoint2 + << ", " << thePoint3 << ", " << thePoint4 << ")"; SetErrorCode(OK); return aResult; @@ -1125,23 +1025,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByEdges return NULL; } - //The GetFaceByEdges() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceByEdges("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theEdge1->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theEdge2->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByEdges(" + << theShape << ", " << theEdge1 << ", " << theEdge2 << ")"; SetErrorCode(OK); return aResult; @@ -1204,21 +1092,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetOppositeFace return NULL; } - //The GetOppositeFace() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetOppositeFace("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theFace->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetOppositeFace(" + << theShape << ", " << theFace << ")"; SetErrorCode(OK); return aResult; @@ -1233,9 +1111,6 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint (Handle(GEOM_Object) theShape, Handle(GEOM_Object) thePoint) { -// OSD_Timer timer1, timer2, timer3, timer4, timer5; -// timer1.Start(); - SetErrorCode(KO); //New object @@ -1275,9 +1150,6 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint Standard_Real PX, PY, PZ; aPnt.Coord(PX, PY, PZ); -// timer1.Stop(); -// timer2.Start(); - // 1. Classify the point relatively each face Standard_Integer nearest = 2, nbFound = 0; TopTools_DataMapOfShapeInteger mapShapeDist; @@ -1328,9 +1200,6 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint } // if (!mapShapeDist.IsBound(aFace)) } -// timer2.Stop(); -// timer3.Start(); - // 2. Define face, containing the point or having minimum distance to it if (nbFound > 1) { if (nearest == 0) { @@ -1401,9 +1270,6 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint } } // if (nbFound > 1) -// timer3.Stop(); -// timer4.Start(); - if (nbFound == 0) { SetErrorCode("There are no faces near the given point"); return NULL; @@ -1414,8 +1280,6 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint anArray->SetValue(1, anIndices.FindIndex(aShape)); aResult = GetEngine()->AddSubShape(theShape, anArray); } - -// timer4.Stop(); } catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); @@ -1423,35 +1287,13 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceNearPoint return NULL; } -// timer5.Start(); - - //The GetFaceNearPoint() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceNearPoint("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceNearPoint(" + << theShape << ", " << thePoint << ")"; SetErrorCode(OK); - -// timer5.Stop(); -// -// cout << "Show current face times:" << endl; -// timer1.Show(); -// timer2.Show(); -// timer3.Show(); -// timer4.Show(); -// timer5.Show(); - return aResult; } @@ -1578,21 +1420,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale return NULL; } - //The GetFaceByNormale() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetFaceByNormale("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(theVector->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByNormale(" + << theShape << ", " << theVector << ")"; SetErrorCode(OK); return aResult; @@ -2226,19 +2058,19 @@ TCollection_AsciiString GEOMImpl_IBlocksOperations::PrintBCErrors switch (errStruct.error) { case NOT_BLOCK: - aDescr += "\nNot a Blocks: "; + aDescr += "\n\tNot a Blocks: "; break; case EXTRA_EDGE: - aDescr += "\nHexahedral solids with degenerated and/or seam edges: "; + aDescr += "\n\tHexahedral solids with degenerated and/or seam edges: "; break; case INVALID_CONNECTION: - aDescr += "\nInvalid connection between two blocks: "; + aDescr += "\n\tInvalid connection between two blocks: "; break; case NOT_CONNECTED: - aDescr += "\nBlocks, not connected with main body: "; + aDescr += "\n\tBlocks, not connected with main body: "; break; case NOT_GLUED: - aDescr += "\nNot glued blocks: "; + aDescr += "\n\tNot glued blocks: "; break; default: break; @@ -2483,13 +2315,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::RemoveExtraEdges } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.RemoveExtraEdges("; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy + << " = geompy.RemoveExtraEdges(" << theObject << ")"; SetErrorCode(OK); return aCopy; @@ -2537,13 +2364,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::CheckAndImprove } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.CheckAndImprove("; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy + << " = geompy.CheckAndImprove(" << theObject << ")"; SetErrorCode(OK); return aCopy; @@ -2570,7 +2392,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound Handle(GEOM_Function) aFunction; TopTools_MapOfShape mapShape; - TCollection_AsciiString anAsciiList = "[", anEntry; + TCollection_AsciiString anAsciiList, anEntry; // Map shapes TopTools_IndexedMapOfShape anIndices; @@ -2601,8 +2423,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound //Make a Python command TDF_Tool::Entry(anObj->GetEntry(), anEntry); - anAsciiList += anEntry; - anAsciiList += ","; + anAsciiList += anEntry + ", "; } } } @@ -2618,23 +2439,16 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::ExplodeCompound return aBlocks; } - anAsciiList.Trunc(anAsciiList.Length() - 1); - anAsciiList += "]"; + anAsciiList.Trunc(anAsciiList.Length() - 2); //The explode doesn't change object so no new function is required. aFunction = theCompound->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); //Make a Python command - TCollection_AsciiString aDescr (anAsciiList); - aDescr += " = IBlocksOperations.ExplodeCompoundOfBlocks("; - TDF_Tool::Entry(theCompound->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theMinNbFaces) + ", "; - aDescr += TCollection_AsciiString(theMaxNbFaces) + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t[" + << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode(" + << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")"; SetErrorCode(OK); return aBlocks; @@ -2805,21 +2619,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockNearPoint return NULL; } - //The GetBlockNearPoint() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theCompound->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.GetBlockNearPoint("; - TDF_Tool::Entry(theCompound->GetEntry(), anEntry); - aDescr += anEntry + ", "; - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockNearPoint(" + << theCompound << ", " << thePoint << ")"; SetErrorCode(OK); return aResult; @@ -2929,20 +2733,11 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetBlockByParts return NULL; } - //The GetBlockByParts() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theCompound->GetLastFunction(); + Handle(GEOM_Function) aFunction = aResult->GetLastFunction(); //Make a Python command - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - TCollection_AsciiString aDescr (anEntry); - aDescr += " = IBlocksOperations.GetBlockByParts("; - TDF_Tool::Entry(theCompound->GetEntry(), anEntry); - aDescr += anEntry + ", ["; - aDescr += aPartsDescr + "])"; - - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockByParts(" + << theCompound << ", [" << aPartsDescr.ToCString() << "])"; SetErrorCode(OK); return aResult; @@ -2970,7 +2765,8 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByPart //Get the parts Standard_Integer argi, aLen = theParts->Length(); TopTools_Array1OfShape anArgs (1, aLen); - TCollection_AsciiString anEntry, aPartsDescr, anAsciiList = "["; + TCollection_AsciiString anEntry, aPartsDescr, anAsciiList; + for (argi = 1; argi <= aLen; argi++) { Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theParts->Value(argi)); Handle(GEOM_Function) aRef = anObj->GetLastFunction(); @@ -2985,8 +2781,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByPart // For Python command TDF_Tool::Entry(anObj->GetEntry(), anEntry); - if (argi > 1) aPartsDescr += ", "; - aPartsDescr += anEntry; + aPartsDescr += anEntry + ", "; } //Get the Blocks @@ -3049,10 +2844,11 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByPart anObj = GetEngine()->AddSubShape(theCompound, anArray); aBlocks->Append(anObj); - //Make a Python command + // For Python command TDF_Tool::Entry(anObj->GetEntry(), anEntry); - anAsciiList += anEntry; - anAsciiList += ","; + anAsciiList += anEntry + ", "; + if (aFunction.IsNull()) + aFunction = anObj->GetLastFunction(); } } } @@ -3062,22 +2858,13 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::GetBlocksByPart return NULL; } - anAsciiList.Trunc(anAsciiList.Length() - 1); - anAsciiList += "]"; - - //The GetBlocksByParts() doesn't change object so no new function is required. - aFunction = theCompound->GetLastFunction(); - //Make a Python command - TCollection_AsciiString aDescr (anAsciiList); - aDescr += " = IBlocksOperations.GetBlocksByParts("; - TDF_Tool::Entry(theCompound->GetEntry(), anEntry); - aDescr += anEntry + ", ["; - aDescr += aPartsDescr + "])"; + aPartsDescr.Trunc(aPartsDescr.Length() - 2); + anAsciiList.Trunc(anAsciiList.Length() - 2); - TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n"; - aNewDescr += aDescr; - aFunction->SetDescription(aNewDescr); + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetBlocksByParts(" << theCompound + << ", [" << aPartsDescr.ToCString() << "])"; SetErrorCode(OK); return aBlocks; @@ -3131,16 +2918,8 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation1D } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation1D("; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theDirFace1) + ", "; - aDescr += TCollection_AsciiString(theDirFace2) + ", "; - aDescr += TCollection_AsciiString(theNbTimes) + ") "; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation1D(" + << theObject << ", " << theDirFace1 << ", " << theDirFace2 << ", " << theNbTimes << ")"; SetErrorCode(OK); return aCopy; @@ -3200,19 +2979,9 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::MakeMultiTransformation2D } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation2D("; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theDirFace1U) + ", "; - aDescr += TCollection_AsciiString(theDirFace2U) + ", "; - aDescr += TCollection_AsciiString(theNbTimesU) + ", "; - aDescr += TCollection_AsciiString(theDirFace1V) + ", "; - aDescr += TCollection_AsciiString(theDirFace2V) + ", "; - aDescr += TCollection_AsciiString(theNbTimesV) + ") "; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation2D(" + << theObject << ", " << theDirFace1U << ", " << theDirFace2U << ", " << theNbTimesU + << ", " << theDirFace1V << ", " << theDirFace2V << ", " << theNbTimesV << ")"; SetErrorCode(OK); return aCopy; @@ -3245,6 +3014,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; TopTools_MapOfShape mapAcceptedEdges; + TCollection_AsciiString aListRes, anEntry; for (ie = 1; ie <= nbEdges; ie++) { TopoDS_Shape curE = MEW.FindKey(ie); @@ -3329,6 +3099,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate // Add the chain to the result aSeq->Append(aChain); + + //Make a Python command + TDF_Tool::Entry(aChain->GetEntry(), anEntry); + aListRes += anEntry + ", "; } if (aSeq->IsEmpty()) { @@ -3336,19 +3110,15 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IBlocksOperations::Propagate return aSeq; } + aListRes.Trunc(aListRes.Length() - 2); + // The Propagation doesn't change object so no new function is required. Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); // Make a Python command - TCollection_AsciiString aDescr - ("\nlistPropagationChains = IShapesOperations.Propagate("); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry + ")"); - - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr = anOldDescr + aDescr; - aFunction->SetDescription(anOldDescr); + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t[" + << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")"; SetErrorCode(OK); return aSeq; diff --git a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx index ad6fba6f4..61b65e4b5 100644 --- a/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBooleanOperations.cxx @@ -3,6 +3,8 @@ using namespace std; #include "GEOMImpl_IBooleanOperations.hxx" #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + #include "GEOMImpl_Types.hxx" #include "GEOMImpl_BooleanDriver.hxx" @@ -95,18 +97,15 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeBoolean (Handle(GEOM_Object return NULL; } - //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aBool->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IBooleanOperations.MakeBoolean("; - TDF_Tool::Entry(theShape1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theShape2->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theOp)+")"); - - aFunction->SetDescription(aDescr); + //Make a Python command + GEOM::TPythonDump pd (aFunction); + pd << aBool; + if (theOp == 1) pd << " = geompy.MakeCommon("; + else if (theOp == 2) pd << " = geompy.MakeCut("; + else if (theOp == 3) pd << " = geompy.MakeFuse("; + else if (theOp == 4) pd << " = geompy.MakeSection("; + else {} + pd << theShape1 << ", " << theShape2 << ")"; SetErrorCode(OK); return aBool; @@ -253,36 +252,24 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition } //Make a Python command - TCollection_AsciiString aDescr; - TDF_Tool::Entry(aPartition->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IBooleanOperations.MakePartition(["; - // Shapes - aDescr += aShapesDescr + "], ["; - // Tools - aDescr += aToolsDescr + "], ["; - // Keep Ins - aDescr += aKeepInsDescr + "], ["; - // Remove Ins - aDescr += aRemoveInsDescr + "], "; - // Limit - aDescr += TCollection_AsciiString(theLimit) + ", "; - // Remove Webs - if (theRemoveWebs) aDescr += "1, ["; - else aDescr += "0, ["; + GEOM::TPythonDump pd (aFunction); + pd << aPartition << " = geompy.MakePartition(["; + // Shapes, Tools + pd << aShapesDescr.ToCString() << "], [" << aToolsDescr.ToCString() << "], ["; + // Keep Ins, Remove Ins + pd << aKeepInsDescr.ToCString() << "], [" << aRemoveInsDescr.ToCString() << "], "; + // Limit, Remove Webs + pd << theLimit << ", " << (int)theRemoveWebs << ", ["; // Materials if (theMaterials->Length() > 0) { int i = theMaterials->Lower(); - aDescr += TCollection_AsciiString(theMaterials->Value(i)); + pd << theMaterials->Value(i); i++; for (; i <= theMaterials->Upper(); i++) { - aDescr += ", "; - aDescr += TCollection_AsciiString(theMaterials->Value(i)); + pd << ", " << theMaterials->Value(i); } } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aPartition; @@ -335,16 +322,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aPart->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IBooleanOperations.MakePartition("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePlane->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aPart << " = geompy.MakeHalfPartition(" + << theShape << ", " << thePlane << ")"; SetErrorCode(OK); return aPart; diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx index 2bf1dfc6e..d694ff537 100644 --- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx @@ -3,6 +3,8 @@ using namespace std; #include "GEOMImpl_ICurvesOperations.hxx" #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + #include "GEOMImpl_Types.hxx" #include "GEOMImpl_PolylineDriver.hxx" @@ -97,22 +99,15 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakePolyline (listGetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakePolyline(["; + GEOM::TPythonDump pd (aFunction); + pd << aPolyline << " = geompy.MakePolyline(["; + it = thePoints.begin(); - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - it++; - aDescr += (anEntry+", "); - for (; it != thePoints.end(); it++) { - aDescr += ", "; - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - aDescr += anEntry; + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aPolyline; @@ -168,18 +163,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCircleThreePnt (Handle(GEOM_ } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aCircle->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeCircleThreePnt("; - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt3->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircleThreePnt(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")"; SetErrorCode(OK); return aCircle; @@ -233,17 +218,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aCircle->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeCirclePntVecR("; - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCircle << " = geompy.MakeCircle(" + << thePnt << ", " << theVec << ", " << theR << ")"; SetErrorCode(OK); return aCircle; @@ -299,18 +275,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(anEll->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeEllipse("; - TDF_Tool::Entry(thePnt->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVec->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theRMajor)+", "); - aDescr += (TCollection_AsciiString(theRMinor)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << anEll << " = geompy.MakeEllipse(" + << thePnt << ", " << theVec << ", " << theRMajor << ", " << theRMinor << ")"; SetErrorCode(OK); return anEll; @@ -366,18 +332,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArc (Handle(GEOM_Object) the } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(anArc->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeArc("; - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt3->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << anArc << " = geompy.MakeArc(" + << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")"; SetErrorCode(OK); return anArc; @@ -433,22 +389,15 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineBezier } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aSpline->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeSplineBezier(["; + GEOM::TPythonDump pd (aFunction); + pd << aSpline << " = geompy.MakeBezier(["; + it = thePoints.begin(); - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - it++; - aDescr += (anEntry+", "); - for (; it != thePoints.end(); it++) { - aDescr += ", "; - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - aDescr += anEntry; + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aSpline; @@ -504,22 +453,15 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aSpline->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeSplineInterpolation(["; + GEOM::TPythonDump pd (aFunction); + pd << aSpline << " = geompy.MakeInterpol(["; + it = thePoints.begin(); - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - it++; - aDescr += (anEntry+", "); - for (; it != thePoints.end(); it++) { - aDescr += ", "; - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - aDescr += anEntry; + pd << (*it++); + while (it != thePoints.end()) { + pd << ", " << (*it++); } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aSpline; @@ -573,23 +515,15 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aSketcher->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ICurvesOperations.MakeSketcher("; - aDescr += aCommand+", ["; + GEOM::TPythonDump pd (aFunction); + pd << aSketcher << " = geompy.MakeSketcher(\"" << theCommand << "\", ["; it = theWorkingPlane.begin(); - aDescr += TCollection_AsciiString(*it); - it++; - for (; it != theWorkingPlane.end(); it++) { - aDescr += ", "; - aDescr += TCollection_AsciiString(*it); + pd << (*it++); + while (it != theWorkingPlane.end()) { + pd << ", " << (*it++); } - - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aSketcher; diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx index 12b1602ed..a641ad29d 100644 --- a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx @@ -6,6 +6,7 @@ using namespace std; #include "GEOM_Function.hxx" #include "GEOM_ISubShape.hxx" +#include "GEOM_PythonDump.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -54,14 +55,15 @@ GEOMImpl_IGroupOperations::~GEOMImpl_IGroupOperations() * CreateGroup */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup(Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType) +Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup + (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType) { SetErrorCode(KO); Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); anArray->SetValue(1, -1); - //Add a new Fillet object + //Add a new Fillet object Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(theMainShape, anArray); //Set a GROUP type @@ -70,17 +72,14 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup(Handle(GEOM_Object) t //Set a sub shape type TDF_Label aFreeLabel = aGroup->GetFreeLabel(); TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType); - - //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aGroup->GetEntry(), anEntry); - aDescr = anEntry + " = IGroupOperations.CreateGroup("; - TDF_Tool::Entry(theMainShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString((int)theShapeType)+")"); + //Make a Python command Handle(GEOM_Function) aFunction = aGroup->GetFunction(1); - aFunction->SetDescription(aDescr); + //TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + //GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" << aGroup + GEOM::TPythonDump(aFunction) << aGroup + << " = geompy.CreateGroup(" << theMainShape << ", " << (int)theShapeType << ")"; SetErrorCode(OK); return aGroup; @@ -119,6 +118,12 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS aSSI.SetIndices(aNewSeq); } + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" + << "geompy.AddObject(" << theGroup << ", " << theSubShapeID << ")"; + SetErrorCode(OK); return; } @@ -128,7 +133,7 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS * RemoveObject */ //============================================================================= -void GEOMImpl_IGroupOperations::RemoveObject(Handle(GEOM_Object) theGroup, int theSubShapeID) +void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int theSubShapeID) { SetErrorCode(KO); if(theGroup.IsNull()) return; @@ -179,6 +184,12 @@ void GEOMImpl_IGroupOperations::RemoveObject(Handle(GEOM_Object) theGroup, int t aSSI.SetIndices(aNewSeq); } + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" + << "geompy.RemoveObject(" << theGroup << ", " << theSubShapeID << ")"; + SetErrorCode(OK); return; } @@ -315,6 +326,17 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, aSSI.SetIndices(aNewSeq); } + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\t" << "geompy.UnionList(" << theGroup << ", ["; + + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); + pd << anObj_i << (( i < aLen ) ? ", " : "])"); + } + SetErrorCode(OK); } @@ -454,9 +476,19 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, aSSI.SetIndices(aNewSeq); } + //Make a Python command + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); + + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\t" << "geompy.DifferenceList(" << theGroup << ", ["; + + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i)); + pd << anObj_i << (( i < aLen ) ? ", " : "])"); + } + SetErrorCode(OK); } - //============================================================================= /*! * UnionIDs @@ -622,23 +654,29 @@ TopAbs_ShapeEnum GEOMImpl_IGroupOperations::GetType(Handle(GEOM_Object) theGroup * GetMainShape */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape(Handle(GEOM_Object) theGroup) +Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object) theGroup) { SetErrorCode(KO); if(theGroup.IsNull()) return NULL; - Handle(GEOM_Function) aFunction = theGroup->GetFunction(1); - if(aFunction.IsNull()) return NULL; - - GEOM_ISubShape aSSI(aFunction); - aFunction = aSSI.GetMainShape(); - if(aFunction.IsNull()) return NULL; + Handle(GEOM_Function) aGroupFunction = theGroup->GetFunction(1); + if (aGroupFunction.IsNull()) return NULL; + + GEOM_ISubShape aSSI (aGroupFunction); + Handle(GEOM_Function) aMainShapeFunction = aSSI.GetMainShape(); + if (aMainShapeFunction.IsNull()) return NULL; - TDF_Label aLabel = aFunction->GetOwnerEntry(); + TDF_Label aLabel = aMainShapeFunction->GetOwnerEntry(); Handle(GEOM_Object) aMainShape = GEOM_Object::GetObject(aLabel); - if(aMainShape.IsNull()) return NULL; - + if (aMainShape.IsNull()) return NULL; + + //Make a Python command + TCollection_AsciiString anOldDescr = aGroupFunction->GetDescription(); + + GEOM::TPythonDump(aGroupFunction) << anOldDescr.ToCString() << "\n\t" + << aMainShape << " = geompy.GetMainShape(" << theGroup << ")"; + SetErrorCode(OK); return aMainShape; } diff --git a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx index 774ef28e2..a87816fb3 100644 --- a/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IHealingOperations.cxx @@ -2,6 +2,8 @@ using namespace std; #include "GEOMImpl_IHealingOperations.hxx" +#include "GEOM_PythonDump.hxx" + #include "GEOMImpl_HealingDriver.hxx" #include "GEOMImpl_Types.hxx" #include "GEOMImpl_IHealing.hxx" @@ -22,6 +24,8 @@ using namespace std; #include #include +#include + #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -123,8 +127,30 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ShapeProcess (Handle(GEOM_Objec } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.ProcessShape(" << theObject << ", ["; + + // list of operators + int i = theOperators->Lower(), nb = theOperators->Upper(); + for ( ; i <= nb; i++) { + pd << "\"" << TCollection_AsciiString(theOperators->Value( i )).ToCString() + << (( i < nb ) ? "\", " : "\""); + } + pd << "], ["; + // list of parameters + i = theParams->Lower(); nb = theParams->Upper(); + for ( ; i <= nb; i++) { + pd << "\"" << TCollection_AsciiString(theParams->Value( i )).ToCString() + << (( i < nb ) ? "\", " : "\""); + } + pd << "], ["; + // list of values + i = theValues->Lower(); nb = theValues->Upper(); + for ( ; i <= nb; i++) { + pd << "\"" << TCollection_AsciiString(theValues->Value( i )).ToCString() + << (( i < nb ) ? "\", " : "\""); + } + pd << "])"; SetErrorCode(OK); return aNewObject; @@ -263,8 +289,8 @@ bool GEOMImpl_IHealingOperations::GetParameters (const string theOperation, * SuppressFaces */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces (Handle(GEOM_Object) theObject, - const Handle(TColStd_HArray1OfInteger)& theFaces) +Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces + (Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theFaces) { // set error code, check parameters SetErrorCode(KO); @@ -308,8 +334,13 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces (Handle(GEOM_Obje } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.SuppressFaces(" << theObject << ", ["; + + // list of face ids + int i = theFaces->Lower(), nb = theFaces->Upper(); + for ( ; i <= nb; i++) + pd << theFaces->Value( i ) << (( i < nb ) ? ", " : "])"); SetErrorCode(OK); return aNewObject; @@ -321,9 +352,10 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::SuppressFaces (Handle(GEOM_Obje * CloseContour */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour (Handle(GEOM_Object) theObject, - const Handle(TColStd_HArray1OfInteger)& theWires, - bool isCommonVertex) +Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour + (Handle(GEOM_Object) theObject, + const Handle(TColStd_HArray1OfInteger)& theWires, + bool isCommonVertex) { // set error code, check parameters SetErrorCode(KO); @@ -368,8 +400,15 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour (Handle(GEOM_Objec } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.CloseContour(" << theObject << ", ["; + + // list of wire ids + int i = theWires->Lower(), nb = theWires->Upper(); + for ( ; i <= nb; i++) + pd << theWires->Value( i ) << (( i < nb ) ? ", " : "], "); + + pd << (int)isCommonVertex << ")"; SetErrorCode(OK); return aNewObject; @@ -380,8 +419,8 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::CloseContour (Handle(GEOM_Objec * RemoveIntWires */ //============================================================================= -Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires (Handle(GEOM_Object) theObject, - const Handle(TColStd_HArray1OfInteger)& theWires) +Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires + (Handle(GEOM_Object) theObject, const Handle(TColStd_HArray1OfInteger)& theWires) { // set error code, check parameters SetErrorCode(KO); @@ -425,8 +464,17 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::RemoveIntWires (Handle(GEOM_Obj } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.SuppressInternalWires(" << theObject << ", ["; + + // list of wire ids + if (!theWires.IsNull()) { + int i = theWires->Lower(), nb = theWires->Upper(); + for ( ; i <= nb; i++) + pd << theWires->Value( i ) << (( i < nb ) ? ", " : "])"); + } else { + pd << "])"; + } SetErrorCode(OK); return aNewObject; @@ -482,8 +530,13 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::FillHoles (Handle(GEOM_Object) } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump pd (aFunction); + pd << aNewObject << " = geompy.SuppressHoles(" << theObject << ", ["; + + // list of wire ids + int i = theWires->Lower(), nb = theWires->Upper(); + for ( ; i <= nb; i++) + pd << theWires->Value( i ) << (( i < nb ) ? ", " : "])"); SetErrorCode(OK); return aNewObject; @@ -539,8 +592,8 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::Sew (Handle(GEOM_Object) theObj } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.Sew(" + << theObject << ", " << theTolerance << ")"; SetErrorCode(OK); return aNewObject; @@ -600,8 +653,8 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::DivideEdge (Handle(GEOM_Object) } //Make a Python command - // ... - // ... missing ... + GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.DivideEdge(" << theObject + << ", " << theIndex << ", " << theValue << ", " << (int)isByParameter << ")"; SetErrorCode(OK); return aNewObject; @@ -652,6 +705,35 @@ bool GEOMImpl_IHealingOperations::GetFreeBoundary (Handle(GEOM_Object) theObject theOpen->Append(anObj); } + //Make a Python command + GEOM::TPythonDump pd (aFunction); + + Standard_Integer i, aLen = theClosed->Length(); + if (aLen > 0) { + pd << "(isDone, ["; + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theClosed->Value(i)); + pd << anObj_i << ((i < aLen) ? ", " : ""); + } + pd << "], "; + } else { + pd << "(isDone, empty_list, "; + } + + aLen = theOpen->Length(); + if (aLen > 0) { + pd << "["; + for (i = 1; i <= aLen; i++) { + Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theOpen->Value(i)); + pd << anObj_i << ((i < aLen) ? ", " : ""); + } + pd << "]"; + } else { + pd << "empty_list"; + } + + pd << ") = geompy.GetFreeBoundary(" << theObject << ")"; + SetErrorCode(OK); return true; } diff --git a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx index 520eba58f..bbf4e9980 100644 --- a/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IInsertOperations.cxx @@ -12,6 +12,7 @@ using namespace std; #include #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" #include "GEOMImpl_CopyDriver.hxx" #include "GEOMImpl_ExportDriver.hxx" @@ -90,13 +91,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::MakeCopy(Handle(GEOM_Object) the } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = IInsertOperations.MakeCopy("); - TDF_Tool::Entry(theOriginal->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeCopy(" << theOriginal << ")"; SetErrorCode(OK); return aCopy; @@ -154,14 +149,8 @@ void GEOMImpl_IInsertOperations::Export } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - aDescr = "IInsertOperations.Export("; - TDF_Tool::Entry(theOriginal->GetEntry(), anEntry); - aDescr += (anEntry + ", "); - aDescr += (TCollection_AsciiString(aFileName) + ", "); - aDescr += (TCollection_AsciiString(aFormatName) + ")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.Export(" << theOriginal + << ", \"" << theFileName << "\", \"" << theFormatName << "\")"; SetErrorCode(OK); } @@ -216,13 +205,8 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(result->GetEntry(), anEntry); - aDescr += (anEntry + " = IInsertOperations.Import("); - aDescr += (TCollection_AsciiString(aFileName) + ", "); - aDescr += (TCollection_AsciiString(aFormatName) + ")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\"" + << theFileName << "\", \"" << theFormatName << "\")"; SetErrorCode(OK); return result; diff --git a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx index 5df5db458..031ab0eaf 100644 --- a/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ILocalOperations.cxx @@ -3,6 +3,8 @@ using namespace std; #include "GEOMImpl_ILocalOperations.hxx" #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + #include "GEOMImpl_Types.hxx" #include "GEOMImpl_FilletDriver.hxx" @@ -94,14 +96,8 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletAll } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aFillet->GetEntry(), anEntry); - aDescr = anEntry + " = ILocalOperations.MakeFilletAll("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aFillet << " = geompy.MakeFilletAll(" + << theShape << ", " << theR << ")"; SetErrorCode(OK); return aFillet; @@ -158,22 +154,16 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletEdges } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aFillet->GetEntry(), anEntry); - aDescr = anEntry + " = ILocalOperations.MakeFilletEdges("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+", ["); + GEOM::TPythonDump pd (aFunction); + pd << aFillet << " = geompy.MakeFillet(" << theShape + << ", " << theR << ", geompy.ShapeType[\"EDGE\"], ["; + it = theEdges.begin(); - aDescr += (TCollection_AsciiString(*it)+", "); - it++; - for (; it != theEdges.end(); it++) { - aDescr += ", "; - aDescr += TCollection_AsciiString(*it); + pd << (*it++); + while (it != theEdges.end()) { + pd << ", " << (*it++); } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aFillet; @@ -230,22 +220,16 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFaces } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aFillet->GetEntry(), anEntry); - aDescr = anEntry + " = ILocalOperations.MakeFilletFaces("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theR)+", ["); + GEOM::TPythonDump pd (aFunction); + pd << aFillet << " = geompy.MakeFillet(" << theShape + << ", " << theR << ", geompy.ShapeType[\"FACE\"], ["; + it = theFaces.begin(); - aDescr += (TCollection_AsciiString(*it)+", "); - it++; - for (; it != theFaces.end(); it++) { - aDescr += ", "; - aDescr += TCollection_AsciiString(*it); + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aFillet; @@ -293,15 +277,8 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferAll (Handle(GEOM_Objec } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ILocalOperations.MakeChamferAll("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theD)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aChamfer << " = geompy.MakeChamferAll(" + << theShape << ", " << theD << ")"; SetErrorCode(OK); return aChamfer; @@ -354,18 +331,9 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdge } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ILocalOperations.MakeChamferEdge("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theD1)+", "); - aDescr += (TCollection_AsciiString(theD2)+", "); - aDescr += (TCollection_AsciiString(theFace1)+", "); - aDescr += (TCollection_AsciiString(theFace2)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aChamfer + << " = geompy.MakeChamferEdge(" << theShape << ", " << theD1 + << ", " << theD2 << ", " << theFace1 << ", " << theFace2 << ")"; SetErrorCode(OK); return aChamfer; @@ -424,24 +392,16 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferFaces } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ILocalOperations.MakeChamferFaces("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theD1)+", "); - aDescr += (TCollection_AsciiString(theD2)+", ["); + GEOM::TPythonDump pd (aFunction); + pd << aChamfer << " = geompy.MakeChamferFaces(" << theShape + << ", " << theD1 << ", " << theD2 << ", ["; + it = theFaces.begin(); - aDescr += (TCollection_AsciiString(*it)+", "); - it++; - for (; it != theFaces.end(); it++) { - aDescr += ", "; - aDescr += TCollection_AsciiString(*it); + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aChamfer; @@ -493,17 +453,9 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeArchimede (Handle(GEOM_Object } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aChamfer->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = ILocalOperations.MakeArchimede("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theWeight)+", "); - aDescr += (TCollection_AsciiString(theWaterDensity)+", "); - aDescr += (TCollection_AsciiString(theMeshingDeflection)+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aChamfer + << " = geompy.Archimede(" << theShape << ", " << theWeight << ", " + << theWaterDensity << ", " << theMeshingDeflection << ")"; SetErrorCode(OK); return aChamfer; diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index c6c4f1c00..883b5a8ad 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -7,6 +7,7 @@ using namespace std; #include "GEOMImpl_IMeasure.hxx" #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -110,13 +111,7 @@ Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetCentreOfMass } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCDG->GetEntry(), anEntry); - aDescr += anEntry + " = IMeasureOperations.MakeCentreOfMass("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCDG << " = geompy.MakeCDG(" << theShape << ")"; SetErrorCode(OK); return aCDG; @@ -810,8 +805,9 @@ void GEOMImpl_IMeasureOperations::GetProblemShapes (const BRepCheck_Analyzer& } TopAbs_ShapeEnum styp = theShape.ShapeType(); BRepCheck_ListIteratorOfListOfStatus itl; + TopTools_ListOfShape empty; if (!theMap.IsBound(theShape)) { - theMap.Bind(theShape,TopTools_ListOfShape()); + theMap.Bind(theShape,empty); if (!theAna.Result(theShape).IsNull()) { itl.Initialize(theAna.Result(theShape)->Status()); diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 48c9a0d74..2d187465d 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -16,6 +16,7 @@ using namespace std; #include "GEOMImpl_Block6Explorer.hxx" #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" #include "GEOMAlgo_FinderShapeOn1.hxx" @@ -142,15 +143,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdge } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(anEdge->GetEntry(), anEntry); - aDescr += (anEntry+" = IShapesOperations.MakeEdge("); - TDF_Tool::Entry(thePnt1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePnt2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << anEdge << " = geompy.MakeEdge(" + << thePnt1 << ", " << thePnt2 << ")"; SetErrorCode(OK); return anEdge; @@ -213,19 +207,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) th } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aFace->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IShapesOperations.MakeFace("; - TDF_Tool::Entry(theWire->GetEntry(), anEntry); - aDescr += anEntry; - if (isPlanarWanted) - aDescr += ", 1)"; - - else - aDescr += ", 0)"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFace(" + << theWire << ", " << (int)isPlanarWanted << ")"; SetErrorCode(OK); return aFace; @@ -285,28 +268,18 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aShape->GetEntry(), anEntry); - aDescr += (anEntry + " = IShapesOperations.MakeFaceWires(["); + GEOM::TPythonDump pd (aFunction); + pd << aShape << " = geompy.MakeFaceWires(["; + // Shapes it = theShapes.begin(); if (it != theShapes.end()) { - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - it++; - aDescr += (anEntry+", "); - for (; it != theShapes.end(); it++) { - aDescr += ", "; - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - aDescr += anEntry; + pd << (*it++); + while (it != theShapes.end()) { + pd << ", " << (*it++); } } - if (isPlanarWanted) - aDescr += "], 1)"; - - else - aDescr += "], 0)"; - - aFunction->SetDescription(aDescr); + pd << "], " << (int)isPlanarWanted << ")"; SetErrorCode(OK); return aShape; @@ -378,14 +351,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShell (Handle(GEOM_Obje } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aSolid->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IShapesOperations.MakeSolidShell("; - TDF_Tool::Entry(theShell->GetEntry(), anEntry); - aDescr += (anEntry+")"); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aSolid + << " = geompy.MakeSolid(" << theShell << ")"; SetErrorCode(OK); return aSolid; @@ -456,25 +423,18 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape } //Make a Python command - TCollection_AsciiString anEntry, aDescr(""); - TDF_Tool::Entry(aShape->GetEntry(), anEntry); - aDescr += (anEntry + " = IShapesOperations."); - aDescr += (theMethodName + "(["); + GEOM::TPythonDump pd (aFunction); + pd << aShape << " = geompy." << theMethodName.ToCString() << "(["; + // Shapes it = theShapes.begin(); if (it != theShapes.end()) { - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - it++; - aDescr += (anEntry+", "); - for (; it != theShapes.end(); it++) { - aDescr += ", "; - TDF_Tool::Entry((*it)->GetEntry(), anEntry); - aDescr += anEntry; + pd << (*it++); + while (it != theShapes.end()) { + pd << ", " << (*it++); } } - aDescr += "])"; - - aFunction->SetDescription(aDescr); + pd << "])"; SetErrorCode(OK); return aShape; @@ -532,15 +492,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aGlued->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IShapesOperations.MakeGlueFaces("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theTolerance) + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueFaces(" + << theShape << ", " << theTolerance << ")"; // to provide warning if (!isWarning) SetErrorCode(OK); @@ -611,7 +564,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode Handle(TColStd_HArray1OfInteger) anArray; TopTools_ListIteratorOfListOfShape itSub (listShape); - TCollection_AsciiString anAsciiList = "[", anEntry; + TCollection_AsciiString anAsciiList, anEntry; for (int index = 1; itSub.More(); itSub.Next(), ++index) { TopoDS_Shape aValue = itSub.Value(); anArray = new TColStd_HArray1OfInteger(1,1); @@ -619,35 +572,22 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::MakeExplode anObj = GetEngine()->AddSubShape(theShape, anArray); aSeq->Append(anObj); + // for python command TDF_Tool::Entry(anObj->GetEntry(), anEntry); anAsciiList += anEntry; anAsciiList += ","; } -// timer3.Stop(); -// timer4.Start(); - + //Make a Python command anAsciiList.Trunc(anAsciiList.Length() - 1); - anAsciiList += "]"; - - anAsciiList = TCollection_AsciiString("\n") + anAsciiList; - //The explode doesn't change object so no new function is requiered. aFunction = theShape->GetLastFunction(); - - //Make a Python command - TCollection_AsciiString aDescr(anAsciiList); - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += " = IShapesOperations.MakeExplode("; - aDescr += (anEntry + ","); - if (isSorted) - aDescr += (TCollection_AsciiString(theShapeType) + ", 1)"); - else - aDescr += (TCollection_AsciiString(theShapeType) + ", 0)"); - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr = anOldDescr + aDescr; - aFunction->SetDescription(anOldDescr); + + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\t[" << anAsciiList.ToCString(); + pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "("); + pd << theShape << ", " << theShapeType << ")"; SetErrorCode(OK); @@ -723,23 +663,14 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::SubShapeAllIDs aSeq->Append(anIndices.FindIndex(aValue)); } - //The explode doesn't change object so no new function is required. Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); //Make a Python command - TCollection_AsciiString aDescr - ("\nlistSubShapeAllIDs = IShapesOperations.SubShapeAllIDs("); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry + ","); - if (isSorted) - aDescr += (TCollection_AsciiString(theShapeType) + ", 1)"); - else - aDescr += (TCollection_AsciiString(theShapeType) + ", 0)"); - - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr = anOldDescr + aDescr; - aFunction->SetDescription(anOldDescr); + GEOM::TPythonDump pd (aFunction); + pd << anOldDescr.ToCString() << "\n\tlistSubShapeIDs = geompy.SubShapeAll"; + pd << (isSorted ? "SortedIDs(" : "IDs("); + pd << theShape << ", " << theShapeType << ")"; SetErrorCode(OK); return aSeq; @@ -760,27 +691,17 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetSubShape Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); anArray->SetValue(1, theID); - Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray); + Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray,true); if (anObj.IsNull()) { SetErrorCode("Can not get a sub-shape with the given ID"); return NULL; } - //The GetSubShape() doesn't change object so no new function is requiered. - Handle(GEOM_Function) aFunction = theMainShape->GetLastFunction(); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); //Make a Python command - TCollection_AsciiString aDescr ("\n"); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(anObj->GetEntry(), anEntry); - aDescr += anEntry + " = IShapesOperations.GetSubShape("; - TDF_Tool::Entry(theMainShape->GetEntry(), anEntry); - aDescr += anEntry + ", "; - aDescr += TCollection_AsciiString(theID) + ")"; - - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr = anOldDescr + aDescr; - aFunction->SetDescription(anOldDescr); + GEOM::TPythonDump(aFunction) << anObj << " = geompy.GetSubShape(" + << theMainShape << ", [" << theID << "])"; SetErrorCode(OK); return anObj; @@ -882,14 +803,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object) } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aReversed->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IShapesOperations.ReverseShape("; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + ")"; - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aReversed + << " = geompy.ChangeOrientation(" << theShape << ")"; SetErrorCode(OK); return aReversed; @@ -935,16 +850,11 @@ Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetFreeFacesIDs //The explode doesn't change object so no new function is required. Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + TCollection_AsciiString anOldDescr = aFunction->GetDescription(); //Make a Python command - TCollection_AsciiString aDescr ("\nlistFreeFacesIDs = IShapesOperations.GetFreeFacesIDs("); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += (anEntry + ")"); - - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr = anOldDescr + aDescr; - aFunction->SetDescription(anOldDescr); + GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() + << "\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")"; SetErrorCode(OK); return aSeq; @@ -978,6 +888,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes Handle(GEOM_Object) anObj; Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + TCollection_AsciiString anAsciiList, anEntry; TopTools_MapOfShape mapShape2; TopExp_Explorer exp (aShape2, TopAbs_ShapeEnum(theShapeType)); @@ -988,6 +899,11 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes anArray->SetValue(1, anIndices.FindIndex(aSS)); anObj = GetEngine()->AddSubShape(theShape1, anArray); aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; } } @@ -996,27 +912,50 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetSharedShapes return aSeq; } - //The explode doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape1->GetLastFunction(); - //Make a Python command - TCollection_AsciiString aDescr - ("\nlistSharedShapes = IShapesOperations.GetSharedShapes("); - TCollection_AsciiString anEntry; - TDF_Tool::Entry(theShape1->GetEntry(), anEntry); - aDescr += (anEntry + ","); - TDF_Tool::Entry(theShape2->GetEntry(), anEntry); - aDescr += (anEntry + ","); - aDescr += TCollection_AsciiString(theShapeType) + ")"; + anAsciiList.Trunc(anAsciiList.Length() - 1); - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr = anOldDescr + aDescr; - aFunction->SetDescription(anOldDescr); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetSharedShapes(" << theShape1 << ", " + << theShape2 << ", " << theShapeType << ")"; SetErrorCode(OK); return aSeq; } +//============================================================================= +/*! + * + */ +//============================================================================= +static GEOM::TPythonDump& operator<< (GEOM::TPythonDump& theDump, + const GEOMAlgo_State theState) +{ + switch (theState) { + case GEOMAlgo_ST_IN: + theDump << "geompy.GEOM.ST_IN"; + break; + case GEOMAlgo_ST_OUT: + theDump << "geompy.GEOM.ST_OUT"; + break; + case GEOMAlgo_ST_ON: + theDump << "geompy.GEOM.ST_ON"; + break; + case GEOMAlgo_ST_ONIN: + theDump << "geompy.GEOM.ST_ONIN"; + break; + case GEOMAlgo_ST_ONOUT: + theDump << "geompy.GEOM.ST_ONOUT"; + break; + default: + theDump << "geompy.GEOM.ST_UNKNOWN"; + break; + } + return theDump; +} + //============================================================================= /*! * GetShapesOnPlane @@ -1143,6 +1082,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan Handle(GEOM_Object) anObj; Handle(TColStd_HArray1OfInteger) anArray; Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + TCollection_AsciiString anAsciiList, anEntry; TopTools_ListIteratorOfListOfShape itSub (listSS); for (int index = 1; itSub.More(); itSub.Next(), ++index) { @@ -1151,6 +1091,11 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan anArray->SetValue(1, id); anObj = GetEngine()->AddSubShape(theShape, anArray); aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; } // timer1.Stop(); @@ -1160,24 +1105,14 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnPlan // timer1.Reset(); // timer1.Start(); - // The GetShapesOnPlane() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); - // Make a Python command - TCollection_AsciiString anEntry, aDescr - ("\nlistShapesOnPlane = IShapesOperations.GetShapesOnPlane("); - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + TCollection_AsciiString(theShapeType) + ","; - TDF_Tool::Entry(theAx1->GetEntry(), anEntry); - aDescr += anEntry + ","; - aDescr += TCollection_AsciiString(theState) + ")"; + anAsciiList.Trunc(anAsciiList.Length() - 1); - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr += aDescr; - aFunction->SetDescription(anOldDescr); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); -// timer1.Stop(); -// timer1.Show(); + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnPlane(" << theShape << ", " + << theShapeType << ", " << theAx1 << ", " << theState << ")"; SetErrorCode(OK); return aSeq; @@ -1285,6 +1220,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli Handle(GEOM_Object) anObj; Handle(TColStd_HArray1OfInteger) anArray; Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + TCollection_AsciiString anAsciiList, anEntry; TopTools_ListIteratorOfListOfShape itSub (listSS); for (int index = 1; itSub.More(); itSub.Next(), ++index) { @@ -1293,24 +1229,21 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnCyli anArray->SetValue(1, id); anObj = GetEngine()->AddSubShape(theShape, anArray); aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; } - // The GetShapesOnCylinder() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); - // Make a Python command - TCollection_AsciiString anEntry, aDescr - ("\nlistShapesOnCylinder = IShapesOperations.GetShapesOnCylinder("); - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + TCollection_AsciiString(theShapeType) + ","; - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += anEntry + ","; - aDescr += TCollection_AsciiString(theRadius) + ","; - aDescr += TCollection_AsciiString(theState) + ")"; + anAsciiList.Trunc(anAsciiList.Length() - 1); - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr += aDescr; - aFunction->SetDescription(anOldDescr); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << theShapeType + << ", " << theAxis << ", " << theRadius << ", " << theState << ")"; SetErrorCode(OK); return aSeq; @@ -1403,6 +1336,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphe Handle(GEOM_Object) anObj; Handle(TColStd_HArray1OfInteger) anArray; Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + TCollection_AsciiString anAsciiList, anEntry; TopTools_ListIteratorOfListOfShape itSub (listSS); for (int index = 1; itSub.More(); itSub.Next(), ++index) { @@ -1411,29 +1345,25 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphe anArray->SetValue(1, id); anObj = GetEngine()->AddSubShape(theShape, anArray); aSeq->Append(anObj); + + // for python command + TDF_Tool::Entry(anObj->GetEntry(), anEntry); + anAsciiList += anEntry; + anAsciiList += ","; } - // The GetShapesOnSphere() doesn't change object so no new function is required. - Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); - // Make a Python command - TCollection_AsciiString anEntry, aDescr - ("\nlistShapesOnSphere = IShapesOperations.GetShapesOnSphere("); - TDF_Tool::Entry(theShape->GetEntry(), anEntry); - aDescr += anEntry + TCollection_AsciiString(theShapeType) + ","; - TDF_Tool::Entry(theCenter->GetEntry(), anEntry); - aDescr += anEntry + ","; - aDescr += TCollection_AsciiString(theRadius) + ","; - aDescr += TCollection_AsciiString(theState) + ")"; + anAsciiList.Trunc(anAsciiList.Length() - 1); - TCollection_AsciiString anOldDescr = aFunction->GetDescription(); - anOldDescr += aDescr; - aFunction->SetDescription(anOldDescr); + Handle(GEOM_Function) aFunction = anObj->GetLastFunction(); + + GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString() + << "] = geompy.GetShapesOnSphere(" << theShape << ", " << theShapeType + << ", " << theCenter << ", " << theRadius << ", " << theState << ")"; SetErrorCode(OK); return aSeq; } - //============================================================================= /*! * GetShapesOnPlaneIDs @@ -1908,17 +1838,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aResult->GetEntry(), anEntry); - aDescr += anEntry; - aDescr += " = IShapesOperations.GetInPlace("; - TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry); - aDescr += anEntry + ","; - TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry); - aDescr += anEntry + ")"; - Handle(GEOM_Function) aFunction = aResult->GetFunction(1); - aFunction->SetDescription(aDescr); + + GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetInPlace(" + << theShapeWhere << ", " << theShapeWhat << ")"; SetErrorCode(OK); return aResult; diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index d7e2397c0..5b287e669 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -12,6 +12,7 @@ using namespace std; #include #include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" #include "GEOMImpl_TranslateDriver.hxx" #include "GEOMImpl_MirrorDriver.hxx" @@ -101,15 +102,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPoints } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateTwoPoints("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateTwoPoints(" + << theObject << ", " << thePoint1 << ", " << thePoint2 << ")"; SetErrorCode(OK); return theObject; @@ -158,14 +152,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZ } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZ("); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theX)+", "); - aDescr += (TCollection_AsciiString(theY)+", "); - aDescr += (TCollection_AsciiString(theZ)+")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateDXDYDZ(" + << theObject << ", " << theX << ", " << theY << ", " << theZ << ")"; SetErrorCode(OK); return theObject; @@ -217,16 +205,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateTwoPointsCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint1->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint2->GetEntry(), anEntry); - aDescr += (anEntry+")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationTwoPoints(" + << theObject << ", " << thePoint1 << ", " << thePoint2 << ")"; SetErrorCode(OK); return aCopy; @@ -277,15 +257,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theX)+", "); - aDescr += (TCollection_AsciiString(theY)+", "); - aDescr += (TCollection_AsciiString(theZ)+")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslation(" + << theObject << ", " << theX << ", " << theY << ", " << theZ << ")"; SetErrorCode(OK); return aCopy; @@ -336,13 +309,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVector } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateVector("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVector->GetEntry(), anEntry); - aDescr += (anEntry+") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVector(" + << theObject << ", " << theVector << ")"; SetErrorCode(OK); return theObject; @@ -392,14 +360,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.TranslateVectorCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVector->GetEntry(), anEntry); - aDescr += (anEntry+")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeTranslationVector(" + << theObject << ", " << theVector << ")"; SetErrorCode(OK); return aCopy; @@ -451,17 +413,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Translate1D("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVector->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theStep)+", "); - aDescr += (TCollection_AsciiString(theNbTimes)+") "); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation1D(" + << theObject << ", " << theVector << ", " << theStep << ", " << theNbTimes << ")"; SetErrorCode(OK); return aCopy; @@ -520,21 +473,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Translate2D("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theVector->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theStep1)+", "); - aDescr += (TCollection_AsciiString(theNbTimes2)+", "); - TDF_Tool::Entry(theVector2->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theStep2)+", "); - aDescr += (TCollection_AsciiString(theNbTimes2)+") "); - - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTranslation2D(" + << theObject << ", " << theVector << ", " << theStep1 << ", " << theNbTimes1 + << ", " << theVector2 << ", " << theStep2 << ", " << theNbTimes2 << ")"; SetErrorCode(OK); return aCopy; @@ -585,13 +526,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlane } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPlane("); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(thePlane->GetEntry(), anEntry); - aDescr += (anEntry + ") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPlane(" + << theObject << ", " << thePlane << ")"; SetErrorCode(OK); return theObject; @@ -640,14 +576,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPlaneCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(thePlane->GetEntry(), anEntry); - aDescr += (anEntry + ")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPlane(" + << theObject << ", " << thePlane << ")"; SetErrorCode(OK); return aCopy; @@ -697,13 +627,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPoint } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPoint("); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += (anEntry + ") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPoint(" + << theObject << ", " << thePoint << ")"; SetErrorCode(OK); return NULL; @@ -752,14 +677,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorPointCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += (anEntry + ")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByPoint(" + << theObject << ", " << thePoint << ")"; SetErrorCode(OK); return aCopy; @@ -809,13 +728,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxis } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorAxis("); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry + ") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorAxis(" + << theObject << ", " << theAxis << ")"; SetErrorCode(OK); return NULL; @@ -864,14 +778,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry + " = ITransformOperations.MirrorAxisCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry + ", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry + ")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMirrorByAxis(" + << theObject << ", " << theAxis << ")"; SetErrorCode(OK); return aCopy; @@ -919,12 +827,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.OffsetShape("); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theOffset)+")"; - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.OffsetShape(" + << theObject << ", " << theOffset << ")"; SetErrorCode(OK); return theObject; @@ -974,13 +878,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.OffsetShapeCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theOffset)+")"; - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset(" + << theObject << ", " << theOffset << ")"; SetErrorCode(OK); return aCopy; @@ -1032,14 +931,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShape } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.ScaleShape("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theFactor)+")"; - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.ScaleShape(" + << theObject << ", " << thePoint << ", " << theFactor << ")"; SetErrorCode(OK); return theObject; @@ -1090,15 +983,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.ScaleShapeCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(thePoint->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += TCollection_AsciiString(theFactor)+")"; - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeScaleTransform(" + << theObject << ", " << thePoint << ", " << theFactor << ")"; SetErrorCode(OK); return aCopy; @@ -1150,15 +1036,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShape } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.PositionShape("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theEndLCS->GetEntry(), anEntry); - aDescr += (anEntry+") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionShape(" + << theObject << ", " << theStartLCS << ", " << theEndLCS << ")"; SetErrorCode(OK); return theObject; @@ -1209,16 +1088,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(aCopy->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.PositionShapeCopy("); - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theEndLCS->GetEntry(), anEntry); - aDescr += (anEntry+")"); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePosition(" + << theObject << ", " << theStartLCS << ", " << theEndLCS << ")"; SetErrorCode(OK); return aCopy; @@ -1270,14 +1141,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Rotate("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theAngle)+") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.Rotate(" << theObject + << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; SetErrorCode(OK); return theObject; @@ -1326,14 +1191,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.RotateCopy("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theAngle)+") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeRotation(" << theObject + << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)"; SetErrorCode(OK); return aCopy; @@ -1384,14 +1243,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Rotate1D("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theNbTimes)+") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1D(" + << theObject << ", " << theAxis << ", " << theNbTimes << ")"; SetErrorCode(OK); return aCopy; @@ -1448,17 +1301,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) } //Make a Python command - TCollection_AsciiString anEntry, aDescr; - TDF_Tool::Entry(theObject->GetEntry(), anEntry); - aDescr += (anEntry+" = ITransformOperations.Rotate2D("); - aDescr += (anEntry+", "); - TDF_Tool::Entry(theAxis->GetEntry(), anEntry); - aDescr += (anEntry+", "); - aDescr += (TCollection_AsciiString(theAngle)+", "); - aDescr += (TCollection_AsciiString(theNbTimes1)+", "); - aDescr += (TCollection_AsciiString(theStep)+", "); - aDescr += (TCollection_AsciiString(theNbTimes2)+") "); - aFunction->SetDescription(aDescr); + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2D(" + << theObject << ", " << theAxis << ", " << theAngle << ", " + << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")"; SetErrorCode(OK); return aCopy; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 2c6f35d7c..594d197d6 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -33,21 +33,24 @@ #include "GEOM_Operation.h" #include "GEOM_Displayer.h" -#include "QAD_Desktop.h" -#include "QAD_FileDlg.h" -#include "QAD_Tools.h" -#include "QAD_MessageBox.h" -#include "QAD_RightFrame.h" -#include "QAD_WaitCursor.h" -#include "SALOMEGUI_Desktop.h" - -#include "OCCViewer_Viewer3d.h" -#include "VTKViewer_ViewFrame.h" -#include "VTKViewer_RenderWindowInteractor.h" +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//#include "OCCViewer_Viewer3d.h" +//#include "VTKViewer_ViewWindow.h" +//#include "VTKViewer_RenderWindowInteractor.h" #include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOMEGUI_ImportOperation.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +//#include "SALOMEGUI_ImportOperation.h" +//#include "SALOMEGUI_QtCatchCorbaException.hxx" #include #include @@ -56,10 +59,15 @@ using namespace std; -GEOMToolsGUI* GEOMToolsGUI::myGUIObject = 0; - typedef QMap FilterMap; +#include "SALOMEDSClient.hxx" +#include "SALOMEDS_SObject.hxx" +#include "SALOMEDS_Study.hxx" + + + + //======================================================================= // function : getFileName // purpose : Selection of a file name for Import/Export. Returns also @@ -77,7 +85,7 @@ static QString getFileName( QWidget* parent, for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) filters.push_back( it.key() ); - QAD_FileDlg* fd = new QAD_FileDlg( parent, open, true, true ); + SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true ); if ( !caption.isEmpty() ) fd->setCaption( caption ); @@ -98,24 +106,12 @@ static QString getFileName( QWidget* parent, return filename; } -//======================================================================= -// function : GetGEOMToolsGUI() -// purpose : Get the only GEOMToolsGUI object [ static ] -//======================================================================= -GEOMToolsGUI* GEOMToolsGUI::GetGEOMToolsGUI() -{ - if ( myGUIObject == 0 ) { - // init GEOMToolsGUI only once - myGUIObject = new GEOMToolsGUI(); - } - return myGUIObject; -} - //======================================================================= // function : GEOMToolsGUI() // purpose : Constructor //======================================================================= -GEOMToolsGUI::GEOMToolsGUI() : GEOMGUI() +GEOMToolsGUI::GEOMToolsGUI( GeometryGUI* parent ) +: GEOMGUI( parent ) { } @@ -133,12 +129,10 @@ GEOMToolsGUI::~GEOMToolsGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); switch (theCommandID) { case 31: // COPY @@ -227,7 +221,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } default: { - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } } @@ -241,15 +235,16 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //=============================================================================== void GEOMToolsGUI::OnEditDelete() { +/* SALOME_Selection* Sel = SALOME_Selection::Selection( QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); if ( Sel->IObjectCount() == 0 ) return; - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - bool aLocked = aStudy->GetProperties()->IsLocked(); + bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), QObject::tr("WRN_WARNING"), @@ -279,8 +274,7 @@ void GEOMToolsGUI::OnEditDelete() int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); Standard_Boolean found; - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; + _PTR(GenericAttribute) anAttr; SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); @@ -297,34 +291,35 @@ void GEOMToolsGUI::OnEditDelete() if ( !IObject->hasEntry() ) continue; - SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() ); + _PTR(SObject) SO ( aStudy->FindObjectID( IObject->getEntry() ) ); + _PTR(AttributeIOR) anIOR; - /* Erase child graphical objects */ + // Erase child graphical objects - SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator( SO ); + _PTR(ChildIterator) it ( aStudy->NewChildIterator( SO ) ); for ( ; it->More();it->Next() ) { - SALOMEDS::SObject_var CSO = it->Value(); + _PTR(SObject) CSO ( it->Value() ); if ( CSO->FindAttribute( anAttr, "AttributeIOR" ) ) { - anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr ); + anIOR = anAttr; // Delete child( s ) shape in Client : - const TCollection_AsciiString ASCior( anIOR->Value() ) ; + const TCollection_AsciiString ASCior( (char*)anIOR->Value().c_str() ) ; GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCior ); for ( int i = 0; i < nbSf; i++ ) { - GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( CSO->GetObject() ); + GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( dynamic_cast(CSO.get())->GetObject() ); if ( !aGeomObj->_is_nil() ) GEOM_Displayer().Erase( aGeomObj, true ); } } } - /* Erase main graphical object */ + // Erase main graphical object for ( int i = 0; i < nbSf; i++ ) { @@ -332,24 +327,24 @@ void GEOMToolsGUI::OnEditDelete() GEOM_Displayer().Erase( IObject, true ); } - /* Delete main shape in Client : */ + // Delete main shape in Client : if ( SO->FindAttribute( anAttr, "AttributeIOR" ) ) { - anIOR = SALOMEDS::AttributeIOR::_narrow( anAttr ); - const TCollection_AsciiString ASCIor( anIOR->Value() ) ; + anIOR = anAttr; + const TCollection_AsciiString ASCIor( (char*)anIOR->Value().c_str() ) ; GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( ASCIor ); } - /* Erase objects in Study */ + // Erase objects in Study - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - if ( !obj->_is_nil() ) + _PTR(SObject) obj ( aStudy->FindObjectID( IObject->getEntry() ) ); + if ( obj ) { - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder()); aStudyBuilder->RemoveObject( obj ); - GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow( obj->GetObject() ); + GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(dynamic_cast(obj.get())->GetObject()); if ( !aGeomObj->_is_nil() ) GeometryGUI::GetGeomGUI()->GetGeomGen()->RemoveObject( aGeomObj ); @@ -362,9 +357,10 @@ void GEOMToolsGUI::OnEditDelete() else op->abort(); - /* Clear any previous selection */ + // Clear any previous selection Sel->ClearIObjects(); QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + */ } @@ -410,19 +406,35 @@ void GEOMToolsGUI::OnEditCopy() //===================================================================================== bool GEOMToolsGUI::Import() { - QAD_Study* aDoc = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = aDoc->getStudyDocument(); + SUIT_Application* app = getGeometryGUI()->getApp(); + if (! app) return false; + + SalomeApp_Study* stud = dynamic_cast ( app->activeStudy() ); + if ( !stud ) { + cout << "FAILED to cast active study to SalomeApp_Study" << endl; + return false; + } + _PTR(Study) aStudy = stud->studyDS(); - bool aLocked = aStudy->GetProperties()->IsLocked(); + bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { - QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warn1 ( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return false; } - GEOM::GEOM_IInsertOperations_var aInsOp = GeometryGUI::GetGeomGUI()->GetGeomGen()->GetIInsertOperations( aStudy->StudyId() ); + GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen(); + if ( CORBA::is_nil( eng ) ) { + SUIT_MessageBox::error1( app->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr( "GEOM Engine is not started" ), + QObject::tr("BUT_OK") ); + return false; + } + + GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() ); if ( aInsOp->_is_nil() ) return false; @@ -432,19 +444,21 @@ bool GEOMToolsGUI::Import() FilterMap aMap; GEOM::string_array_var aFormats, aPatterns; aInsOp->ImportTranslators( aFormats, aPatterns ); + for ( int i = 0, n = aFormats->length(); i < n; i++ ) aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] ); QString fileType; - QString file = getFileName(QAD_Application::getDesktop(), "", aMap, tr("GEOM_MEN_IMPORT"), true, fileType ); + QString file = getFileName(app->desktop(), "", aMap, tr("GEOM_MEN_IMPORT"), true, fileType ); if( file.isEmpty() || fileType.isEmpty() ) return false; - GEOM_Operation* anOp = new GEOM_Operation( aDoc, aInsOp.in() ); + GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() ); try { - QAD_WaitCursor wc; - QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) ); + SUIT_OverrideCursor wc; + + app->putInfo( tr("GEOM_PRP_LOADING").arg(SUIT_Tools::file( file, /*withExten=*/true )) ); anOp->start(); @@ -452,25 +466,27 @@ bool GEOMToolsGUI::Import() if ( !anObj->_is_nil() && aInsOp->IsDone() ) { anObj->SetName( GEOMBase::GetDefaultName( QObject::tr( "GEOM_IMPORT" ) ).latin1() ); - QString aPublishObjName = GEOMBase::GetDefaultName( QAD_Tools::getFileNameFromPath( file )); - GeometryGUI::GetGeomGUI()->GetGeomGen()->PublishInStudy( - aStudy, SALOMEDS::SObject::_nil(), anObj, aPublishObjName ); + QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( file, /*withExten=*/true )); + GeometryGUI::GetGeomGen()->PublishInStudy(dynamic_cast(aStudy.get())->GetStudy(), + SALOMEDS::SObject::_nil(), + anObj, + aPublishObjName ); - GEOM_Displayer().Display( anObj.in() ); + GEOM_Displayer( stud ).Display( anObj.in() ); - anOp->finish(); + anOp->commit(); } else { anOp->abort(); - wc.stop(); - QAD_MessageBox::error1( QAD_Application::getDesktop(), - QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), - QObject::tr("BUT_OK") ); + wc.suspend(); + SUIT_MessageBox::error1( app->desktop(), + QObject::tr( "GEOM_ERROR" ), + QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), + QObject::tr("BUT_OK") ); } } - catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); + catch( const SALOME::SALOME_Exception& S_ex ) { + //QtCatchCorbaException(S_ex); anOp->abort(); return false; } @@ -485,6 +501,7 @@ bool GEOMToolsGUI::Import() //===================================================================================== bool GEOMToolsGUI::Export() { +/* SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); GEOM::GEOM_IInsertOperations_var aInsOp = GeometryGUI::GetGeomGUI()->GetGeomGen()->GetIInsertOperations( aStudy->StudyId() ); if ( aInsOp->_is_nil() ) @@ -537,7 +554,7 @@ bool GEOMToolsGUI::Export() QtCatchCorbaException(S_ex); } } - +*/ return true; } @@ -547,8 +564,8 @@ bool GEOMToolsGUI::Export() //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return GEOMToolsGUI::GetGEOMToolsGUI(); + return new GEOMToolsGUI( parent ); } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 4927db5d5..626a70cc7 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -37,16 +37,11 @@ //================================================================================= class GEOMToolsGUI : public GEOMGUI { -protected: - GEOMToolsGUI(); // hide constructor to avoid direct creation - public : + GEOMToolsGUI( GeometryGUI* ); // hide constructor to avoid direct creation ~GEOMToolsGUI(); - // Get the only GEOMToolsGUI object - static GEOMToolsGUI* GetGEOMToolsGUI(); - - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); private: /* Import and export topology methods */ @@ -68,9 +63,6 @@ private: void OnTransparency(); void OnNbIsos(); void OnOpen(); - -private: - static GEOMToolsGUI* myGUIObject; // the only GEOMToolsGUI object }; #endif diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 499106347..1f455c67b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -30,22 +30,28 @@ #include "GeometryGUI.h" #include "GEOM_Actor.h" #include "GEOMBase.h" +#include "GEOMToolsGUI_TransparencyDlg.h" +#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement + +#include +#include + +#include +#include +#include -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "QAD_FileDlg.h" -#include "QAD_PyEditor.h" -#include "QAD_RightFrame.h" -#include "QAD_MessageBox.h" -#include "SALOMEGUI_NameDlg.h" +#include +#include -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include "VTKViewer_ViewFrame.h" -#include "VTKViewer_RenderWindowInteractor.h" +#include +#include +#include +#include +#include +#include -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" +#include +#include #include #include @@ -64,106 +70,99 @@ #include #include -#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement -#include "GEOMToolsGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement - #include "utilities.h" using namespace std; +#include "SALOMEDSClient.hxx" +#include "SALOMEDS_Study.hxx" + + + void GEOMToolsGUI::OnSettingsColor() { + SUIT_Session* sess = SUIT_Session::session(); + SUIT_ResourceMgr* resMgr = sess->resourceMgr(); + SUIT_Desktop* desk = sess->activeApplication()->desktop(); + + QColor anInitColor = resMgr->colorValue( "Geometry:SettingsShadingColor", QColor( "yellow" ) ); - QString aSCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); - QString aSCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); - QString aSCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); - QColor anInitColor; - if(!aSCr.isEmpty() && !aSCg.isEmpty() && !aSCb.isEmpty()) { - anInitColor = QColor (aSCr.toInt(), aSCg.toInt(), aSCb.toInt()); - } - else { - Quantity_Color aDefColor = Quantity_Color(); - anInitColor = - QColor ((int)( aDefColor.Red() * 255.0 ), (int)( aDefColor.Green() * 255.0 ), (int)( aDefColor.Blue() * 255.0 ) ); - } - - QColor aDialogColor = QColorDialog::getColor(anInitColor, QAD_Application::getDesktop()); - if(aDialogColor.isValid()) { - QApplication::setOverrideCursor(Qt::waitCursor); - - if( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC && - QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK ) + QColor aDialogColor = QColorDialog::getColor(anInitColor, desk ); + if( aDialogColor.isValid() ) + { + QString type = desk->activeWindow()->getViewManager()->getType(); + if( type != OCCViewer_Viewer::Type() && type != VTKViewer_Viewer::Type() ) MESSAGE("Settings Color is not supported for current Viewer"); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", aDialogColor.red()); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", aDialogColor.green()); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", aDialogColor.blue()); - QApplication::restoreOverrideCursor(); + resMgr->setValue( "Geometry:SettingsShadingColor", aDialogColor ); } } void GEOMToolsGUI::OnSettingsIsos() { - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) +/* + SUIT_Session* sess = SUIT_Session::session(); + SUIT_ResourceMgr* resMgr = sess->resourceMgr(); + SUIT_Desktop* desk = sess->activeApplication()->desktop(); + + SUIT_ViewManager* vman = desk->activeWindow()->getViewManager(); + QString type = vman->getType(); + + if ( type != OCCViewer_Viewer::Type() ) return; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + OCCViewer_Viewer* vm = (OCCViewer_Viewer*)vman->getViewModel(); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); - QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); + int IsoU = resMgr->integerValue( "Geometry:SettingsIsoU", 1 ); + int IsoV = resMgr->integerValue( "Geometry:SettingsIsoV", 1 ); - if(!IsoU.isEmpty()) - ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); - else - IsoU = "1"; - if (!IsoV.isEmpty()) - ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); - else - IsoV = "1"; + ic->DefaultDrawer()->UIsoAspect()->SetNumber( IsoU ); + ic->DefaultDrawer()->VIsoAspect()->SetNumber( IsoV ); - GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); - int UIso = IsoU.toInt(); - int VIso = IsoV.toInt(); + GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(desk, tr("GEOM_MEN_ISOS"), TRUE); - NbIsosDlg->SpinBoxU->setValue(UIso); - NbIsosDlg->SpinBoxV->setValue(VIso); + NbIsosDlg->SpinBoxU->setValue(IsoU); + NbIsosDlg->SpinBoxV->setValue(IsoV); if(NbIsosDlg->exec()) { - UIso = NbIsosDlg->SpinBoxU->text().toInt(); - VIso = NbIsosDlg->SpinBoxV->text().toInt(); + IsoU = NbIsosDlg->SpinBoxU->text().toInt(); + IsoV = NbIsosDlg->SpinBoxV->text().toInt(); ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso); ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso); - QAD_CONFIG->addSetting("Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text()); /* text format */ - QAD_CONFIG->addSetting("Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text()); /* text format */ + resMgr->setValue("Geometry:SettingsIsoU", isoU); + resMgr->setValue("Geometry:SettingsIsoV", isoV); } +*/ } void GEOMToolsGUI::OnSettingsStep() { - QString step = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - if(step.isEmpty()) - step = "100.0"; + SUIT_Session* sess = SUIT_Session::session(); + SUIT_ResourceMgr* resMgr = sess->resourceMgr(); + + double step = resMgr->doubleValue( "Geometry:SettingsGeomStep", 100. ); Standard_Boolean res = false; double dd = GEOMBase::Parameter(res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3); if(res) { - QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", QString("%1").arg(dd)); + resMgr->setValue( "Geometry:SettingsGeomStep", dd ); /* Emit signal to GeometryGUI_SpinBoxes */ - GeometryGUI::GetGeomGUI()->EmitSignalDefaultStepValueChanged(dd); + getGeometryGUI()->EmitSignalDefaultStepValueChanged( dd ); } else - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + sess->activeApplication()->putInfo(tr("GEOM_PRP_ABORT")); } void GEOMToolsGUI::OnRename() { +/* SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - bool aLocked = aStudy->GetProperties()->IsLocked(); + bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), QObject::tr("WRN_WARNING"), @@ -176,14 +175,13 @@ void GEOMToolsGUI::OnRename() for(; It.More(); It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - if(!obj->_is_nil()) { + _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); + _PTR(GenericAttribute) anAttr; + if(obj) { if(obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); + _PTR(AttributeName) aName (anAttr); - QString nm = QString(aName->Value()); + QString nm = QString(aName->Value().c_str()); nm = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), nm); if(!nm.isEmpty()) { QApplication::setOverrideCursor(Qt::waitCursor); @@ -193,19 +191,23 @@ void GEOMToolsGUI::OnRename() } } } +*/ } void GEOMToolsGUI::OnCheckGeometry() { +/* QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); PyEditor->setText("from GEOM_usinggeom import *\n"); PyEditor->handleReturn(); +*/ } void GEOMToolsGUI::OnLoadScript() { - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - bool aLocked = aStudy->GetProperties()->IsLocked(); +/* + _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + bool aLocked = (_PTR(AttributeStudyProperties)(aStudy->GetProperties())->IsLocked(); if ( aLocked ) { QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), QObject::tr("WRN_WARNING"), @@ -230,123 +232,102 @@ void GEOMToolsGUI::OnLoadScript() PyEditor->handleReturn(); } QApplication::restoreOverrideCursor(); +*/ } void GEOMToolsGUI::OnColor() { - SALOME_Selection* Sel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + SALOME_ListIO selected; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( aSelMgr ) { + aSelMgr->selectedObjects( selected ); + if ( !selected.IsEmpty() ) { + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool isVTK = ( window && window->getViewManager()->getType() == VTKViewer_Viewer::Type() ); + if ( isVTK ) { + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + SVTK_RenderWindowInteractor* rwi = vtkVW->getRWInteractor(); + QColor initcolor = rwi->GetColor( selected.First() ); + QColor c = QColorDialog::getColor( QColor(), app->desktop() ); + if ( c.isValid() ) { + SUIT_OverrideCursor(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + rwi->SetColor( It.Value(), c ); + } + } + } // if ( isVTK ) + else if ( isOCC ) { + Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() ); + if ( !io.IsNull() ) { + Quantity_Color aColor; + io->Color( aColor ); + QColor initcolor( (int)( aColor.Red() * 255.0 ), (int)( aColor.Green() * 255.0 ), (int)( aColor.Blue() * 255.0 ) ); + QColor c = QColorDialog::getColor( initcolor, app->desktop() ); + if ( c.isValid() ) { + SUIT_OverrideCursor(); + aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + io = GEOMBase::GetAIS( It.Value(), true ); + if ( !io.IsNull() ) { + io->SetColor( aColor ); + if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) + Handle(GEOM_AISShape)::DownCast( io )->SetShadingColor( aColor ); - if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) - { - VTKViewer_RenderWindowInteractor* myRenderInter = - ( (VTKViewer_ViewFrame*)QAD_Application::getDesktop()-> - getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject(); - if ( !FirstIOS.IsNull() ) - { - QColor initcolor = myRenderInter->GetColor(FirstIOS); - QColor c = QColorDialog::getColor( initcolor, QAD_Application::getDesktop() ); - - if ( c.isValid() ) - { - QApplication::setOverrideCursor( Qt::waitCursor ); - for ( ;It.More();It.Next() ) - { - Handle(SALOME_InteractiveObject) IOS = It.Value(); - myRenderInter->SetColor(IOS,c); - } - } - QApplication::restoreOverrideCursor(); - } - } - else if( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) - { - Handle(AIS_InteractiveObject) anIO = GEOMBase::GetAIS( Sel->firstIObject() ); - if ( !anIO.IsNull() ) - { - Quantity_Color aColor; - anIO->Color( aColor ); - - QColor qColor = QColorDialog::getColor( QColor( (int)( aColor.Red() * 255.0 ), - (int)( aColor.Green() * 255.0 ), - (int)( aColor.Blue() * 255.0 ) ), - QAD_Application::getDesktop()); - - if ( qColor.isValid() ) - { - aColor = Quantity_Color( qColor.red() / 255., - qColor.green() / 255., - qColor.blue() / 255., - Quantity_TOC_RGB ); - - QApplication::setOverrideCursor( Qt::waitCursor ); - - SALOME_ListIteratorOfListIO anIter ( Sel->StoredIObjects() ); - for( ;anIter.More();anIter.Next() ) - { - Handle(SALOME_InteractiveObject) IObject = anIter.Value(); - Handle(AIS_InteractiveObject) anIO = GEOMBase::GetAIS( IObject, true ); - if ( !anIO.IsNull() ) - { - anIO->SetColor( aColor ); - - if ( anIO->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) - Handle(GEOM_AISShape)::DownCast( anIO )->SetShadingColor( aColor ); - - anIO->Redisplay( Standard_True ); - } - } - } + io->Redisplay( Standard_True ); + } + } + } // if c.isValid() + } // first IO is not null + } // if ( isOCC ) + } // if ( selection not empty ) } } - - QApplication::restoreOverrideCursor(); } void GEOMToolsGUI::OnTransparency() { - Handle(AIS_InteractiveContext) ic; - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - ic = v3d->getAISContext(); - } - new GEOMBase_TransparencyDlg(QAD_Application::getDesktop(), "", Sel, ic); + GEOMToolsGUI_TransparencyDlg dlg( SUIT_Session::session()->activeApplication()->desktop() ); + dlg.exec(); } void GEOMToolsGUI::OnNbIsos() { - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + + if ( !isOCC ) return; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + Handle (AIS_InteractiveContext) ic = vm->getAISContext(); ic->InitCurrent(); - if(ic->MoreCurrent()) { + if ( ic->MoreCurrent() ) { Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); int UIso = CurDrawer->UIsoAspect()->Number(); int VIso = CurDrawer->VIsoAspect()->Number(); - GEOMBase_NbIsosDlg * NbIsosDlg = - new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + GEOMToolsGUI_NbIsosDlg * NbIsosDlg = + new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); - NbIsosDlg->SpinBoxU->setValue( UIso ); - NbIsosDlg->SpinBoxV->setValue( VIso ); + NbIsosDlg->setU( UIso ); + NbIsosDlg->setV( VIso ); - if(NbIsosDlg->exec()) { - QApplication::setOverrideCursor(Qt::waitCursor); + if ( NbIsosDlg->exec() ) { + SUIT_OverrideCursor(); for(; ic->MoreCurrent(); ic->NextCurrent()) { CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - int nbUIso = NbIsosDlg->SpinBoxU->text().toInt(); - int nbVIso = NbIsosDlg->SpinBoxV->text().toInt(); + int nbUIso = NbIsosDlg->getU(); + int nbVIso = NbIsosDlg->getV(); CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) ); CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) ); @@ -356,31 +337,31 @@ void GEOMToolsGUI::OnNbIsos() } } } - QApplication::restoreOverrideCursor(); } void GEOMToolsGUI::OnOpen() { +/* SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + _PTR(Study) aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); Handle(SALOME_InteractiveObject) anIObject; for(;It.More();It.Next()) { anIObject = It.Value(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); - SALOMEDS::AttributePersistentRef_var aPersist; - SALOMEDS::AttributeIOR_var anIOR; - if(!obj->_is_nil()) { + _PTR(SObject) obj ( aStudy->FindObjectID(anIObject->getEntry()) ); + _PTR(AttributePersistentRef) aPersist; + _PTR(AttributeIOR) anIOR; + if(obj) { // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(obj); - SALOMEDS::GenericAttribute_var anAttr; + _PTR(ChildIterator) anIter ( aStudy->NewChildIterator() ); + _PTR(GenericAttribute) anAttr; bool useSubItems = false; while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); + _PTR(SObject) subobj ( anIter->Value() ); if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) { useSubItems = true; - obj = subobj; + obj = subobj; } else anIter->Next(); @@ -390,11 +371,11 @@ void GEOMToolsGUI::OnOpen() while(useSubItems?anIter->More():!anAttr->_is_nil()) { if(!obj->FindAttribute(anAttr, "AttributeIOR") && obj->FindAttribute(anAttr, "AttributePersistentRef")) { - SALOMEDS::SComponent_var FComp = obj->GetFatherComponent(); - if (!CORBA::is_nil(FComp)) { + _PTR(SComponent) FComp ( obj->GetFatherComponent() ); + if (FComp) { if (FComp->FindAttribute(anAttr, "AttributeName")) { - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - QString compName = QAD_Application::getDesktop()->getComponentName(aName->Value()); + _PTR(AttributeName) aName ( anAttr ); + QString compName = QAD_Application::getDesktop()->getComponentName(aName->Value().c_str()); // parent->loadComponentData(parent->getComponentName(aName->Value())); Engines::Component_var comp ; if ( compName.compare("SUPERV") == 0 ) { @@ -409,7 +390,7 @@ void GEOMToolsGUI::OnOpen() if (!CORBA::is_nil(comp)) { SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); if (!CORBA::is_nil(driver)) { - SALOMEDS::StudyBuilder_var B = aStudy->NewBuilder(); + SALOMEDS::StudyBuilder_var B = dynamic_cast(aStudy.get())->GetStudy()->NewBuilder(); if (!CORBA::is_nil(B)) { B->LoadWith(FComp,driver); } else { @@ -441,11 +422,12 @@ void GEOMToolsGUI::OnOpen() } if(useSubItems) { anIter->Next(); - obj = anIter->Value(); + obj.reset( anIter->Value() ); } else - anAttr = SALOMEDS::GenericAttribute::_nil(); + anAttr = NULL; } } } +*/ } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx index 642b0d0f4..a3964d921 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -28,7 +28,8 @@ using namespace std; #include "GEOMToolsGUI_NbIsosDlg.h" -#include "QAD_Tools.h" + +#include #include #include @@ -37,18 +38,16 @@ using namespace std; #include //================================================================================= -// class : GEOMBase_NbIsosDlg() -// purpose : Constructs a GEOMBase_NbIsosDlg which is a child of 'parent', with the +// class : GEOMToolsGUI_NbIsosDlg() +// purpose : Constructs a GEOMToolsGUI_NbIsosDlg which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool modal, WFlags fl) - :QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_NbIsosDlg(QWidget* parent ) + :QDialog( parent, "GEOMToolsGUI_NbIsosDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - if( !name ) - setName("GEOMBase_NbIsosDlg"); - setCaption(name); + setCaption( tr( "GEOM_MEN_ISOS" ) ); setSizeGripEnabled(TRUE); QGridLayout* MyDialogLayout = new QGridLayout(this); MyDialogLayout->setSpacing(6); @@ -64,7 +63,7 @@ GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool m GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setMargin( 11 ); - TextLabel1 = new QLabel( GroupC1, "TextLabel1" ); + QLabel* TextLabel1 = new QLabel( GroupC1, "TextLabel1" ); TextLabel1->setText( tr( "GEOM_MEN_ISOU") ); GroupC1Layout->addWidget( TextLabel1, 0, 0 ); @@ -74,7 +73,7 @@ GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool m SpinBoxU->setValue( 1 ); GroupC1Layout->addWidget( SpinBoxU, 0, 1 ); - TextLabel2 = new QLabel( GroupC1, "TextLabel2" ); + QLabel* TextLabel2 = new QLabel( GroupC1, "TextLabel2" ); TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ; GroupC1Layout->addWidget( TextLabel2, 0, 2 ); @@ -94,7 +93,7 @@ GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool m GroupButtonsLayout->setSpacing( 6 ); GroupButtonsLayout->setMargin( 11 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" ); buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ; buttonOk->setAutoDefault( TRUE ); buttonOk->setDefault( TRUE ); @@ -102,7 +101,7 @@ GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool m GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + QPushButton* buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ; buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); @@ -117,15 +116,36 @@ GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool m connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); /* Move widget on the botton right corner of main widget */ - QAD_Tools::centerWidget(this, parent); + SUIT_Tools::centerWidget(this, parent); } //================================================================================= -// function : ~GEOMBase_NbIsosDlg() +// function : ~GEOMToolsGUI_NbIsosDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= -GEOMBase_NbIsosDlg::~GEOMBase_NbIsosDlg() +GEOMToolsGUI_NbIsosDlg::~GEOMToolsGUI_NbIsosDlg() { // no need to delete child widgets, Qt does it all for us } + +int GEOMToolsGUI_NbIsosDlg::getU() const +{ + return SpinBoxU->text().toInt(); +} + +int GEOMToolsGUI_NbIsosDlg::getV() const +{ + return SpinBoxV->text().toInt(); +} + +void GEOMToolsGUI_NbIsosDlg::setU( const int v ) +{ + SpinBoxU->setValue( v ); +} + +void GEOMToolsGUI_NbIsosDlg::setV( const int v ) +{ + SpinBoxV->setValue( v ); +} + diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h index 48c70c563..943dbdcde 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h @@ -21,39 +21,40 @@ // // // -// File : GEOMBase_NbIsosDlg.h +// File : GEOMToolsGUI_NbIsosDlg.h // Author : // Module : GEOM // $Header: -#ifndef GEOMBASE_NBISOSDLG_H -#define GEOMBASE_NBISOSDLG_H +#ifndef GEOMTOOLSGUI_NBISOSDLG_H +#define GEOMTOOLSGUI_NBISOSDLG_H #include -class QLabel; class QSpinBox; -class QPushButton; //================================================================================= -// class : GEOMBase_NbIsosDlg +// class : GEOMToolsGUI_NbIsosDlg // purpose : //================================================================================= -class GEOMBase_NbIsosDlg : public QDialog +class GEOMToolsGUI_NbIsosDlg : public QDialog { Q_OBJECT public: - GEOMBase_NbIsosDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); - ~GEOMBase_NbIsosDlg(); + GEOMToolsGUI_NbIsosDlg( QWidget* parent ); + ~GEOMToolsGUI_NbIsosDlg(); + + int getU() const; + int getV() const; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QLabel* TextLabel1; - QLabel* TextLabel2; + void setU( const int ); + void setV( const int ); + +private: QSpinBox* SpinBoxU; QSpinBox* SpinBoxV; }; -#endif // GEOMETRYGUI_NBISOSDLG_H +#endif // GEOMTOOLSGUI_NBISOSDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index f681d13c7..e1da9d6ac 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -27,13 +27,28 @@ using namespace std; #include "GEOMToolsGUI_TransparencyDlg.h" +#include "GEOMBase.h" +#include "GEOM_AISShape.hxx" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -46,8 +61,8 @@ using namespace std; #include #include -#include "VTKViewer_ViewFrame.h" -#include "VTKViewer_RenderWindowInteractor.h" +#include + //================================================================================= // class : GEOMBase_TransparencyDlg() @@ -57,17 +72,15 @@ using namespace std; // : WARNING : this dialog is modal ! // //================================================================================= -GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic, bool modal, WFlags fl) - :QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) + :QDialog( parent, "GEOMBase_TransparencyDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) { - if(!name) - setName("GEOMBase_TransparencyDlg"); resize(152, 107); setCaption(tr("GEOM_TRANSPARENCY_TITLE")); setSizeGripEnabled(TRUE); - GEOMBase_TransparencyDlgLayout = new QGridLayout(this); - GEOMBase_TransparencyDlgLayout->setSpacing(6); - GEOMBase_TransparencyDlgLayout->setMargin(11); + QGridLayout* lay = new QGridLayout(this); + lay->setSpacing(6); + lay->setMargin(11); /*************************************************************************/ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); @@ -79,7 +92,7 @@ GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* GroupButtonsLayout->setSpacing( 6 ); GroupButtonsLayout->setMargin( 11 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" ); buttonOk->setText( tr( "GEOM_BUT_OK" ) ); buttonOk->setAutoDefault( TRUE ); buttonOk->setDefault( TRUE ); @@ -97,47 +110,36 @@ GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setMargin( 11 ); - TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); + QLabel* TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) ); TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) ); GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); - TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" ); + QLabel* TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" ); TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) ); TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) ); GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); - Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" ); - Slider1->setMinimumSize( 300, 0 ); - Slider1->setTickmarks( QSlider::Left ); - GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 ); + mySlider = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "mySlider" ); + mySlider->setMinimumSize( 300, 0 ); + mySlider->setTickmarks( QSlider::Left ); + GroupC1Layout->addMultiCellWidget( mySlider, 1, 1, 0, 2 ); /*************************************************************************/ - GEOMBase_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); - GEOMBase_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); - - /* Initialisations */ - this->myGeomBase = new GEOMBase(); - this->myIc = ic; - this->mySel = Sel; - + lay->addWidget(GroupC1, 0, 0); + lay->addWidget(GroupButtons, 1, 0); + /* First call valueChanged() method for initialisation */ /* The default value of transparency will change with the selection */ - this->myFirstInit = true; -// Slider1->setMaxValue( 10 ); -// Slider1->setValue( 5 ) ; - this->ValueHasChanged(Slider1->value()); + myFirstInit = true; + // mySlider->setMaxValue( 10 ); + // mySlider->setValue( 5 ) ; + ValueHasChanged(mySlider->value()); // signals and slots connections : after ValueHasChanged() connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int))); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomBase->DefineDlgPosition(this, x, y); - this->move(x, y) ; - this->show() ; /* Displays this Dialog */ + connect(mySlider, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int))); } @@ -145,7 +147,7 @@ GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* // function : ~GEOMBase_TransparencyDlg() // purpose : //================================================================================= -GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg() +GEOMToolsGUI_TransparencyDlg::~GEOMToolsGUI_TransparencyDlg() { // no need to delete child widgets, Qt does it all for us } @@ -155,7 +157,7 @@ GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg() // function : ClickOnOk() // purpose : //======================================================================= -void GEOMBase_TransparencyDlg::ClickOnOk() +void GEOMToolsGUI_TransparencyDlg::ClickOnOk() { accept(); return; @@ -166,7 +168,7 @@ void GEOMBase_TransparencyDlg::ClickOnOk() // function : ClickOnClose() // purpose : //======================================================================= -void GEOMBase_TransparencyDlg::ClickOnClose() +void GEOMToolsGUI_TransparencyDlg::ClickOnClose() { accept(); return; @@ -178,68 +180,72 @@ void GEOMBase_TransparencyDlg::ClickOnClose() // purpose : Called when value of slider change // : or the first time as initilisation //================================================================================= -void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue) +void GEOMToolsGUI_TransparencyDlg::ValueHasChanged( int newValue ) { - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - // VTK - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); - - Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); - if(!FirstIOS.IsNull()) { - /* The first time as initialisation */ - if(this->myFirstInit) { - this->myFirstInit = false; - float transp = (myRenderInter->GetTransparency(FirstIOS))*10.0; - this->Slider1->setValue(int(transp)); - return; - } + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) + return; + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) + return; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) + return; + + Handle(SALOME_InteractiveObject) FirstIOS = selected.First(); + if ( FirstIOS.IsNull() ) + return; + + SUIT_ViewWindow* window = app->desktop()->activeWindow(); + bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + bool isVTK = ( window && window->getViewManager()->getType() == VTKViewer_Viewer::Type() ); + + if ( isVTK ) { + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); + if ( !vtkVW ) + return; + SVTK_RenderWindowInteractor* rwi = vtkVW->getRWInteractor(); + if ( myFirstInit ) { + myFirstInit = false; + float transp = (rwi->GetTransparency(FirstIOS))*10.0; + mySlider->setValue(int(transp)); + return; } - - QApplication::setOverrideCursor(Qt::waitCursor); - for(;It.More(); It.Next()) { - Handle(SALOME_InteractiveObject) IOS = It.Value(); - myRenderInter->SetTransparency(IOS, newValue/10.0); + + SUIT_OverrideCursor(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + rwi->SetTransparency( It.Value(), newValue/10.0 ); } - myRenderInter->Render(); - QApplication::restoreOverrideCursor(); - } - - else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - // OCC - SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); - Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); - if(!FirstIOS.IsNull()) { - - /* The first time as initialisation */ - if(this->myFirstInit) { - this->myFirstInit = false; - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(FirstIOS, found); - if(!found) - return; - float transp = (int(Shape->Transparency() * 10.0 + 0.001)); - this->Slider1->setValue(int(transp)); + rwi->Render(); + } // if ( isVTK ) + + else if ( isOCC ) { + GEOMBase* gb = new GEOMBase(); + Standard_Boolean found; + Handle(GEOM_AISShape) aisShape; + if ( myFirstInit ) { + myFirstInit = false; + aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, found ); + if( !found ) return; - } + float transp = (int(aisShape->Transparency() * 10.0 + 0.001)); + mySlider->setValue(int(transp)); + return; } - - QApplication::setOverrideCursor(Qt::waitCursor); - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - for(;It.More(); It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found); - if(!found) { - QApplication::restoreOverrideCursor(); - return; + + SUIT_OverrideCursor(); + OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); + if ( !vm ) + return; + Handle(AIS_InteractiveContext) ic = vm->getAISContext(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), found ); + if ( found ) { + ic->SetTransparency( aisShape, newValue / 10.0, false ); + ic->Redisplay( aisShape, Standard_False, Standard_True ); } - ic->SetTransparency(Shape, newValue / 10.0, false); - ic->Redisplay(Shape, Standard_False, Standard_True); - } + } // for... ic->UpdateCurrentViewer(); - } - QApplication::restoreOverrideCursor(); - return; + } // if ( isOCC ) } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h index 94889f6ef..e0dff7b5b 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -29,68 +29,32 @@ #ifndef DIALOGBOX_TRANSPARENCYDLG_H #define DIALOGBOX_TRANSPARENCYDLG_H -#include #include -/* #include "SALOME_Selection.h" */ -/* #include "SALOME_InteractiveObject.hxx" */ -/* #include "GEOM_InteractiveObject.hxx" */ -/* #include "GEOM_AISShape.hxx" */ - -#include "GEOMBase.h" - - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QFrame; -class QLabel; -class QPushButton; class QSlider; - - //================================================================================= // class : GEOMBase_TransparencyDlg // purpose : // : WARNING : that is a MODAL dialog. //================================================================================= -class GEOMBase_TransparencyDlg : public QDialog +class GEOMToolsGUI_TransparencyDlg : public QDialog { Q_OBJECT public: - GEOMBase_TransparencyDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - const Handle(AIS_InteractiveContext)& ic = 0, - bool modal = TRUE, - WFlags fl = 0 ); - - ~GEOMBase_TransparencyDlg(); + GEOMToolsGUI_TransparencyDlg( QWidget* parent ); + ~GEOMToolsGUI_TransparencyDlg(); private : + bool myFirstInit ; /* Inform for the first init */ + QSlider* mySlider; - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - bool myFirstInit ; /* Inform for the first init */ - SALOME_Selection* mySel; /* User selection */ - Handle(AIS_InteractiveContext) myIc ; /* Interactive context */ - - QPushButton* buttonOk; - QLabel* TextLabelOpaque; - QLabel* TextLabelTransparent; - QSlider* Slider1; - -public slots: - - void ClickOnOk(); - void ClickOnClose(); - void ValueHasChanged( int newValue ) ; +private slots: + void ClickOnOk(); + void ClickOnClose(); + void ValueHasChanged( int ) ; -protected: - QGridLayout* GEOMBase_TransparencyDlgLayout; - QHBoxLayout* Layout1; - QHBoxLayout* Layout2; }; #endif // DIALOGBOX_TRANSPARENCYDLG_H diff --git a/src/GEOMToolsGUI/Makefile.in b/src/GEOMToolsGUI/Makefile.in index 0614a6d83..29290e11d 100644 --- a/src/GEOMToolsGUI/Makefile.in +++ b/src/GEOMToolsGUI/Makefile.in @@ -42,23 +42,25 @@ EXPORT_HEADERS= LIB_SRC = GEOMToolsGUI.cxx \ GEOMToolsGUI_1.cxx \ - GEOMToolsGUI_NbIsosDlg.cxx \ - GEOMToolsGUI_TransparencyDlg.cxx + GEOMToolsGUI_TransparencyDlg.cxx \ + GEOMToolsGUI_NbIsosDlg.cxx -LIB_MOC = \ - GEOMToolsGUI.h \ - GEOMToolsGUI_NbIsosDlg.h \ - GEOMToolsGUI_TransparencyDlg.h +LIB_MOC = GEOMToolsGUI.h \ + GEOMToolsGUI_TransparencyDlg.h \ + GEOMToolsGUI_NbIsosDlg.h -LIB_CLIENT_IDL = SALOMEDS_Attributes.idl SALOME_GenericObj.idl +LIB_CLIENT_IDL = SALOMEDS_Attributes.idl \ + SALOME_GenericObj.idl \ + SALOME_Exception.idl \ + SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(GUI_ROOT_DIR)/include/salome +CXXFLAGS += $(BOOST_CPPFLAGS) -I$(KERNEL_ROOT_DIR)/include/salome -I$(GUI_ROOT_DIR)/include/salome -LDFLAGS += -lGEOMFiltersSelection -lGEOMBase +LDFLAGS += -L$(KERNEL_ROOT_DIR)/lib/salome -L$(GUI_ROOT_DIR)/lib/salome -lGEOMBase -lVTKViewer -lOCCViewer -lsuit -lSalomeApp @CONCLUDE@ diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 56ad67851..c2fcc2448 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -1,10 +1,7 @@ -#include - -using namespace std; - #include "GEOM_Gen_i.hh" #include "GEOM_Object_i.hh" -#include "SALOMEDS_Tool.hxx" + +#include #include "Utils_CorbaException.hxx" #include "OpUtil.hxx" @@ -26,6 +23,9 @@ using namespace std; #include #include +#include "SALOMEDS_Tool.hxx" +using namespace std; + //============================================================================ // function : GEOM_Gen_i() // purpose : constructor to be called for servant creation. @@ -760,7 +760,8 @@ GEOM::GEOM_IGroupOperations_ptr GEOM_Gen_i::GetIGroupOperations(CORBA::Long theS * AddSubShape */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape(GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfLong& theIndices) +GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainShape, + const GEOM::ListOfLong& theIndices) { if(theMainShape == NULL || theIndices.length() < 1) return GEOM::GEOM_Object::_nil(); Handle(GEOM_Object) aMainsShape = _impl->GetObject(theMainShape->GetStudyID(), theMainShape->GetEntry()); @@ -769,7 +770,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape(GEOM::GEOM_Object_ptr theMainShape Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length()); for(Standard_Integer i = 0; iSetValue(i+1, theIndices[i]); - Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray); + Handle(GEOM_Object) anObject = _impl->AddSubShape(aMainsShape, anArray, true); if(anObject.IsNull()) return GEOM::GEOM_Object::_nil(); TCollection_AsciiString anEntry; diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index f8537d7d3..6543545fb 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -9,11 +9,12 @@ #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + #include "SALOME_Component_i.hxx" #include "SALOME_NamingService.hxx" -#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +//#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC #include "GEOM_IBasicOperations_i.hh" #include "GEOM_ITransformOperations_i.hh" @@ -28,6 +29,7 @@ #include "GEOM_IMeasureOperations_i.hh" #include "GEOM_IGroupOperations_i.hh" + //===================================================================== // GEOM_Gen_i : class definition //===================================================================== @@ -175,6 +177,14 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, public Engines_Component_i virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR); + virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript); + + char* GetDumpName (const char* theStudyEntry); + + GEOM::string_array* GetAllDumpNames(); + //********************************************************************************************************// // Internal methods //********************************************************************************************************// diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index e6f153bce..fcee420eb 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -44,12 +44,12 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double the //Set a not done flag GetOperations()->SetNotDone(); - + //Create the Box Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); - + return GetObject(anObject); } diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc index d570efe16..d93a06133 100644 --- a/src/GEOM_I/GEOM_IOperations_i.cc +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -8,7 +8,7 @@ using namespace std; #include "GEOM_Engine.hxx" -#include "GEOM_Gen_i.hh" +//#include "GEOM_Gen_i.hh" #include #include diff --git a/src/GEOM_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc index 2af09b209..c273d3d11 100644 --- a/src/GEOM_I/GEOM_Object_i.cc +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -1,7 +1,7 @@ using namespace std; #include "GEOM_Object_i.hh" -#include "GEOM_Gen_i.hh" +//#include "GEOM_Gen_i.hh" #include "GEOM_ISubShape.hxx" #include "GEOMImpl_Types.hxx" @@ -129,8 +129,8 @@ void GEOM_Object_i::SetStudyEntry(const char* theEntry) //============================================================================= char* GEOM_Object_i::GetStudyEntry() { - char* anEntry = _impl->GetAuxData(); - if(anEntry) return strdup(anEntry); + TCollection_AsciiString anEntry = _impl->GetAuxData(); + if(!anEntry.IsEmpty()) return strdup(anEntry.ToCString()); return strdup(""); } diff --git a/src/GEOM_I/Makefile.in b/src/GEOM_I/Makefile.in index ffca57d1d..ec731fbd2 100644 --- a/src/GEOM_I/Makefile.in +++ b/src/GEOM_I/Makefile.in @@ -51,7 +51,9 @@ LIB_SRC = \ GEOM_ITransformOperations_i.cc \ GEOM_IMeasureOperations_i.cc \ GEOM_IGroupOperations_i.cc \ - GEOM_Gen_i.cc + GEOM_Gen_i.cc \ + GEOM_DumpPython.cc + LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl \ GEOM_Gen.idl SALOME_GenericObj.idl @@ -80,8 +82,8 @@ EXPORT_HEADERS = GEOM_Object_i.hh \ GEOM_Gen_i.hh # additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS += -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMArchimede -lGEOMbasic -lGEOMimpl $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj # additional file to be cleaned diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 445ba9b62..515e095b7 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1,6 +1,7 @@ using namespace std; #include "GEOM_Superv_i.hh" +#include "SALOME_LifeCycleCORBA.hxx" //============================================================================= // constructor: diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 3a3ce4596..97d476f78 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -8,10 +8,6 @@ #include "GEOM_Gen_i.hh" #include "GEOM_List_i.hh" -#include "QAD_Study.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" - class GEOM_Superv_i : public virtual POA_GEOM::GEOM_Superv, public Engines_Component_i { diff --git a/src/GEOM_SWIG/Makefile.in b/src/GEOM_SWIG/Makefile.in index c7e1a4e83..8f3d5c12a 100644 --- a/src/GEOM_SWIG/Makefile.in +++ b/src/GEOM_SWIG/Makefile.in @@ -86,6 +86,6 @@ EXPORT_SHAREDPYSCRIPTS=\ CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -DHAVE_CONFIG_H LIBS+= $(PYTHON_LIBS) -LDFLAGS+= -lGEOMGUI +LDFLAGS+= -lGEOM @CONCLUDE@ diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index e9b8eeeb3..608be6d96 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -36,10 +36,34 @@ while step < 50 and g == None: step = step + 1 time.sleep(4) geom = g._narrow( GEOM.GEOM_Gen ) -myBuilder = myStudy.NewBuilder() -father = myStudy.FindComponent("GEOM") -if father is None: +myBuilder = None +myStudyId = 0 +father = None + +BasicOp = None +CurvesOp = None +PrimOp = None +ShapesOp = None +HealOp = None +InsertOp = None +BoolOp = None +TrsfOp = None +LocalOp = None +MeasuOp = None +BlocksOp = None +GroupOp = None + +def init_geom(theStudy): + + global myStudy, myBuilder, myStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp + global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp, father + + myStudy = theStudy + myStudyId = myStudy._get_StudyId() + myBuilder = myStudy.NewBuilder() + father = myStudy.FindComponent("GEOM") + if father is None: father = myBuilder.NewComponent("GEOM") A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName") FName = A1._narrow(SALOMEDS.AttributeName) @@ -48,6 +72,27 @@ if father is None: aPixmap = A2._narrow(SALOMEDS.AttributePixMap) aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry") myBuilder.DefineComponentInstance(father,geom) + pass + + # ----------------------------------------------------------------------------- + # Assign Operations Interfaces + # ----------------------------------------------------------------------------- + + BasicOp = geom.GetIBasicOperations (myStudyId) + CurvesOp = geom.GetICurvesOperations (myStudyId) + PrimOp = geom.GetI3DPrimOperations (myStudyId) + ShapesOp = geom.GetIShapesOperations (myStudyId) + HealOp = geom.GetIHealingOperations (myStudyId) + InsertOp = geom.GetIInsertOperations (myStudyId) + BoolOp = geom.GetIBooleanOperations (myStudyId) + TrsfOp = geom.GetITransformOperations(myStudyId) + LocalOp = geom.GetILocalOperations (myStudyId) + MeasuOp = geom.GetIMeasureOperations (myStudyId) + BlocksOp = geom.GetIBlocksOperations (myStudyId) + GroupOp = geom.GetIGroupOperations (myStudyId) + pass + +init_geom(myStudy) # * Get name for sub-shape aSubObj of shape aMainObj # @@ -82,23 +127,6 @@ def addToStudyInFather(aFather, aShape, aName): ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} -# ----------------------------------------------------------------------------- -# Get Operations Interfaces -# ----------------------------------------------------------------------------- - -BasicOp = geom.GetIBasicOperations (myStudyId) -CurvesOp = geom.GetICurvesOperations (myStudyId) -PrimOp = geom.GetI3DPrimOperations (myStudyId) -ShapesOp = geom.GetIShapesOperations (myStudyId) -HealOp = geom.GetIHealingOperations (myStudyId) -InsertOp = geom.GetIInsertOperations (myStudyId) -BoolOp = geom.GetIBooleanOperations (myStudyId) -TrsfOp = geom.GetITransformOperations(myStudyId) -LocalOp = geom.GetILocalOperations (myStudyId) -MeasuOp = geom.GetIMeasureOperations (myStudyId) -BlocksOp = geom.GetIBlocksOperations (myStudyId) -GroupOp = geom.GetIGroupOperations (myStudyId) - # ----------------------------------------------------------------------------- # Basic primitives # ----------------------------------------------------------------------------- diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index a561d6e84..e83ae1970 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -36,10 +36,37 @@ import GEOM g = lcc.FindOrLoadComponent("FactoryServer", "GEOM") geom = g._narrow( GEOM.GEOM_Gen ) -myBuilder = myStudy.NewBuilder() - -father = myStudy.FindComponent("GEOM") -if father is None: +gg = ImportComponentGUI("GEOM") + +#SRN: modified on Mar 18, 2005 + +myBuilder = None +myStudyId = 0 +father = None + +BasicOp = None +CurvesOp = None +PrimOp = None +ShapesOp = None +HealOp = None +InsertOp = None +BoolOp = None +TrsfOp = None +LocalOp = None +MeasuOp = None +BlocksOp = None +GroupOp = None + +def init_geom(theStudy): + + global myStudy, myBuilder, myStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp + global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp, father + + myStudy = theStudy + myStudyId = myStudy._get_StudyId() + myBuilder = myStudy.NewBuilder() + father = myStudy.FindComponent("GEOM") + if father is None: father = myBuilder.NewComponent("GEOM") A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName") FName = A1._narrow(SALOMEDS.AttributeName) @@ -48,8 +75,29 @@ if father is None: aPixmap = A2._narrow(SALOMEDS.AttributePixMap) aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry") myBuilder.DefineComponentInstance(father,geom) - -gg = ImportComponentGUI("GEOM") + pass + + # ----------------------------------------------------------------------------- + # Assign Operations Interfaces + # ----------------------------------------------------------------------------- + + BasicOp = geom.GetIBasicOperations (myStudyId) + CurvesOp = geom.GetICurvesOperations (myStudyId) + PrimOp = geom.GetI3DPrimOperations (myStudyId) + ShapesOp = geom.GetIShapesOperations (myStudyId) + HealOp = geom.GetIHealingOperations (myStudyId) + InsertOp = geom.GetIInsertOperations (myStudyId) + BoolOp = geom.GetIBooleanOperations (myStudyId) + TrsfOp = geom.GetITransformOperations(myStudyId) + LocalOp = geom.GetILocalOperations (myStudyId) + MeasuOp = geom.GetIMeasureOperations (myStudyId) + BlocksOp = geom.GetIBlocksOperations (myStudyId) + GroupOp = geom.GetIGroupOperations (myStudyId) + pass + +init_geom(myStudy) + +#SRN: end of modifications def SubShapeName(aSubObj, aMainObj): """ @@ -95,23 +143,6 @@ def addToStudyInFather(aFather, aShape, aName): ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8} -# ----------------------------------------------------------------------------- -# Get Operations Interfaces -# ----------------------------------------------------------------------------- - -BasicOp = geom.GetIBasicOperations (myStudyId) -CurvesOp = geom.GetICurvesOperations (myStudyId) -PrimOp = geom.GetI3DPrimOperations (myStudyId) -ShapesOp = geom.GetIShapesOperations (myStudyId) -HealOp = geom.GetIHealingOperations (myStudyId) -InsertOp = geom.GetIInsertOperations (myStudyId) -BoolOp = geom.GetIBooleanOperations (myStudyId) -TrsfOp = geom.GetITransformOperations(myStudyId) -LocalOp = geom.GetILocalOperations (myStudyId) -MeasuOp = geom.GetIMeasureOperations (myStudyId) -BlocksOp = geom.GetIBlocksOperations (myStudyId) -GroupOp = geom.GetIGroupOperations (myStudyId) - # ----------------------------------------------------------------------------- # Basic primitives # ----------------------------------------------------------------------------- diff --git a/src/GenerationGUI/GenerationGUI.cxx b/src/GenerationGUI/GenerationGUI.cxx index b6ba761b3..e05be81ca 100644 --- a/src/GenerationGUI/GenerationGUI.cxx +++ b/src/GenerationGUI/GenerationGUI.cxx @@ -29,8 +29,8 @@ using namespace std; #include "GenerationGUI.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" #include "GenerationGUI_PrismDlg.h" // Method PRISM #include "GenerationGUI_RevolDlg.h" // Method REVOL @@ -43,10 +43,10 @@ GenerationGUI* GenerationGUI::myGUIObject = 0; // function : GetGenerationGUI() // purpose : Get the only GenerationGUI object [ static ] //======================================================================= -GenerationGUI* GenerationGUI::GetGenerationGUI() +GenerationGUI* GenerationGUI::GetGenerationGUI(GeometryGUI* parent) { if ( myGUIObject == 0 ) - myGUIObject = new GenerationGUI(); + myGUIObject = new GenerationGUI(parent); return myGUIObject; } @@ -55,7 +55,7 @@ GenerationGUI* GenerationGUI::GetGenerationGUI() // function : GenerationGUI() // purpose : Constructor //======================================================================= -GenerationGUI::GenerationGUI() : GEOMGUI() +GenerationGUI::GenerationGUI(GeometryGUI* parent) : GEOMGUI(parent) { } @@ -73,23 +73,20 @@ GenerationGUI::~GenerationGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool GenerationGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +bool GenerationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - - SALOME_Selection* Sel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; switch ( theCommandID ) - { - case 4031: aDlg = new GenerationGUI_PrismDlg ( parent, "", Sel ); break; - case 4032: aDlg = new GenerationGUI_RevolDlg ( parent, "", Sel ); break; - case 4033: aDlg = new GenerationGUI_FillingDlg ( parent, "", Sel ); break; - case 4034: aDlg = new GenerationGUI_PipeDlg ( parent, "", Sel ); break; + { + case 4031: aDlg = new GenerationGUI_PrismDlg ( getGeometryGUI(), parent, ""); break; + case 4032: aDlg = new GenerationGUI_RevolDlg ( getGeometryGUI(), parent, ""); break; + case 4033: aDlg = new GenerationGUI_FillingDlg ( getGeometryGUI(), parent, ""); break; + case 4034: aDlg = new GenerationGUI_PipeDlg ( parent, ""); break; - default: parent->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; + default: SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; } if ( aDlg != NULL ) @@ -104,8 +101,8 @@ bool GenerationGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI(GeometryGUI* parent) { - return GenerationGUI::GetGenerationGUI(); + return GenerationGUI::GetGenerationGUI(parent); } } diff --git a/src/GenerationGUI/GenerationGUI.h b/src/GenerationGUI/GenerationGUI.h index cde32bc34..eb5562848 100644 --- a/src/GenerationGUI/GenerationGUI.h +++ b/src/GenerationGUI/GenerationGUI.h @@ -38,15 +38,15 @@ class GenerationGUI : public GEOMGUI { protected: - GenerationGUI(); // hide constructor to avoid direct creation + GenerationGUI(GeometryGUI* parent); // hide constructor to avoid direct creation public : ~GenerationGUI(); // Get the only GenerationGUI object - static GenerationGUI* GetGenerationGUI(); + static GenerationGUI* GetGenerationGUI(GeometryGUI* parent); - bool OnGUIEvent( int theCommandID, QAD_Desktop* parent ); + bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); private: static GenerationGUI* myGUIObject; // the only GenerationGUI object diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 2a5478e77..8cda67418 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -28,9 +28,10 @@ #include "GenerationGUI_FillingDlg.h" -#include "QAD_WaitCursor.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include #include @@ -45,6 +46,8 @@ #include #include "GEOMImpl_Types.hxx" +#include + #include "utilities.h" //================================================================================= @@ -54,11 +57,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_FillingDlg::GenerationGUI_FillingDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GenerationGUI_FillingDlg::GenerationGUI_FillingDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_FILLING"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_FILLING_TITLE")); @@ -144,13 +147,14 @@ void GenerationGUI_FillingDlg::Init() connect(GroupPoints->SpinBox_4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupPoints->SpinBox_5, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_3, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_4, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_5, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_3, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_4, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_5, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName(tr("GEOM_FILLING")); } @@ -190,7 +194,7 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkCompound = false; return; @@ -198,7 +202,7 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if (!testResult) return; @@ -264,7 +268,7 @@ void GenerationGUI_FillingDlg::LineEditReturnPressed() void GenerationGUI_FillingDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection( GEOM_COMPOUND ); displayPreview(); } diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h index 885630cc2..d562c5275 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.h +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -41,7 +41,7 @@ class GenerationGUI_FillingDlg : public GEOMBase_Skeleton Q_OBJECT public: - GenerationGUI_FillingDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + GenerationGUI_FillingDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~GenerationGUI_FillingDlg(); protected: @@ -54,6 +54,8 @@ private: void Init(); void enterEvent(QEvent* e); + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myCompound; /* compound of curves */ Standard_Integer myMinDeg; Standard_Integer myMaxDeg; diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 51674226a..9a59cda5e 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -28,6 +28,13 @@ #include "GenerationGUI_PipeDlg.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include + #include #include #include @@ -39,7 +46,6 @@ #include "GEOMImpl_Types.hxx" -#include "QAD_Desktop.h" #include "utilities.h" //================================================================================= @@ -49,11 +55,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PIPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_PIPE_TITLE")); @@ -113,7 +119,8 @@ void GenerationGUI_PipeDlg::Init() connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName(tr("GEOM_PIPE")); @@ -155,7 +162,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; else if(myEditCurrentArgument == GroupPoints->LineEdit2) @@ -165,7 +172,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if (!testResult) return; @@ -256,7 +263,8 @@ void GenerationGUI_PipeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); displayPreview(); } diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index 6df389000..4f525f343 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -41,7 +41,7 @@ class GenerationGUI_PipeDlg : public GEOMBase_Skeleton Q_OBJECT public: - GenerationGUI_PipeDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + GenerationGUI_PipeDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~GenerationGUI_PipeDlg(); protected: diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index bd18da9b4..7ab104b48 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -28,13 +28,17 @@ #include "GenerationGUI_PrismDlg.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + #include #include #include -#include "QAD_Config.h" -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" +#include #include #include "utilities.h" @@ -46,11 +50,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PRISM"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PRISM"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_PRISM_TITLE")); @@ -104,8 +108,8 @@ void GenerationGUI_PrismDlg::Init() myOkBase = myOkVec = false; /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, +999.999, step, 3); @@ -122,11 +126,12 @@ void GenerationGUI_PrismDlg::Init() connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName(tr("GEOM_PRISM")); @@ -168,7 +173,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; @@ -179,7 +184,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if (!testResult) return; @@ -261,7 +266,8 @@ void GenerationGUI_PrismDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; displayPreview(); diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index 3b90b2ecb..ee946ae77 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -41,7 +41,7 @@ class GenerationGUI_PrismDlg : public GEOMBase_Skeleton Q_OBJECT public: - GenerationGUI_PrismDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + GenerationGUI_PrismDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~GenerationGUI_PrismDlg(); protected: @@ -54,6 +54,8 @@ private : void Init(); void enterEvent(QEvent* e); double getHeight() const; + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myBase; /* Base shape */ GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index f811dba46..6856a9f48 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -28,15 +28,19 @@ #include "GenerationGUI_RevolDlg.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + #include #include #include -#include "QAD_Config.h" -#include "QAD_Desktop.h" #include #include #include "GEOMImpl_Types.hxx" +#include #include #include "utilities.h" @@ -48,11 +52,11 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_REVOL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REVOL"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_REVOLUTION_TITLE")); @@ -123,9 +127,10 @@ void GenerationGUI_RevolDlg::Init() connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName(tr("GEOM_REVOLUTION")); @@ -193,7 +198,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() erasePreview(); myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; else if(myEditCurrentArgument == GroupPoints->LineEdit2) @@ -203,7 +208,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if (!testResult) return; @@ -274,7 +279,7 @@ void GenerationGUI_RevolDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; displayPreview(); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index acc71d3d0..f5d7637f3 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -43,7 +43,7 @@ class GenerationGUI_RevolDlg : public GEOMBase_Skeleton Q_OBJECT public: - GenerationGUI_RevolDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + GenerationGUI_RevolDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~GenerationGUI_RevolDlg(); protected: @@ -57,6 +57,8 @@ private : void enterEvent(QEvent* e); double getAngle() const; + GeometryGUI* myGeometryGUI; + GEOM::GEOM_Object_var myBase; /* Base shape */ GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ bool myOkBase; diff --git a/src/GenerationGUI/Makefile.in b/src/GenerationGUI/Makefile.in index 66f3f7df3..3ce50cd87 100644 --- a/src/GenerationGUI/Makefile.in +++ b/src/GenerationGUI/Makefile.in @@ -52,14 +52,14 @@ LIB_MOC = \ GenerationGUI_FillingDlg.h \ GenerationGUI_PipeDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMFiltersSelection -lGEOMBase $(CAS_LDPATH) -lTKOffset diff --git a/src/GroupGUI/GroupGUI.cxx b/src/GroupGUI/GroupGUI.cxx index 6252e88bd..788ac2a39 100644 --- a/src/GroupGUI/GroupGUI.cxx +++ b/src/GroupGUI/GroupGUI.cxx @@ -31,9 +31,12 @@ #include "GEOMImpl_Types.hxx" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" +#include "SUIT_MessageBox.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" +#include "SalomeApp_SelectionMgr.h" GroupGUI* GroupGUI::myGUIObject = 0; @@ -41,10 +44,10 @@ GroupGUI* GroupGUI::myGUIObject = 0; // function : GetGroupGUI() // purpose : Get the only GroupGUI object [ static ] //======================================================================= -GroupGUI* GroupGUI::GetGroupGUI() +GroupGUI* GroupGUI::GetGroupGUI(GeometryGUI* parent) { if ( myGUIObject == 0 ) - myGUIObject = new GroupGUI(); + myGUIObject = new GroupGUI(parent); return myGUIObject; } @@ -53,8 +56,8 @@ GroupGUI* GroupGUI::GetGroupGUI() // function : GroupGUI() // purpose : Constructor //======================================================================= -GroupGUI::GroupGUI() -: GEOMGUI() +GroupGUI::GroupGUI(GeometryGUI* parent) +: GEOMGUI(parent) { } @@ -72,47 +75,58 @@ GroupGUI::~GroupGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool GroupGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +bool GroupGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); + getGeometryGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); - QDialog* aDlg = NULL; - if ( QAD_Application::getDesktop()->getActiveStudy()->isLocked() ) { - QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return false; + _PTR(Study) aStudy = appStudy->studyDS(); + + if ( aStudy->GetProperties()->IsLocked() ) { + SUIT_MessageBox::warn1 ( parent, + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return false; } switch ( theCommandID ) { case 800: - aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, parent, "", Sel ); + aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::CreateGroup, parent, ""); break; case 801: { - if ( Sel->IObjectCount() == 1 ) { + SALOME_ListIO aList; + aList.Clear(); + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( app ) { + SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( aSelMgr ) + aSelMgr->selectedObjects( aList ); + } + + if ( aList.Extent() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( Sel->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( aList.First(), aResult ); if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { - aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, parent, "", Sel ); + aDlg = new GroupGUI_GroupDlg( GroupGUI_GroupDlg::EditGroup, parent, "" ); break; } } - QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), - tr("WRN_WARNING"), - tr("NO_GROUP"), - tr("BUT_OK") ); + SUIT_MessageBox::warn1 ( parent, + tr("WRN_WARNING"), + tr("NO_GROUP"), + tr("BUT_OK") ); break; } default: - parent->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; } @@ -127,8 +141,8 @@ bool GroupGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI(GeometryGUI* p) { - return GroupGUI::GetGroupGUI(); + return GroupGUI::GetGroupGUI(p); } } diff --git a/src/GroupGUI/GroupGUI.h b/src/GroupGUI/GroupGUI.h index dd3fd8de9..cfe3191a3 100644 --- a/src/GroupGUI/GroupGUI.h +++ b/src/GroupGUI/GroupGUI.h @@ -40,15 +40,15 @@ class GroupGUI : public GEOMGUI Q_OBJECT protected: - GroupGUI(); // hide constructor to avoid direct creation + GroupGUI(GeometryGUI* parent); // hide constructor to avoid direct creation public : ~GroupGUI(); // Get the only GroupGUI object - static GroupGUI* GetGroupGUI(); + static GroupGUI* GetGroupGUI(GeometryGUI* parent); - bool OnGUIEvent( int theCommandID, QAD_Desktop* parent ); + bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent ); private: static GroupGUI* myGUIObject; // the only GroupGUI object diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 0559aaff7..15b7b03d9 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -28,12 +28,16 @@ #include "GroupGUI_GroupDlg.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" +#include "SalomeApp_SelectionMgr.h" + #include "GEOMBase.h" #include "GEOMImpl_Types.hxx" -#include "QAD_Desktop.h" - #include #include #include @@ -42,23 +46,25 @@ #include #include + + + GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, QWidget* parent, const char* name, - SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton( parent, "GroupGUI_GroupDlg", Sel, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + :GEOMBase_Skeleton( parent, "GroupGUI_GroupDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myMode( mode ), myBusy( false ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_VERTEX" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_EDGE" ) ) ); - QPixmap image2( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_FACE" ) ) ); - QPixmap image3( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_SOLID" ) ) ); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_VERTEX" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_EDGE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_FACE" ) ) ); + QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_OBJBROWSER_SOLID" ) ) ); - QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); setCaption( myMode == CreateGroup ? tr( "CREATE_GROUP_TITLE" ) : tr( "EDIT_GROUP_TITLE" ) ); @@ -110,7 +116,7 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, aMedLayout->addWidget( myAddBtn, 2, 3 ); aMedLayout->addWidget( myRemBtn, 3, 3 ); - Init( Sel ); + Init(); } GroupGUI_GroupDlg::~GroupGUI_GroupDlg() @@ -122,10 +128,8 @@ GroupGUI_GroupDlg::~GroupGUI_GroupDlg() // function : Init() // purpose : //================================================================================= -void GroupGUI_GroupDlg::Init( SALOME_Selection* Sel ) +void GroupGUI_GroupDlg::Init() { - mySelection = Sel; - // san -- TODO: clear selected sub-shapes... if ( myMode == CreateGroup ) { @@ -137,10 +141,10 @@ void GroupGUI_GroupDlg::Init( SALOME_Selection* Sel ) connect( GroupConstructors, SIGNAL( clicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect( mySelBtn, SIGNAL( clicked() ), this, SLOT(SetEditCurrentArgument())); } - else if ( myMode == EditGroup && Sel->IObjectCount() ) { + else if ( myMode == EditGroup && IObjectCount() ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( Sel->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !CORBA::is_nil( anObj ) && anObj->GetType() == GEOM_GROUP ) { myGroup = anObj; @@ -170,7 +174,8 @@ void GroupGUI_GroupDlg::Init( SALOME_Selection* Sel ) connect( mySelSubBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( mySelection,SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( selectAllSubShapes() ) ); connect( myAddBtn, SIGNAL( clicked() ), this, SLOT( add() ) ); connect( myRemBtn, SIGNAL( clicked() ), this, SLOT( remove() ) ); @@ -223,7 +228,8 @@ void GroupGUI_GroupDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); } @@ -274,10 +280,10 @@ void GroupGUI_GroupDlg::SelectionIntoArgument() if ( myEditCurrentArgument ) { // Selection of a main shape is active myEditCurrentArgument->setText( "" ); - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) { myMainObj = anObj; @@ -297,10 +303,10 @@ void GroupGUI_GroupDlg::SelectionIntoArgument() myIdList->blockSignals( true ); myIdList->clearSelection(); - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { QMap aMap; @@ -308,7 +314,7 @@ void GroupGUI_GroupDlg::SelectionIntoArgument() aMap.insert( myIdList->item( i )->text().toInt(), i ); TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); for ( int ii = 1, nn = aMapIndex.Extent(); ii <= nn; ii++ ) { if ( aMap.contains( aMapIndex( ii ) ) ) myIdList->setSelected( aMap[aMapIndex( ii )], true ); @@ -379,14 +385,14 @@ void GroupGUI_GroupDlg::add() for ( int i = 0, n = myIdList->count(); i < n; i++ ) aMap.Add( myIdList->item( i )->text().toInt() ); - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); QListBoxItem* anItem; bool isBlocked = myIdList->signalsBlocked(); myIdList->blockSignals( true ); @@ -483,14 +489,14 @@ void GroupGUI_GroupDlg::activateSelection() void GroupGUI_GroupDlg::updateState() { bool isAdd = false; - if ( mySelection->IObjectCount() == 1 ) { + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; - mySelection->GetIndex( mySelection->firstIObject(), aMapIndex ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), aMapIndex ); isAdd = aMapIndex.Extent() > 0; } } @@ -535,8 +541,9 @@ void GroupGUI_GroupDlg::highlightSubShapes() if ( myIdList->isSelected( ii ) ) anIds.Add( myIdList->item( ii )->text().toInt() ); - mySelection->ClearIObjects(); - mySelection->AddOrRemoveIndex( aSh->getIO(), anIds, false, true ); + SalomeApp_SelectionMgr* aSelMgr = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + aSelMgr->clearSelected(); + aSelMgr->AddOrRemoveIndex( aSh->getIO(), anIds, false ); myBusy = false; @@ -564,9 +571,9 @@ GEOM::GEOM_IOperations_ptr GroupGUI_GroupDlg::createOperation() //================================================================================= bool GroupGUI_GroupDlg::isValid( QString& theMessage ) { - QAD_Study* study = getStudy(); + SalomeApp_Study* study = getStudy(); ASSERT(study); - RETURN_WITH_MSG ( !study->getStudyDocument()->GetProperties()->IsLocked(), tr( "GEOM_STUDY_LOCKED" ) ) + RETURN_WITH_MSG ( !study->studyDS()->GetProperties()->IsLocked(), tr( "GEOM_STUDY_LOCKED" ) ) if ( myMode == CreateGroup ) { RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_MAIN_OBJ" ) ) @@ -615,13 +622,13 @@ bool GroupGUI_GroupDlg::execute( ObjectList& objects ) return false; } - QAD_Study* study = getStudy(); + SalomeApp_Study* study = getStudy(); if ( study ) { string IOR = GEOMBase::GetIORFromObject( aGroup ); if ( IOR != "" ) { - SALOMEDS::SObject_var SO = study->getStudyDocument()->FindObjectIOR( IOR.c_str() ); - if ( !SO->_is_nil() ) { - SALOMEDS::StudyBuilder_var aBuilder = study->getStudyDocument()->NewBuilder(); + _PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) ); + if ( SO ) { + _PTR(StudyBuilder) aBuilder (study->studyDS()->NewBuilder()); aBuilder->SetName( SO, getNewObjectName() ); } } diff --git a/src/GroupGUI/GroupGUI_GroupDlg.h b/src/GroupGUI/GroupGUI_GroupDlg.h index d2da0e231..75879c54d 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.h +++ b/src/GroupGUI/GroupGUI_GroupDlg.h @@ -50,7 +50,7 @@ public: EditGroup } Mode; - GroupGUI_GroupDlg(Mode mode, QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + GroupGUI_GroupDlg(Mode mode, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~GroupGUI_GroupDlg(); protected: @@ -76,7 +76,7 @@ private slots: void selectionChanged(); private: - void Init( SALOME_Selection* ); + void Init(); void enterEvent( QEvent* e ); int getConstructorId() const; TopAbs_ShapeEnum getShapeType() const; diff --git a/src/GroupGUI/Makefile.in b/src/GroupGUI/Makefile.in index c615b7d85..26a351ad4 100755 --- a/src/GroupGUI/Makefile.in +++ b/src/GroupGUI/Makefile.in @@ -46,14 +46,14 @@ LIB_SRC = GroupGUI.cxx \ LIB_MOC = GroupGUI.h \ GroupGUI_GroupDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMFiltersSelection -lGEOMBase diff --git a/src/Makefile.in b/src/Makefile.in index ac330ca23..fe15b01b1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -32,6 +32,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = OBJECT ARCHIMEDE NMTDS NMTTools NMTAlgo GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport ShHealOper GEOMImpl GEOM_I GEOMClient DlgRef GEOMFiltersSelection GEOMGUI GEOMBase DisplayGUI GEOMToolsGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI GEOM_SWIG GEOM_I_Superv +SUBDIRS = OBJECT ARCHIMEDE NMTDS NMTTools NMTAlgo GEOMAlgo SKETCHER GEOM BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport ShHealOper GEOMImpl GEOM_I GEOMClient DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GroupGUI BlocksGUI GEOM_I_Superv GEOM_SWIG @MODULE@ diff --git a/src/MeasureGUI/Makefile.in b/src/MeasureGUI/Makefile.in index 10c55309d..7bb4af629 100644 --- a/src/MeasureGUI/Makefile.in +++ b/src/MeasureGUI/Makefile.in @@ -78,14 +78,14 @@ LIB_MOC = \ MeasureGUI_CheckCompoundOfBlocksDlg.h \ MeasureGUI_PointDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMBase diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index 0fb757c6f..a989d9ae8 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -27,9 +27,10 @@ // $Header$ #include "MeasureGUI.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SalomeApp_Tools.h" #include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES #include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS @@ -48,11 +49,11 @@ MeasureGUI* MeasureGUI::myGUIObject = 0; // function : GetMeasureGUI() // purpose : Get the only MeasureGUI object [ static ] //======================================================================= -MeasureGUI* MeasureGUI::GetMeasureGUI() +MeasureGUI* MeasureGUI::GetMeasureGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init MeasureGUI only once - myGUIObject = new MeasureGUI(); + myGUIObject = new MeasureGUI( parent ); } return myGUIObject; } @@ -61,7 +62,7 @@ MeasureGUI* MeasureGUI::GetMeasureGUI() // function : MeasureGUI() // purpose : Constructor //======================================================================= -MeasureGUI::MeasureGUI() : GEOMGUI() +MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { } @@ -79,27 +80,27 @@ MeasureGUI::~MeasureGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool MeasureGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { - MeasureGUI* myMeasureGUI = GetMeasureGUI(); - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + MeasureGUI* myMeasureGUI = GetMeasureGUI( getGeometryGUI() ); + getGeometryGUI()->EmitSignalDeactivateDialog(); switch ( theCommandID ) { - case 701 : new MeasureGUI_PropertiesDlg ( parent, Sel ); break; // LENGTH, AREA AND VOLUME - case 702 : new MeasureGUI_CenterMassDlg ( parent, Sel ); break; // CENTER MASS - case 703 : new MeasureGUI_InertiaDlg ( parent, Sel ); break; // INERTIA - case 7041 : new MeasureGUI_BndBoxDlg ( parent, Sel ); break; // BOUNDING BOX - case 7042 : new MeasureGUI_DistanceDlg ( parent, Sel ); break; // MIN DISTANCE - case 705 : new MeasureGUI_MaxToleranceDlg( parent, Sel ); break; // MAXTOLERANCE - case 706 : new MeasureGUI_WhatisDlg ( parent, Sel ); break; // WHATIS - case 707 : new MeasureGUI_CheckShapeDlg ( parent, Sel ); break; // CHECKSHAPE - case 7072 : new MeasureGUI_CheckCompoundOfBlocksDlg ( parent, Sel ); break; // CHECKCOMPOUND - case 708 : new MeasureGUI_PointDlg ( parent, Sel ); break; // POINT COORDINATES + case 701 : new MeasureGUI_PropertiesDlg ( getGeometryGUI(), parent ); break; // LENGTH, AREA AND VOLUME + case 702 : new MeasureGUI_CenterMassDlg ( parent ); break; // CENTER MASS + case 703 : new MeasureGUI_InertiaDlg ( getGeometryGUI(), parent ); break; // INERTIA + case 7041 : new MeasureGUI_BndBoxDlg ( getGeometryGUI(), parent ); break; // BOUNDING BOX + case 7042 : new MeasureGUI_DistanceDlg ( getGeometryGUI(), parent ); break; // MIN DISTANCE + case 705 : new MeasureGUI_MaxToleranceDlg( getGeometryGUI(), parent ); break; // MAXTOLERANCE + case 706 : new MeasureGUI_WhatisDlg ( getGeometryGUI(), parent ); break; // WHATIS + case 707 : new MeasureGUI_CheckShapeDlg ( getGeometryGUI(), parent ); break; // CHECKSHAPE + case 7072 : new MeasureGUI_CheckCompoundOfBlocksDlg ( getGeometryGUI(), parent ); break; // CHECKCOMPOUND + case 708 : new MeasureGUI_PointDlg ( getGeometryGUI(), parent ); break; // POINT COORDINATES - default: parent->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); break; + default: + SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); + break; } return true; } @@ -124,7 +125,7 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); + SalomeApp_Tools::QtCatchCorbaException(S_ex); } return; @@ -137,8 +138,8 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return MeasureGUI::GetMeasureGUI(); + return MeasureGUI::GetMeasureGUI( parent ); } } diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h index b3eaadea7..2a34e5e7a 100644 --- a/src/MeasureGUI/MeasureGUI.h +++ b/src/MeasureGUI/MeasureGUI.h @@ -38,12 +38,12 @@ class MeasureGUI : public GEOMGUI { protected: - MeasureGUI(); + MeasureGUI( GeometryGUI* parent ); public : ~MeasureGUI(); - static MeasureGUI* GetMeasureGUI(); - bool OnGUIEvent( int , QAD_Desktop* ); + static MeasureGUI* GetMeasureGUI( GeometryGUI* parent ); + bool OnGUIEvent( int , SUIT_Desktop* ); private: static MeasureGUI* myGUIObject; diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index cc7349832..b1e133cfc 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -28,7 +28,6 @@ #include "MeasureGUI_BndBoxDlg.h" #include "MeasureGUI_1Sel6LineEdit_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "GEOMBase.h" #include "GEOM_Displayer.h" @@ -36,9 +35,11 @@ #include #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Tools.h" #include +#include #include #include #include @@ -51,12 +52,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_PropertiesDlg", Sel ) +MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PropertiesDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_BOUNDING_BOX" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_BNDBOX_TITLE" ) ); @@ -88,7 +89,7 @@ MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( QWidget* parent, SALOME_Selection* S /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -105,11 +106,11 @@ MeasureGUI_BndBoxDlg::~MeasureGUI_BndBoxDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_BndBoxDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_BndBoxDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -163,7 +164,7 @@ bool MeasureGUI_BndBoxDlg::getParameters( double& theXmin, double& theXmax, } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h index 50e24820b..43e5a7ade 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h @@ -42,8 +42,8 @@ class MeasureGUI_BndBoxDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_BndBoxDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_BndBoxDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_BndBoxDlg(); protected: @@ -53,7 +53,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( double& Xmin, double& Xmax, double& Ymin, double& Ymax, double& Zmin, double& Zmax ); diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index ed0a1087e..9c1a927e9 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -28,15 +28,20 @@ #include "MeasureGUI_CenterMassDlg.h" #include "MeasureGUI_1Sel3LineEdit_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" + #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_Tools.h" #include #include #include #include +#include + //================================================================================= // class : MeasureGUI_CenterMassDlg() // purpose : Constructs a MeasureGUI_CenterMassDlg which is a child of 'parent', with the @@ -44,12 +49,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( QWidget* parent, SALOME_Selection* Sel ) -: GEOMBase_Skeleton( parent, "MeasureGUI_CenterMassDlg", Sel, false, +MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( QWidget* parent ) +: GEOMBase_Skeleton( parent, "MeasureGUI_CenterMassDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr( "ICON_DLG_CENTERMASS" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_CENTERMASS" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_CMASS_TITLE" ) ); @@ -76,7 +81,7 @@ MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( QWidget* parent, SALOME_Sele /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -93,10 +98,9 @@ MeasureGUI_CenterMassDlg::~MeasureGUI_CenterMassDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_CenterMassDlg::Init() { /* init variables */ - mySelection = Sel; myEditCurrentArgument = myGrp->LineEdit1; /* signals and slots connections */ @@ -106,7 +110,8 @@ void MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) connect( myGrp->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( myGrp->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_POINT") ); globalSelection(); @@ -154,7 +159,7 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument() erasePreview(); myObj = GEOM::GEOM_Object::_nil(); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) { processObject(); return; @@ -162,7 +167,7 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument() Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if ( !testResult || aSelectedObject->_is_nil() ) { @@ -211,8 +216,8 @@ void MeasureGUI_CenterMassDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( mySelection, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; globalSelection(); displayPreview(); @@ -311,7 +316,7 @@ bool MeasureGUI_CenterMassDlg::getParameters( double& theX, double& theY, double } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } } diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h index 74703bce9..bab31e6ea 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h @@ -41,8 +41,7 @@ class MeasureGUI_CenterMassDlg : public GEOMBase_Skeleton Q_OBJECT public: - MeasureGUI_CenterMassDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_CenterMassDlg( QWidget* parent ); ~MeasureGUI_CenterMassDlg(); protected: @@ -62,7 +61,7 @@ private slots: private: - void Init( SALOME_Selection* ); + void Init( ); void enterEvent( QEvent* e ); void processObject(); bool getParameters( double&, double&, double& ); diff --git a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx index b2b8cdf33..5941b95e2 100644 --- a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx @@ -28,12 +28,14 @@ #include "MeasureGUI_CheckCompoundOfBlocksDlg.h" #include "MeasureGUI_1Sel1TextView_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Tools.h" + #include #include +#include #include "GEOMBase.h" #include "GEOMImpl_Types.hxx" @@ -64,12 +66,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_CheckCompoundOfBlocksDlg::MeasureGUI_CheckCompoundOfBlocksDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_CheckCompoundOfBlocksDlg", Sel ) +MeasureGUI_CheckCompoundOfBlocksDlg::MeasureGUI_CheckCompoundOfBlocksDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_CheckCompoundOfBlocksDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_CHECK_COMPOUND_OF_BLOCKS" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_CHECK_BLOCKS_COMPOUND" ) ); @@ -116,7 +118,7 @@ MeasureGUI_CheckCompoundOfBlocksDlg::MeasureGUI_CheckCompoundOfBlocksDlg( QWidge connect( myErrorsLBox, SIGNAL( selectionChanged() ), SLOT( onErrorsListSelectionChanged() ) ); connect( mySubShapesLBox, SIGNAL( selectionChanged() ), SLOT( onSubShapesListSelectionChanged() ) ); /* Initialisation */ - Init( Sel ); + Init(); } @@ -133,12 +135,12 @@ MeasureGUI_CheckCompoundOfBlocksDlg::~MeasureGUI_CheckCompoundOfBlocksDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_CheckCompoundOfBlocksDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_CheckCompoundOfBlocksDlg::Init() { activateSelection(); mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -161,7 +163,7 @@ bool MeasureGUI_CheckCompoundOfBlocksDlg::getBCErrors( bool& theIsCompoundOfBloc } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } @@ -349,7 +351,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged() } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); } } } diff --git a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h index b961bf88c..6f733eaa9 100644 --- a/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h +++ b/src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.h @@ -44,8 +44,8 @@ class MeasureGUI_CheckCompoundOfBlocksDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_CheckCompoundOfBlocksDlg( QWidget* theParent, - SALOME_Selection* theSel ); + MeasureGUI_CheckCompoundOfBlocksDlg( GeometryGUI* GUI, + QWidget* theParent ); ~MeasureGUI_CheckCompoundOfBlocksDlg(); protected: @@ -60,7 +60,7 @@ private slots: private: - void Init( SALOME_Selection* theSel ); + void Init(); bool getBCErrors( bool& theIsCompoundOfBlocks, GEOM::GEOM_IBlocksOperations::BCErrors& theErrors); void activateSelection(); diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx index 3ed0566df..d63de1040 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx @@ -28,13 +28,14 @@ #include "MeasureGUI_CheckShapeDlg.h" #include "MeasureGUI_1Sel1TextView_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Tools.h" #include #include +#include #include #include #include @@ -50,12 +51,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_CheckShapeDlg", Sel ) +MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_CheckShapeDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_CHECKSHAPE" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_CHECK_TITLE" ) ); @@ -81,7 +82,7 @@ MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg( QWidget* parent, SALOME_Sele /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -98,11 +99,11 @@ MeasureGUI_CheckShapeDlg::~MeasureGUI_CheckShapeDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_CheckShapeDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_CheckShapeDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -123,7 +124,7 @@ bool MeasureGUI_CheckShapeDlg::getParameters ( bool& theIsValid, QString& theMsg } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h index 514d06065..959066632 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h @@ -42,8 +42,8 @@ class MeasureGUI_CheckShapeDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_CheckShapeDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_CheckShapeDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_CheckShapeDlg(); protected: @@ -52,7 +52,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( bool& theIsValid, QString& theMsg); diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index 2e9a3934a..5762c0606 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -30,11 +30,12 @@ #include "MeasureGUI_2Sel1LineEdit_QTD.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_Prs.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "SOCC_Prs.h" +#include "SOCC_ViewModel.h" +#include "SalomeApp_Tools.h" #include #include @@ -48,6 +49,7 @@ #include "utilities.h" #include +#include #include #include #include @@ -60,12 +62,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_DistanceDlg", Sel ) +MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_DistanceDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_MINDIST" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_MINDIST_TITLE" ) ); @@ -91,7 +93,7 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( QWidget* parent, SALOME_Selectio /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -108,7 +110,7 @@ MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_DistanceDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; @@ -120,7 +122,7 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel ) connect( mySelEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( mySelBtn2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } @@ -133,7 +135,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument() { Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if ( !testResult ) aSelectedObject = GEOM::GEOM_Object::_nil(); @@ -194,7 +196,7 @@ bool MeasureGUI_DistanceDlg::getParameters( double& theDistance, } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } @@ -239,7 +241,7 @@ void MeasureGUI_DistanceDlg::LineEditReturnPressed() else myEditCurrentArgument = mySelEdit2; - if ( GEOMBase::SelectionByNameInDialogs( this, mySelEdit->text(), mySelection ) ) + if ( GEOMBase::SelectionByNameInDialogs( this, mySelEdit->text(), selectedIO() ) ) mySelEdit->setText( mySelEdit->text() ); } @@ -254,7 +256,8 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() gp_Pnt aPnt1( 0, 0, 0 ), aPnt2( 0, 0, 0 ); if ( myObj->_is_nil() || myObj2->_is_nil() || !getParameters( aDist, aPnt1, aPnt2 ) || - QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC ) + SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) return 0; try @@ -293,8 +296,11 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() Handle( AIS_LengthDimension ) anIO = new AIS_LengthDimension( aVert1, aVert2, P, aDist, TCollection_ExtendedString( (Standard_CString)aLabel.latin1() ) ); - QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView(); - OCCViewer_Prs* aPrs = dynamic_cast( vf->CreatePrs( 0 ) ); + SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + SOCC_Prs* aPrs = dynamic_cast( ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs( 0 ) ); + + //QAD_ViewFrame* vf = GEOM_Displayer::GetActiveView(); + //OCCViewer_Prs* aPrs = dynamic_cast( vf->CreatePrs( 0 ) ); if ( aPrs ) aPrs->AddObject( anIO ); diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.h b/src/MeasureGUI/MeasureGUI_DistanceDlg.h index 25c60f9d5..bb935c2fa 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.h +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.h @@ -44,8 +44,8 @@ class MeasureGUI_DistanceDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_DistanceDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_DistanceDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_DistanceDlg(); protected: @@ -59,7 +59,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( double& theDistance, gp_Pnt& thePnt1, gp_Pnt& thePnt2 ); diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index 96c38a341..2c36eacac 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -27,7 +27,6 @@ #include "MeasureGUI_InertiaDlg.h" #include "MeasureGUI_1Sel12LineEdit_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "GEOMBase.h" @@ -38,9 +37,11 @@ #include #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Tools.h" #include +#include #include #include #include @@ -54,12 +55,12 @@ // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_InertiaDlg::MeasureGUI_InertiaDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_InertiaDlg", Sel ) +MeasureGUI_InertiaDlg::MeasureGUI_InertiaDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_InertiaDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_INERTIA" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_INERTIA_TITLE" ) ); @@ -96,7 +97,7 @@ MeasureGUI_InertiaDlg::MeasureGUI_InertiaDlg( QWidget* parent, SALOME_Selection* /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -113,11 +114,11 @@ MeasureGUI_InertiaDlg::~MeasureGUI_InertiaDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_InertiaDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_InertiaDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -193,7 +194,7 @@ bool MeasureGUI_InertiaDlg::getParameters( gp_Mat& I, } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.h b/src/MeasureGUI/MeasureGUI_InertiaDlg.h index 0a45b87d2..f636d1263 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.h +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.h @@ -45,8 +45,8 @@ class MeasureGUI_InertiaDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_InertiaDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_InertiaDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_InertiaDlg(); protected: @@ -55,7 +55,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( gp_Mat& theMatrix, gp_XYZ& theMoment ); diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 7fb4de9f6..75be01ef7 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -28,12 +28,13 @@ #include "MeasureGUI_MaxToleranceDlg.h" #include "MeasureGUI_1Sel6LineEdit_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Tools.h" #include +#include #include #include #include @@ -46,12 +47,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_MaxToleranceDlg::MeasureGUI_MaxToleranceDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_MaxToleranceDlg", Sel ) +MeasureGUI_MaxToleranceDlg::MeasureGUI_MaxToleranceDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_MaxToleranceDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_TOLERANCE" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_TOLERANCE_TITLE" ) ); @@ -83,7 +84,7 @@ MeasureGUI_MaxToleranceDlg::MeasureGUI_MaxToleranceDlg( QWidget* parent, SALOME_ /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -100,11 +101,11 @@ MeasureGUI_MaxToleranceDlg::~MeasureGUI_MaxToleranceDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_MaxToleranceDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -171,7 +172,7 @@ bool MeasureGUI_MaxToleranceDlg::getParameters( double& theMinFaceToler, } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h index e580873db..e72d365e4 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h @@ -42,8 +42,8 @@ class MeasureGUI_MaxToleranceDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_MaxToleranceDlg( QWidget* parent, - SALOME_Selection* ); + MeasureGUI_MaxToleranceDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_MaxToleranceDlg(); protected: @@ -53,7 +53,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( double& theMinFaceToler, double& theMaxFaceToler, double& theMinEdgeToler, diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx index 5747f70b9..d5aab6ed4 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -27,10 +27,13 @@ // $Header$ #include "MeasureGUI_PointDlg.h" -#include "utilities.h" -#include "QAD_Desktop.h" #include "GEOMBase.h" +#include "utilities.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + #include #include #include @@ -57,13 +60,13 @@ // purpose : Constructs a MeasureGUI_PointDlg which is a child of 'parent' // //================================================================================= -MeasureGUI_PointDlg::MeasureGUI_PointDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_PointDlg", Sel ) +MeasureGUI_PointDlg::MeasureGUI_PointDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PointDlg" ) { - QPixmap iconPnt( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap iconPnt( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_POINT" ) ) ); - QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "CAPTION" ) ); @@ -96,7 +99,7 @@ MeasureGUI_PointDlg::MeasureGUI_PointDlg( QWidget* parent, SALOME_Selection* Sel Layout1->addWidget( aGrp, 1, 0 ); - Init( Sel ); + Init(); } @@ -113,11 +116,11 @@ MeasureGUI_PointDlg::~MeasureGUI_PointDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_PointDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_PointDlg::Init() { QSize aSize( size() ); resize( (int)(aSize.width() *0.75 ), aSize.height() ); - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -145,7 +148,7 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if( !testResult || aSelectedObject->_is_nil() ) return; @@ -153,7 +156,8 @@ void MeasureGUI_PointDlg::SelectionIntoArgument() myObj = aSelectedObject; TColStd_IndexedMapOfInteger anIndexes; - mySelection->GetIndex( mySelection->firstIObject(), anIndexes ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))-> + selectionMgr()->GetIndexes( firstIObject(), anIndexes ); TopoDS_Shape aShape; if ( anIndexes.Extent() > 1 || !GEOMBase::GetShape( myObj, aShape ) || aShape.IsNull() ) diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.h b/src/MeasureGUI/MeasureGUI_PointDlg.h index a79072547..5480010bf 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.h +++ b/src/MeasureGUI/MeasureGUI_PointDlg.h @@ -42,8 +42,8 @@ class MeasureGUI_PointDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_PointDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_PointDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_PointDlg(); protected: @@ -54,7 +54,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); private: QLineEdit* myX; QLineEdit* myY; diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index b26488704..596cddd4f 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -28,16 +28,18 @@ #include "MeasureGUI_PropertiesDlg.h" #include "MeasureGUI_1Sel3LineEdit_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "GEOM_Displayer.h" -#include "utilities.h" -#include "QAD_Desktop.h" #include "GEOMImpl_Types.hxx" #include "GEOMBase.h" +#include "SalomeApp_Tools.h" +#include "utilities.h" +#include "SUIT_Session.h" + #include #include +#include #include #include #include @@ -50,12 +52,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_PropertiesDlg::MeasureGUI_PropertiesDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_PropertiesDlg", Sel ) +MeasureGUI_PropertiesDlg::MeasureGUI_PropertiesDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_PropertiesDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_BASICPROPERTIES" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_PROPERTIES_TITLE" ) ); @@ -82,7 +84,7 @@ MeasureGUI_PropertiesDlg::MeasureGUI_PropertiesDlg( QWidget* parent, SALOME_Sele /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -99,11 +101,11 @@ MeasureGUI_PropertiesDlg::~MeasureGUI_PropertiesDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_PropertiesDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_PropertiesDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -169,7 +171,7 @@ bool MeasureGUI_PropertiesDlg::getParameters( double& theLength, } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h index d52ea9d8a..f3cbdb2e3 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h @@ -41,8 +41,8 @@ class MeasureGUI_PropertiesDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_PropertiesDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_PropertiesDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_PropertiesDlg(); protected: @@ -54,7 +54,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( double& theLength, double& theArea, double& theVolume ); diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index 39bcaf04f..402285c3d 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -27,18 +27,21 @@ // $Header$ #include "MeasureGUI_Skeleton.h" -#include "QAD_Desktop.h" -#include "QAD_WaitCursor.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" #include "GeometryGUI.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_Tools.h" +#include "SUIT_Session.h" #include #include #include #include #include +#include //================================================================================= // class : MeasureGUI_Skeleton() @@ -47,11 +50,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_Skeleton::MeasureGUI_Skeleton( QWidget* parent, - const char* name, - SALOME_Selection* Sel ) +MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI, + QWidget* parent, + const char* name ) : MeasureGUI_Skeleton_QTD( parent, name, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + myGeomGUI( GUI ) { mySelBtn = 0; @@ -85,13 +89,9 @@ MeasureGUI_Skeleton::~MeasureGUI_Skeleton() // function : Init() // purpose : //================================================================================= -void MeasureGUI_Skeleton::Init( SALOME_Selection* Sel ) +void MeasureGUI_Skeleton::Init() { - myGeomGUI = GeometryGUI::GetGeomGUI(); - /* init variables */ - mySelection = Sel; - myGeomGUI->SetActiveDialogBox((QDialog*)this); /* signals and slots connections */ @@ -111,9 +111,10 @@ void MeasureGUI_Skeleton::Init( SALOME_Selection* Sel ) connect( mySelBtn, SIGNAL( clicked() ), this, SLOT ( SetEditCurrentArgument() ) ); - if ( mySelection ) - connect( mySelection, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ); + SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + connect( aSel, SIGNAL( currentSelectionChanged() ), + this, SLOT ( SelectionIntoArgument() ) ) ; /* displays Dialog */ RadioButton1->setChecked( TRUE ); @@ -147,7 +148,7 @@ void MeasureGUI_Skeleton::LineEditReturnPressed() const QString objectUserName = mySelEdit->text(); QWidget* thisWidget = ( QWidget* )this; - if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) + if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, selectedIO() ) ) mySelEdit->setText( objectUserName ); } @@ -160,9 +161,10 @@ void MeasureGUI_Skeleton::DeactivateActiveDialog() { setEnabled( false ); - if ( mySelection ) - disconnect( mySelection, 0, this, 0 ); - + SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + disconnect( aSel, 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); globalSelection(); @@ -181,9 +183,10 @@ void MeasureGUI_Skeleton::ActivateThisDialog() myGeomGUI->SetActiveDialogBox( ( QDialog* )this ); - if ( mySelection ) - connect( mySelection, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ); + SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + connect( aSel, SIGNAL( currentSelectionChanged() ), + this, SLOT ( SelectionIntoArgument() ) ) ; redisplayPreview(); activateSelection(); @@ -209,7 +212,7 @@ void MeasureGUI_Skeleton::SelectionIntoArgument() Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if( !testResult || aSelectedObject->_is_nil() ) { @@ -240,7 +243,9 @@ void MeasureGUI_Skeleton::processObject() //================================================================================= void MeasureGUI_Skeleton::closeEvent( QCloseEvent* e ) { - disconnect( mySelection, 0, this, 0 ); + SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + disconnect( aSel, 0, this, 0 ); QDialog::closeEvent( e ); } @@ -282,7 +287,7 @@ void MeasureGUI_Skeleton::redisplayPreview() try { - QAD_WaitCursor wc; + QApplication::setOverrideCursor( Qt::waitCursor ); getDisplayer()->SetColor( Quantity_NOC_VIOLET ); getDisplayer()->SetToActivate( false ); @@ -292,7 +297,7 @@ void MeasureGUI_Skeleton::redisplayPreview() } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); } } @@ -322,7 +327,7 @@ bool MeasureGUI_Skeleton::isValid( QString& ) GEOM_Displayer* MeasureGUI_Skeleton::getDisplayer() { if ( !myDisplayer ) - myDisplayer = new GEOM_Displayer(); + myDisplayer = new GEOM_Displayer( getStudy() ); return myDisplayer; } @@ -335,26 +340,11 @@ GEOM::GEOM_IOperations_ptr MeasureGUI_Skeleton::createOperation() return getGeomEngine()->GetIMeasureOperations( getStudyId() ); } - - - - - - - - - - - - - - - - - - - - - - - +//================================================================================= +// function : getDesktop() +// purpose : +//================================================================================= +SUIT_Desktop* MeasureGUI_Skeleton::getDesktop() const +{ + return dynamic_cast( parentWidget() ); +} diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.h b/src/MeasureGUI/MeasureGUI_Skeleton.h index 664ee5a33..8d3236814 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.h +++ b/src/MeasureGUI/MeasureGUI_Skeleton.h @@ -36,7 +36,6 @@ class GeometryGUI; class QWidget; class QLineEdit; class QPushButton; -class SALOME_Selection; class GEOM_Displayer; class MeasureGUI_Skeleton : public MeasureGUI_Skeleton_QTD, @@ -45,9 +44,9 @@ class MeasureGUI_Skeleton : public MeasureGUI_Skeleton_QTD, Q_OBJECT public: - MeasureGUI_Skeleton( QWidget* parent, - const char* name, - SALOME_Selection* Sel = 0 ); + MeasureGUI_Skeleton( GeometryGUI* GUI, + QWidget* parent, + const char* name ); ~MeasureGUI_Skeleton(); protected slots: @@ -61,7 +60,7 @@ protected slots: protected: - void Init( SALOME_Selection* Sel ); + void Init(); void enterEvent( QEvent* e ); void closeEvent( QCloseEvent* e ); @@ -75,13 +74,14 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual SUIT_Desktop* getDesktop() const; + protected: QPushButton* mySelBtn; QLineEdit* mySelEdit; GEOM::GEOM_Object_var myObj; - SALOME_Selection* mySelection; GeometryGUI* myGeomGUI; GEOM_Displayer* myDisplayer; }; diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 0f30aaed2..7bd5a6a81 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -28,7 +28,6 @@ #include "MeasureGUI_WhatisDlg.h" #include "MeasureGUI_1Sel1TextView_QTD.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "GEOMBase.h" #include @@ -41,10 +40,12 @@ #include #include "utilities.h" -#include "QAD_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Tools.h" #include #include +#include #include #include #include @@ -57,12 +58,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( QWidget* parent, SALOME_Selection* Sel ) -: MeasureGUI_Skeleton( parent, "MeasureGUI_WhatisDlg", Sel ) +MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( GeometryGUI* GUI, QWidget* parent ) +: MeasureGUI_Skeleton( GUI, parent, "MeasureGUI_WhatisDlg" ) { - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_DLG_WHATIS" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_WHATIS_TITLE" ) ); @@ -84,7 +85,7 @@ MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( QWidget* parent, SALOME_Selection* S /***************************************************************/ /* Initialisation */ - Init( Sel ); + Init(); } @@ -101,11 +102,11 @@ MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_WhatisDlg::Init() { mySelBtn = myGrp->PushButton1; mySelEdit = myGrp->LineEdit1; - MeasureGUI_Skeleton::Init( Sel ); + MeasureGUI_Skeleton::Init(); } //================================================================================= @@ -135,7 +136,7 @@ bool MeasureGUI_WhatisDlg::getParameters( QString& theText ) } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); return false; } diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.h b/src/MeasureGUI/MeasureGUI_WhatisDlg.h index e94d8dd0a..72aae55cf 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.h +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.h @@ -42,8 +42,8 @@ class MeasureGUI_WhatisDlg : public MeasureGUI_Skeleton Q_OBJECT public: - MeasureGUI_WhatisDlg( QWidget* parent, - SALOME_Selection* Sel ); + MeasureGUI_WhatisDlg( GeometryGUI* GUI, + QWidget* parent ); ~MeasureGUI_WhatisDlg(); protected: @@ -53,7 +53,7 @@ protected: private: - void Init( SALOME_Selection* Sel ); + void Init(); bool getParameters( QString& ); private: diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in index db0e73fcd..589469a87 100644 --- a/src/OBJECT/Makefile.in +++ b/src/OBJECT/Makefile.in @@ -58,9 +58,9 @@ LIB_CLIENT_IDL = BIN = BIN_SRC = -CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome +CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome %_moc.cxx: %.h $(MOC) $< -o $@ diff --git a/src/OperationGUI/Makefile.in b/src/OperationGUI/Makefile.in index 04a05bbf9..6b7f980d8 100644 --- a/src/OperationGUI/Makefile.in +++ b/src/OperationGUI/Makefile.in @@ -56,14 +56,14 @@ LIB_MOC = \ OperationGUI_ChamferDlg.h \ OperationGUI_ClippingDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += $(CAS_LDPATH) -lTKFillet -lGEOMBase diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx index e784ac282..b24f64e55 100644 --- a/src/OperationGUI/OperationGUI.cxx +++ b/src/OperationGUI/OperationGUI.cxx @@ -29,11 +29,8 @@ using namespace std; #include "OperationGUI.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" #include #include @@ -52,11 +49,11 @@ OperationGUI* OperationGUI::myGUIObject = 0; // function : GetOperationGUI() // purpose : Get the only OperationGUI object [ static ] //======================================================================= -OperationGUI* OperationGUI::GetOperationGUI() +OperationGUI* OperationGUI::GetOperationGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init OperationGUI only once - myGUIObject = new OperationGUI(); + myGUIObject = new OperationGUI( parent ); } return myGUIObject; } @@ -65,7 +62,7 @@ OperationGUI* OperationGUI::GetOperationGUI() // function : OperationGUI() // purpose : Constructor //======================================================================= -OperationGUI::OperationGUI() : GEOMGUI() +OperationGUI::OperationGUI(GeometryGUI* parent) : GEOMGUI(parent) { } @@ -83,32 +80,29 @@ OperationGUI::~OperationGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool OperationGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) +bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) { - OperationGUI* myOperationGUI = GetOperationGUI(); - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection( - QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + getGeometryGUI()->EmitSignalDeactivateDialog(); switch ( theCommandID ) { case 503: // PARTITION - ( new OperationGUI_PartitionDlg( parent, "", Sel ) )->show(); + ( new OperationGUI_PartitionDlg( parent, "" ) )->show(); break; case 504: // ARCHIMEDE - new OperationGUI_ArchimedeDlg( parent, Sel ); + new OperationGUI_ArchimedeDlg( getGeometryGUI(), parent ); break; case 505: // FILLET - new OperationGUI_FilletDlg( parent, Sel ); + new OperationGUI_FilletDlg( parent ); break; case 506: // CHAMFER - new OperationGUI_ChamferDlg( parent, Sel ); + new OperationGUI_ChamferDlg( parent ); break; case 507: // CLIPPING RANGE ( new OperationGUI_ClippingDlg( parent, "" ) )->show(); break; default: - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } @@ -120,8 +114,8 @@ bool OperationGUI::OnGUIEvent( int theCommandID, QAD_Desktop* parent ) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI(GeometryGUI* parent) { - return OperationGUI::GetOperationGUI(); + return OperationGUI::GetOperationGUI(parent); } } diff --git a/src/OperationGUI/OperationGUI.h b/src/OperationGUI/OperationGUI.h index 17786bb80..02e38cf12 100644 --- a/src/OperationGUI/OperationGUI.h +++ b/src/OperationGUI/OperationGUI.h @@ -39,15 +39,15 @@ class OperationGUI : public GEOMGUI { protected: - OperationGUI(); // hide constructor to avoid direct creation + OperationGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~OperationGUI(); // Get the only OperationGUI object - static OperationGUI* GetOperationGUI(); + static OperationGUI* GetOperationGUI( GeometryGUI* parent ); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); private: static OperationGUI* myGUIObject; // the only OperationGUI object diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 26a867ae2..2efc7b0f0 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -29,8 +29,12 @@ #include "OperationGUI_ArchimedeDlg.h" #include "DlgRef_1Sel3Spin.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include //================================================================================= // class : OperationGUI_ArchimedeDlg() @@ -39,14 +43,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, SALOME_Selection* Sel ) -: GEOMBase_Skeleton( parent, "ArchimedeDlg", Sel, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) +: GEOMBase_Skeleton( parent, "ArchimedeDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - mySelection = Sel; - - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_ARCHIMEDE_TITLE")); @@ -69,7 +71,7 @@ OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, SALOME_Se /***************************************************************/ /* Initialisations */ - Init( mySelection ); + Init(); } @@ -87,16 +89,14 @@ OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg() // function : Init() // purpose : //================================================================================= -void OperationGUI_ArchimedeDlg::Init( SALOME_Selection* Sel ) +void OperationGUI_ArchimedeDlg::Init() { - mySelection = Sel; - /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; /* Get setting of myStep value from file configuration */ - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ); - myStep = !St.isEmpty() ? St.toDouble() : 100; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double myStep = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double SpecificStep1 = 0.1; double SpecificStep2 = 0.01; @@ -115,14 +115,15 @@ void OperationGUI_ArchimedeDlg::Init( SALOME_Selection* Sel ) connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; - initName( tr( "GEOM_ARCHIMEDE" ) ); - + globalSelection( GEOM_ALLSHAPES ); SelectionIntoArgument(); @@ -167,11 +168,11 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument() myEditCurrentArgument->setText( "" ); myShape = GEOM::GEOM_Object::_nil(); - if ( mySelection->IObjectCount() != 1 ) + if ( IObjectCount() != 1 ) return; Standard_Boolean testResult = Standard_False; - myShape = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + myShape = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if ( !testResult || myShape->_is_nil() || !GEOMBase::IsShape( myShape ) ) { @@ -207,7 +208,8 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection( GEOM_ALLSHAPES ); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); return; } diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.h b/src/OperationGUI/OperationGUI_ArchimedeDlg.h index b11b6fd8d..f1c1fd7d7 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.h +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.h @@ -42,9 +42,8 @@ class OperationGUI_ArchimedeDlg : public GEOMBase_Skeleton Q_OBJECT public: - OperationGUI_ArchimedeDlg( QWidget* parent, - SALOME_Selection* Sel ); - ~OperationGUI_ArchimedeDlg(); + OperationGUI_ArchimedeDlg( GeometryGUI* theGeometryGUI, QWidget* parent ); + ~OperationGUI_ArchimedeDlg(); protected: @@ -55,13 +54,14 @@ protected: virtual bool execute( ObjectList& objects ); private: - void Init( SALOME_Selection* ); + void Init(); void enterEvent(QEvent* e); private: GEOM::GEOM_Object_var myShape; DlgRef_1Sel3Spin* GroupPoints; double myStep; + GeometryGUI* myGeometryGUI; private slots: void ClickOnOk(); diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 856d941d1..38486902b 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -29,7 +29,16 @@ #include "OperationGUI_ChamferDlg.h" #include "DlgRef_SpinBox.h" -#include "QAD_Desktop.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" + +#include + +#include #include "qpixmap.h" #include @@ -42,18 +51,16 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( QWidget* parent, SALOME_Selection* Sel ) -: GEOMBase_Skeleton(parent, "ChamferDlg", Sel, false, +OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( QWidget* parent ) +: GEOMBase_Skeleton(parent, "ChamferDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - - mySelection = Sel; myConstructorId = -1; - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE"))); - QPixmap iconSelect(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE"))); + QPixmap iconSelect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); @@ -143,7 +150,7 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( QWidget* parent, SALOME_Select anIter.data()->RangeStepAndValidator( 0.001, 999.999, SpecificStep, 3 ); /* Initialisations */ - Init( mySelection ); + Init(); } @@ -160,9 +167,8 @@ OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() // function : Init() // purpose : //================================================================================= -void OperationGUI_ChamferDlg::Init( SALOME_Selection* Sel ) +void OperationGUI_ChamferDlg::Init() { - mySelection = Sel; myConstructorId = -1; reset(); RadioButton1->setChecked( true ); @@ -197,8 +203,8 @@ void OperationGUI_ChamferDlg::Init( SALOME_Selection* Sel ) this, SLOT( ValueChangedInSpinBox( double ) ) ); // selection - connect( mySelection, SIGNAL( currentSelectionChanged() ), - this, SLOT( SelectionIntoArgument() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_CHAMFER" ) ); @@ -217,11 +223,12 @@ void OperationGUI_ChamferDlg::Init( SALOME_Selection* Sel ) void OperationGUI_ChamferDlg::ConstructorsClicked( int constructorId ) { // Activate next widget - if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC ) - { - RadioButton1->setChecked( true ); - return; - } + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) + { + RadioButton1->setChecked( true ); + return; + } if ( myConstructorId == constructorId ) return; @@ -334,11 +341,11 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() // If selection of main object is activated if ( aCurrFocus == MainObj1 || aCurrFocus == MainObj2 || aCurrFocus == MainObj3 ) { - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { @@ -356,16 +363,16 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() // If face selection of second tab is activated else if ( aCurrFocus == Face1 || aCurrFocus == Face2 ) { - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger anIndexes; - mySelection->GetIndex( mySelection->firstIObject(), anIndexes ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); if ( anIndexes.Extent() == 1 ) { @@ -384,16 +391,16 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() // If face selection of third tab is activated else if ( aCurrFocus == Faces ) { - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger anIndexes; - mySelection->GetIndex( mySelection->firstIObject(), anIndexes ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); if ( anIndexes.Extent() > 0 ) { @@ -475,8 +482,8 @@ void OperationGUI_ChamferDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( mySelection, SIGNAL(currentSelectionChanged()), - this, SLOT( SelectionIntoArgument() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); displayPreview(); diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index 1291337bc..cb69ad24b 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -46,8 +46,7 @@ class OperationGUI_ChamferDlg : public GEOMBase_Skeleton enum { SpinBox1, SpinBox21, SpinBox22, SpinBox31, SpinBox32 }; public: - OperationGUI_ChamferDlg( QWidget* parent, - SALOME_Selection* Sel ); + OperationGUI_ChamferDlg( QWidget* parent ); virtual ~OperationGUI_ChamferDlg(); protected: @@ -70,7 +69,7 @@ private slots: private : - void Init( SALOME_Selection* ); + void Init(); void enterEvent( QEvent* e ); void reset(); void createSelWg( const QString&, QPixmap&, QWidget*, const int ); diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.cxx b/src/OperationGUI/OperationGUI_ClippingDlg.cxx index 932627e35..bdda9f768 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.cxx +++ b/src/OperationGUI/OperationGUI_ClippingDlg.cxx @@ -29,15 +29,14 @@ #include "OperationGUI_ClippingDlg.h" #include "DlgRef_SpinBox.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "VTKViewer_ViewFrame.h" -#include "OCCViewer_ViewFrame.h" -#include "QAD_MessageBox.h" -#include "utilities.h" +#include "SUIT_Session.h" +#include "SUIT_ViewWindow.h" +#include "VTKViewer_ViewWindow.h" +#include "VTKViewer_ViewModel.h" +#include "OCCViewer_ViewWindow.h" #include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_Viewer3d.h" + +#include "utilities.h" #include #include @@ -58,8 +57,8 @@ // class : OperationGUI_ClippingDlg() // purpose : //================================================================================= -OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : GEOMBase_Skeleton( parent, "OperationGUI_ClippingDlg", 0, false, +OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : GEOMBase_Skeleton( parent, "OperationGUI_ClippingDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { setCaption( tr( "Change clipping range" ) ); @@ -80,7 +79,7 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( QWidget* parent, const char* // Controls TextLabelNear = new QLabel( GroupArguments, "TextLabelNear" ); TextLabelNear->setText( tr( "Near" ) ); - //mzn TextLabelNear->setFixedWidth(74); + TextLabelNear->setFixedWidth(74); GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 ); SpinBox_Near = new DlgRef_SpinBox( GroupArguments, "SpinBox_Near"); @@ -88,7 +87,7 @@ OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( QWidget* parent, const char* TextLabelFar = new QLabel( GroupArguments, "TextLabelFar" ); TextLabelFar->setText( tr( "Far" ) ); - //mzn TextLabelFar->setFixedWidth(74); + TextLabelFar->setFixedWidth(74); GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 ); SpinBox_Far = new DlgRef_SpinBox( GroupArguments, "SpinBox_Far"); @@ -142,12 +141,14 @@ OperationGUI_ClippingDlg::~ OperationGUI_ClippingDlg() //================================================================================= void OperationGUI_ClippingDlg::Init() { - QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> - getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); + SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (!anActiveWindow) + return; - VTKViewer_ViewFrame* aVTKFrame = dynamic_cast( aFrame ); - if ( aVTKFrame ) - { + if ( anActiveWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) + { + VTKViewer_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); + TextLabelNear->setText( tr( "Near" ) ); TextLabelFar->setText( tr( "Far" ) ); @@ -191,10 +192,10 @@ void OperationGUI_ClippingDlg::Init() return; } - - OCCViewer_ViewFrame* aOCCFrame = dynamic_cast( aFrame ); - if ( aOCCFrame ) + else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); + TextLabelNear->setText( tr( "Depth" ) ); TextLabelFar->setText( tr( "Thickness" ) ); @@ -218,12 +219,14 @@ void OperationGUI_ClippingDlg::Init() //================================================================================= bool OperationGUI_ClippingDlg::ClickOnApply() { - QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> - getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); + SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (!anActiveWindow) + return false; - VTKViewer_ViewFrame* aVTKFrame = dynamic_cast( aFrame ); - if ( aVTKFrame ) + if ( anActiveWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) { + VTKViewer_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return false; @@ -239,10 +242,10 @@ bool OperationGUI_ClippingDlg::ClickOnApply() return true; } - - OCCViewer_ViewFrame* aOCCFrame = dynamic_cast( aFrame ); - if ( aOCCFrame ) + else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)aOCCFrame->getViewPort())->getView(); double depth = SpinBox_Near->GetValue(); @@ -324,12 +327,14 @@ void OperationGUI_ClippingDlg::closeEvent( QCloseEvent* e ) //================================================================================= void OperationGUI_ClippingDlg::onReset() { - QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()-> - getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame(); + SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if (!anActiveWindow) + return; - VTKViewer_ViewFrame* aVTKFrame = dynamic_cast( aFrame ); - if ( aVTKFrame ) + if ( anActiveWindow->getViewManager()->getType() == VTKViewer_Viewer::Type() ) { + VTKViewer_ViewWindow* aVTKFrame = dynamic_cast( anActiveWindow ); + vtkRenderer* aRenderer = aVTKFrame->getRenderer(); if(!aRenderer) return; @@ -368,10 +373,10 @@ void OperationGUI_ClippingDlg::onReset() return; } - - OCCViewer_ViewFrame* aOCCFrame = dynamic_cast( aFrame ); - if ( aOCCFrame ) + else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + OCCViewer_ViewWindow* aOCCFrame = dynamic_cast( anActiveWindow ); + TextLabelNear->setText( tr( "Depth" ) ); TextLabelFar->setText( tr( "Thickness" ) ); diff --git a/src/OperationGUI/OperationGUI_ClippingDlg.h b/src/OperationGUI/OperationGUI_ClippingDlg.h index b59306ef7..ba5e6ee07 100644 --- a/src/OperationGUI/OperationGUI_ClippingDlg.h +++ b/src/OperationGUI/OperationGUI_ClippingDlg.h @@ -48,7 +48,7 @@ class OperationGUI_ClippingDlg : public GEOMBase_Skeleton Q_OBJECT public: - OperationGUI_ClippingDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + OperationGUI_ClippingDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_ClippingDlg(); private : diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index ae49d6c2e..3516a9280 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -29,8 +29,16 @@ #include "OperationGUI_FilletDlg.h" #include "DlgRef_1Sel1Spin.h" #include "DlgRef_2Sel1Spin.h" -#include "QAD_Desktop.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "OCCViewer_ViewModel.h" + +#include "qlabel.h" #include "qpixmap.h" +#include #include #include @@ -43,18 +51,17 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_FilletDlg::OperationGUI_FilletDlg( QWidget* parent, SALOME_Selection* Sel ) - :GEOMBase_Skeleton( parent, "OperationGUI_FilletDlg", Sel, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +OperationGUI_FilletDlg::OperationGUI_FilletDlg( QWidget* parent ) + :GEOMBase_Skeleton( parent, "OperationGUI_FilletDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { myConstructorId = -1; - mySelection = Sel; - QPixmap image0( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) ); - QPixmap image1( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) ); - QPixmap image2( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_FACE" ) ) ); + QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_ALL" ) ) ); + QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_EDGE" ) ) ); + QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_FILLET_FACE" ) ) ); - QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); setCaption( tr( "GEOM_FILLET_TITLE" ) ); @@ -102,7 +109,7 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg( QWidget* parent, SALOME_Selectio Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); /* Initialisations */ - Init( mySelection ); + Init(); } @@ -119,9 +126,8 @@ OperationGUI_FilletDlg::~OperationGUI_FilletDlg() // function : Init() // purpose : //================================================================================= -void OperationGUI_FilletDlg::Init( SALOME_Selection* Sel ) +void OperationGUI_FilletDlg::Init() { - mySelection = Sel; myConstructorId = -1; reset(); RadioButton1->setChecked( true ); @@ -152,7 +158,8 @@ void OperationGUI_FilletDlg::Init( SALOME_Selection* Sel ) connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); // selection - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); initName( tr( "GEOM_FILLET" ) ); @@ -171,7 +178,8 @@ void OperationGUI_FilletDlg::Init( SALOME_Selection* Sel ) //================================================================================= void OperationGUI_FilletDlg::ConstructorsClicked( int constructorId ) { - if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC ) + if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() + != OCCViewer_Viewer::Type() ) { RadioButton1->setChecked( true ); return; @@ -269,11 +277,11 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group3->LineEdit1 ) { - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { @@ -292,16 +300,16 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() else if ( myEditCurrentArgument == Group2->LineEdit2 || myEditCurrentArgument == Group3->LineEdit2 ) { - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), aResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult ); if ( aResult && !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger anIndexes; - mySelection->GetIndex( mySelection->firstIObject(), anIndexes ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( firstIObject(), anIndexes ); if ( anIndexes.Extent() > 0 ) { @@ -411,8 +419,8 @@ void OperationGUI_FilletDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect( mySelection, SIGNAL(currentSelectionChanged()), - this, SLOT( SelectionIntoArgument() ) ); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT( SelectionIntoArgument() ) ); activateSelection(); displayPreview(); diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h index b18f85863..d794e834d 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.h +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -45,8 +45,7 @@ class OperationGUI_FilletDlg : public GEOMBase_Skeleton Q_OBJECT public: - OperationGUI_FilletDlg( QWidget* parent, - SALOME_Selection* Sel ); + OperationGUI_FilletDlg( QWidget* parent ); ~OperationGUI_FilletDlg(); protected: @@ -69,7 +68,7 @@ private slots: private : - void Init( SALOME_Selection* ); + void Init(); void enterEvent( QEvent* e ); void reset(); int getConstructorId() const; diff --git a/src/OperationGUI/OperationGUI_MaterialDlg.cxx b/src/OperationGUI/OperationGUI_MaterialDlg.cxx index bb2231281..82345576a 100644 --- a/src/OperationGUI/OperationGUI_MaterialDlg.cxx +++ b/src/OperationGUI/OperationGUI_MaterialDlg.cxx @@ -29,9 +29,13 @@ using namespace std; #include "OperationGUI_MaterialDlg.h" #include "OperationGUI_PartitionDlg.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + #include "utilities.h" -#include "QAD_Desktop.h" +#include #include #include @@ -43,15 +47,14 @@ using namespace std; // TRUE to construct a modal dialog. //================================================================================= OperationGUI_MaterialDlg::OperationGUI_MaterialDlg (QWidget* parent, const char* name, - SALOME_Selection* Sel, - GEOM::ListOfGO ListShapes, + GEOM::ListOfGO ListShapes, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { myListShapes = ListShapes; myParentDlg = parent; - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); setCaption(tr("GEOM_MATERIAL_TITLE")); @@ -127,7 +130,8 @@ void OperationGUI_MaterialDlg::Init() // connect(GroupPoints->ListView1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); // connect(GroupPoints->SpinBox1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* displays Dialog */ MESSAGE("GroupPoints->show() ..."); @@ -146,7 +150,7 @@ void OperationGUI_MaterialDlg::Init() //================================================================================= void OperationGUI_MaterialDlg::ClickOnOk() { - QAD_Application::getDesktop()->putInfo(tr("")); + SUIT_Session::session()->activeApplication()->putInfo(tr("")); int nbSh = myListShapes.length(); myListMaterials.length(nbSh); @@ -179,12 +183,12 @@ void OperationGUI_MaterialDlg::SelectionIntoArgument() { QString aString = ""; /* name of selection */ - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(selectedIO(), aString); if(nbSel < 1) { return; } -// myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + //myGeomBase->ConvertListOfIOInListOfIOR(selectedIO(), myListShapes); /* no simulation */ return; @@ -216,7 +220,8 @@ void OperationGUI_MaterialDlg::SetMaterial() void OperationGUI_MaterialDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); return; } diff --git a/src/OperationGUI/OperationGUI_MaterialDlg.h b/src/OperationGUI/OperationGUI_MaterialDlg.h index 9c1bd46ed..a57dfe514 100644 --- a/src/OperationGUI/OperationGUI_MaterialDlg.h +++ b/src/OperationGUI/OperationGUI_MaterialDlg.h @@ -41,8 +41,7 @@ class OperationGUI_MaterialDlg : public GEOMBase_Skeleton Q_OBJECT public: - OperationGUI_MaterialDlg (QWidget* parent, const char* name, - SALOME_Selection* Sel, + OperationGUI_MaterialDlg (QWidget* parent, const char* name, GEOM::ListOfGO ListShapes, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_MaterialDlg(); diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index be89f1131..bedc63180 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -31,9 +31,14 @@ #include "GEOMImpl_Types.hxx" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include +#include +#include #include "utilities.h" @@ -44,12 +49,12 @@ // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION_PLANE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION_PLANE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_PARTITION_TITLE")); @@ -130,7 +135,8 @@ void OperationGUI_PartitionDlg::Init() connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_PARTITION" ) ); ConstructorsClicked( 0 ); @@ -143,7 +149,7 @@ void OperationGUI_PartitionDlg::Init() //================================================================================= void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); globalSelection(); myListShapes.length(0); @@ -187,7 +193,8 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) onRemoveWebs(false); myEditCurrentArgument->setFocus(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); MESSAGE(width()<<" "<setText( "" ); QString aString = ""; - int nbSel = GEOMBase::GetNameOfSelectedIObjects( mySelection, aString, true ); + int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true ); if ( nbSel < 1 ) { @@ -264,26 +271,26 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { - GEOMBase::ConvertListOfIOInListOfGO( mySelection->StoredIObjects(), myListShapes, true ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true ); myListMaterials.length( 0 ); if ( !myListShapes.length() ) return; } else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) { - GEOMBase::ConvertListOfIOInListOfGO( mySelection->StoredIObjects(), myListTools, true ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListTools, true ); if ( !myListTools.length() ) return; } else if(myEditCurrentArgument == GroupPoints->LineEdit3) { - GEOMBase::ConvertListOfIOInListOfGO( mySelection->StoredIObjects(), myListRemoveInside, true ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListRemoveInside, true ); if (!myListRemoveInside.length()) return; } else if(myEditCurrentArgument == GroupPoints->LineEdit4) { - GEOMBase::ConvertListOfIOInListOfGO( mySelection->StoredIObjects(), myListKeepInside, true ); + GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListKeepInside, true ); if ( !myListKeepInside.length() ) return; } @@ -346,7 +353,8 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed() void OperationGUI_PartitionDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -467,11 +475,9 @@ void OperationGUI_PartitionDlg::ComboTextChanged() //================================================================================= void OperationGUI_PartitionDlg::SetMaterials() { - SALOME_Selection* Sel = - SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); MESSAGE("OperationGUI_MaterialDlg ..."); OperationGUI_MaterialDlg *aDlg = - new OperationGUI_MaterialDlg(this, "", Sel, myListShapes, true); + new OperationGUI_MaterialDlg(this, "", myListShapes, true); MESSAGE("OperationGUI_MaterialDlg"); return; } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index d6d35ded3..1599bf1a8 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.h +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -42,7 +42,7 @@ class OperationGUI_PartitionDlg : public GEOMBase_Skeleton Q_OBJECT public: - OperationGUI_PartitionDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + OperationGUI_PartitionDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_PartitionDlg(); void SetListMaterials(GEOM::ListOfLong ListMaterials) diff --git a/src/PrimitiveGUI/Makefile.in b/src/PrimitiveGUI/Makefile.in index 78c535dc7..deac5e77e 100644 --- a/src/PrimitiveGUI/Makefile.in +++ b/src/PrimitiveGUI/Makefile.in @@ -54,14 +54,14 @@ LIB_MOC = \ PrimitiveGUI_TorusDlg.h \ PrimitiveGUI_ConeDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMFiltersSelection -lGEOMBase diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index 0304e194f..4e90069bd 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -30,10 +30,8 @@ using namespace std; #include "PrimitiveGUI.h" #include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" - -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" #include "PrimitiveGUI_BoxDlg.h" // Method BOX #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER @@ -47,11 +45,11 @@ PrimitiveGUI* PrimitiveGUI::myGUIObject = 0; // function : GetPrimitiveGUI() // purpose : Get the only PrimitiveGUI object [ static ] //======================================================================= -PrimitiveGUI* PrimitiveGUI::GetPrimitiveGUI() +PrimitiveGUI* PrimitiveGUI::GetPrimitiveGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init PrimitiveGUI only once - myGUIObject = new PrimitiveGUI(); + myGUIObject = new PrimitiveGUI( parent ); } return myGUIObject; } @@ -60,7 +58,7 @@ PrimitiveGUI* PrimitiveGUI::GetPrimitiveGUI() // function : PrimitiveGUI() // purpose : Constructor //======================================================================= -PrimitiveGUI::PrimitiveGUI() : GEOMGUI() +PrimitiveGUI::PrimitiveGUI(GeometryGUI* parent) : GEOMGUI(parent) { } @@ -78,11 +76,9 @@ PrimitiveGUI::~PrimitiveGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool PrimitiveGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - PrimitiveGUI* aPrimitiveGUI = GetPrimitiveGUI(); - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; @@ -90,32 +86,32 @@ bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { case 4021: // BOX { - aDlg = new PrimitiveGUI_BoxDlg(parent, "", Sel); + aDlg = new PrimitiveGUI_BoxDlg(getGeometryGUI(), parent, ""); break; } case 4022: // CYLINDER { - aDlg = new PrimitiveGUI_CylinderDlg(parent, "", Sel); + aDlg = new PrimitiveGUI_CylinderDlg(getGeometryGUI(), parent, ""); break; } case 4023: // SPHERE { - aDlg = new PrimitiveGUI_SphereDlg(parent, "", Sel); + aDlg = new PrimitiveGUI_SphereDlg(getGeometryGUI(), parent, ""); break; } case 4024: // TORUS { - aDlg = new PrimitiveGUI_TorusDlg(parent, "", Sel); + aDlg = new PrimitiveGUI_TorusDlg(getGeometryGUI(), parent, ""); break; } case 4025: // CONE { - aDlg = new PrimitiveGUI_ConeDlg(parent, "", Sel); + aDlg = new PrimitiveGUI_ConeDlg(getGeometryGUI(), parent, ""); break; } default: { - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } } @@ -132,8 +128,8 @@ bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return PrimitiveGUI::GetPrimitiveGUI(); + return PrimitiveGUI::GetPrimitiveGUI( parent ); } } diff --git a/src/PrimitiveGUI/PrimitiveGUI.h b/src/PrimitiveGUI/PrimitiveGUI.h index 3276c5ed6..ce0b00d77 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.h +++ b/src/PrimitiveGUI/PrimitiveGUI.h @@ -39,15 +39,15 @@ class PrimitiveGUI : public GEOMGUI { protected: - PrimitiveGUI(); // hide constructor to avoid direct creation + PrimitiveGUI(GeometryGUI* parent); // hide constructor to avoid direct creation public : ~PrimitiveGUI(); // Get the only PrimitiveGUI object - static PrimitiveGUI* GetPrimitiveGUI(); + static PrimitiveGUI* GetPrimitiveGUI(GeometryGUI* parent); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); private: static PrimitiveGUI* myGUIObject; // the only PrimitiveGUI object diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index de16e300b..6ad4bbc87 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -28,8 +28,12 @@ #include "PrimitiveGUI_BoxDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -45,12 +49,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_2P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); setCaption(tr("GEOM_BOX_TITLE")); @@ -105,9 +109,9 @@ void PrimitiveGUI_BoxDlg::Init() myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + /* min, max, step and decimals for spin boxes */ GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); @@ -133,11 +137,12 @@ void PrimitiveGUI_BoxDlg::Init() connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_BOX" ) ); ConstructorsClicked(0); @@ -150,7 +155,7 @@ void PrimitiveGUI_BoxDlg::Init() //================================================================================= void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); switch (constructorId) { @@ -167,7 +172,8 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit2->setText(""); myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: @@ -230,7 +236,7 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); - if (mySelection->IObjectCount() != 1) + if (IObjectCount() != 1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil(); @@ -241,7 +247,7 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -299,7 +305,8 @@ void PrimitiveGUI_BoxDlg::LineEditReturnPressed() void PrimitiveGUI_BoxDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -385,7 +392,6 @@ bool PrimitiveGUI_BoxDlg::execute( ObjectList& objects ) anObj = GEOM::GEOM_I3DPrimOperations::_narrow( getOperation() )->MakeBoxDXDYDZ( x, y, z ); res = true; - break; } } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h index 1756b3984..51d8ecedd 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h @@ -44,7 +44,7 @@ class PrimitiveGUI_BoxDlg : public GEOMBase_Skeleton Q_OBJECT public: - PrimitiveGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + PrimitiveGUI_BoxDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~PrimitiveGUI_BoxDlg(); protected: @@ -58,6 +58,8 @@ protected: private : void Init(); void enterEvent(QEvent* e); + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points containing the vector */ diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 2a4055a6b..3339c7afe 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -28,8 +28,12 @@ #include "PrimitiveGUI_ConeDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -44,12 +48,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CONE_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_CONE_TITLE")); @@ -107,9 +111,9 @@ void PrimitiveGUI_ConeDlg::Init() myPoint = myDir = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.000, 999.999, step, 3); GroupPoints->SpinBox_DY->RangeStepAndValidator(0.000, 999.999, step, 3); @@ -144,14 +148,15 @@ void PrimitiveGUI_ConeDlg::Init() connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_CONE" ) ); ConstructorsClicked(0); @@ -164,7 +169,7 @@ void PrimitiveGUI_ConeDlg::Init() //================================================================================= void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); switch(constructorId) { @@ -180,7 +185,8 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit2->setText(tr("")); myPoint = myDir = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1 : @@ -241,7 +247,7 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() if ( getConstructorId() != 0 ) return; - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); @@ -252,7 +258,7 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if(!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -313,7 +319,8 @@ void PrimitiveGUI_ConeDlg::LineEditReturnPressed() void PrimitiveGUI_ConeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -414,7 +421,7 @@ bool PrimitiveGUI_ConeDlg::execute( ObjectList& objects ) //================================================================================= void PrimitiveGUI_ConeDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h index 4cd7f5b88..17d913e25 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h @@ -42,7 +42,7 @@ class PrimitiveGUI_ConeDlg : public GEOMBase_Skeleton Q_OBJECT public: - PrimitiveGUI_ConeDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + PrimitiveGUI_ConeDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~PrimitiveGUI_ConeDlg(); protected: @@ -59,6 +59,8 @@ private: double getRadius1() const; double getRadius2() const; double getHeight() const; + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myPoint, myDir; diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 4da544407..cf4e3d020 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -28,8 +28,12 @@ #include "PrimitiveGUI_CylinderDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -44,12 +48,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_CYLINDER_TITLE")); @@ -105,8 +109,8 @@ void PrimitiveGUI_CylinderDlg::Init() myPoint = myDir = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ /* First constructor : radius */ @@ -139,12 +143,13 @@ void PrimitiveGUI_CylinderDlg::Init() connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_CYLINDER" ) ); ConstructorsClicked(0); @@ -157,7 +162,7 @@ void PrimitiveGUI_CylinderDlg::Init() //================================================================================= void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); switch(constructorId) { @@ -174,7 +179,8 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit2->setText(tr("")); myPoint = myDir = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1 : @@ -237,7 +243,7 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); @@ -248,7 +254,7 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if(!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -309,7 +315,8 @@ void PrimitiveGUI_CylinderDlg::LineEditReturnPressed() void PrimitiveGUI_CylinderDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h index 6a182ef13..3ed400a0e 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h @@ -43,7 +43,7 @@ class PrimitiveGUI_CylinderDlg : public GEOMBase_Skeleton Q_OBJECT public: - PrimitiveGUI_CylinderDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + PrimitiveGUI_CylinderDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~PrimitiveGUI_CylinderDlg(); protected: @@ -59,6 +59,8 @@ private: void enterEvent(QEvent* e); double getRadius() const; double getHeight() const; + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myPoint, myDir; diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index f1dbaf002..32ec46fbd 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -29,8 +29,12 @@ using namespace std; #include "PrimitiveGUI_SphereDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -45,12 +49,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_P"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SPHERE_TITLE")); @@ -101,8 +105,8 @@ void PrimitiveGUI_SphereDlg::Init() myPoint = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes */ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); @@ -121,10 +125,11 @@ void PrimitiveGUI_SphereDlg::Init() connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName(tr("GEOM_SPHERE")); ConstructorsClicked(0); @@ -137,7 +142,7 @@ void PrimitiveGUI_SphereDlg::Init() //================================================================================= void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); switch (constructorId) { @@ -152,7 +157,8 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit1->setText(""); myPoint = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: @@ -216,7 +222,7 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { myPoint = GEOM::GEOM_Object::_nil(); return; @@ -224,7 +230,7 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() /* nbSel == 1 ! */ Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if (!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -275,7 +281,8 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() void PrimitiveGUI_SphereDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -371,7 +378,7 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects ) //================================================================================= void PrimitiveGUI_SphereDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h index af41f7dcf..10042e22f 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h @@ -43,7 +43,7 @@ class PrimitiveGUI_SphereDlg : public GEOMBase_Skeleton Q_OBJECT public: - PrimitiveGUI_SphereDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + PrimitiveGUI_SphereDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~PrimitiveGUI_SphereDlg(); protected: @@ -58,6 +58,8 @@ private : void Init(); void enterEvent(QEvent* e); double getRadius() const; + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myPoint; /* Center point */ diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 3c622ef4d..287ce0d28 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -28,8 +28,12 @@ #include "PrimitiveGUI_TorusDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include "GEOMImpl_Types.hxx" @@ -44,12 +48,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_PV"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_TORUS_TITLE")); @@ -105,8 +109,8 @@ void PrimitiveGUI_TorusDlg::Init() myPoint = myDir = GEOM::GEOM_Object::_nil(); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); @@ -135,12 +139,13 @@ void PrimitiveGUI_TorusDlg::Init() connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_TORUS" ) ); ConstructorsClicked(0); @@ -154,7 +159,7 @@ void PrimitiveGUI_TorusDlg::Init() //================================================================================= void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); switch(constructorId) { @@ -171,7 +176,8 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) GroupPoints->LineEdit2->setText(tr("")); myPoint = myDir = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break ; } case 1 : @@ -234,7 +240,7 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil(); @@ -246,7 +252,7 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() /* nbSel == 1 */ Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if(!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -306,7 +312,8 @@ void PrimitiveGUI_TorusDlg::LineEditReturnPressed() void PrimitiveGUI_TorusDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h index b61b0e289..ef90ffbdf 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -43,7 +43,7 @@ class PrimitiveGUI_TorusDlg : public GEOMBase_Skeleton Q_OBJECT public: - PrimitiveGUI_TorusDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + PrimitiveGUI_TorusDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~PrimitiveGUI_TorusDlg(); protected: @@ -59,6 +59,8 @@ private: void enterEvent(QEvent* e); double getRadius1() const; double getRadius2() const; + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myPoint, myDir; diff --git a/src/RepairGUI/Makefile.in b/src/RepairGUI/Makefile.in index c9ccb325f..cc5c61a4c 100644 --- a/src/RepairGUI/Makefile.in +++ b/src/RepairGUI/Makefile.in @@ -64,14 +64,14 @@ LIB_MOC = \ RepairGUI_FreeFacesDlg.h \ RepairGUI_GlueDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_GenericObj.idl SALOME_Component.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMBase diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index 18bcd8bba..df2eeba63 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -28,10 +28,8 @@ #include "RepairGUI.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" #include "RepairGUI_SewingDlg.h" // Method SEWING #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES @@ -54,11 +52,11 @@ RepairGUI* RepairGUI::myGUIObject = 0; // function : GetRepairGUI() // purpose : Get the only RepairGUI object [ static ] //======================================================================= -RepairGUI* RepairGUI::GetRepairGUI() +RepairGUI* RepairGUI::GetRepairGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init RepairGUI only once - myGUIObject = new RepairGUI(); + myGUIObject = new RepairGUI( parent ); } return myGUIObject; } @@ -67,7 +65,7 @@ RepairGUI* RepairGUI::GetRepairGUI() // function : RepairGUI() // purpose : Constructor //======================================================================= -RepairGUI::RepairGUI() : GEOMGUI() +RepairGUI::RepairGUI( GeometryGUI* parent ) : GEOMGUI( parent ) { } @@ -85,45 +83,44 @@ RepairGUI::~RepairGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool RepairGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - + getGeometryGUI()->EmitSignalDeactivateDialog(); + QDialog* aDlg = NULL; switch (theCommandID) { case 601: // SEWING - aDlg = new RepairGUI_SewingDlg( parent, "", Sel ); + aDlg = new RepairGUI_SewingDlg( parent, "" ); break; case 602: // GLUE FACES - aDlg = new RepairGUI_GlueDlg( parent, "", Sel ); + aDlg = new RepairGUI_GlueDlg( parent, "" ); break; case 603: // SUPPRESS FACES - aDlg = new RepairGUI_SuppressFacesDlg( parent, "", Sel); + aDlg = new RepairGUI_SuppressFacesDlg( parent, "" ); break; case 604: // SUPPRESS HOLES - aDlg = new RepairGUI_RemoveHolesDlg( parent, "", Sel ); + aDlg = new RepairGUI_RemoveHolesDlg( parent, "" ); break; case 605: // SHAPE PROCESSING - aDlg = new RepairGUI_ShapeProcessDlg( parent, "", Sel ); + aDlg = new RepairGUI_ShapeProcessDlg( parent, "" ); break; case 606: // CLOSE CONTOUR - aDlg = new RepairGUI_CloseContourDlg( parent, "", Sel ); + aDlg = new RepairGUI_CloseContourDlg( parent, "" ); break; case 607: // REMOVE INTERNAL WIRES - aDlg = new RepairGUI_RemoveIntWiresDlg( parent, "", Sel ); + aDlg = new RepairGUI_RemoveIntWiresDlg( parent, "" ); break; case 608: // ADD POINT ON EDGE - aDlg = new RepairGUI_DivideEdgeDlg( parent, "", Sel ); + aDlg = new RepairGUI_DivideEdgeDlg( parent, "" ); break; case 609: // FREE BOUNDARIES - aDlg = new RepairGUI_FreeBoundDlg( parent, Sel ); + aDlg = new RepairGUI_FreeBoundDlg( getGeometryGUI(), parent ); break; case 610: // FREE FACES - aDlg = new RepairGUI_FreeFacesDlg( parent, "", Sel ); + aDlg = new RepairGUI_FreeFacesDlg( getGeometryGUI(), parent, "" ); break; default: - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } @@ -139,8 +136,8 @@ bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return RepairGUI::GetRepairGUI(); + return RepairGUI::GetRepairGUI( parent ); } } diff --git a/src/RepairGUI/RepairGUI.h b/src/RepairGUI/RepairGUI.h index 2454b406c..000fa1137 100644 --- a/src/RepairGUI/RepairGUI.h +++ b/src/RepairGUI/RepairGUI.h @@ -39,15 +39,15 @@ class RepairGUI : public GEOMGUI { protected: - RepairGUI(); // hide constructor to avoid direct creation + RepairGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~RepairGUI(); // Get the only RepairGUI object - static RepairGUI* GetRepairGUI(); + static RepairGUI* GetRepairGUI( GeometryGUI* parent ); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); private: static RepairGUI* myGUIObject; // the only RepairGUI object diff --git a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx index 46721ef62..b609b0d65 100644 --- a/src/RepairGUI/RepairGUI_CloseContourDlg.cxx +++ b/src/RepairGUI/RepairGUI_CloseContourDlg.cxx @@ -29,15 +29,18 @@ using namespace std; #include "RepairGUI_CloseContourDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include +#include +#include //================================================================================= // class : RepairGUI_CloseContourDlg() @@ -46,11 +49,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_CloseContourDlg::RepairGUI_CloseContourDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CLOSECONTOUR"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_CLOSECONTOUR"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_CLOSECONTOUR_TITLE")); @@ -123,7 +126,7 @@ void RepairGUI_CloseContourDlg::Init() myWiresInd = new GEOM::short_array(); myWiresInd->length( 0 ); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); /* signals and slots connections */ @@ -139,7 +142,8 @@ void RepairGUI_CloseContourDlg::Init() connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "CLOSE_CONTOUR_NEW_OBJ_NAME" ) ); } @@ -204,9 +208,9 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument() else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection { @@ -225,7 +229,7 @@ void RepairGUI_CloseContourDlg::SelectionIntoArgument() else if ( myEditCurrentArgument == mySelectWiresEdt ) { TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); const int n = aMap.Extent(); myWiresInd->length( n ); for ( int i = 1; i <= n; i++ ) @@ -277,7 +281,7 @@ void RepairGUI_CloseContourDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_CloseContourDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -289,7 +293,8 @@ void RepairGUI_CloseContourDlg::DeactivateActiveDialog() void RepairGUI_CloseContourDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText(""); @@ -297,7 +302,7 @@ void RepairGUI_CloseContourDlg::ActivateThisDialog() myObject = GEOM::GEOM_Object::_nil(); myWiresInd->length( 0 ); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); } @@ -319,7 +324,7 @@ void RepairGUI_CloseContourDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_CloseContourDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/RepairGUI/RepairGUI_CloseContourDlg.h b/src/RepairGUI/RepairGUI_CloseContourDlg.h index 6b66cb4e2..08c183664 100644 --- a/src/RepairGUI/RepairGUI_CloseContourDlg.h +++ b/src/RepairGUI/RepairGUI_CloseContourDlg.h @@ -46,7 +46,7 @@ class RepairGUI_CloseContourDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_CloseContourDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_CloseContourDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_CloseContourDlg(); protected: diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx index acd54e86d..e9f373009 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -29,15 +29,16 @@ using namespace std; #include "RepairGUI_DivideEdgeDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include //================================================================================= // class : RepairGUI_DivideEdgeDlg() @@ -46,11 +47,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_DIVIDE_EDGE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_DIVIDE_EDGE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_DIVIDE_EDGE_TITLE")); @@ -74,7 +75,8 @@ RepairGUI_DivideEdgeDlg::RepairGUI_DivideEdgeDlg(QWidget* parent, const char* na myIsParameterGr->find( 0 )->toggle(); QGridLayout* aLay = new QGridLayout( 0, 1, 2, 0, 6, "aLay" ); - myValEdt = new QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0., 1., 0.1, 3 ); + myValEdt = new QtxDblSpinBox(0., 1., 0.1, GroupPoints->GroupBox1);// QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0., 1., 0.1, 3 ); + myValEdt->setPrecision( 3 ); myValEdt->setValue( 0.5 ); QLabel* aLbl1 = new QLabel( tr( "GEOM_VALUE" ), GroupPoints->GroupBox1 ); aLay->addWidget( aLbl1, 0, 0 ); @@ -110,7 +112,7 @@ void RepairGUI_DivideEdgeDlg::Init() myObject = GEOM::GEOM_Object::_nil(); myIndex = -1; - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); /* signals and slots connections */ @@ -124,7 +126,8 @@ void RepairGUI_DivideEdgeDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "DEVIDE_EDGE_NEW_OBJECT_NAME" ) ); } @@ -185,9 +188,9 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() myObject = GEOM::GEOM_Object::_nil(); myIndex = -1; - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); Standard_Boolean aRes; GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( aSelectedObj ) && aRes ) @@ -196,29 +199,31 @@ void RepairGUI_DivideEdgeDlg::SelectionIntoArgument() if ( myGeomBase->GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) { const int aType = aShape.ShapeType(); - if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound - { - GEOM::short_array anIndexes; - if ( mySelection->HasIndex( anIO ) ) // subshape selection - { - TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); - myIndex = aMap( 1 ); - myObject = aSelectedObj; - myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" ); - } - else if ( aType == TopAbs_EDGE ) // single shape selection - { - myIndex = -1; - myObject = aSelectedObj; - myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); - } - else // face, shell, solid or compound was selected, and NOT its subshape. - { - myIndex = -1; - myObject = GEOM::GEOM_Object::_nil(); - } - } + if ( aType <= TopAbs_EDGE ) // edge, wire, face, shell, solid, compound + { + GEOM::short_array anIndexes; + + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) // subshape selection + { + myIndex = aMap( 1 ); + myObject = aSelectedObj; + myEditCurrentArgument->setText( tr( "GEOM_EDGE" ) + "_1" ); + } + else if ( aType == TopAbs_EDGE ) // single shape selection + { + myIndex = -1; + myObject = aSelectedObj; + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + } + else // face, shell, solid or compound was selected, and NOT its subshape. + { + myIndex = -1; + myObject = GEOM::GEOM_Object::_nil(); + } + } } } } @@ -259,7 +264,7 @@ void RepairGUI_DivideEdgeDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_DivideEdgeDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -271,12 +276,13 @@ void RepairGUI_DivideEdgeDlg::DeactivateActiveDialog() void RepairGUI_DivideEdgeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; myObject = GEOM::GEOM_Object::_nil(); myIndex = -1; - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); } @@ -298,7 +304,7 @@ void RepairGUI_DivideEdgeDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_DivideEdgeDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h index 33b63916e..801fdcc10 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.h +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.h @@ -31,7 +31,7 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_1Sel_Ext.h" -#include "QAD_SpinBoxDbl.h" +#include "QtxDblSpinBox.h" #include @@ -47,7 +47,7 @@ class RepairGUI_DivideEdgeDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_DivideEdgeDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_DivideEdgeDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_DivideEdgeDlg(); protected: @@ -68,8 +68,8 @@ private : int myIndex; DlgRef_1Sel_Ext* GroupPoints; - QButtonGroup* myIsParameterGr; - QAD_SpinBoxDbl* myValEdt; + QButtonGroup* myIsParameterGr; + QtxDblSpinBox* myValEdt; private slots: void ClickOnOk(); diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx index ca9930705..7d2c88288 100644 --- a/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.cxx @@ -27,14 +27,16 @@ // $Header$ #include "RepairGUI_FreeBoundDlg.h" -#include "QAD_Desktop.h" #include "GEOMBase.h" #include "GeometryGUI.h" #include "GEOM_Displayer.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "GEOMImpl_Types.hxx" -#include "SALOME_Prs.h" -#include "SALOME_Selection.h" + +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" + +#include #include #include @@ -55,13 +57,14 @@ // function : RepairGUI_FreeBoundDlg // purpose : Constructor //================================================================================= -RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( QWidget* theParen, SALOME_Selection* theSelection ) -: QDialog( theParen, "RepairGUI_FreeBoundDlg", false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) +RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent ) +: QDialog( theParent, "RepairGUI_FreeBoundDlg", false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + myGeomGUI ( theGUI ) { setCaption( tr( "CAPTION" ) ); - QPixmap iconSelect( QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); + QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr( "ICON_SELECT" ) ) ); QGroupBox* aMainGrp = new QGroupBox( 1, Qt::Horizontal, tr( "FREE_BOUND" ), this ); @@ -93,7 +96,7 @@ RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( QWidget* theParen, SALOME_Select connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ); - Init( theSelection ); + Init(); } //================================================================================= @@ -111,8 +114,8 @@ RepairGUI_FreeBoundDlg::~RepairGUI_FreeBoundDlg() void RepairGUI_FreeBoundDlg::onClose() { globalSelection(); - disconnect( mySelection, 0, this, 0 ); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); reject(); erasePreview(); } @@ -125,8 +128,8 @@ void RepairGUI_FreeBoundDlg::onDeactivate() { setEnabled(false); globalSelection(); - disconnect( mySelection, 0, this, 0 ); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); } //================================================================================= @@ -135,10 +138,11 @@ void RepairGUI_FreeBoundDlg::onDeactivate() //================================================================================= void RepairGUI_FreeBoundDlg::onActivate() { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); + myGeomGUI->EmitSignalDeactivateDialog(); setEnabled( true ); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( this ); - connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + myGeomGUI->SetActiveDialogBox( this ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); activateSelection(); onSelectionDone(); } @@ -149,12 +153,12 @@ void RepairGUI_FreeBoundDlg::onActivate() //================================================================================= void RepairGUI_FreeBoundDlg::onSelectionDone() { - if( mySelection->IObjectCount() != 1 ) + if( IObjectCount() != 1 ) return; Standard_Boolean isOk = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), isOk ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk ); if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) return; @@ -170,15 +174,14 @@ void RepairGUI_FreeBoundDlg::onSelectionDone() // function : Init // purpose : Initialize dialog fields //================================================================================= -void RepairGUI_FreeBoundDlg::Init( SALOME_Selection* theSel ) +void RepairGUI_FreeBoundDlg::Init() { myNbClosed = myNbOpen = 0; myObj = GEOM::GEOM_Object::_nil(); - mySelection = theSel; - GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI(); - connect( aGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); - connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); activateSelection(); onSelectionDone(); @@ -274,16 +277,14 @@ bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects ) return result; } - - - - - - - - - - +//================================================================================= +// function : getDesktop() +// purpose : +//================================================================================= +SUIT_Desktop* RepairGUI_FreeBoundDlg::getDesktop() const +{ + return dynamic_cast( parentWidget() ); +} diff --git a/src/RepairGUI/RepairGUI_FreeBoundDlg.h b/src/RepairGUI/RepairGUI_FreeBoundDlg.h index ae7a6c4b7..cdf07980e 100644 --- a/src/RepairGUI/RepairGUI_FreeBoundDlg.h +++ b/src/RepairGUI/RepairGUI_FreeBoundDlg.h @@ -32,11 +32,10 @@ #include #include "GEOMBase_Helper.h" -class SALOME_Prs; -class SALOME_Selection; class QLineEdit; class QLabel; class GEOM_Displayer; +class GeometryGUI; //================================================================================= // class : RepairGUI_FreeBoundDlg @@ -48,7 +47,7 @@ class RepairGUI_FreeBoundDlg : public QDialog, Q_OBJECT public: - RepairGUI_FreeBoundDlg( QWidget*, SALOME_Selection* ); + RepairGUI_FreeBoundDlg( GeometryGUI*, QWidget* ); ~RepairGUI_FreeBoundDlg(); private slots: @@ -60,7 +59,7 @@ private slots: private: - void Init( SALOME_Selection* ); + void Init(); void enterEvent( QEvent* e ); void closeEvent( QCloseEvent* e ); void activateSelection(); @@ -68,6 +67,7 @@ private: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool execute( ObjectList& objects ); virtual bool isValid( QString& ); + virtual SUIT_Desktop* getDesktop() const; private: @@ -75,7 +75,7 @@ private: QLabel* myClosedLbl; QLabel* myOpenLbl; GEOM::GEOM_Object_var myObj; - SALOME_Selection* mySelection; + GeometryGUI* myGeomGUI; int myNbClosed; int myNbOpen; }; diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx index 54b50e964..35831e001 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx @@ -29,22 +29,22 @@ using namespace std; #include "RepairGUI_FreeFacesDlg.h" -#include "QAD_Desktop.h" -#include "QAD_WaitCursor.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_Tools.h" +#include "SUIT_Session.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include #include #include "GEOMBase.h" #include "GeometryGUI.h" #include "GEOM_Displayer.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "SALOME_Selection.h" -#include "SALOME_Prs.h" - +#include #include #include #include @@ -62,14 +62,15 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(QWidget* parent, const char* name, SALOME_Selection* theSelection, bool modal, WFlags fl) +RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent, const char* name, bool modal, WFlags fl) :QDialog( parent, "RepairGUI_FreeBoundDlg", false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ) + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + myGeomGUI( GUI ) { myDisplayer = 0; setSizeGripEnabled( TRUE ); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_FREE_FACES_TITLE")); @@ -110,7 +111,7 @@ RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg(QWidget* parent, const char* name this, SLOT ( onSetEditCurrentArgument() ) ); /***************************************************************/ - Init( theSelection ); + Init(); } @@ -130,8 +131,8 @@ RepairGUI_FreeFacesDlg::~RepairGUI_FreeFacesDlg() void RepairGUI_FreeFacesDlg::onClose() { globalSelection(); - disconnect( mySelection, 0, this, 0 ); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); reject(); erasePreview(); } @@ -144,8 +145,8 @@ void RepairGUI_FreeFacesDlg::onDeactivate() { setEnabled(false); globalSelection(); - disconnect( mySelection, 0, this, 0 ); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); } //================================================================================= @@ -154,10 +155,11 @@ void RepairGUI_FreeFacesDlg::onDeactivate() //================================================================================= void RepairGUI_FreeFacesDlg::onActivate() { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); + myGeomGUI->EmitSignalDeactivateDialog(); setEnabled( true ); - GeometryGUI::GetGeomGUI()->SetActiveDialogBox( this ); - connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + myGeomGUI->SetActiveDialogBox( this ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); activateSelection(); } @@ -165,16 +167,14 @@ void RepairGUI_FreeFacesDlg::onActivate() // function : Init() // purpose : //================================================================================= -void RepairGUI_FreeFacesDlg::Init(SALOME_Selection* theSel) +void RepairGUI_FreeFacesDlg::Init() { myObj = GEOM::GEOM_Object::_nil(); - mySelection = theSel; - /* signals and slots connections */ - GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI(); - connect( aGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); - connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); + connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL( currentSelectionChanged() ), SLOT ( onSelectionDone() ) ); activateSelection(); onSelectionDone(); @@ -187,7 +187,7 @@ void RepairGUI_FreeFacesDlg::Init(SALOME_Selection* theSel) void RepairGUI_FreeFacesDlg::onSelectionDone() { erasePreview(); - if( mySelection->IObjectCount() != 1 ) + if( IObjectCount() != 1 ) { myEdit->setText( "" ); return; @@ -195,7 +195,7 @@ void RepairGUI_FreeFacesDlg::onSelectionDone() Standard_Boolean isOk = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), isOk ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), isOk ); if ( !isOk || anObj->_is_nil() || !GEOMBase::IsShape( anObj ) ) { @@ -281,7 +281,7 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) TopExp::MapShapes( aSelShape, anIndices); SALOME_Prs* aPrs = 0; - QAD_WaitCursor wc; + QApplication::setOverrideCursor( Qt::waitCursor ); for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) { @@ -296,7 +296,7 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); } } } @@ -310,7 +310,7 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) GEOM_Displayer* RepairGUI_FreeFacesDlg::getDisplayer() { if ( !myDisplayer ) - myDisplayer = new GEOM_Displayer(); + myDisplayer = new GEOM_Displayer( getStudy() ); return myDisplayer; } @@ -324,3 +324,11 @@ void RepairGUI_FreeFacesDlg::onSetEditCurrentArgument() onSelectionDone(); } +//================================================================================= +// function : getDesktop() +// purpose : +//================================================================================= +SUIT_Desktop* RepairGUI_FreeFacesDlg::getDesktop() const +{ + return dynamic_cast( parentWidget() ); +} diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.h b/src/RepairGUI/RepairGUI_FreeFacesDlg.h index a8fd91d2d..80845f1d6 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.h +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.h @@ -33,10 +33,9 @@ #include "GEOMBase_Helper.h" class GEOM_Displayer; -class SALOME_Selection; -class SALOME_Prs; class QPushButton; class QLineEdit; +class GeometryGUI; //================================================================================= // class : RepairGUI_FreeFacesDlg @@ -48,7 +47,7 @@ class RepairGUI_FreeFacesDlg : public QDialog, Q_OBJECT public: - RepairGUI_FreeFacesDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_FreeFacesDlg(GeometryGUI* GUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_FreeFacesDlg(); protected: @@ -56,10 +55,11 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& objects ); + virtual SUIT_Desktop* getDesktop() const; private : - void Init(SALOME_Selection*); + void Init(); void enterEvent(QEvent* e); void closeEvent(QCloseEvent* e); void activateSelection(); @@ -71,15 +71,15 @@ private slots: void onDeactivate(); void onActivate(); void onSelectionDone(); - void onSetEditCurrentArgument(); + void onSetEditCurrentArgument(); private : GEOM_Displayer* myDisplayer; GEOM::GEOM_Object_var myObj; - SALOME_Selection* mySelection; QPushButton* mySelBtn; QLineEdit* myEdit; + GeometryGUI* myGeomGUI; }; diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 6a5b0d07a..52572ac82 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -28,23 +28,29 @@ using namespace std; #include "RepairGUI_GlueDlg.h" - #include "DlgRef_1Sel_Ext.h" +#include "GEOMImpl_Types.hxx" -#include "QAD_Desktop.h" -#include "QAD_SpinBoxDbl.h" -#include "QAD_MessageBox.h" -#include "QAD_WaitCursor.h" +#include "QtxDblSpinBox.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SalomeApp_Study.h" +#include "SalomeApp_Tools.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" -#include "OCCViewer_Viewer3d.h" #include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "GEOMImpl_Types.hxx" +#include + +#include +#include #define DEFAULT_TOLERANCE_VALUE 1e-07 + + //================================================================================= // class : RepairGUI_GlueDlg() // purpose : Constructs a RepairGUI_GlueDlg which is a child of 'parent', with the @@ -52,11 +58,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_GlueDlg::RepairGUI_GlueDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_GlueDlg::RepairGUI_GlueDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_GLUE_TITLE")); @@ -76,7 +82,8 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(QWidget* parent, const char* name, SALOME_S QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" ); QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 ); - myTolEdt = new QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); + myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); + myTolEdt->setPrecision( 10 ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); aLay->addWidget( aLbl1, 0, 0 ); @@ -109,7 +116,7 @@ void RepairGUI_GlueDlg::Init() myObject = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); globalSelection( GEOM_COMPOUND ); /* signals and slots connections */ @@ -123,7 +130,8 @@ void RepairGUI_GlueDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GLUE_NEW_OBJ_NAME" ) ); } @@ -181,8 +189,8 @@ void RepairGUI_GlueDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); myObject = GEOM::GEOM_Object::_nil(); - if ( mySelection->IObjectCount() == 1 ) { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + if ( IObjectCount() == 1 ) { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( aRes ) @@ -224,7 +232,7 @@ void RepairGUI_GlueDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_GlueDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -236,12 +244,13 @@ void RepairGUI_GlueDlg::DeactivateActiveDialog() void RepairGUI_GlueDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); GroupPoints->LineEdit1->setText(""); myObject = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); globalSelection( GEOM_COMPOUND ); } @@ -263,7 +272,7 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } @@ -310,25 +319,25 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj ) if ( CORBA::is_nil( theObj ) ) return; - string IOR = GeometryGUI::GetORB()->object_to_string( theObj ); + string IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj ); TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) ); - GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); - if ( !getStudy() || CORBA::is_nil( getStudy()->getStudyDocument() ) ) + if ( !getStudy() || !( getStudy()->studyDS() ) ) return; - SALOMEDS::Study_var aStudy = getStudy()->getStudyDocument(); - SALOMEDS::SObject_var aSObj = aStudy->FindObjectIOR( IOR.c_str() ); - if ( CORBA::is_nil( aSObj ) ) + _PTR(Study) aStudy = getStudy()->studyDS(); + _PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) ); + if ( !aSObj ) return; - SALOMEDS::ChildIterator_var anIt = aStudy->NewChildIterator( aSObj ); + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { - SALOMEDS::GenericAttribute_var anAttr; + _PTR(GenericAttribute) anAttr; if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { - SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - TCollection_AsciiString asciiIOR( anIOR->Value() ); - GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); + _PTR(AttributeIOR) anIOR ( anAttr ); + TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR ); } } } @@ -341,16 +350,18 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj ) //================================================================ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransaction ) { - QAD_Study* aDoc = QAD_Application::getDesktop()->getActiveStudy(); - SALOMEDS::Study_var aStudy = aDoc->getStudyDocument(); + if ( !getStudy() || !( getStudy()->studyDS() ) ) + return false; + + _PTR(Study) aStudy = getStudy()->studyDS(); bool aLocked = aStudy->GetProperties()->IsLocked(); if ( aLocked ) { MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); - QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK") ); return false; } @@ -364,12 +375,13 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac try { if ( ( !publish && !useTransaction ) || openCommand() ) { - QAD_WaitCursor wc; - QAD_Application::getDesktop()->putInfo( "" ); + QApplication::setOverrideCursor( Qt::waitCursor ); + SUIT_Session::session()->activeApplication()->putInfo( "" ); ObjectList objects; // JFA 28.12.2004 if ( !execute( objects ) || !getOperation()->IsDone() ) { if ( !execute( objects ) ) { // JFA 28.12.2004 // To enable warnings - wc.stop(); + while( QApplication::overrideCursor() ) + QApplication::restoreOverrideCursor(); abortCommand(); showError(); } @@ -402,7 +414,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac if ( nbObjs ) { commitCommand(); updateObjBrowser(); - QAD_Application::getDesktop()->putInfo( QObject::tr("GEOM_PRP_DONE") ); + SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") ); } else { abortCommand(); @@ -411,12 +423,13 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac // JFA 28.12.2004 BEGIN // To enable warnings if ( !getOperation()->_is_nil() ) { if ( !getOperation()->IsDone() ) { - wc.stop(); + while( QApplication::overrideCursor() ) + QApplication::restoreOverrideCursor(); QString msgw = QObject::tr( getOperation()->GetErrorCode() ); - QAD_MessageBox::warn1(QAD_Application::getDesktop(), - QObject::tr( "WRN_WARNING" ), - msgw, - QObject::tr( "BUT_OK" )); + SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()), + QObject::tr( "WRN_WARNING" ), + msgw, + QObject::tr( "BUT_OK" )); } } // JFA 28.12.2004 END @@ -424,7 +437,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransac } } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); abortCommand(); } diff --git a/src/RepairGUI/RepairGUI_GlueDlg.h b/src/RepairGUI/RepairGUI_GlueDlg.h index 4278198c8..2c493dfa5 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.h +++ b/src/RepairGUI/RepairGUI_GlueDlg.h @@ -31,7 +31,7 @@ #include "GEOMBase_Skeleton.h" -class QAD_SpinBoxDbl; +class QtxDblSpinBox; class DlgRef_1Sel_Ext; //================================================================================= @@ -43,7 +43,7 @@ class RepairGUI_GlueDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_GlueDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_GlueDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_GlueDlg(); protected: @@ -65,7 +65,7 @@ private : GEOM::GEOM_Object_var myObject; DlgRef_1Sel_Ext* GroupPoints; - QAD_SpinBoxDbl* myTolEdt; + QtxDblSpinBox* myTolEdt; private slots: void ClickOnOk(); diff --git a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx index 8572c9fbc..8cbf4835b 100644 --- a/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveHolesDlg.cxx @@ -29,17 +29,17 @@ using namespace std; #include "RepairGUI_RemoveHolesDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Session.h" -#include "GEOM_Displayer.h" -#include "OCCViewer_Viewer3d.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include //================================================================================= @@ -49,11 +49,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_RemoveHolesDlg::RepairGUI_RemoveHolesDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_HOLES"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_HOLES"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_REMOVE_HOLES_TITLE")); @@ -129,7 +129,7 @@ void RepairGUI_RemoveHolesDlg::Init() myWiresInd = new GEOM::short_array(); myWiresInd->length( 0 ); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); myClosed = -1; @@ -148,7 +148,8 @@ void RepairGUI_RemoveHolesDlg::Init() connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) ); connect( myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect()) ); @@ -213,9 +214,9 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument() if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection { @@ -229,7 +230,7 @@ void RepairGUI_RemoveHolesDlg::SelectionIntoArgument() else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) { TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); const int n = aMap.Extent(); myWiresInd->length( n ); for ( int i = 1; i <= n; i++ ) @@ -281,7 +282,7 @@ void RepairGUI_RemoveHolesDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_RemoveHolesDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -293,7 +294,8 @@ void RepairGUI_RemoveHolesDlg::DeactivateActiveDialog() void RepairGUI_RemoveHolesDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText(""); @@ -304,7 +306,7 @@ void RepairGUI_RemoveHolesDlg::ActivateThisDialog() myClosed = -1; myOpen = -1; - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); } @@ -326,7 +328,7 @@ void RepairGUI_RemoveHolesDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_RemoveHolesDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } @@ -441,6 +443,6 @@ void RepairGUI_RemoveHolesDlg::onDetect() msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen ); else msg = tr( "GEOM_FREE_BOUNDS_ERROR" ); - QAD_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); + SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); } diff --git a/src/RepairGUI/RepairGUI_RemoveHolesDlg.h b/src/RepairGUI/RepairGUI_RemoveHolesDlg.h index 12c85fdfd..42edf5b6e 100644 --- a/src/RepairGUI/RepairGUI_RemoveHolesDlg.h +++ b/src/RepairGUI/RepairGUI_RemoveHolesDlg.h @@ -48,7 +48,7 @@ class RepairGUI_RemoveHolesDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_RemoveHolesDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_RemoveHolesDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_RemoveHolesDlg(); protected: diff --git a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx index e865a125d..74167b217 100644 --- a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx +++ b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.cxx @@ -29,14 +29,15 @@ using namespace std; #include "RepairGUI_RemoveIntWiresDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include //================================================================================= @@ -46,11 +47,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_RemoveIntWiresDlg::RepairGUI_RemoveIntWiresDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_INT_WIRES"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPPRESS_INT_WIRES"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_REMOVE_INTERNAL_WIRES_TITLE")); @@ -119,7 +120,7 @@ void RepairGUI_RemoveIntWiresDlg::Init() myWiresInd = new GEOM::short_array(); myWiresInd->length( 0 ); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); /* signals and slots connections */ @@ -135,7 +136,8 @@ void RepairGUI_RemoveIntWiresDlg::Init() connect(mySelectWiresBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySelectWiresEdt, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect( myAllChk, SIGNAL( clicked() ), this, SLOT( onRemoveAllClicked() ) ); @@ -198,31 +200,31 @@ void RepairGUI_RemoveIntWiresDlg::SelectionIntoArgument() if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myObject = GEOM::GEOM_Object::_nil(); else if ( myEditCurrentArgument == mySelectWiresEdt ) myWiresInd->length( 0 ); - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) + { + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + + if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); - - if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) // face selection - { - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( aRes && GEOMBase::IsShape( myObject ) ) - myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); - else - myObject = GEOM::GEOM_Object::_nil(); - } - else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) - { - TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); - const int n = aMap.Extent(); - myWiresInd->length( n ); - for ( int i = 1; i <= n; i++ ) - myWiresInd[i-1] = aMap( i ); - if ( n ) - myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) ); - } + Standard_Boolean aRes; + myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + if ( aRes && GEOMBase::IsShape( myObject ) ) + myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) ); + else + myObject = GEOM::GEOM_Object::_nil(); } + else if ( myEditCurrentArgument == mySelectWiresEdt && !myAllChk->isChecked() ) + { + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + const int n = aMap.Extent(); + myWiresInd->length( n ); + for ( int i = 1; i <= n; i++ ) + myWiresInd[i-1] = aMap( i ); + if ( n ) + myEditCurrentArgument->setText( QString::number( n ) + "_" + tr( "GEOM_WIRE" ) + tr( "_S_" ) ); + } + } } //================================================================================= @@ -267,7 +269,7 @@ void RepairGUI_RemoveIntWiresDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_RemoveIntWiresDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -279,7 +281,8 @@ void RepairGUI_RemoveIntWiresDlg::DeactivateActiveDialog() void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setText(""); @@ -287,8 +290,8 @@ void RepairGUI_RemoveIntWiresDlg::ActivateThisDialog() myObject = GEOM::GEOM_Object::_nil(); myWiresInd->length( 0 ); - myGeomGUI->SetState( 0 ); - initSelection(); + //myGeomGUI->SetState( 0 ); + initSelection(); } @@ -309,7 +312,7 @@ void RepairGUI_RemoveIntWiresDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_RemoveIntWiresDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h index 4880e97a8..2142784a3 100644 --- a/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h +++ b/src/RepairGUI/RepairGUI_RemoveIntWiresDlg.h @@ -48,7 +48,7 @@ class RepairGUI_RemoveIntWiresDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_RemoveIntWiresDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_RemoveIntWiresDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_RemoveIntWiresDlg(); protected: diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index 79e78405b..d8753363b 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -29,15 +29,16 @@ using namespace std; #include "RepairGUI_SewingDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "QAD_MessageBox.h" -#include "OCCViewer_Viewer3d.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include #define DEFAULT_TOLERANCE_VALUE 1e-07 @@ -49,11 +50,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_SewingDlg::RepairGUI_SewingDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_SewingDlg::RepairGUI_SewingDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SEWING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SEWING"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SEWING_TITLE")); @@ -72,7 +73,8 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg(QWidget* parent, const char* name, SALO Layout1->addWidget(GroupPoints, 2, 0); QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" ); - myTolEdt = new QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); + myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 ); + myTolEdt->setPrecision( 10 ); myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE ); QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 ); myFreeBoundBtn = new QPushButton( tr( "GEOM_DETECT" ), GroupPoints->GroupBox1 ); @@ -109,7 +111,7 @@ void RepairGUI_SewingDlg::Init() myObject = GEOM::GEOM_Object::_nil(); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); myClosed = -1; @@ -126,7 +128,8 @@ void RepairGUI_SewingDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(myFreeBoundBtn, SIGNAL(clicked()), this, SLOT(onDetect())); @@ -186,9 +189,9 @@ void RepairGUI_SewingDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); myObject = GEOM::GEOM_Object::_nil(); - if ( mySelection->IObjectCount() == 1 ) + if ( IObjectCount() == 1 ) { - Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( aRes ) @@ -232,7 +235,7 @@ void RepairGUI_SewingDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_SewingDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -244,7 +247,8 @@ void RepairGUI_SewingDlg::DeactivateActiveDialog() void RepairGUI_SewingDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); GroupPoints->LineEdit1->setText(""); myObject = GEOM::GEOM_Object::_nil(); @@ -252,7 +256,7 @@ void RepairGUI_SewingDlg::ActivateThisDialog() myClosed = -1; myOpen = -1; - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); } @@ -274,7 +278,7 @@ void RepairGUI_SewingDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_SewingDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } @@ -361,5 +365,5 @@ void RepairGUI_SewingDlg::onDetect() msg = tr( "GEOM_FREE_BOUNDS_MSG" ).arg( myClosed + myOpen ).arg( myClosed ).arg( myOpen ); else msg = tr( "GEOM_FREE_BOUNDS_ERROR" ); - QAD_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); + SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" ); } diff --git a/src/RepairGUI/RepairGUI_SewingDlg.h b/src/RepairGUI/RepairGUI_SewingDlg.h index eaaa5de7f..c2c459507 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.h +++ b/src/RepairGUI/RepairGUI_SewingDlg.h @@ -31,7 +31,7 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_1Sel_Ext.h" -#include "QAD_SpinBoxDbl.h" +#include "QtxDblSpinBox.h" #include @@ -49,7 +49,7 @@ class RepairGUI_SewingDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_SewingDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_SewingDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_SewingDlg(); protected: @@ -64,10 +64,10 @@ private : void closeEvent(QCloseEvent* e); void initSelection(); - GEOM::GEOM_Object_var myObject; + GEOM::GEOM_Object_var myObject; DlgRef_1Sel_Ext* GroupPoints; - QAD_SpinBoxDbl* myTolEdt; + QtxDblSpinBox* myTolEdt; QPushButton* myFreeBoundBtn; int myClosed; // number of free closed boundaries detected. calculated in execute(), used in onDetect(). diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx index 0b267a889..63583ecb4 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx @@ -32,13 +32,17 @@ using namespace std; #include "GEOMImpl_Types.hxx" -#include "QAD_Desktop.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_ListIO.hxx" #include +#include #include +#include #include @@ -49,8 +53,8 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_ShapeProcessDlg::RepairGUI_ShapeProcessDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { init(); } @@ -71,7 +75,7 @@ RepairGUI_ShapeProcessDlg::~RepairGUI_ShapeProcessDlg() //================================================================================= void RepairGUI_ShapeProcessDlg::init() { - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initParamsValues(); initSelection(); @@ -84,7 +88,7 @@ void RepairGUI_ShapeProcessDlg::init() mySelectWdgt = new DlgRef_1Sel_QTD( this, "SelectedObjects" ); mySelectWdgt->GroupBox1->setTitle( tr("GEOM_SHAPE") ); mySelectWdgt->TextLabel1->setText( tr("GEOM_SELECTED_OBJECTS") ); - mySelectWdgt->PushButton1->setPixmap( QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")) ); + mySelectWdgt->PushButton1->setPixmap( SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")) ); mySelectWdgt->LineEdit1->setReadOnly( true ); Layout1->addWidget( mySelectWdgt, 0, 0 ); @@ -127,8 +131,10 @@ void RepairGUI_ShapeProcessDlg::init() QFrame* aFrame = new QFrame( myStack ); QGridLayout* aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); - myFixShapeTol3D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); - myFixShapeMaxTol3D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixShapeTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixShapeTol3D->setPrecision( 10 ); + myFixShapeMaxTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixShapeMaxTol3D->setPrecision( 10 ); aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( myFixShapeTol3D, 0, 1 ); @@ -142,7 +148,8 @@ void RepairGUI_ShapeProcessDlg::init() aFrame = new QFrame( myStack ); aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); - myFixFaceSizeTol = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixFaceSizeTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myFixFaceSizeTol->setPrecision( 10 ); aLay->addWidget( new QLabel( tr("GEOM_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( myFixFaceSizeTol, 0, 1 ); @@ -154,7 +161,8 @@ void RepairGUI_ShapeProcessDlg::init() aFrame = new QFrame( myStack ); aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); - myDropSmallEdgesTol3D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myDropSmallEdgesTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myDropSmallEdgesTol3D->setPrecision( 10 ); aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( myDropSmallEdgesTol3D, 0, 1 ); @@ -166,8 +174,9 @@ void RepairGUI_ShapeProcessDlg::init() aFrame = new QFrame( myStack ); aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); - mySplitAngleAngle = new QAD_SpinBoxDbl( aFrame, 0, 360, 1 ); - mySplitAngleMaxTol = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySplitAngleAngle = new QtxDblSpinBox( 0, 360, 1, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 360, 1 ); + mySplitAngleMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySplitAngleMaxTol->setPrecision( 10 ); aLay->addWidget( new QLabel( tr("GEOM_ANGLE_1"), aFrame ), 0, 0 ); aLay->addWidget( mySplitAngleAngle, 0, 1 ); @@ -193,7 +202,8 @@ void RepairGUI_ShapeProcessDlg::init() aFrame = new QFrame( myStack ); aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); - mySplitContTol3D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySplitContTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySplitContTol3D->setPrecision( 10 ); mySplitContSurfCont = new QComboBox( aFrame ); mySplitContSurfCont->insertStringList( aContinueties ); mySplitContCurvCont = new QComboBox( aFrame ); @@ -216,8 +226,13 @@ void RepairGUI_ShapeProcessDlg::init() myBSplineSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); myBSpline3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); myBSpline2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); - myBSplineTol3D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); - myBSplineTol2D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + + myBSplineTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myBSplineTol3D->setPrecision( 10 ); + + myBSplineTol2D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myBSplineTol2D->setPrecision( 10 ); + myBSplineDegree = new QSpinBox( aFrame ); myBSplineSegments = new QSpinBox( aFrame ); myBSpline2DCont = new QComboBox( aFrame ); @@ -255,7 +270,9 @@ void RepairGUI_ShapeProcessDlg::init() myToBezierSurfModeChk = new QCheckBox( tr("GEOM_SURFACE_MODE"), aFrame ); myToBezier3DCurveChk = new QCheckBox( tr("GEOM_3D_CURVE_MODE"), aFrame ); myToBezier2DCurveChk = new QCheckBox( tr("GEOM_2D_CURVE_MODE"), aFrame ); - myToBezierMaxTol = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + + myToBezierMaxTol = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + myToBezierMaxTol->setPrecision( 10 ); aLay->addWidget( myToBezierSurfModeChk, 0, 0 ); aLay->addWidget( myToBezier3DCurveChk, 1, 0 ); @@ -270,7 +287,8 @@ void RepairGUI_ShapeProcessDlg::init() aFrame = new QFrame( myStack ); aLay = new QGridLayout( aFrame, 10, 2, 0, 5 ); - mySameParameterTol3D = new QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySameParameterTol3D = new QtxDblSpinBox( 0, 100, 1e-7, aFrame );//QAD_SpinBoxDbl( aFrame, 0, 100, 1e-7, 10, 1e-10 ); + mySameParameterTol3D->setPrecision( 10 ); aLay->addWidget( new QLabel( tr("GEOM_3D_TOLERANCE"), aFrame ), 0, 0 ); aLay->addWidget( mySameParameterTol3D, 0, 1 ); @@ -286,7 +304,8 @@ void RepairGUI_ShapeProcessDlg::init() connect( buttonOk, SIGNAL(clicked()), this, SLOT(onOk()) ); connect( buttonApply, SIGNAL(clicked()), this, SLOT(onApply()) ); - connect( mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged()) ); + connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged()) ); connect( myOpList, SIGNAL(selectionChanged()), this, SLOT(operationChanged()) ); connect( mySelectWdgt->PushButton1, SIGNAL(clicked()), this, SLOT(selectClicked()) ); @@ -368,8 +387,8 @@ void RepairGUI_ShapeProcessDlg::selectionChanged() Standard_Boolean aRes = Standard_False; int i = 0; - myObjects->length( mySelection->IObjectCount() ); - for ( SALOME_ListIteratorOfListIO anIt( mySelection->StoredIObjects() ); anIt.More(); anIt.Next() ) + myObjects->length( IObjectCount() ); + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) { GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) @@ -411,7 +430,7 @@ void RepairGUI_ShapeProcessDlg::lineEditReturnPressed() //================================================================================= void RepairGUI_ShapeProcessDlg::deactivate() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -423,10 +442,11 @@ void RepairGUI_ShapeProcessDlg::deactivate() void RepairGUI_ShapeProcessDlg::activate() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged())); reset(); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); } @@ -448,7 +468,7 @@ void RepairGUI_ShapeProcessDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_ShapeProcessDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } @@ -501,8 +521,7 @@ const char* set_convert( const char* theParam, const char* theValue ) //================================================================================= void RepairGUI_ShapeProcessDlg::loadDefaults() { - const int aStudyId = QAD_Application::getDesktop()->getActiveStudy()->getStudyId(); - GEOM::GEOM_IHealingOperations_var anOp = myGeomGUI->GetGeomGen()->GetIHealingOperations( aStudyId ); + GEOM::GEOM_IHealingOperations_var anOp = myGeomGUI->GetGeomGen()->GetIHealingOperations( getStudyId() ); GEOM::string_array_var anOperators, aParams, aValues; anOp->GetShapeProcessParameters( anOperators, aParams, aValues ); @@ -541,8 +560,8 @@ void RepairGUI_ShapeProcessDlg::setValue( QWidget* theControl, const char* theVa if ( theControl == NULL || theValue == NULL ) return; - if ( theControl->isA( "QAD_SpinBoxDbl" ) ) - ((QAD_SpinBoxDbl*)theControl)->setValue( QString( theValue ).toDouble() ); + if ( theControl->isA( "QtxDblSpinBox" ) ) + ((QtxDblSpinBox*)theControl)->setValue( QString( theValue ).toDouble() ); else if ( theControl->isA( "QSpinBox" ) ) ((QSpinBox*)theControl)->setValue( QString( theValue ).toInt() ); else if ( theControl->isA( "QComboBox" ) ) @@ -560,8 +579,8 @@ const char* RepairGUI_ShapeProcessDlg::getValue( QWidget* theControl ) const if ( theControl == NULL ) return ""; - if ( theControl->isA( "QAD_SpinBoxDbl" ) ) - return ((QAD_SpinBoxDbl*)theControl)->text().latin1(); + if ( theControl->isA( "QtxDblSpinBox" ) ) + return ((QtxDblSpinBox*)theControl)->text().latin1(); else if ( theControl->isA( "QSpinBox" ) ) return ((QSpinBox*)theControl)->text().latin1(); else if ( theControl->isA( "QComboBox" ) ) @@ -824,6 +843,6 @@ void RepairGUI_ShapeProcessDlg::advOptionToggled( bool on ) { QButton* btn = (QButton*)sender(); if ( on && btn->isToggleButton() && - QMessageBox::warning( QAD_Application::getDesktop(), tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) + QMessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), tr( "GEOM_WRN_WARNING" ), tr( "TIME_CONSUMING" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) btn->toggle(); } diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h index df4930ea5..ffdbd536b 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.h +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.h @@ -32,7 +32,7 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_1Sel_QTD.h" #include "RepairGUI.h" -#include "QAD_SpinBoxDbl.h" +#include "QtxDblSpinBox.h" #include #include @@ -52,7 +52,7 @@ class RepairGUI_ShapeProcessDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_ShapeProcessDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_ShapeProcessDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_ShapeProcessDlg(); protected: @@ -90,27 +90,27 @@ private : QListView* myOpList; QWidgetStack* myStack; - QAD_SpinBoxDbl* myFixShapeTol3D; - QAD_SpinBoxDbl* myFixShapeMaxTol3D; + QtxDblSpinBox* myFixShapeTol3D; + QtxDblSpinBox* myFixShapeMaxTol3D; - QAD_SpinBoxDbl* myFixFaceSizeTol; + QtxDblSpinBox* myFixFaceSizeTol; - QAD_SpinBoxDbl* myDropSmallEdgesTol3D; + QtxDblSpinBox* myDropSmallEdgesTol3D; - QAD_SpinBoxDbl* mySplitAngleAngle; - QAD_SpinBoxDbl* mySplitAngleMaxTol; + QtxDblSpinBox* mySplitAngleAngle; + QtxDblSpinBox* mySplitAngleMaxTol; QSpinBox* mySplitClosedFacesNum; - QAD_SpinBoxDbl* mySplitContTol3D; + QtxDblSpinBox* mySplitContTol3D; QComboBox* mySplitContSurfCont; QComboBox* mySplitContCurvCont; QCheckBox* myBSplineSurfModeChk; QCheckBox* myBSpline3DCurveChk; QCheckBox* myBSpline2DCurveChk; - QAD_SpinBoxDbl* myBSplineTol3D; - QAD_SpinBoxDbl* myBSplineTol2D; + QtxDblSpinBox* myBSplineTol3D; + QtxDblSpinBox* myBSplineTol2D; QSpinBox* myBSplineDegree; QSpinBox* myBSplineSegments; QComboBox* myBSpline2DCont; @@ -119,9 +119,9 @@ private : QCheckBox* myToBezierSurfModeChk; QCheckBox* myToBezier3DCurveChk; QCheckBox* myToBezier2DCurveChk; - QAD_SpinBoxDbl* myToBezierMaxTol; + QtxDblSpinBox* myToBezierMaxTol; - QAD_SpinBoxDbl* mySameParameterTol3D; + QtxDblSpinBox* mySameParameterTol3D; private slots: void onOk(); diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index 55b5d0cd6..d7a4dfab5 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -29,15 +29,16 @@ using namespace std; #include "RepairGUI_SuppressFacesDlg.h" -#include "QAD_RightFrame.h" -#include "QAD_Desktop.h" -#include "OCCViewer_Viewer3d.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include "SUIT_Session.h" #include "SALOME_ListIteratorOfListIO.hxx" #include "GEOMImpl_Types.hxx" #include +#include //================================================================================= // class : RepairGUI_SuppressFacesDlg() @@ -46,11 +47,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SUPRESSFACE_TITLE")); @@ -94,7 +95,7 @@ void RepairGUI_SuppressFacesDlg::Init() myObjects = new GEOM::ListOfGO(); myObjects->length( 0 ); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); /* signals and slots connections */ @@ -108,7 +109,8 @@ void RepairGUI_SuppressFacesDlg::Init() connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "SUPRESS_FACE_NEW_OBJ_NAME" ) ); } @@ -169,9 +171,9 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() Standard_Boolean aRes = Standard_False; int i = 0; int numFaces = 0; - myObjects->length( mySelection->IObjectCount() ); + myObjects->length( IObjectCount() ); myFaces.clear(); - for ( SALOME_ListIteratorOfListIO anIt( mySelection->StoredIObjects() ); anIt.More(); anIt.Next() ) + for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() ) { Handle(SALOME_InteractiveObject) anIO = anIt.Value(); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); @@ -183,10 +185,12 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() if ( aShape.ShapeType() <= TopAbs_FACE ) // FACE, SHELL, SOLID, COMPOUND { GEOM::short_array anIndexes; - if ( mySelection->HasIndex( anIO ) ) + + TColStd_IndexedMapOfInteger aMap; + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( !aMap.IsEmpty() ) { - TColStd_IndexedMapOfInteger aMap; - mySelection->GetIndex( anIO, aMap ); Convert( aMap, anIndexes ); myObjects[i++] = aSelectedObject; // append the object myFaces.append( anIndexes ); // append faces' indexes @@ -248,7 +252,7 @@ void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -260,9 +264,10 @@ void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() void RepairGUI_SuppressFacesDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState( 0 ); + //myGeomGUI->SetState( 0 ); initSelection(); } @@ -284,7 +289,7 @@ void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e) //================================================================================= void RepairGUI_SuppressFacesDlg::closeEvent(QCloseEvent* e) { - myGeomGUI->SetState( -1 ); + //myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h index a164e3577..e725f0e64 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h @@ -43,7 +43,7 @@ class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton Q_OBJECT public: - RepairGUI_SuppressFacesDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + RepairGUI_SuppressFacesDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_SuppressFacesDlg(); protected: diff --git a/src/SKETCHER/Makefile.in b/src/SKETCHER/Makefile.in index 82c1e52e9..086509549 100644 --- a/src/SKETCHER/Makefile.in +++ b/src/SKETCHER/Makefile.in @@ -37,7 +37,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMSketcher.la LIB_SRC = Sketcher_Profile.cxx -LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl +LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl SALOME_GenericObj.idl # header files EXPORT_HEADERS= Sketcher_Profile.hxx diff --git a/src/TransformationGUI/Makefile.in b/src/TransformationGUI/Makefile.in index c68291361..22de12a82 100644 --- a/src/TransformationGUI/Makefile.in +++ b/src/TransformationGUI/Makefile.in @@ -60,14 +60,14 @@ LIB_MOC = \ TransformationGUI_OffsetDlg.h \ TransformationGUI_PositionDlg.h -LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl +LIB_CLIENT_IDL = SALOME_GenericObj.idl SALOME_Component.idl SALOME_Exception.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome LDFLAGS += -lGEOMFiltersSelection -lGEOMBase diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx index 38e863d13..59cc9655d 100644 --- a/src/TransformationGUI/TransformationGUI.cxx +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -28,9 +28,10 @@ using namespace std; #include "TransformationGUI.h" -#include "QAD_Desktop.h" +#include "GeometryGUI.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "SUIT_Session.h" +#include "SUIT_Desktop.h" #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION @@ -47,11 +48,11 @@ TransformationGUI* TransformationGUI::myGUIObject = 0; // function : GetTransformationGUI() // purpose : Get the only TransformationGUI object [ static ] //======================================================================= -TransformationGUI* TransformationGUI::GetTransformationGUI() +TransformationGUI* TransformationGUI::GetTransformationGUI( GeometryGUI* parent ) { if ( myGUIObject == 0 ) { // init TransformationGUI only once - myGUIObject = new TransformationGUI(); + myGUIObject = new TransformationGUI( parent ); } return myGUIObject; } @@ -60,7 +61,7 @@ TransformationGUI* TransformationGUI::GetTransformationGUI() // function : TransformationGUI() // purpose : Constructor //======================================================================= -TransformationGUI::TransformationGUI() : GEOMGUI() +TransformationGUI::TransformationGUI(GeometryGUI* parent) : GEOMGUI(parent) { } @@ -78,57 +79,56 @@ TransformationGUI::~TransformationGUI() // function : OnGUIEvent() // purpose : //======================================================================= -bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool TransformationGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) { - GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + getGeometryGUI()->EmitSignalDeactivateDialog(); QDialog* aDlg = NULL; switch (theCommandID) { case 5021: // TRANSLATION { - aDlg = new TransformationGUI_TranslationDlg(parent, "", Sel); + aDlg = new TransformationGUI_TranslationDlg( getGeometryGUI(), parent, "" ); break; } case 5022: // ROTATION { - aDlg = new TransformationGUI_RotationDlg(parent, "", Sel); + aDlg = new TransformationGUI_RotationDlg( parent, "" ); break; } case 5023: // POSITION { - aDlg = new TransformationGUI_PositionDlg(parent, "", Sel); + aDlg = new TransformationGUI_PositionDlg( parent, "" ); break; } case 5024: // MIRROR { - aDlg = new TransformationGUI_MirrorDlg(parent, "", Sel); + aDlg = new TransformationGUI_MirrorDlg( parent, "" ); break; } case 5025: // SCALE { - aDlg = new TransformationGUI_ScaleDlg(parent, "", Sel ); + aDlg = new TransformationGUI_ScaleDlg( getGeometryGUI(), parent, "" ); break; } case 5026: // OFFSET { - aDlg = new TransformationGUI_OffsetDlg(parent, "", Sel ); + aDlg = new TransformationGUI_OffsetDlg( parent, "" ); break; } case 5027: // MULTI TRANSLATION { - aDlg = new TransformationGUI_MultiTranslationDlg(parent, "", Sel); + aDlg = new TransformationGUI_MultiTranslationDlg( getGeometryGUI(), parent, "" ); break; } case 5028: // MULTI ROTATION { - aDlg = new TransformationGUI_MultiRotationDlg(parent, "", Sel); + aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent, "" ); break; } default: { - parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); break; } } @@ -145,8 +145,8 @@ bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //===================================================================================== extern "C" { - GEOMGUI* GetLibGUI() + GEOMGUI* GetLibGUI( GeometryGUI* parent ) { - return TransformationGUI::GetTransformationGUI(); + return TransformationGUI::GetTransformationGUI( parent ); } } diff --git a/src/TransformationGUI/TransformationGUI.h b/src/TransformationGUI/TransformationGUI.h index 65a4bd999..96f48970b 100644 --- a/src/TransformationGUI/TransformationGUI.h +++ b/src/TransformationGUI/TransformationGUI.h @@ -39,15 +39,15 @@ class TransformationGUI : public GEOMGUI { protected: - TransformationGUI(); // hide constructor to avoid direct creation + TransformationGUI( GeometryGUI* parent ); // hide constructor to avoid direct creation public : ~TransformationGUI(); // Get the only TransformationGUI object - static TransformationGUI* GetTransformationGUI(); + static TransformationGUI* GetTransformationGUI( GeometryGUI* parent ); - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool OnGUIEvent(int theCommandID, SUIT_Desktop* parent); private: static TransformationGUI* myGUIObject; // the only TransformationGUI object diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index b56df85cb..d255e8f0b 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -28,9 +28,13 @@ #include "TransformationGUI_MirrorDlg.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include +#include #include "GEOMImpl_Types.hxx" @@ -45,13 +49,13 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_POINT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_AXE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_PLANE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_POINT"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_AXE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR_PLANE"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_MIRROR_TITLE")); @@ -120,7 +124,8 @@ void TransformationGUI_MirrorDlg::Init() connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_MIRROR" ) ); ConstructorsClicked( 0 ); @@ -134,7 +139,7 @@ void TransformationGUI_MirrorDlg::Init() //================================================================================= void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId) { - disconnect( mySelection, 0, this, 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); globalSelection(); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -159,7 +164,8 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId) break; } } - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -211,13 +217,13 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument() if(myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if(aNbSel < 1) { myObjects.length(0); return; } - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; if(aNbSel != 1) @@ -225,13 +231,13 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument() } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { myArgument = GEOM::GEOM_Object::_nil(); return; } Standard_Boolean testResult = Standard_False; - myArgument = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult || CORBA::is_nil( myArgument )) return; aName = GEOMBase::GetName( myArgument ); @@ -304,7 +310,8 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() void TransformationGUI_MirrorDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.h b/src/TransformationGUI/TransformationGUI_MirrorDlg.h index 4b2bea586..150d3edae 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.h +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.h @@ -44,7 +44,7 @@ class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_MirrorDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_MirrorDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_MirrorDlg(); protected: diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 441abea0a..aa5024141 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -28,12 +28,15 @@ #include "TransformationGUI_MultiRotationDlg.h" -#include "GEOMImpl_Types.hxx" - -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include +#include + +#include "GEOMImpl_Types.hxx" #include "utilities.h" @@ -46,12 +49,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_MULTIROTATION_TITLE")); @@ -110,8 +113,8 @@ TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg() void TransformationGUI_MultiRotationDlg::Init() { /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); double SpecificStep1 = 5; double SpecificStep2 = 1; @@ -149,15 +152,16 @@ void TransformationGUI_MultiRotationDlg::Init() connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_MULTIROTATION" ) ); ConstructorsClicked( 0 ); @@ -170,7 +174,7 @@ void TransformationGUI_MultiRotationDlg::Init() //================================================================================= void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); myAng = 45.0; myStep = 50.0; @@ -215,7 +219,7 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument->setFocus(); myBase = myVector = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -263,7 +267,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) myBase = GEOM::GEOM_Object::_nil(); else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) @@ -273,7 +277,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) return; @@ -343,7 +347,8 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -416,7 +421,7 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle() //================================================================================= GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation() { - return getGeomEngine()->GetITransformOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); } @@ -473,6 +478,6 @@ bool TransformationGUI_MultiRotationDlg::execute( ObjectList& objects ) //================================================================================= void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h index 06d10be13..c122bc3eb 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -43,7 +43,7 @@ class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_MultiRotationDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_MultiRotationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_MultiRotationDlg(); protected: @@ -57,6 +57,8 @@ protected: private : void Init(); void enterEvent(QEvent* e); + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myBase, myVector; int myNbTimes1; diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 108dbb1dd..61671b818 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -28,10 +28,14 @@ #include "TransformationGUI_MultiTranslationDlg.h" -#include "GEOMImpl_Types.hxx" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "GEOMImpl_Types.hxx" #include @@ -46,12 +50,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_MULTITRANSLATION_TITLE")); @@ -116,9 +120,9 @@ TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg() void TransformationGUI_MultiTranslationDlg::Init() { /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); + double SpecificStep = 1; /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); @@ -159,18 +163,19 @@ void TransformationGUI_MultiTranslationDlg::Init() connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); connect(GroupDimensions->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(ReverseStepV())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_MULTITRANSLATION" ) ); @@ -184,7 +189,7 @@ void TransformationGUI_MultiTranslationDlg::Init() //================================================================================= void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelection, 0, this, 0); + disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0); myStepU = myStepV = 50.0; myNbTimesU = myNbTimesV = 2; @@ -231,7 +236,8 @@ void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorI myEditCurrentArgument->setFocus(); myBase = myVectorU = GEOM::GEOM_Object::_nil(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -279,7 +285,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) myBase = GEOM::GEOM_Object::_nil(); else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) @@ -291,7 +297,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() // nbSel == 1 Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if ( !testResult || CORBA::is_nil( aSelectedObject ) || !GEOMBase::IsShape( aSelectedObject ) ) return; @@ -368,7 +374,8 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -470,7 +477,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseStepV() //================================================================================= GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperation() { - return getGeomEngine()->GetITransformOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); } @@ -534,6 +541,6 @@ bool TransformationGUI_MultiTranslationDlg::execute( ObjectList& objects ) //================================================================================= void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h index 1440ab66f..8fd449628 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -43,7 +43,7 @@ class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_MultiTranslationDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_MultiTranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_MultiTranslationDlg(); protected: @@ -57,6 +57,8 @@ protected: private : void Init(); void enterEvent(QEvent* e); + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myBase, myVectorU, myVectorV ; int myNbTimesU; diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx index ba0cd6381..3b4d896b5 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.cxx @@ -27,11 +27,17 @@ // $Header$ #include "TransformationGUI_OffsetDlg.h" -#include -#include "utilities.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" + +#include #include +#include "utilities.h" + using namespace std; //================================================================================= @@ -41,11 +47,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_OFFSET"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_OFFSET"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_OFFSET_TITLE")); @@ -100,7 +106,7 @@ void TransformationGUI_OffsetDlg::Init() /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); GroupPoints->SpinBox_DX->setPrecision(5); - GroupPoints->SpinBox_DX->setDblPrecision(1e-05); + //@ GroupPoints->SpinBox_DX->setDblPrecision(1e-05); GroupPoints->SpinBox_DX->SetValue(1e-05); // Activate Create a Copy mode @@ -112,7 +118,8 @@ void TransformationGUI_OffsetDlg::Init() connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); @@ -168,7 +175,7 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); QString aName; - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if(aNbSel < 1) { myObjects.length(0); @@ -176,12 +183,10 @@ void TransformationGUI_OffsetDlg::SelectionIntoArgument() } // nbSel > 0 - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; - if(aNbSel != 1) - aName = tr("%1_objects").arg(aNbSel); - + myEditCurrentArgument->setText( aName ); displayPreview(); @@ -238,7 +243,8 @@ void TransformationGUI_OffsetDlg::enterEvent(QEvent * e) void TransformationGUI_OffsetDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection( GEOM_ALLSHAPES ); myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); @@ -321,7 +327,7 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects ) //================================================================================= void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/TransformationGUI/TransformationGUI_OffsetDlg.h b/src/TransformationGUI/TransformationGUI_OffsetDlg.h index e14ccc4cf..da127fbc0 100644 --- a/src/TransformationGUI/TransformationGUI_OffsetDlg.h +++ b/src/TransformationGUI/TransformationGUI_OffsetDlg.h @@ -42,7 +42,7 @@ class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_OffsetDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_OffsetDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_OffsetDlg(); protected: diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx index d6fca9051..dc8a9b583 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx @@ -28,10 +28,16 @@ #include "TransformationGUI_PositionDlg.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include #include +#include "TColStd_MapOfInteger.hxx" + #include "GEOMImpl_Types.hxx" #include "utilities.h" @@ -45,12 +51,12 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_PositionDlg::TransformationGUI_PositionDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_PositionDlg::TransformationGUI_PositionDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POSITION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POSITION2"))); - QPixmap imageselect(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POSITION"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_POSITION2"))); + QPixmap imageselect(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_POSITION_TITLE")); @@ -127,7 +133,8 @@ void TransformationGUI_PositionDlg::Init() connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_POSITION" ) ); ConstructorsClicked( 0 ); @@ -141,7 +148,7 @@ void TransformationGUI_PositionDlg::Init() //================================================================================= void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId) { - disconnect( mySelection, 0, this, 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); globalSelection(); myEditCurrentArgument = Group1->LineEdit1; @@ -167,7 +174,8 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId) break; } } - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); SelectionIntoArgument(); } @@ -219,29 +227,27 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument() QString aName; if(myEditCurrentArgument == Group1->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if(aNbSel < 1) { myObjects.length(0); displayPreview(); return; } - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) { displayPreview(); return; } - if(aNbSel != 1) - aName = tr("%1_objects").arg(aNbSel); } else if(myEditCurrentArgument == Group1->LineEdit2) { myStartLCS = GEOM::GEOM_Object::_nil(); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { displayPreview(); return; } Standard_Boolean testResult = Standard_False; - myStartLCS = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + myStartLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult || CORBA::is_nil( myStartLCS )) { displayPreview(); return; @@ -250,13 +256,13 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument() } else if(myEditCurrentArgument == Group1->LineEdit3) { myEndLCS = GEOM::GEOM_Object::_nil(); - if(mySelection->IObjectCount() != 1) { + if(IObjectCount() != 1) { displayPreview(); return; } Standard_Boolean testResult = Standard_False; - myEndLCS = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult || CORBA::is_nil( myEndLCS )) { displayPreview(); return; @@ -322,7 +328,8 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument() void TransformationGUI_PositionDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.h b/src/TransformationGUI/TransformationGUI_PositionDlg.h index cda05c5d9..2e5e499b4 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.h +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.h @@ -44,7 +44,7 @@ class TransformationGUI_PositionDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_PositionDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_PositionDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_PositionDlg(); protected: diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 66fde50d0..03f9cd8d1 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -27,13 +27,16 @@ // $Header$ #include "TransformationGUI_RotationDlg.h" -#include - -#include "QAD_Desktop.h" -#include "GEOMImpl_Types.hxx" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include +#include + +#include "GEOMImpl_Types.hxx" #include "utilities.h" @@ -46,11 +49,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_RotationDlg::TransformationGUI_RotationDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_RotationDlg::TransformationGUI_RotationDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ROTATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_ROTATION"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_ROTATION_TITLE")); @@ -98,7 +101,8 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg(QWidget* parent, c connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; Init(); } @@ -176,27 +180,25 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() if(myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if(aNbSel < 1) { myObjects.length(0); return; } - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; - if(aNbSel != 1) - aName = tr("%1_objects").arg(aNbSel); } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { myAxis = GEOM::GEOM_Object::_nil(); return; } Standard_Boolean testResult = Standard_False; - myAxis = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + myAxis = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult || CORBA::is_nil( myAxis )) return; aName = GEOMBase::GetName( myAxis ); @@ -252,7 +254,8 @@ void TransformationGUI_RotationDlg::LineEditReturnPressed() void TransformationGUI_RotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection(); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h index ab3dc222e..173ce35de 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -41,7 +41,7 @@ class TransformationGUI_RotationDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_RotationDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_RotationDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_RotationDlg(); protected: @@ -56,7 +56,7 @@ private : void Init(); void enterEvent(QEvent* e); double GetAngle() const; - + GEOM::ListOfGO myObjects; GEOM::GEOM_Object_var myAxis; diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index bcfec2b55..1690ae6d3 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -28,12 +28,16 @@ #include "TransformationGUI_ScaleDlg.h" -#include "QAD_Desktop.h" - -#include "GEOMImpl_Types.hxx" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" +#include #include +#include "GEOMImpl_Types.hxx" + #include "utilities.h" using namespace std; @@ -45,11 +49,11 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SCALE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_SCALE"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SCALE_TITLE")); @@ -97,10 +101,11 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(QWidget* parent, const ch connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; Init(); } @@ -177,27 +182,25 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument() if(myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); if(aNbSel < 1) { myObjects.length(0); return; } - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; - if(aNbSel != 1) - aName = tr("%1_objects").arg(aNbSel); } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { - if(mySelection->IObjectCount() != 1) + if(IObjectCount() != 1) { myPoint = GEOM::GEOM_Object::_nil(); return; } Standard_Boolean testResult = Standard_False; - myPoint = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if(!testResult || CORBA::is_nil( myPoint )) return; aName = GEOMBase::GetName( myPoint ); @@ -253,7 +256,8 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() void TransformationGUI_ScaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); globalSelection(); GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; @@ -297,7 +301,7 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox() //================================================================================= GEOM::GEOM_IOperations_ptr TransformationGUI_ScaleDlg::createOperation() { - return getGeomEngine()->GetITransformOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); } //================================================================================= diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h index b2894a805..8f0e61c07 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.h +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -42,7 +42,7 @@ class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_ScaleDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_ScaleDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_ScaleDlg(); protected: @@ -57,6 +57,8 @@ private : void Init(); void enterEvent(QEvent* e); double GetFactor() const; + + GeometryGUI* myGeometryGUI; GEOM::ListOfGO myObjects; GEOM::GEOM_Object_var myPoint; /* Central Point */ diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 0654d2ad4..c56d2e402 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -28,10 +28,13 @@ #include "TransformationGUI_TranslationDlg.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_SelectionMgr.h" #include +#include #include "GEOMImpl_Types.hxx" @@ -46,13 +49,13 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent, const char* name, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myGeometryGUI(theGeometryGUI) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_DXYZ"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_POINTS"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_VECTOR"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_DXYZ"))); + QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_POINTS"))); + QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION_VECTOR"))); + QPixmap image3(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_TRANSLATION_TITLE")); @@ -112,8 +115,8 @@ void TransformationGUI_TranslationDlg::Init() CreateCopyModeChanged(true); /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100); /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox1->RangeStepAndValidator(-999.999, 999.999, step, 3); @@ -133,19 +136,20 @@ void TransformationGUI_TranslationDlg::Init() connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); // MZN: Delete ? + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); //@ Delete ? connect(GroupPoints->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupPoints->SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox1, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox2, SLOT(SetStep(double))); + connect(myGeometryGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox3, SLOT(SetStep(double))); connect(GroupPoints->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool))); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; initName( tr( "GEOM_TRANSLATION" ) ); ConstructorsClicked( 0 ); @@ -158,7 +162,7 @@ void TransformationGUI_TranslationDlg::Init() //================================================================================= void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) { - disconnect( mySelection, 0, this, 0 ); + disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0 ); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); @@ -196,7 +200,8 @@ void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId) } myEditCurrentArgument->setFocus(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -247,21 +252,20 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() if(myEditCurrentArgument == GroupPoints->LineEdit1) { - int aNbSel = GEOMBase::GetNameOfSelectedIObjects(mySelection, aName); + int aNbSel = GEOMBase::GetNameOfSelectedIObjects(selectedIO(), aName); + if(aNbSel < 1) { myObjects.length(0); return; } - GEOMBase::ConvertListOfIOInListOfGO(mySelection->StoredIObjects(), myObjects); + GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), myObjects); if (!myObjects.length()) return; - if(aNbSel != 1) - aName = tr("%1_objects").arg(aNbSel); } else { - if (mySelection->IObjectCount() != 1) { + if (IObjectCount() != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1) myPoint1 = GEOM::GEOM_Object::_nil(); else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) @@ -272,7 +276,7 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() } Standard_Boolean testResult = Standard_False;; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(mySelection->firstIObject(), testResult ); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult ); if (!testResult || CORBA::is_nil( aSelectedObject )) return; @@ -345,7 +349,8 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() void TransformationGUI_TranslationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); ConstructorsClicked( getConstructorId() ); } @@ -388,7 +393,7 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox() //================================================================================= GEOM::GEOM_IOperations_ptr TransformationGUI_TranslationDlg::createOperation() { - return getGeomEngine()->GetITransformOperations( getStudyId() ); + return myGeometryGUI->GetGeomGen()->GetITransformOperations( getStudyId() ); } @@ -507,7 +512,7 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects ) //================================================================================= void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e ) { - myGeomGUI->SetState( -1 ); + // myGeomGUI->SetState( -1 ); GEOMBase_Skeleton::closeEvent( e ); } diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.h b/src/TransformationGUI/TransformationGUI_TranslationDlg.h index 48050c84c..069c33435 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.h @@ -42,7 +42,7 @@ class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton Q_OBJECT public: - TransformationGUI_TranslationDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + TransformationGUI_TranslationDlg(GeometryGUI* theGeometryGUI, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_TranslationDlg(); protected: @@ -56,6 +56,8 @@ protected: private : void Init(); void enterEvent(QEvent* e); + + GeometryGUI* myGeometryGUI; GEOM::GEOM_Object_var myVector, myPoint1, myPoint2; GEOM::ListOfGO myObjects; -- 2.39.2