From: admin Date: Thu, 15 Jan 2009 08:05:40 +0000 (+0000) Subject: This commit was generated by cvs2git to create tag X-Git-Tag: mergeto_BR_V5_DEV_22Jan09 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=041dfe0daafeed17b0b4fae02d46bb88ab5e3d9e;p=modules%2Fvisu.git This commit was generated by cvs2git to create tag 'mergeto_BR_V5_DEV_22Jan09'. Sprout from BR_QT4_Dev 2008-08-28 09:52:33 UTC abd 'Fix compilation problems on Win32 platform' Cherrypick from BR_QT4_Dev 2008-09-16 07:21:15 UTC vsr 'Implement 'make dist' and 'make distcheck' steps support': Makefile.am adm_local/Makefile.am adm_local/unix/config_files/Makefile.am adm_local/unix/make_common_starter.am bin/Makefile.am doc/Makefile.am doc/salome/Makefile.am doc/salome/gui/Makefile.am doc/salome/gui/VISU/doxyfile.in doc/salome/gui/VISU/doxyfile_idl.in doc/salome/tui/Makefile.am idl/Makefile.am src/CONVERTOR/Makefile.am src/ENGINE/Makefile.am src/VISU_SWIG/Makefile.am Cherrypick from BR_QT4_Dev 2007-05-25 14:40:53 UTC admin 'This commit was generated by cvs2git to create branch 'BR_QT4_Dev'.': doc/salome/gui/VISU/pics/smds1.png resources/Visu_cutplane.png Cherrypick from master 2008-03-07 07:46:09 UTC jfa 'Join modifications from BR_Dev_For_4_0 tag V4_1_1.': doc/salome/gui/VISU/files/about_structure_of_med_object.htm doc/salome/gui/VISU/files/about_tables.htm doc/salome/gui/VISU/files/animating_presentations.htm doc/salome/gui/VISU/files/changing_visualization_parameters_of_the_presenetation.htm doc/salome/gui/VISU/files/creating_curves.htm doc/salome/gui/VISU/files/creating_field_presentations.htm doc/salome/gui/VISU/files/creating_presentations.htm doc/salome/gui/VISU/files/creating_xy_plot.htm doc/salome/gui/VISU/files/cut_lines_presentation.htm doc/salome/gui/VISU/files/cut_lines_resentation.htm doc/salome/gui/VISU/files/deformed_shape_presentation.htm doc/salome/gui/VISU/files/displaying_hiding_presentations.htm doc/salome/gui/VISU/files/displaying_tables.htm doc/salome/gui/VISU/files/getting_elements_attributes.htm doc/salome/gui/VISU/files/getting_started.htm doc/salome/gui/VISU/files/importing_med_objects.htm doc/salome/gui/VISU/files/importing_tables.htm doc/salome/gui/VISU/files/insideframe.htm doc/salome/gui/VISU/files/introduction.htm doc/salome/gui/VISU/files/iso_surfaces_presentation.htm doc/salome/gui/VISU/files/points.htm doc/salome/gui/VISU/files/running_visu.htm doc/salome/gui/VISU/files/scalar_map_presentation.htm doc/salome/gui/VISU/files/scaling_presentations.htm doc/salome/gui/VISU/files/setting_properties_of_xy_plots.htm doc/salome/gui/VISU/files/shrink.htm doc/salome/gui/VISU/files/stream_lines_presentation.htm doc/salome/gui/VISU/files/surface.htm doc/salome/gui/VISU/files/surfaceframe.htm doc/salome/gui/VISU/files/sweeping.htm doc/salome/gui/VISU/files/vectors_presentation.htm doc/salome/gui/VISU/files/wireframe.htm doc/salome/gui/VISU/pics/animation.png doc/salome/gui/VISU/pics/createcurves.png doc/salome/gui/VISU/pics/cutlines.png doc/salome/gui/VISU/pics/dataonelements1.png doc/salome/gui/VISU/pics/dataonelements2.png doc/salome/gui/VISU/pics/image157.gif doc/salome/gui/VISU/pics/scalarbarproperties.png doc/salome/gui/VISU/pics/set_rotation_point_dialog1.png doc/salome/gui/VISU/pics/set_rotation_point_dialog2.png doc/salome/gui/VISU/pics/view_rotation_point.png doc/salome/gui/VISU/visugenidl_doc/VISU__Gen_8idl.html doc/salome/gui/VISU/visugenidl_doc/VISU__Gen_8idl__incl.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Animation.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Animation__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Base.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Base__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ColoredPrs3d.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ColoredPrs3dCache.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ColoredPrs3dCache__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ColoredPrs3dHolder.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ColoredPrs3dHolder__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ColoredPrs3d__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Container.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Container__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Curve.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Curve__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1CutLines.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1CutLines__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1CutPlanes.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1CutPlanes__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1DeformedShape.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1DeformedShape__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1GaussPoints.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1GaussPoints__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1IsoSurfaces.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1IsoSurfaces__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Mesh.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Mesh__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Plot3D.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Plot3D__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Prs3d.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Prs3d__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1PrsObject.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1PrsObject__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1RemovableObject.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1RemovableObject__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Result.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Result__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMap.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMapOnDeformedShape.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMapOnDeformedShape__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMap__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1StreamLines.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1StreamLines__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Table.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1TableView.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1TableView__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Table__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1VISU__Gen.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1VISU__Gen__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Vectors.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1Vectors__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1View.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1View3D.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1View3D__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ViewManager.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ViewManager__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1View__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1XYPlot.html doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1XYPlot__inherit__graph.jpg doc/salome/gui/VISU/visugenidl_doc/namespaceVISU.html doc/salome/gui/VISU/whdata/whftdata.js doc/salome/gui/VISU/whdata/whftdata0.htm doc/salome/gui/VISU/whdata/whfts.htm doc/salome/gui/VISU/whdata/whfts.js doc/salome/gui/VISU/whdata/whfwdata.js doc/salome/gui/VISU/whdata/whfwdata0.htm doc/salome/gui/VISU/whdata/whgdata.js doc/salome/gui/VISU/whdata/whgdata0.htm doc/salome/gui/VISU/whdata/whglo.htm doc/salome/gui/VISU/whdata/whglo.js doc/salome/gui/VISU/whdata/whidata.js doc/salome/gui/VISU/whdata/whidx.htm doc/salome/gui/VISU/whdata/whidx.js doc/salome/gui/VISU/whdata/whtdata.js doc/salome/gui/VISU/whdata/whtdata0.htm doc/salome/gui/VISU/whdata/whtoc.htm doc/salome/gui/VISU/whdata/whtoc.js doc/salome/gui/VISU/whgdata/whlstf0.htm doc/salome/gui/VISU/whgdata/whlstf1.htm doc/salome/gui/VISU/whgdata/whlstf2.htm doc/salome/gui/VISU/whgdata/whlstf3.htm doc/salome/gui/VISU/whgdata/whlstf4.htm doc/salome/gui/VISU/whgdata/whlstf5.htm doc/salome/gui/VISU/whgdata/whlstf6.htm doc/salome/gui/VISU/whgdata/whlstf7.htm doc/salome/gui/VISU/whgdata/whlstf8.htm doc/salome/gui/VISU/whgdata/whlstf9.htm doc/salome/gui/VISU/whgdata/whlstfl0.htm doc/salome/gui/VISU/whgdata/whlstfl1.htm doc/salome/gui/VISU/whgdata/whlstfl10.htm doc/salome/gui/VISU/whgdata/whlstfl11.htm doc/salome/gui/VISU/whgdata/whlstfl12.htm doc/salome/gui/VISU/whgdata/whlstfl13.htm doc/salome/gui/VISU/whgdata/whlstfl14.htm doc/salome/gui/VISU/whgdata/whlstfl15.htm doc/salome/gui/VISU/whgdata/whlstfl16.htm doc/salome/gui/VISU/whgdata/whlstfl17.htm doc/salome/gui/VISU/whgdata/whlstfl18.htm doc/salome/gui/VISU/whgdata/whlstfl19.htm doc/salome/gui/VISU/whgdata/whlstfl2.htm doc/salome/gui/VISU/whgdata/whlstfl20.htm doc/salome/gui/VISU/whgdata/whlstfl21.htm doc/salome/gui/VISU/whgdata/whlstfl22.htm doc/salome/gui/VISU/whgdata/whlstfl23.htm doc/salome/gui/VISU/whgdata/whlstfl24.htm doc/salome/gui/VISU/whgdata/whlstfl3.htm doc/salome/gui/VISU/whgdata/whlstfl4.htm doc/salome/gui/VISU/whgdata/whlstfl5.htm doc/salome/gui/VISU/whgdata/whlstfl6.htm doc/salome/gui/VISU/whgdata/whlstfl7.htm doc/salome/gui/VISU/whgdata/whlstfl8.htm doc/salome/gui/VISU/whgdata/whlstfl9.htm doc/salome/gui/VISU/whgdata/whlstg0.htm doc/salome/gui/VISU/whgdata/whlsti0.htm doc/salome/gui/VISU/whgdata/whlstt0.htm doc/salome/gui/VISU/whgdata/whlstt1.htm doc/salome/gui/VISU/whgdata/whlstt2.htm doc/salome/gui/VISU/whgdata/whlstt3.htm doc/salome/gui/VISU/whgdata/whlstt4.htm doc/salome/gui/VISU/whgdata/whlstt5.htm doc/salome/gui/VISU/whgdata/whlstt6.htm doc/salome/gui/VISU/whgdata/whlstt7.htm doc/salome/gui/VISU/whgdata/whnvf30.htm doc/salome/gui/VISU/whgdata/whnvf31.htm doc/salome/gui/VISU/whgdata/whnvf32.htm doc/salome/gui/VISU/whgdata/whnvf33.htm doc/salome/gui/VISU/whgdata/whnvl31.htm doc/salome/gui/VISU/whgdata/whnvl32.htm doc/salome/gui/VISU/whgdata/whnvl33.htm doc/salome/gui/VISU/whgdata/whnvp30.htm doc/salome/gui/VISU/whgdata/whnvp31.htm doc/salome/gui/VISU/whgdata/whnvp32.htm doc/salome/gui/VISU/whgdata/whnvp33.htm doc/salome/gui/VISU/whgdata/whnvt30.htm doc/salome/gui/VISU/whgdata/whnvt31.htm doc/salome/gui/VISU/whgdata/whnvt32.htm doc/salome/gui/VISU/whgdata/whnvt33.htm doc/salome/gui/VISU/whxdata/whftdata0.xml doc/salome/gui/VISU/whxdata/whfts.xml doc/salome/gui/VISU/whxdata/whfwdata0.xml doc/salome/gui/VISU/whxdata/whgdata0.xml doc/salome/gui/VISU/whxdata/whglo.xml doc/salome/gui/VISU/whxdata/whidx.xml doc/salome/gui/VISU/whxdata/whtdata0.xml doc/salome/gui/VISU/whxdata/whtoc.xml doc/salome/tui/VISU/doxyfile.in doc/salome/tui/VISU/sources/bg_salome.gif doc/salome/tui/VISU/sources/static/examples_VISU.html doc/salome/tui/VISU/sources/static/overview_VISU.html src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh Cherrypick from BR_V5_DEV 2008-10-29 14:04:50 UTC dmv 'Icons Plot2DView and Curves in Object Browser are missing in series 4x and 5x': configure.ac resources/Makefile.am src/CONVERTOR/VISU_Convertor_impl.cxx src/ENGINE/VISU_Engine_i.cc src/ENGINE/VISU_Engine_i.hh src/OBJECT/Makefile.am src/OBJECT/VISU_DataSetActor.cxx src/OBJECT/VISU_DataSetActor.h src/OBJECT/VISU_GaussPtsAct.cxx src/OBJECT/VISU_GaussPtsAct.h src/OBJECT/VISU_GaussPtsDeviceActor.cxx src/OBJECT/VISU_GaussPtsDeviceActor.h src/OBJECT/VISU_GaussPtsSettings.cxx src/OBJECT/VISU_GaussPtsSettings.h src/OBJECT/VISU_MeshAct.cxx src/OBJECT/VISU_MeshAct.h src/OBJECT/VISU_ScalarMapAct.cxx src/OBJECT/VISU_ScalarMapAct.h src/PIPELINE/Makefile.am src/PIPELINE/SALOME_ExtractGeometry.h src/PIPELINE/SALOME_ExtractPolyDataGeometry.h src/PIPELINE/VISUPipeLine.cxx src/PIPELINE/VISU_ColoredPL.cxx src/PIPELINE/VISU_ColoredPL.hxx src/PIPELINE/VISU_CutLinesPL.cxx src/PIPELINE/VISU_CutPlanesPL.cxx src/PIPELINE/VISU_DataSetMapperHolder.cxx src/PIPELINE/VISU_DataSetMapperHolder.hxx src/PIPELINE/VISU_DeformedShapePL.cxx src/PIPELINE/VISU_GaussPointsPL.cxx src/PIPELINE/VISU_IsoSurfacesPL.cxx src/PIPELINE/VISU_IsoSurfacesPL.hxx src/PIPELINE/VISU_LookupTable.cxx src/PIPELINE/VISU_LookupTable.hxx src/PIPELINE/VISU_MapperHolder.hxx src/PIPELINE/VISU_MeshPL.cxx src/PIPELINE/VISU_PipeLine.cxx src/PIPELINE/VISU_PipeLine.hxx src/PIPELINE/VISU_Plot3DPL.cxx src/PIPELINE/VISU_PointSpriteMapperHolder.cxx src/PIPELINE/VISU_PolyDataMapperHolder.cxx src/PIPELINE/VISU_PolyDataMapperHolder.hxx src/PIPELINE/VISU_ScalarBarCtrl.cxx src/PIPELINE/VISU_ScalarMapPL.cxx src/PIPELINE/VISU_StreamLinesPL.cxx src/PIPELINE/VISU_VectorsPL.cxx src/VISUGUI/VisuGUI_ClippingDlg.cxx src/VISUGUI/VisuGUI_ClippingDlg.h src/VISUGUI/VisuGUI_CutPlanesDlg.cxx src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx src/VISUGUI/VisuGUI_DeformedShapeDlg.h src/VISUGUI/VisuGUI_Displayer.cxx src/VISUGUI/VisuGUI_Module.cxx src/VISUGUI/VisuGUI_Module.h src/VISUGUI/VisuGUI_Prs3dTools.h src/VISUGUI/VisuGUI_Slider.cxx src/VISUGUI/VisuGUI_Slider.h src/VISUGUI/VisuGUI_Tools.h src/VISUGUI/VisuGUI_VectorsDlg.cxx src/VISUGUI/VisuGUI_ViewTools.h src/VISU_I/Makefile.am src/VISU_I/VISUConfig.cc src/VISU_I/VISU_ColoredPrs3dCache_i.cc src/VISU_I/VISU_ColoredPrs3dCache_i.hh src/VISU_I/VISU_ColoredPrs3dFactory.cc src/VISU_I/VISU_ColoredPrs3dHolder_i.cc src/VISU_I/VISU_ColoredPrs3dHolder_i.hh src/VISU_I/VISU_CorbaMedConvertor.cxx src/VISU_I/VISU_CutLines_i.cc src/VISU_I/VISU_CutPlanes_i.cc src/VISU_I/VISU_DeformedShape_i.cc src/VISU_I/VISU_Gen_i.cc src/VISU_I/VISU_Gen_i.hh src/VISU_I/VISU_IsoSurfaces_i.cc src/VISU_I/VISU_Plot3D_i.cc src/VISU_I/VISU_Prs3d_i.cc src/VISU_I/VISU_Prs3d_i.hh src/VISU_I/VISU_ResultUtils.cc src/VISU_I/VISU_Result_i.cc src/VISU_I/VISU_StreamLines_i.cc src/VISU_I/VISU_Table_i.cc src/VISU_I/VISU_TimeAnimation.cxx src/VISU_I/VISU_Vectors_i.cc src/VISU_I/VISU_View_i.hh src/VVTK/Makefile.am src/VVTK/VVTK_MainWindow.cxx src/VVTK/VVTK_MainWindow.h src/VVTK/VVTK_PickingDlg.cxx src/VVTK/VVTK_Renderer.cxx src/VVTK/VVTK_ViewModel.cxx Cherrypick from BR_V5_IMP_P8 2009-01-15 08:05:39 UTC sln '0019819: EDF 643 VISU : Scalar bar ergonomics. Default origin and size of scalar bar changed': doc/salome/gui/VISU/images/barproperty.png doc/salome/gui/VISU/images/scalarbarproperties.png doc/salome/gui/VISU/input/a3d_presentations.doc doc/salome/gui/VISU/input/field_presentations.doc doc/salome/gui/VISU/input/index.doc doc/salome/gui/VISU/input/scalar_map.doc idl/VISU_Gen.idl resources/SalomeApp.xml src/OBJECT/VISU_Actor.cxx src/OBJECT/VISU_Actor.h src/OBJECT/VISU_VectorsAct.cxx src/OBJECT/VISU_VectorsAct.h src/PIPELINE/VISU_ScalarBarActor.cxx src/PIPELINE/VISU_ScalarBarActor.hxx src/VISUGUI/Makefile.am src/VISUGUI/VisuGUI.cxx src/VISUGUI/VisuGUI.h src/VISUGUI/VisuGUI_ActionsDef.h src/VISUGUI/VisuGUI_GaussPointsDlg.cxx src/VISUGUI/VisuGUI_GaussPointsDlg.h src/VISUGUI/VisuGUI_Prs3dDlg.cxx src/VISUGUI/VisuGUI_Prs3dDlg.h src/VISUGUI/VisuGUI_Selection.cxx src/VISUGUI/VisuGUI_Selection.h src/VISUGUI/VisuGUI_Tools.cxx src/VISU_I/VISU_ColoredPrs3d_i.cc src/VISU_I/VISU_ColoredPrs3d_i.hh src/VISU_I/VISU_DumpPython.cc src/VISU_I/VISU_GaussPoints_i.cc src/VISU_I/VISU_Mesh_i.cc src/VISU_I/VISU_Mesh_i.hh src/VISU_I/VISU_Prs3dUtils.cc src/VISU_I/VISU_Prs3dUtils.hh src/VISU_I/VISU_ScalarMap_i.cc src/VISU_I/VISU_ScalarMap_i.hh Delete: doc/salome/gui/VISU/images/exportmedfile.png doc/salome/gui/VISU/images/table.png doc/salome/gui/VISU/images/table3d.png doc/salome/gui/VISU/images/tablesn1.png doc/salome/gui/VISU/images/tablesn2.png doc/salome/gui/VISU/input/table_3d.doc src/CONVERTOR/VISU_ElnoMeshValue.hxx src/CONVERTOR/VISU_TableReader.cxx src/CONVERTOR/VISU_TableReader.hxx src/CONVERTOR/VISU_VTKTypeList.hxx src/OBJECT/VISU_ActorBase.cxx src/OBJECT/VISU_ActorBase.h src/OBJECT/VISU_IsoSurfActor.cxx src/OBJECT/VISU_IsoSurfActor.h src/OBJECT/VISU_PointMap3dActor.cxx src/OBJECT/VISU_PointMap3dActor.h src/PIPELINE/VISU_DeformationPL.cxx src/PIPELINE/VISU_DeformationPL.hxx src/PIPELINE/VISU_DeformedGridPL.cxx src/PIPELINE/VISU_DeformedGridPL.hxx src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx src/PIPELINE/VISU_ElnoAssembleFilter.cxx src/PIPELINE/VISU_ElnoAssembleFilter.hxx src/PIPELINE/VISU_ElnoDisassembleFilter.cxx src/PIPELINE/VISU_ElnoDisassembleFilter.hxx src/PIPELINE/VISU_LabelPointsFilter.cxx src/PIPELINE/VISU_LabelPointsFilter.hxx src/PIPELINE/VISU_MergedPL.cxx src/PIPELINE/VISU_MergedPL.hxx src/PIPELINE/VISU_OptionalDeformationPL.cxx src/PIPELINE/VISU_OptionalDeformationPL.hxx src/VISUGUI/VISU_images.ts src/VISUGUI/VISU_msg_en.ts src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h src/VISUGUI/VisuGUI_FileInfoDlg.cxx src/VISUGUI/VisuGUI_FileInfoDlg.h src/VISUGUI/VisuGUI_Table3dDlg.cxx src/VISUGUI/VisuGUI_Table3dDlg.h src/VISU_I/VISU_Deformation_i.cc src/VISU_I/VISU_Deformation_i.hh src/VISU_I/VISU_DeformedShapeAndScalarMap_i.cc src/VISU_I/VISU_DeformedShapeAndScalarMap_i.hh src/VISU_I/VISU_MonoColorPrs_i.cc src/VISU_I/VISU_MonoColorPrs_i.hh src/VISU_I/VISU_OptionalDeformation_i.cc src/VISU_I/VISU_OptionalDeformation_i.hh src/VISU_I/VISU_PointMap3d_i.cc src/VISU_I/VISU_PointMap3d_i.hh src/VISU_SWIG/visu_pointmap3d.py --- diff --git a/Makefile.am b/Makefile.am index d0f22977..f594b4d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,15 +25,20 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am +ACLOCAL_AMFLAGS = -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files + SUBDIRS = adm_local idl resources src doc bin DISTCLEANFILES = a.out aclocal.m4 configure -salomeinclude_DATA=VISU_version.h +salomeinclude_DATA = VISU_version.h -EXTRA_DIST+= \ - build_configure \ - clean_configure \ +EXTRA_DIST += \ + build_configure \ + clean_configure \ LICENCE dist-hook: @@ -42,7 +47,7 @@ dist-hook: usr_docs: (cd doc && $(MAKE) $(AM_MAKEFLAGS) usr_docs) -docs:usr_docs +docs: usr_docs dev_docs: (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs) diff --git a/adm_local/Makefile.am b/adm_local/Makefile.am index 76fe0fa5..ed00ea01 100644 --- a/adm_local/Makefile.am +++ b/adm_local/Makefile.am @@ -19,4 +19,4 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -SUBDIRS= unix \ No newline at end of file +SUBDIRS = unix \ No newline at end of file diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am index f4266455..a482e6be 100644 --- a/adm_local/unix/config_files/Makefile.am +++ b/adm_local/unix/config_files/Makefile.am @@ -18,5 +18,5 @@ # include $(top_srcdir)/adm_local/unix/make_common_starter.am -dist_admlocalm4_DATA= \ +dist_admlocalm4_DATA = \ check_VISU.m4 diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index d53f5c10..d863afd8 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -7,48 +7,63 @@ # # Standard directory for installation -salomeincludedir = $(includedir)/@PACKAGE@ -libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/@PACKAGE@ -bindir = $(prefix)/bin/@PACKAGE@ +salomeincludedir = $(includedir)/salome +libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/salome +bindir = $(prefix)/bin/salome purebindir = $(prefix)/bin salomescriptdir = $(bindir) +salomepythondir = $(pythondir)/salome +salomepyexecdir = $(pyexecdir)/salome # Tests environment folders testsenvirondir = $(prefix)/Tests/environ testsenvironcshdir = $(prefix)/Tests/environ/csh # Directory for installing idl files -salomeidldir = $(prefix)/idl/@PACKAGE@ +salomeidldir = $(prefix)/idl/salome # Directory for installing resource files -salomeresdir = $(prefix)/share/@PACKAGE@/resources/@MODULE_NAME@ +salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@ # Directories for installing admin files -admlocaldir = $(prefix)/adm_local -admlocalunixdir = $(admlocaldir)/unix -admlocalm4dir = $(admlocaldir)/unix/config_files +admlocaldir = $(prefix)/adm_local +admlocalunixdir = $(admlocaldir)/unix +admlocalm4dir = $(admlocaldir)/unix/config_files # Shared modules installation directory -sharedpkgpythondir =$(pkgpythondir)/shared_modules +sharedpkgpythondir = $(salomepythondir)/shared_modules # Documentation directory -docdir = $(datadir)/doc/@PACKAGE@ +docdir = $(datadir)/doc/salome # common rules -# moc-files generation +# meta object implementation files generation (moc) %_moc.cxx: %.h $(MOC) $< -o $@ -# qm-files generation +# translation (*.qm) files generation (lrelease) %.qm: %.ts $(LRELEASE) $< -qm $@ -EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(nodist_salomeres_DATA:%.qm=%.ts) +# resource files generation (qrcc) +qrc_%.cxx: %.qrc + $(QRCC) $< -o $@ -name $(*F) +# qt forms files generation (uic) +ui_%.h: %.ui + $(UIC) -o $@ $< + +# extra distributed files +EXTRA_DIST = $(MOC_FILES:%_moc.cxx=%.h) $(QRC_FILES:qrc_%.cxx=%.qrc) \ + $(UIC_FILES:ui_%.h=%.ui) $(nodist_salomeres_DATA:%.qm=%.ts) + +# customize clean operation mostlyclean-local: rm -f @builddir@/*_moc.cxx rm -f @builddir@/*.qm + rm -f @builddir@/ui_*.h + rm -f @builddir@/qrc_*.cxx # tests tests: unittest diff --git a/bin/Makefile.am b/bin/Makefile.am index e81b2089..a5f6e4f9 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -18,5 +18,8 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -nodist_salomescript_DATA= VERSION -EXTRA_DIST+= VERSION.in +# non-distributed files +nodist_salomescript_DATA = VERSION + +# distributed files +dist_salomescript_SCRIPTS = diff --git a/configure.ac b/configure.ac index b5113abc..b21738e3 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ # -AC_INIT([Salome2 Project VISU module], [5.0.0], [webmaster.salome@opencascade.com], [salome]) +AC_INIT([Salome2 Project VISU module], [5.1.0], [webmaster.salome@opencascade.com], [SalomeVISU]) AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -354,11 +354,11 @@ AC_OUTPUT([ \ ./doc/Makefile \ ./doc/salome/Makefile \ ./doc/salome/gui/Makefile \ + ./doc/salome/gui/VISU/Makefile \ ./doc/salome/gui/VISU/doxyfile \ ./doc/salome/gui/VISU/doxyfile_idl \ ./doc/salome/tui/Makefile \ - ./doc/salome/tui/VISU/doxyfile \ - ./doc/salome/tui/VISU/sources/static/tree.js \ + ./doc/salome/tui/doxyfile \ ./idl/Makefile \ ./resources/VISUCatalog.xml \ ./resources/Makefile \ diff --git a/doc/Makefile.am b/doc/Makefile.am index 68f247f8..cdcfd951 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -17,6 +17,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -SUBDIRS= salome +SUBDIRS = salome -EXTRA_DIST= html \ No newline at end of file +usr_docs: + (cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs) + +docs: usr_docs + +dev_docs: + (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs) diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index 35fbf228..344600a1 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -18,9 +18,9 @@ # # $Header$ -SUBDIRS= tui gui -SUBDIRSTUI= tui -SUBDIRSGUI= gui +SUBDIRS = tui gui +SUBDIRSTUI = tui +SUBDIRSGUI = gui usr_docs: @@SETX@; for d in $(SUBDIRSGUI); do \ diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index 1ec04c7a..abde2b5a 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -22,34 +22,9 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -EXTRA_DIST+=VISU - -doxygen=@DOXYGEN@ +SUBDIRS = VISU usr_docs: - cd ./VISU; \ - echo "Processing VISU_Gen.idl file: "; \ - $(doxygen) ./doxyfile_idl; \ - echo "Running doxygen in directory: "`pwd`; \ - $(doxygen) ./doxyfile; + (cd VISU && $(MAKE) $(AM_MAKEFLAGS) usr_docs) docs: usr_docs - -clean-local: - rm -fr `ls | grep -v "Makefile"` - rm -fr VISU - -install-data-local: usr_docs - mkdir -p $(docdir)/gui - cp -rf VISU $(docdir)/gui - -find $(PWD) -name CVS -prune -exec rm -rf {} \; - -uninstall-local: - rm -rf $(docdir)/gui/VISU - -docguidir=$(docdir)/gui/VISU - -nodist_docgui_DATA= VISU/doxyfile -nodist_docgui_DATA+= VISU/doxyfile_idl -EXTRA_DIST+= VISU/doxyfile.in -EXTRA_DIST+= VISU/doxyfile_idl.in diff --git a/doc/salome/gui/VISU/doxyfile.in b/doc/salome/gui/VISU/doxyfile.in index b8330d48..9aa594fc 100755 --- a/doc/salome/gui/VISU/doxyfile.in +++ b/doc/salome/gui/VISU/doxyfile.in @@ -2,7 +2,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "Post-Pro Module Reference Manual v.@VERSION@" -OUTPUT_DIRECTORY = ./ +OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English TAB_SIZE = 5 @@ -18,13 +18,15 @@ WARNINGS = YES #--------------------------------------------------------------------------- INPUT = @srcdir@/input FILE_PATTERNS = *.doc +EXCLUDE = IMAGE_PATH = @srcdir@/images +EXAMPLE_PATH = #--------------------------------------------------------------------------- #HTML related options #--------------------------------------------------------------------------- GENERATE_HTML = YES -HTML_OUTPUT = ./ +HTML_OUTPUT = . HTML_HEADER = @srcdir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html #HTML_STYLESHEET = @srcdir@/static/doxygen.css @@ -46,4 +48,4 @@ GENERATE_RTF = NO #--------------------------------------------------------------------------- #External reference options #--------------------------------------------------------------------------- -TAGFILES = visugen_doc.tag=./visugen_doc \ No newline at end of file +TAGFILES = visugen_doc.tag=visugen_doc diff --git a/doc/salome/gui/VISU/doxyfile_idl.in b/doc/salome/gui/VISU/doxyfile_idl.in index 60d89c2d..18af834e 100755 --- a/doc/salome/gui/VISU/doxyfile_idl.in +++ b/doc/salome/gui/VISU/doxyfile_idl.in @@ -2,7 +2,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = "Post-Pro Module Reference Manual v.@VERSION@" -OUTPUT_DIRECTORY = ./ +OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO @@ -66,8 +66,8 @@ VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES +QUIET = NO +WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO @@ -86,7 +86,7 @@ RECURSIVE = NO #HTML related options #--------------------------------------------------------------------------- GENERATE_HTML = YES -HTML_OUTPUT = ./visugen_doc +HTML_OUTPUT = visugen_doc HTML_HEADER = @srcdir@/static/header.html HTML_FOOTER = @srcdir@/static/footer.html #HTML_STYLESHEET = @srcdir@/static/doxygen.css @@ -134,4 +134,4 @@ DOT_CLEANUP = YES #--------------------------------------------------------------------------- #External reference options #--------------------------------------------------------------------------- -GENERATE_TAGFILE = visugen_doc.tag +GENERATE_TAGFILE = visugen_doc.tag diff --git a/doc/salome/gui/VISU/images/barproperty.png b/doc/salome/gui/VISU/images/barproperty.png index 6bc74cec..f095a330 100644 Binary files a/doc/salome/gui/VISU/images/barproperty.png and b/doc/salome/gui/VISU/images/barproperty.png differ diff --git a/doc/salome/gui/VISU/images/exportmedfile.png b/doc/salome/gui/VISU/images/exportmedfile.png deleted file mode 100644 index c2fc56fd..00000000 Binary files a/doc/salome/gui/VISU/images/exportmedfile.png and /dev/null differ diff --git a/doc/salome/gui/VISU/images/scalarbarproperties.png b/doc/salome/gui/VISU/images/scalarbarproperties.png index b60ed898..318497db 100644 Binary files a/doc/salome/gui/VISU/images/scalarbarproperties.png and b/doc/salome/gui/VISU/images/scalarbarproperties.png differ diff --git a/doc/salome/gui/VISU/images/table.png b/doc/salome/gui/VISU/images/table.png deleted file mode 100644 index 473aeff1..00000000 Binary files a/doc/salome/gui/VISU/images/table.png and /dev/null differ diff --git a/doc/salome/gui/VISU/images/table3d.png b/doc/salome/gui/VISU/images/table3d.png deleted file mode 100644 index 1b199906..00000000 Binary files a/doc/salome/gui/VISU/images/table3d.png and /dev/null differ diff --git a/doc/salome/gui/VISU/images/tablesn1.png b/doc/salome/gui/VISU/images/tablesn1.png deleted file mode 100644 index 4db643e3..00000000 Binary files a/doc/salome/gui/VISU/images/tablesn1.png and /dev/null differ diff --git a/doc/salome/gui/VISU/images/tablesn2.png b/doc/salome/gui/VISU/images/tablesn2.png deleted file mode 100644 index 4b3b85d1..00000000 Binary files a/doc/salome/gui/VISU/images/tablesn2.png and /dev/null differ diff --git a/doc/salome/gui/VISU/input/a3d_presentations.doc b/doc/salome/gui/VISU/input/a3d_presentations.doc index 852bb5a3..0c944e43 100644 --- a/doc/salome/gui/VISU/input/a3d_presentations.doc +++ b/doc/salome/gui/VISU/input/a3d_presentations.doc @@ -29,6 +29,7 @@
  • \ref segmentation_page
  • \ref recording_in_gauss_viewer_page
  • +
  • \ref values_labeling_page
  • \subpage viewing_3d_presentations_page
    • diff --git a/doc/salome/gui/VISU/input/field_presentations.doc b/doc/salome/gui/VISU/input/field_presentations.doc index a60c43cb..1987b13a 100644 --- a/doc/salome/gui/VISU/input/field_presentations.doc +++ b/doc/salome/gui/VISU/input/field_presentations.doc @@ -26,6 +26,7 @@
    • \ref segmentation_page
    • \ref recording_in_gauss_viewer_page
    +
  • \subpage values_labeling_page
  • */ \ No newline at end of file diff --git a/doc/salome/gui/VISU/input/index.doc b/doc/salome/gui/VISU/input/index.doc index 402f3a69..8ca330b5 100644 --- a/doc/salome/gui/VISU/input/index.doc +++ b/doc/salome/gui/VISU/input/index.doc @@ -35,6 +35,7 @@
  • \ref segmentation_page
  • \ref recording_in_gauss_viewer_page
  • +
  • \ref values_labeling_page
  • \ref viewing_3d_presentations_page
    • diff --git a/doc/salome/gui/VISU/input/scalar_map.doc b/doc/salome/gui/VISU/input/scalar_map.doc index 1f92cc3c..e99ab907 100644 --- a/doc/salome/gui/VISU/input/scalar_map.doc +++ b/doc/salome/gui/VISU/input/scalar_map.doc @@ -91,7 +91,7 @@ orientation of the scalar bar.
    • Origin: you can enter X & Y coordinates of the origin of the scalar bar.
    • Dimensions: you can enter \b Width and \b Height of the -scalar bar.
    • +scalar bar specified in % of the size of view.
    • Text properties button allows you to define from the following dialog box: @@ -110,11 +110,11 @@ following dialog box: \image html barproperty.png
        -
      • Relative \b width and \b height of \b Title (in percents),
      • -
      • Relative \b width and \b height of \b Labels (in percents),
      • -
      • Relative \b width and \b height of \b Bar (in percents),
      • +
      • Relative \b size of \b Title (in percents of the width of scalar bar widget),
      • +
      • Relative \b size of \b Labels (in percents of the width of scalar bar widget),
      • +
      • Relative \b width and \b height of \b Bar (in percents of the width and height of scalar bar widget),
      • Visibility of \b Units in \b Title,
      • -
      • Format of \b Labels.
      • +
      • Precision of \b Labels which specifies the number of characters to be printed, the number of decimal places, or the number of significant digits
    diff --git a/doc/salome/gui/VISU/input/table_3d.doc b/doc/salome/gui/VISU/input/table_3d.doc deleted file mode 100644 index 15a36d2e..00000000 --- a/doc/salome/gui/VISU/input/table_3d.doc +++ /dev/null @@ -1,49 +0,0 @@ -/*! - -\page table_3d_page Table 3D presentation - -\n Table 3D is a 3D graphic presentation of data contained in the table. -The relief and coloring of the resulting -presentation both correspond to the values contained in the table. The values from the first column of the -table define X-axis. The values from the second to the last columns define Z-axis. Y increases with a fixed step starting from Y=0. -To successfully produce a Table 3D presentation, the table should not contain empty fields. - -To create a Table 3D presentation: -\par -– Right-click on an XLS table in the -Object browser and from the context menu choose Show, or Show only - -\image html table.png - -The table will be immediately displayed in the Viewer. - -Choose Edit in the context menu if you wish to change the layout of the presentation. - -\image html table3d.png - -\par -
      -
    • Scale Factor - visualization scaling of all values of the table.
    • -
    • Presentation type:
    • -
        -
      • \b Surface - Plot 3D will be represented with a smooth surface.
      • - -\image html tablesn2.png - -
      • \b Contour - Plot 3D will be represented with a set of contours.
      • - -\image html tablesn1.png - -
      -
    • Number of contours - allows to define the number of -contours (active when Contour presentation type is selected).
    • -
    • Scalar Bar tab allows to define the parameters of the scalar -bar displayed with this presentation (\ref scalar_map_page "see also").
    • -
    - -It is also possible to choose \b Wireframe or \b Shading \b Representation type, change -such properties as \b Opacity and Line Width and Translate presentation from the context menu. - - - -*/ \ No newline at end of file diff --git a/doc/salome/gui/VISU/pics/smds1.png b/doc/salome/gui/VISU/pics/smds1.png index f74008d4..24c5feda 100755 Binary files a/doc/salome/gui/VISU/pics/smds1.png and b/doc/salome/gui/VISU/pics/smds1.png differ diff --git a/doc/salome/gui/VISU/visugenidl_doc/VISU__Gen_8idl.html b/doc/salome/gui/VISU/visugenidl_doc/VISU__Gen_8idl.html index 25789b67..5d34130d 100644 --- a/doc/salome/gui/VISU/visugenidl_doc/VISU__Gen_8idl.html +++ b/doc/salome/gui/VISU/visugenidl_doc/VISU__Gen_8idl.html @@ -74,7 +74,7 @@ Include dependency graph for VISU_Gen.idl:

     Deformed shape presentation interface. More...
    interface  VISU.ScalarMapOnDeformedShape - Deformed shape and Scalar Map presentation interface. More...
    + Scalar Map on Deformed shape presentation interface. More...
    interface  VISU.Plot3D  Plot3D interface. More...
    diff --git a/doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMapOnDeformedShape.html b/doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMapOnDeformedShape.html index 79095052..878345b4 100644 --- a/doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMapOnDeformedShape.html +++ b/doc/salome/gui/VISU/visugenidl_doc/interfaceVISU_1_1ScalarMapOnDeformedShape.html @@ -14,7 +14,7 @@ -

    VISU.ScalarMapOnDeformedShape Interface Reference

    Deformed shape and Scalar Map presentation interface. +

    VISU.ScalarMapOnDeformedShape Interface Reference

    Scalar Map on Deformed shape presentation interface. More...

    import "VISU_Gen.idl"; diff --git a/doc/salome/gui/VISU/visugenidl_doc/namespaceVISU.html b/doc/salome/gui/VISU/visugenidl_doc/namespaceVISU.html index 8de0ca8a..9543044b 100644 --- a/doc/salome/gui/VISU/visugenidl_doc/namespaceVISU.html +++ b/doc/salome/gui/VISU/visugenidl_doc/namespaceVISU.html @@ -60,7 +60,7 @@  Deformed shape presentation interface. More...
    interface  ScalarMapOnDeformedShape - Deformed shape and Scalar Map presentation interface. More...
    + Scalar Map on Deformed shape presentation interface. More...
    interface  Plot3D  Plot3D interface. More...
    diff --git a/doc/salome/gui/VISU/whdata/whftdata0.htm b/doc/salome/gui/VISU/whdata/whftdata0.htm index 5acacd5e..eae6a624 100755 --- a/doc/salome/gui/VISU/whdata/whftdata0.htm +++ b/doc/salome/gui/VISU/whdata/whftdata0.htm @@ -49,7 +49,7 @@ aTE("Plot2D Viewer","plot2d_viewer.htm"); aTE("Plot 3D presentation","plot_3d_presentation.htm"); aTE("Primitive Types","primitive_types.htm"); aTE("Scalar Bar","scalar_bar.htm"); -aTE("Deformed Shape and Scalar Map presentation","scalar_map_on_deformed_shape_presentation.htm"); +aTE("Scalar Map on Deformed Shape presentation","scalar_map_on_deformed_shape_presentation.htm"); aTE("Segmentation","segmentation.htm"); aTE("Types of Gauss Points Presentations","types_of_gauss_points_presentations.htm"); aTE("VTK 3D Viewer","vtk_3d_viewer.htm"); diff --git a/doc/salome/gui/VISU/whdata/whtdata0.htm b/doc/salome/gui/VISU/whdata/whtdata0.htm index 67da6bc2..fe3b5c79 100755 --- a/doc/salome/gui/VISU/whdata/whtdata0.htm +++ b/doc/salome/gui/VISU/whdata/whtdata0.htm @@ -24,7 +24,7 @@ aTE(2,0,"Deformed Shape presentation","files/deformed_shape_presentation.htm"); aTE(2,0,"Vectors Presentation","files/vectors_presentation.htm"); aTE(2,0,"Stream Lines presentation","files/stream_lines_presentation.htm"); - aTE(2,0,"Deformed Shape and Scalar Map presentation","scalar_map_on_deformed_shape_presentation.htm"); + aTE(2,0,"Scalar Map on Deformed Shape presentation","scalar_map_on_deformed_shape_presentation.htm"); aTE(2,0,"Plot 3D presentation","plot_3d_presentation.htm"); aTE(2,0,"Animating presentations","files/animating_presentations.htm"); aTE(1,9,"Gauss Points Presentations"); diff --git a/doc/salome/gui/VISU/whgdata/whlstt3.htm b/doc/salome/gui/VISU/whgdata/whlstt3.htm index 56224cc4..d960e94d 100755 --- a/doc/salome/gui/VISU/whgdata/whlstt3.htm +++ b/doc/salome/gui/VISU/whgdata/whlstt3.htm @@ -53,7 +53,7 @@ img {vertial-align:middle;}           Deformed Shape presentation
              Vectors Presentation
              Stream Lines presentation
    -          Deformed Shape and Scalar Map presentation
    +          Scalar Map on Deformed Shape presentation
              Plot 3D presentation
              Animating presentations
              Gauss Points Presentations
    diff --git a/doc/salome/gui/VISU/whgdata/whlstt4.htm b/doc/salome/gui/VISU/whgdata/whlstt4.htm index 49593c24..253afb61 100755 --- a/doc/salome/gui/VISU/whgdata/whlstt4.htm +++ b/doc/salome/gui/VISU/whgdata/whlstt4.htm @@ -53,7 +53,7 @@ img {vertial-align:middle;}           Deformed Shape presentation
              Vectors Presentation
              Stream Lines presentation
    -          Deformed Shape and Scalar Map presentation
    +          Scalar Map on Deformed Shape presentation
              Plot 3D presentation
              Animating presentations
              Gauss Points Presentations
    diff --git a/doc/salome/gui/VISU/whxdata/whftdata0.xml b/doc/salome/gui/VISU/whxdata/whftdata0.xml index 37c3d337..18b3f31d 100755 --- a/doc/salome/gui/VISU/whxdata/whftdata0.xml +++ b/doc/salome/gui/VISU/whxdata/whftdata0.xml @@ -37,7 +37,7 @@ - + diff --git a/doc/salome/gui/VISU/whxdata/whtdata0.xml b/doc/salome/gui/VISU/whxdata/whtdata0.xml index 13b3a715..14a0dff2 100755 --- a/doc/salome/gui/VISU/whxdata/whtdata0.xml +++ b/doc/salome/gui/VISU/whxdata/whtdata0.xml @@ -16,7 +16,7 @@ - + diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 0f139546..2c7beb8e 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -22,36 +22,20 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -EXTRA_DIST+=VISU +EXTRA_DIST += images static -dev_docs: - cp -fr $(srcdir)/VISU ./INPUT; \ - cp -f ./VISU/doxyfile ./INPUT; \ - cd INPUT; \ - sed 's|../../../share/salome|$(top_srcdir)|' ./doxyfile > ./doxyfile1; \ - sed 's|../../build/salome|$(top_builddir)|' ./doxyfile1 > ./doxyfile2; \ - mv -f doxyfile2 doxyfile1; \ - echo "DOXYGEN SUPPORT PYTHON - @DOXYGEN_WITH_PYTHON@"; \ - if( test "x@DOXYGEN_WITH_PYTHON@" = "xyes"); then \ - sed 's|python_extension_must_be_here|*.py|' ./doxyfile1 > ./doxyfile2; \ - mv -f doxyfile2 doxyfile1; \ - $(DOXYGEN) -u ./doxyfile1; \ - else \ - sed 's|python_extension_must_be_here||' ./doxyfile1 > ./doxyfile2; \ - mv -f doxyfile2 doxyfile1; \ - fi; \ - if( test "x@DOXYGEN_WITH_STL@" = "xyes"); then \ - sed -e 's|BUILTIN_STL_SUPPORT = NO|BUILTIN_STL_SUPPORT = YES|' ./doxyfile1 > ./doxyfile2; \ - mv -f doxyfile2 doxyfile1; \ - fi; \ - mv -f doxyfile1 doxyfile; \ - echo "Running doxygen in directory:"`pwd`; \ - $(DOXYGEN) ./doxyfile; \ - cd ../; \ - cp -fr $(srcdir)/VISU/sources/ VISU ; \ - rm -fr INPUT +dev_docs: doxyfile + echo "Running doxygen in directory: "`pwd`; \ + $(DOXYGEN) $<; -doctuidir=$(docdir)/tui/VISU +clean-local: + -rm -fr VISU doxygen.bak -nodist_doctui_DATA= VISU/doxyfile -EXTRA_DIST+= VISU/doxyfile.in +install-data-local: + if test -d VISU; then \ + $(INSTALL) -d $(DESTDIR)$(docdir)/tui ; \ + cp -rp VISU $(DESTDIR)$(docdir)/tui ; \ + fi; + +uninstall-local: + rm -rf $(DESTDIR)$(docdir)/tui/VISU diff --git a/idl/Makefile.am b/idl/Makefile.am index 538f127b..cddec231 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,25 +26,23 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -BASEIDL_FILES= VISU_Gen.idl - -EXTRA_DIST+= $(BASEIDL_FILES) +BASEIDL_FILES = VISU_Gen.idl # This variable defines the files to be installed -salomeidl_DATA = $(BASEIDL_FILES) +dist_salomeidl_DATA = $(BASEIDL_FILES) # VISU idl common library lib_LTLIBRARIES = libSalomeIDLVISU.la # Sources built from idl files -nodist_libSalomeIDLVISU_la_SOURCES= VISU_GenSK.cc +nodist_libSalomeIDLVISU_la_SOURCES = VISU_GenSK.cc # header files must be exported: other modules have to use this library -nodist_salomeinclude_HEADERS= $(BASEIDL_FILES:%.idl=%.hh) +nodist_salomeinclude_HEADERS = $(BASEIDL_FILES:%.idl=%.hh) -libSalomeIDLVISU_la_CPPFLAGS =\ - -I$(top_builddir)/salome_adm/unix \ - -I$(top_builddir)/idl \ +libSalomeIDLVISU_la_CPPFLAGS = \ + -I$(top_builddir)/salome_adm/unix \ + -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @KERNEL_CXXFLAGS@ @MED_CXXFLAGS@ libSalomeIDLVISU_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeIDLVISU_la_LIBADD = @CORBA_LIBS@ $(MED_LDFLAGS) -lSalomeIDLMED @@ -64,14 +62,14 @@ SUFFIXES = .idl .hh SK.cc $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< install-exec-local: $(BASEIDL_FILES:%=$(top_srcdir)/idl/%) - $(INSTALL) -d $(pkgpythondir) + $(INSTALL) -d $(DESTDIR)$(salomepythondir) ls $^ | while read file; do \ - $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(pkgpythondir) $$file ; \ + $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ done # uninstall-local removes too much, but it works in distcheck uninstall-local: - rm -rf $(pkgpythondir)/* + rm -rf $(DESTDIR)$(salomepythondir)/* mostlyclean-local: clean-idls diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index a0484262..a6357f39 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -106,6 +106,18 @@ module VISU { TALL }; + /* Clipping planes management */ + struct ClippingPlane { + double X; + double Y; + double Z; + double dX; + double dY; + double dZ; + boolean isAuto; + string name; + }; + interface Base { /*! * Returns ID of the object. @@ -295,6 +307,7 @@ module VISU { SHADED, INSIDEFRAME, SURFACEFRAME, + FEATURE_EDGES, SHRINK }; @@ -349,6 +362,17 @@ module VISU { * \return The type of representation of the mesh. */ PresentationType GetPresentationType(); + + /*! + * Switches shrink mode of presentation + * Note: SetPresentationType(SHRINK) is same as SetShrink(True) + */ + void SetShrink(in boolean toShrink); + + /*! + * Returns current state of shrink mode + */ + boolean IsShrank(); }; @@ -508,6 +532,32 @@ module VISU { */ long GetScalarMode(); + /*! + * Set the visibility of a distribution curve. + * \param theIs is used to switch on/off the visibility of a distribution curve. + */ + void SetIsDistributionVisible(in boolean theIs); + + //! Gets current visibility of a distribution curve + boolean GetIsDistributionVisible(); + + //! Gets current filtering by scalars mode + boolean IsScalarFilterUsed(); + + void UseScalarFiltering( in boolean theUseScalarFilter ); + + /*! + * Sets scalar range - min and max boundaries of the scalar bar. + * \param theMin Min boundary of the scalar bar. + * \param theMax Max boundary of the scalar bar. + * \param theIsFilter if true then filter by scalars. + */ + void SetScalarFilterRange( in double theMin, in double theMax ); + + double GetScalarFilterMin(); + + double GetScalarFilterMax(); + /*! * Add group as geometry of presentation. * \param theMeshName - mesh name @@ -672,6 +722,16 @@ module VISU { interface ScalarMap : ColoredPrs3d, ScaledPrs3d { + /*! + * Returns visibility state of scalar bar + */ + boolean IsBarVisible(); + + /*! + * Sets visibility state of scalar bar + */ + void SetBarVisible(in boolean theVisible); + }; //------------------------------------------------------- @@ -2209,6 +2269,37 @@ module VISU { * Get or create %ColoredPrs3dCache object. */ ColoredPrs3dCache GetColoredPrs3dCache(in SALOMEDS::Study theStudy); + + + /* Clipping planes management */ + + /*Create a clipping plane and return its ID (position in corresponded array) + Id of clipping plane could be changed after deletion of other clipping plane + */ + long CreateClippingPlane(in double X, in double Y, in double Z, + in double dX, in double dY, in double dZ, + in boolean auto, in string name); + + void EditClippingPlane(in long id, in double X, in double Y, in double Z, + in double dX, in double dY, in double dZ, + in boolean auto, in string name); + + /* Returns clipping plane by its Id */ + ClippingPlane GetClippingPlane(in long id); + + /* Deletes clipping plane by its Id */ + boolean DeleteClippingPlane(in long id); + + /* Applyes a clipping plane with Id to presentation thePrs */ + boolean ApplyClippingPlane(in Prs3d thePrs, in long id); + + /* Detaches a clipping plane with Id from presentation thePrs */ + boolean DetachClippingPlane(in Prs3d thePrs, in long id); + + + /* Get number of clipping planes */ + long GetClippingPlanesNb(); + }; /*! \brief %View interface @@ -2217,8 +2308,8 @@ module VISU { * the following types: 3d, Table, XY plot. * %View interface is a base for all types of %view interfaces. */ - interface View: Base { - + interface View: Base, SALOME::GenericObj + { /*! \brief %ViewRepresentation enumeration * * displaying part ("ALL" isn't setable) @@ -2741,6 +2832,8 @@ module VISU { */ void Destroy(in View theView); }; + + }; #endif diff --git a/resources/Makefile.am b/resources/Makefile.am index 148851d3..db62fb16 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -27,14 +27,18 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # =============================================================== # -dist_salomeres_DATA= \ +dist_salomeres_DATA = \ ModuleVisu.png \ SalomeApp.xml \ sprite_alpha.bmp \ sprite_texture.bmp \ Vertex_Program_ARB.txt \ +Visu_actor_selection.png \ Visu_add.png \ +Visu_apply.png \ Visu_anim.png \ +Visu_cell_selection.png \ +Visu_close.png \ VISU.config \ Visu_cutlines.png \ Visu_cutplanes.png \ @@ -43,14 +47,18 @@ Visu_deformed.png \ VISU_en.xml \ Visu_eraseall.png \ VISU_fr.xml \ +Visu_gauss_point_selection.png \ Visu_gauss_points.png \ Visu_graduated_axes.png \ +Visu_help.png \ Visu_import_med.png \ Visu_isosurfaces.png \ Visu_load_texture.png \ +Visu_ok.png \ Visu_PlaneSegmentation.png \ Visu_plot2d.png \ Visu_plot3d.png \ +Visu_point_selection.png \ Visu_points.png \ Visu_recording_pause.png \ Visu_recording_play.png \ @@ -63,6 +71,9 @@ Visu_scalars_anim.png \ Visu_scalars.png \ Visu_scaling.png \ Visu_selectall.png \ +Visu_selection_panel.png \ +Visu_slider_panel.png \ +Visu_sweep_panel.png \ Visu_selectionactor.png \ Visu_selectioncell.png \ Visu_selectionedge.png \ @@ -110,7 +121,10 @@ Visu_slider_previous.png \ Visu_slider_play.png \ Visu_slider_pause.png \ Visu_slider_next.png \ -Visu_slider_last.png +Visu_holo_render.png \ +Visu_slider_last.png \ +Visu_DeactivatePlane.png \ +Visu_planemanager.png -EXTRA_DIST+= VISUCatalog.xml.in -nodist_salomeres_DATA=VISUCatalog.xml +# VSR: little trick to avoid putting if VISUCatalog.xml to the distribution archive +nodist_salomeres_SCRIPTS = VISUCatalog.xml diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index dfd869d5..af06b9dd 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -27,31 +27,41 @@ - - - + + + + + + + + + - - - - + + - - + + + + + + + + - + - - + + - + @@ -119,8 +129,10 @@ + - + + @@ -135,6 +147,8 @@ + +

    diff --git a/resources/Visu_cutplane.png b/resources/Visu_cutplane.png new file mode 100644 index 00000000..5e92cf65 Binary files /dev/null and b/resources/Visu_cutplane.png differ diff --git a/src/CONVERTOR/Makefile.am b/src/CONVERTOR/Makefile.am index 3953664f..b6ddf017 100644 --- a/src/CONVERTOR/Makefile.am +++ b/src/CONVERTOR/Makefile.am @@ -41,6 +41,7 @@ salomeinclude_HEADERS= \ VISU_Convertor_impl.hxx \ VISU_ConvertorUtils.hxx \ VISU_MergeFilter.hxx \ + VISU_MergeFilterUtilities.hxx \ VISU_AppendFilter.hxx \ VISU_AppendPolyData.hxx \ VISU_AppendFilterUtilities.hxx \ @@ -48,6 +49,7 @@ salomeinclude_HEADERS= \ VISU_UsedPointsFilter.hxx \ VISU_CommonCellsFilter.hxx \ VISUConvertor.hxx \ + VISU_MedConvertor.hxx \ VISU_GaussMergeFilter.hxx \ VISU_TableReader.hxx diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index e35b3626..53911e28 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -353,11 +353,18 @@ namespace const VISU::PMeshOnEntityImpl& theMeshOnEntity, const VISU::PProfileImpl& theProfile) { + // rnv fix for issue 19999: + // Throw exception in case if mesh on entity from profile is not equal + // input mesh on entity. This exception catch in tne VISU_Convertor_impl::GetTimeStampOnMesh + // function. + if(theProfile->myMeshOnEntity && theProfile->myMeshOnEntity != theMeshOnEntity.get()) + EXCEPTION(std::runtime_error,"GetMeshOnProfile >> theProfile->myMeshOnEntity != theMeshOnEntity.get()"); + if(theProfile->myIsVTKDone) return true; - if(theProfile->myMeshOnEntity && theProfile->myMeshOnEntity != theMeshOnEntity.get()) - return false; + // if(theProfile->myMeshOnEntity && theProfile->myMeshOnEntity != theMeshOnEntity.get()) + // return false; VISU::TTimerLog aTimerLog(MYDEBUG,"GetMeshOnProfile"); INITMSG(MYDEBUG,"GetMeshOnProfile - anEntity = "<myEntity< - - -/*! - \file VISU_ElnoMeshValue.hxx - \brief The file contains declarations for the acess to the specific ELNO MED data -*/ - -namespace VISU -{ - //--------------------------------------------------------------- - template< int elno_type > - struct TGetElnoNodeData - { - typedef typename TL::TEnum2VTKArrayType< elno_type >::TResult TVTKDataArray; - typedef typename TL::TEnum2VTKBasicType< elno_type >::TResult TDataType; - TVTKDataArray *myElnoDataArray; - vtkIntArray *myElnoDataMapper; - int myElemInfo[3]; - - - //---------------------------------------------------------------------------- - TGetElnoNodeData( vtkDataArray *theElnoDataArray, - vtkDataArray *theElnoDataMapper ) - : myElnoDataArray( TVTKDataArray::SafeDownCast( theElnoDataArray ) ) - , myElnoDataMapper( vtkIntArray::SafeDownCast( theElnoDataMapper ) ) - {} - - - //---------------------------------------------------------------------------- - TDataType* - operator () ( vtkIdType theCellId, vtkIdType theLocalPntId ) - { - myElnoDataMapper->GetTupleValue( theCellId, myElemInfo ); - - vtkIdType aPos = myElemInfo[ 0 ] + theLocalPntId * myElemInfo[ 1 ]; - - return myElnoDataArray->GetPointer( aPos ); - } - - - //---------------------------------------------------------------------------- - int - getNbComp() - { - myElnoDataMapper->GetTupleValue( 0, myElemInfo ); - - return myElemInfo[ 1 ]; - } - }; - - - //---------------------------------------------------------------------------------------------- - template< int elno_type > - struct TSetElnoNodeData - { - typedef typename TL::TEnum2VTKArrayType< elno_type >::TResult TVTKDataArray; - typedef typename TL::TEnum2VTKBasicType< elno_type >::TResult TDataType; - - //---------------------------------------------------------------------------------------------- - TSetElnoNodeData( vtkIdType theEffectNbComp, - vtkIdType theRealNbComp, - vtkIdType theNbTuples, - const char* theDataArrayName, - const char* theMapperArrayName ) - : myElnoDataArray( TVTKDataArray::New() ) - , myElnoDataMapper( vtkIntArray::New() ) - { - myElnoDataArray->SetNumberOfComponents( theEffectNbComp ); - myElnoDataArray->SetNumberOfTuples( theNbTuples ); - myElnoDataArray->SetName( theDataArrayName ); - - myElnoDataMapper->SetNumberOfComponents( 3 ); - myElnoDataMapper->Allocate( theNbTuples * 3 ); - myElnoDataMapper->SetName( theMapperArrayName ); - - myElemInfo[ 0 ] = 0; - myElemInfo[ 1 ] = theRealNbComp; - myElemInfo[ 2 ] = 0; - } - - - //---------------------------------------------------------------------------------------------- - ~TSetElnoNodeData() - { - myElnoDataArray->Delete(); - myElnoDataMapper->Delete(); - } - - - //---------------------------------------------------------------------------------------------- - int - AddNextPointData( TDataType* theDataPtr ) - { - vtkIdType aPos = myElemInfo[ 0 ] + myElemInfo[ 2 ] * myElemInfo[ 1 ]; - - TDataType* aDataPtr = myElnoDataArray->GetPointer( aPos ); - - for ( vtkIdType aCompId = 0; aCompId < myElemInfo[ 1 ]; aCompId++ ) - *aDataPtr++ = *theDataPtr++; - - return myElemInfo[ 2 ]++; - } - - - //---------------------------------------------------------------------------------------------- - void - InsertNextCellData() - { - myElnoDataMapper->InsertNextTupleValue( myElemInfo ); - myElemInfo[ 0 ] += myElemInfo[ 2 ] * myElemInfo[ 1 ]; - myElemInfo[ 2 ] = 0; - } - - - //---------------------------------------------------------------------------------------------- - void - AddData( vtkDataSetAttributes* theDataSetAttributes ) - { - theDataSetAttributes->AddArray( myElnoDataArray ); - theDataSetAttributes->AddArray( myElnoDataMapper ); - } - - protected: - TVTKDataArray *myElnoDataArray; - vtkIntArray *myElnoDataMapper; - int myElemInfo[ 3 ]; - }; - - - //--------------------------------------------------------------- -} - -#endif diff --git a/src/CONVERTOR/VISU_TableReader.cxx b/src/CONVERTOR/VISU_TableReader.cxx deleted file mode 100644 index 33676e26..00000000 --- a/src/CONVERTOR/VISU_TableReader.cxx +++ /dev/null @@ -1,401 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File: -// Author: -// Module : VISU - -#include "VISU_TableReader.hxx" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - - -//--------------------------------------------------------------- -int -VISU::TTable2D -::Check() -{ - if ( myRows.empty() ) - return 0; - - int iEnd = myRows[0].myValues.size(); - if ( iEnd == 0 ) - return 0; - - if ( myColumnTitles.size() != iEnd ) - myColumnTitles.resize( iEnd ); - - if ( myColumnUnits.size() != iEnd ) - myColumnUnits.resize( iEnd ); - - int jEnd = myRows.size(); - for ( int j = 0; j < jEnd; j++ ) - if ( myRows[j].myValues.size() != iEnd ) - return 0; - - return 1; -} - - -//--------------------------------------------------------------- -void -VISU::TTable2D -::getColumns(VISU::TTable2D& theTable2D) const -{ - TRows& aRows = theTable2D.myRows; - aRows.clear(); - if ( myRows.empty() ) - return; - - int jEnd = myRows.size(); - - //Define Titles & Units - theTable2D.myColumnTitles.resize(jEnd); - theTable2D.myColumnUnits.resize(jEnd); - for ( int j = 0; j < jEnd; j++ ) { - theTable2D.myColumnTitles[j] = myRows[j].myTitle; - theTable2D.myColumnUnits[j] = myRows[j].myUnit; - } - - //Define Rows - int iEnd = myRows[0].myValues.size(); - for ( int i = 0; i < iEnd; i++ ) { - TRow aNewRow; - aNewRow.myTitle = myColumnTitles[i]; - aNewRow.myUnit = myColumnUnits[i]; - aNewRow.myValues.resize(jEnd); - for ( int j = 0; j < jEnd; j++ ) { - aNewRow.myValues[j] = myRows[j].myValues[i]; - } - aRows.push_back(aNewRow); - } -} - - -//--------------------------------------------------------------- -namespace -{ - int getLine( std::ifstream& theStmIn, QString& theString ) - { - char tmp; - std::ostrstream aStrOut; - - while ( theStmIn.get( tmp ) ) { - aStrOut<= 0 ) { - data = aTmp.left( index ).trimmed(); - cmt = aTmp.mid( index+1 ).trimmed(); - } - // if comment is not empty, try to get keyword from it (separated by ':' symbol) - if ( !cmt.isEmpty() ) { - int index1 = cmt.indexOf( ":" ); - if ( index1 >= 0 ) { - QString tmpstr = cmt.left( index1 ).trimmed(); - if ( tmpstr == QString( "TITLE" ) || - tmpstr == QString( "COLUMN_TITLES" ) || - tmpstr == QString( "COLUMN_UNITS" ) || - tmpstr == QString( "COMMENT" ) ) { - keyword = tmpstr; - cmt = cmt.mid( index1+1 ).trimmed(); - } - } - } - // if data is empty, process only comment - if ( data.isEmpty() ) { - // if keyword is found, try to process it - // elsewise it is a simple comment, just ignore it - if ( !keyword.isEmpty() ) { - if ( keyword == QString( "TITLE" ) ) { - QString title = cmt; - if ( aTable2D.myTitle != "" ) - title = QString( aTable2D.myTitle.c_str() ) + QString( " " ) + title; - if(MYDEBUG) std::cout << "...Table TITLE is: " << title.toLatin1().constData() << std::endl; - aTable2D.myTitle = title.toLatin1().constData(); - } - else if ( keyword == QString( "COLUMN_TITLES" ) ) { - // comment may contain column headers - QStringList aStrList = cmt.split( "|", QString::SkipEmptyParts ); - if(MYDEBUG) std::cout << "...Column TITLES are: "; - for ( int i = 0; i < aStrList.count(); i++ ) { - QString tmpstr = aStrList[ i ].trimmed(); - if(MYDEBUG) std::cout << tmpstr.toLatin1().constData() << " "; - aTable2D.myColumnTitles.push_back( tmpstr.toLatin1().constData() ); - } - if(MYDEBUG) std::cout << std::endl; - } - else if ( keyword == QString( "COLUMN_UNITS" ) ) { - // comment may contain column units - QStringList aStrList = cmt.split( " ", QString::SkipEmptyParts ); - if(MYDEBUG) std::cout << "...Column UNITS are: "; - for ( int i = 0; i < aStrList.count(); i++ ) { - QString tmpstr = aStrList[ i ].trimmed(); - if(MYDEBUG) std::cout << tmpstr.toLatin1().constData() << " "; - aTable2D.myColumnUnits.push_back( tmpstr.toLatin1().constData() ); - } - if(MYDEBUG) std::cout << std::endl; - } - else if ( keyword == QString( "COMMENT" ) ) { - // keyword 'COMMENT' processing can be here - // currently it is ignored - if(MYDEBUG) std::cout << "...COMMENT: " << cmt.toLatin1().constData() << std::endl; - } - } - else { - if(MYDEBUG) std::cout << "...comment: " << cmt.toLatin1().constData() << std::endl; - // simple comment processing can be here - // currently it is ignored - } - } - // if data is not empty, try to process it - else { - TTable2D::TRow aRow; - if(MYDEBUG) std::cout << "...New row is found: " << std::endl; - if ( !cmt.isEmpty() ) { - aRow.myTitle = cmt.toLatin1().constData(); - if(MYDEBUG) std::cout << "......ROW TITLE is: " << cmt.toLatin1().constData() << std::endl; - } - QString datar1 = data.replace(QRegExp("\t"), " "); - QStringList aValList = datar1.split( " ", QString::SkipEmptyParts ); - for ( int i = 0; i < aValList.count(); i++ ) { - if ( aValList[i].trimmed() != "" ) { - TTable2D::TValue aVal = aValList[i].trimmed().toLatin1().constData(); - aRow.myValues.push_back( aVal ); - } - } - if( aRow.myValues.size() > 0 ) - aTable2D.myRows.push_back( aRow ); - // ************** OLD CODE ****************** - /* - TValue aVal; - istrstream aStream( data ); - aStream.precision( STRPRECISION ); - while( aStream >> aVal ) { - aRow.myValues.push_back( aVal ); - } - if( aRow.myValues.size() > 0 ) - aTable2D.myRows.push_back( aRow ); - */ - // ************** OLD CODE ****************** - } - ::getLine( aStmIn, aTmp ); - } - if( aTable2D.Check() ) { - if(MYDEBUG) std::cout << "aTable2D is checked OK " << aTable2D.myTitle << std::endl; - theContainer.push_back( aTableIDMapper ); - } - } while ( !aStmIn.eof() ); - aStmIn.close(); - - if(MYDEBUG) std::cout << "After close" << std::endl; -} - - -//--------------------------------------------------------------- -VISU::TTableIDMapper -::TTableIDMapper(): - myOutput( vtkPolyData::New() ), - myXAxisPosition( -1 ) -{} - -VISU::TTableIDMapper -::~TTableIDMapper() -{ - myOutput->Delete(); -} - -vtkPolyData* -VISU::TTableIDMapper -::GetPolyDataOutput() -{ - if ( myXAxisPosition == -1 ) - SetXAxisPosition( 0 ); - - return myOutput; -} - -long unsigned int -VISU::TTableIDMapper -::GetMemorySize() -{ - return myOutput->GetActualMemorySize() * 1024; -} - -void -VISU::TTableIDMapper -::SetXAxisPosition( vtkIdType theAxisPosition ) -{ - if ( myXAxisPosition == theAxisPosition || !Check() ) - return; - - myOutput->Initialize(); - - if ( !Check() ) - return; - - TTable2D aTable2D; - getColumns( aTable2D ); - - vtkIdType aXSize = aTable2D.myRows[0].myValues.size(); - - // It is necessary to decrease the size at 1 take intoa account X axis - vtkIdType anYSize = aTable2D.myRows.size() - 1; - - vtkIdType aNbPoints = aXSize * anYSize; - - std::vector anXAxis(aXSize); - const TTable2D::TValues& aValues = aTable2D.myRows[theAxisPosition].myValues; - for ( vtkIdType aX = 0; aX < aXSize; aX++ ) - anXAxis[aX] = atof( aValues[aX].c_str() ); - - double aXRange = anXAxis[aXSize - 1] - anXAxis[0]; - double anYDelta = aXRange / anYSize; - std::vector anYAxis(anYSize); - for ( vtkIdType anY = 0; anY < anYSize; anY++ ) - anYAxis[anY] = anY * anYDelta; - - vtkPoints* aPoints = vtkPoints::New(); - aPoints->SetNumberOfPoints( aNbPoints ); - - vtkIntArray *aPointsIDMapper = vtkIntArray::New(); - aPointsIDMapper->SetName("VISU_POINTS_MAPPER"); - aPointsIDMapper->SetNumberOfComponents(2); - aPointsIDMapper->SetNumberOfTuples(aNbPoints); - int *aPointsIDMapperPtr = aPointsIDMapper->GetPointer(0); - - //vtkIntArray *aCellIDMapper = vtkIntArray::New(); - //aCellIDMapper->SetName("VISU_POINTS_MAPPER"); - //aCellIDMapper->SetNumberOfComponents(2); - //aCellIDMapper->SetNumberOfTuples(aNbPoints); - //int *aCellIDMapperPtr = aCellIDMapper->GetPointer(0); - - for ( vtkIdType aY = 0, aPntId = 0; aY < anYSize; aY++ ) { - for ( vtkIdType aX = 0; aX < aXSize; aX++, aPntId++ ) { - aPoints->SetPoint( aPntId, anXAxis[aX], anYAxis[aY], 0.0 ); - - *aPointsIDMapperPtr++ = aPntId; - *aPointsIDMapperPtr++ = 0; - - //*aCellIDMapperPtr++ = aPntId; - //*aCellIDMapperPtr++ = 0; - } - } - - std::vector anYData; - for ( vtkIdType anY = 0; anY < anYSize + 1; anY++ ) { - if ( anY == theAxisPosition ) - continue; - anYData.push_back( aTable2D.myRows[anY].myValues ); - } - - vtkDoubleArray* aScalars = vtkDoubleArray::New(); - aScalars->SetNumberOfComponents( 1 ); - aScalars->SetNumberOfTuples( aNbPoints ); - double *aScalarsPtr = aScalars->GetPointer(0); - for ( vtkIdType anY = 0; anY < anYSize; anY++ ) { - const TTable2D::TValues& aValues = anYData[anY]; - for ( vtkIdType aX = 0; aX < aXSize; aX++ ) { - double aValue = atof( aValues[aX].c_str() ); - *aScalarsPtr++ = aValue; - } - } - - vtkStructuredGrid* aStructuredGrid = vtkStructuredGrid::New(); - aStructuredGrid->SetPoints( aPoints ); - aPoints->Delete(); - - aStructuredGrid->SetDimensions( aXSize, anYSize, 1 ); - - aStructuredGrid->GetPointData()->AddArray( aPointsIDMapper ); - aPointsIDMapper->Delete(); - - //aStructuredGrid->GetCellData()->AddArray( aCellIDMapper ); - //aCellIDMapper->Delete(); - - aStructuredGrid->GetPointData()->SetScalars( aScalars ); - aScalars->Delete(); - - vtkStructuredGridGeometryFilter* aFilter = vtkStructuredGridGeometryFilter::New(); - aFilter->SetInput( aStructuredGrid ); - aFilter->Update(); - myOutput->ShallowCopy( aFilter->GetOutput() ); - aFilter->Delete(); -} diff --git a/src/CONVERTOR/VISU_TableReader.hxx b/src/CONVERTOR/VISU_TableReader.hxx deleted file mode 100644 index 17082a31..00000000 --- a/src/CONVERTOR/VISU_TableReader.hxx +++ /dev/null @@ -1,111 +0,0 @@ -// VISU CONVERTOR : -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_TableReader.hxx -// Author : Alexey PETROV -// Module : VISU - -#ifndef VISU_TableReader_HeaderFile -#define VISU_TableReader_HeaderFile - -/*! - \file VISU_TableReader.hxx - \brief The file contains definition of the Table reading functionlity -*/ - -#include "VISUConvertor.hxx" - -#include "VISU_IDMapper.hxx" - -#include -#include - -namespace VISU -{ - //--------------------------------------------------------------- - struct VISU_CONVERTOR_EXPORT TTable2D - { - typedef std::string TValue; - typedef std::vector TValues; - - struct TRow - { - std::string myTitle; - std::string myUnit; - TValues myValues; - }; - - std::string myTitle; - std::vector myColumnUnits; - std::vector myColumnTitles; - - typedef std::vector TRows; - TRows myRows; - - int - Check(); - - void - getColumns( TTable2D& theTable2D ) const; - }; - - - //--------------------------------------------------------------- - class VISU_CONVERTOR_EXPORT TTableIDMapper: - public virtual TPolyDataIDMapper, - public virtual TTable2D - { - public: - TTableIDMapper(); - ~TTableIDMapper(); - - virtual - vtkPolyData* - GetPolyDataOutput(); - - virtual - long unsigned int - GetMemorySize(); - - void - SetXAxisPosition( vtkIdType theAxisPosition ); - - vtkIdType - GetXAxisPosition(); - - protected: - vtkIdType myXAxisPosition; - vtkPolyData* myOutput; - }; - typedef MED::SharedPtr PTableIDMapper; - - - //--------------------------------------------------------------- - typedef std::vector TTableContainer; - VISU_CONVERTOR_EXPORT - void ImportTables( const char* theFileName, TTableContainer& theContainer ); - - - //--------------------------------------------------------------- -} - -#endif diff --git a/src/CONVERTOR/VISU_VTKTypeList.hxx b/src/CONVERTOR/VISU_VTKTypeList.hxx deleted file mode 100644 index f210f652..00000000 --- a/src/CONVERTOR/VISU_VTKTypeList.hxx +++ /dev/null @@ -1,120 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_VTKTypeList.hxx -// Author : Oleg UVAROV -// Module : VISU - -#ifndef VISU_VTKTypeList_HeaderFile -#define VISU_VTKTypeList_HeaderFile - -#include "VISU_TypeList.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//---------------------------------------------------------------------------- -namespace VISU -{ - //---------------------------------------------------------------------------- - namespace TL - { - //---------------------------------------------------------------------------- - typedef TSequence< char, - unsigned char, - short, - unsigned short, - int, - unsigned int, - long, - unsigned long, - float, - double >::TResult TVTKBasicTypeList; - - - //---------------------------------------------------------------------------- - typedef TSequence< vtkCharArray, - vtkUnsignedCharArray, - vtkShortArray, - vtkUnsignedShortArray, - vtkIntArray, - vtkUnsignedIntArray, - vtkLongArray, - vtkUnsignedLongArray, - vtkFloatArray, - vtkDoubleArray >::TResult TVTKArrayTypeList; - - - //---------------------------------------------------------------------------- - typedef TSequence< TInt2Type< VTK_CHAR >, - TInt2Type< VTK_UNSIGNED_CHAR >, - TInt2Type< VTK_SHORT >, - TInt2Type< VTK_UNSIGNED_SHORT >, - TInt2Type< VTK_INT >, - TInt2Type< VTK_UNSIGNED_INT >, - TInt2Type< VTK_LONG >, - TInt2Type< VTK_UNSIGNED_LONG >, - TInt2Type< VTK_FLOAT >, - TInt2Type< VTK_DOUBLE > >::TResult TVTKBasicEnumList; - - - //---------------------------------------------------------------------------- - template< unsigned int type_enum > - struct TEnum2VTKBasicType - { - typedef typename TTypeAt< TVTKBasicTypeList, TIndexOf< TVTKBasicEnumList, TInt2Type< type_enum > >::value >::TResult TResult; - }; - - - //---------------------------------------------------------------------------- - template< unsigned int type_enum > - struct TEnum2VTKArrayType - { - typedef typename TTypeAt< TVTKArrayTypeList, TIndexOf< TVTKBasicEnumList, TInt2Type< type_enum > >::value >::TResult TResult; - }; - - - //---------------------------------------------------------------------------- - template< class T > - struct TVTKBasicType2Enum - { - typedef typename TTypeAt< TVTKBasicEnumList, TIndexOf< TVTKBasicTypeList, T >::value >::TResult TResult; - }; - - - //---------------------------------------------------------------------------- - } - - - //---------------------------------------------------------------------------- -} - -#endif diff --git a/src/ENGINE/Makefile.am b/src/ENGINE/Makefile.am index 452ba6fe..52f9ad77 100644 --- a/src/ENGINE/Makefile.am +++ b/src/ENGINE/Makefile.am @@ -25,6 +25,9 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am lib_LTLIBRARIES= libVISUEngine.la + +salomeinclude_HEADERS= VISU_Engine_i.hh + dist_libVISUEngine_la_SOURCES= VISU_Engine_i.cc libVISUEngine_la_CPPFLAGS= $(KERNEL_CXXFLAGS) $(MED_CXXFLAGS) $(CORBA_CXXFLAGS) $(CORBA_INCLUDES) \ diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index d857f644..2187cce8 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -470,4 +470,50 @@ namespace VISU{ { return myVisuGen->GetColoredPrs3dCache(theStudy); } + + + + CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name) + { + return myVisuGen->CreateClippingPlane(X, Y, Z, dX, dY, dZ, isAuto, name); + } + + + void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name) + { + myVisuGen->EditClippingPlane(id, X, Y, Z, dX, dY, dZ, isAuto, name); + } + + /* Returns clipping plane by its Id */ + VISU::ClippingPlane* VISU_Gen_i::GetClippingPlane(CORBA::Long id) + { + return myVisuGen->GetClippingPlane(id); + } + + /* Deletes clipping plane by its Id */ + CORBA::Boolean VISU_Gen_i::DeleteClippingPlane(CORBA::Long id) + { + return myVisuGen->DeleteClippingPlane(id); + } + + /* Applyes a clipping plane with Id to presentation thePrs */ + CORBA::Boolean VISU_Gen_i::ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id) + { + return myVisuGen->ApplyClippingPlane(thePrs, id); + } + + CORBA::Boolean VISU_Gen_i::DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id) + { + return myVisuGen->DetachClippingPlane(thePrs, id); + } + + /* Get number of clipping planes */ + CORBA::Long VISU_Gen_i::GetClippingPlanesNb() + { + return myVisuGen->GetClippingPlanesNb(); + } }; diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index 247a1074..df49fb25 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -229,6 +229,31 @@ namespace VISU virtual VISU::ColoredPrs3dCache_ptr GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy); + + + + virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name); + + virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name); + + /* Returns clipping plane by its Id */ + virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id); + + /* Deletes clipping plane by its Id */ + virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id); + + /* Applyes a clipping plane with Id to presentation thePrs */ + virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id); + + /* Detaches a clipping plane with Id from presentation thePrs */ + virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id); + + /* Get number of clipping planes */ + virtual CORBA::Long GetClippingPlanesNb(); }; }; diff --git a/src/OBJECT/Makefile.am b/src/OBJECT/Makefile.am index ff0a1471..9c2ed5df 100644 --- a/src/OBJECT/Makefile.am +++ b/src/OBJECT/Makefile.am @@ -31,8 +31,10 @@ lib_LTLIBRARIES= libVisuObject.la salomeinclude_HEADERS = \ VISU_BoostSignals.h \ VISU_ActorFactory.h \ + VISU_PickingSettings.h \ VISU_GaussPtsSettings.h \ VISU_GaussPtsActorFactory.h \ + VISU_GaussPtsDeviceActor.h \ VISU_Event.h \ VISU_Actor.h \ VISU_DataSetActor.h \ @@ -49,6 +51,7 @@ dist_libVisuObject_la_SOURCES = \ VISU_DataSetActor.cxx \ VISU_MeshAct.cxx \ VISU_ScalarMapAct.cxx \ + VISU_PickingSettings.cxx \ VISU_GaussPtsDeviceActor.cxx \ VISU_GaussPtsSettings.cxx \ VISU_GaussPtsAct.cxx \ diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index f4d26b4e..cb8245af 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -27,7 +27,14 @@ // $Header$ #include "VISU_Actor.h" + +#include "VISU_PickingSettings.h" +#include "VISU_GaussPtsDeviceActor.h" + #include "VISU_PipeLine.hxx" + +#include "SVTK_Event.h" + #include "VTKViewer_ShrinkFilter.h" #include "VTKViewer_GeometryFilter.h" #include "VISU_ActorFactory.h" @@ -52,6 +59,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -59,6 +73,10 @@ #include #include +#include +#include +#include + #include #include "utilities.h" @@ -83,13 +101,21 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- VISU_Actor ::VISU_Actor(): + myEventCallbackCommand(vtkCallbackCommand::New()), + myPriority(0.0), myIsVTKMapping(false), myPrs3d(NULL), myIsShrunk(false), myIsShrinkable(false), myShrinkFilter(VTKViewer_ShrinkFilter::New()), myAnnotationMapper(vtkTextMapper::New()), - myAnnotationActor(vtkTextActor::New()) + myAnnotationActor(vtkTextActor::New()), + myTextActor(VISU_FramedTextActor::New()), + myIsFeatureEdgesAllowed(false), + myIsFeatureEdgesEnabled(false), + myFeatureEdges(vtkFeatureEdges::New()), + myLastSelectionMode(ActorSelection), + myIsSubElementsHighlighted(false) { if(MYDEBUG) MESSAGE("VISU_Actor::VISU_Actor - this = "<Delete(); myAnnotationActor->SetVisibility(0); + + myTextActor->Delete(); + myTextActor->SetVisibility(false); + myTextActor->SetPickable(false); + + myFeatureEdges->Delete(); + + myEventCallbackCommand->Delete(); + myEventCallbackCommand->SetClientData(this); + myEventCallbackCommand->SetCallback(VISU_Actor::ProcessEvents); + + if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() ) + aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, + myEventCallbackCommand.GetPointer(), + myPriority); + + //Definition of values labeling pipeline + + myValLblDataSet = vtkUnstructuredGrid::New(); + + myValCellCenters = vtkCellCenters::New(); + myValCellCenters->SetInput(myValLblDataSet); + + myValMaskPoints = vtkMaskPoints::New(); + myValMaskPoints->SetInput(myValCellCenters->GetOutput()); + myValMaskPoints->SetOnRatio(1); + + myValSelectVisiblePoints = vtkSelectVisiblePoints::New(); + myValSelectVisiblePoints->SetInput(myValMaskPoints->GetOutput()); + myValSelectVisiblePoints->SelectInvisibleOff(); + myValSelectVisiblePoints->SetTolerance(0.1); + + myValLabeledDataMapper = vtkLabeledDataMapper::New(); + myValLabeledDataMapper->SetInput(myValSelectVisiblePoints->GetOutput()); + myValLabeledDataMapper->SetLabelFormat("%g"); + myValLabeledDataMapper->SetLabelModeToLabelScalars(); + + vtkTextProperty* aClsTextProp = vtkTextProperty::New(); + aClsTextProp->SetFontFamilyToTimes(); + static int aCellsFontSize = 12; + aClsTextProp->SetFontSize(aCellsFontSize); + aClsTextProp->SetBold(1); + aClsTextProp->SetItalic(0); + aClsTextProp->SetShadow(0); + myValLabeledDataMapper->SetLabelTextProperty(aClsTextProp); + aClsTextProp->Delete(); + + myIsValLabeled = false; + + myValLabels = vtkActor2D::New(); + myValLabels->SetMapper(myValLabeledDataMapper); + myValLabels->GetProperty()->SetColor(0,1,0); + myValLabels->SetVisibility( myIsValLabeled ); } //---------------------------------------------------------------------------- @@ -119,6 +198,15 @@ VISU_Actor SetShrink(); else UnShrink(); + + SetFeatureEdgesAllowed(theActor->IsFeatureEdgesAllowed()); + SetFeatureEdgesEnabled(theActor->IsFeatureEdgesEnabled()); + SetFeatureEdgesAngle(theActor->GetFeatureEdgesAngle()); + bool aFeatureEdges = false, aBoundaryEdges = false, aManifoldEdges = false, aNonManifoldEdges = false; + theActor->GetFeatureEdgesFlags( aFeatureEdges, aBoundaryEdges, aManifoldEdges, aNonManifoldEdges ); + SetFeatureEdgesFlags( aFeatureEdges, aBoundaryEdges, aManifoldEdges, aNonManifoldEdges ); + SetFeatureEdgesColoring(theActor->GetFeatureEdgesColoring()); + SetOpacity(theActor->GetOpacity()); SetLineWidth(theActor->GetLineWidth()); SetPosition(theActor->GetPosition()); @@ -138,6 +226,15 @@ VISU_Actor VISU_Actor ::~VISU_Actor() { + // Deleting of values labeling pipeline + myValLblDataSet->Delete(); + myValLabeledDataMapper->RemoveAllInputs(); + myValLabeledDataMapper->Delete(); + myValSelectVisiblePoints->Delete(); + myValMaskPoints->Delete(); + myValCellCenters->Delete(); + myValLabels->Delete(); + if(MYDEBUG) MESSAGE("~VISU_Actor() - this = "<GetMapper() ) { - if ( vtkDataSet *aDataSet = aMapper->GetInput() ) { - SetShrinkable( thePipeLine->IsShrinkable() ); - SetMapperInput( aDataSet ); + if(thePipeLine){ + if(vtkMapper *aMapper = myPipeLine->GetMapper()){ + if(vtkDataSet *aDataSet = aMapper->GetInput()){ + SetShrinkable(thePipeLine->IsShrinkable()); + SetFeatureEdgesAllowed(thePipeLine->IsFeatureEdgesAllowed()); + SetMapperInput(aDataSet); } } } @@ -213,7 +311,10 @@ VISU_Actor { Superclass::SetRepresentation(theMode); if(myRepresentation == VTK_POINTS) + { UnShrink(); + } + SetFeatureEdgesEnabled( theMode == SVTK::Representation::FeatureEdges ); } @@ -282,6 +383,111 @@ VISU_Actor } +//---------------------------------------------------------------------------- +bool +VISU_Actor +::IsFeatureEdgesAllowed() +{ + return myIsFeatureEdgesAllowed; +} + +void +VISU_Actor +::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed) +{ + myIsFeatureEdgesAllowed = theIsFeatureEdgesAllowed; +} + +bool +VISU_Actor +::IsFeatureEdgesEnabled() +{ + return myIsFeatureEdgesEnabled; +} + +void +VISU_Actor +::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled) +{ + if ( !myIsFeatureEdgesAllowed || myIsFeatureEdgesEnabled == theIsFeatureEdgesEnabled ) + return; + + if ( vtkPolyData* aPolyData = myPassFilter[ 2 ]->GetPolyDataOutput() ) + { + if( theIsFeatureEdgesEnabled ) + { + myFeatureEdges->SetInput( aPolyData ); + myPassFilter[ 3 ]->SetInput( myFeatureEdges->GetOutput() ); + myIsFeatureEdgesEnabled = true; + } + else + { + myPassFilter[3]->SetInput( aPolyData ); + myPassFilter[3]->Modified(); + myIsFeatureEdgesEnabled = false; + Modified(); + } + myIsFeatureEdgesEnabled = theIsFeatureEdgesEnabled; + } +} + +vtkFloatingPointType +VISU_Actor +::GetFeatureEdgesAngle() +{ + return myFeatureEdges->GetFeatureAngle(); +} + +void +VISU_Actor +::SetFeatureEdgesAngle(vtkFloatingPointType theValue) +{ + myFeatureEdges->SetFeatureAngle(theValue); + Modified(); +} + +void +VISU_Actor +::GetFeatureEdgesFlags(bool& theIsFeatureEdges, + bool& theIsBoundaryEdges, + bool& theIsManifoldEdges, + bool& theIsNonManifoldEdges) +{ + theIsFeatureEdges = myFeatureEdges->GetFeatureEdges(); + theIsBoundaryEdges = myFeatureEdges->GetBoundaryEdges(); + theIsManifoldEdges = myFeatureEdges->GetManifoldEdges(); + theIsNonManifoldEdges = myFeatureEdges->GetNonManifoldEdges(); +} + +void +VISU_Actor +::SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges) +{ + myFeatureEdges->SetFeatureEdges(theIsFeatureEdges); + myFeatureEdges->SetBoundaryEdges(theIsBoundaryEdges); + myFeatureEdges->SetManifoldEdges(theIsManifoldEdges); + myFeatureEdges->SetNonManifoldEdges(theIsNonManifoldEdges); + Modified(); +} + +bool +VISU_Actor +::GetFeatureEdgesColoring() +{ + return myFeatureEdges->GetColoring(); +} + +void +VISU_Actor +::SetFeatureEdgesColoring(bool theIsColoring) +{ + myFeatureEdges->SetColoring(theIsColoring); + Modified(); +} + //---------------------------------------------------------------------------- void VISU_Actor @@ -321,6 +527,11 @@ VISU_Actor { Superclass::AddToRender(theRenderer); theRenderer->AddActor(myAnnotationActor.GetPointer()); + theRenderer->AddActor(myTextActor.GetPointer()); + + myValSelectVisiblePoints->SetRenderer( theRenderer ); + theRenderer->AddActor2D( myValLabels ); + } //================================================================== @@ -332,10 +543,21 @@ VISU_Actor ::RemoveFromRender(vtkRenderer* theRenderer) { theRenderer->RemoveActor(myAnnotationActor.GetPointer()); + theRenderer->RemoveActor(myTextActor.GetPointer()); + theRenderer->RemoveActor(myValLabels); Superclass::RemoveFromRender(theRenderer); myDestroySignal(this); } +//---------------------------------------------------------------------------- +void +VISU_Actor +::SetVisibility(int theMode) +{ + Superclass::SetVisibility( theMode ); + myValLabels->SetVisibility( myIsValLabeled && theMode ); +} + //---------------------------------------------------------------------------- void VISU_Actor @@ -379,6 +601,11 @@ VISU_Actor aSize += aDataSet->GetActualMemorySize() * 1024; } + if(IsFeatureEdgesEnabled()){ + vtkPolyData* aPolyData = myFeatureEdges->GetOutput(); + aSize += aPolyData->GetActualMemorySize() * 1024; + } + return aSize; } @@ -449,6 +676,84 @@ VISU_Actor //---------------------------------------------------------------------------- bool VISU_Actor +::isSubElementsHighlighted() +{ + return myIsSubElementsHighlighted; +} + + +//---------------------------------------------------------------------------- +inline +void +ChangeZoom(vtkFloatingPointType theZoomFactor, + vtkRenderer* theRenderer, + vtkIdType theInitialHasIndex, + vtkIdType theCurrentHasIndex) +{ + //printf( "VISU_Actor::ChangeZoom( %d, %d )", theInitialHasIndex, theCurrentHasIndex ); + if(theInitialHasIndex + theCurrentHasIndex == 1){ + vtkCamera *aCamera = theRenderer->GetActiveCamera(); + + double aScale = aCamera->GetParallelScale(); + if ( !theInitialHasIndex && theCurrentHasIndex ) { + //printf( " : +%f", theZoomFactor ); + aCamera->SetParallelScale( aScale / theZoomFactor ); + } + else { + //printf( " : -%f", theZoomFactor ); + aCamera->SetParallelScale( aScale * theZoomFactor ); + } + } + //printf( "\n" ); +} + +/*! + Updates visibility of the highlight devices +*/ +void +VISU_Actor +::highlight(bool theIsHighlight) +{ + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); + + bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled(); + if( theIsHighlight && mySelectionMode != myLastSelectionMode ) + { + if( mySelectionMode == ActorSelection ) + ResetTextActor(); + else + aShowTextActor = false; + myLastSelectionMode = mySelectionMode; + } + + myTextActor->SetVisibility( GetVisibility() && theIsHighlight && aShowTextActor ); + + bool anInitialHasIndex = isHighlighted(); + bool aCurrentHasIndex = theIsHighlight; + + if( !theIsHighlight && mySelectionMode == ActorSelection && isSubElementsHighlighted() ) + { + myIsSubElementsHighlighted = false; + + // Zoom + if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() ) + { + vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor(); + ChangeZoom(aZoomFactor, + GetRenderer(), + anInitialHasIndex, + aCurrentHasIndex); + } + } + + Superclass::highlight(theIsHighlight); +} + +/*! + To process prehighlight (called from SVTK_InteractorStyle) +*/ +bool +VISU_Actor ::PreHighlight(vtkInteractorStyle* theInteractorStyle, SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight) @@ -472,7 +777,7 @@ VISU_Actor if(myCellPicker->GetActor() != this) return false; - + vtkIdType aVTKId = myCellPicker->GetCellId(); if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){ vtkIdType anObjId = GetElemObjId(aVTKId); @@ -513,7 +818,7 @@ VISU_Actor theSelectionEvent->myY, 0.0, aRenderer); - + if(myPointPicker->GetActor() != this) return false; @@ -550,3 +855,405 @@ VISU_Actor return aRet; } + +void VISU_Actor::RemoveAllClippingPlanes() +{ +} + +vtkIdType VISU_Actor::GetNumberOfClippingPlanes() +{ + return 0; +} + +bool VISU_Actor::AddClippingPlane(vtkPlane* thePlane) +{ + return false; +} + +vtkPlane* VISU_Actor::GetClippingPlane(vtkIdType theID) +{ + return NULL; +} + +vtkImplicitFunctionCollection* VISU_Actor::GetClippingPlanes() +{ + return NULL; +} + +//---------------------------------------------------------------------------- +template std::string getScalar(TData* theData, int theId) +{ + std::ostringstream aStr; + if (vtkDataArray *aScalar = theData->GetScalars()){ + vtkFloatingPointType aVal = aScalar->GetTuple1(theId); + aStr << "\nScalar: " << aVal; + } + return aStr.str(); +} + +template std::string getVector(TData* theData, int theId) +{ + std::ostringstream aStr; + if (vtkDataArray *aVector = theData->GetVectors()) { + vtkFloatingPointType *aVal = aVector->GetTuple3(theId); + aStr << "\nVector: " << "{" << aVal[0] << "; " << aVal[1] << "; " << aVal[2] << "}"; + } + return aStr.str(); +} + +/*! + To process highlight (called from SVTK_InteractorStyle) +*/ +bool +VISU_Actor +::Highlight(vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight) +{ + return Superclass::Highlight(theInteractorStyle, + theSelectionEvent, + theIsHighlight); +} + +//------------------------------------------------------------------------- +void +VISU_Actor +::Highlight(bool theIsHighlight) +{ + Superclass::Highlight(theIsHighlight); + + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); + + bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode != ActorSelection; + + TColStd_IndexedMapOfInteger aMapIndex; + mySelector->GetIndex( getIO(), aMapIndex ); + bool aCurrentHasIndex = aMapIndex.Extent() == 1; + + myIsSubElementsHighlighted = aCurrentHasIndex; + + bool aFlyTo = false; + vtkFloatingPointType aFlyToCoord[3] = { 0.0, 0.0, 0.0 }; + vtkRenderer *aRenderer = GetRenderer(); + + if( theIsHighlight ) + { + vtkDataSet* aDataSet = GetMapper()->GetInput(); + switch(mySelectionMode) + { + case ActorSelection: + { + ResetTextActor(); + break; + } + case CellSelection: + { + if( !aCurrentHasIndex ) + { + myTextActor->SetVisibility(false); + break; + } + + int anObjId = aMapIndex(1); + vtkCellData* aCellData = aDataSet->GetCellData(); + if(vtkCell* aCell = GetElemCell(anObjId)){ + vtkPoints* aPts = aCell->GetPoints(); + if(int aNbPts = aCell->GetNumberOfPoints()){ + vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0}; + for(int i = 0; i < aNbPts; i++){ + vtkFloatingPointType *aPntCoord = aPts->GetPoint(i); + aCoord[0] += aPntCoord[0]; + aCoord[1] += aPntCoord[1]; + aCoord[2] += aPntCoord[2]; + } + + aFlyTo = true; + aFlyToCoord[0] = aCoord[0] / aNbPts; + aFlyToCoord[1] = aCoord[1] / aNbPts; + aFlyToCoord[2] = aCoord[2] / aNbPts; + + vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0}; + aRenderer->SetWorldPoint(aWorldCoord); + aRenderer->WorldToDisplay(); + vtkFloatingPointType aSelectionPoint[3]; + aRenderer->GetDisplayPoint(aSelectionPoint); + myTextActor->SetPosition(aSelectionPoint); + myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); + myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); + myTextActor->SetWorldPoint(aWorldCoord); + + std::ostringstream aStr; + aStr << "Cell ID: " << anObjId; + + vtkCell* aCell = GetElemCell(anObjId); + int aVTKID = GetElemVTKID(anObjId); + if (aCell) { + int aNbOfPoints = aCell->GetNumberOfPoints(); + if ( aNbOfPoints > 0 ) { + aStr << getScalar(aCellData, aVTKID); + aStr << getVector(aCellData, aVTKID); + } + } + + std::string aString = aStr.str(); + myTextActor->SetText(aString.c_str()); + } + } + break; + } + case NodeSelection: + { + if( !aCurrentHasIndex ) + { + myTextActor->SetVisibility(false); + break; + } + + int anObjId = aMapIndex(1); + vtkPointData* aPntData = aDataSet->GetPointData(); + if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){ + aFlyTo = true; + aFlyToCoord[0] = aCoord[0]; + aFlyToCoord[1] = aCoord[1]; + aFlyToCoord[2] = aCoord[2]; + + vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0}; + aRenderer->SetWorldPoint(aWorldCoord); + aRenderer->WorldToDisplay(); + vtkFloatingPointType aSelectionPoint[3]; + aRenderer->GetDisplayPoint(aSelectionPoint); + myTextActor->SetPosition(aSelectionPoint); + myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); + myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); + myTextActor->SetWorldPoint(aWorldCoord); + + std::ostringstream aStr; + aStr << "Point ID: " << anObjId; + + int aVTKID = GetNodeVTKID(anObjId); + if(aVTKID >= 0) { + aStr << getScalar(aPntData, aVTKID); + aStr << getVector(aPntData, aVTKID); + } + + const VISU::PIDMapper& aMapper = GetPipeLine()->GetIDMapper(); + //VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anObjId); + VISU::TStructuredId aVec = aMapper->GetIndexesOfNode(anObjId); + + aStr << "\nCoordinates: " << "["; + aStr << aCoord[0]; + //if( aVec.size() > 0 ) + if (aVec[0] != -1) + aStr << " (" << aVec[0] << ")"; + aStr << "; "; + + aStr << aCoord[1]; + //if( aVec.size() > 1 ) + if (aVec[1] != -1) + aStr << " (" << aVec[1] << ")"; + aStr << "; "; + + aStr << aCoord[2]; + //if( aVec.size() > 2 ) + if (aVec[2] != -1) + aStr << " (" << aVec[2] << ")"; + aStr << "]"; + + std::string aString = aStr.str(); + myTextActor->SetText(aString.c_str()); + } + break; + } + case EdgeOfCellSelection: + break; + default: + break; + } + } + + // Zoom + if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() ) + { + vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor(); + ChangeZoom(aZoomFactor, + GetRenderer(), + anInitialHasIndex, + aCurrentHasIndex); + } + + // FlyTo + if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() && aFlyTo ) + { + vtkRenderWindowInteractor* anInteractor = myInteractor; + vtkFloatingPointType aDollyWas = anInteractor->GetDolly(); + int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames(); + + anInteractor->SetDolly(0.0); + anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber()); + anInteractor->FlyTo(aRenderer, aFlyToCoord); + aRenderer->ResetCameraClippingRange(); + anInteractor->SetDolly(aDollyWas); + anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas); + anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aFlyToCoord); + } +} + +//------------------------------------------------------------------------- +void +VISU_Actor +::ResetTextActor() +{ + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); + + vtkFloatingPointType aCoord[6]; + GetBounds(aCoord); + + vtkFloatingPointType aWorldCoord[4] = { ( aCoord[0] + aCoord[1] ) / 2, + ( aCoord[2] + aCoord[3] ) / 2, + ( aCoord[4] + aCoord[5] ) / 2, 1.0}; + vtkRenderer* aRenderer = GetRenderer(); + aRenderer->SetWorldPoint(aWorldCoord); + aRenderer->WorldToDisplay(); + vtkFloatingPointType aSelectionPoint[3]; + aRenderer->GetDisplayPoint(aSelectionPoint); + myTextActor->SetPosition(aSelectionPoint); + myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); + myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); + myTextActor->SetWorldPoint(aWorldCoord); + + std::ostringstream aStr; + /* + if( const char* aName = getName() ) + aStr << aName << "\n"; + */ + aStr << "Position: " << "[" << aCoord[0] << "; " << aCoord[2] << "; " << aCoord[4] << "]"; + aStr << "\nSize: " << "[" << + fabs(aCoord[1]-aCoord[0]) << "; " << + fabs(aCoord[3]-aCoord[2]) << "; " << + fabs(aCoord[5]-aCoord[4]) << "]"; + + std::string aString = aStr.str(); + myTextActor->SetText(aString.c_str()); +} + +//------------------------------------------------------------------------- +void +VISU_Actor +::ProcessEvents(vtkObject* vtkNotUsed(theObject), + unsigned long theEvent, + void* theClientData, + void* vtkNotUsed(theCallData)) +{ + if(vtkObject* anObject = reinterpret_cast(theClientData)) + if(VISU_Actor* self = dynamic_cast(anObject)) { + if(theEvent == VISU::UpdatePickingSettingsEvent) + self->UpdatePickingSettings(); + } +} + +//---------------------------------------------------------------------------- +void +VISU_Actor +::UpdatePickingSettings() +{ + //printf( "VISU_Actor::UpdatePickingSettings()\n" ); + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); + if( !aPickingSettings ) + return; + + myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); + myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); + + Highlight(isHighlighted()); + + Update(); +} + +// --------------------------------------------------------------- + +void VISU_Actor::SetValuesLabeled( const bool theIsValLabeled ) +{ + vtkDataSet* aGrid = GetValLabelsInput(); + if ( !aGrid ) + return; + + bool isOnPnt = VISU::IsDataOnPoints( aGrid ); + bool isOnCell = VISU::IsDataOnCells( aGrid ); + if ( !isOnPnt && !isOnCell ) + { + // try to specify location of scalars "manually" + vtkCellData* aCData = aGrid->GetCellData(); + if ( aCData ) + { + vtkDataArray* anArr = aCData->GetScalars(); + if ( anArr && anArr->GetNumberOfTuples() ) + isOnCell = true; + } + + if ( !isOnCell ) + { + vtkPointData* aPData = aGrid->GetPointData(); + if ( aPData ) + { + vtkDataArray* anArr = aPData->GetScalars(); + if ( anArr && anArr->GetNumberOfTuples() ) + isOnPnt = true; + } + } + + if ( !isOnPnt && !isOnCell ) + { + myValLabels->SetVisibility( false ); + return; + } + } + + myIsValLabeled = theIsValLabeled; + + if ( myIsValLabeled ) + { + vtkDataSet* aDataSet = aGrid; + + if ( isOnCell ) + { + myValCellCenters->SetInput( aDataSet ); + myValMaskPoints->SetInput( myValCellCenters->GetOutput() ); + } + else if ( isOnPnt ) + myValMaskPoints->SetInput( aDataSet ); + + myValLabels->SetVisibility( GetVisibility() ); + } + else + myValLabels->SetVisibility( false ); + + Modified(); +} + +//---------------------------------------------------------------------------- + +bool VISU_Actor::GetValuesLabeled() const +{ + return myIsValLabeled; +} + +//---------------------------------------------------------------------------- + +vtkTextProperty* VISU_Actor::GetsValLabelsProps() const +{ + return myValLabeledDataMapper->GetLabelTextProperty(); +} + +//---------------------------------------------------------------------------- + +vtkDataSet* VISU_Actor::GetValLabelsInput() +{ + vtkDataSet* aDataSet = 0; + VISU_PipeLine* aPL = GetPipeLine(); + if ( aPL ) + aDataSet = aPL->GetOutput(); + if ( !aDataSet ) + aDataSet = GetInput(); + return aDataSet; +} + diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index d1c36b8c..69fcf141 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -43,8 +43,20 @@ class vtkProperty; class vtkTextMapper; class vtkTextActor; class vtkInteractorStyle; +class vtkCallbackCommand; class VTKViewer_ShrinkFilter; class VISU_PipeLine; +class vtkPlane; +class vtkImplicitFunctionCollection; +class vtkFeatureEdges; +class vtkTextProperty; +class vtkCellCenters; +class vtkSelectVisiblePoints; +class vtkLabeledDataMapper; +class vtkMaskPoints; +class vtkActor2D; + +class VISU_FramedTextActor; #ifdef _WIN32 #define VTKOCC_EXPORT __declspec (dllexport) @@ -57,6 +69,7 @@ namespace SVTK namespace Representation { const Type Surfaceframe = Insideframe + 1; + const Type FeatureEdges = Insideframe + 2; } } @@ -100,6 +113,10 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase virtual void RemoveFromRender(); + + virtual + void + SetVisibility(int theMode); //---------------------------------------------------------------------------- virtual @@ -144,6 +161,53 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase vtkFloatingPointType GetShrinkFactor(); + //---------------------------------------------------------------------------- + virtual + bool + IsFeatureEdgesAllowed(); + + virtual + void + SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed); + + virtual + bool + IsFeatureEdgesEnabled(); + + virtual + void + SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled); + + virtual + vtkFloatingPointType + GetFeatureEdgesAngle(); + + virtual + void + SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); + + virtual + void + GetFeatureEdgesFlags(bool& theIsFeatureEdges, + bool& theIsBoundaryEdges, + bool& theIsManifoldEdges, + bool& theIsNonManifoldEdges); + + virtual + void + SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges); + + virtual + bool + GetFeatureEdgesColoring(); + + virtual + void + SetFeatureEdgesColoring(bool theIsColoring); + //---------------------------------------------------------------------------- virtual void @@ -171,12 +235,30 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase RemoveFromRender( vtkRenderer* ); //---------------------------------------------------------------------------- + //! Just to update visibility of the highlight devices + virtual + void + highlight(bool theHighlight); + + //! To process prehighlight (called from #SVTK_InteractorStyle) virtual bool PreHighlight(vtkInteractorStyle* theInteractorStyle, SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight); + //! To process highlight (called from #SVTK_InteractorStyle) + virtual + bool + Highlight(vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight); + + //! Internal highlight. + virtual + void + Highlight(bool theIsHighlight); + virtual void SetVTKMapping(bool theIsVTKMapping); @@ -220,6 +302,38 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase GetElemCell(vtkIdType theObjID); //---------------------------------------------------------------------------- + virtual void RemoveAllClippingPlanes(); + + virtual vtkIdType GetNumberOfClippingPlanes(); + + virtual bool AddClippingPlane(vtkPlane* thePlane); + + virtual vtkPlane* GetClippingPlane(vtkIdType theID); + + virtual vtkImplicitFunctionCollection* GetClippingPlanes(); + + //---------------------------------------------------------------------------- + //! Apply the picking settings on the actor. + void + UpdatePickingSettings(); + + //---------------------------------------------------------------------------- + //! Methods for values labeling + virtual + void + SetValuesLabeled( const bool theIsValLabeled ); + + virtual + bool + GetValuesLabeled() const; + + virtual + vtkDataSet* + GetValLabelsInput(); + + vtkTextProperty* + GetsValLabelsProps() const; + protected: VISU_Actor(); @@ -235,6 +349,28 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase GetCurrentPL(); //---------------------------------------------------------------------------- + bool + isSubElementsHighlighted(); + + //---------------------------------------------------------------------------- + vtkSmartPointer myEventCallbackCommand; + + //! Main process VTK event method + static + void + ProcessEvents(vtkObject* theObject, + unsigned long theEvent, + void* theClientData, + void* theCallData); + + //---------------------------------------------------------------------------- + private: + void + ResetTextActor(); + + //---------------------------------------------------------------------------- + protected: + vtkFloatingPointType myPriority; bool myIsVTKMapping; VISU::Prs3d_i* myPrs3d; vtkSmartPointer myPipeLine; @@ -245,6 +381,24 @@ class VTKOCC_EXPORT VISU_Actor : public VISU_ActorBase vtkSmartPointer myAnnotationMapper; vtkSmartPointer myAnnotationActor; + + vtkSmartPointer myTextActor; + + vtkSmartPointer myFeatureEdges; + bool myIsFeatureEdgesAllowed; + bool myIsFeatureEdgesEnabled; + + Selection_Mode myLastSelectionMode; + bool myIsSubElementsHighlighted; + + // fields for values labeling + bool myIsValLabeled; + vtkDataSet* myValLblDataSet; + vtkActor2D* myValLabels; + vtkMaskPoints* myValMaskPoints; + vtkCellCenters* myValCellCenters; + vtkLabeledDataMapper* myValLabeledDataMapper; + vtkSelectVisiblePoints* myValSelectVisiblePoints; }; #endif //VISU_ACTOR_H diff --git a/src/OBJECT/VISU_ActorBase.cxx b/src/OBJECT/VISU_ActorBase.cxx deleted file mode 100644 index c794a7d5..00000000 --- a/src/OBJECT/VISU_ActorBase.cxx +++ /dev/null @@ -1,163 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : -// Author : -// Module : VISU -// $Header$ - -#include "VISU_ActorBase.h" -#include "VISU_ActorFactory.h" -#include "VTKViewer_ShrinkFilter.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "utilities.h" - -#include - -VISU_ActorBase -::VISU_ActorBase() : - myIsShrinkable(true), - myIsShrunk(false), - myShrinkFilter(VTKViewer_ShrinkFilter::New()) -{ - myShrinkFilter->Delete(); - - myStoreMapping = true; - - myShrinkFilter->SetStoreMapping(true); -} - -VISU_ActorBase -::~VISU_ActorBase() -{ - -} - -//---------------------------------------------------------------------------- -VISU::TActorFactory* -VISU_ActorBase -::GetFactory() -{ - return myActorFactory; -} - -void -VISU_ActorBase -::SetFactory(VISU::TActorFactory* theActorFactory) -{ - using namespace VISU; - - if(myActorFactory == theActorFactory) - return; - - if(theActorFactory) - myDestroySignal.connect(boost::bind(&TActorFactory::RemoveActor, - theActorFactory, - _1)); - - myActorFactory = theActorFactory; -} - -void -VISU_ActorBase -::UpdateFromFactory() -{ - if(myUpdateFromFactoryTime.GetMTime() < myActorFactory->GetMTime()){ - myUpdateFromFactoryTime.Modified(); - myActorFactory->UpdateActor(this); - Update(); - } -} - -//-------------------------------------------------------------------------- - -void -VISU_ActorBase -::SetLineWidth(vtkFloatingPointType theLineWidth) -{ - GetProperty()->SetLineWidth(theLineWidth); -} - -vtkFloatingPointType -VISU_ActorBase -::GetLineWidth() -{ - return GetProperty()->GetLineWidth(); -} - -//-------------------------------------------------------------------------- -void -VISU_ActorBase -::SetRepresentation(int theMode) -{ - Superclass::SetRepresentation(theMode); - if(myRepresentation == VTK_POINTS) - UnShrink(); -} - -//---------------------------------------------------------------------------- -void VISU_ActorBase::SetShrink() -{ - if(!myIsShrinkable) - return; - if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){ - myShrinkFilter->SetInput(aDataSet); - myPassFilter[1]->SetInput(myShrinkFilter->GetOutput()); - myIsShrunk = true; - } -} - -void VISU_ActorBase::UnShrink() -{ - if(!myIsShrunk) - return; - if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){ - myPassFilter[1]->SetInput(aDataSet); - myPassFilter[1]->Modified(); - myIsShrunk = false; - Modified(); - } -} - -bool VISU_ActorBase::IsShrunk() -{ - return myIsShrunk; -} - -void VISU_ActorBase::SetShrinkable(bool theIsShrinkable) -{ - myIsShrinkable = theIsShrinkable; -} - -bool VISU_ActorBase::IsShrunkable() -{ - return myIsShrinkable; -} diff --git a/src/OBJECT/VISU_ActorBase.h b/src/OBJECT/VISU_ActorBase.h deleted file mode 100644 index 2b9e414d..00000000 --- a/src/OBJECT/VISU_ActorBase.h +++ /dev/null @@ -1,92 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : -// Author : -// Module : VISU -// $Header$ - -#ifndef VISU_ACTOR_BASE_H -#define VISU_ACTOR_BASE_H - -#include "SALOME_Actor.h" -#include "VISU_BoostSignals.h" - -class VTKViewer_ShrinkFilter; - -#ifdef _WIN32 -#define VTKOCC_EXPORT __declspec (dllexport) -#else -#define VTKOCC_EXPORT VTK_EXPORT -#endif - - -//---------------------------------------------------------------------------- -namespace VISU -{ - struct TActorFactory; -} - - -//! This class defines an abstaract interface to manage actors -class VTKOCC_EXPORT VISU_ActorBase: public SALOME_Actor, - public boost::signalslib::trackable -{ - public: - vtkTypeMacro(VISU_ActorBase, SALOME_Actor); - - //---------------------------------------------------------------------------- - VISU::TActorFactory* GetFactory(); - virtual void SetFactory(VISU::TActorFactory* theActorFactory); - - //---------------------------------------------------------------------------- - virtual void UpdateFromFactory(); - - //---------------------------------------------------------------------------- - - virtual void SetLineWidth(vtkFloatingPointType theLineWidth); - virtual vtkFloatingPointType GetLineWidth(); - - virtual void SetShrink(); - virtual void UnShrink(); - virtual bool IsShrunkable(); - virtual bool IsShrunk(); - virtual void SetShrinkable(bool theIsShrinkable); - - virtual void SetRepresentation(int theMode); - - protected: - VISU_ActorBase(); - virtual ~VISU_ActorBase(); - - VISU::TActorFactory* myActorFactory; - vtkTimeStamp myUpdateFromFactoryTime; - boost::signal1 myDestroySignal; - - vtkSmartPointer myShrinkFilter; - - bool myIsShrinkable; - bool myIsShrunk; -}; - -#endif //VISU_ACTOR_BASE_H diff --git a/src/OBJECT/VISU_DataSetActor.cxx b/src/OBJECT/VISU_DataSetActor.cxx index 1b282c01..dbdb25ec 100644 --- a/src/OBJECT/VISU_DataSetActor.cxx +++ b/src/OBJECT/VISU_DataSetActor.cxx @@ -31,6 +31,11 @@ #include #include +#include +#include +#include +#include +#include #include @@ -48,11 +53,24 @@ vtkStandardNewMacro(VISU_DataSetActor); //---------------------------------------------------------------------------- VISU_DataSetActor ::VISU_DataSetActor(): - myMapper(vtkDataSetMapper::New()) + myMapper(vtkDataSetMapper::New()), + myExtractor(SALOME_ExtractGeometry::New()), + myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()), + myFunction(vtkImplicitBoolean::New()) { if(MYDEBUG) MESSAGE("VISU_DataSetActor::VISU_DataSetActor - this = "<SetImplicitFunction(myFunction); + myPolyDataExtractor->SetImplicitFunction(myFunction); + //myExtractor->ExtractBoundaryCellsOn(); + //myPolyDataExtractor->ExtractBoundaryCellsOn(); + + myFunction->SetOperationTypeToIntersection(); + myMapper->Delete(); + myExtractor->Delete(); + myPolyDataExtractor->Delete(); + myFunction->Delete(); } //---------------------------------------------------------------------------- @@ -71,9 +89,8 @@ VISU_DataSetActor if(VISU_UnstructuredGridPL* aPipeLine = dynamic_cast(thePipeLine)){ vtkDataSetMapper* aTarget = GetDataSetMapper(); - vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper(); + vtkDataSetMapper* aSource = aPipeLine->GetDataSetMapper(); VISU::CopyDataSetMapper(aTarget, aSource, true); - aTarget->SetLookupTable(aSource->GetLookupTable()); } } @@ -82,14 +99,67 @@ void VISU_DataSetActor ::SetMapperInput(vtkDataSet* theDataSet) { - myMapper->SetInput(theDataSet); + if (theDataSet->IsA("vtkPolyData")) { + myPolyDataExtractor->SetInput(theDataSet); + myMapper->SetInput(myPolyDataExtractor->GetOutput()); + } else { + myExtractor->SetInput(theDataSet); + myMapper->SetInput(myExtractor->GetOutput()); + } + // myMapper->SetInput(theDataSet); SetMapper(myMapper.GetPointer()); } //---------------------------------------------------------------------------- -vtkDataSetMapper* -VISU_DataSetActor -::GetDataSetMapper() +vtkDataSetMapper* VISU_DataSetActor::GetDataSetMapper() { return myMapper.GetPointer(); } + +//---------------------------------------------------------------------------- +void VISU_DataSetActor::RemoveAllClippingPlanes() +{ + myFunction->GetFunction()->RemoveAllItems(); + myFunction->Modified(); +} + +//---------------------------------------------------------------------------- +vtkIdType VISU_DataSetActor::GetNumberOfClippingPlanes() +{ + return myFunction->GetFunction()->GetNumberOfItems(); +} + +//---------------------------------------------------------------------------- +bool VISU_DataSetActor::AddClippingPlane(vtkPlane* thePlane) +{ + vtkImplicitFunctionCollection* aFunctions = GetClippingPlanes(); + aFunctions->InitTraversal(); + vtkImplicitFunction* aItem; + while ((aItem = aFunctions->GetNextItem())) { + if (thePlane == aItem) + return false; + } + myFunction->AddFunction(thePlane); + return true; +} + +//---------------------------------------------------------------------------- +vtkPlane* VISU_DataSetActor::GetClippingPlane(vtkIdType theID) +{ + vtkPlane* aPlane = NULL; + if ((theID >= 0) && (theID < GetNumberOfClippingPlanes())) { + vtkImplicitFunctionCollection* aFunction = myFunction->GetFunction(); + vtkImplicitFunction* aFun = NULL; + aFunction->InitTraversal(); + for (vtkIdType i = 0; i <= theID; i++) + aFun = aFunction->GetNextItem(); + aPlane = dynamic_cast(aFun); + } + return aPlane; +} + +//---------------------------------------------------------------------------- +vtkImplicitFunctionCollection* VISU_DataSetActor::GetClippingPlanes() +{ + return myFunction->GetFunction(); +} diff --git a/src/OBJECT/VISU_DataSetActor.h b/src/OBJECT/VISU_DataSetActor.h index 9e7ef457..4af55e3e 100644 --- a/src/OBJECT/VISU_DataSetActor.h +++ b/src/OBJECT/VISU_DataSetActor.h @@ -31,6 +31,10 @@ #include "VISU_Actor.h" class vtkDataSetMapper; +class SALOME_ExtractGeometry; +class SALOME_ExtractPolyDataGeometry; +class vtkImplicitBoolean; +class vtkImplicitFunctionCollection; #ifdef _WIN_32 #define VTKOCC_EXPORT __declspec (dllexport) @@ -56,6 +60,17 @@ class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor vtkDataSetMapper* GetDataSetMapper(); + //---------------------------------------------------------------------------- + virtual void RemoveAllClippingPlanes(); + + virtual vtkIdType GetNumberOfClippingPlanes(); + + virtual bool AddClippingPlane(vtkPlane* thePlane); + + virtual vtkPlane* GetClippingPlane(vtkIdType theID); + + virtual vtkImplicitFunctionCollection* GetClippingPlanes(); + //---------------------------------------------------------------------------- protected: VISU_DataSetActor(); @@ -69,6 +84,9 @@ class VTKOCC_EXPORT VISU_DataSetActor : public VISU_Actor //---------------------------------------------------------------------------- vtkSmartPointer myMapper; + vtkSmartPointer myExtractor; + vtkSmartPointer myPolyDataExtractor; + vtkSmartPointer myFunction; }; #endif //VISU_DATASETACTOR_H diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 04837dc4..e46d2a63 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -30,6 +30,7 @@ #include "VISU_GaussPointsPL.hxx" #include "VISU_GaussPtsSettings.h" #include "VISU_GaussPtsDeviceActor.h" +#include "VISU_PickingSettings.h" #include "VISU_WidgetCtrl.hxx" #include "VISU_SphereWidget.hxx" #include "VISU_OpenGLPointSpriteMapper.hxx" @@ -38,6 +39,7 @@ #include "VISU_Event.h" #include "SVTK_Actor.h" +#include #include #include @@ -46,6 +48,9 @@ #include #include #include +#include +#include +#include #include #include @@ -124,23 +129,22 @@ VISU_GaussPtsAct myWidgetCtrl(NULL), myGaussPointsPL(NULL), myLastPreHighlightObjID(-1), - myTextActor(VISU_FramedTextActor::New()), myCursorPyramid(VISU_CursorPyramid::New()), myCursorPyramidSelected(VISU_CursorPyramid::New()), myCellSource(vtkUnstructuredGrid::New()), myCellActor(SVTK_Actor::New()), myScalarBarCtrl(VISU_ScalarBarCtrl::New()), myBarVisibility(true), - myPickingSettings(NULL), myInsideCursorSettings(NULL), myCurrentPL(NULL), - myMapper(vtkPolyDataMapper::New()) + myMapper(vtkPolyDataMapper::New()), + myPolyDataExtractor(SALOME_ExtractPolyDataGeometry::New()), + myFunction(vtkImplicitBoolean::New()) { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<Delete(); myDeviceActor->Delete(); - myTextActor->Delete(); myCursorPyramid->Delete(); myCursorPyramid->SetPickable(0); @@ -163,9 +167,6 @@ VISU_GaussPtsAct myDeviceActor->SetVisibility(true); myDeviceActor->SetPickable(false); - myTextActor->SetVisibility(false); - myTextActor->SetPickable(false); - myCellSource->Allocate(); myCellActor->Initialize(); myCellActor->SetRepresentation(VTK_WIREFRAME); @@ -180,6 +181,18 @@ VISU_GaussPtsAct myMapper->Delete(); aMatrix->Delete(); + + myPolyDataExtractor->SetImplicitFunction(myFunction); + //myPolyDataExtractor->ExtractBoundaryCellsOn(); + + myFunction->SetOperationTypeToIntersection(); + myPolyDataExtractor->Delete(); + myFunction->Delete(); + + if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() ) + aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, + myEventCallbackCommand.GetPointer(), + myPriority); } VISU_GaussPtsAct @@ -188,7 +201,6 @@ VISU_GaussPtsAct if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<AddToRender(theRenderer); - theRenderer->AddActor(myTextActor.GetPointer()); theRenderer->AddActor(myCellActor.GetPointer()); myCursorPyramid->AddToRender(theRenderer); @@ -313,7 +324,6 @@ VISU_GaussPtsAct myDeviceActor->RemoveFromRender(theRenderer); - theRenderer->RemoveActor(myTextActor.GetPointer()); theRenderer->RemoveActor(myCellActor.GetPointer()); myCursorPyramid->RemoveFromRender(theRenderer); @@ -423,11 +433,14 @@ VISU_GaussPtsAct { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<SetExtractor(myPolyDataExtractor); myDeviceActor->SetPipeLine(GetGaussPointsPL()); myCurrentPL = myDeviceActor->GetPipeLine(); //SetMapper(myCurrentPL->GetPointSpriteMapper()); + // myPolyDataExtractor->SetInput(myCurrentPL->GetPickableDataSet()); + //myMapper->SetInput(myPolyDataExtractor->GetOutput()); myMapper->SetInput(myCurrentPL->GetPickableDataSet()); SetMapper(myMapper.GetPointer()); } @@ -526,6 +539,7 @@ VISU_GaussPtsAct ::SetVisibility(int theMode) { Superclass::SetVisibility(theMode); + myDeviceActor->SetVisibility(GetVisibility()); // VSV myScalarBarCtrl->SetVisibility(theMode); Highlight(isHighlighted()); } @@ -723,6 +737,8 @@ VISU_GaussPtsAct bool anIsChanged = (mySelectionMode != aSelectionMode); bool anIsPreselected = myIsPreselected; myIsPreselected = false; + + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); if(aSelectionMode == GaussPointSelection && theIsHighlight){ myPointPicker->Pick(theSelectionEvent->myX, @@ -761,25 +777,22 @@ VISU_GaussPtsAct vtkDataSet* aDataSet = GetInput(); vtkPointData* aPointData = aDataSet->GetPointData(); if(vtkDataArray *aScalarArray = aPointData->GetScalars()){ - if ( myPickingSettings ){ - vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight(); - aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); - //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor(); - vtkFloatingPointType aColor[3]; - theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor ); - aColor[0] = 1. - aColor[0]; - aColor[1] = 1. - aColor[1]; - aColor[2] = 1. - aColor[2]; - - myCursorPyramid->Init(aPyramidHeight, - myPickingSettings->GetCursorSize(), - GetRadius(anObjId,aVtkId,aScalarArray), - GetMagnification(anObjId), - GetClamp(anObjId), - aLocalNodeCoord, - aColor); - } - + vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight(); + aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); + //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor(); + vtkFloatingPointType aColor[3]; + theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor ); + aColor[0] = 1. - aColor[0]; + aColor[1] = 1. - aColor[1]; + aColor[2] = 1. - aColor[2]; + + myCursorPyramid->Init(aPyramidHeight, + aPickingSettings->GetCursorSize(), + GetRadius(anObjId,aVtkId,aScalarArray), + GetMagnification(anObjId), + GetClamp(anObjId), + aNodeCoord, + aColor); } this->Transform->Pop(); myLastPreHighlightObjID = anObjId; @@ -828,9 +841,9 @@ VISU_GaussPtsAct if ( !GetPickable() ) return false; - // int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection; + // int anInitialHasIndex = myIsSubElementsHighlighted && mySelectionMode == GaussPointSelection; Handle(SALOME_InteractiveObject) anIO = getIO(); - // myIsHighlighted = false; + // myIsSubElementsHighlighted = false; Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode; @@ -947,54 +960,65 @@ VISU_GaussPtsAct if(!mySelector.GetPointer()) return; - if ( !myPickingSettings ) - { - Superclass::Highlight(theIsHighlight); - return; - } + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); Selection_Mode aSelectionMode = mySelector->SelectionMode(); - bool anInitialHasIndex = isHighlighted() && mySelectionMode == GaussPointSelection; + bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode == GaussPointSelection; TColStd_IndexedMapOfInteger aMapIndex; mySelector->GetIndex( getIO(), aMapIndex ); bool aCurrentHasIndex = aMapIndex.Extent() == 1; bool anIsVisible = GetVisibility() && aCurrentHasIndex && theIsHighlight; + bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled(); + bool aShowCellActor = aPickingSettings->GetDisplayParentMesh(); myOutlineActor->SetVisibility(false); myCursorPyramid->SetVisibility(false); - myTextActor->SetVisibility(false); - myCellActor->SetVisibility(false); - myCursorPyramidSelected->SetVisibility(false); + myTextActor->SetVisibility(anIsVisible && aShowTextActor); + myCellActor->SetVisibility(anIsVisible && aShowCellActor); + GetScalarBarCtrl()->SetIsMarked(anIsVisible); + myCursorPyramidSelected->SetVisibility(anIsVisible); + //GetScalarBarCtrl()->Update(); - if(!theIsHighlight) - return; + myIsSubElementsHighlighted = aCurrentHasIndex; + + // Zoom if necessary + if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() ) + { + ChangeZoom(aPickingSettings, + GetRenderer(), + anInitialHasIndex, + aCurrentHasIndex); + } if( aSelectionMode == ActorSelection ) { - Superclass::highlight(theIsHighlight); + Superclass::Highlight(theIsHighlight); return; } + if(!theIsHighlight) + return; + if( aSelectionMode != GaussPointSelection ) return; if ( !aCurrentHasIndex || !myBarVisibility ) return; - myTextActor->SetVisibility(anIsVisible); - myCellActor->SetVisibility(anIsVisible && myPickingSettings->GetDisplayParentMesh()); - GetScalarBarCtrl()->SetIsMarked(anIsVisible); - myCursorPyramidSelected->SetVisibility(anIsVisible); + // myTextActor->SetVisibility(anIsVisible); + // myCellActor->SetVisibility(anIsVisible && myPickingSettings->GetDisplayParentMesh()); + // GetScalarBarCtrl()->SetIsMarked(anIsVisible); + // myCursorPyramidSelected->SetVisibility(anIsVisible); //GetScalarBarCtrl()->Update(); - myIsHighlighted = aCurrentHasIndex; +// myIsHighlighted = aCurrentHasIndex; // Zoom if necessary - ChangeZoom(myPickingSettings, - GetRenderer(), - anInitialHasIndex, - aCurrentHasIndex); +// ChangeZoom(myPickingSettings, +// GetRenderer(), +// anInitialHasIndex, +// aCurrentHasIndex); // TColStd_IndexedMapOfInteger aMapIndex; mySelector->GetIndex( getIO(), aMapIndex ); @@ -1031,17 +1055,20 @@ VISU_GaussPtsAct return; // FlyTo - vtkRenderWindowInteractor* anInteractor = myInteractor; - vtkFloatingPointType aDollyWas = anInteractor->GetDolly(); - int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames(); + if( anIsVisible && aPickingSettings->GetCameraMovementEnabled() ) + { + vtkRenderWindowInteractor* anInteractor = myInteractor; + vtkFloatingPointType aDollyWas = anInteractor->GetDolly(); + int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames(); - anInteractor->SetDolly(0.0); - anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber()); - anInteractor->FlyTo(aRenderer, aLocalNodeCoord); - aRenderer->ResetCameraClippingRange(); - anInteractor->SetDolly(aDollyWas); - anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas); - anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aLocalNodeCoord); + anInteractor->SetDolly(0.0); + anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber()); + anInteractor->FlyTo(aRenderer, aNodeCoord); + aRenderer->ResetCameraClippingRange(); + anInteractor->SetDolly(aDollyWas); + anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas); + anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord); + } // std::ostringstream aStr; // int anObjId = aMapIndex(1); @@ -1061,10 +1088,10 @@ VISU_GaussPtsAct GetScalarBarCtrl()->SetMarkValue(aVal); GetScalarBarCtrl()->Update(); // - vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight(); + vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight(); aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize(); myCursorPyramidSelected->Init(aPyramidHeight, - myPickingSettings->GetCursorSize(), + aPickingSettings->GetCursorSize(), GetRadius(anObjId,aVtkId,aScalarArray), GetMagnification(anObjId), GetClamp(anObjId), @@ -1106,55 +1133,26 @@ VISU_GaussPtsAct // // myTextActor std::string aString = aStr.str(); - myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition()); - myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency()); + myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); + myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); myTextActor->SetWorldPoint(aWorldCoord); myTextActor->SetText(aString.c_str()); - myTextActor->SetVisibility(anIsVisible && theIsHighlight); + myTextActor->SetVisibility(anIsVisible && theIsHighlight && aShowTextActor); // // myCellActor - if(myPickingSettings->GetDisplayParentMesh()){ - const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = - myGaussPointsPL->GetGaussPtsIDMapper(); - VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); - - myCellSource->Reset(); - myCellSource->Modified(); // a VTK bug - vtkUnstructuredGrid* aDataSet = aParent->GetUnstructuredGridOutput(); - myCellSource->SetPoints(aDataSet->GetPoints()); - - VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId); - vtkIdType aCellID = aGaussPointID.first; - vtkCell* aCell = aParent->GetElemCell(aCellID); - myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); - myCellActor->SetVisibility(anIsVisible && theIsHighlight); - myCellActor->SetRepresentation(VTK_WIREFRAME); - } - else - myCellActor->SetVisibility(false); - } -} - - -//---------------------------------------------------------------- -void -VISU_GaussPtsAct -::SetPickingSettings(VISU_PickingSettings* thePickingSettings) -{ - if(myPickingSettings == thePickingSettings) - return; - - if(myPickingSettings) - myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer()); - - myPickingSettings = thePickingSettings; - - if(thePickingSettings) - { - thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, - myEventCallbackCommand.GetPointer(), - myPriority); - this->UpdatePickingSettings(); + const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = myGaussPointsPL->GetGaussPtsIDMapper(); + VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent(); + // + myCellSource->Reset(); + myCellSource->Modified(); // a VTK bug + vtkUnstructuredGrid* aCellDataSet = aParent->GetUnstructuredGridOutput(); + myCellSource->SetPoints(aCellDataSet->GetPoints()); + // + VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId); + vtkIdType aCellID = aGaussPointID.first; + vtkCell* aCell = aParent->GetElemCell(aCellID); + myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds()); + myCellActor->SetVisibility(anIsVisible && theIsHighlight && aShowCellActor); } } @@ -1162,19 +1160,21 @@ void VISU_GaussPtsAct ::UpdatePickingSettings() { - if(!myPickingSettings) + //printf( "VISU_GaussPtsAct::UpdatePickingSettings()\n" ); + VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); + if(!aPickingSettings) return; - myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition()); - myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency()); + myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); + myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); - vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight(); - vtkFloatingPointType aCursorSize = myPickingSettings->GetCursorSize(); + vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*aPickingSettings->GetPyramidHeight(); + vtkFloatingPointType aCursorSize = aPickingSettings->GetCursorSize(); myCursorPyramid->SetPreferences(aHeight,aCursorSize); myCursorPyramidSelected->SetPreferences(aHeight,aCursorSize); - myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() ); - myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() ); + myHighlightActor->GetProperty()->SetColor( aPickingSettings->GetColor() ); + myPointPicker->SetTolerance( aPickingSettings->GetPointTolerance() ); Highlight(isHighlighted()); @@ -1256,6 +1256,51 @@ VISU_GaussPtsAct return aTime; } +void VISU_GaussPtsAct::RemoveAllClippingPlanes() +{ + myFunction->GetFunction()->RemoveAllItems(); + myFunction->Modified(); +} + +vtkIdType VISU_GaussPtsAct::GetNumberOfClippingPlanes() +{ + return myFunction->GetFunction()->GetNumberOfItems(); +} + +bool VISU_GaussPtsAct::AddClippingPlane(vtkPlane* thePlane) +{ + vtkImplicitFunctionCollection* aFunctions = GetClippingPlanes(); + aFunctions->InitTraversal(); + vtkImplicitFunction* aItem; + while ((aItem = aFunctions->GetNextItem())) { + if (thePlane == aItem) + return false; + } + myFunction->AddFunction(thePlane); + return true; +} + +vtkPlane* VISU_GaussPtsAct::GetClippingPlane(vtkIdType theID) +{ + vtkPlane* aPlane = NULL; + if ((theID >= 0) && (theID < GetNumberOfClippingPlanes())) { + vtkImplicitFunctionCollection* aFunction = myFunction->GetFunction(); + vtkImplicitFunction* aFun = NULL; + aFunction->InitTraversal(); + for (vtkIdType i = 0; i <= theID; i++) + aFun = aFunction->GetNextItem(); + aPlane = dynamic_cast(aFun); + } + return aPlane; +} + +vtkImplicitFunctionCollection* VISU_GaussPtsAct::GetClippingPlanes() +{ + return myFunction->GetFunction(); +} + + + //============================================================================== vtkStandardNewMacro(VISU_GaussPtsAct1); @@ -1314,16 +1359,16 @@ VISU_GaussPtsAct1 { Superclass::AddToRender(theRenderer); - myInsideDeviceActor->AddToRender(theRenderer); - myOutsideDeviceActor->AddToRender(theRenderer); + //myInsideDeviceActor->AddToRender(theRenderer); + //myOutsideDeviceActor->AddToRender(theRenderer); } void VISU_GaussPtsAct1 ::RemoveFromRender(vtkRenderer* theRenderer) { - myInsideDeviceActor->RemoveFromRender(theRenderer); - myOutsideDeviceActor->RemoveFromRender(theRenderer); + //myInsideDeviceActor->RemoveFromRender(theRenderer); + //myOutsideDeviceActor->RemoveFromRender(theRenderer); Superclass::RemoveFromRender(theRenderer); } @@ -1401,18 +1446,18 @@ VISU_GaussPtsAct1 Superclass::SetMapperInput(theDataSet); - if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){ - myInsideDeviceActor->SetPipeLine(aPipeLine); - aPipeLine->Delete(); - } +// if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){ +// myInsideDeviceActor->SetPipeLine(aPipeLine); +// aPipeLine->Delete(); +// } - if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){ - myOutsideDeviceActor->SetPipeLine(aPipeLine); - aPipeLine->Delete(); +// if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){ +// myOutsideDeviceActor->SetPipeLine(aPipeLine); +// aPipeLine->Delete(); - aPipeLine->SetExtractBoundaryCells(true); - aPipeLine->SetExtractInside(true); - } +// aPipeLine->SetExtractBoundaryCells(true); +// aPipeLine->SetExtractInside(true); +// } } @@ -1492,7 +1537,7 @@ VISU_GaussPtsAct1 bool aVisisbility = GetVisibility(); bool anIsSegementation = IsSegmentationEnabled(); - myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation); + myDeviceActor->SetVisibility(aVisisbility/* && !anIsSegementation*/); myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation); myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation); @@ -1545,7 +1590,7 @@ VISU_GaussPtsAct1 aPipeline->SetImplicitFunction(anImplicitFunction); // To restore aPipeline->SetExtractBoundaryCells(true); - aPipeline->SetExtractInside(true); + //aPipeline->SetExtractInside(true); aPipeline->SetMagnification( aMagnification ); aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() ); @@ -1615,7 +1660,7 @@ VISU_GaussPtsAct1 case vtkCommand::EndInteractionEvent: { bool aVisisbility = GetVisibility(); bool anIsSegementation = IsSegmentationEnabled(); - myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation); + myDeviceActor->SetVisibility(aVisisbility/* && !anIsSegementation*/); myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation); myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation); break; @@ -1684,15 +1729,15 @@ VISU_GaussPtsAct2 ::SetMapperInput(vtkDataSet* theDataSet) { if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetMapperInput - this = "<SetPipeLine(aPipeLine); - myCurrentPL = aPipeLine; - aPipeLine->Delete(); - - myMapper->SetInput(myCurrentPL->GetPickableDataSet()); - SetMapper(myMapper.GetPointer()); - } + Superclass::SetMapperInput(theDataSet); +// if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){ +// myDeviceActor->SetPipeLine(aPipeLine); +// myCurrentPL = aPipeLine; +// aPipeLine->Delete(); + +// myMapper->SetInput(myCurrentPL->GetPickableDataSet()); +// SetMapper(myMapper.GetPointer()); +// } } //---------------------------------------------------------------------------- diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 4685f60d..5c0b45ed 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -60,10 +60,11 @@ class vtkInteractorObserver; class vtkCallbackCommand; class VISU_ScalarBarCtrl; -class VISU_PickingSettings; class VISU_InsideCursorSettings; class VISU_OutsideCursorSettings; +class SALOME_ExtractPolyDataGeometry; +class vtkImplicitBoolean; //============================================================================ //! Base class for Gauss Points Actors. @@ -236,9 +237,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor UpdateInsideCursorSettings( PDeviceActor ); //---------------------------------------------------------------------------- - void - SetPickingSettings(VISU_PickingSettings* thePickingSettings); - //! Apply the picking settings on the actor. void UpdatePickingSettings(); @@ -256,6 +254,17 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor unsigned long int GetMTime(); + //---------------------------------------------------------------------------- + virtual void RemoveAllClippingPlanes(); + + virtual vtkIdType GetNumberOfClippingPlanes(); + + virtual bool AddClippingPlane(vtkPlane* thePlane); + + virtual vtkPlane* GetClippingPlane(vtkIdType theID); + + virtual vtkImplicitFunctionCollection* GetClippingPlanes(); + protected: //---------------------------------------------------------------------------- VISU_GaussPtsAct(); @@ -319,11 +328,11 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor vtkSmartPointer myGaussPointsPL; vtkSmartPointer myMapper; + vtkSmartPointer myPolyDataExtractor; + vtkSmartPointer myFunction; vtkIdType myLastPreHighlightObjID; - vtkSmartPointer myTextActor; - vtkSmartPointer myCursorPyramid; vtkSmartPointer myCursorPyramidSelected; @@ -334,7 +343,6 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor vtkSmartPointer myScalarBarCtrl; VISU_InsideCursorSettings* myInsideCursorSettings; - VISU_PickingSettings* myPickingSettings; }; diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index c4b084da..654243d6 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -34,6 +34,7 @@ #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" +#include #include #include @@ -136,7 +137,8 @@ vtkStandardNewMacro(VISU_GaussDeviceActorBase); VISU_GaussDeviceActorBase ::VISU_GaussDeviceActorBase(): - myTransformFilter(VTKViewer_TransformFilter::New()) + myTransformFilter(VTKViewer_TransformFilter::New()), + myPolyDataExtractor(0) { if(MYDEBUG) MESSAGE("VISU_GaussDeviceActorBase - "<SetInput( aDataSet ); + if (myPolyDataExtractor) { + myPolyDataExtractor->SetInput(aDataSet); + myPassFilter[ anId ]->SetInput( myPolyDataExtractor->GetOutput() ); + } else { + myPassFilter[ anId ]->SetInput( aDataSet ); + } myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); - + anId++; myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); @@ -586,7 +593,7 @@ VISU_FramedTextActor::VISU_FramedTextActor() myTextProperty->SetFontFamilyToArial(); // myTextMapper=vtkTextMapper::New(); - myTextMapper->SetInput("some text"); + myTextMapper->SetInput(""); myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty); myTextActor=vtkActor2D::New(); myTextActor->SetMapper(myTextMapper); diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.h b/src/OBJECT/VISU_GaussPtsDeviceActor.h index 7ff5c369..5b25e78e 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.h +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.h @@ -43,6 +43,7 @@ class VISU_GaussPointsPL; class vtkPassThroughFilter; class vtkImageData; +class SALOME_ExtractPolyDataGeometry; //============================================================================ @@ -92,6 +93,13 @@ class VISU_GaussDeviceActorBase: public vtkLODActor virtual unsigned long int GetMemorySize(); + + //---------------------------------------------------------------------------- + void SetExtractor(SALOME_ExtractPolyDataGeometry* theExtractor) + { myPolyDataExtractor = theExtractor; } + + SALOME_ExtractPolyDataGeometry* GetExtractor() const + { return myPolyDataExtractor; } protected: //---------------------------------------------------------------------------- @@ -101,6 +109,8 @@ class VISU_GaussDeviceActorBase: public vtkLODActor typedef vtkSmartPointer PPassThroughFilter; std::vector myPassFilter; + SALOME_ExtractPolyDataGeometry* myPolyDataExtractor; + VISU_GaussDeviceActorBase(); ~VISU_GaussDeviceActorBase(); diff --git a/src/OBJECT/VISU_GaussPtsSettings.cxx b/src/OBJECT/VISU_GaussPtsSettings.cxx index 7c04a8f0..db7bd70d 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.cxx +++ b/src/OBJECT/VISU_GaussPtsSettings.cxx @@ -30,6 +30,9 @@ #include #include +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + #include #include @@ -39,7 +42,6 @@ vtkStandardNewMacro( VISU_GaussPtsSettings ); vtkStandardNewMacro( VISU_InsideCursorSettings ); vtkStandardNewMacro( VISU_OutsideCursorSettings ); -vtkStandardNewMacro( VISU_PickingSettings ); //---------------------------------------------------------------- VISU_GaussPtsSettings::VISU_GaussPtsSettings() @@ -86,44 +88,3 @@ VISU_OutsideCursorSettings::VISU_OutsideCursorSettings() : VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings() { } - -//---------------------------------------------------------------- -VISU_PickingSettings::VISU_PickingSettings() -{ - float aCursorSize = 0.5; - float aPyramidHeight = 10.0; - float aPointTolerance = 0.1; - QColor aColor = Qt::yellow; - int anInfoWindowTransparency = 50; - int anInfoWindowPosition = VISU_PickingSettings::BelowPoint; - float aZoomFactor = 1.5; - int aStepNumber = 10; - bool aDisplayParentMesh = false; - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - this->CursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize ); - - this->PyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight ); - - this->PointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance ); - - aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor ); - this->Color[0] = aColor.red() / 255.0; - this->Color[1] = aColor.green() / 255.0; - this->Color[2] = aColor.blue() / 255.0; - - this->InfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ) / 100.0; - - this->InfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition ); - - this->ZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor ); - - this->StepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber ); - - this->DisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh ); -} - -VISU_PickingSettings::~VISU_PickingSettings() -{ -} diff --git a/src/OBJECT/VISU_GaussPtsSettings.h b/src/OBJECT/VISU_GaussPtsSettings.h index a34dbca6..11435aeb 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.h +++ b/src/OBJECT/VISU_GaussPtsSettings.h @@ -44,7 +44,6 @@ namespace VISU const vtkIdType UpdateFromSettingsEvent = vtkCommand::UserEvent + 100; const vtkIdType UpdateInsideSettingsEvent = vtkCommand::UserEvent + 101; const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 102; - const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 103; } @@ -162,68 +161,4 @@ class VTKOCC_EXPORT VISU_OutsideCursorSettings : public VISU_GaussPtsSettings vtkFloatingPointType Color[3]; }; - -//! Class of Picking settings. -/*! - * Contains information about the following parameters: - * Cursor Pyramid height, Info Window transparency, - * Info Window position, Zoom factor on first selected point, - * Camera movement steps number and Display parent mesh. - * Used by Gauss Points Actor. - */ -class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject -{ - public: - enum { BelowPoint = 0, TopLeftCorner }; - - public: - vtkTypeMacro( VISU_PickingSettings, vtkObject ); - - VISU_PickingSettings(); - virtual ~VISU_PickingSettings(); - - static - VISU_PickingSettings* - New(); - - vtkSetMacro( PyramidHeight, vtkFloatingPointType ); - vtkGetMacro( PyramidHeight, vtkFloatingPointType ); - - vtkSetMacro( CursorSize, vtkFloatingPointType ); - vtkGetMacro( CursorSize, vtkFloatingPointType ); - - vtkSetVector3Macro( Color, vtkFloatingPointType ); - vtkGetVector3Macro( Color, vtkFloatingPointType ); - - vtkSetMacro( PointTolerance, vtkFloatingPointType ); - vtkGetMacro( PointTolerance, vtkFloatingPointType ); - - vtkSetMacro( InfoWindowTransparency, vtkFloatingPointType ); - vtkGetMacro( InfoWindowTransparency, vtkFloatingPointType ); - - vtkSetMacro( InfoWindowPosition, int ); - vtkGetMacro( InfoWindowPosition, int ); - - vtkSetMacro( ZoomFactor, vtkFloatingPointType ); - vtkGetMacro( ZoomFactor, vtkFloatingPointType ); - - vtkSetMacro( StepNumber, int ); - vtkGetMacro( StepNumber, int ); - - vtkSetMacro( DisplayParentMesh, bool ); - vtkGetMacro( DisplayParentMesh, bool ); - -private: - vtkFloatingPointType PyramidHeight; - vtkFloatingPointType CursorSize; - vtkFloatingPointType PointTolerance; - vtkFloatingPointType Color[3]; - vtkFloatingPointType InfoWindowTransparency; - int InfoWindowPosition; - vtkFloatingPointType ZoomFactor; - int StepNumber; - bool DisplayParentMesh; -}; - - #endif diff --git a/src/OBJECT/VISU_IsoSurfActor.cxx b/src/OBJECT/VISU_IsoSurfActor.cxx deleted file mode 100644 index 3c58fc47..00000000 --- a/src/OBJECT/VISU_IsoSurfActor.cxx +++ /dev/null @@ -1,165 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VISU_IsoSurfActor.cxx -// Author : Vitaly Smetannikov -// Module : VISU - - -#include "VISU_IsoSurfActor.h" -#include "VISU_PipeLine.hxx" -#include "VISU_LabelPointsFilter.hxx" - - -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include - - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VISU_IsoSurfActor); - - -//---------------------------------------------------------------------------- -VISU_IsoSurfActor::VISU_IsoSurfActor(): - VISU_ScalarMapAct(), - myIsLinesLabeled(true) -{ - myLabelsDataSet = vtkPolyData::New(); - -// myMaskPoints = vtkMaskPoints::New(); -// myMaskPoints->SetInput(myLabelsDataSet); -// myMaskPoints->SetOnRatio(100); - - myMaskPoints = VISU_LabelPointsFilter::New(); - myMaskPoints->SetInput(myLabelsDataSet); - - myLabeledDataMapper = vtkLabeledDataMapper::New(); - myLabeledDataMapper->SetInput(myMaskPoints->GetOutput()); - //myLabeledDataMapper->SetLabelFormat("%e"); - myLabeledDataMapper->SetLabelModeToLabelScalars(); - - myLabels = vtkActor2D::New(); - myLabels->SetMapper(myLabeledDataMapper); - myLabels->GetProperty()->SetColor(1,1,1); - myLabels->SetVisibility(myIsLinesLabeled); -} - - -//---------------------------------------------------------------------------- -VISU_IsoSurfActor::~VISU_IsoSurfActor() -{ - myLabelsDataSet->Delete(); - myMaskPoints->Delete(); - myLabeledDataMapper->Delete(); - myLabels->Delete(); -} - -//---------------------------------------------------------------------------- -void VISU_IsoSurfActor::SetLinesLabeled(bool theIsLinesLabeled, int theNbLbl) -{ - myIsLinesLabeled = theIsLinesLabeled; - myMaskPoints->SetPointsNb(theNbLbl); - Modified(); -} - -//---------------------------------------------------------------------------- -int VISU_IsoSurfActor::GetNbLabels() const -{ - return myMaskPoints->GetPointsNb(); -} - - -//---------------------------------------------------------------------------- -void VISU_IsoSurfActor::UpdateLabels() -{ - if (myIsLinesLabeled) { - vtkDataSet* aDataSet = GetPipeLine()->GetOutput(); - if (aDataSet != NULL) { - unsigned long aTime = myLabelsDataSet->GetMTime(); - unsigned long anObjTime = GetMTime(); - if (aTime < anObjTime) { - myLabelsDataSet->ShallowCopy(aDataSet); - myLabelsDataSet->Modified(); - } - } - } - myLabels->SetVisibility(myIsLinesLabeled); -} - - -//---------------------------------------------------------------------------- -void VISU_IsoSurfActor::AddToRender(vtkRenderer* theRenderer) -{ - VISU_ScalarMapAct::AddToRender(theRenderer); - theRenderer->AddActor2D(myLabels); -} - -//---------------------------------------------------------------------------- -void VISU_IsoSurfActor::RemoveFromRender(vtkRenderer* theRenderer) -{ - VISU_ScalarMapAct::RemoveFromRender(theRenderer); - theRenderer->RemoveActor(myLabels); -} - -//From vtkFollower -int VISU_IsoSurfActor::RenderOpaqueGeometry(vtkViewport *vp) -{ - UpdateLabels(); - return VISU_ScalarMapAct::RenderOpaqueGeometry(vp); -} - - -int VISU_IsoSurfActor::RenderTranslucentGeometry(vtkViewport *vp) -{ - UpdateLabels(); - return VISU_ScalarMapAct::RenderTranslucentGeometry(vp); -} - -void VISU_IsoSurfActor::SetVisibility(int theMode){ - VISU_ScalarMapAct::SetVisibility(theMode); - if(GetVisibility()) - myLabels->VisibilityOn(); - else - myLabels->VisibilityOff(); - Modified(); -} - - -///!!!! For test purposes only -// void VISU_IsoSurfActor::SetMapperInput(vtkDataSet* theDataSet) -// { -// VISU_ScalarMapAct::SetMapperInput(theDataSet); - -// vtkFeatureEdges* aFilter = vtkFeatureEdges::New(); -// aFilter->SetInput(VISU_ScalarMapAct::GetInput()); -// SetInput(aFilter->GetOutput()); -// } diff --git a/src/OBJECT/VISU_IsoSurfActor.h b/src/OBJECT/VISU_IsoSurfActor.h deleted file mode 100644 index 0377ae6a..00000000 --- a/src/OBJECT/VISU_IsoSurfActor.h +++ /dev/null @@ -1,88 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VISU_IsoSurfActor.h -// Author : Vitaly Smetannikov -// Module : VISU - - -#ifndef VISU_VectorsAct_HeaderFile -#define VISU_VectorsAct_HeaderFile - -#include "VISU_ScalarMapAct.h" - -class vtkActor2D; -//class vtkMaskPoints; -class vtkLabeledDataMapper; -class vtkPolyData; -class VISU_LabelPointsFilter; - - -class VTKOCC_EXPORT VISU_IsoSurfActor : public VISU_ScalarMapAct -{ - public: - vtkTypeMacro(VISU_IsoSurfActor, VISU_ScalarMapAct); - - static VISU_IsoSurfActor* New(); - - - //---------------------------------------------------------------------------- - virtual void AddToRender( vtkRenderer* ); - - virtual void RemoveFromRender( vtkRenderer* ); - - virtual int RenderOpaqueGeometry(vtkViewport *viewport); - virtual int RenderTranslucentGeometry(vtkViewport *viewport); - - //virtual void SetPipeLine(VISU_PipeLine* thePipeLine); - - void SetLinesLabeled(bool theIsLinesLabeled, int theNbLbl); - bool GetLinesLabeled() const { return myIsLinesLabeled;} - - int GetNbLabels() const; - - - //---------------------------------------------------------------------------- - //! Visibility management - virtual void SetVisibility( int ); - - - protected: - - VISU_IsoSurfActor(); - ~VISU_IsoSurfActor(); - - void UpdateLabels(); - - vtkActor2D *myLabels; - vtkLabeledDataMapper* myLabeledDataMapper; - //vtkMaskPoints* myMaskPoints; - VISU_LabelPointsFilter* myMaskPoints; - vtkPolyData* myLabelsDataSet; - - bool myIsLinesLabeled; - //int myNbLabels; -}; - - -#endif diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index cf2e7cfc..486498da 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -212,6 +212,64 @@ VISU_MeshAct myEdgeActor->UnShrink(); } +//---------------------------------------------------------------------------- +void +VISU_MeshAct +::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed) +{ + Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed); + + mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed); +} + +void +VISU_MeshAct +::SetFeatureEdgesAngle(vtkFloatingPointType theValue) +{ + Superclass::SetFeatureEdgesAngle(theValue); + + mySurfaceActor->SetFeatureEdgesAngle(theValue); +} + +void +VISU_MeshAct +::SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges) +{ + Superclass::SetFeatureEdgesFlags(theIsFeatureEdges, + theIsBoundaryEdges, + theIsManifoldEdges, + theIsNonManifoldEdges); + + mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges, + theIsBoundaryEdges, + theIsManifoldEdges, + theIsNonManifoldEdges); +} + +void +VISU_MeshAct +::SetFeatureEdgesColoring(bool theIsColoring) +{ + Superclass::SetFeatureEdgesColoring(theIsColoring); + + mySurfaceActor->SetFeatureEdgesColoring(theIsColoring); +} + +//---------------------------------------------------------------------------- +void +VISU_MeshAct +::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled) +{ + if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS) + return; + + Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled); + + mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled); +} //---------------------------------------------------------------------------- void @@ -288,6 +346,10 @@ VISU_MeshAct myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren); myEdgeActor->RenderOpaqueGeometry(ren); break; + case FeatureEdges : + mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren); + mySurfaceActor->RenderOpaqueGeometry(ren); + break; } return 1; } @@ -322,6 +384,10 @@ VISU_MeshAct myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren); myEdgeActor->RenderTranslucentGeometry(ren); break; + case FeatureEdges : + mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren); + mySurfaceActor->RenderTranslucentGeometry(ren); + break; } return 1; } diff --git a/src/OBJECT/VISU_MeshAct.h b/src/OBJECT/VISU_MeshAct.h index 5a5778d3..86ea7308 100644 --- a/src/OBJECT/VISU_MeshAct.h +++ b/src/OBJECT/VISU_MeshAct.h @@ -99,6 +99,29 @@ class VTKOCC_EXPORT VISU_MeshAct : public VISU_DataSetActor void UnShrink(); + virtual + void + SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed); + + virtual + void + SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled); + + virtual + void + SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); + + virtual + void + SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges); + + virtual + void + SetFeatureEdgesColoring(bool theIsColoring); + //! Gets memory size used by the instance (bytes). virtual unsigned long int diff --git a/src/OBJECT/VISU_PointMap3dActor.cxx b/src/OBJECT/VISU_PointMap3dActor.cxx deleted file mode 100644 index 933cf60b..00000000 --- a/src/OBJECT/VISU_PointMap3dActor.cxx +++ /dev/null @@ -1,149 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : -// Author : -// Module : VISU -// $Header$ - -#include "VISU_PointMap3dActor.h" -#include "VISU_PipeLine.hxx" -#include "VISU_ScalarBarActor.hxx" -#include "VISU_DeformedGridPL.hxx" - -#include - -#include "utilities.h" -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -vtkStandardNewMacro(VISU_PointMap3dActor); - -//================================================================== -// function: Constructor -// purpose : -//================================================================== - -VISU_PointMap3dActor -::VISU_PointMap3dActor() -{ - if(MYDEBUG) MESSAGE("VISU_PointMap3dActor::VISU_PointMap3dActor - this = "< myPipeLine; - - VISU_ScalarBarActor* myScalarBar; -}; - -#endif diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index 90816504..790bc9fc 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -36,6 +36,9 @@ #include "VISU_DeformedShapePL.hxx" #include "VISU_PipeLineUtils.hxx" +#include +#include + #include #include #include @@ -258,7 +261,7 @@ void VISU_ScalarMapAct ::ShallowCopyPL(VISU_PipeLine* thePipeLine) { - VISU_Actor::ShallowCopyPL( thePipeLine ); + VISU_DataSetActor::ShallowCopyPL( thePipeLine ); myEdgeActor->GetMapper()->ScalarVisibilityOff(); @@ -274,10 +277,19 @@ VISU_ScalarMapAct { Superclass::SetMapperInput( theDataSet ); - myPointsActor->SetInput( theDataSet ); +// myPointsActor->SetInput( theDataSet ); +// mySurfaceActor->SetInput( theDataSet ); +// myEdgeActor->SetInput( theDataSet ); - mySurfaceActor->SetInput( theDataSet ); - myEdgeActor->SetInput( theDataSet ); + if (theDataSet->IsA("vtkPolyData")) { + myPointsActor->SetInput( myPolyDataExtractor->GetOutput() ); + mySurfaceActor->SetInput( myPolyDataExtractor->GetOutput() ); + myEdgeActor->SetInput( myPolyDataExtractor->GetOutput() ); + } else { + myPointsActor->SetInput( myExtractor->GetOutput() ); + mySurfaceActor->SetInput( myExtractor->GetOutput() ); + myEdgeActor->SetInput( myExtractor->GetOutput() ); + } } //---------------------------------------------------------------------------- @@ -334,6 +346,65 @@ VISU_ScalarMapAct mySurfaceActor->UnShrink(); } +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed) +{ + Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed); + + mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed); +} + +void +VISU_ScalarMapAct +::SetFeatureEdgesAngle(vtkFloatingPointType theValue) +{ + Superclass::SetFeatureEdgesAngle(theValue); + + mySurfaceActor->SetFeatureEdgesAngle(theValue); +} + +void +VISU_ScalarMapAct +::SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges) +{ + Superclass::SetFeatureEdgesFlags(theIsFeatureEdges, + theIsBoundaryEdges, + theIsManifoldEdges, + theIsNonManifoldEdges); + + mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges, + theIsBoundaryEdges, + theIsManifoldEdges, + theIsNonManifoldEdges); +} + +void +VISU_ScalarMapAct +::SetFeatureEdgesColoring(bool theIsColoring) +{ + Superclass::SetFeatureEdgesColoring(theIsColoring); + + mySurfaceActor->SetFeatureEdgesColoring(theIsColoring); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled) +{ + if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS) + return; + + Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled); + + mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled); +} + //---------------------------------------------------------------------------- void VISU_ScalarMapAct diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index 8589d05d..d67cfa5f 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -77,6 +77,29 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor void UnShrink(); + virtual + void + SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed); + + virtual + void + SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled); + + virtual + void + SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); + + virtual + void + SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges); + + virtual + void + SetFeatureEdgesColoring(bool theIsColoring); + virtual void SetOpacity(vtkFloatingPointType theValue); diff --git a/src/OBJECT/VISU_VectorsAct.cxx b/src/OBJECT/VISU_VectorsAct.cxx index 7a157e23..f878dcf9 100644 --- a/src/OBJECT/VISU_VectorsAct.cxx +++ b/src/OBJECT/VISU_VectorsAct.cxx @@ -36,6 +36,9 @@ #include #include #include +#include +#include +#include //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_VectorsAct); @@ -120,3 +123,24 @@ VISU_VectorsAct return aSize; } + +//---------------------------------------------------------------------------- +vtkDataSet* +VISU_VectorsAct +::GetValLabelsInput() +{ + VISU_VectorsPL* aPL = dynamic_cast( GetPipeLine() ); + if ( aPL ) + { + return aPL->GetMergedInput(); + /*VISU_UsedPointsFilter* aFilter = aPL->GetUsedPointsFilter(); + vtkSmartPointer< VISU_MergeFilter > aFilter = aPL->myMergeFilter; + if ( aFilter ) + { + aFilter->Update(); + return aFilter->GetOutput(); + }*/ + } + + return Superclass::GetValLabelsInput(); +} diff --git a/src/OBJECT/VISU_VectorsAct.h b/src/OBJECT/VISU_VectorsAct.h index cc76ce48..5c409c57 100644 --- a/src/OBJECT/VISU_VectorsAct.h +++ b/src/OBJECT/VISU_VectorsAct.h @@ -65,6 +65,10 @@ class VTKOCC_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct virtual unsigned long int GetMemorySize(); + + virtual + vtkDataSet* + GetValLabelsInput(); protected: VISU_VectorsAct(); diff --git a/src/PIPELINE/Makefile.am b/src/PIPELINE/Makefile.am index 425f955c..8c488c75 100644 --- a/src/PIPELINE/Makefile.am +++ b/src/PIPELINE/Makefile.am @@ -69,7 +69,8 @@ salomeinclude_HEADERS= \ VISU_ElnoDisassembleFilter.hxx \ VISU_ElnoAssembleFilter.hxx \ VISU_DeformationPL.hxx \ - VISU_OptionalDeformationPL.hxx + VISU_OptionalDeformationPL.hxx \ + VISU_XYPlotActor.hxx dist_libVisuPipeLine_la_SOURCES= \ VISU_MapperHolder.cxx \ @@ -111,7 +112,8 @@ dist_libVisuPipeLine_la_SOURCES= \ VISU_ElnoDisassembleFilter.cxx \ VISU_ElnoAssembleFilter.cxx \ VISU_DeformationPL.cxx \ - VISU_OptionalDeformationPL.cxx + VISU_OptionalDeformationPL.cxx\ + VISU_XYPlotActor.cxx libVisuPipeLine_la_CPPFLAGS= \ $(VTK_INCLUDES) \ diff --git a/src/PIPELINE/SALOME_ExtractGeometry.h b/src/PIPELINE/SALOME_ExtractGeometry.h index ed9c0749..8fbf41f6 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.h +++ b/src/PIPELINE/SALOME_ExtractGeometry.h @@ -20,6 +20,8 @@ #ifndef SALOME_ExtractGeometry_H #define SALOME_ExtractGeometry_H +#include "VISUPipeline.hxx" + #include #include @@ -27,7 +29,7 @@ class vtkImplicitBoolean; -class SALOME_ExtractGeometry : public vtkExtractGeometry +class VISU_PIPELINE_EXPORT SALOME_ExtractGeometry : public vtkExtractGeometry { public: vtkTypeMacro(SALOME_ExtractGeometry, vtkExtractGeometry); diff --git a/src/PIPELINE/SALOME_ExtractPolyDataGeometry.h b/src/PIPELINE/SALOME_ExtractPolyDataGeometry.h index 05b03918..1b3bf436 100644 --- a/src/PIPELINE/SALOME_ExtractPolyDataGeometry.h +++ b/src/PIPELINE/SALOME_ExtractPolyDataGeometry.h @@ -20,6 +20,8 @@ #ifndef SALOME_ExtractPolyDataGeometry_H #define SALOME_ExtractPolyDataGeometry_H +#include "VISUPipeline.hxx" + #include #include @@ -27,7 +29,7 @@ class vtkImplicitBoolean; -class SALOME_ExtractPolyDataGeometry : public vtkExtractPolyDataGeometry +class VISU_PIPELINE_EXPORT SALOME_ExtractPolyDataGeometry : public vtkExtractPolyDataGeometry { public: vtkTypeMacro(SALOME_ExtractPolyDataGeometry, vtkExtractPolyDataGeometry); diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 291c457a..0881f71a 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -34,6 +34,7 @@ #include "VISU_IsoSurfacesPL.hxx" #include "VISU_CutPlanesPL.hxx" #include "VISU_CutLinesPL.hxx" +#include "VISU_ColoredPL.hxx" #include "VISU_DeformedShapePL.hxx" #include "VISU_VectorsPL.hxx" #include "VISU_StreamLinesPL.hxx" @@ -48,7 +49,9 @@ #include "VISU_ElnoDisassembleFilter.hxx" #include "VISU_ElnoAssembleFilter.hxx" -typedef VISU_ScalarMapPL TPresent; +//typedef VISU_CutPlanesPL TPresent; +//typedef VISU_ScalarMapPL TPresent; +typedef VISU_CutLinesPL TPresent; // VTK includes #include @@ -73,8 +76,42 @@ typedef VISU_ScalarMapPL TPresent; #include #include +//RKV:Begin +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/*#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +*/ +//RKV:End + #include "utilities.h" +static int isOnlyMesh = false; + void PrintMissing(){ MESSAGE(std::endl << "VISUPipeLine : missing operand after `VISUPipeLine'" << std::endl << "VISUPipeLine : Try `VISUPipeLine -h' for more information."); @@ -95,6 +132,159 @@ void PrintHelp(){ void PrintErr(){ MESSAGE("***************************ERROR*****************************************"); } +//#define _DEBUG_ID_MAPPING_ + +//RKV:Begin +/* +vtkActor* barChartActor() +{ + int numTuples = 6; + + vtkFloatArray *bitter = vtkFloatArray::New(); + bitter->SetNumberOfTuples(numTuples); + + for (int i=0; iSetTuple1(i, vtkMath::Random(7,100)); + } + + vtkDataObject *dobj = vtkDataObject::New(); + dobj->GetFieldData()->AddArray(bitter); + + vtkBarChartActor *actor = vtkBarChartActor::New(); + actor->SetInput(dobj); + actor->SetTitle("Bar Chart"); + actor->GetPositionCoordinate()->SetValue(0.05,0.05,0.0); + actor->GetPosition2Coordinate()->SetValue(0.95,0.85,0.0); + actor->GetProperty()->SetColor(1,1,1); + actor->GetLegendActor()->SetNumberOfEntries(numTuples); + for (int i=0; iSetBarColor(i,red,green,blue); + } + actor->SetBarLabel(0,"oil"); + actor->SetBarLabel(1,"gas"); + actor->SetBarLabel(2,"water"); + actor->SetBarLabel(3,"snake oil"); + actor->SetBarLabel(4,"tequila"); + actor->SetBarLabel(5,"beer"); + actor->LegendVisibilityOn(); + + // Set text colors (same as actor for backward compat with test) + actor->GetTitleTextProperty()->SetColor(1,1,0); + actor->GetLabelTextProperty()->SetColor(1,0,0); + return actor; +} +*/ +//RKV:End +//---------------------------------------------------------------------------- +template +VISU_ColoredPL* +CreateColoredPL(VISU_Convertor* theConvertor, + const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theTimeStampNumber); + + +//---------------------------------------------------------------------------- +template<> +VISU_ColoredPL* +CreateColoredPL(VISU_Convertor* theConvertor, + const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theTimeStampNumber) +{ + VISU_GaussPointsPL* aPresent = VISU_GaussPointsPL::New(); + VISU::PGaussPtsIDMapper aGaussPtsIDMapper = + theConvertor->GetTimeStampOnGaussPts(theMeshName, + theEntity, + theFieldName, + theTimeStampNumber); + aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper); + + char aMainTexture[80]; + strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) ); + strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.bmp" ); + + char anAlphaTexture[80]; + strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) ); + strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.bmp" ); + + vtkSmartPointer aTextureValue = + VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ); + aPresent->SetImageData( aTextureValue.GetPointer() ); + + aPresent->Update(); + +#ifdef _DEBUG_ID_MAPPING_ + vtkDataSet* aDataSet = aPresent->GetOutput(); + aDataSet->Update(); + int aNbCells = aDataSet->GetNumberOfCells(); + cout<<"aNbCells = "<GetNodeObjID(anCellId); + vtkIdType aVtkID = aPresent->GetNodeVTKID(anObjID); + cout<GetNodeCoord(anObjID); + cout< +VISU_ColoredPL* +CreateColoredPL(VISU_Convertor* theConvertor, + const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theTimeStampNumber) +{ + TPipeLine* aPresent = TPipeLine::New(); + VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper = + theConvertor->GetTimeStampOnMesh(theMeshName, + theEntity, + theFieldName, + theTimeStampNumber); + aPresent->SetUnstructuredGridIDMapper(anUnstructuredGridIDMapper); + + vtkFloatingPointType aRange[] = { 4, 5 }; +cout << "before filter limits set" << endl; + vtkObject::GlobalWarningDisplayOn(); + aPresent->DebugOn(); + aPresent->SetScalarFilterRange( aRange ); + aPresent->UseScalarFiltering( true ); +cout << "after filter set" << endl; + + //aPresent->ClearGeometry(); + //{ + // VISU::PUnstructuredGridIDMapper anIDMapper = + // theConvertor->GetMeshOnGroup(theMeshName, + // "groupe1"); + // aPresent->AddGeometry(anIDMapper->GetOutput()); + //} + //{ + // VISU::PUnstructuredGridIDMapper anIDMapper = + // theConvertor->GetMeshOnGroup(theMeshName, + // "TUBEH "); + // aPresent->AddGeometry(anIDMapper->GetOutput()); + //} + //{ + // VISU::PUnstructuredGridIDMapper anIDMapper = + // theConvertor->GetMeshOnGroup(theMeshName, + // "STRI "); + // aPresent->AddGeometry(anIDMapper->GetOutput()); + //} + aPresent->Update(); +cout << "after update" << endl; + return aPresent; +} //---------------------------------------------------------------------------- @@ -187,106 +377,260 @@ main(int argc, char** argv) const VISU::TMeshMap& aMeshMap = aConvertor->GetMeshMap(); VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin(); if(aMeshMapIter == aMeshMap.end()) return 0; - //Iterate by meshes - for (;aMeshMapIter != aMeshMap.end();aMeshMapIter++) { - - const std::string& theMeshName = aMeshMapIter->first; - if( strcmp(aMeshName, theMeshName.c_str()) ) - continue; - else - isMeshOk = true; - - const VISU::PMesh aMesh = aMeshMapIter->second; - const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; - VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter; - - aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); - //Iterate by meshes on entity - for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) { - const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; - const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; - - const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); - - //Iterate by field - for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ - const VISU::PField aField = aFieldMapIter->second; - const std::string& theFieldName = aFieldMapIter->first; - - if( strcmp(aFieldName, theFieldName.c_str()) ) - continue; - else - isFieldOk = true; - - if(aComponentNumber > aField->myNbComp) - continue; - else - isComponentOk = true; - - const VISU::TValField& aValField = aField->myValField; - VISU::TValField::const_iterator aValFieldIter = aValField.find(aTimeStampNumber); - if(aValFieldIter == aValField.end()) - continue; - else - isTimeStampOk = true; - - int aTimeStamp = aValFieldIter->first; - - vtkActor* anActor = vtkActor::New(); - - if(anEntity != VISU::NODE_ENTITY){ - VISU::PUnstructuredGridIDMapper anUnstructuredGridIDMapper = - aConvertor->GetTimeStampOnMesh(theMeshName, - anEntity, - theFieldName, - aTimeStamp); - - vtkUnstructuredGrid* anUnstructuredGrid = anUnstructuredGridIDMapper->GetUnstructuredGridOutput(); - VISU::WriteToFile( anUnstructuredGrid, "/data/apo/elno_from_id_mapper.vtk" ); - - VISU_ElnoDisassembleFilter* aDisassembleFilter = VISU_ElnoDisassembleFilter::New(); - aDisassembleFilter->SetInput( anUnstructuredGrid ); - aDisassembleFilter->SetShrinkFactor( 0.999 ); - VISU::WriteToFile( aDisassembleFilter->GetOutput(), "/data/apo/elno_from_disassemble.vtk" ); - - vtkCutter *aCutter = vtkCutter::New(); - - vtkPointLocator* aPointLocator = vtkPointLocator::New(); - aCutter->SetLocator( aPointLocator ); - aPointLocator->Delete(); - - TPresent* aPresent = TPresent::New(); - aPresent->SetUnstructuredGridIDMapper( anUnstructuredGridIDMapper ); - //aPresent->SetOrientation( VISU_CutPlanesPL::ZX, 0.0, 0.0, 0 ); - aPresent->Update(); - - aPresent->GetMapper()->InterpolateScalarsBeforeMappingOn(); - anActor->SetMapper( aPresent->GetMapper() ); - - vtkScalarBarActor* aScalarBar = vtkScalarBarActor::New(); - //aScalarBar->SetLookupTable( aMapperTable ); - aScalarBar->SetLookupTable( aPresent->GetBarTable() ); - - - vtkScalarBarWidget* aWidget = vtkScalarBarWidget::New(); - aWidget->SetScalarBarActor( aScalarBar ); - aWidget->SetInteractor( anInteractor ); - aWidget->SetEnabled( true ); - - aRenderer->AddActor(anActor); - aRenderer->AddActor2D(aScalarBar); - }else{ - continue; - } - - aWindow->Render(); - aRenderer->ResetCamera(); - - anInteractor->Start(); - return 0; - } - } + const std::string& aMeshName = aMeshMapIter->first; + const VISU::PMesh aMesh = aMeshMapIter->second; + const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; + VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter; + if(isOnlyMesh){ + const VISU::TEntity& anEntity = VISU::CELL_ENTITY; + aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity); + + VISU::PNamedIDMapper anIDMapper = + aConvertor->GetMeshOnEntity(aMeshName,anEntity); + + VISU_MeshPL* aPresent = VISU_MeshPL::New(); + aPresent->SetUnstructuredGridIDMapper(anIDMapper); + + vtkActor* aActor = vtkActor::New(); + aActor->SetMapper(aPresent->GetMapper()); + aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME); + //aRenderer->ResetCameraClippingRange(); + + aRenderer->AddActor(aActor); + + aWindow->Render(); + anInteractor->Start(); + return 0; + } + //Import fields + aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); + for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) { + const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first; + const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; + const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); + for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ + const VISU::PField aField = aFieldMapIter->second; +// if(aField->myNbComp == 1) +// continue; + const std::string& aFieldName = aFieldMapIter->first; + const VISU::TValField& aValField = aField->myValField; + VISU::TValField::const_reverse_iterator aValFieldIter = aValField.rbegin(); + if(aValFieldIter == aValField.rend()) return 0; + int aTimeStamp = aValFieldIter->first; + + vtkActor* anActor = vtkActor::New(); + VISU_ColoredPL* aPresent = NULL; + if(anEntity == VISU::NODE_ENTITY){ + aPresent = CreateColoredPL(aConvertor, + aMeshName, + anEntity, + aFieldName, + aTimeStamp); + + anActor->SetMapper(aPresent->GetMapper()); + }else{ + continue; + aPresent = CreateColoredPL(aConvertor, + aMeshName, + anEntity, + aFieldName, + aTimeStamp); + + VTKViewer_GeometryFilter* aGeometryFilter = VTKViewer_GeometryFilter::New(); + aGeometryFilter->SetInput(aPresent->GetOutput()); + aGeometryFilter->SetInside(true); + + vtkMaskPoints* aMaskPoints = vtkMaskPoints::New(); + aMaskPoints->SetInput(aGeometryFilter->GetOutput()); + aMaskPoints->SetGenerateVertices(true); + aMaskPoints->SetOnRatio(1); + + VISU_OpenGLPointSpriteMapper* aMapper = VISU_OpenGLPointSpriteMapper::New(); + aMapper->SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( aPresent->GetOutput() ) ); + + char aMainTexture[80]; + strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) ); + strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" ); + + char anAlphaTexture[80]; + strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) ); + strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" ); + + vtkSmartPointer aTextureValue = + VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ); + aMapper->SetImageData( aTextureValue.GetPointer() ); + + //vtkPolyDataMapper* aMapper = vtkPolyDataMapper::New(); + aMapper->SetLookupTable(aPresent->GetMapperTable()); + aMapper->SetUseLookupTableScalarRange(true); + aMapper->SetColorModeToMapScalars(); + aMapper->SetScalarVisibility(true); + + aMapper->SetInput(aMaskPoints->GetOutput()); + aGeometryFilter->Delete(); + + anActor->SetMapper(aMapper); + aMapper->Delete(); + } + + + + + +//RKV:Begin + vtkLookupTable* lut = vtkLookupTable::New(); + int nbColors = aPresent->GetNbColors(); + lut->SetNumberOfTableValues(nbColors); + vtkDataArray* dataArr; + if(VISU::IsDataOnCells(aPresent->GetInput())) { + dataArr = aPresent->GetInput()->GetCellData()->GetScalars(); + } else { + dataArr = aPresent->GetInput()->GetPointData()->GetScalars(); + } + vtkFloatingPointType aRange[2]; + dataArr->GetRange(aRange); + MSG(true, "Range[0]: "<SetTableRange(aRange); + lut->Build(); + MSG(true, "1\n"); + vtkIntArray* distr = vtkIntArray::New(); + distr->SetNumberOfValues(nbColors); + MSG(true, "Number of colors: "<FillComponent(0, 0.); + MSG(true, "2\n"); + int aNbVals = dataArr->GetNumberOfTuples(); + int idx = 0, cnt = 0; + + MSG(true, "3\n"); + for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){ +// MSG(true, "Value: "<< *(dataArr->GetTuple(aValId))); + idx = lut->GetIndex(*(dataArr->GetTuple(aValId))); +// MSG(true, "Value index "<GetValue(idx); + distr->SetValue(idx, cnt + 1); + } + MSG(true, "4\n"); + distr->Modified(); + double range[2]; + distr->GetRange(range); + MSG(true, "DistrRange[0]: " << range[0]); + MSG(true, "DistrRange[1]: " << range[1]); + MSG(true, "5\n"); +// vtkPoints* points = vtkPoints::New(); +// aNbVals = distr->GetNumberOfTuples(); +// points->Allocate(aNbVals); +// double x[3] = {0., 0., 0.}; +/* for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){ + x[0] = aValId; + points->InsertPoint(aValId, x); +*/// MSG(true, "Inserted point "<GetValue(aValId)); +// } +// points->SetData(distr); + +/* vtkPointSet* pset = vtkPolyData::New(); + pset->SetPoints(points); + pset->GetPointData()->SetScalars(distr); +*/ + vtkDataObject *dobj = vtkDataObject::New(); + dobj->GetFieldData()->AddArray(distr); + + vtkXYPlotActor* xyplot = vtkXYPlotActor::New(); +// xyplot->AddInput(pset); + xyplot->AddDataObjectInput(dobj); + xyplot->GetPositionCoordinate()->SetValue(0.0, 0.67, 0); + xyplot->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0); // #relative to Position + xyplot->SetXValuesToIndex(); +// xyplot->SetXValuesToNormalizedArcLength(); +// xyplot->SetXValuesToArcLength(); +// xyplot->SetNumberOfXLabels(0); + xyplot->SetTitle(""); + xyplot->SetXTitle(""); + xyplot->SetYTitle("Distribution"); +// xyplot->ReverseYAxisOn(); +// xyplot->SetDataObjectPlotModeToRows(); + xyplot->SetLabelFormat("%.0f"); + xyplot->SetXRange(0, nbColors-1); + xyplot->SetYRange(range[0], range[1]); +/* int ny = floor(fabs(range[1] - range[0])); + MSG(true, "ny = "<SetNumberOfYLabels(ny); + MSG(true, "nbYLabels = "<GetNumberOfYLabels()); + } +*/ xyplot->GetProperty()->SetColor(1, 1, 1); + xyplot->GetProperty()->SetLineWidth(2); + xyplot->GetProperty()->SetDisplayLocationToForeground(); +/* vtkMatrix4x4 *m = vtkMatrix4x4::New(); + MSG(true, "5.1\n"); + m->Zero(); + MSG(true, "5.2\n"); + m->SetElement(0, 1, 1); + m->SetElement(1, 0, -1); + m->SetElement(2, 2, 1); + m->SetElement(3, 3, 1); + MSG(true, "5.3\n"); + xyplot->PokeMatrix(m); +*/ //# Set text prop color (same color for backward compat with test) + //# Assign same object to all text props + vtkTextProperty* tprop; + tprop = xyplot->GetTitleTextProperty(); + tprop->SetColor(xyplot->GetProperty()->GetColor()); + xyplot->SetAxisTitleTextProperty(tprop); + xyplot->SetAxisLabelTextProperty(tprop); + +//RKV:End + + + MSG(true, "6\n"); + +/*{ + vtkXYPlotWidget* aWidget = vtkXYPlotWidget::New(); + aWidget->SetInteractor( anInteractor ); + aWidget->SetXYPlotActor( xyplot ); + aWidget->SetEnabled( 1 ); +}*/ + + + vtkObject::GlobalWarningDisplayOn(); + + VISU_ScalarBarActor * aScalarBar = VISU_ScalarBarActor::New(); + //vtkScalarBarActor * aScalarBar = vtkScalarBarActor::New(); + aPresent->SetNbColors(5); + aPresent->DebugOn(); + aPresent->Update(); + aScalarBar->SetLookupTable(aPresent->GetBarTable()); + aScalarBar->DebugOn(); + aScalarBar->SetDistribution(aPresent->GetDistribution()); + aScalarBar->DistributionVisibilityOn(); +// aScalarBar->SetOrientationToHorizontal(); +// aScalarBar->GetPositionCoordinate()->SetValue(.1, .6, 0); +// aScalarBar->GetPosition2Coordinate()->SetValue(.8, .3, 0); + +/*{ + vtkScalarBarWidget* aWidget = vtkScalarBarWidget::New(); + aWidget->SetInteractor( anInteractor ); + aWidget->SetScalarBarActor( aScalarBar ); + aWidget->SetEnabled( 1 ); +} +*/ + aRenderer->AddActor(anActor); +// aRenderer->AddActor2D(xyplot); //RKV + aRenderer->AddActor2D(aScalarBar); + + //aRenderer->AddActor2D(barChartActor()); //RKV + + aWindow->Render(); + aRenderer->ResetCamera(); + + anInteractor->Start(); + return 0; + } } } else{ diff --git a/src/PIPELINE/VISU_ColoredPL.cxx b/src/PIPELINE/VISU_ColoredPL.cxx index 0792a90c..decfeff2 100644 --- a/src/PIPELINE/VISU_ColoredPL.cxx +++ b/src/PIPELINE/VISU_ColoredPL.cxx @@ -34,14 +34,21 @@ #include "VISU_PipeLineUtils.hxx" +#include +#include +#include + //---------------------------------------------------------------------------- VISU_ColoredPL ::VISU_ColoredPL(): - myMapperTable(VISU_LookupTable::New()), - myBarTable(VISU_LookupTable::New()), - myExtractor(VISU_Extractor::New()), - myFieldTransform(VISU_FieldTransform::New()) + myMapperTable( VISU_LookupTable::New() ), + myBarTable( VISU_LookupTable::New() ), + myExtractor( VISU_Extractor::New() ), + myFieldTransform( VISU_FieldTransform::New() ), + myThreshold ( vtkThreshold::New() ), + myPassFilter( vtkPassThroughFilter::New() ), + myDistribution( vtkDoubleArray::New() ) { myMapperTable->Delete(); myMapperTable->SetScale(VTK_SCALE_LINEAR); @@ -54,6 +61,11 @@ VISU_ColoredPL myExtractor->Delete(); myFieldTransform->Delete(); + + myThreshold->AllScalarsOn(); + myThreshold->Delete(); + myPassFilter->Delete(); + myDistribution->Delete(); } @@ -74,6 +86,9 @@ VISU_ColoredPL aTime = std::max(aTime, myBarTable->GetMTime()); aTime = std::max(aTime, myExtractor->GetMTime()); aTime = std::max(aTime, myFieldTransform->GetMTime()); + aTime = std::max(aTime, myThreshold->GetMTime()); + aTime = std::max(aTime, myPassFilter->GetMTime()); + aTime = std::max(aTime, myDistribution->GetMTime()); return aTime; } @@ -88,8 +103,12 @@ VISU_ColoredPL Superclass::DoShallowCopy(thePipeLine, theIsCopyInput); if(VISU_ColoredPL *aPipeLine = dynamic_cast(thePipeLine)){ - if(theIsCopyInput) - SetScalarRange(aPipeLine->GetScalarRange()); + if ( theIsCopyInput ) { + SetScalarRange( aPipeLine->GetScalarRange() ); + if ( this->IsScalarFilterUsed() ) + SetScalarFilterRange( aPipeLine->GetScalarFilterRange() ); + } + SetScalarMode(aPipeLine->GetScalarMode()); SetNbColors(aPipeLine->GetNbColors()); SetScaling(aPipeLine->GetScaling()); @@ -135,7 +154,6 @@ VISU_ColoredPL theExtractor->SetScalarMode(theScalarMode); } - //---------------------------------------------------------------------------- void VISU_ColoredPL @@ -148,18 +166,144 @@ VISU_ColoredPL //---------------------------------------------------------------------------- void VISU_ColoredPL -::SetScalarRange(vtkFloatingPointType theRange[2]) +::SetScalarRange( vtkFloatingPointType theRange[2] ) { - if(theRange[0] > theRange[1]) + if ( theRange[0] > theRange[1] ) return; - if(VISU::CheckIsSameRange(GetScalarRange(), theRange)) + if (VISU::CheckIsSameRange( GetScalarRange(), theRange) ) + return; + + myFieldTransform->SetScalarRange( theRange ); + myBarTable->SetRange( theRange ); +} + + +//---------------------------------------------------------------------------- +void +VISU_ColoredPL +::SetScalarFilterRange( vtkFloatingPointType theRange[2] ) +{ + vtkFloatingPointType aRange[ 2 ]; + this->GetScalarFilterRange( aRange ); + + if ( VISU::CheckIsSameRange( aRange, theRange) ) return; - myFieldTransform->SetScalarRange(theRange); - myBarTable->SetRange(theRange); + myThreshold->ThresholdBetween( theRange[0], theRange[1] ); +} + + +//---------------------------------------------------------------------------- +void +VISU_ColoredPL +::GetScalarFilterRange( vtkFloatingPointType theRange[2] ) +{ + theRange[ 0 ] = myThreshold->GetLowerThreshold(); + theRange[ 1 ] = myThreshold->GetUpperThreshold(); +} + + +//---------------------------------------------------------------------------- +vtkFloatingPointType* +VISU_ColoredPL +::GetScalarFilterRange() +{ + static vtkFloatingPointType aRange[ 2 ]; + + this->GetScalarFilterRange( aRange ); + + return aRange; } + +//---------------------------------------------------------------------------- +void +VISU_ColoredPL +::UseScalarFiltering( bool theUseScalarFilter ) +{ + if ( theUseScalarFilter ) { + // Include threshold filter between the transform and the pass filters. + myPassFilter->SetInput( myThreshold->GetOutput() ); + } else { + // Exclude threshold filter before the pass filter. + myPassFilter->SetInput( myFieldTransform->GetOutput() ); + } +} + + +//---------------------------------------------------------------------------- +bool +VISU_ColoredPL +::IsScalarFilterUsed() +{ + return myThreshold->GetOutput() == myPassFilter->GetInput(); +} + + +//---------------------------------------------------------------------------- +vtkDoubleArray* +VISU_ColoredPL +::GetDistribution() +{ + unsigned long int aTime = this->GetMTime(); + // If modified then update the distribution array + if (aTime > myDistribution->GetMTime()) { + // Set number of colors for the distribution + int nbColors = this->GetNbColors(); + this->myDistribution->SetNumberOfValues(nbColors); + // Initialize numbers of colored cells with zero + this->myDistribution->FillComponent(0, 0); + // Create a lookup table to compute a color of a cell + VISU_LookupTable* lut = GetMapperTable(); + vtkFloatingPointType aMapScale = lut->GetMapScale(); + // Get scalar values from the input data to calculate their distribution within cells + vtkDataArray* dataArr; + // Dtermine where we have to take scalars from: cells data or points data. + if(VISU::IsDataOnCells(this->GetOutput())) { + dataArr = this->GetOutput()->GetCellData()->GetScalars(); + } else { + dataArr = this->GetOutput()->GetPointData()->GetScalars(); + } + // If scalars data array is not defined then create an empty one to avoid exceptions + if (dataArr == NULL) { + dataArr = vtkDoubleArray::New(); + } + + // Get range of scalars values +// vtkFloatingPointType aRange[2]; +// dataArr->GetRange(aRange); + + // Build the lookup table with the found range + // Get number of scalar values + int aNbVals = dataArr->GetNumberOfTuples(); + if (aNbVals > 0) { + // Count the number of scalar values for each color in the input data + int idx = 0; + double cnt = 0; + // For each scalar value + for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){ + // Find the color index for this scalar value + idx = lut->GetIndex(*(dataArr->GetTuple(aValId)) * aMapScale); + // Increment the distribution value for this color index + cnt = this->myDistribution->GetValue(idx); + this->myDistribution->SetValue(idx, cnt + 1); + } + // Compute relative values when 1 is according to the total number of scalar values + for(vtkIdType aValId = 0; aValId < nbColors; aValId++){ + cnt = this->myDistribution->GetValue(aValId); + this->myDistribution->SetValue(aValId, cnt / aNbVals); + } + } + this->myDistribution->Modified(); + + } + + return myDistribution; +} +//---------------------------------------------------------------------------- + // RKV : End + //---------------------------------------------------------------------------- vtkFloatingPointType* VISU_ColoredPL @@ -215,7 +359,12 @@ VISU_ColoredPL ::Init() { SetScalarMode(0); - SetSourceRange(); + + vtkFloatingPointType aRange[2]; + GetSourceRange( aRange ); + + SetScalarRange( aRange ); + SetScalarFilterRange( aRange ); } //---------------------------------------------------------------------------- @@ -223,9 +372,9 @@ vtkPointSet* VISU_ColoredPL ::GetClippedInput() { - if(GetFieldTransformFilter()->GetInput()) - GetFieldTransformFilter()->Update(); - return GetFieldTransformFilter()->GetUnstructuredGridOutput(); + if(myPassFilter->GetInput()) + myPassFilter->Update(); + return myPassFilter->GetUnstructuredGridOutput(); } @@ -234,9 +383,14 @@ void VISU_ColoredPL ::Build() { - myExtractor->SetInput(Superclass::GetClippedInput()); + myExtractor->SetInput( Superclass::GetClippedInput() ); myFieldTransform->SetInput(myExtractor->GetOutput()); + myThreshold->SetInput( myFieldTransform->GetOutput() ); + // The pass filter is used here for possibility to include/exclude + // threshold filter before it. + myPassFilter->SetInput( myFieldTransform->GetOutput() ); + GetMapperHolder()->SetLookupTable(GetMapperTable()); //GetMapper()->InterpolateScalarsBeforeMappingOn(); GetMapper()->SetUseLookupTableScalarRange( true ); @@ -343,7 +497,7 @@ VISU_ColoredPL ::GetSourceRange(vtkFloatingPointType theRange[2]) { myExtractor->Update(); - myExtractor->GetOutput()->GetScalarRange(theRange); + myExtractor->GetOutput()->GetScalarRange( theRange ); } void @@ -351,6 +505,6 @@ VISU_ColoredPL ::SetSourceRange() { vtkFloatingPointType aRange[2]; - GetSourceRange(aRange); - SetScalarRange(aRange); + GetSourceRange( aRange ); + SetScalarRange( aRange ); } diff --git a/src/PIPELINE/VISU_ColoredPL.hxx b/src/PIPELINE/VISU_ColoredPL.hxx index e507f140..ada174b8 100644 --- a/src/PIPELINE/VISU_ColoredPL.hxx +++ b/src/PIPELINE/VISU_ColoredPL.hxx @@ -36,9 +36,13 @@ class VISU_Extractor; class VISU_FieldTransform; class VISU_LookupTable; +class vtkPassThroughFilter; +class vtkDoubleArray; +class vtkThreshold; + //---------------------------------------------------------------------------- -class VISU_ColoredPL : public VISU_PipeLine +class VISU_PIPELINE_EXPORT VISU_ColoredPL : public VISU_PipeLine { public: vtkTypeMacro(VISU_ColoredPL, VISU_PipeLine); @@ -62,7 +66,22 @@ public: virtual void - SetScalarRange(vtkFloatingPointType theRange[2]); + SetScalarRange( vtkFloatingPointType theRange[2] ); + + void + SetScalarFilterRange( vtkFloatingPointType theRange[2] ); + + void + GetScalarFilterRange( vtkFloatingPointType theRange[2] ); + + vtkFloatingPointType* + GetScalarFilterRange(); + + bool + IsScalarFilterUsed(); + + void + UseScalarFiltering( bool theUseScalarFilter ); virtual void @@ -80,8 +99,11 @@ public: int GetNbColors(); - //---------------------------------------------------------------------------- + vtkDoubleArray* GetDistribution(); + + public: + //---------------------------------------------------------------------------- virtual void Init(); @@ -157,11 +179,13 @@ protected: VISU_Extractor* theExtractor); private: - vtkSmartPointer myMapperTable; - vtkSmartPointer myBarTable; - vtkSmartPointer myExtractor; - vtkSmartPointer myFieldTransform; - + vtkSmartPointer< VISU_LookupTable > myMapperTable; + vtkSmartPointer< VISU_LookupTable > myBarTable; + vtkSmartPointer< VISU_Extractor > myExtractor; + vtkSmartPointer< VISU_FieldTransform > myFieldTransform; + vtkSmartPointer< vtkThreshold > myThreshold; + vtkSmartPointer< vtkPassThroughFilter > myPassFilter; + vtkSmartPointer< vtkDoubleArray > myDistribution; }; #endif diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index dbd2243a..89b00b02 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -41,6 +41,7 @@ VISU_CutLinesPL ::VISU_CutLinesPL() { SetIsShrinkable(false); + SetIsFeatureEdgesAllowed(false); myCondition = 1; myPosition = 0; diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index a8776eaf..5888942e 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -59,6 +59,7 @@ VISU_CutPlanesPL if(MYDEBUG) MESSAGE("VISU_CutPlanesPL()::VISU_CutPlanesPL() - "<GetDataSetMapper(), theIsCopyInput); + myExtractGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction()); } } @@ -317,6 +318,7 @@ VISU_DataSetMapperHolder if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) { vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction(); aFunction->AddItem(thePlane); + aBoolean->Modified(); // Check, that at least one cell present after clipping. // This check was introduced because of bug IPAL8849. vtkDataSet* aClippedDataSet = GetClippedInput(); @@ -346,6 +348,19 @@ VISU_DataSetMapperHolder return aPlane; } +//---------------------------------------------------------------------------- +void VISU_DataSetMapperHolder::RemoveClippingPlane(vtkIdType theID) +{ + if(theID >= 0 && theID < GetNumberOfClippingPlanes()){ + if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){ + vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction(); + aFunctions->RemoveItem(theID); + aBoolean->Modified(); + } + } +} + + //---------------------------------------------------------------------------- void VISU_DataSetMapperHolder diff --git a/src/PIPELINE/VISU_DataSetMapperHolder.hxx b/src/PIPELINE/VISU_DataSetMapperHolder.hxx index 6588abd9..23f056e6 100644 --- a/src/PIPELINE/VISU_DataSetMapperHolder.hxx +++ b/src/PIPELINE/VISU_DataSetMapperHolder.hxx @@ -134,6 +134,8 @@ public: vtkPlane* GetClippingPlane(vtkIdType theID); + virtual void RemoveClippingPlane(vtkIdType theID); + protected: //---------------------------------------------------------------------------- VISU_DataSetMapperHolder(); diff --git a/src/PIPELINE/VISU_DeformationPL.cxx b/src/PIPELINE/VISU_DeformationPL.cxx deleted file mode 100755 index 88e29868..00000000 --- a/src/PIPELINE/VISU_DeformationPL.cxx +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: VISU_ScalarMapPL.cxx -// Author: Roman NIKOLAEV -// Module : VISU - -//Salome includes -#include "VISU_DeformationPL.hxx" -#include "VISU_MergeFilter.hxx" -#include "VISU_DeformedShapePL.hxx" -#include "VISU_PipeLineUtils.hxx" - -//VTK includes -#include -#include -#include -#include -#include -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - - -//---------------------------------------------------------------------------- -VISU_DeformationPL::VISU_DeformationPL(): - myScaleFactor(1.0), - myMapScaleFactor(1.0) -{ - if(MYDEBUG) MESSAGE("VISU_DeformationPL()::VISU_DeformationPL() - "<SetScaleFactor(myScaleFactor); - - myVectorMergeFilter = VISU_MergeFilter::New(); - myVectorMergeFilter->SetMergingInputs(true); - myInputPassFilter = vtkPassThroughFilter::New(); - myOutputPassFiler = vtkPassThroughFilter::New(); - myCellDataToPointData = vtkCellDataToPointData::New(); - myCellDataToPointData->PassCellDataOn(); - - myInputPassFilter->SetInput(vtkUnstructuredGrid::New()); - - myCellDataToPointData->SetInput(myInputPassFilter->GetOutput()); - - myWarpVector->SetInput(myCellDataToPointData->GetOutput()); - - myOutputPassFiler->SetInput(myWarpVector->GetOutput()); -} - -//---------------------------------------------------------------------------- -VISU_DeformationPL::~VISU_DeformationPL() -{ - if(MYDEBUG) MESSAGE("VISU_DeformationPL()::~VISU_DeformationPL() - "<Delete(); - myVectorMergeFilter->Delete(); - myInputPassFilter->Delete(); - myOutputPassFiler->Delete(); - myCellDataToPointData->Delete(); -} - - -//---------------------------------------------------------------------------- -unsigned long int -VISU_DeformationPL::GetMTime(){ - unsigned long int aTime = std::max(myWarpVector->GetMTime(), - myVectorMergeFilter->GetMTime()); - - aTime = std::max(aTime,myInputPassFilter->GetMTime()); - aTime = std::max(aTime,myOutputPassFiler->GetMTime()); - aTime = std::max(aTime,myCellDataToPointData->GetMTime()); - return 0; -} - -//---------------------------------------------------------------------------- -void VISU_DeformationPL::SetScale(vtkFloatingPointType theScaleFactor) -{ - if(myScaleFactor == theScaleFactor) - return; - myScaleFactor = theScaleFactor; - myWarpVector->SetScaleFactor(myScaleFactor*myMapScaleFactor); -} - -void VISU_DeformationPL::SetMapScale(vtkFloatingPointType theMapScaleFactor) -{ - if(myMapScaleFactor == theMapScaleFactor) - return; - myMapScaleFactor = theMapScaleFactor; - - myWarpVector->SetScaleFactor(myScaleFactor*myMapScaleFactor); -} - - -vtkFloatingPointType VISU_DeformationPL::GetScale() -{ - return myScaleFactor; -} - -//---------------------------------------------------------------------------- -void VISU_DeformationPL::SetWarpVectorInput(vtkDataSet *theInput) -{ - myInputPassFilter->SetInput(theInput); -} - -//---------------------------------------------------------------------------- -vtkDataSet* VISU_DeformationPL::GetWarpVectorOutput() -{ - return myOutputPassFiler->GetOutput(); -} - -//---------------------------------------------------------------------------- -void VISU_DeformationPL::SetMergeFilterInput(vtkDataSet* ScalarInput, - vtkDataSet* VectorialInput) -{ - myVectorMergeFilter->SetScalars(ScalarInput); - myVectorMergeFilter->AddField("VISU_CELLS_MAPPER",ScalarInput); - myVectorMergeFilter->AddField("VISU_POINTS_MAPPER",ScalarInput); - - myVectorMergeFilter->SetGeometry(VectorialInput); - myVectorMergeFilter->SetVectors(VectorialInput); -} - -//---------------------------------------------------------------------------- -vtkDataSet* VISU_DeformationPL::GetMergeFilterOutput(){ - return myVectorMergeFilter->GetOutput(); -} - -//---------------------------------------------------------------------------- -vtkFloatingPointType VISU_DeformationPL::GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine) -{ - if(!thePipeLine || !thePipeLine->GetMergeFilterOutput()) - return 0.0; - - vtkFloatingPointType aSourceRange[2]; - thePipeLine->GetMergeFilterOutput()->GetScalarRange(aSourceRange); - - static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT; - if(fabs(aSourceRange[1]) > EPS){ - vtkDataSet* aDataSet = thePipeLine->GetMergeFilterOutput(); - vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor(aDataSet); - return aScaleFactor / aSourceRange[1]; - } - return 0.0; -} - diff --git a/src/PIPELINE/VISU_DeformationPL.hxx b/src/PIPELINE/VISU_DeformationPL.hxx deleted file mode 100755 index e18f43e3..00000000 --- a/src/PIPELINE/VISU_DeformationPL.hxx +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VISU_DeformationPL.hxx -// Author : -// Module : SALOME - -#ifndef VISU_DeformationPL_HeaderFile -#define VISU_DeformationPL_HeaderFile - -#include "VISUPipeline.hxx" -#include "VISU_MapperHolder.hxx" -#include - -class vtkDataSet; -class VISU_MergeFilter; -class vtkPassThroughFilter; -class vtkWarpVector; -class vtkCellDataToPointData; - -class VISU_PIPELINE_EXPORT VISU_DeformationPL { - -public: - VISU_DeformationPL(); - virtual ~VISU_DeformationPL(); - - //----------------------------------------------------------- - virtual void SetScale(vtkFloatingPointType theScaleFactor); - virtual void SetMapScale(vtkFloatingPointType theMapScaleFactor); - virtual vtkFloatingPointType GetScale(); - - //----------------------------------------------------------- - virtual void SetVectorialField(VISU::PUnstructuredGridIDMapper theIdMapper) = 0; - virtual VISU::PUnstructuredGridIDMapper getVectorialField() = 0; - - - //----------------------------------------------------------- - virtual - unsigned - long int - GetMTime(); - - static vtkFloatingPointType GetDefaultScaleFactor(VISU_DeformationPL *thePipeLine); - - void SetWarpVectorInput(vtkDataSet *theInput); - vtkDataSet* GetWarpVectorOutput(); - - //----------------------------------------------------------- - void SetMergeFilterInput(vtkDataSet* ScalarInput, - vtkDataSet* VectorialInput); - - vtkDataSet* GetMergeFilterOutput(); - -protected: - - VISU::PUnstructuredGridIDMapper myVectorialField; - vtkWarpVector *myWarpVector; - vtkSmartPointer myVectorMergeFilter; - vtkPassThroughFilter *myInputPassFilter; - vtkPassThroughFilter *myOutputPassFiler; - vtkCellDataToPointData *myCellDataToPointData; - -private: - vtkFloatingPointType myScaleFactor; - vtkFloatingPointType myMapScaleFactor; - -}; - -#endif diff --git a/src/PIPELINE/VISU_DeformedGridPL.cxx b/src/PIPELINE/VISU_DeformedGridPL.cxx deleted file mode 100644 index 72f40c58..00000000 --- a/src/PIPELINE/VISU_DeformedGridPL.cxx +++ /dev/null @@ -1,238 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File: VISU_DeformedGridPL.cxx -// Author: Alexey PETROV -// Module : VISU - - -#include "VISU_DeformedGridPL.hxx" -#include "VISU_FieldTransform.hxx" -#include "VISU_Plot3DPL.hxx" - -#include "VISU_PipeLineUtils.hxx" - -#include -#include -#include - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VISU_DeformedGridPL); - - -//---------------------------------------------------------------------------- -VISU_DeformedGridPL -::VISU_DeformedGridPL(): - myContourFilter(vtkContourFilter::New()), - myWarpScalar(vtkWarpScalar::New()), - myIsContour(false), - myScaleFactor(1.0), - myMapScaleFactor(1.0) -{ - SetIsShrinkable(false); - SetNumberOfContours(32); -} - - -//---------------------------------------------------------------------------- -VISU_DeformedGridPL -::~VISU_DeformedGridPL() -{} - - -//---------------------------------------------------------------------------- -unsigned long int -VISU_DeformedGridPL -::GetMTime() -{ - unsigned long int aTime = Superclass::GetMTime(); - - aTime = std::max(aTime, myContourFilter->GetMTime()); - aTime = std::max(aTime, myWarpScalar->GetMTime()); - - return aTime; -} - - -//---------------------------------------------------------------------------- -unsigned long int -VISU_DeformedGridPL -::GetMemorySize() -{ - unsigned long int aSize = Superclass::GetMemorySize(); - - if(vtkDataObject* aDataObject = myContourFilter->GetInput()) - aSize += aDataObject->GetActualMemorySize() * 1024; - - if(vtkDataObject* aDataObject = myWarpScalar->GetInput()) - aSize += aDataObject->GetActualMemorySize() * 1024; - - return aSize; -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput) -{ - Superclass::DoShallowCopy(thePipeLine, theIsCopyInput); - - if(VISU_DeformedGridPL *aPipeLine = dynamic_cast(thePipeLine)){ - SetScaleFactor( aPipeLine->GetScaleFactor() ); - SetContourPrs( aPipeLine->GetIsContourPrs() ); - SetNumberOfContours( aPipeLine->GetNumberOfContours() ); - } -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::Init() -{ - Superclass::Init(); - - vtkPointSet* aPointSet = GetFieldTransformFilter()->GetPolyDataOutput(); - SetScaleFactor( VISU_Plot3DPL::GetScaleFactor( this, aPointSet ) ); -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::Build() -{ - Superclass::Build(); - - myWarpScalar->SetInput( GetFieldTransformFilter()->GetPolyDataOutput() ); - GetPolyDataMapper()->SetInput( myWarpScalar->GetPolyDataOutput() ); -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::Update() -{ - vtkPointSet* aPointSet = GetFieldTransformFilter()->GetPolyDataOutput(); - if ( !myIsContour ) // surface prs - { - myWarpScalar->SetInput( aPointSet ); - } - else // contour prs - { - myContourFilter->SetInput( aPointSet ); - - vtkFloatingPointType aScalarRange[2]; - GetSourceRange( aScalarRange ); - - myContourFilter->GenerateValues( GetNumberOfContours(), aScalarRange ); - myWarpScalar->SetInput( myContourFilter->GetOutput() ); - } - - Superclass::Update(); -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::SetNumberOfContours(int theNumber) -{ - myContourFilter->SetNumberOfContours(theNumber); -} - - -//---------------------------------------------------------------------------- -int -VISU_DeformedGridPL -::GetNumberOfContours() -{ - return myContourFilter->GetNumberOfContours(); -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::SetScaleFactor(vtkFloatingPointType theScaleFactor) -{ - if ( VISU::CheckIsSameValue( myWarpScalar->GetScaleFactor(), theScaleFactor ) ) - return; - - myScaleFactor = theScaleFactor; - myWarpScalar->SetScaleFactor(theScaleFactor*myMapScaleFactor); -} - - -//---------------------------------------------------------------------------- -vtkFloatingPointType -VISU_DeformedGridPL -::GetScaleFactor() -{ - return myScaleFactor; -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::SetContourPrs(bool theIsContourPrs ) -{ - if(myIsContour == theIsContourPrs) - return; - - myIsContour = theIsContourPrs; - Modified(); -} - - -//---------------------------------------------------------------------------- -bool -VISU_DeformedGridPL -::GetIsContourPrs() -{ - return myIsContour; -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedGridPL -::SetMapScale(vtkFloatingPointType theMapScale) -{ - Superclass::SetMapScale(theMapScale); - myMapScaleFactor = theMapScale; - - if ( myIsContour ) { - vtkFloatingPointType aSourceRange[2]; - GetSourceRange( aSourceRange ); - vtkFloatingPointType aDeltaRange = aSourceRange[1] - aSourceRange[0]; - vtkFloatingPointType aNewRange[2] = { aSourceRange[1] - theMapScale*aDeltaRange, aSourceRange[1] }; - myContourFilter->GenerateValues( GetNumberOfContours(), aNewRange ); - } - - myWarpScalar->SetScaleFactor( myScaleFactor * theMapScale ); -} diff --git a/src/PIPELINE/VISU_DeformedGridPL.hxx b/src/PIPELINE/VISU_DeformedGridPL.hxx deleted file mode 100644 index 4f325949..00000000 --- a/src/PIPELINE/VISU_DeformedGridPL.hxx +++ /dev/null @@ -1,117 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: VISU_ScalarMapPL.hxx -// Author: Alexey PETROV -// Module : VISU - -#ifndef VISU_DeformedGridPL_HeaderFile -#define VISU_DeformedGridPL_HeaderFile - -#include "VISUPipeline.hxx" -#include "VISU_PolyDataPL.hxx" - -class vtkWarpScalar; -class vtkContourFilter; - - -//---------------------------------------------------------------------------- -class VISU_PIPELINE_EXPORT VISU_DeformedGridPL : public VISU_PolyDataPL -{ -public: - vtkTypeMacro(VISU_DeformedGridPL, VISU_PolyDataPL); - - static - VISU_DeformedGridPL* - New(); - - //---------------------------------------------------------------------------- - virtual - unsigned long int - GetMTime(); - - //! Gets memory size used by the instance (bytes). - virtual - unsigned long int - GetMemorySize(); - - //---------------------------------------------------------------------------- - void - SetScaleFactor( vtkFloatingPointType theScaleFactor ); - - vtkFloatingPointType - GetScaleFactor(); - - void - SetContourPrs( bool theIsContourPrs ); - - bool - GetIsContourPrs(); - - void - SetNumberOfContours( int theNumber ); - - int - GetNumberOfContours(); - - virtual - void - SetMapScale(vtkFloatingPointType theMapScale = 1.0); - - //---------------------------------------------------------------------------- - virtual - void - Init(); - - virtual - void - Update(); - -protected: - //---------------------------------------------------------------------------- - VISU_DeformedGridPL(); - - virtual - ~VISU_DeformedGridPL(); - - virtual - void - Build(); - - virtual - void - DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput); - -private: - VISU_DeformedGridPL(const VISU_DeformedGridPL&); // Not implemented. - void operator=(const VISU_DeformedGridPL&); // Not implemented. - - vtkFloatingPointType myScaleFactor; - vtkFloatingPointType myMapScaleFactor; - vtkContourFilter* myContourFilter; - vtkWarpScalar *myWarpScalar; - bool myIsContour; -}; - -#endif diff --git a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx deleted file mode 100644 index b807671e..00000000 --- a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx +++ /dev/null @@ -1,372 +0,0 @@ -// VISU DeformedShapeAndScalarMapPL -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File: VISU_DeformedShapeAndScalarMapPL.cxx -// Author: Eugeny Nikolaev -// Module : VISU - -#include "VISU_DeformedShapeAndScalarMapPL.hxx" -#include "VISU_FieldTransform.hxx" -#include "VISU_Extractor.hxx" -#include "VISU_LookupTable.hxx" -#include "VISU_DeformedShapePL.hxx" -#include "VTKViewer_TransformFilter.h" -#include "VTKViewer_Transform.h" -#include "VISU_MergeFilter.hxx" -#include "VISU_ElnoDisassembleFilter.hxx" -#include "VISU_PipeLineUtils.hxx" - -#include -#include -#include -#include - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VISU_DeformedShapeAndScalarMapPL) - -//---------------------------------------------------------------------------- -/*! - * Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid - * Where: - * \li myDeformVectors is vtkWarpVector - deformation vectors data - * \li myScalarsMergeFilter is vtkMergeFilter - merge filter. - * Merge filter which unify the deformation and scalars - * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data -*/ -VISU_DeformedShapeAndScalarMapPL -::VISU_DeformedShapeAndScalarMapPL(): - myScaleFactor(1.0), - myMapScaleFactor(1.0) -{ - myWarpVector = vtkWarpVector::New(); - - myScalarsMergeFilter = VISU_MergeFilter::New(); - myScalarsMergeFilter->SetMergingInputs(true); - - myScalarsExtractor = VISU_Extractor::New(); - - myScalarsFieldTransform = VISU_FieldTransform::New(); - - myCellDataToPointData = vtkCellDataToPointData::New(); - myScalarsElnoDisassembleFilter = VISU_ElnoDisassembleFilter::New(); -} - -//---------------------------------------------------------------------------- -/*! - * Destructor. - * Delete all fields. -*/ -VISU_DeformedShapeAndScalarMapPL -::~VISU_DeformedShapeAndScalarMapPL() -{ - myWarpVector->Delete(); - - myScalarsMergeFilter->Delete(); - - myScalarsExtractor->Delete(); - - myScalarsFieldTransform->Delete(); - - myCellDataToPointData->Delete(); -} - -//---------------------------------------------------------------------------- -/*! - * Initial method - */ -void -VISU_DeformedShapeAndScalarMapPL -::Init() -{ - Superclass::Init(); - - SetScale(VISU_DeformedShapePL::GetDefaultScale(this)); -} - -//---------------------------------------------------------------------------- -/*! - * Build method - * Building of deformation and puts result to merge filter. - */ -void -VISU_DeformedShapeAndScalarMapPL -::Build() -{ - Superclass::Build(); -} - - -//---------------------------------------------------------------------------- -vtkDataSet* -VISU_DeformedShapeAndScalarMapPL -::InsertCustomPL() -{ - GetMapper()->SetColorModeToMapScalars(); - GetMapper()->ScalarVisibilityOn(); - - VISU::CellDataToPoint(myWarpVector, - myCellDataToPointData, - GetMergedInput()); - - myScalars = GetMergedInput(); - - UpdateScalars(); - - myScalarsFieldTransform->SetInput(myScalarsExtractor->GetOutput()); - - // Sets geometry for merge filter - myScalarsMergeFilter->SetGeometry(myWarpVector->GetUnstructuredGridOutput()); - - vtkDataSet* aScalarsDataSet = myScalarsFieldTransform->GetOutput(); - myScalarsMergeFilter->SetScalars(aScalarsDataSet); - myScalarsMergeFilter->AddField("VISU_CELLS_MAPPER", aScalarsDataSet); - myScalarsMergeFilter->AddField("VISU_POINTS_MAPPER", aScalarsDataSet); - - return myScalarsMergeFilter->GetOutput(); -} - - -//---------------------------------------------------------------------------- -/*! - * Update method - */ -void -VISU_DeformedShapeAndScalarMapPL -::Update() -{ - Superclass::Update(); - //{ - // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsExtractor.vtk"; - // VISU::WriteToFile(myScalarsExtractor->GetUnstructuredGridOutput(), aFileName); - //} - //{ - // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk"; - // VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName); - //} - //{ - // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsMergeFilter.vtk"; - // VISU::WriteToFile(myScalarsMergeFilter->GetUnstructuredGridOutput(), aFileName); - //} -} - -//---------------------------------------------------------------------------- -unsigned long int -VISU_DeformedShapeAndScalarMapPL -::GetMemorySize() -{ - unsigned long int aSize = Superclass::GetMemorySize(); - - if(vtkDataSet* aDataSet = myWarpVector->GetOutput()) - aSize += aDataSet->GetActualMemorySize() * 1024; - - if(vtkDataSet* aDataSet = myScalarsExtractor->GetOutput()) - aSize += aDataSet->GetActualMemorySize() * 1024; - - if(vtkDataSet* aDataSet = myScalarsMergeFilter->GetOutput()) - aSize += aDataSet->GetActualMemorySize() * 1024; - - if(myCellDataToPointData->GetInput()) - if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput()) - aSize += aDataSet->GetActualMemorySize() * 1024; - - return aSize; -} - -//---------------------------------------------------------------------------- -/*! - * Update scalars method. - * Put scalars to merge filter. - */ -void -VISU_DeformedShapeAndScalarMapPL -::UpdateScalars() -{ - vtkDataSet* aScalars = GetScalars(); - myScalarsElnoDisassembleFilter->SetInput(aScalars); - myScalarsExtractor->SetInput(myScalarsElnoDisassembleFilter->GetOutput()); - - if(VISU::IsDataOnCells(myScalarsElnoDisassembleFilter->GetOutput())) - GetMapper()->SetScalarModeToUseCellData(); - else - GetMapper()->SetScalarModeToUsePointData(); -} - -//---------------------------------------------------------------------------- -/*! - * Copy information about pipline. - * Copy scale and scalars. - */ -void -VISU_DeformedShapeAndScalarMapPL -::DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput) -{ - Superclass::DoShallowCopy(thePipeLine, theIsCopyInput); - - if(VISU_DeformedShapeAndScalarMapPL *aPipeLine = dynamic_cast(thePipeLine)){ - SetScale(aPipeLine->GetScale()); - SetScalars(aPipeLine->GetScalars()); - } -} - -//---------------------------------------------------------------------------- -/*! - * Set scalars. - * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction. - */ -void -VISU_DeformedShapeAndScalarMapPL -::SetScalars(vtkDataSet *theScalars) -{ - if(GetScalars() == theScalars) - return; - - myScalars = theScalars; - UpdateScalars(); -} - -//---------------------------------------------------------------------------- -/*! - * Get pointer to input scalars. - */ -vtkDataSet* -VISU_DeformedShapeAndScalarMapPL -::GetScalars() -{ - return myScalars.GetPointer(); -} - -//---------------------------------------------------------------------------- -/*! - * Sets scale for deformed shape - */ -void -VISU_DeformedShapeAndScalarMapPL -::SetScale(vtkFloatingPointType theScale) -{ - if(VISU::CheckIsSameValue(myScaleFactor, theScale)) - return; - - myScaleFactor = theScale; - myWarpVector->SetScaleFactor(theScale*myMapScaleFactor); -} - -//---------------------------------------------------------------------------- -/*! - * Gets scale of deformed shape. - */ -vtkFloatingPointType -VISU_DeformedShapeAndScalarMapPL -::GetScale() -{ - return myScaleFactor; -} - -//---------------------------------------------------------------------------- -/*! - * Set scale factor of deformation. - */ -void -VISU_DeformedShapeAndScalarMapPL -::SetMapScale(vtkFloatingPointType theMapScale) -{ - myMapScaleFactor = theMapScale; - Superclass::SetMapScale(theMapScale); - myWarpVector->SetScaleFactor(myScaleFactor*theMapScale); -} - -//---------------------------------------------------------------------------- -/*! - * Gets scalar mode. - */ -int -VISU_DeformedShapeAndScalarMapPL -::GetScalarMode() -{ - return myScalarsExtractor->GetScalarMode(); -} - -//---------------------------------------------------------------------------- -/*! - * Sets scalar mode. - */ -void -VISU_DeformedShapeAndScalarMapPL -::SetScalarMode(int theScalarMode) -{ - VISU_ScalarMapPL::SetScalarMode(theScalarMode, GetScalars(), myScalarsExtractor); -} - -//---------------------------------------------------------------------------- -void -VISU_DeformedShapeAndScalarMapPL -::SetScaling(int theScaling) -{ - if(GetScaling() == theScaling) - return; - - GetBarTable()->SetScale(theScaling); - - if(theScaling == VTK_SCALE_LOG10) - myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10)); - else - myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident)); -} - - -//---------------------------------------------------------------------------- -void -VISU_DeformedShapeAndScalarMapPL -::SetScalarRange(vtkFloatingPointType theRange[2]) -{ - if(VISU::CheckIsSameRange(theRange, GetScalarRange())) - return; - - myScalarsFieldTransform->SetScalarRange(theRange); - GetBarTable()->SetRange(theRange); -} - - -//---------------------------------------------------------------------------- -vtkFloatingPointType* -VISU_DeformedShapeAndScalarMapPL -::GetScalarRange() -{ - return myScalarsFieldTransform->GetScalarRange(); -} - - -//---------------------------------------------------------------------------- -/*! - * Gets ranges of extracted scalars - * \param theRange[2] - output values - * \li theRange[0] - minimum value - * \li theRange[1] - maximum value - */ -void -VISU_DeformedShapeAndScalarMapPL -::GetSourceRange(vtkFloatingPointType theRange[2]) -{ - myScalarsExtractor->Update(); - myScalarsExtractor->GetUnstructuredGridOutput()->GetScalarRange(theRange); -} diff --git a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx deleted file mode 100644 index b3d454a2..00000000 --- a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx +++ /dev/null @@ -1,149 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File: VISU_DeformedShapeAndScalarMapPL.hxx -// Author: Eugeny Nikolaev -// Module : VISU - -#ifndef VISU_DeformedShapeAndScalarMapPL_HeaderFile -#define VISU_DeformedShapeAndScalarMapPL_HeaderFile - -#include "VISUPipeline.hxx" -#include "VISU_ScalarMapPL.hxx" - -class VISU_MergeFilter; -class vtkWarpVector; -class vtkUnstructuredGrid; -class vtkCellDataToPointData; -class vtkPointDataToCellData; -class VISU_ElnoDisassembleFilter; - - -//---------------------------------------------------------------------------- -class VISU_PIPELINE_EXPORT VISU_DeformedShapeAndScalarMapPL : public VISU_ScalarMapPL -{ -public: - vtkTypeMacro(VISU_DeformedShapeAndScalarMapPL, VISU_ScalarMapPL); - - static - VISU_DeformedShapeAndScalarMapPL* - New(); - - virtual - void - SetScale(vtkFloatingPointType theScale); - - virtual - vtkFloatingPointType - GetScale(); - - virtual - int - GetScalarMode(); - - virtual - void - SetScalarMode(int theScalarMode = 0); - - virtual - void - SetScaling(int theScaling); - - virtual - void - SetScalarRange(vtkFloatingPointType theRange[2]); - - virtual - vtkFloatingPointType* - GetScalarRange(); - - virtual - void - GetSourceRange(vtkFloatingPointType theRange[2]); - - virtual - void - SetScalars(vtkDataSet *theScalars); - - virtual - vtkDataSet* - GetScalars(); - -public: - //! Redefined method for initialization of the pipeline. - virtual - void - Init(); - - //! Redefined method for building the pipeline. - virtual - void - Build(); - - //! Redefined method for updating the pipeline. - virtual - void - Update(); - - //! Gets memory size used by the instance (bytes). - virtual - unsigned long int - GetMemorySize(); - - //! Update scalars. - void - UpdateScalars(); - - virtual - void - SetMapScale(vtkFloatingPointType theMapScale = 1.0); - -protected: - VISU_DeformedShapeAndScalarMapPL(); - - virtual - ~VISU_DeformedShapeAndScalarMapPL(); - - virtual - vtkDataSet* - InsertCustomPL(); - - virtual - void - DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput); - -private: - VISU_DeformedShapeAndScalarMapPL(const VISU_DeformedShapeAndScalarMapPL&); - - vtkFloatingPointType myScaleFactor; - vtkFloatingPointType myMapScaleFactor; - vtkWarpVector *myWarpVector; - VISU_MergeFilter *myScalarsMergeFilter; - vtkSmartPointer myScalars; - vtkCellDataToPointData* myCellDataToPointData; - VISU_FieldTransform* myScalarsFieldTransform; - VISU_Extractor* myScalarsExtractor; - VISU_ElnoDisassembleFilter* myScalarsElnoDisassembleFilter; -}; - -#endif diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 2a7f2c6a..b17f86b8 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -43,6 +43,7 @@ VISU_DeformedShapePL myMapScaleFactor(1.0) { SetIsShrinkable(true); + SetIsFeatureEdgesAllowed(true); myWarpVector = vtkWarpVector::New(); myCellDataToPointData = vtkCellDataToPointData::New(); @@ -110,6 +111,8 @@ VISU_DeformedShapePL aVolume *= aVol; } } + if( aNbElem == 0 || fabs(idim) < 1.0 / VTK_LARGE_FLOAT ) + return 0.0; // to avoid division by zero aVolume /= aNbElem; return pow(aVolume, vtkFloatingPointType(1.0/idim)); } diff --git a/src/PIPELINE/VISU_ElnoAssembleFilter.cxx b/src/PIPELINE/VISU_ElnoAssembleFilter.cxx deleted file mode 100644 index be843ed3..00000000 --- a/src/PIPELINE/VISU_ElnoAssembleFilter.cxx +++ /dev/null @@ -1,171 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#include "VISU_ElnoAssembleFilter.hxx" -#include "VISU_PipeLineUtils.hxx" -#include "VISU_ElnoMeshValue.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro( VISU_ElnoAssembleFilter ); - - -//---------------------------------------------------------------------------- -VISU_ElnoAssembleFilter::VISU_ElnoAssembleFilter() -{ - this->SetInputArrayToProcess( 0, // idx - 0, // port - 0, // connection - vtkDataObject::FIELD_ASSOCIATION_POINTS, // field association - "ELNO_POINT_COORDS" ); // name - - this->myIsRestorePoints = false; -} - - -//---------------------------------------------------------------------------- -VISU_ElnoAssembleFilter::~VISU_ElnoAssembleFilter() -{} - - -//---------------------------------------------------------------------------- -void VISU_ElnoAssembleFilter::SetElnoAssembleState( bool theIsRestorePoints ) -{ - if ( myIsRestorePoints == theIsRestorePoints ) - return; - - myIsRestorePoints = theIsRestorePoints; - this->Modified(); -} - -//---------------------------------------------------------------------------- -namespace -{ - //---------------------------------------------------------------------------- - template < int points_type, int elno_type > - int Execute2( vtkPointSet *theInput, - vtkPointSet *theOutput, - vtkDataArray *theElnoPointCoords ) - { - theOutput->CopyStructure( theInput ); - - vtkCellData *aCellData = theOutput->GetCellData(); - aCellData->PassData( theInput->GetCellData() ); - - vtkPointData *aPointData = theOutput->GetPointData(); - aPointData->PassData( theInput->GetPointData() ); - - vtkPoints *anInputPoints = theInput->GetPoints(); - vtkPoints *aPoints = anInputPoints->New( elno_type ); - vtkIdType aNbPoints = theInput->GetNumberOfPoints(); - aPoints->SetNumberOfPoints( aNbPoints ); - - typedef typename VISU::TL::TEnum2VTKArrayType< elno_type >::TResult TPointsDataArray; - typedef typename VISU::TL::TEnum2VTKBasicType< elno_type >::TResult TPointsDataType; - TPointsDataArray* anOutputPointsArray = TPointsDataArray::SafeDownCast( aPoints->GetData() ); - - TPointsDataArray* anElnoPointCoords = TPointsDataArray::SafeDownCast( theElnoPointCoords ); - - for ( vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++ ) { - TPointsDataType aCoords[ 3 ]; - anElnoPointCoords->GetTupleValue( aPointId, aCoords ); - anOutputPointsArray->SetTupleValue( aPointId, aCoords ); - } - - theOutput->SetPoints( aPoints ); - - return 1; - } - - - //---------------------------------------------------------------------------- - template < int points_type > - int Execute( vtkPointSet *theInput, - vtkPointSet *theOutput, - vtkDataArray *theElnoPointCoords ) - { - switch( theElnoPointCoords->GetDataType() ){ - case VTK_DOUBLE: - return Execute2< points_type, VTK_DOUBLE >( theInput, theOutput, theElnoPointCoords ); - case VTK_FLOAT: - return Execute2< points_type, VTK_FLOAT >( theInput, theOutput, theElnoPointCoords ); - case VTK_INT: - return Execute2< points_type, VTK_INT >( theInput, theOutput, theElnoPointCoords ); - case VTK_LONG: - return Execute2< points_type, VTK_LONG >( theInput, theOutput, theElnoPointCoords ); - default: - break; - } - - return 0; - } - - - //---------------------------------------------------------------------------- -} - - -//---------------------------------------------------------------------------- -int VISU_ElnoAssembleFilter::RequestData( vtkInformation *vtkNotUsed(request), - vtkInformationVector **inputVector, - vtkInformationVector *outputVector ) -{ - // get the info objects - vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); - vtkInformation *outInfo = outputVector->GetInformationObject(0); - - // get the input and ouptut - vtkPointSet *anInput = vtkPointSet::SafeDownCast( inInfo->Get( vtkDataObject::DATA_OBJECT() ) ); - vtkPointSet *anOutput = vtkPointSet::SafeDownCast( outInfo->Get( vtkDataObject::DATA_OBJECT() ) ); - - vtkDataArray *anElnoPointCoords = this->GetInputArrayToProcess( 0, inputVector ); - - if ( !myIsRestorePoints || !anElnoPointCoords ) { - anOutput->ShallowCopy( anInput ); - return 1; - } - - vtkPoints *aPoints = anInput->GetPoints(); - switch( aPoints->GetDataType() ){ - case VTK_DOUBLE: - return ::Execute< VTK_DOUBLE >( anInput, anOutput, anElnoPointCoords ); - case VTK_FLOAT: - return ::Execute< VTK_FLOAT >( anInput, anOutput, anElnoPointCoords ); - case VTK_INT: - return ::Execute< VTK_INT >( anInput, anOutput, anElnoPointCoords ); - case VTK_LONG: - return ::Execute< VTK_LONG >( anInput, anOutput, anElnoPointCoords ); - default: - break; - } - - return 0; -} - - -//---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_ElnoAssembleFilter.hxx b/src/PIPELINE/VISU_ElnoAssembleFilter.hxx deleted file mode 100644 index 8f586c66..00000000 --- a/src/PIPELINE/VISU_ElnoAssembleFilter.hxx +++ /dev/null @@ -1,47 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef VISU_ElnoAssembleFilter_H -#define VISU_ElnoAssembleFilter_H - -#include - -class VISU_ElnoAssembleFilter : public vtkPointSetAlgorithm -{ -public: - typedef vtkPointSetAlgorithm Superclass; - - static VISU_ElnoAssembleFilter *New(); - - void SetElnoAssembleState( bool theIsRestorePoints ); - -protected: - VISU_ElnoAssembleFilter(); - ~VISU_ElnoAssembleFilter(); - - int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); - - bool myIsRestorePoints; - -private: - VISU_ElnoAssembleFilter(const VISU_ElnoAssembleFilter&); // Not implemented. - void operator=(const VISU_ElnoAssembleFilter&); // Not implemented. -}; - -#endif diff --git a/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx b/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx deleted file mode 100644 index eb84ca41..00000000 --- a/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx +++ /dev/null @@ -1,400 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#include "VISU_ElnoDisassembleFilter.hxx" -#include "VISU_PipeLineUtils.hxx" -#include "VISU_ElnoMeshValue.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro( VISU_ElnoDisassembleFilter ); - - -//---------------------------------------------------------------------------- -VISU_ElnoDisassembleFilter::VISU_ElnoDisassembleFilter() -{ - this->SetInputArrayToProcess( 0, // idx - 0, // port - 0, // connection - vtkDataObject::FIELD_ASSOCIATION_CELLS, // field association - "ELNO_FIELD" ); // name - - this->SetInputArrayToProcess( 1, // idx - 0, // port - 0, // connection - vtkDataObject::FIELD_ASSOCIATION_CELLS, // field association - "ELNO_COMPONENT_MAPPER" ); // name - - this->myShrinkFactor = -0.999; -} - - -//---------------------------------------------------------------------------- -VISU_ElnoDisassembleFilter::~VISU_ElnoDisassembleFilter() -{} - - -//---------------------------------------------------------------------------- -void VISU_ElnoDisassembleFilter::SetShrinkFactor( vtkFloatingPointType theValue ) -{ - if ( VISU::CheckIsSameValue( theValue, myShrinkFactor ) ) - return; - - myShrinkFactor = theValue; - this->Modified(); -} - - -//---------------------------------------------------------------------------- -vtkFloatingPointType VISU_ElnoDisassembleFilter::GetShrinkFactor() -{ - return myShrinkFactor; -} - - -//---------------------------------------------------------------------------- -namespace -{ - //---------------------------------------------------------------------------- - template < int points_type, int elno_type > - struct TExecute2 - { - vtkUnstructuredGrid *myInput; - vtkUnstructuredGrid *myOutput; - vtkDataArray *myElnoDataArray; - vtkDataArray *myElnoDataMapper; - vtkFloatingPointType myShrinkFactor; - - typedef typename VISU::TL::TEnum2VTKArrayType< points_type >::TResult TPointsDataArray; - typedef typename VISU::TL::TEnum2VTKBasicType< points_type >::TResult TPointsDataType; - - typedef typename VISU::TL::TEnum2VTKArrayType< elno_type >::TResult TElnoDataArray; - typedef typename VISU::TL::TEnum2VTKBasicType< elno_type >::TResult TElnoDataType; - - VISU::TGetElnoNodeData< elno_type > myGetElnoNodeData; - vtkCellArray *myConnectivity; - vtkPointData *myInputPointData; - vtkPointData *myOutputPointData; - TPointsDataArray *myInputPointsArray; - TPointsDataArray *myOutputPointsArray; - TElnoDataArray* myElnoFullDataArray; - TElnoDataArray* myElnoPartialDataArray; - TPointsDataArray *myElnoPointCoords; - vtkIntArray* myInputPointsMapper; - vtkIntArray* myOutputPointsMapper; - - //---------------------------------------------------------------------------- - TExecute2( vtkUnstructuredGrid *theInput, - vtkUnstructuredGrid *theOutput, - vtkDataArray *theElnoDataArray, - vtkDataArray *theElnoDataMapper, - vtkFloatingPointType theShrinkFactor ) - : myGetElnoNodeData( theElnoDataArray, theElnoDataMapper ) - , myInput( theInput ) - , myOutput( theOutput ) - , myElnoDataArray( theElnoDataArray ) - , myElnoDataMapper( theElnoDataMapper ) - , myShrinkFactor( theShrinkFactor ) - { - myConnectivity = vtkCellArray::New(); - myConnectivity->DeepCopy( theInput->GetCells() ); - - vtkPoints *anInputPoints = theInput->GetPoints(); - vtkPoints *aPoints = anInputPoints->New( anInputPoints->GetDataType() ); - vtkIdType aNbCells = myConnectivity->GetNumberOfCells(); - vtkIdType aNbPoints = myConnectivity->GetNumberOfConnectivityEntries() - aNbCells; - aPoints->Allocate( aNbPoints ); - - myInputPointsArray = TPointsDataArray::SafeDownCast( anInputPoints->GetData() ); - myOutputPointsArray = TPointsDataArray::SafeDownCast( aPoints->GetData() ); - - myInputPointData = theInput->GetPointData(); - myOutputPointData = theOutput->GetPointData(); - myOutputPointData->Allocate( aNbPoints ); - - vtkCellData *anInputCellData = theInput->GetCellData(); - - // To create a new copy of initial data for output - myElnoFullDataArray = TElnoDataArray::New(); - myElnoFullDataArray->SetName( "VISU_FIELD" ); - myElnoFullDataArray->SetNumberOfComponents( myGetElnoNodeData.getNbComp() ); - myElnoFullDataArray->SetNumberOfTuples( aNbPoints ); - - // To create a new copy of partial initial data for output - myElnoPartialDataArray = TElnoDataArray::New(); - // This partial data can be represented as in terms of vectors as scalars - if ( anInputCellData->GetVectors() != NULL ) - myElnoPartialDataArray->SetNumberOfComponents( 3 ); - else - myElnoPartialDataArray->SetNumberOfComponents( 1 ); - myElnoPartialDataArray->SetNumberOfTuples( aNbPoints ); - - myElnoPointCoords = TPointsDataArray::New(); - myElnoPointCoords->SetName( "ELNO_POINT_COORDS" ); - myElnoPointCoords->SetNumberOfComponents( 3 ); - myElnoPointCoords->SetNumberOfTuples( aNbPoints ); - - vtkDataArray* anArray = myInputPointData->GetArray( "VISU_POINTS_MAPPER" ); - myInputPointsMapper = vtkIntArray::SafeDownCast( anArray ); - - myOutputPointsMapper = vtkIntArray::New(); - myOutputPointsMapper->SetName( myInputPointsMapper->GetName() ); - myOutputPointsMapper->SetNumberOfComponents( myInputPointsMapper->GetNumberOfComponents() ); - myOutputPointsMapper->SetNumberOfTuples( aNbPoints ); - - if ( theShrinkFactor > 0.0 ) - this->ShrinkExecute(); - else - this->SimpleExecute(); - - theOutput->SetPoints( aPoints ); - - theOutput->SetCells( theInput->GetCellTypesArray(), - theInput->GetCellLocationsArray(), - myConnectivity ); - - myConnectivity->Delete(); - - vtkCellData *anOutputCellData = theOutput->GetCellData(); - anOutputCellData->PassData( anInputCellData ); - - anOutputCellData->RemoveArray( "ELNO_COMPONENT_MAPPER" ); - anOutputCellData->RemoveArray( "ELNO_FIELD" ); - anOutputCellData->RemoveArray( "VISU_FIELD" ); - anOutputCellData->SetVectors( NULL ); - - //anOutputPointData->PassData( anInputPointData ); - - myOutputPointData->AddArray( myElnoFullDataArray ); - myElnoFullDataArray->Delete(); - - if ( anInputCellData->GetVectors() != NULL ) - myOutputPointData->SetVectors( myElnoPartialDataArray ); - else - myOutputPointData->SetScalars( myElnoPartialDataArray ); - myElnoPartialDataArray->Delete(); - - myOutputPointData->AddArray( myElnoPointCoords ); - myElnoPointCoords->Delete(); - - myOutputPointData->AddArray( myOutputPointsMapper ); - myOutputPointsMapper->Delete(); - } - - //---------------------------------------------------------------------------- - void SimpleExecute() - { - // To reserve a temproary value holder - vtkIdType aNbComp = std::max( 3, myGetElnoNodeData.getNbComp() ); - std::vector< TElnoDataType > anElnoDataValues( aNbComp ); - - std::vector< int > anPointsMapperValues( myInputPointsMapper->GetNumberOfComponents() ); - - myConnectivity->InitTraversal(); - vtkIdType aNbPts = 0, *aPts = 0; - for ( vtkIdType aCellId = 0; myConnectivity->GetNextCell( aNbPts, aPts ); aCellId++ ) { - for ( vtkIdType aPntId = 0; aPntId < aNbPts; aPntId++ ) { - TPointsDataType aCoords[ 3 ]; - vtkIdType aCurrentPntId = aPts[ aPntId ]; - myInputPointsArray->GetTupleValue( aCurrentPntId, aCoords ); - - aPts[ aPntId ] = myOutputPointsArray->InsertNextTupleValue( aCoords ); - vtkIdType aNewPntId = aPts[ aPntId ]; - - myElnoPointCoords->SetTupleValue( aNewPntId, aCoords ); - - myOutputPointData->CopyData( myInputPointData, aCurrentPntId, aNewPntId ); - - TElnoDataType* anElnoData = myGetElnoNodeData( aCellId, aPntId ); - myElnoFullDataArray->SetTupleValue( aNewPntId, anElnoData ); - - myElnoFullDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); - myElnoPartialDataArray->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); - - myInputPointsMapper->GetTupleValue( aCurrentPntId, &anPointsMapperValues[ 0 ] ); - myOutputPointsMapper->SetTupleValue( aNewPntId, &anPointsMapperValues[ 0 ] ); - } - } - } - - //---------------------------------------------------------------------------- - void ShrinkExecute() - { - // To reserve a temproary value holder - vtkIdType aNbComp = std::max( 3, myGetElnoNodeData.getNbComp() ); - std::vector< TElnoDataType > anElnoDataValues( aNbComp ); - - std::vector< int > anPointsMapperValues( myInputPointsMapper->GetNumberOfComponents() ); - - myConnectivity->InitTraversal(); - vtkIdType aNbPts = 0, *aPts = 0; - for ( vtkIdType aCellId = 0; myConnectivity->GetNextCell( aNbPts, aPts ); aCellId++ ) { - - TPointsDataType aCenter[ 3 ] = { TPointsDataType(), TPointsDataType(), TPointsDataType() }; - - for ( vtkIdType aPntId = 0; aPntId < aNbPts; aPntId++ ) { - TPointsDataType aCoords[ 3 ]; - myInputPointsArray->GetTupleValue( aPts[ aPntId ], aCoords ); - - aCenter[ 0 ] += aCoords[ 0 ]; - aCenter[ 1 ] += aCoords[ 1 ]; - aCenter[ 2 ] += aCoords[ 2 ]; - } - - aCenter[ 0 ] /= aNbPts; - aCenter[ 1 ] /= aNbPts; - aCenter[ 2 ] /= aNbPts; - - for ( vtkIdType aPntId = 0; aPntId < aNbPts; aPntId++ ) { - TPointsDataType aCoords[ 3 ]; - vtkIdType aCurrentPntId = aPts[ aPntId ]; - myInputPointsArray->GetTupleValue( aCurrentPntId, aCoords ); - - TPointsDataType aNewCoords[ 3 ]; - - aNewCoords[ 0 ] = aCenter[ 0 ] + - TPointsDataType( myShrinkFactor * ( aCoords[ 0 ] - aCenter[ 0 ] ) ); - aNewCoords[ 1 ] = aCenter[ 1 ] + - TPointsDataType( myShrinkFactor * ( aCoords[ 1 ] - aCenter[ 1 ] ) ); - aNewCoords[ 2 ] = aCenter[ 2 ] + - TPointsDataType( myShrinkFactor * ( aCoords[ 2 ] - aCenter[ 2 ] ) ); - - aPts[ aPntId ] = myOutputPointsArray->InsertNextTupleValue( aNewCoords ); - vtkIdType aNewPntId = aPts[ aPntId ]; - - myElnoPointCoords->SetTupleValue( aNewPntId, aCoords ); - - myOutputPointData->CopyData( myInputPointData, aCurrentPntId, aNewPntId ); - - TElnoDataType* anElnoData = myGetElnoNodeData( aCellId, aPntId ); - myElnoFullDataArray->SetTupleValue( aNewPntId, anElnoData ); - - myElnoFullDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); - myElnoPartialDataArray->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); - - myInputPointsMapper->GetTupleValue( aCurrentPntId, &anPointsMapperValues[ 0 ] ); - myOutputPointsMapper->SetTupleValue( aNewPntId, &anPointsMapperValues[ 0 ] ); - } - } - } - }; - - - //---------------------------------------------------------------------------- - template < int points_type, int elno_type > - int Execute2( vtkUnstructuredGrid *theInput, - vtkUnstructuredGrid *theOutput, - vtkDataArray *theElnoDataArray, - vtkDataArray *theElnoDataMapper, - vtkFloatingPointType theShrinkFactor ) - { - TExecute2< points_type, elno_type >( theInput, - theOutput, - theElnoDataArray, - theElnoDataMapper, - theShrinkFactor ); - - return 1; - } - - - //---------------------------------------------------------------------------- - template < int points_type > - int Execute( vtkUnstructuredGrid *theInput, - vtkUnstructuredGrid *theOutput, - vtkDataArray *theElnoDataArray, - vtkDataArray *theElnoDataMapper, - vtkFloatingPointType theShrinkFactor ) - { - switch( theElnoDataArray->GetDataType() ){ - case VTK_DOUBLE: - return Execute2< points_type, VTK_DOUBLE > - ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor ); - case VTK_FLOAT: - return Execute2< points_type, VTK_FLOAT > - ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor ); - case VTK_INT: - return Execute2< points_type, VTK_INT > - ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor ); - case VTK_LONG: - return Execute2< points_type, VTK_LONG > - ( theInput, theOutput, theElnoDataArray, theElnoDataMapper, theShrinkFactor ); - default: - break; - } - - return 0; - } - - - //---------------------------------------------------------------------------- -} - - -//---------------------------------------------------------------------------- -int VISU_ElnoDisassembleFilter::RequestData( vtkInformation *vtkNotUsed(request), - vtkInformationVector **inputVector, - vtkInformationVector *outputVector ) -{ - // get the info objects - vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); - vtkInformation *outInfo = outputVector->GetInformationObject(0); - - // get the input and ouptut - vtkUnstructuredGrid *anInput = - vtkUnstructuredGrid::SafeDownCast( inInfo->Get( vtkDataObject::DATA_OBJECT() ) ); - vtkUnstructuredGrid *anOutput = - vtkUnstructuredGrid::SafeDownCast( outInfo->Get( vtkDataObject::DATA_OBJECT() ) ); - - vtkDataArray *anElnoDataArray = this->GetInputArrayToProcess( 0, inputVector ); - vtkDataArray *anElnoDataMapper = this->GetInputArrayToProcess( 1, inputVector ); - - if ( !anElnoDataArray ) { - anOutput->ShallowCopy( anInput ); - return 1; - } - - vtkPoints *aPoints = anInput->GetPoints(); - switch( aPoints->GetDataType() ){ - case VTK_DOUBLE: - return ::Execute< VTK_DOUBLE >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor ); - case VTK_FLOAT: - return ::Execute< VTK_FLOAT >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor ); - case VTK_INT: - return ::Execute< VTK_INT >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor ); - case VTK_LONG: - return ::Execute< VTK_LONG >( anInput, anOutput, anElnoDataArray, anElnoDataMapper, myShrinkFactor ); - default: - break; - } - - return 0; -} - - -//---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_ElnoDisassembleFilter.hxx b/src/PIPELINE/VISU_ElnoDisassembleFilter.hxx deleted file mode 100644 index 40f41d34..00000000 --- a/src/PIPELINE/VISU_ElnoDisassembleFilter.hxx +++ /dev/null @@ -1,50 +0,0 @@ -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef VISU_ElnoDisassembleFilter_H -#define VISU_ElnoDisassembleFilter_H - -#include "VISUPipeline.hxx" - -#include - -class VISU_PIPELINE_EXPORT VISU_ElnoDisassembleFilter : public vtkUnstructuredGridAlgorithm -{ -public: - typedef vtkUnstructuredGridAlgorithm Superclass; - - static VISU_ElnoDisassembleFilter *New(); - - void SetShrinkFactor( vtkFloatingPointType theValue ); - vtkFloatingPointType GetShrinkFactor(); - -protected: - VISU_ElnoDisassembleFilter(); - ~VISU_ElnoDisassembleFilter(); - - int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); - - vtkFloatingPointType myShrinkFactor; - -private: - VISU_ElnoDisassembleFilter(const VISU_ElnoDisassembleFilter&); // Not implemented. - void operator=(const VISU_ElnoDisassembleFilter&); // Not implemented. -}; - -#endif diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index c59d0d19..a0c7a8d8 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -60,6 +60,7 @@ VISU_GaussPointsPL myMergeFilter(VISU_GaussMergeFilter::New()) { SetIsShrinkable(false); + SetIsFeatureEdgesAllowed(false); myWarpVector = vtkWarpVector::New(); @@ -245,7 +246,7 @@ VISU_GaussPointsPL { Superclass::Init(); - SetExtractInside(false); + //SetExtractInside(false); vtkDataSet* aDataSet = GetParentMesh(); vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index 88359963..125d5a21 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -45,6 +45,7 @@ VISU_IsoSurfacesPL ::VISU_IsoSurfacesPL() { SetIsShrinkable(false); + SetIsFeatureEdgesAllowed(false); SetElnoDisassembleState( true ); @@ -125,9 +126,9 @@ VISU_IsoSurfacesPL //---------------------------------------------------------------------------- void VISU_IsoSurfacesPL -::SetScalarRange(vtkFloatingPointType theRange[2]) +::SetScalarRange( vtkFloatingPointType theRange[2] ) { - Superclass::SetScalarRange(theRange); + Superclass::SetScalarRange( theRange ); SetRange(myRange); } diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.hxx b/src/PIPELINE/VISU_IsoSurfacesPL.hxx index 73aec61e..b6cb7971 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.hxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.hxx @@ -61,7 +61,7 @@ public: virtual void - SetScalarRange(vtkFloatingPointType theRange[2]); + SetScalarRange( vtkFloatingPointType theRange[2] ); virtual void diff --git a/src/PIPELINE/VISU_LabelPointsFilter.cxx b/src/PIPELINE/VISU_LabelPointsFilter.cxx deleted file mode 100644 index 040d6a23..00000000 --- a/src/PIPELINE/VISU_LabelPointsFilter.cxx +++ /dev/null @@ -1,296 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: VISU_LabelPointsFilter.cxx -// Author: Vitaly Smetannikov -// Module : VISU - - - -#include "VISU_LabelPointsFilter.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - - -#define CONTAINS(SET, PT) (SET.find(PT) != SET.end()) - -struct ltIdType -{ - bool operator()(const vtkIdType a1, const vtkIdType a2) const - { - return a1 < a2; - } -}; - - - -//---------------------------------------------------------------------------- -vtkStandardNewMacro(VISU_LabelPointsFilter); - - -//---------------------------------------------------------------------------- -void VISU_LabelPointsFilter::SetPointsNb(int theNb) -{ - if (myPointsNb == theNb) return; - myPointsNb = (theNb < 1)? 1:theNb; - Modified(); -} - -//---------------------------------------------------------------------------- -VISU_LabelPointsFilter::VISU_LabelPointsFilter(): - vtkPolyDataAlgorithm(), - myPointsNb(3) -{ -} - -//---------------------------------------------------------------------------- -VISU_LabelPointsFilter::~VISU_LabelPointsFilter() -{} - - - -//---------------------------------------------------------------------------- -int VISU_LabelPointsFilter::RequestData(vtkInformation* vtkNotUsed(request), - vtkInformationVector** inputVector, - vtkInformationVector* outputVector) -{ - // get the info objects - vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); - vtkInformation* outInfo = outputVector->GetInformationObject(0); - - // get the input and ouptut - vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); - vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); - - GetRegions(input, output); - - return 1; -} - -int VISU_LabelPointsFilter::RequestUpdateExtent(vtkInformation* vtkNotUsed(request), - vtkInformationVector** inputVector, - vtkInformationVector* outputVector) -{ - // get the info objects - vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); - vtkInformation *outInfo = outputVector->GetInformationObject(0); - - vtkPolyData* input = vtkPolyData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); - vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); - - GetRegions(input, output); - return 1; -} - - - -int VISU_LabelPointsFilter::GetRegions(vtkPolyData* theInput, - vtkPolyData* theOutput) -{ - vtkIdType cellId, i; - vtkIdType numPts, numCells; - vtkPoints *inPts; - - vtkPointData *aInpPD=theInput->GetPointData(), *aOutPD=theOutput->GetPointData(); - vtkCellData *aInpCD=theInput->GetCellData(), *aOutCD=theOutput->GetCellData(); - - // Check input/allocate storage - // - inPts = theInput->GetPoints(); - - if (inPts == NULL) - return 1; - - numPts = inPts->GetNumberOfPoints(); - numCells = theInput->GetNumberOfCells(); - - if ( numPts < 1 || numCells < 1 ) - return 1; - - // Build cell structure - // - vtkPolyData* aMesh = vtkPolyData::New(); - aMesh->CopyStructure(theInput); - aMesh->BuildLinks(); - - // Initialize. Keep track of points and cells visited. - // - vtkIdTypeArray* aRegionSizes = vtkIdTypeArray::New(); - int* aVisited = new int[numCells]; - for ( i=0; i < numCells; i++ ) - aVisited[i] = -1; - - vtkIdType* aPointMap = new vtkIdType[numPts]; - for ( i=0; i < numPts; i++ ) - aPointMap[i] = -1; - - vtkPoints* newPts = vtkPoints::New(); - newPts->Allocate(numPts); - - // Traverse all cells marking those visited. Each new search - // starts a new connected region. Connected region grows - // using a connected wave propagation. - // - vtkIdList* aWave = vtkIdList::New(); - aWave->Allocate(numPts/4+1,numPts); - vtkIdList* aWave2 = vtkIdList::New(); - aWave2->Allocate(numPts/4+1,numPts); - - vtkIdType aPointNumber = 0; - int aRegionNumber = 0; - - vtkIdList* aCellIds = vtkIdList::New(); - aCellIds->Allocate(8, VTK_CELL_SIZE); - vtkIdList* aPointIds = vtkIdList::New(); - aPointIds->Allocate(8, VTK_CELL_SIZE); - - // vtkIdType aNumCellsInRegion; - - aOutPD->CopyAllocate(aInpPD); - aOutCD->CopyAllocate(aInpCD); - - //visit all cells marking with region number - for (cellId=0; cellId < numCells; cellId++) { - if ( aVisited[cellId] < 0 ) { - aWave->InsertNextId(cellId); - aPointNumber = 0; - TraverseAndMark(aWave, aWave2, aVisited, aPointMap, - aRegionNumber, aPointNumber, aMesh); - - if (aPointNumber >= myPointsNb) { - std::set aIdxSet; - for (i=0; i < numPts; i++) { - if ( aPointMap[i] > -1 ) { - aIdxSet.insert(i); - aPointMap[i] = -1; - } - } - std::vector aIdx(aIdxSet.begin(), aIdxSet.end()); - int aActualPts = aIdx.size(); - int aNewId; - if (myPointsNb > 2) { - int k = aActualPts/(myPointsNb - 1); - int count; - for (i=0, count = 0; i < aActualPts; i+=k, count++) { - aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[i])); - aOutPD->CopyData(aInpPD, aIdx[i], aNewId); - } - if (count < myPointsNb) { - aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[aActualPts - 1])); - aOutPD->CopyData(aInpPD, aIdx[aActualPts - 1], aNewId); - } - } else { - aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[0])); - aOutPD->CopyData(aInpPD, aIdx[0], aNewId); - if (myPointsNb == 2) { - aNewId = newPts->InsertNextPoint(inPts->GetPoint(aIdx[aActualPts - 1])); - aOutPD->CopyData(aInpPD, aIdx[aActualPts - 1], aNewId); - } - } - } - aWave->Reset(); - aWave2->Reset(); - } - } - - aWave->Delete(); - aWave2->Delete(); - - theOutput->SetPoints(newPts); - newPts->Delete(); - - - delete [] aVisited; - delete [] aPointMap; - aMesh->Delete(); - theOutput->Squeeze(); - aCellIds->Delete(); - aPointIds->Delete(); - - return aRegionSizes->GetMaxId() + 1; -} - - -// Mark current cell as visited and assign region number. Note: -// traversal occurs across shared vertices. -// -void VISU_LabelPointsFilter::TraverseAndMark (vtkIdList* theWave, - vtkIdList* theWave2, - int* theVisited, - vtkIdType* thePointMap, - int& theRegionNumber, - vtkIdType& thePointNumber, - vtkPolyData* theMesh) -{ - vtkIdType cellId, ptId, numIds, i; - int j, k; - vtkIdType *pts, *cells, npts; - vtkIdList *tmpWave; - unsigned short ncells; - vtkIdList* aNeighborCellPointIds = vtkIdList::New(); - - - while ( (numIds=theWave->GetNumberOfIds()) > 0 ) { - for ( i=0; i < numIds; i++ ) { - cellId = theWave->GetId(i); - if ( theVisited[cellId] < 0 ) { - theVisited[cellId] = theRegionNumber; - theMesh->GetCellPoints(cellId, npts, pts); - - for (j=0; j < npts; j++) { - if ( thePointMap[ptId=pts[j]] < 0 ) { - thePointMap[ptId] = thePointNumber++; - } - theMesh->GetPointCells(ptId,ncells,cells); - - // check connectivity criterion (geometric + scalar) - for (k=0; k < ncells; k++) { - cellId = cells[k]; - theWave2->InsertNextId(cellId); - // } - }//for all cells using this point - }//for all points of this cell - }//if cell not yet visited - }//for all cells in this wave - - tmpWave = theWave; - theWave = theWave2; - theWave2 = tmpWave; - tmpWave->Reset(); - } //while wave is not empty -} diff --git a/src/PIPELINE/VISU_LabelPointsFilter.hxx b/src/PIPELINE/VISU_LabelPointsFilter.hxx deleted file mode 100644 index 46fa1c44..00000000 --- a/src/PIPELINE/VISU_LabelPointsFilter.hxx +++ /dev/null @@ -1,76 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File: VISU_LabelPointsFilter.hxx -// Author: Vitaly Smetannikov -// Module : VISU - -#ifndef VISU_LabelPointsFilter_HeaderFile -#define VISU_LabelPointsFilter_HeaderFile - -#include "VISUPipeline.hxx" -#include - -class vtkPolyData; - -class VISU_PIPELINE_EXPORT VISU_LabelPointsFilter : public vtkPolyDataAlgorithm -{ -public: - vtkTypeMacro(VISU_LabelPointsFilter, vtkPolyDataAlgorithm); - - static VISU_LabelPointsFilter* New(); - - void SetPointsNb(int theNb); - - int GetPointsNb() const { return myPointsNb; } - -protected: - VISU_LabelPointsFilter(); - - virtual ~VISU_LabelPointsFilter(); - - virtual int RequestData(vtkInformation* request, - vtkInformationVector** inputVector, - vtkInformationVector* outputVector); - - virtual int RequestUpdateExtent(vtkInformation*, - vtkInformationVector**, - vtkInformationVector*); - - - void TraverseAndMark (vtkIdList* theWave, - vtkIdList* theWave2, - int* theVisited, - vtkIdType* thePointMap, - int& theRegionNumber, - vtkIdType& thePointNumber, - vtkPolyData* theMesh); - - int GetRegions(vtkPolyData* theInput, - vtkPolyData* theOutput); - - int myPointsNb; - -}; - - -#endif diff --git a/src/PIPELINE/VISU_LookupTable.cxx b/src/PIPELINE/VISU_LookupTable.cxx index 8c4dfc90..c325fa06 100644 --- a/src/PIPELINE/VISU_LookupTable.cxx +++ b/src/PIPELINE/VISU_LookupTable.cxx @@ -32,8 +32,12 @@ using namespace std; + +//---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_LookupTable); + +//---------------------------------------------------------------------------- VISU_LookupTable ::VISU_LookupTable(int sze, int ext): vtkLookupTable(sze, ext), @@ -41,6 +45,73 @@ VISU_LookupTable myBicolor(false) {} +//---------------------------------------------------------------------------- +namespace +{ + inline + void + CopyColor( unsigned char* theTaget, const unsigned char* theSource ) + { + theTaget[0] = theSource[0]; + theTaget[1] = theSource[1]; + theTaget[2] = theSource[2]; + } +} + + +//---------------------------------------------------------------------------- +void +VISU_LookupTable +::MarkValueByColor( vtkFloatingPointType theValue, + unsigned char* theColor ) +{ + vtkIdType anIndex = this->GetIndex( theValue ); + unsigned char *aTablePtr = this->GetPointer( anIndex ); + CopyColor( aTablePtr, theColor ); +} + + +//---------------------------------------------------------------------------- +void +VISU_LookupTable +::FillByColor( unsigned char* theColor ) +{ + vtkIdType aNbColors = this->GetNumberOfColors(); + for(int i = 0; i < aNbColors; i++){ + unsigned char *aTablePtr = this->GetPointer(i); + CopyColor( aTablePtr, theColor ); + } +} + + +//---------------------------------------------------------------------------- +void +VISU_LookupTable +::MakeBiColor() +{ + unsigned char aRedPtr[3] = {255, 0, 0}; + unsigned char aBluePtr[3] = {0, 0, 255}; + + vtkFloatingPointType aRange[2]; + this->GetTableRange(aRange); + vtkIdType aNbColors = this->GetNumberOfColors(); + + vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors; + vtkFloatingPointType aValue = aRange[0]+0.5*aDelta; + for(int i = 0; i < aNbColors; i++){ + vtkIdType anIndex = this->GetIndex(aValue); + unsigned char* aTablePtr = this->GetPointer(anIndex); + if(aValue > 0.0){ + CopyColor(aTablePtr,aRedPtr); + }else{ + CopyColor(aTablePtr,aBluePtr); + } + aValue += aDelta; + } +} + + +//---------------------------------------------------------------------------- void VISU_LookupTable ::SetMapScale(vtkFloatingPointType theScale) diff --git a/src/PIPELINE/VISU_LookupTable.hxx b/src/PIPELINE/VISU_LookupTable.hxx index 93fc7a47..c7e29c6c 100644 --- a/src/PIPELINE/VISU_LookupTable.hxx +++ b/src/PIPELINE/VISU_LookupTable.hxx @@ -24,11 +24,13 @@ #ifndef VISU_LookupTable_H #define VISU_LookupTable_H +#include "VISUPipeline.hxx" + #include #include "VTKViewer.h" -class VISU_LookupTable: public vtkLookupTable +class VISU_PIPELINE_EXPORT VISU_LookupTable: public vtkLookupTable { public: vtkTypeMacro(VISU_LookupTable,vtkLookupTable); @@ -44,8 +46,17 @@ class VISU_LookupTable: public vtkLookupTable bool GetBicolor() { return myBicolor; } void SetBicolor( bool theBicolor ); - static int ComputeLogRange(vtkFloatingPointType inRange[2], vtkFloatingPointType outRange[2]); - unsigned char *MapValue(vtkFloatingPointType v); + static int ComputeLogRange( vtkFloatingPointType inRange[2], + vtkFloatingPointType outRange[2] ); + + unsigned char *MapValue(vtkFloatingPointType v); + + void MarkValueByColor( vtkFloatingPointType theValue, + unsigned char* theColor ); + + void FillByColor( unsigned char* theColor ); + + void MakeBiColor(); protected: VISU_LookupTable(int sze=256, int ext=256); diff --git a/src/PIPELINE/VISU_MapperHolder.hxx b/src/PIPELINE/VISU_MapperHolder.hxx index 756abdee..3a87d47c 100644 --- a/src/PIPELINE/VISU_MapperHolder.hxx +++ b/src/PIPELINE/VISU_MapperHolder.hxx @@ -139,6 +139,8 @@ public: vtkPlane* GetClippingPlane(vtkIdType theID) = 0; + virtual void RemoveClippingPlane(vtkIdType theID) = 0; + //---------------------------------------------------------------------------- virtual void diff --git a/src/PIPELINE/VISU_MergedPL.cxx b/src/PIPELINE/VISU_MergedPL.cxx deleted file mode 100644 index 4aa24b88..00000000 --- a/src/PIPELINE/VISU_MergedPL.cxx +++ /dev/null @@ -1,51 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: VISU_MergedPL.cxx -// Author: Alexey PETROV -// Module : VISU - - -#include "VISU_MergedPL.hxx" -#include "VISU_PipeLine.hxx" - - -//---------------------------------------------------------------------------- -void -VISU_MergedPL -::DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput) -{ - if(VISU_MergedPL *aPipeLine = dynamic_cast(thePipeLine)){ - if ( this == aPipeLine ) - return; - - if ( aPipeLine->IsExternalGeometryUsed() ) { - ClearGeometry(); - int aNbOfGeometry = aPipeLine->GetNumberOfGeometry(); - for ( int aGeomNumber = 0; aGeomNumber < aNbOfGeometry; aGeomNumber++ ) - AddGeometry( aPipeLine->GetGeometry( aGeomNumber ) ); - }else - SetSourceGeometry(); - } -} diff --git a/src/PIPELINE/VISU_MergedPL.hxx b/src/PIPELINE/VISU_MergedPL.hxx deleted file mode 100644 index 9c8e9b97..00000000 --- a/src/PIPELINE/VISU_MergedPL.hxx +++ /dev/null @@ -1,75 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: VISU_MergedPL.hxx -// Author: Alexey PETROV -// Module : VISU - -#ifndef VISU_MergedPL_HeaderFile -#define VISU_MergedPL_HeaderFile - -#include "VISUPipeline.hxx" - -class vtkDataSet; -class vtkPointSet; -class VISU_PipeLine; - - -//---------------------------------------------------------------------------- -struct VISU_PIPELINE_EXPORT VISU_MergedPL -{ - virtual - void - SetSourceGeometry() = 0; - - virtual - int - AddGeometry( vtkDataSet* theGeometry ) = 0; - - virtual - vtkDataSet* - GetGeometry( int theGeomNumber ) = 0; - - virtual - int - GetNumberOfGeometry() = 0; - - virtual - bool - IsExternalGeometryUsed() = 0; - - virtual - void - ClearGeometry() = 0; - - virtual - vtkPointSet* - GetMergedInput() = 0; - - virtual - void - DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput); -}; - -#endif diff --git a/src/PIPELINE/VISU_MeshPL.cxx b/src/PIPELINE/VISU_MeshPL.cxx index 9e5dd5d7..cfcc2116 100644 --- a/src/PIPELINE/VISU_MeshPL.cxx +++ b/src/PIPELINE/VISU_MeshPL.cxx @@ -44,6 +44,7 @@ VISU_MeshPL VISU_UnstructuredGridPL(this) { SetIsShrinkable(true); + SetIsFeatureEdgesAllowed(true); } diff --git a/src/PIPELINE/VISU_OptionalDeformationPL.cxx b/src/PIPELINE/VISU_OptionalDeformationPL.cxx deleted file mode 100755 index a4bc4555..00000000 --- a/src/PIPELINE/VISU_OptionalDeformationPL.cxx +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: VISU_ScalarMapPL.cxx -// Author: Roman NIKOLAEV -// Module : VISU - -//Salome includes -#include "VISU_OptionalDeformationPL.hxx" -#include "VISU_PipeLineUtils.hxx" - -//VTK includes -#include -#include -#include -#include -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//---------------------------------------------------------------------------- -VISU_OptionalDeformationPL::VISU_OptionalDeformationPL(): - VISU_DeformationPL(), - myIsDeformed(true) -{ - if(MYDEBUG) MESSAGE("VISU_OptionalDeformationPL()::VISU_OptionalDeformationPL() - "<SetInput(myInputPassFilter->GetOutput()); - myWarpVector->SetInput(myCellDataToPointData->GetOutput()); - myOutputPassFiler->SetInput(myWarpVector->GetOutput()); -} - -//---------------------------------------------------------------------------- -void VISU_OptionalDeformationPL::OffDeformation(){ - myOutputPassFiler->SetInput(myInputPassFilter->GetOutput()); -} - - - -bool VISU_OptionalDeformationPL::CheckCanDeformate(vtkDataSet* theInput){ - if(theInput) { - if(VISU::IsDataOnCells(theInput)) - return theInput->GetCellData()->GetVectors() != NULL; - else if(VISU::IsDataOnPoints(theInput)) - return theInput->GetPointData()->GetVectors() != NULL; - } - return false; -} diff --git a/src/PIPELINE/VISU_OptionalDeformationPL.hxx b/src/PIPELINE/VISU_OptionalDeformationPL.hxx deleted file mode 100755 index 333da0cc..00000000 --- a/src/PIPELINE/VISU_OptionalDeformationPL.hxx +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VISU_OptionalDeformationPL.hxx -// Author : -// Module : SALOME - -#ifndef VISU_OptionalDeformationPL_HeaderFile -#define VISU_OptionalDeformationPL_HeaderFile - -#include "VISUPipeline.hxx" -#include "VISU_DeformationPL.hxx" - -class VISU_PIPELINE_EXPORT VISU_OptionalDeformationPL: public VISU_DeformationPL -{ -public: - VISU_OptionalDeformationPL(); - virtual ~VISU_OptionalDeformationPL(); - - typedef VISU_DeformationPL Superclass; - - void UseDeformation(bool flag); - bool IsDeformed(); - - virtual - unsigned - long int - GetMTime(); - -protected: - bool CheckCanDeformate(vtkDataSet* theInput); - -private: - void OnDeformation(); - void OffDeformation(); - -private: - bool myIsDeformed; -}; - -#endif diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index ea165bc0..0761bbd5 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -47,7 +47,8 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- VISU_PipeLine ::VISU_PipeLine(): - myIsShrinkable(true) + myIsShrinkable(true), + myIsFeatureEdgesAllowed(true) { if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<GetClippingPlane(theID); } +//---------------------------------------------------------------------------- +void VISU_PipeLine::RemoveClippingPlane(vtkIdType theID) +{ + return GetMapperHolder()->RemoveClippingPlane(theID); +} + //---------------------------------------------------------------------------- vtkDataSet* VISU_PipeLine diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index 53015937..72ee74d2 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -132,6 +132,9 @@ public: bool IsShrinkable(); + bool + IsFeatureEdgesAllowed(); + //---------------------------------------------------------------------------- void SetImplicitFunction(vtkImplicitFunction *theFunction); @@ -159,6 +162,8 @@ public: vtkPlane* GetClippingPlane(vtkIdType theID); + virtual void RemoveClippingPlane(vtkIdType theID); + virtual void SetPlaneParam(vtkFloatingPointType theDir[3], @@ -209,10 +214,14 @@ protected: void SetIsShrinkable(bool theIsShrinkable); + void + SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed); + private: //---------------------------------------------------------------------------- vtkSmartPointer myMapperHolder; bool myIsShrinkable; + bool myIsFeatureEdgesAllowed; }; #endif diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index ed3750fc..a3465a37 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -60,6 +60,7 @@ VISU_Plot3DPL myMapScaleFactor(1.0) { SetIsShrinkable(false); + SetIsFeatureEdgesAllowed(false); myCellDataToPointData->Delete(); myAppendPolyData->Delete(); diff --git a/src/PIPELINE/VISU_PointSpriteMapperHolder.cxx b/src/PIPELINE/VISU_PointSpriteMapperHolder.cxx index 69c9be26..6497e489 100644 --- a/src/PIPELINE/VISU_PointSpriteMapperHolder.cxx +++ b/src/PIPELINE/VISU_PointSpriteMapperHolder.cxx @@ -30,6 +30,7 @@ #include "VISU_OpenGLPointSpriteMapper.hxx" #include "VISU_PipeLineUtils.hxx" +#include "SALOME_ExtractPolyDataGeometry.h" #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -73,6 +74,7 @@ VISU_PointSpriteMapperHolder VISU::CopyPointSpriteDataMapper(GetPointSpriteMapper(), aMapperHolder->GetPointSpriteMapper(), theIsCopyInput); + myExtractPolyDataGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction()); } } diff --git a/src/PIPELINE/VISU_PolyDataMapperHolder.cxx b/src/PIPELINE/VISU_PolyDataMapperHolder.cxx index 0b9cd227..43ece171 100644 --- a/src/PIPELINE/VISU_PolyDataMapperHolder.cxx +++ b/src/PIPELINE/VISU_PolyDataMapperHolder.cxx @@ -40,6 +40,7 @@ #include #include #include +//#include #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -67,6 +68,7 @@ VISU_PolyDataMapperHolder myExtractPolyDataGeometry->SetImplicitFunction(anImplicitBoolean); anImplicitBoolean->SetOperationTypeToIntersection(); anImplicitBoolean->Delete(); + //myExtractPolyDataGeometry->ExtractInsideOn(); } @@ -92,6 +94,7 @@ VISU_PolyDataMapperHolder VISU::CopyPolyDataMapper(GetPolyDataMapper(), aMapperHolder->GetPolyDataMapper(), theIsCopyInput); + myExtractPolyDataGeometry->SetImplicitFunction(aMapperHolder->GetImplicitFunction()); } } @@ -257,6 +260,7 @@ VISU_PolyDataMapperHolder if (vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()) { vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction(); aFunction->AddItem(thePlane); + aBoolean->Modified(); // Check, that at least one cell present after clipping. // This check was introduced because of bug IPAL8849. vtkDataSet* aClippedDataSet = GetClippedInput(); @@ -286,6 +290,18 @@ VISU_PolyDataMapperHolder return aPlane; } +//---------------------------------------------------------------------------- +void VISU_PolyDataMapperHolder::RemoveClippingPlane(vtkIdType theID) +{ + if(theID >= 0 && theID < GetNumberOfClippingPlanes()){ + if(vtkImplicitBoolean* aBoolean = myExtractPolyDataGeometry->GetImplicitBoolean()){ + vtkImplicitFunctionCollection* aFunctions = aBoolean->GetFunction(); + aFunctions->RemoveItem(theID); + aBoolean->Modified(); + } + } +} + //---------------------------------------------------------------------------- void VISU_PolyDataMapperHolder diff --git a/src/PIPELINE/VISU_PolyDataMapperHolder.hxx b/src/PIPELINE/VISU_PolyDataMapperHolder.hxx index dc9848ec..ece41f4d 100644 --- a/src/PIPELINE/VISU_PolyDataMapperHolder.hxx +++ b/src/PIPELINE/VISU_PolyDataMapperHolder.hxx @@ -129,6 +129,8 @@ public: virtual vtkPlane* GetClippingPlane(vtkIdType theID); + + void RemoveClippingPlane(vtkIdType theID); protected: //---------------------------------------------------------------------------- @@ -159,6 +161,8 @@ private: //---------------------------------------------------------------------------- VISU::PPolyDataIDMapper myPolyDataIDMapper; vtkSmartPointer myPolyDataMapper; + +protected: vtkSmartPointer myExtractPolyDataGeometry; //!< Clipping }; diff --git a/src/PIPELINE/VISU_ScalarBarActor.cxx b/src/PIPELINE/VISU_ScalarBarActor.cxx index 9adbc387..08dbfdd3 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.cxx +++ b/src/PIPELINE/VISU_ScalarBarActor.cxx @@ -38,6 +38,8 @@ #include #include #include +#include // RKV +#include // RKV using namespace std; @@ -103,12 +105,36 @@ VISU_ScalarBarActor::VISU_ScalarBarActor() this->LastSize[0] = 0; this->LastSize[1] = 0; - this->TitleRatioWidth = 0; + this->TitleRatioSize = 0; this->LabelRatioWidth = 0; this->BarRatioWidth = 0; - this->TitleRatioHeight = 0; - this->LabelRatioHeight = 0; this->BarRatioHeight = 0; + + // RKV : Begin + this->Distribution = vtkDoubleArray::New(); + this->DistributionObj = vtkDataObject::New(); + this->DistributionActor = VISU_XYPlotActor::New(); + this->DistributionActor->SetTitle(""); + this->DistributionActor->SetXTitle(""); + this->DistributionActor->SetYTitle(""); + this->DistributionActor->GetXAxisActor2D()->LabelVisibilityOff(); + this->DistributionActor->GetXAxisActor2D()->TitleVisibilityOff(); + this->DistributionActor->GetXAxisActor2D()->TickVisibilityOff(); +// this->DistributionActor->GetXAxisActor2D()->SetFontFactor(0.); + this->DistributionActor->SetNumberOfYLabels(1); +// this->DistributionActor->SetNumberOfXLabels(2); + this->DistributionActor->GetXAxisActor2D()->AdjustLabelsOff(); + this->DistributionActor->GetYAxisActor2D()->AdjustLabelsOff(); + this->DistributionActor->LegendOff(); + this->DistributionActor->SetLabelFormat("%4.3f"); + this->DistributionActor->SetXValuesToIndex(); +// this->DistributionActor->GetPositionCoordinate()->SetValue(0.0, 0.67, 0); +// this->DistributionActor->GetPosition2Coordinate()->SetValue(1.0, 0.33, 0); // #relative to Position + this->DistributionActor->GetPositionCoordinate()-> + SetReferenceCoordinate(this->PositionCoordinate); + this->DistributionVisibilityOff(); // Don't show the distribution curve by default + + // RKV : End } void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win) @@ -122,6 +148,7 @@ void VISU_ScalarBarActor::ReleaseGraphicsResources(vtkWindow *win) } } this->ScalarBarActor->ReleaseGraphicsResources(win); + this->DistributionActor->ReleaseGraphicsResources(win); // RKV } VISU_ScalarBarActor::~VISU_ScalarBarActor() @@ -146,10 +173,16 @@ VISU_ScalarBarActor::~VISU_ScalarBarActor() delete [] this->TextActors; } + // RKV : Begin + this->DistributionActor->Delete(); + this->DistributionObj->Delete(); + this->SetDistribution(NULL); + // RKV : End + this->ScalarBar->Delete(); this->ScalarBarMapper->Delete(); this->ScalarBarActor->Delete(); - + if (this->Title) { delete [] this->Title; @@ -172,6 +205,10 @@ int VISU_ScalarBarActor::RenderOverlay(vtkViewport *viewport) renderedSomething += this->TitleActor->RenderOverlay(viewport); } this->ScalarBarActor->RenderOverlay(viewport); + // RKV : Begin + if (this->DistributionVisibility) + this->DistributionActor->RenderOverlay(viewport); + // RKV : End if( this->TextActors == NULL) { vtkWarningMacro(<<"Need a mapper to render a scalar bar"); @@ -238,11 +275,19 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) } // Check to see whether we have to rebuild everything + // RKV : Begin if (positionsHaveChanged || this->GetMTime() > this->BuildTime || this->LookupTable->GetMTime() > this->BuildTime || this->LabelTextProperty->GetMTime() > this->BuildTime || - this->TitleTextProperty->GetMTime() > this->BuildTime) + this->TitleTextProperty->GetMTime() > this->BuildTime || + this->Distribution->GetMTime() > this->BuildTime) + // RKV : End +/* RKV if (positionsHaveChanged || + this->GetMTime() > this->BuildTime || + this->LookupTable->GetMTime() > this->BuildTime || + this->LabelTextProperty->GetMTime() > this->BuildTime || + this->TitleTextProperty->GetMTime() > this->BuildTime)*/ { // Delete previously constructed objects @@ -276,6 +321,32 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) colors->SetNumberOfComponents(3); colors->SetNumberOfTuples(numColors); +// RKV : Begin + // If the distribution is changed then recalculate the total + if (this->Distribution->GetMTime() > this->BuildTime) { + int aNbVals = this->Distribution->GetNumberOfTuples(); + double range[2]; + this->Distribution->GetRange(range); + this->DistributionActor->SetYRange(0, range[1]); +/* int total = 0; + for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){ + total += this->Distribution->GetValue(aValId); + } + this->DistributionActor->SetYRange(0, total); +*/ + } + + this->DistributionActor->SetProperty(this->GetProperty()); + this->DistributionActor->GetProperty()->SetColor(1, 1, 1); + this->DistributionActor->GetProperty()->SetLineWidth(2); + this->DistributionActor->GetProperty()->SetDisplayLocationToForeground(); + vtkTextProperty* tprop; + tprop = this->DistributionActor->GetTitleTextProperty(); + tprop->SetColor(this->DistributionActor->GetProperty()->GetColor()); +// this->DistributionActor->SetAxisTitleTextProperty(tprop); +// this->DistributionActor->SetAxisLabelTextProperty(tprop); + +// RKV : End this->ScalarBarActor->SetProperty(this->GetProperty()); this->ScalarBar->Initialize(); this->ScalarBar->SetPoints(pts); @@ -394,6 +465,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) this->TextActors[i]->SetPosition(barWidth+3, val - sizeTextData[1]/2); } + } else { @@ -405,7 +477,11 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) val = (vtkFloatingPointType)i/(this->NumberOfLabels-1) * barWidth; this->TextActors[i]->SetPosition(val, barHeight + 0.05*size[1]); } + } + + // Compute the position of the distribution curve + this->PlaceDistribution(viewport, barWidth, barHeight); // RKV this->BuildTime.Modified(); } @@ -416,6 +492,10 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) renderedSomething += this->TitleActor->RenderOpaqueGeometry(viewport); } this->ScalarBarActor->RenderOpaqueGeometry(viewport); + // RKV : Begin + if (this->DistributionVisibility) + this->DistributionActor->RenderOpaqueGeometry(viewport); + // RKV : End for (i=0; iNumberOfLabels; i++) { renderedSomething += this->TextActors[i]->RenderOpaqueGeometry(viewport); @@ -571,13 +651,10 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, else targetWidth = (int)(0.01*LabelRatioWidth*size[0]); - if(LabelRatioHeight == 0) - if ( this->Orientation == VTK_ORIENT_VERTICAL ) - targetHeight = (int)(0.86*size[1]/this->NumberOfLabels); - else - targetHeight = (int)(0.25*size[1]); + if ( this->Orientation == VTK_ORIENT_VERTICAL ) + targetHeight = (int)(0.86*size[1]/this->NumberOfLabels); else - targetHeight = (int)(0.01*LabelRatioHeight*size[1]); + targetHeight = (int)(0.25*size[1]); vtkTextMapper::SetMultipleConstrainedFontSize(viewport, targetWidth, @@ -600,18 +677,15 @@ void VISU_ScalarBarActor::SizeTitle(int *titleSize, int *size, int targetWidth, targetHeight; - if(TitleRatioWidth == 0) + if(TitleRatioSize == 0) targetWidth = size[0]; else - targetWidth = (int)(0.01*TitleRatioWidth*size[0]); + targetWidth = (int)(0.01*TitleRatioSize*size[0]); - if(TitleRatioHeight == 0) - if ( this->Orientation == VTK_ORIENT_VERTICAL ) - targetHeight = (int)(0.1*size[1]); - else - targetHeight = (int)(0.25*size[1]); + if ( this->Orientation == VTK_ORIENT_VERTICAL ) + targetHeight = (int)(0.1*size[1]); else - targetHeight = (int)(0.01*TitleRatioHeight*size[1]); + targetHeight = (int)(0.25*size[1]); this->TitleMapper->SetConstrainedFontSize( viewport, targetWidth, targetHeight); @@ -619,21 +693,66 @@ void VISU_ScalarBarActor::SizeTitle(int *titleSize, int *size, this->TitleMapper->GetSize(viewport, titleSize); } -void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, +// RKV : Begin +void VISU_ScalarBarActor::SetDistributionVisibility(int v) +{ + this->DistributionVisibility = v; + if (v) { + this->DistributionActor->VisibilityOn(); + } else { + this->DistributionActor->VisibilityOff(); + } +} + +void VISU_ScalarBarActor::SetDistribution(vtkDoubleArray *distr) +{ + this->Distribution = distr; + if (distr == NULL) return; + + this->DistributionObj->Initialize(); + this->DistributionObj->GetFieldData()->AddArray(this->Distribution); + this->DistributionActor->AddDataObjectInput(this->DistributionObj); + // Set ranges of axes for the distribution curve + this->DistributionActor->SetXRange(0, this->Distribution->GetNumberOfTuples()-1); + double range[2]; + this->Distribution->GetRange(range); + int aNbVals = this->Distribution->GetNumberOfTuples(); +// int total = 0; + if (this->GetDebug()) { + for(vtkIdType aValId = 0; aValId < aNbVals; aValId++){ +// if (this->GetDebug()) { + if (this->Distribution->GetValue(aValId) > 0) + vtkDebugMacro(<< "D(" << aValId << ") = " << this->Distribution->GetValue(aValId)); +// } +// total += this->Distribution->GetValue(aValId); + } + } +// this->DistributionActor->SetYRange(0, total); + this->DistributionActor->SetYRange(0, range[1]); + vtkDebugMacro(<< "max X = " << this->Distribution->GetNumberOfTuples()); + vtkDebugMacro(<< "Y = (" << range[0] << ", " << range[1] << ")"); +// vtkDebugMacro(<< "total = " << total); +} + +void VISU_ScalarBarActor::DebugOn() { + this->DistributionActor->DebugOn(); + Superclass::DebugOn(); +} + +void VISU_ScalarBarActor::DebugOff() { + this->DistributionActor->DebugOff(); + Superclass::DebugOff(); +} +// RKV : End + +void VISU_ScalarBarActor::SetRatios(int titleRatioSize, int labelRatioWidth, int barRatioWidth, int barRatioHeight) { - TitleRatioWidth=titleRatioWidth; - if(TitleRatioWidth>100) - TitleRatioWidth=100; - else if(TitleRatioWidth<0) - TitleRatioWidth=0; - - TitleRatioHeight=titleRatioHeight; - if(TitleRatioHeight>100) - TitleRatioHeight=100; - else if(TitleRatioHeight<0) - TitleRatioHeight=0; + TitleRatioSize=titleRatioSize; + if(TitleRatioSize>100) + TitleRatioSize=100; + else if(TitleRatioSize<0) + TitleRatioSize=0; LabelRatioWidth=labelRatioWidth; if(LabelRatioWidth>100) @@ -641,12 +760,6 @@ void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight, else if(LabelRatioWidth<0) LabelRatioWidth=0; - LabelRatioHeight=labelRatioHeight; - if(LabelRatioHeight>100) - LabelRatioHeight=100; - else if(LabelRatioHeight<0) - LabelRatioHeight=0; - BarRatioWidth=barRatioWidth; if(BarRatioWidth>100) BarRatioWidth=100; @@ -660,14 +773,11 @@ void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight, BarRatioHeight=0; } -void VISU_ScalarBarActor::GetRatios(int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, - int& barRatioWidth, int& barRatioHeight) +void VISU_ScalarBarActor::GetRatios(int& titleRatioSize, int& labelRatioWidth, + int& barRatioWidth, int& barRatioHeight) { - titleRatioWidth=TitleRatioWidth; - titleRatioHeight=TitleRatioHeight; + titleRatioSize=TitleRatioSize; labelRatioWidth=LabelRatioWidth; - labelRatioHeight=LabelRatioHeight; barRatioWidth=BarRatioWidth; barRatioHeight=BarRatioHeight; } @@ -694,3 +804,91 @@ void VISU_ScalarBarActor::SizeBar(int& barSizeWidth, int& barSizeHeight, int *si else barSizeHeight = (int)(0.01*BarRatioHeight*size[1]); } +// RKV : Begin +//------------------------------------------------------------------------------ +/** Place the distribution plot actor in the viewport according to the + * scalar bar location and orientation */ +void VISU_ScalarBarActor::PlaceDistribution(vtkViewport *viewport, const int barWidth, const int barHeight) { + vtkDebugMacro(<< "barOrigin[0]=" << this->LastOrigin[0] << "; barOrigin[1]=" << this->LastOrigin[1]); + // Detect the side of the viewport where the curve should be placed by the bar origin. + double u = (double)(this->LastOrigin[0]), v = (double)(this->LastOrigin[1]), z=0; + viewport->ViewportToNormalizedViewport(u, v); + + if ( this->Orientation == VTK_ORIENT_VERTICAL ) { + // Position the distribution curve vertically + if (u > 0.5) { + // X - UP, Y - TO THE LEFT + this->DistributionActor->SetPlotLocation(VISU_XYPLOT_RIGHT); + // Curve to be placed on the left side of the bar + vtkDebugMacro(<< "Curve to be placed on the left side of the bar"); + // relative to the bar origin + u = 0; + v = 0; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro(<< "u=" << u << "; v=" << v); + this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0); + // relative to Position + u = - barWidth; + v = barHeight; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro("u2=" << u << "; v2=" << v); + this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0); + } else { + // X - UP, Y - TO THE RIGHT + this->DistributionActor->SetPlotLocation(VISU_XYPLOT_LEFT); + // Curve to be placed on the right side of the bar + vtkDebugMacro(<< "Curve to be placed on the right side of the bar"); + // relative to the bar origin + u = barWidth; + v = 0; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro(<< "u=" << u << "; v=" << v); + this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0); + // relative to Position + u = barWidth; + v = barHeight; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro("u2=" << u << "; v2=" << v); + this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0); + } + } else { + // Position the distribution curve horizontally + if (v > 0.5) { + // X - TO THE LEFT, Y - DOWN + this->DistributionActor->SetPlotLocation(VISU_XYPLOT_TOP); + // Curve to be placed below the bar + vtkDebugMacro(<< "Curve to be placed below the bar"); + // relative to the bar origin + u = 0; + v = 0; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro(<< "u=" << u << "; v=" << v); + this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0); + // relative to Position + u = barWidth; + v = - barHeight; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro("u2=" << u << "; v2=" << v); + this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0); + } else { + // X - TO THE RIGHT, Y - UP + this->DistributionActor->SetPlotLocation(VISU_XYPLOT_BOTTOM); + // Curve to be placed on the top of the bar + vtkDebugMacro(<< "Curve to be placed on the top of the bar"); + // relative to the bar origin + u = 0; + v = barHeight; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro(<< "u=" << u << "; v=" << v); + this->DistributionActor->GetPositionCoordinate()->SetValue(u, v, 0); + // relative to Position + u = barWidth; + v = barHeight; + viewport->ViewportToNormalizedViewport(u, v); + vtkDebugMacro("u2=" << u << "; v2=" << v); + this->DistributionActor->GetPosition2Coordinate()->SetValue(u, v, 0); + } + } +} +// RKV : End + diff --git a/src/PIPELINE/VISU_ScalarBarActor.hxx b/src/PIPELINE/VISU_ScalarBarActor.hxx index 3252e6e8..24c1e862 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.hxx +++ b/src/PIPELINE/VISU_ScalarBarActor.hxx @@ -29,8 +29,10 @@ #include "VISUPipeline.hxx" #include "VISU_LookupTable.hxx" +#include "VISU_XYPlotActor.hxx" #include +#include // RKV class vtkPolyData; class vtkPolyDataMapper2D; @@ -106,15 +108,31 @@ public: // Set/Get the labels text property. virtual void SetLabelTextProperty(vtkTextProperty *p); vtkGetObjectMacro(LabelTextProperty,vtkTextProperty); + +// RKV : Begin + // Description: + // Set/Get the values distribution array + virtual void SetDistribution(vtkDoubleArray *d); + vtkGetObjectMacro(Distribution,vtkDoubleArray); + + // Description: + // Set/Get the flag of distribution plot visibility + void SetDistributionVisibility(int v); + vtkGetMacro(DistributionVisibility, int); + void DistributionVisibilityOn() + {this->SetDistributionVisibility(1);}; + void DistributionVisibilityOff() {this->SetDistributionVisibility(0);}; + + void DebugOn(); + void DebugOff(); +// RKV : End // Description: // Set/Get the scalar bar dimention properties in persents. // 0 <= ration <= 100 - void SetRatios(int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, + void SetRatios(int titleRatioSize,int labelRatioWidth, int barRatioWidth, int barRatioHeight); - void GetRatios(int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, + void GetRatios(int& titleRatioSize, int& labelRatioWidth, int& barRatioWidth, int& barRatioHeight); // Description: @@ -139,6 +157,13 @@ protected: VISU_LookupTable *LookupTable; vtkTextProperty *TitleTextProperty; vtkTextProperty *LabelTextProperty; + + /** Array for keeping the distribution of colors within cells. + * For each color index the appropriate element of the array contains + * a number of cells for this color.*/ + vtkDoubleArray *Distribution; // RKV + /** Visibility flag for the distribution plot */ + int DistributionVisibility; // RKV int MaximumNumberOfColors; int NumberOfLabels; @@ -146,11 +171,9 @@ protected: int Orientation; char *Title; char *LabelFormat; - int TitleRatioWidth; + int TitleRatioSize; int LabelRatioWidth; int BarRatioWidth; - int TitleRatioHeight; - int LabelRatioHeight; int BarRatioHeight; vtkTextMapper **TextMappers; @@ -167,6 +190,9 @@ private: vtkPolyDataMapper2D *ScalarBarMapper; vtkActor2D *ScalarBarActor; + vtkDataObject *DistributionObj; // RKV + VISU_XYPlotActor *DistributionActor; // RKV + vtkTimeStamp BuildTime; int LastSize[2]; int LastOrigin[2]; @@ -175,6 +201,10 @@ private: void SizeBar(int& barSizeWidth, int& barSizeHeight, int *size, vtkViewport *viewport, vtkFloatingPointType *range); + + /** Place the distribution plot actor in the viewport according to the + * scalar bar location and orientation */ + void PlaceDistribution(vtkViewport *viewport, const int barWidth, const int barHeight); private: VISU_ScalarBarActor(const VISU_ScalarBarActor&); // Not implemented. diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index 5dbf6e47..3003295d 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -39,68 +39,6 @@ #include -//---------------------------------------------------------------------------- -namespace -{ - inline - void - MarkValueByColor(VISU_LookupTable* theTable, - vtkFloatingPointType theValue, - unsigned char* theColor) - { - vtkIdType anIndex = theTable->GetIndex(theValue); - unsigned char *aTablePtr = theTable->GetPointer(anIndex); - aTablePtr[0] = theColor[0]; - aTablePtr[1] = theColor[1]; - aTablePtr[2] = theColor[2]; - } - - inline - void - CopyColor(unsigned char* theTaget, const unsigned char* theSource) - { - theTaget[0] = theSource[0]; - theTaget[1] = theSource[1]; - theTaget[2] = theSource[2]; - } - - void - FillByColor(VISU_LookupTable* theTable, - unsigned char* theColor) - { - vtkIdType aNbColors = theTable->GetNumberOfColors(); - for(int i = 0; i < aNbColors; i++){ - unsigned char *aTablePtr = theTable->GetPointer(i); - CopyColor(aTablePtr,theColor); - } - } - - void - MakeBiColor(VISU_LookupTable* theTable) - { - unsigned char aRedPtr[3] = {255, 0, 0}; - unsigned char aBluePtr[3] = {0, 0, 255}; - - vtkFloatingPointType aRange[2]; - theTable->GetTableRange(aRange); - vtkIdType aNbColors = theTable->GetNumberOfColors(); - - vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors; - vtkFloatingPointType aValue = aRange[0]+0.5*aDelta; - for(int i = 0; i < aNbColors; i++){ - vtkIdType anIndex = theTable->GetIndex(aValue); - unsigned char* aTablePtr = theTable->GetPointer(anIndex); - if(aValue > 0.0){ - CopyColor(aTablePtr,aRedPtr); - }else{ - CopyColor(aTablePtr,aBluePtr); - } - aValue += aDelta; - } - } -} - - //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_ScalarBarCtrl); @@ -435,16 +373,16 @@ VISU_ScalarBarCtrl { if(myMarked){ if(myMode == eGlobal){ - MarkValueByColor(myGlobalLookupTable, myMarkedValue, myBlack); + myGlobalLookupTable->MarkValueByColor( myMarkedValue, myBlack ); }else{ - MarkValueByColor(myLocalLookupTable, myMarkedValue, myBlack); + myLocalLookupTable->MarkValueByColor( myMarkedValue, myBlack ); } } if(myGlobalRangeIsDefined){ vtkFloatingPointType aLocalRange[2]; myLocalLookupTable->GetTableRange(aLocalRange); - MarkValueByColor(myGlobalLookupTable, aLocalRange[0], myBlack); - MarkValueByColor(myGlobalLookupTable, aLocalRange[1], myBlack); + myGlobalLookupTable->MarkValueByColor( aLocalRange[0], myBlack ); + myGlobalLookupTable->MarkValueByColor( aLocalRange[1], myBlack ); } } @@ -490,9 +428,9 @@ VISU_ScalarBarCtrl ::UpdateForColor() { if(myMode == eGlobal){ - FillByColor(myLocalLookupTable,myGrey); + myLocalLookupTable->FillByColor( myGrey ); }else if(myMode == eLocal){ - FillByColor(myGlobalLookupTable,myGrey); + myGlobalLookupTable->FillByColor( myGrey ); } } @@ -506,15 +444,15 @@ VISU_ScalarBarCtrl myLocalLookupTable->Build(); if(myMode == eSimple){ - MakeBiColor(myLocalLookupTable); + myLocalLookupTable->MakeBiColor(); return; } if(myMode == eGlobal){ - MakeBiColor(myGlobalLookupTable); - FillByColor(myLocalLookupTable,myGrey); + myGlobalLookupTable->MakeBiColor(); + myLocalLookupTable->FillByColor( myGrey ); }else if(myMode == eLocal){ - MakeBiColor(myLocalLookupTable); - FillByColor(myGlobalLookupTable,myGrey); + myLocalLookupTable->MakeBiColor(); + myGlobalLookupTable->FillByColor( myGrey ); } } diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx new file mode 100644 index 00000000..54ff4f87 --- /dev/null +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -0,0 +1,368 @@ +// VISU ScalarMapOnDeformedShapePL +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File: VISU_ScalarMapOnDeformedShapePL.cxx +// Author: Eugeny Nikolaev +// Module : VISU + +#include "VISU_ScalarMapOnDeformedShapePL.hxx" +#include "VISU_FieldTransform.hxx" +#include "VISU_Extractor.hxx" +#include "VISU_LookupTable.hxx" +#include "VISU_DeformedShapePL.hxx" +#include "VTKViewer_TransformFilter.h" +#include "VTKViewer_Transform.h" +#include "VISU_MergeFilter.hxx" + +#include "VISU_PipeLineUtils.hxx" + +#include +#include +#include +#include + + +//---------------------------------------------------------------------------- +vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL) + +//---------------------------------------------------------------------------- +/*! + * Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid + * Where: + * \li myDeformVectors is vtkWarpVector - deformation vectors data + * \li myScalarsMergeFilter is vtkMergeFilter - merge filter. + * Merge filter which unify the deformation and scalars + * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data +*/ +VISU_ScalarMapOnDeformedShapePL +::VISU_ScalarMapOnDeformedShapePL(): + myScaleFactor(0.0) +{ + myWarpVector = vtkWarpVector::New(); + + myScalarsMergeFilter = VISU_MergeFilter::New(); + myScalarsMergeFilter->SetMergingInputs(true); + + myScalarsExtractor = VISU_Extractor::New(); + + myScalarsFieldTransform = VISU_FieldTransform::New(); + + myCellDataToPointData = vtkCellDataToPointData::New(); +} + +//---------------------------------------------------------------------------- +/*! + * Destructor. + * Delete all fields. +*/ +VISU_ScalarMapOnDeformedShapePL +::~VISU_ScalarMapOnDeformedShapePL() +{ + myWarpVector->Delete(); + + myScalarsMergeFilter->Delete(); + + myScalarsExtractor->Delete(); + + myScalarsFieldTransform->Delete(); + + myCellDataToPointData->Delete(); +} + +//---------------------------------------------------------------------------- +/*! + * Initial method + */ +void +VISU_ScalarMapOnDeformedShapePL +::Init() +{ + Superclass::Init(); + + SetScale(VISU_DeformedShapePL::GetDefaultScale(this)); +} + +//---------------------------------------------------------------------------- +/*! + * Build method + * Building of deformation and puts result to merge filter. + */ +void +VISU_ScalarMapOnDeformedShapePL +::Build() +{ + Superclass::Build(); +} + + +//---------------------------------------------------------------------------- +vtkDataSet* +VISU_ScalarMapOnDeformedShapePL +::InsertCustomPL() +{ + GetMapper()->SetColorModeToMapScalars(); + GetMapper()->ScalarVisibilityOn(); + + VISU::CellDataToPoint(myWarpVector, + myCellDataToPointData, + GetMergedInput()); + + myScalars = GetMergedInput(); + + UpdateScalars(); + + myScalarsFieldTransform->SetInput(myScalarsExtractor->GetOutput()); + + // Sets geometry for merge filter + myScalarsMergeFilter->SetGeometry(myWarpVector->GetUnstructuredGridOutput()); + + vtkDataSet* aScalarsDataSet = myScalarsFieldTransform->GetOutput(); + myScalarsMergeFilter->SetScalars(aScalarsDataSet); + myScalarsMergeFilter->AddField("VISU_CELLS_MAPPER", aScalarsDataSet); + myScalarsMergeFilter->AddField("VISU_POINTS_MAPPER", aScalarsDataSet); + + return myScalarsMergeFilter->GetOutput(); +} + + +//---------------------------------------------------------------------------- +/*! + * Update method + */ +void +VISU_ScalarMapOnDeformedShapePL +::Update() +{ + Superclass::Update(); + //{ + // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsExtractor.vtk"; + // VISU::WriteToFile(myScalarsExtractor->GetUnstructuredGridOutput(), aFileName); + //} + //{ + // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk"; + // VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName); + //} + //{ + // std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsMergeFilter.vtk"; + // VISU::WriteToFile(myScalarsMergeFilter->GetUnstructuredGridOutput(), aFileName); + //} +} + +//---------------------------------------------------------------------------- +unsigned long int +VISU_ScalarMapOnDeformedShapePL +::GetMemorySize() +{ + unsigned long int aSize = Superclass::GetMemorySize(); + + if(vtkDataSet* aDataSet = myWarpVector->GetOutput()) + aSize += aDataSet->GetActualMemorySize() * 1024; + + if(vtkDataSet* aDataSet = myScalarsExtractor->GetOutput()) + aSize += aDataSet->GetActualMemorySize() * 1024; + + if(vtkDataSet* aDataSet = myScalarsMergeFilter->GetOutput()) + aSize += aDataSet->GetActualMemorySize() * 1024; + + if(myCellDataToPointData->GetInput()) + if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput()) + aSize += aDataSet->GetActualMemorySize() * 1024; + + return aSize; +} + +//---------------------------------------------------------------------------- +/*! + * Update scalars method. + * Put scalars to merge filter. + */ +void +VISU_ScalarMapOnDeformedShapePL +::UpdateScalars() +{ + vtkDataSet* aScalars = GetScalars(); + myScalarsExtractor->SetInput(aScalars); + + if(VISU::IsDataOnCells(aScalars)) + GetMapper()->SetScalarModeToUseCellData(); + else + GetMapper()->SetScalarModeToUsePointData(); +} + +//---------------------------------------------------------------------------- +/*! + * Copy information about pipline. + * Copy scale and scalars. + */ +void +VISU_ScalarMapOnDeformedShapePL +::DoShallowCopy(VISU_PipeLine *thePipeLine, + bool theIsCopyInput) +{ + Superclass::DoShallowCopy(thePipeLine, theIsCopyInput); + + if(VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast(thePipeLine)){ + SetScale(aPipeLine->GetScale()); + SetScalars(aPipeLine->GetScalars()); + } +} + +//---------------------------------------------------------------------------- +/*! + * Set scalars. + * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction. + */ +void +VISU_ScalarMapOnDeformedShapePL +::SetScalars(vtkDataSet *theScalars) +{ + if(GetScalars() == theScalars) + return; + + myScalars = theScalars; + UpdateScalars(); +} + +//---------------------------------------------------------------------------- +/*! + * Get pointer to input scalars. + */ +vtkDataSet* +VISU_ScalarMapOnDeformedShapePL +::GetScalars() +{ + return myScalars.GetPointer(); +} + +//---------------------------------------------------------------------------- +/*! + * Sets scale for deformed shape + */ +void +VISU_ScalarMapOnDeformedShapePL +::SetScale(vtkFloatingPointType theScale) +{ + if(VISU::CheckIsSameValue(myScaleFactor, theScale)) + return; + + myWarpVector->SetScaleFactor(theScale); + myScaleFactor = theScale; +} + +//---------------------------------------------------------------------------- +/*! + * Gets scale of deformed shape. + */ +vtkFloatingPointType +VISU_ScalarMapOnDeformedShapePL +::GetScale() +{ + return myWarpVector->GetScaleFactor(); +} + +//---------------------------------------------------------------------------- +/*! + * Set scale factor of deformation. + */ +void +VISU_ScalarMapOnDeformedShapePL +::SetMapScale(vtkFloatingPointType theMapScale) +{ + Superclass::SetMapScale(theMapScale); + myWarpVector->SetScaleFactor(myScaleFactor*theMapScale); +} + +//---------------------------------------------------------------------------- +/*! + * Gets scalar mode. + */ +int +VISU_ScalarMapOnDeformedShapePL +::GetScalarMode() +{ + return myScalarsExtractor->GetScalarMode(); +} + +//---------------------------------------------------------------------------- +/*! + * Sets scalar mode. + */ +void +VISU_ScalarMapOnDeformedShapePL +::SetScalarMode(int theScalarMode) +{ + VISU_ScalarMapPL::SetScalarMode(theScalarMode, GetScalars(), myScalarsExtractor); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapOnDeformedShapePL +::SetScaling(int theScaling) +{ + if(GetScaling() == theScaling) + return; + + GetBarTable()->SetScale(theScaling); + + if(theScaling == VTK_SCALE_LOG10) + myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10)); + else + myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident)); +} + + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapOnDeformedShapePL +::SetScalarRange(vtkFloatingPointType theRange[2]) +{ + if(VISU::CheckIsSameRange(theRange, GetScalarRange())) + return; + + myScalarsFieldTransform->SetScalarRange(theRange); + GetBarTable()->SetRange(theRange); +} + + +//---------------------------------------------------------------------------- +vtkFloatingPointType* +VISU_ScalarMapOnDeformedShapePL +::GetScalarRange() +{ + return myScalarsFieldTransform->GetScalarRange(); +} + + +//---------------------------------------------------------------------------- +/*! + * Gets ranges of extracted scalars + * \param theRange[2] - output values + * \li theRange[0] - minimum value + * \li theRange[1] - maximum value + */ +void +VISU_ScalarMapOnDeformedShapePL +::GetSourceRange(vtkFloatingPointType theRange[2]) +{ + myScalarsExtractor->Update(); + myScalarsExtractor->GetUnstructuredGridOutput()->GetScalarRange(theRange); +} diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx new file mode 100644 index 00000000..041a37d2 --- /dev/null +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx @@ -0,0 +1,146 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File: VISU_ScalarMapOnDeformedShapePL.hxx +// Author: Eugeny Nikolaev +// Module : VISU + +#ifndef VISU_ScalarMapOnDeformedShapePL_HeaderFile +#define VISU_ScalarMapOnDeformedShapePL_HeaderFile + +#include "VISUPipeline.hxx" +#include "VISU_ScalarMapPL.hxx" + +class VISU_MergeFilter; +class vtkWarpVector; +class vtkUnstructuredGrid; +class vtkCellDataToPointData; +class vtkPointDataToCellData; + + +//---------------------------------------------------------------------------- +class VISU_PIPELINE_EXPORT VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL +{ +public: + vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL, VISU_ScalarMapPL); + + static + VISU_ScalarMapOnDeformedShapePL* + New(); + + virtual + void + SetScale(vtkFloatingPointType theScale); + + virtual + vtkFloatingPointType + GetScale(); + + virtual + int + GetScalarMode(); + + virtual + void + SetScalarMode(int theScalarMode = 0); + + virtual + void + SetScaling(int theScaling); + + virtual + void + SetScalarRange(vtkFloatingPointType theRange[2]); + + virtual + vtkFloatingPointType* + GetScalarRange(); + + virtual + void + GetSourceRange(vtkFloatingPointType theRange[2]); + + virtual + void + SetScalars(vtkDataSet *theScalars); + + virtual + vtkDataSet* + GetScalars(); + +public: + //! Redefined method for initialization of the pipeline. + virtual + void + Init(); + + //! Redefined method for building the pipeline. + virtual + void + Build(); + + //! Redefined method for updating the pipeline. + virtual + void + Update(); + + //! Gets memory size used by the instance (bytes). + virtual + unsigned long int + GetMemorySize(); + + //! Update scalars. + void + UpdateScalars(); + + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); + +protected: + VISU_ScalarMapOnDeformedShapePL(); + + virtual + ~VISU_ScalarMapOnDeformedShapePL(); + + virtual + vtkDataSet* + InsertCustomPL(); + + virtual + void + DoShallowCopy(VISU_PipeLine *thePipeLine, + bool theIsCopyInput); + +private: + VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&); + + vtkFloatingPointType myScaleFactor; + vtkWarpVector *myWarpVector; + VISU_MergeFilter *myScalarsMergeFilter; + vtkSmartPointer myScalars; + vtkCellDataToPointData* myCellDataToPointData; + VISU_FieldTransform* myScalarsFieldTransform; + VISU_Extractor* myScalarsExtractor; +}; + +#endif diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index ad739773..e252334b 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -56,6 +56,7 @@ VISU_ScalarMapPL myMergeFilter(VISU_MergeFilter::New()) { SetIsShrinkable(true); + SetIsFeatureEdgesAllowed(true); SetElnoDisassembleState( false ); diff --git a/src/PIPELINE/VISU_StreamLinesPL.cxx b/src/PIPELINE/VISU_StreamLinesPL.cxx index b596155e..82c05009 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.cxx +++ b/src/PIPELINE/VISU_StreamLinesPL.cxx @@ -62,6 +62,7 @@ VISU_StreamLinesPL ::VISU_StreamLinesPL() { SetIsShrinkable(false); + SetIsFeatureEdgesAllowed(false); myStream = vtkStreamLine::New(); myCenters = vtkCellCenters::New(); diff --git a/src/PIPELINE/VISU_VectorsPL.cxx b/src/PIPELINE/VISU_VectorsPL.cxx index 1c3257b9..e3976494 100644 --- a/src/PIPELINE/VISU_VectorsPL.cxx +++ b/src/PIPELINE/VISU_VectorsPL.cxx @@ -63,7 +63,8 @@ void ToCellCenters( TOutputFilter *theOutputFilter, VISU_VectorsPL ::VISU_VectorsPL() { - SetIsShrinkable( false ); + SetIsShrinkable(false); + SetIsFeatureEdgesAllowed(false); myGlyph = vtkGlyph3D::New(); diff --git a/src/VISUGUI/Makefile.am b/src/VISUGUI/Makefile.am index e3a86336..959e972e 100644 --- a/src/VISUGUI/Makefile.am +++ b/src/VISUGUI/Makefile.am @@ -30,20 +30,65 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am lib_LTLIBRARIES= libVISU.la -salomeinclude_HEADERS= VisuGUI_Tools.h - # .po files to transform in .qm nodist_salomeres_DATA= \ VISU_msg_en.qm VISU_images.qm +salomeinclude_HEADERS= \ + VisuGUI_Tools.h \ + VisuGUI_Prs3dTools.h \ + VisuGUI_ActionsDef.h \ + VisuGUI.h \ + VisuGUI_Module.h \ + VisuGUI_Selection.h \ + VisuGUI_Tools.h \ + VisuGUI_ViewTools.h \ + VisuGUI_PopupTools.h \ + VisuGUI_NameDlg.h \ + VisuGUI_FileDlg.h \ + VisuGUI_CursorDlg.h \ + VisuGUI_TimeAnimation.h \ + VisuGUI_EditContainerDlg.h \ + VisuGUI_ClippingDlg.h \ + VisuGUI_DialogRunner.h \ + VisuGUI_OffsetDlg.h \ + VisuGUI_Prs3dDlg.h \ + VisuGUI_ScalarBarDlg.h \ + VisuGUI_Plot3DDlg.h \ + VisuGUI_GaussPointsDlg.h \ + VisuGUI_DeformedShapeDlg.h \ + VisuGUI_IsoSurfacesDlg.h \ + VisuGUI_CutLinesDlg.h \ + VisuGUI_CutPlanesDlg.h \ + VisuGUI_StreamLinesDlg.h \ + VisuGUI_VectorsDlg.h \ + VisuGUI_Displayer.h \ + VisuGUI_DeformedShapeAndScalarMapDlg.h \ + VisuGUI_SetupPlot2dDlg.h \ + VisuGUI_BuildProgressDlg.h \ + VisuGUI_TransparencyDlg.h \ + VisuGUI_Timer.h \ + VisuGUI_Slider.h \ + VisuGUI_InputPane.h \ + VisuGUI_CacheDlg.h \ + VisuGUI_FieldFilter.h \ + VisuGUI_ValuesLabelingDlg.h + dist_libVISU_la_SOURCES= \ VisuGUI.cxx \ VisuGUI_Factory.cxx \ VisuGUI_Module.cxx \ - VisuGUI_Selection.cxx \ + VisuGUI_InputPanel.cxx \ + VisuGUI_BasePanel.cxx \ + VisuGUI_Panel.cxx \ + VisuGUI_SelectionPanel.cxx \ + VisuGUI_SelectionPrefDlg.cxx \ + VisuGUI_GaussPointsSelectionPane.cxx \ + VisuGUI_FindPane.cxx \ + VisuGUI_FeatureEdgesPanel.cxx \ VisuGUI_Tools.cxx \ VisuGUI_ViewTools.cxx \ - VisuGUI_PopupTools.cxx \ + VisuGUI_Selection.cxx \ VisuGUI_NameDlg.cxx \ VisuGUI_FileDlg.cxx \ VisuGUI_CursorDlg.cxx \ @@ -70,15 +115,27 @@ dist_libVISU_la_SOURCES= \ VisuGUI_TransparencyDlg.cxx \ VisuGUI_Timer.cxx \ VisuGUI_Slider.cxx \ + VisuGUI_Sweep.cxx \ VisuGUI_InputPane.cxx \ VisuGUI_CacheDlg.cxx \ + VisuGUI_FileInfoDlg.cxx \ VisuGUI_FieldFilter.cxx \ - VisuGUI_FileInfoDlg.cxx + VisuGUI_ClippingPanel.cxx \ + VisuGUI_ClippingPlaneDlg.cxx \ + VisuGUI_FilterScalarsDlg.cxx \ + VisuGUI_ValuesLabelingDlg.cxx MOC_FILES= \ VisuGUI_moc.cxx \ VisuGUI_Module_moc.cxx \ - VisuGUI_Selection_moc.cxx \ + VisuGUI_InputPanel_moc.cxx \ + VisuGUI_BasePanel_moc.cxx \ + VisuGUI_Panel_moc.cxx \ + VisuGUI_SelectionPanel_moc.cxx \ + VisuGUI_SelectionPrefDlg_moc.cxx \ + VisuGUI_GaussPointsSelectionPane_moc.cxx \ + VisuGUI_FindPane_moc.cxx \ + VisuGUI_FeatureEdgesPanel_moc.cxx \ VisuGUI_NameDlg_moc.cxx \ VisuGUI_FileDlg_moc.cxx \ VisuGUI_CursorDlg_moc.cxx \ @@ -103,9 +160,15 @@ MOC_FILES= \ VisuGUI_Table3dDlg_moc.cxx \ VisuGUI_TransparencyDlg_moc.cxx \ VisuGUI_Slider_moc.cxx \ + VisuGUI_Sweep_moc.cxx \ VisuGUI_InputPane_moc.cxx \ VisuGUI_CacheDlg_moc.cxx \ - VisuGUI_FileInfoDlg_moc.cxx + VisuGUI_FileInfoDlg_moc.cxx \ + VisuGUI_ClippingPanel_moc.cxx \ + VisuGUI_ClippingPlaneDlg_moc.cxx \ + VisuGUI_FilterScalarsDlg_moc.cxx \ + VisuGUI_ValuesLabelingDlg_moc.cxx + nodist_libVISU_la_SOURCES=$(MOC_FILES) diff --git a/src/VISUGUI/VISU_images.ts b/src/VISUGUI/VISU_images.ts deleted file mode 100644 index dd7a9d46..00000000 --- a/src/VISUGUI/VISU_images.ts +++ /dev/null @@ -1,294 +0,0 @@ - - - - @default - - ICON_ADD - Visu_add.png - - - ICON_CUBE_AXES - Visu_graduated_axes.png - - - ICON_CUT_LINES - Visu_cutlines.png - - - ICON_CUT_PLANES - Visu_cutplanes.png - - - ICON_DEFORMED_SHAPE - Visu_deformed.png - - - ICON_ERASE_ALL - Visu_eraseall.png - - - ICON_GAUSS_NEW_VIEWER - Visu_points.png - - - ICON_GAUSS_POINTS - Visu_gauss_points.png - - - ICON_GLOBAL_SELECTION - Visu_selectall.png - - - ICON_HOLO_RENDER - Visu_holo_render.png - - - ICON_IMPORT_MED - Visu_import_med.png - - - ICON_ISO_SURFACES - Visu_isosurfaces.png - - - ICON_LOAD_TEXTURE - Visu_load_texture.png - - - ICON_MULTIPR_VIEW_FULL - Visu_tree_multipr_full.png - - - ICON_MULTIPR_VIEW_HIDE - Visu_tree_multipr_hide.png - - - ICON_MULTIPR_VIEW_LOW - Visu_tree_multipr_low.png - - - ICON_MULTIPR_VIEW_MEDIUM - Visu_tree_multipr_medium.png - - - ICON_OBJBROWSER_Visu - Visu_tree_visu.png - - - ICON_PARTIAL_SELECTION - Visu_selectonly.png - - - ICON_PLOT2D - Visu_plot2d.png - - - ICON_PLOT_3D - Visu_plot3d.png - - - ICON_POINTS - Visu_points.png - - - ICON_REMOVE - Visu_remove.png - - - ICON_SCALAR_MAP - Visu_scalars.png - - - ICON_SCALAR_MAP_ON_DEFORMED_SHAPE - Visu_scalarmapondeformedshape.png - - - ICON_SCALING - Visu_scaling.png - - - ICON_SLIDER_AVI - Visu_slider_avi.png - - - ICON_SLIDER_FIRST - Visu_slider_first.png - - - ICON_SLIDER_LAST - Visu_slider_last.png - - - ICON_SLIDER_MORE - Visu_slider_more.png - - - ICON_SLIDER_NEXT - Visu_slider_next.png - - - ICON_SLIDER_PAUSE - Visu_slider_pause.png - - - ICON_SLIDER_PLAY - Visu_slider_play.png - - - ICON_SLIDER_PREVIOUS - Visu_slider_previous.png - - - ICON_STREAM_LINES - Visu_streamlines.png - - - ICON_SURFACE - Visu_surface.png - - - ICON_SWEEP - Visu_scalars_anim.png - - - ICON_TIMEANIMATION - Visu_anim.png - - - ICON_TREE_CONTAINER - Visu_tree_container.png - - - ICON_TREE_CURVE - Visu_tree_curve.png - - - ICON_TREE_CUT_LINES - Visu_tree_cutlines.png - - - ICON_TREE_CUT_LINES_GROUPS - Visu_tree_cutlines_gr.png - - - ICON_TREE_CUT_PLANES - Visu_tree_cutplanes.png - - - ICON_TREE_CUT_PLANES_GROUPS - Visu_tree_cutplanes_gr.png - - - ICON_TREE_DEFORMED_SHAPE - Visu_tree_deformed.png - - - ICON_TREE_DEFORMED_SHAPE_GROUPS - Visu_tree_deformed_gr.png - - - ICON_TREE_GAUSS_POINTS - Visu_tree_gauss_points.png - - - ICON_TREE_ISO_SURFACES - Visu_tree_isosurfaces.png - - - ICON_TREE_ISO_SURFACES_GROUPS - Visu_tree_isosurfaces_gr.png - - - ICON_TREE_MESH - Visu_tree_mesh.png - - - ICON_TREE_PLOT_3D - Visu_tree_plot3d.png - - - ICON_TREE_PLOT_3D_GROUPS - Visu_tree_plot3d_gr.png - - - ICON_TREE_RESULT - Visu_tree_result.png - - - ICON_TREE_SCALAR_MAP - Visu_tree_scalars.png - - - ICON_TREE_SCALAR_MAP_GROUPS - Visu_tree_scalars_gr.png - - - ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE - Visu_tree_scalarmapondeformedshape.png - - - ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE_GROUPS - Visu_tree_scalarmapondeformedshape_gr.png - - - ICON_TREE_STREAM_LINES - Visu_tree_streamlines.png - - - ICON_TREE_STREAM_LINES_GROUPS - Visu_tree_streamlines_gr.png - - - ICON_TREE_TABLE - Visu_tree_table.png - - - ICON_TREE_VECTORS - Visu_tree_vectors.png - - - ICON_TREE_VECTORS_GROUPS - Visu_tree_vectors_gr.png - - - ICON_VECTORS - Visu_vectors.png - - - ICON_VVTK_INTERACTOR_STYLE_SWITCH - Visu_vvtk_switch.png - - - ICON_VVTK_PLANE_SEGMENTATION_SWITCH - Visu_PlaneSegmentation.png - - - ICON_VVTK_RECORDING_PAUSE - Visu_recording_pause.png - - - ICON_VVTK_RECORDING_PLAY - Visu_recording_play.png - - - ICON_VVTK_RECORDING_START - Visu_recording_start.png - - - ICON_VVTK_RECORDING_STOP - Visu_recording_stop.png - - - ICON_VVTK_SELECTION_MODE_SWITCH - Visu_points.png - - - ICON_VVTK_SPHERE_SEGMENTATION_SWITCH - Visu_SphereSegmentation.png - - - ICON_WIREFRAME - Visu_wireframe.png - - - diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts deleted file mode 100644 index b24996d2..00000000 --- a/src/VISUGUI/VISU_msg_en.ts +++ /dev/null @@ -1,3431 +0,0 @@ - - - - @default - - ASSIGNED - Assigned - - - ATTRIBUTES_LBL - Attributes - - - AXIS_LBL - Axis - - - BTN_RESET - Reset - - - DATA_LBL - Data - - - ERR_CANT_BUILD_PRESENTATION - The object can't be built - - - ERR_CANT_CREATE_ACTOR - Can't create actor for this presentation - - - ERR_CANT_CREATE_ANIMATION - Can't create animation for these fields: -number of time stamps or number of components is not the same! - - - ERR_CANT_FIND_MED_COMPONENT - Failed to activate MED engine! - - - ERR_CANT_FIND_VISU_COMPONENT - Failed to activate VISU engine! - - - ERR_NO_MEMORY_TO_BUILD - Please, free %1 Mb to make the cache enlarging possible -(for example, try to delete some holders) - - - IMPORT_DONE - Importing is done - - - INF_DONE - done - - - INF_VISU - Post-Pro Info - - - NO_GROUPS - No groups in the mesh - - - PARALLEL_ANIMATION - Parallel Animation - - - PERIOD_2PI - From -PI to PI - - - PERIOD_PI - From 0 to PI - - - PRS_ON_GROUPS - Use Only Groups - - - SUCCESSIVE_ANIMATION - Successive Animation - - - TIT_OFFSETDLG - Translate Presentation - - - TLT_SETUP_PLOT2D - Setup Plot 2d - - - UNITS_LBL - Units - - - VISU_3DCACHE_PROPS - 3D Cache properties - - - VISU_COLORS_AND_LABELS - Colors && Labels - - - VISU_COMPONENT - Component - - - VISU_COS_SWEEP - Cosinusoidal ( (1 - cos(t))/2 ) - - - VISU_CUTLINE_PREF - CutLine preferences - - - VISU_CUT_LINES - Cut Lines - - - VISU_CUT_PLANES - Cut Planes - - - VISU_DEFORMED_SHAPE - Deformed Shape - - - VISU_DISP_ONLY - Display only on creation - - - VISU_FIELD_RANGE - Field range - - - VISU_FONT - Font - - - VISU_FONT_ARIAL - Arial - - - VISU_FONT_COURIER - Courier - - - VISU_FONT_TIMES - Times - - - VISU_HEIGHT - Height: - - - VISU_HORIZONTAL - Horizontal - - - VISU_IMPOSED_RANGE - Imposed range - - - VISU_IS2PI - Parameter varies: - - - VISU_ISO_SURFACES - Iso Surfaces - - - VISU_LABELS - Labels - - - VISU_LIMITED - Limited - - - VISU_LINEAR_SWEEP - Linear - - - VISU_LOGARITHMIC_SCALING - Logarithmic scaling - - - VISU_MAX - Max: - - - VISU_MEMORY_LIMIT - Memory limit (Mb) - - - VISU_MEMORY_MODE - Memory mode - - - VISU_MESH - Mesh - - - VISU_MIN - Min: - - - VISU_MINIMAL - Minimal - - - VISU_MINMAX_IMPOSED_RANGE - Min and max for imposed range - - - VISU_MODULUS - Modulus - - - VISU_NB_COLORS - Nb. of colors - - - VISU_NB_CYCLES - Number of cycles - - - VISU_NB_LABELS - Nb. of labels - - - VISU_NB_STEPS - Number of steps - - - VISU_ORIENTATION - Orientation - - - VISU_ORIGIN_AND_SIZE - Origin && Size - - - VISU_PLOT3D - Plot3D - - - VISU_PREF_MED_FULL_LOAD - Full MED loading - - - VISU_PREF_MED_IMPORT - MED files import - - - VISU_PREF_SECOND_TAB - Scalar range, Sweep, MED import, Shading - - - VISU_RANGE_TO_USE - Range to use - - - VISU_REPRESENT_PROPS - Representation properties - - - VISU_SCALAR_BAR - Scalar Bar - - - VISU_SCALAR_MAP - Scalar Map - - - VISU_SCALAR_MAP_ON_DEFORMED_SHAPE - Scalar Map on Def. Shape - - - VISU_SCALAR_MODE - Scalar mode - - - VISU_SCALAR_RANGE - Scalar range - - - VISU_SHRINK - Shrink - - - VISU_SIN_SWEEP - Sinusoidal ( sin( t - PI/2 ) ) - - - VISU_STREAM_LINES - Stream Lines - - - VISU_SWEEPING_MODES - Mode of the sweeping - - - VISU_SWEEPING_PREF - Sweeping preferences - - - VISU_TIME_STEP - Time step(second) - - - VISU_TITLE - Title - - - VISU_USE_SHADING - Use Shading - - - VISU_VECTORS - Vectors - - - VISU_VERTICAL - Vertical - - - VISU_WIDTH - Width: - - - VISU_X - X: - - - VISU_Y - Y: - - - WRN_EXTRA_MEMORY_REQUIRED - Cache need more memory to build the presentation (%1 Mb). -Do you want to enlarge the cache? - - - WRN_NO_AVAILABLE_DATA - No Available data in selection - - - WRN_STUDY_LOCKED - Current Study is locked - - - WRN_VISU - Post-Pro Warning - - - WRN_VISU_WARNING - Warning - - - INF_FAILED - failed! - - - VISU_IS_UNITS - Display units in title - - - VISU_LABELS_FORMAT - Labels format - - - VISU_TITLE_WIDTH - Title width (%): - - - VISU_TITLE_HEIGHT - Title height (%): - - - VISU_LABEL_WIDTH - Label width (%): - - - VISU_LABEL_HEIGHT - Label height (%): - - - VISU_BAR_WIDTH - Bar width (%): - - - VISU_BAR_HEIGHT - Bar height (%): - - - VISU_AUTOMATIC_FIT_ALL - Automatic Fit All - - - VISU_DEFORMED_SHAPE_AND_SCALAR_MAP - Def. Shape and Scalar Map - - - VISU_FLOATING_POINT_PRECISION - Floating Point Precision - - - VISU_REALLY_DELETE - Do you really want to delete this %1 object(s): %2 - - - WRN_NO_APPROPRIATE_SELECTION - No appropriate objects selected - - - - VVTK_MainWindow - - DSC_VVTK_RECORDING_PAUSE - Pause recording - - - DSC_VVTK_RECORDING_PLAY - Play recording - - - DSC_VVTK_RECORDING_START - Start recording - - - DSC_VVTK_RECORDING_STOP - Stop recording - - - LBL_TOOLBAR_RECORD_LABEL - Recording Operations - - - MNU_VVTK_RECORDING_PAUSE - Pause recording - - - MNU_VVTK_RECORDING_PLAY - Play recording - - - MNU_VVTK_RECORDING_START - Start recording - - - MNU_VVTK_RECORDING_STOP - Stop recording - - - MSG_NO_AVI_MAKER - Tool jpeg2yuv, necessary for AVI recording, is not available. -Please, refer to the documentation. - - - - VVTK_MainWindow1 - - DSC_VVTK_INTERACTOR_STYLE_SWITCH - Interaction Style Switch - - - DSC_VVTK_PLANE_SEGMENTATION_SWITCH - Plane Segmentation - - - DSC_VVTK_SELECTION_MODE_SWITCH - Selection Mode Switch - - - DSC_VVTK_SPHERE_SEGMENTATION_SWITCH - Sphere Segmentation - - - LBL_TOOLBAR_GAUSS_LABEL - Gauss Viewer Tools - - - MNU_VVTK_INTERACTOR_STYLE_SWITCH - Interaction Style Switch - - - MNU_VVTK_PLANE_SEGMENTATION_SWITCH - Plane Segmentation - - - MNU_VVTK_SELECTION_MODE_SWITCH - Selection Mode Switch - - - MNU_VVTK_SPHERE_SEGMENTATION_SWITCH - Sphere Segmentation - - - - VVTK_PickingDlg - - BELOW_POINT - Centered below the point - - - CAMERA_TITLE - Movement of the camera - - - CURSOR_SIZE - Size of the cursor : - - - CURSOR_TITLE - Cursor - - - DISPLAY_PARENT_MESH - Display parent mesh element - - - INFO_WINDOW_TITLE - Information window - - - PARENT_MESH_TITLE - Parent mesh element - - - PICKING_DLG_TITLE - Picking - - - POINT_TOLERANCE - Point tolerance : - - - POSITION - Position : - - - PYRAMID_HEIGHT - Height of the pyramids : - - - SELECTION_COLOR - Selection cursor color : - - - STEP_NUMBER - Number of steps between two positions : - - - TOLERANCE_TITLE - Tolerance - - - TOP_LEFT_CORNER - Top-left corner of the 3D view - - - TRANSPARENCY - Transparency : - - - ZOOM_FACTOR - Zoom at first selected point (ratio) : - - - DATA_POSITION - Position - - - PARENT_ELEMENT - Parent mesh element ID: - - - LOCAL_POINT - Local Gauss Point ID: - - - - VVTK_PrimitiveBox - - ALPHA_TEXTURE - Alpha Channel Texture (16x16) : - - - ALPHA_THRESHOLD - Alpha Channel Threshold : - - - CLAMP - Maximum Size (Clamp) : - - - FACE_LIMIT - Notify when number of faces exceeds : - - - FACE_NUMBER - Number of faces : - - - GEOMETRICAL_SPHERE - Geometrical Sphere - - - MAIN_TEXTURE - Main Texture (16x16) : - - - OPENGL_POINT - OpenGL Point - - - POINT_SPRITE - Point Sprite - - - PRIMITIVE_TITLE - Primitive - - - RESOLUTION - Resolution : - - - - VVTK_RecorderDlg - - ALL_DISLPAYED_FRAMES - Recording all displayed frames - - - CLOSE - Close - - - DLG_RECORDER_TITLE - Recorder - - - FILE_NAME - Save to file : - - - FLT_ALL_FILES - All Files (*.*) - - - FLT_AVI_FILES - AVI Files (*.avi) - - - FPS - FPS : - - - PROGRESSIVE - Progressive - - - QUALITY - Quality : - - - RECORDING_MODE - Mode : - - - SETTINGS - Settings - - - SKIPPED_FRAMES - Recording at a given FPS - - - START - Start - - - - VVTK_SegmentationCursorDlg - - DEPTH - Depth of the cursor: - - - DEPTH_TITLE - Depth - - - DIRECTION_DX - DX: - - - DIRECTION_DY - DY: - - - DIRECTION_DZ - DZ: - - - DIRECTION_TITLE - Direction - - - GAUSS_POINTS_TAB - Gauss Points - - - INCREMENT - +/- Ratio : - - - INSIDE_GAUSS_POINTS - Inside Cursor Gauss Points Presentation - - - MAGNIFICATION - Magnification (%) : - - - MAGNIFICATION_TITLE - Magnification - - - ORIGIN_TITLE - Origin - - - ORIGIN_X - X: - - - ORIGIN_Y - Y: - - - ORIGIN_Z - Z: - - - OUTSIDE_GAUSS_POINTS - Outside Cursor Gauss Points Presentation - - - RADIUS - Radius of the cursor : - - - RADIUS_TITLE - Radius - - - RATIO - +/- Ratio : - - - SEGMENTATION_CURSOR_DLG_TITLE - Segmentation Cursor - - - SEGMENTATION_CURSOR_TAB - Segmentation Cursor - - - - VVTK_SizeBox - - COLOR - Color : - - - COLOR_TITLE - Color - - - GEOM_SIZE - Size of points (%) : - - - INCREMENT - +/- Ratio : - - - MAGNIFICATION - Magnification (%) : - - - MAX_SIZE - max size (%) : - - - MIN_SIZE - Range values for min size (%) : - - - OUTSIDE_SIZE - Percentage of normal size(%) : - - - SIZE_TITLE - Size - - - UNIFORM_COLOR - Uniform Color - - - - VVTK_ViewManager - - VTK_VIEW_TITLE - Gauss scene:%1 - viewer:%2 - - - - VVTK_ViewWindow - - LBL_TOOLBAR_LABEL - GAUSS viewer tools - - - - VisuGUI - - DLG_LINEWIDTH_CMT1 - Set value between - - - DLG_LINEWIDTH_CMT2 - 1 (thin) and 10 (thick) - - - DLG_LINEWIDTH_TITLE - Line Width - - - DLG_OPACITY_CMT1 - Set value between - - - DLG_OPACITY_CMT2 - 0 (transparent) and 100 (opaque) - - - DLG_OPACITY_TITLE - Opacity - - - ERR_ACTIVATE_VIEW3D - Please activate 3D view before - - - ERR_ERROR_DURING_EXPORT - Error has been occured during exporting to file - - - ERR_SCALARBAR_PARAMS - Warning! The parameters is incorrect - - - FLT_ALL_FILES - All Files (*.*) - - - FLT_MED_FILES - MED Files (*.med) - - - FLT_TABLE_FILES - Tables (*.xls *.txt *.tab) - - - IMPORT_FROM_FILE - Import from File - - - MEN_ARRANGE_ACTORS - Arrange Actors - - - MEN_CACHE_PROPERTIES - Properties - - - MEN_CELL_COLOR - Cell color - - - MEN_CLEAR_CONTAINER - Clear - - - MEN_CLIPPING - Clipping planes - - - MEN_COLOR - Color... - - - MEN_COPY_PRS - Copy - - - MEN_CREATE_CURVES - Create Curves - - - MEN_CREATE_MANY_PRS - Create Presentations - - - MEN_CREATE_PLOT2D - Create Plot2d View - - - MEN_CREATE_PRS - Create Presentation - - - MEN_CREATE_TABLE - Create Table - - - MEN_CUBE_AXES - Graduated axes - - - MEN_CURVE_PROPS - Properties... - - - MEN_CUT_LINES - Cut Lines - - - MEN_CUT_PLANES - Cut Planes - - - MEN_DEFORMED_SHAPE - Deformed Shape - - - MEN_DELETE_OBJS - Delete - - - MEN_DELETE_VIEWPARAMS - Delete view parameters - - - MEN_SHOW - Show - - - MEN_DISPLAY_ONLY - Show Only - - - MEN_DISPLAY_SELECTION - Display Selection - - - MEN_EDGE_COLOR - Edge Color - - - MEN_EDIT_CONTAINER - Edit... - - - MEN_EDIT_PRS - Edit... - - - MEN_HIDE - Hide - - - MEN_ERASE_ALL - Hide All - - - MEN_EXPORT_TABLE - Export Table - - - MEN_FREE_SCALAR_BARS - Use Field Range - - - MEN_GLOBAL_SELECTION - Global Selection - - - MEN_HOLO_RENDER - Holo render - - - MEN_IMPORT - Import - - - MEN_IMPORT_FROM_FILE - MED file - - - MEN_IMPORT_MED_FIELD - Import Field - - - MEN_IMPORT_MED_STRUCTURE - Import Structure - - - MEN_IMPORT_MED_TIMESTAMP - Import TimeStamp - - - MEN_IMPORT_TABLE - Table from file - - - MEN_INSIDEFRAME - Insideframe - - - MEN_ISO_SURFACES - Iso Surfaces - - - MEN_LINE_WIDTH - Line Width - - - MEN_MERGE_SCALAR_BARS - Merge Scalar Range - - - MEN_MULTIPR_VIEW_FULL_RES - Display at full resolution - - - MEN_MULTIPR_VIEW_HIDE - Hide - - - MEN_MULTIPR_VIEW_LOW_RES - Display at low resolution - - - MEN_MULTIPR_VIEW_MEDIUM_RES - Display at medium resolution - - - MEN_NOSHADING - Shading Off - - - MEN_OPACITY - Opacity - - - MEN_PARALLEL_ANIMATION - Parallel Animation... - - - MEN_PARTIAL_SELECTION - Partial Selection - - - MEN_PLOT3D_FROM_CUTPLANE - Plot3d - - - MEN_PLOT_3D - Plot3D - - - MEN_POINTS - Points - - - MEN_PROPERTIES - Properties - - - MEN_RENAME - Rename... - - - MEN_RENAME_CONTAINER - Rename... - - - MEN_RENAME_TABLE - Rename... - - - MEN_REPRESENTATION - Representation - - - MEN_RESTORE_VIEWPARAMS - Restore view parameters - - - MEN_SAVE_VIEWPARAMS - Save view parameters - - - MEN_SCALAR_MAP - Scalar Map - - - MEN_DEFORMED_SHAPE_AND_SCALAR_MAP - Deformed Shape and Scalar Map - - - MEN_SCALING - Scaling - - - MEN_SELECTION - Selection - - - MEN_SELECTION_INFO - Selection Info... - - - MEN_SHADING - Shading On - - - MEN_SHOW_ANIMATION - Show... - - - MEN_SHOW_TABLE - Show Table - - - MEN_SHRINK - Shrink - - - MEN_STREAM_LINES - Stream Lines - - - MEN_SUCCCESSIVE_ANIMATION - Successive Animation... - - - MEN_SURFACE - Surface - - - MEN_SURFACEFRAME - Surfaceframe - - - MEN_SWEEP - Sweep - - - MEN_TRANSLATE_PRS - Translate Presentation - - - MEN_UNSHRINK - Unshrink - - - MEN_VECTORS - Vectors - - - MEN_VISUALIZATION - Visualization - - - MEN_WIREFRAME - Wireframe - - - TOOL_IMPORT - Import Toolbar - - - TOOL_REPRESENTATION - Representation Toolbar - - - TOOL_VISUALISATION - Visualization Toolbar - - - USE_BUILD_PROGRESS - Use build progress - - - MEN_LOAD_COMPONENT_DATA - Load Component Data - - - FLT_DISTRIBUTED_MED_FILES - Distributed MED Files (*_maitre.med) - - - SHOW_LEVEL_LABELS - Show level labels - - - MEN_FILE_INFO - MED File information - - - ERR_ERROR_IN_THE_FILE - Error in the file - - - ERR_FILE_NOT_EXISTS - File does not exist - - - IMPORT_ERRORS - Import operation has finished with errors: - - - TLT_IMPORT_TABLE - Import table - - - UNKNOWN_IMPORT_ERROR - Unknown error - - - - VisuGUI_AxisWg - - AXIS_NAME - Axis name - - - FONT - Font - - - IS_VISIBLE - Is visible - - - LABELS - Labels - - - LENGTH - Length - - - NAME - Name - - - NUMBER - Number - - - OFFSET - Offset - - - TICK_MARKS - Tick marks - - - - VisuGUI_BuildProgressDlg - - BUILD_ALL - Build all - - - BUILD_AT_ONCE - Build at once - - - BUILD_ENTITIES - Build entities - - - BUILD_FIELDS - Build fields - - - BUILD_GROUPS - Build groups - - - BUILD_MINMAX - Build min/max - - - CLOSE - Close - - - CLOSE_AT_FINISH - Close dialog at finish - - - DLG_BUILD_PROGRESS_TITLE - Build progress - - - ERR_ERROR_IN_THE_FILE - Error in the file - - - FILE_NAME - Import file : - - - FLT_ALL_FILES - All Files (*.*) - - - FLT_MED_FILES - MED Files (*.med) - - - HELP - Help - - - IMPORT_FROM_FILE - Import from File - - - IMPORT_PROGRESS - Import progress - - - IMPORT_SETTINGS - Settings - - - IMPORT_TIME - Time - - - START - Start - - - TIME - Elapsed time : - - - - VisuGUI_CacheDlg - - CACHE_TITLE - Cache properties - - - FREE - Free - - - LIMITED_MEMORY - Limited memory - - - MEMORY STATE - Memory state - - - MEMORY_MODE - Memory mode - - - MINIMAL_MEMORY - Minimal memory - - - USED_BY_CACHE - Used by cache - - - - VisuGUI_ClippingDlg - - AUTO_APPLY_CHK - Auto Apply - - - BUT_DELETE - Delete - - - BUT_NEW - New - - - GRP_IJK_AXIS - Axis - - - GRP_PARAMETERS - Parameters - - - GRP_PLANES - Clipping planes - - - I_RADIO_BTN - I - - - J_RADIO_BTN - J - - - K_RADIO_BTN - K - - - LBL_DISTANCE - Distance - - - LBL_IJK_INDEX - Index (from 0 to ...) - - - LBL_IJK_INDEX_TO_arg - Index (from 0 to %1) - - - LBL_ORIENTATION - Orientation - - - LBL_ROTATION_XY - Rotation around Z (X to Y): - - - LBL_ROTATION_XZ - Rotation around Y (X to Z): - - - LBL_ROTATION_YX - Rotation around Z (Y to X): - - - LBL_ROTATION_YZ - Rotation around X (Y to Z): - - - LBL_ROTATION_ZX - Rotation around Y (Z to X): - - - LBL_ROTATION_ZY - Rotation around X (Z to Y): - - - PARALLEL_XOY_COMBO_ITEM - || X-Y - - - PARALLEL_YOZ_COMBO_ITEM - || Y-Z - - - PARALLEL_ZOX_COMBO_ITEM - || Z-X - - - PLANES_COMBO_ITEM_i - Plane# %1 - - - PLANES_COMBO_ITEM_no - No planes - - - REVERSE_NORMAL_CHK - Reverse normal - - - SHOW_PREVIEW_CHK - Show preview - - - TAB_IJK_STRUCTURED - IJK (Structured) - - - TAB_NON_STRUCTURED - Non structured - - - TITLE - Change Clipping - - - WRN_EMPTY_RESULTING_PRS - Impossible to use given clipping planes because of VTK restrictions. -Please, provide non-empty resulting presentation. - - - - VisuGUI_CubeAxesDlg - - CAPTION - Graduated axes - - - IS_VISIBLE - Is visible - - - X_AXIS - X axis - - - Y_AXIS - Y axis - - - Z_AXIS - Z axis - - - - VisuGUI_CursorDlg - - &Cancel - - - - &OK - - - - TextLabel1 - Set value between - - - TextLabel2 - minimal and maximal - - - - VisuGUI_CutLinesDlg - - BASE_PLANE_POS - Base plane position - - - LBL_ABSOLUTE_LENGTH - Use absolute length - - - LBL_GENERATE_CURVES - Generate Curves - - - LBL_GENERATE_TABLE - Generate Data Table - - - LBL_INVERT_CURVES - Invert all curves - - - LBL_LINES_CUT - Cut planes - - - LBL_LINES_PLANE - Plane of lines - - - LBL_NB_PLANS - Number of planes: - - - LBL_POS - Displacement (0...1): - - - LBL_ROTATION - Rotations - - - LBL_ROT_X - Rotation around X (Y to Z): - - - LBL_ROT_Y - Rotation around Y (Z to X): - - - LBL_ROT_Z - Rotation around Z (X to Y): - - - LBL_SHOW_PREVIEW - Show preview - - - PARALLEL_XOY - || X-Y - - - PARALLEL_YOZ - || Y-Z - - - PARALLEL_ZOX - || Z-X - - - SET_DEFAULT - Set default - - - TXT_ORIENTATION - Orientation - - - - VisuGUI_CutPlanesDlg - - &Cancel - - - - &OK - - - - - VisuGUI_CutPlanesPane - - LBL_NB_PLANS - Number of planes: - - - LBL_POS - Displacement (0...1): - - - LBL_ROTATION - Rotations - - - LBL_ROT_X - Rotation around X (Y to Z): - - - LBL_ROT_Y - Rotation around Y (Z to X): - - - LBL_ROT_Z - Rotation around Z (X to Y): - - - LBL_SHOW_PREVIEW - Show preview - - - PARALLEL_XOY - // X-Y - - - PARALLEL_YOZ - // Y-Z - - - PARALLEL_ZOX - // Z-X - - - TXT_ORIENTATION - Orientation - - - LBL_DEFORMATION - Deformation - - - LBL_DEFROMATION_SCALE - Scale Factor : - - - LBL_DEFROMATION_VECT - Vectors : - - - - VisuGUI_DeformedShapeDlg - - &Cancel - - - - &OK - - - - DEFORMED_SHAPE_TAB - Deformed Shape - - - DLG_TITLE - Deformed Shape - - - INPUT_TAB - Input - - - MAGNITUDE_COLORING - Magnitude coloring - - - SCALAR_BAR_TAB - Scalar Bar - - - SCALE_FACTOR - Scale Factor: - - - - VisuGUI_EditContainerDlg - - &Cancel - - - - &OK - - - - LBL_CONTAINER - Container - - - LBL_STUDY - Study - - - TXT_CURVE - Curve - - - TXT_TABLE - Table - - - - VisuGUI_FileDlg - - FULL_LOAD - Full loading for current file - - - - VisuGUI_FontWg - - ARIAL - Arial - - - BOLD - Bold - - - COURIER - Courier - - - ITALIC - Italic - - - SHADOW - Shadow - - - TIMES - Times - - - - VisuGUI_GaussPointsDlg - - &Cancel - - - - &OK - - - - DEFORMED_SHAPE - Deformed Shape - - - DEFORMED_SHAPE_TITLE - Deformed Shape - - - DLG_PREF_TITLE - Gauss Points Preferences - - - DLG_PROP_TITLE - Gauss Points Properties - - - DLG_TITLE - Gauss Points - - - GAUSS_POINTS_TAB - Gauss Points - - - GEOMETRY - Geometry - - - INPUT_TAB - Input - - - PRS_TITLE - Presentation - - - RESULTS - Results - - - SCALAR_BAR_TAB - Scalar Bar - - - SCALE_FACTOR - Scale Factor : - - - WARNING - Warning - - - - VisuGUI_GaussScalarBarPane - - ACTIVE_BAR_GRP - Active bar - - - BICOLOR - Bicolor - - - COLORS_LABELS_GRP - Colors and labels - - - DIMENSIONS_GRP - Dimensions - - - DISPLAYED - Displayed - - - FIELD_RANGE_BTN - Use field range - - - GLOBAL - Global - - - HORIZONTAL_BTN - Horizontal - - - IMPOSED_RANGE_BTN - Use imposed range - - - LBL_HEIGHT - Height: - - - LBL_MAX - Max: - - - LBL_MIN - Min: - - - LBL_NB_COLORS - Nb. of colors: - - - LBL_NB_LABELS - Nb. of labels: - - - LBL_SPACING - Spacing: - - - LBL_WIDTH - Width: - - - LBL_X - X: - - - LBL_Y - Y: - - - LOCAL - Local - - - LOGARITHMIC_SCALING - Logarithmic scaling - - - ORIENTATION_GRP - Orientation - - - ORIGIN_GRP - Origin - - - RAINBOW - Rainbow - - - SAVE_DEFAULT_CHK - Save as default values - - - SCALAR_RANGE_GRP - Scalar range - - - VERTICAL_BTN - Vertical - - - - VisuGUI_InputPane - - ENTITY - Entity : - - - FIELD - Field : - - - MED_FILE - Source File : - - - MESH - Mesh : - - - PRS_DATA_SOUIRCE - Data Source - - - REINITIALIZE - Auto Update - - - TIME_STAMP - Time Stamp : - - - - VisuGUI_IsoSurfPane - - MAX_VALUE - Maximum value: - - - MIN_VALUE - Minimum value: - - - MSG_MINMAX_VALUES - Min value can not be higher or equal to Max value - - - NB_SURFACES - Number of surfaces: - - - MAGNITUDE_COLORING_CHK - Magnitude coloring - - - SEL_COLOR_BTN - Select Color - - - SHOW_VALUES_CHK - Show values (nb per surface) - - - - VisuGUI_IsoSurfacesDlg - - &Cancel - - - - &OK - - - - DEFINE_ISOSURFACES - Iso Surfaces Definition - - - - VisuGUI_ItemContainer - - AUTO_CHECK_LBL - Auto assign - - - CIRCLE_MARKER_LBL - Circle - - - CROSS_MARKER_LBL - Cross - - - DAHSDOTDOT_LINE_LBL - DashDotDot - - - DASHDOT_LINE_LBL - DashDot - - - DASH_LINE_LBL - Dash - - - DIAMOND_MARKER_LBL - Diamond - - - DOT_LINE_LBL - Dot - - - DTRIANGLE_MARKER_LBL - Downward triangle - - - H - H - - - LTRIANGLE_MARKER_LBL - Leftward triangle - - - NONE_LINE_LBL - None - - - NONE_MARKER_LBL - None - - - RECTANGLE_MARKER_LBL - Rectangle - - - RTRIANGLE_MARKER_LBL - Rightward triangle - - - SOLID_LINE_LBL - Solid - - - UTRIANGLE_MARKER_LBL - Upward triangle - - - V - V - - - XCROSS_MARKER_LBL - Diagonal cross - - - - VisuGUI_Module - - MEN_DESK_FILE_SAVE_GUI_STATE - Save VISU state - - - MEN_GAUSS - Gauss - - - MEN_GAUSS_CREATE_PRS - Gauss Points - - - MEN_GAUSS_NEW_VIEWER - Points view - - - MEN_OVERWRITE_CONFIGURATION - Overwrite current configuration - - - MEN_RESTORE_CONFIGURATION - Restore current configuration - - - MEN_SAVE_CONFIGURATION - Store current configuration - - - MEN_VISUALISATION - Visualization - - - PRP_DESK_FILE_SAVE_GUI_STATE - Saves current state of viewers, displayed objects, etc. - - - TOOL_IMPORT - Import Toolbar - - - TOOL_VISUALISATION - Visualization Toolbar - - - TOT_DESK_FILE_SAVE_GUI_STATE - Save VISU state - - - VISU_CAMERA_MOVE_PREF - Number of steps between two positions - - - VISU_CAMERA_PREF_GROUP_TTL - Camera movements - - - VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL - Inside Cursor - - - VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL - Outside Cursor - - - VISU_GAUSS_PREF_ACTIVE_BAR - Active bar - - - VISU_GAUSS_PREF_ALPHA_TEXTURE - Alpha Channel Texture (16x16) - - - VISU_GAUSS_PREF_ALPHA_THRESHOLD - Alpha Channel Threshold - - - VISU_GAUSS_PREF_BICOLOR - Bicolor - - - VISU_GAUSS_PREF_CLAMP - Maximum Size (Clamp) - - - VISU_GAUSS_PREF_COLOR - Color - - - VISU_GAUSS_PREF_COLOR_GROUP_TTL - Color - - - VISU_GAUSS_PREF_DEFORMED_SHAPE_GROUP_TTL - Deformed Shape - - - VISU_GAUSS_PREF_DISPLAY_GLOBAL - Display global bar - - - VISU_GAUSS_PREF_FACE_LIMIT - Notify when number of faces exceeds - - - VISU_GAUSS_PREF_GEOMSPHERE - Geometrical sphere - - - VISU_GAUSS_PREF_GEOM_GROUP_TTL - Geometry - - - VISU_GAUSS_PREF_GLOBAL - Global - - - VISU_GAUSS_PREF_INCREMENT - +/- Ratio - - - VISU_GAUSS_PREF_LOCAL - Local - - - VISU_GAUSS_PREF_MAGNIFICATION - Magnification (%) - - - VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL - Magnification (Inside and Outside) - - - VISU_GAUSS_PREF_MAIN_TEXTURE - Main Texture (16x16) - - - VISU_GAUSS_PREF_MAX_SIZE - Range value for max size (%) - - - VISU_GAUSS_PREF_MIN_SIZE - Range value for min size (%) - - - VISU_GAUSS_PREF_OPENGLPOINT - OpenGL point - - - VISU_GAUSS_PREF_POINTSPRITE - Point sprite - - - VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL - Primitive - - - VISU_GAUSS_PREF_PRIMITIVE_TYPE - Primitive Type - - - VISU_GAUSS_PREF_RAINBOW - Rainbow - - - VISU_GAUSS_PREF_RESOLUTION - Geometrical sphere resolution - - - VISU_GAUSS_PREF_SCALAR_BAR_MODE - Scalar bar mode - - - VISU_GAUSS_PREF_SCALE_FACTOR - Scale factor - - - VISU_GAUSS_PREF_SIZE - Size of points (%) - - - VISU_GAUSS_PREF_SIZE_GROUP_TTL - Size - - - VISU_GAUSS_PREF_SPACING - Spacing - - - VISU_GAUSS_PREF_TAB_TTL - Gauss Points - - - VISU_GAUSS_PREF_UNIFORM_COLOR - Uniform Color - - - VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL - Gauss Points Scalar Bar - - - VISU_GAUSS_SCALAR_BAR_PREF_TAB_TTL - Gauss Points Scalar Bar - - - VISU_KEYBOARD_PREF - [+]/[-] Speed increment - - - VISU_KEYBOARD_PREF_GROUP_TTL - Keyboard - - - VISU_MOUSE_PREF - Mouse behaviour - - - VISU_MOUSE_PREF_GROUP_TLT - Mouse - - - VISU_MOUSE_PREF_KEYBOARD_FREE - Keyboard free - - - VISU_MOUSE_PREF_STANDARD - Salome standard controls - - - VISU_MOUSE_PREF_TAB_TLT - Navigation - - - VISU_PICKING_PREF_BELOW_POINT - Centered below the point - - - VISU_PICKING_PREF_CAMERA_GROUP_TTL - Movement of the camera - - - VISU_PICKING_PREF_CURSOR_GROUP_TTL - Cursor - - - VISU_PICKING_PREF_CURSOR_SIZE - Size of the cursor - - - VISU_PICKING_PREF_DISPLAY_PARENT_MESH - Display parent mesh element - - - VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL - Information window - - - VISU_PICKING_PREF_PARENT_MESH_TTL - Parent mesh element - - - VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE - Point selection tolerance - - - VISU_PICKING_PREF_POSITION - Position - - - VISU_PICKING_PREF_PYRAMID_HEIGHT - Height of the pyramids - - - VISU_PICKING_PREF_SELECTION_COLOR - Selection cursor color - - - VISU_PICKING_PREF_STEP_NUMBER - Number of steps between two positions - - - VISU_PICKING_PREF_TAB_TTL - Picking - - - VISU_PICKING_PREF_TOLERANCE_GROUP_TTL - Tolerance - - - VISU_PICKING_PREF_TOP_LEFT_CORNER - Top-left corner of the 3D view - - - VISU_PICKING_PREF_TRANSPARENCY - Transparency - - - VISU_PICKING_PREF_ZOOM_FACTOR - Zoom at first selected point (ratio) - - - VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES - Recording all displayed frames - - - VISU_RECORDER_PREF_FPS - FPS - - - VISU_RECORDER_PREF_GROUP_TTL - Settings - - - VISU_RECORDER_PREF_PROGRESSIVE - Progressive - - - VISU_RECORDER_PREF_QUALITY - Quality - - - VISU_RECORDER_PREF_RECORDING_MODE - Mode - - - VISU_RECORDER_PREF_SKIPPED_FRAMES - Recording at a given FPS - - - VISU_RECORDER_PREF_TAB_TTL - Recorder - - - VISU_SPACEMOUSE_PREF - Spacemouse - - - VISU_SPACEMOUSE_PREF_1 - Decrease speed increment - - - VISU_SPACEMOUSE_PREF_2 - Increase speed increment - - - VISU_SPACEMOUSE_PREF_3 - Decrease Gauss points magnification - - - VISU_SPACEMOUSE_PREF_4 - Increase Gauss points magnification - - - VISU_SPACEMOUSE_PREF_5 - Dominant / combined switch - - - VISU_SPACEMOUSE_PREF_BTN_* - Button * - - - VISU_SPACEMOUSE_PREF_BTN_1 - Button 1 - - - VISU_SPACEMOUSE_PREF_BTN_10 - Button 10 - - - VISU_SPACEMOUSE_PREF_BTN_11 - Button 11 - - - VISU_SPACEMOUSE_PREF_BTN_2 - Button 2 - - - VISU_SPACEMOUSE_PREF_BTN_3 - Button 3 - - - VISU_SPACEMOUSE_PREF_BTN_4 - Button 4 - - - VISU_SPACEMOUSE_PREF_BTN_5 - Button 5 - - - VISU_SPACEMOUSE_PREF_BTN_6 - Button 6 - - - VISU_SPACEMOUSE_PREF_BTN_7 - Button 7 - - - VISU_SPACEMOUSE_PREF_BTN_8 - Button 8 - - - - VisuGUI_NameDlg - - NAME_LBL - Name: - - - TLT_RENAME - Rename - - - - VisuGUI_NonIsometricDlg - - &Apply - - - - &Cancel - - - - &Reset - - - - DLG_TITLE - Scaling - - - LBL_X - X : - - - LBL_Y - Y : - - - LBL_Z - Z : - - - O&K - - - - - VisuGUI_Plot3DDlg - - INPUT_TAB_TITLE - Input - - - PLOT3D_TAB_TITLE - Plot 3D - - - SCALAR_BAR_TAB_TITLE - Scalar Bar - - - TITLE - Plot3D Definition - - - - VisuGUI_Plot3DPane - - CONTOUR - Contour - - - NUMBER_CONTOURS - Number of contours: - - - ORIENTATION - Orientation - - - POSITION - Position - - - POSITION_VALUE - Value: - - - PRESENTATION_TYPE - Presentation type - - - PREVIEW - Preview cutting plane - - - RELATIVE - Relative - - - ROTATIONS - Rotations - - - ROTATION_X - Rotation around X (Y to Z): - - - ROTATION_Y - Rotation around Y (Z to X): - - - ROTATION_Z - Rotation around Z (X to Y): - - - SCALE - Scale Factor: - - - SURFACE - Surface - - - - VisuGUI_ScalarBarDlg - - &Cancel - - - - &OK - - - - DLG_PREF_TITLE - Scalar Bar Preferences - - - DLG_PROP_TITLE - Scalar Bar Properties - - - - VisuGUI_ScalarBarPane - - COLORS_LABELS_GRP - Colors and labels - - - DIMENSIONS_GRP - Dimensions - - - FIELD_RANGE_BTN - Use field range - - - HORIZONTAL_BTN - Horizontal - - - IMPOSED_RANGE_BTN - Use imposed range - - - LBL_HEIGHT - Height: - - - LBL_MAX - Max: - - - LBL_MIN - Min: - - - LBL_NB_COLORS - Nb. of colors: - - - LBL_NB_LABELS - Nb. of labels: - - - LBL_SHOW_PREVIEW - Show preview - - - LBL_WIDTH - Width: - - - LBL_X - X: - - - LBL_Y - Y: - - - LOGARITHMIC_SCALING - Logarithmic scaling - - - MSG_MINMAX_VALUES - Min value can not be higher or equal to Max value - - - ORIENTATION_GRP - Orientation - - - ORIGIN_GRP - Origin - - - SAVE_DEFAULT_CHK - Save as default values - - - SCALAR_RANGE_GRP - Scalar range - - - VERTICAL_BTN - Vertical - - - WRN_LOGARITHMIC_FIELD_RANGE - Logarithmic scaling: field range contains negative values, use imposed range instead - - - WRN_LOGARITHMIC_RANGE - Logarithmic scaling: use imposed range values > 0 - - - - VisuGUI_DeformedShapeAndScalarMapDlg - - &Cancel - - - - &OK - - - - DLG_TITLE - Deformed Shape and Scalar Map - - - FIELD_ITEM - Scalar Field: - - - INPUT_TAB - Input - - - SCALAR_BAR_TAB - Scalar Bar - - - DEFORMED_SHAPE_AND_SCALAR_MAP_TAB - Deformed Shape and Scalar Map - - - SCALE_FACTOR - Scale Factor: - - - TIMESTAMP_ITEM - Current Time Stamp: - - - - VisuGUI_SetupPlot2dDlg - - BUT_NO - No - - - BUT_YES - Yes - - - QUE_WANT_SAME_UNITS - Do you want to choose all items with the same units for vertical axis? - - - - VisuGUI_Slider - - AVI - AVI - - - CACHE_MEMORY - Cache: - - - FREE_MEMORY - Free: - - - MORE - More... - - - SPEED - Speed: - - - TOOLBAR_TITLE - Slider - - - - VisuGUI_StreamLinesDlg - - &Cancel - - - - &OK - - - - DLG_TITLE - Stream lines Preferences - - - LBL_DIRECTION - Direction - - - LBL_INTEGRATION_STEP - Integration Step - - - LBL_PROPAGATION_TIME - Propagation Time - - - LBL_SOURCE_TYPE - Source type - - - LBL_STEP_LENGTH - Step Length - - - LBL_USED_POINTS - Used points (0..1) - - - MAGNITUDE_COLORING_CHK - Magnitude coloring - - - SOURCE_GRP - Source - - - USE_COLOR_BTN - Use Color - - - - VisuGUI_SweepPrefDlg - - &Cancel - - - - &OK - - - - DLG_TITLE - Sweeping Preferences - - - LBL_NB_CYCLES - Number of cycles: - - - LBL_NB_STEPS - Number of steps: - - - LBL_TIME_STEP - Time step (second): - - - - VisuGUI_TableDlg - - EDIT_TABLE_TLT - Edit Table - - - ERR_TABLE_NOT_AVAILABLE - Table is not available - - - TABLE_OF_INTEGER_TLT - Table of integer - - - TABLE_OF_REAL_TLT - Table of real - - - VIEW_TABLE_TLT - View Table - - - - VisuGUI_TableWidget - - ADD_COLUMN_BTN - Add Column - - - ADD_ROW_BTN - Add Row - - - ADJUST_CELLS_BTN - Adjust Cells - - - CLEAR_BTN - Clear - - - REMOVE_COLUMN_BTN - Remove Column(s) - - - REMOVE_ROW_BTN - Remove Row(s) - - - SELECT_ALL_BTN - Select All - - - SET_TITLE_TLT - Set title - - - TITLE_LBL - Title: - - - UNITS_TLT - Units - - - - VisuGUI_TextPrefDlg - - &Cancel - - - - &OK - - - - LBL_BOLD - Bold - - - LBL_ITALIC - Italic - - - LBL_LABELS - Labels - - - LBL_SHADOW - Shadow - - - LBL_TITLE - Title - - - TIT_TEXT_PREF - Text properties - - - - VisuGUI_TimeAnimationDlg - - &OK - - - - ERROR - Error - - - MSG_NO_ANIMATIONDATA - There is no data for animation - - - MSG_NO_AVI_MAKER - Tool jpeg2yuv, necessary for AVI recording, is not available. -Please, refer to the documentation. - - - - VisuGUI_TransparencyDlg - - BUT_CLOSE - Close - - - TRANSPARENCY_OPAQUE - Opaque - - - TRANSPARENCY_TITLE - Change Transparency - - - TRANSPARENCY_TRANSPARENT - Transparent - - - - VisuGUI_VectorsDlg - - &Cancel - - - - &OK - - - - ARROWS_BTN - Arrows - - - CENTER_BTN - Center - - - CONES2_BTN - Cones (2) - - - CONES6_BTN - Cones (6) - - - DLG_TITLE - Vector Field Representation - - - GLYPH_POSITION_GRP - Glyph position - - - GLYPH_TYPE_GRP - Glyph type - - - HEAD_BTN - Head - - - LBL_LINE_WIDTH - Line width: - - - LBL_SCALE_FACTOR - Scale factor: - - - MAGNITUDE_COLORING_CHK - Magnitude coloring - - - SEL_COLOR_BTN - Select Color - - - TAIL_BTN - Tail - - - USE_GLYPHS_CHK - Use glyphs - - - - VisuGUI_SelectionDlg - - WINDOW_TITLE - Data on elements - - - MODE_TITLE - Selection - - - MODE_POINT - Point - - - MODE_CELL - Cell - - - MODE_ACTOR - Actor - - - MESH_NAME_LBL - Mesh name: - - - FIELD_NAME_LBL - Field name: - - - POINT_DATA_TITLE - Data of Point - - - DATA_ID_LBL - ID: - - - DATA_SCALAR_LBL - Scalar Value: - - - DATA_VECTOR_LBL - Vector Value: - - - POINT_COORD_TITLE - Coordinates - - - CELL_DATA_TITLE - Data of Cell - - - CELL_DATA_ID_LBL - ID: - - - CELL_DATA_SCALAR_HDR - Scalar - - - CELL_DATA_VECTOR_HDR - Vector - - - ACTOR_DATA_POSITION_TITLE - Position - - - ACTOR_DATA_SIZE_TITLE - Size - - - - VisuGUI_BarPrefDlg - - &OK - - - - &Cancel - - - - TIT_BAR_PREF - Bar properties - - - LBL_TITLE_W - Title width (%) - - - LBL_TITLE_H - Title height (%) - - - LBL_LABEL_W - Label width (%) - - - LBL_LABEL_H - Label height (%) - - - LBL_BAR_W - Bar width (%) - - - LBL_BAR_H - Bar height (%) - - - LBL_SHOW_UNITS - Show units - - - LBL_UNITS_FORMAT - Format: - - - MSG_LABEL_FORMAT - Labels format is invalid. - - - MSG_BIG_SCALE - The common (Title, Label, Bar) width or height should not be greater then 100%. - - - AUTO - auto - - - - VisuGUI_Table3DDlg - - DLG_PREF_TITLE - Table 3D Bar Preferences - - - DLG_PROP_TITLE - Scalar Bar Properties - - - - VisuGUI_TableScalarBarPane - - SCALAR_RANGE_GRP - Scalar range - - - LOGARITHMIC_SCALING - Logarithmic scaling - - - FIELD_RANGE_BTN - Use field range - - - IMPOSED_RANGE_BTN - Use imposed range - - - LBL_MIN - Min: - - - LBL_MAX - Max: - - - COLORS_LABELS_GRP - Colors and labels - - - LBL_NB_COLORS - Nb. of colors: - - - LBL_NB_LABELS - Nb. of labels: - - - ORIENTATION_GRP - Orientation - - - VERTICAL_BTN - Vertical - - - HORIZONTAL_BTN - Horizontal - - - ORIGIN_GRP - Origin - - - LBL_X - X: - - - LBL_Y - Y: - - - LBL_SHOW_PREVIEW - Show preview - - - DIMENSIONS_GRP - Dimensions - - - LBL_WIDTH - Width: - - - LBL_HEIGHT - Height: - - - SAVE_DEFAULT_CHK - Save as default values - - - MSG_MINMAX_VALUES - Min value can not be higher or equal to Max value - - - WRN_LOGARITHMIC_RANGE - Logarithmic scaling: use imposed range values > 0 - - - WRN_LOGARITHMIC_FIELD_RANGE - Logarithmic scaling: field range contains negative values, use imposed range instead - - - - VisuGUI_Table3DPane - - SCALE - Scale Factor: - - - PRESENTATION_TYPE - Presentation type - - - SURFACE - Surface - - - CONTOUR - Contour - - - NUMBER_CONTOURS - Number of contours: - - - - VisuGUI_FileInfoDlg - - CAPTION - File information - - - FILE_NAME - File name - - - FILE_SIZE - File size (bytes) - - - MED_VERSION - MED version - - - diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 3d7fcc0f..e52a0e8d 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -63,6 +63,7 @@ #include "SVTK_ViewWindow.h" #include "SVTK_ViewModel.h" #include "SVTK_Functor.h" +//#include "SVTK_MainWindow.h" #include "SPlot2d_ViewModel.h" #include "VisuGUI_SetupPlot2dDlg.h" @@ -102,7 +103,8 @@ #include "VisuGUI_Prs3dTools.h" #include "VisuGUI_Tools.h" -#include "VisuGUI_PopupTools.h" +#include "VisuGUI_SelectionPanel.h" +#include "VisuGUI_FeatureEdgesPanel.h" #include "VisuGUI_NameDlg.h" #include "VisuGUI_CursorDlg.h" #include "VisuGUI_Selection.h" @@ -116,6 +118,8 @@ #include "VisuGUI_TransparencyDlg.h" #include "VisuGUI_CacheDlg.h" #include "VisuGUI_Table3dDlg.h" +#include "VisuGUI_ClippingPanel.h" +#include "VisuGUI_FilterScalarsDlg.h" #include "VISU_ScalarMap_i.hh" #include "VisuGUI_ScalarBarDlg.h" @@ -153,7 +157,13 @@ #include "VisuGUI_Timer.h" -#include "VVTK_ViewModel.h" +//#include "VVTK_ViewModel.h" + +#include "VisuGUI_Slider.h" +#include "VisuGUI_Sweep.h" +#include +#include +#include using namespace VISU; @@ -174,11 +184,12 @@ static int MYDEBUG = 0; VisuGUI ::VisuGUI(): SalomeApp_Module( "VISU" ), - myDisplayer( 0 ) + myDisplayer( 0 ), + mySlider( NULL ), + mySweep( NULL ) { } - VisuGUI ::~VisuGUI() { @@ -189,6 +200,7 @@ VisuGUI ::OnImportFromFile() { if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()"); + if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) ) return; @@ -204,7 +216,7 @@ VisuGUI SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") ); fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) ); - fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles ); + fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles ); fd.setFilters( aFilter ); fd.SetChecked( toUseBuildProgress ); if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() ) @@ -225,7 +237,7 @@ VisuGUI for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) { QFileInfo aFileInfo( *it ); - + if ( !aFileInfo.exists() ) { // file not exist errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). @@ -240,12 +252,12 @@ VisuGUI bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true ); bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false ); bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false ); - - QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " ); + + QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " ); application()->putInfo( anInfo ); - + VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() ); - + if ( CORBA::is_nil( aResult.in() ) ) { errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); @@ -316,15 +328,15 @@ VisuGUI } else { try { - QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." ); + QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." ); application()->putInfo( anInfo ); - + CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData()); - + if (CORBA::is_nil(anObject.in())) { errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); - } + } else { application()->putInfo( anInfo + tr("INF_DONE") ); } @@ -683,7 +695,9 @@ VisuGUI SVTK_ViewWindow* aViewWindow = GetViewWindow(this); // create mesh presentation and display it in aViewWindow - CreateMesh(this, anIO, aViewWindow); + VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow); + if (aPrs) + emit presentationCreated(aPrs); } void @@ -708,7 +722,9 @@ VisuGUI return; // create mesh presentation and display it in aViewWindow - CreateMesh(this, anIO, aViewWindow); + VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow); + if (aPrs) + emit presentationCreated(aPrs); } } @@ -716,7 +732,9 @@ void VisuGUI ::OnCreateScalarMap() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } @@ -724,56 +742,73 @@ void VisuGUI ::OnCreateDeformedShape() { - CreatePrs3d(this); + // CreatePrs3d(this); + Prs3d_i* aPrs = VisuGUI_DeformedShapeDlg::CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreateDeformedShapeAndScalarMap() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreateVectors() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreateIsoSurfaces() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreateCutPlanes() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreateCutLines() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreateStreamLines() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void VisuGUI ::OnCreatePlot3D() { - CreatePrs3d(this); + Prs3d_i* aPrs = CreatePrs3d(this); + if (aPrs) + emit presentationCreated(aPrs); } void @@ -1053,6 +1088,14 @@ VisuGUI ChangeRepresentation(this, VISU::SHRINK); } +//---------------------------------------------------------------------------- +void +VisuGUI +::OnMakeFeatureEdges() +{ + ChangeRepresentation(this, VISU::FEATURE_EDGES); +} + //---------------------------------------------------------------------------- void VisuGUI @@ -1070,36 +1113,6 @@ VisuGUI } -namespace -{ - //---------------------------------------------------------------------------- - bool - GetPrs3dSelectionInfo(const SalomeApp_Module* theModule, - VISU::Prs3d_i*& thePrs3d, - SVTK_ViewWindow*& theViewWindow, - VISU_Actor*& thenActor) - { - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); - if(aSelectionInfo.empty()) - return false; - - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase); - if(!thePrs3d) - return false; - - theViewWindow = GetActiveViewWindow(theModule); - if(!theViewWindow) - return false; - - thenActor = FindActor(theViewWindow, thePrs3d); - if(!thenActor) - return false; - - return true; - } -} - //---------------------------------------------------------------------------- void VisuGUI @@ -1288,7 +1301,7 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; @@ -1344,11 +1357,22 @@ VisuGUI Handle(SALOME_InteractiveObject) anIO; for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) { anIO = it.Value(); - aNameList.append("\n - "); - aNameList.append(anIO->getName()); if (anIO->hasEntry()) { - if (IsRemovable(anIO->getEntry(), this)) - anEntries[i++] = anIO->getEntry(); + if (IsRemovable(anIO->getEntry(), this)) { + aNameList.append("\n - "); + // Get Name Of the Main Object if it's a referenced object + VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); + if(_PTR(SObject) aSObject = anObjectInfo.mySObject){ + _PTR(SObject) aRefSObject; + if (aSObject->ReferencedObject(aRefSObject)) { + QString aRefName = QString::fromStdString ( aRefSObject->GetName() ); + aNameList.append( aRefName ); + } + else + aNameList.append(anIO->getName()); + } + anEntries[i++] = anIO->getEntry(); + } } } nbSelected = i; @@ -1356,6 +1380,7 @@ VisuGUI SUIT_MessageBox::warning(GetDesktop(this), QObject::tr("WRN_VISU"), QObject::tr("WRN_NO_APPROPRIATE_SELECTION")); + return; } if ( SUIT_MessageBox::question( GetDesktop(this), @@ -1371,6 +1396,7 @@ VisuGUI for (i = 0; i < nbSelected; i++) { VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]); if(_PTR(SObject) aSObject = anObjectInfo.mySObject){ + emit beforeObjectDelete(QString(aSObject->GetID().c_str())); _PTR(SObject) aRefSObject; if (aSObject->ReferencedObject(aRefSObject)) { // It can be a reference on curve, published under a container. @@ -1755,7 +1781,7 @@ VisuGUI case VISU::TPOINTMAP3D: { // Table object if (VISU::PointMap3d_i* aTable3d = dynamic_cast(aBase)) { aTable3d->SetTitle(Name.toLatin1().constData()); - aTable3d->UpdateActors(); + aTable3d->UpdateActors(); } break; } @@ -1784,7 +1810,6 @@ VisuGUI } UpdateObjBrowser(this, false); - QApplication::restoreOverrideCursor(); } } @@ -1811,65 +1836,8 @@ void VisuGUI ::OnSweep() { - VISU_Actor* anActor = NULL; - VISU::Prs3d_i* aPrs3d = NULL; - SVTK_ViewWindow* aViewWindow = NULL; - if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) - return; - - VISU::ScalarMap_i* aScalarMap = dynamic_cast(aPrs3d); - if(!aScalarMap) - return; - - if(!anActor->GetVisibility()) - anActor->VisibilityOn(); - - // Get sweep parameters - SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); - - double aTempoDbl = aResourceMgr->doubleValue("VISU", "sweeping_time_step", 0.1); - int aTemp = int(1.E6 * aTempoDbl); - - int aCycles = aResourceMgr->integerValue("VISU", "sweeping_number_cycles", 1); - int aSteps = aResourceMgr->integerValue("VISU", "sweeping_number_steps", 40); - - int aMode = aResourceMgr->integerValue("VISU", "sweeping_modes", 0); - - int is2Pi = aResourceMgr->integerValue("VISU", "sweeping_is2PI", 0); - - // Sweep - QApplication::setOverrideCursor(Qt::WaitCursor); - - for (int j = 0; j < aCycles; j++) { - for (int i = 0; i <= aSteps; i++) { - try { - float aPercents; - float aT; - if( aMode >= 1 ) - aT = ( is2Pi == 1 ? -PI + 2. * PI * float(i)/aSteps : PI * float(i)/aSteps ); - if( aMode == 1 ){ //if selected Periodic cosinusoidal mode of sweeping - //This is necessary in order for animation to return to the initial picture - aPercents = (1.-cos( aT ))/2.; - } - else if( aMode == 2 ){ //if selected Periodic sinusoidal mode of sweeping - //This is necessary in order for animation to return to the initial picture - aPercents = sin( aT - PI/2 ); - } - else //if selected Linear mode of sweeping - aPercents = float(i)/aSteps; - aScalarMap->SetMapScale(aPercents); - aScalarMap->UpdateActor(anActor); - aViewWindow->getRenderWindow()->Render(); - aViewWindow->Repaint(); - usleep(aTemp); - } catch (std::exception& exc) { - INFOS("Follow exception was occured :\n" << exc.what()); - } catch (...) { - INFOS("Unknown exception was occured!"); - } - } - } - QApplication::restoreOverrideCursor(); + mySweep->toggleViewAction()->setChecked(true); + mySweep->onPlay(true); } //---------------------------------------------------------------------------- @@ -2011,16 +1979,68 @@ VisuGUI //---------------------------------------------------------------------------- void VisuGUI -::OnSelectionInfo() +::OnToggleSelectionPanel() { if (GetActiveViewWindow(this)) - (new VisuGUI_SelectionDlg(this))->show(); + { + if( myPanels.find( SelectionPanelId ) != myPanels.end() ) + { + if( VisuGUI_SelectionPanel* aSelectionPanel = + dynamic_cast( myPanels[ SelectionPanelId ] ) ) + { + if( aSelectionPanel->isVisible() ) + aSelectionPanel->hide(); + else + aSelectionPanel->show(); + } + } + } else SUIT_MessageBox::warning(GetDesktop(this), tr("WRN_VISU"), tr("ERR_ACTIVATE_VIEW3D") ); } +//---------------------------------------------------------------------------- +void +VisuGUI +::OnSwitchSelectionMode() +{ + QAction* anAction = dynamic_cast( sender() ); + if( !anAction ) + return; + + bool isAnyChecked = false; + for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ ) + { + QAction* aRefAction = action( anId ); + isAnyChecked |= aRefAction->isChecked(); + if( anAction != aRefAction ) + aRefAction->setChecked( false ); + else if( myPanels.find( SelectionPanelId ) != myPanels.end() ) + { + if( VisuGUI_SelectionPanel* aSelectionPanel = + dynamic_cast( myPanels[ SelectionPanelId ] ) ) + aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION ); + } + } + // At least one action must be checked + if( !isAnyChecked ) + anAction->setChecked( true ); +} + +//---------------------------------------------------------------------------- +void +VisuGUI +::OnSwitchSelectionMode( int theId ) +{ + for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ ) + { + QAction* aRefAction = action( anId ); + aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId ); + } +} + //---------------------------------------------------------------------------- void VisuGUI @@ -2149,10 +2169,18 @@ VisuGUI { SalomeApp_Module::initialize( theApp ); + mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() ); + + mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() ); + createActions(); createMenus(); createToolBars(); createPopupMenus(); + createPanels(); + + // tmp + action( VISU_ACTOR_SELECTION )->setChecked( true ); } void @@ -2362,6 +2390,10 @@ VisuGUI tr("MEN_UNSHRINK"), "", 0, aParent, false, this, SLOT(OnMakeShrink())); + createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(), + tr("MEN_FEATURE_EDGES"), "", 0, aParent, false, + this, SLOT(OnMakeFeatureEdges())); + createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(), tr("MEN_SHADING"), "", 0, aParent, false, this, SLOT(OnSetShadingOn())); @@ -2440,10 +2472,6 @@ VisuGUI tr("MEN_CLIPPING"), "", 0, aParent, false, this, SLOT(OnClippingPlanes())); - createAction( VISU_SELECTION_INFO, tr("MEN_SELECTION_INFO"), QIcon(), - tr("MEN_SELECTION_INFO"), "", 0, aParent, false, - this, SLOT(OnSelectionInfo())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION")); createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap), tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false, @@ -2459,15 +2487,34 @@ VisuGUI tr("MEN_ERASE_ALL"), "", 0, aParent, false, this, SLOT(OnEraseAll())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION")); - createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIcon(aPixmap), - tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false, - this); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL")); + createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap), + tr("MEN_SELECTION_PANEL"), "", 0, aParent, false, + this, SLOT(OnToggleSelectionPanel())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION")); + createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap), + tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true, + this, SLOT(OnSwitchSelectionMode())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION")); + createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap), + tr("MEN_CELL_SELECTION"), "", 0, aParent, true, + this, SLOT(OnSwitchSelectionMode())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION")); + createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap), + tr("MEN_POINT_SELECTION"), "", 0, aParent, true, + this, SLOT(OnSwitchSelectionMode())); - aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION")); - createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIcon(aPixmap), - tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false, - this); + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION")); + createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap), + tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true, + this, SLOT(OnSwitchSelectionMode())); + + // Defenition of the actions for the "Navigation" tool bar + registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() ); + registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() ); createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(), tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false, @@ -2478,9 +2525,9 @@ VisuGUI tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false, this, SLOT(OnPlot3dFromCutPlane())); - createAction( VISU_CACHE_PROPERTIES, tr("MEN_CACHE_PROPERTIES"), QIcon(), - tr("MEN_CACHE_PROPERTIES"), "", 0, aParent, false, - this, SLOT(OnCacheProperties())); + createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(), + tr("MEN_MANAGE_CACHE"), "", 0, aParent, false, + this, SLOT( OnManageCache() ) ); aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL")); createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap), @@ -2509,6 +2556,19 @@ VisuGUI createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(), tr("MEN_EXPORT_MED"), "", 0, aParent, false, this, SLOT(OnExportMED())); + + createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(), + tr("MEN_FILTER_SCALARS"), "", 0, aParent, false, + this, SLOT(OnFilterScalars())); + + createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(), + tr("MEN_VALUES_LABELING"), "", 0, aParent, true, + this, SLOT(OnValuesLabeling())); + + createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(), + tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false, + this, SLOT(OnValuesLabelingParams())); + } void @@ -2535,9 +2595,6 @@ VisuGUI createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape - aMenuId = createMenu( tr( "MEN_SELECTION" ), -1, -1, 30 ); - createMenu( VISU_SELECTION_INFO, aMenuId, 10 ); // selection info - aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 ); int parentId = createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection @@ -2545,8 +2602,6 @@ VisuGUI createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe createMenu( VISU_SURFACE, parentId, 10 ); // surface createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all - createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection - createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection } void @@ -2572,8 +2627,19 @@ VisuGUI createTool( VISU_WIREFRAME, aToolId ); createTool( VISU_SURFACE, aToolId ); createTool( VISU_ERASE_ALL, aToolId ); - createTool( VISU_GLOBAL_SELECTION, aToolId ); - createTool( VISU_PARTIAL_SELECTION, aToolId ); + + aToolId = createTool(tr("TOOL_SELECTION")); + createTool( VISU_SELECTION_PANEL, aToolId ); + createTool( separator(), aToolId ); + createTool( VISU_ACTOR_SELECTION, aToolId ); + createTool( VISU_CELL_SELECTION, aToolId ); + createTool( VISU_POINT_SELECTION, aToolId ); + createTool( VISU_GAUSS_POINT_SELECTION, aToolId ); + + aToolId = createTool( tr( "TOOL_NAVIGATION" ) ); + createTool( VISU_SLIDER_PANEL, aToolId ); + createTool( separator(), aToolId ); + createTool( VISU_SWEEP_PANEL, aToolId ); } void @@ -2619,6 +2685,8 @@ VisuGUI mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 ); mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 ); + mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 ); + // rename mgr->insert( action( VISU_RENAME ), -1, -1, -1 ); @@ -2627,6 +2695,12 @@ VisuGUI // delete mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 ); + + // labeling + mgr->insert( separator(), -1, -1, -1 ); + mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 ); + mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 ); + mgr->insert( separator(), -1, -1, -1 ); // table commands mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table @@ -2646,6 +2720,7 @@ VisuGUI mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe + mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink mgr->insert( separator(), parentId, -1, -1 ); @@ -2685,8 +2760,6 @@ VisuGUI mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties - mgr->insert( action( VISU_SELECTION_INFO ), -1, -1, -1 ); // Selection info - mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 ); mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 ); mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 ); @@ -2700,6 +2773,9 @@ VisuGUI QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' " "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'"); + QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " + "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' " + "'VISU::TSCALARMAPONDEFORMEDSHAPE'"); // VISU root commands QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'"; @@ -2750,6 +2826,16 @@ VisuGUI mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule ); mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule ); + aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}"; + mgr->setRule( action( VISU_FILTERSCALARS ), aRule ); + + // labeling + + aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }"; + mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule ); + mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule ); + mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule ); + // view parameters aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'"; mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule ); @@ -2757,34 +2843,41 @@ VisuGUI mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" ); //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true ); - mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'VVTK'} and selcount=0" ); + mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" ); // 3D presentations commands - QString aPrsType = " and $type in {'VISU::TMESH'" + aPrsAll + "}"; + QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}"; QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}"; QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}"; - QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}"; + //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}"; + QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }"; + //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}"; QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}"; QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}"; QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' " "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}"; + QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; + aRule = "selcount=1"; mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType ); + aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}"; // "Representation" submenu - QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; - QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; - QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; - QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME'}"; - QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}"; + QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}"; + QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}"; + QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}"; + QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}"; + QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}"; + QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}"; mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints ); mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr ); mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac ); mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside ); mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr ); + mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges ); mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" ); mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" ); @@ -2850,23 +2943,19 @@ VisuGUI aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0"; mgr->setRule( action( VISU_CREATE_TABLE ), aRule ); - aRule = "selcount=1 and ($type in {" + aPrsAll + "})"; + aRule = "client='VTKViewer' and selcount=1 and ($type in {" + aSimplePrsAll + "})"; mgr->setRule( action( VISU_SWEEP ), aRule ); - // "Selection info" popup item - aRule = "client='VTKViewer' and selcount=1" + anInsideType; - mgr->setRule( action( VISU_SELECTION_INFO ), aRule ); - aRule = "client='ObjectBrowser' and selcount>0"; aRule += " and $type in {'VISU::TFIELD'}"; aRule += " and nbTimeStamps>1"; - aRule += " and activeView in {'VTKViewer' 'VVTK'}"; + aRule += " and activeView in {'VTKViewer' 'SVTK'}"; mgr->setRule( action( VISU_PARALLELANIMATION ), aRule ); - aRule = "client='ObjectBrowser' and selcount>0"; + aRule = "client='ObjectBrowser'"; + aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)"; aRule += " and $type in {'VISU::TFIELD'}"; - aRule += " and nbTimeStamps>0"; - aRule += " and activeView in {'VTKViewer' 'VVTK'}"; + aRule += " and activeView in {'VTKViewer' 'SVTK'}"; mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule ); aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}"; @@ -2900,6 +2989,23 @@ VisuGUI mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" ); } +void VisuGUI::createPanels() +{ + myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) ); + myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) ); + myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) ); + + QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end(); + for( ; it != itEnd; ++it ) + { + if( VisuGUI_Panel* aPanel = it.value() ) + { + aPanel->hide(); + GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel ); + } + } +} + //*************************************************************************** void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle ) { @@ -2998,7 +3104,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QStrin if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){ if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE) - theMenu->addAction( action( VISU_CACHE_PROPERTIES ) ); + theMenu->addAction( action( VISU_MANAGE_CACHE ) ); } theMenu->addSeparator(); @@ -3078,10 +3184,10 @@ VisuGUI { theList.clear(); // append SVTK viewer only if there is no opened VVTK - SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); - if( vm && vm->getViewsCount()>0 ) - theList.append( VVTK_Viewer::Type() ); - else +// SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); +// if( vm && vm->getViewsCount()>0 ) +// theList.append( VVTK_Viewer::Type() ); +// else theList.append( SVTK_Viewer::Type() ); } @@ -3099,7 +3205,8 @@ bool VisuGUI ::activateModule( SUIT_Study* theStudy ) { - SalomeApp_Module::activateModule( theStudy ); + bool aResult = SalomeApp_Module::activateModule( theStudy ); + studyActivated(); setMenuShown( true ); setToolShown( true ); @@ -3112,7 +3219,11 @@ VisuGUI action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2 - return true; + ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init(); + + emit moduleActivated(); + + return aResult; } @@ -3123,14 +3234,24 @@ VisuGUI setMenuShown( false ); setToolShown( false ); + QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end(); + for( ; it != itEnd; ++it ) + { + if( VisuGUI_Panel* aPanel = it.value() ) + aPanel->hide(); + } + // Unset actions accelerator keys action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2 - SalomeApp_Module::deactivateModule( theStudy ); - return true; + bool aResult = SalomeApp_Module::deactivateModule( theStudy ); + + emit moduleDeactivated(); + + return aResult; } LightApp_Selection* @@ -3144,6 +3265,7 @@ VisuGUI void VisuGUI::studyActivated() { GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this)))); + } /* @@ -3222,23 +3344,11 @@ void VisuGUI::createPreferences() int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab ); setPreferenceProperty( fontGr, "columns", 2 ); - int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" ); + addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false ); addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" ); - int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" ); - addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" ); - QStringList fam; - fam.append( tr( "VISU_FONT_ARIAL" ) ); - fam.append( tr( "VISU_FONT_COURIER" ) ); - fam.append( tr( "VISU_FONT_TIMES" ) ); - int wflag = ( QtxFontEdit::All & ( ~( QtxFontEdit::Size | QtxFontEdit::UserSize ) ) ); - - setPreferenceProperty( tfont, "families", fam ); - setPreferenceProperty( tfont, "system", false ); - setPreferenceProperty( tfont, "widget_flags", wflag ); - setPreferenceProperty( lfont, "families", fam ); - setPreferenceProperty( lfont, "system", false ); - setPreferenceProperty( lfont, "widget_flags", wflag ); + addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false ); + addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" ); // group: "Colors & Labels" int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab ); @@ -3257,11 +3367,17 @@ void VisuGUI::createPreferences() setPreferenceProperty( numlab, "min", 2 ); setPreferenceProperty( numlab, "max", 65 ); - addPreference( tr( "VISU_LABELS_FORMAT" ), colorsLabelsGr, - LightApp_Preferences::String, "VISU", "scalar_bar_label_format" ); + int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" ); + + setPreferenceProperty( lPrec, "min", 1 ); + setPreferenceProperty( lPrec, "max", 100 ); + + int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" ); + setPreferenceProperty( frame, "orientation", "horizontal" ); // group: "Orientation" - int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab ); + int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox ); setPreferenceProperty( orientGr, "columns", 2 ); int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" ); @@ -3274,8 +3390,17 @@ void VisuGUI::createPreferences() setPreferenceProperty( orient, "strings", orients ); setPreferenceProperty( orient, "indexes", indices ); + // group: "Scalar bars default position" + int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox ); + addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" ); + + // group: "Origin & Size Vertical" - int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab ); + int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" ); + setPreferenceProperty( psSzFrame, "orientation", "horizontal" ); + + int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), + psSzFrame, LightApp_Preferences::GroupBox ); setPreferenceProperty( posVSizeGr, "columns", 2 ); int xv = addPreference( tr( "VISU_X" ), posVSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" ); @@ -3287,16 +3412,12 @@ void VisuGUI::createPreferences() int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" ); - int twv = addPreference( tr( "VISU_TITLE_WIDTH" ), posVSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_width" ); - int thv = addPreference( tr( "VISU_TITLE_HEIGHT" ), posVSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_height" ); - - int lwv = addPreference( tr( "VISU_LABEL_WIDTH" ), posVSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_width" ); - int lhv = addPreference( tr( "VISU_LABEL_HEIGHT" ), posVSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_height" ); - + int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" ); + + int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" ); + int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr, LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" ); int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr, @@ -3312,12 +3433,8 @@ void VisuGUI::createPreferences() setPreferenceProperty( hv, "min", 0.0 ); setPreferenceProperty( twv, "min", 0 ); setPreferenceProperty( twv, "special", "auto" ); - setPreferenceProperty( thv, "min", 0 ); - setPreferenceProperty( thv, "special", "auto" ); setPreferenceProperty( lwv, "min", 0 ); setPreferenceProperty( lwv, "special", "auto" ); - setPreferenceProperty( lhv, "min", 0 ); - setPreferenceProperty( lhv, "special", "auto" ); setPreferenceProperty( bwv, "min", 0 ); setPreferenceProperty( bwv, "special", "auto" ); setPreferenceProperty( bhv, "min", 0 ); @@ -3327,14 +3444,13 @@ void VisuGUI::createPreferences() setPreferenceProperty( wv, "max", 1.0 ); setPreferenceProperty( hv, "max", 1.0 ); setPreferenceProperty( twv, "max", 100 ); - setPreferenceProperty( thv, "max", 100 ); setPreferenceProperty( lwv, "max", 100 ); - setPreferenceProperty( lhv, "max", 100 ); setPreferenceProperty( bwv, "max", 100 ); setPreferenceProperty( bhv, "max", 100 ); // group: "Origin & Size Horizontal" - int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab ); + int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), + psSzFrame, LightApp_Preferences::GroupBox ); setPreferenceProperty( posHSizeGr, "columns", 2 ); int xh = addPreference( tr( "VISU_X" ), posHSizeGr, @@ -3347,19 +3463,15 @@ void VisuGUI::createPreferences() int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" ); - int twh = addPreference( tr( "Title width (%)" ), posHSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_width" ); - int thh = addPreference( tr( "Title height (%)" ), posHSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_height" ); - - int lwh = addPreference( tr( "Label width (%)" ), posHSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_width" ); - int lhh = addPreference( tr( "Label height (%)" ), posHSizeGr, - LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_height" ); - - int bwh = addPreference( tr( "Bar width (%)" ), posHSizeGr, + int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" ); + + int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" ); + + int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr, LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" ); - int bhh = addPreference( tr( "Bar height (%)" ), posHSizeGr, + int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr, LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" ); setPreferenceProperty( xh, "step", 0.1 ); @@ -3372,12 +3484,8 @@ void VisuGUI::createPreferences() setPreferenceProperty( hh, "min", 0.0 ); setPreferenceProperty( twh, "min", 0 ); setPreferenceProperty( twh, "special", "auto" ); - setPreferenceProperty( thh, "min", 0 ); - setPreferenceProperty( thh, "special", "auto" ); setPreferenceProperty( lwh, "min", 0 ); setPreferenceProperty( lwh, "special", "auto" ); - setPreferenceProperty( lhh, "min", 0 ); - setPreferenceProperty( lhh, "special", "auto" ); setPreferenceProperty( bwh, "min", 0 ); setPreferenceProperty( bwh, "special", "auto" ); setPreferenceProperty( bhh, "min", 0 ); @@ -3387,16 +3495,10 @@ void VisuGUI::createPreferences() setPreferenceProperty( wh, "max", 1.0 ); setPreferenceProperty( hh, "max", 1.0 ); setPreferenceProperty( twh, "max", 100 ); - setPreferenceProperty( thh, "max", 100 ); setPreferenceProperty( lwh, "max", 100 ); - setPreferenceProperty( lhh, "max", 100 ); setPreferenceProperty( bwh, "max", 100 ); setPreferenceProperty( bhh, "max", 100 ); - // group: "Scalar bars default position" - int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab ); - addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" ); - // TAB: "CutLines" int cutLineTab = addPreference( tr( "CutLines" ) ); @@ -3409,58 +3511,88 @@ void VisuGUI::createPreferences() addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" ); addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" ); - // TAB: "Sweep, Animation" - int srangeTab = addPreference( tr( "Sweep, Animation" ) ); - - // group: "Sweeping preferences" - int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab ); - setPreferenceProperty( sweepGr, "columns", 2 ); - - int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_modes" ); - QStringList sweep_modes; - sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) ); - sweep_modes.append( tr( "VISU_COS_SWEEP" ) ); - sweep_modes.append( tr( "VISU_SIN_SWEEP" ) ); - indices.clear(); - indices.append( 0 ); - indices.append( 1 ); - indices.append( 2 ); - setPreferenceProperty( modeSw, "strings", sweep_modes ); - setPreferenceProperty( modeSw, "indexes", indices ); - - int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, - LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); - int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, - LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); - int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, - LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); - int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" ); - QStringList ranges; - ranges.append( tr( "PERIOD_PI" ) ); - ranges.append( tr( "PERIOD_2PI" ) ); - indices.clear(); - indices.append( 0 ); - indices.append( 1 ); - setPreferenceProperty( rangeSw, "strings", ranges ); - setPreferenceProperty( rangeSw, "indexes", indices ); - - setPreferenceProperty( timestep, "min", 0.1 ); - setPreferenceProperty( timestep, "step", 0.1 ); - setPreferenceProperty( timestep, "max", 1000 ); - setPreferenceProperty( nbcycles, "max", 100 ); - setPreferenceProperty( nbsteps, "max", 200 ); - - // group: "Animation preferences" - int animationGr = addPreference( tr( "Animation preferences" ), srangeTab ); - setPreferenceProperty( animationGr, "columns", 3 ); + // TAB: "Sweep, Animation, 3D Cache" + int animationTab = addPreference( tr( "Animation" ) ); + { + // group: "3D Cache System prefereces" + { + int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab ); + setPreferenceProperty( cacheGroup, "columns", 2 ); + + int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup, + LightApp_Preferences::Selector, "VISU", "cache_memory_mode" ); + + modes.clear(); + modes.append( tr( "VISU_MINIMAL" ) ); + modes.append( tr( "VISU_LIMITED" ) ); + setPreferenceProperty( memory_mode, "strings", modes ); + + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( memory_mode, "indexes", indices ); + + int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup, + LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" ); + setPreferenceProperty( memory_limit, "min", 1 ); + setPreferenceProperty( memory_limit, "max", 5000 ); + setPreferenceProperty( memory_limit, "step", 10 ); + } - int speed = addPreference( tr( "Speed" ), animationGr, LightApp_Preferences::IntSpin, "VISU", "speed" ); - addPreference( tr( "Cycled animation" ), animationGr, LightApp_Preferences::Bool, "VISU", "cycled_animation" ); - addPreference( tr( "Use proportional timing" ), animationGr, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" ); - addPreference( tr( "Clean memory at each frame" ), animationGr, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" ); + // group: "Animation preferences" + { + int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab ); + setPreferenceProperty( animationGroup, "columns", 3 ); + + int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" ); + addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" ); + addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" ); + addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" ); + + setPreferenceProperty( speed, "min", 1 ); + setPreferenceProperty( speed, "max", 99 ); + } - setPreferenceProperty( speed, "min", 1 ); - setPreferenceProperty( speed, "max", 99 ); + // group: "Sweeping preferences" + { + int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab ); + setPreferenceProperty( sweepGroup, "columns", 2 ); + + int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" ); + QStringList sweep_modes; + sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) ); + sweep_modes.append( tr( "VISU_COS_SWEEP" ) ); + sweep_modes.append( tr( "VISU_SIN_SWEEP" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + indices.append( 2 ); + setPreferenceProperty( modeSw, "strings", sweep_modes ); + setPreferenceProperty( modeSw, "indexes", indices ); + + int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup, + LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); + int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup, + LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); + int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup, + LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); + int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" ); + QStringList ranges; + ranges.append( tr( "PERIOD_PI" ) ); + ranges.append( tr( "PERIOD_2PI" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( rangeSw, "strings", ranges ); + setPreferenceProperty( rangeSw, "indexes", indices ); + + setPreferenceProperty( timestep, "min", 0.1 ); + setPreferenceProperty( timestep, "step", 0.1 ); + setPreferenceProperty( timestep, "max", 1000 ); + setPreferenceProperty( nbcycles, "max", 100 ); + setPreferenceProperty( nbsteps, "max", 200 ); + } + } // TAB: Representation ; group: "Representation properties" int representationTab = addPreference( tr( "Representation" ) ); @@ -3474,16 +3606,23 @@ void VisuGUI::createPreferences() mesh_modes.append( "Insideframe" ); mesh_modes.append( "Surfaceframe" ); mesh_modes.append( "Surface" ); + mesh_modes.append( "Feature edges" ); QList mesh_indices; mesh_indices.append( 0 ); mesh_indices.append( 1 ); mesh_indices.append( 3 ); mesh_indices.append( 4 ); mesh_indices.append( 2 ); + mesh_indices.append( 5 ); + + QStringList modes0 = mesh_modes; + modes0.removeAll( "Feature edges" ); + QList indices0 = mesh_indices; + indices0.removeAll( 5 ); - QStringList modes1 = mesh_modes; + QStringList modes1 = modes0; modes1.removeAll( "Insideframe" ); - QList indices1 = mesh_indices; + QList indices1 = indices0; indices1.removeAll( 3 ); QStringList modes2 = modes1; @@ -3503,8 +3642,8 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" ); int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" ); - setPreferenceProperty( scalar_map_represent, "strings", mesh_modes ); - setPreferenceProperty( scalar_map_represent, "indexes", mesh_indices ); + setPreferenceProperty( scalar_map_represent, "strings", modes0 ); + setPreferenceProperty( scalar_map_represent, "indexes", indices0 ); addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" ); int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" ); @@ -3527,8 +3666,8 @@ void VisuGUI::createPreferences() setPreferenceProperty( sp, "vstretch", 0 ); int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" ); - setPreferenceProperty( deformed_shape_represent, "strings", mesh_modes ); - setPreferenceProperty( deformed_shape_represent, "indexes", mesh_indices ); + setPreferenceProperty( deformed_shape_represent, "strings", modes0 ); + setPreferenceProperty( deformed_shape_represent, "indexes", indices0 ); addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" ); int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" ); @@ -3575,30 +3714,39 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr, LightApp_Preferences::Bool, "VISU", "automatic_fit_all" ); - // TAB: 3D Cache ; group: "Cache properties" - int cacheTab = addPreference( tr( "3D Cache" ) ); + // TAB: Feature edges ; group: "Feature edges properties" + int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) ); - int cacheGr = addPreference( tr( "VISU_3DCACHE_PROPS" ), cacheTab ); - setPreferenceProperty( cacheGr, "columns", 2 ); + int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab ); + setPreferenceProperty( featureEdgesGr, "columns", 2 ); - int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGr, - LightApp_Preferences::Selector, "VISU", "cache_memory_mode" ); + int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr, + LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" ); + setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 ); + setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 ); + setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 ); + + addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" ); + addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" ); + addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" ); + addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" ); + //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" ); + + // TAB: "Values labels" + + int valLblTab = addPreference( tr( "VALUES_LABELING" ) ); - modes.clear(); - modes.append( tr( "VISU_MINIMAL" ) ); - modes.append( tr( "VISU_LIMITED" ) ); - setPreferenceProperty( memory_mode, "strings", modes ); + // "Font" group + int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab ); + setPreferenceProperty( valLblFontGr, "columns", 2 ); - indices.clear(); - indices.append( 0 ); - indices.append( 1 ); - setPreferenceProperty( memory_mode, "indexes", indices ); + // font + addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true ); + + // color + addPreference( tr( "COLOR" ), valLblFontGr, + LightApp_Preferences::Color, "VISU", "values_labeling_color" ); - int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGr, - LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" ); - setPreferenceProperty( memory_limit, "min", 1 ); - setPreferenceProperty( memory_limit, "max", 5000 ); - setPreferenceProperty( memory_limit, "step", 10 ); } void VisuGUI::preferencesChanged( const QString& a, const QString& b) @@ -3610,8 +3758,8 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) float aTol = 1.00000009999999; QString aWarning; if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){ - sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1); - sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW); + sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01); + sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05); if(sbX1+sbW > aTol){ aWarning = "Origin and Size Vertical: X+Width > 1\n"; sbX1=0.01; @@ -3621,8 +3769,8 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) } } else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){ - sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1); - sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH); + sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01); + sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5); if(sbY1+sbH > aTol){ aWarning = "Origin and Size Vertical: Y+Height > 1\n"; sbY1=0.01; @@ -3632,8 +3780,8 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) } } else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){ - sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1); - sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW); + sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2); + sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6); if(sbX1+sbW > aTol){ aWarning = "Origin and Size Horizontal: X+Width > 1\n"; sbX1=0.2; @@ -3643,8 +3791,8 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) } } else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){ - sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1); - sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH); + sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01); + sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12); if(sbY1+sbH > aTol){ aWarning = "Origin and Size Horizontal: Y+Height > 1\n"; sbY1=0.01; @@ -3652,17 +3800,8 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1); aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH); } - } else if(b == QString("scalar_bar_label_format")) { - QString dVal; - dVal.sprintf(aResourceMgr->stringValue("VISU", "scalar_bar_label_format",dVal).toLatin1().data(), 1.1); - if(dVal.toDouble() == 0.) { - aWarning = "Label format is incorrect "; - aWarning += dVal; - aWarning += "\n"; - dVal="%-#6.3g"; - aResourceMgr->setValue("VISU", "scalar_bar_label_format", dVal); - } - } + } + if ( !aWarning.isEmpty() ){ aWarning += "The default values are applied instead."; SUIT_MessageBox::warning(GetDesktop(this), @@ -3734,7 +3873,7 @@ void VisuGUI::OnPlot3dFromCutPlane() _PTR(SObject) aTimeStampSObj = aSObject->GetFather(); if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) { QString aViewType = aViewManager->getType(); - bool anIsVVTK = (aViewType == VVTK_Viewer::Type()); + //bool anIsVVTK = (aViewType == VVTK_Viewer::Type()); Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj); VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap ); @@ -3748,13 +3887,13 @@ void VisuGUI::OnPlot3dFromCutPlane() int aPos; SUIT_ViewWindow* aViewWindow = 0; - if (anIsVVTK) { - aViewWindow = GetViewWindow(this); - aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(aViewWindow)); - } else { +// if (anIsVVTK) { +// aViewWindow = GetViewWindow(this); +// aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(aViewWindow)); +// } else { aViewWindow = GetViewWindow(this); aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(GetViewWindow(this))); - } + // } GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos); VISU::Plot3D_i* aPrs3d = @@ -3792,31 +3931,17 @@ void VisuGUI::OnPlot3dFromCutPlane() AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos); } + if (aPrs3d) + emit presentationCreated(aPrs3d); } } application()->putInfo(QObject::tr("INF_DONE")); } } -void VisuGUI::OnCacheProperties() +void VisuGUI::OnManageCache() { - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); - if(aSelectionInfo.empty()) - return; - - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; - - CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); - if( CORBA::is_nil( anObject ) ) - return; - - VISU::ColoredPrs3dCache_var aCache = VISU::GetInterface(anObject); - if( CORBA::is_nil( aCache ) ) - return; - - VisuGUI_CacheDlg* aDlg = new VisuGUI_CacheDlg( aCache, this ); - aDlg->exec(); + mySlider->show(); } @@ -3936,7 +4061,7 @@ void VisuGUI::OnExportMED() SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); QString aDir = aResourceMgr->stringValue("VISU","OutputDir",""); - + // get name for the file QStringList aFilter; aFilter.append("MED Files (*.med)"); @@ -3946,7 +4071,7 @@ void VisuGUI::OnExportMED() QString aBaseName = anInitFileInfo.fileName(); QString aPath = Qtx::addSlash(aDir) + aBaseName; - + QFileInfo aFileInfo = SUIT_FileDlg::getFileName(GetDesktop(this), aPath, @@ -3959,3 +4084,107 @@ void VisuGUI::OnExportMED() aResult->ExportMED((const char*)aFile.toLatin1()); } } + +void VisuGUI::OnFilterScalars() +{ + VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this ); + aDlg->show(); +} + +/*! + \brief SLOT called when "Labeling" popup menu item of presentation is clicked + activates/deactivates labeling of results of the screen. This functionality works + to numbering in SMESH module but is intended for showing results on the screen + instead of elements numbers + \sa OnValuesLabelingParams() +*/ +void VisuGUI::OnValuesLabeling() +{ + // to do: rewrite for several actors if necessary + + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this ); + if ( aSelectionInfo.empty() ) + return; + + TSelectionItem aSelectionItem = GetSelectedObjects(this).front(); + VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase); + if(!aPrs3d) + return; + + SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(this); + if(!aViewWindow) + return; + + VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d); + if(!anActor) + return; + + if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast(anActor) ) + { + aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() ); + aViewWindow->Repaint(); + } + else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast(anActor) ) + { + aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() ); + aViewWindow->Repaint(); + } +} + +/*! + \brief SLOT called when "Labeling parameters" popup menu item of presentation + is clicked launch dialog box for changing parameters of labeling + \sa OnValuesLabeling() +*/ +void VisuGUI::OnValuesLabelingParams() +{ + Handle(SALOME_InteractiveObject) anIO; + if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) ) + EditPrs3d(this, anIO, aPrs3d); +} +/*! + \brief Adds preferences for dfont of VTK viewer + \param label label + \param pIf group identifier + \param param parameter + \return identifier of preferences +*/ +int VisuGUI::addVtkFontPref( + const QString& label, + const int pId, + const QString& param, + const bool useSize ) +{ + int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param ); + + setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom ); + + QStringList fam; + fam.append( tr( "VISU_FONT_ARIAL" ) ); + fam.append( tr( "VISU_FONT_COURIER" ) ); + fam.append( tr( "VISU_FONT_TIMES" ) ); + + setPreferenceProperty( tfont, "fonts", fam ); + + int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow; + if ( useSize ) + f |= QtxFontEdit::UserSize | QtxFontEdit::Size; + + setPreferenceProperty( tfont, "features", f ); + + return tfont; +} + + + + + + + + + + + + + + diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 2325ddc1..6ca1a8a2 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -29,23 +29,23 @@ #ifndef VisuGUI_HeaderFile #define VisuGUI_HeaderFile -#include -#include +#include -#include "SalomeApp_Module.h" - -#include "SALOME_ListIO.hxx" -#include "VISU_Prs3d_i.hh" -#include "SVTK_ViewWindow.h" +#include +#include +#include "VisuGUI_Panel.h" +#include +#include class SUIT_ViewManager; -class SVTK_ViewWindow; -class Prs3d_i; +class VisuGUI_Slider; +class VisuGUI_Sweep; namespace VISU { + class Prs3d_i; typedef std::pair TPrs3dToInd; // prs pointer and default index of scalar bar placement typedef std::set TSetPrs3d; typedef std::map TViewToPrs3d; @@ -56,7 +56,11 @@ class VisuGUI: public SalomeApp_Module Q_OBJECT; public: + enum PanelId { SelectionPanelId = 0, + FeatureEdgesPanelId, + ClippingPlanesPanelId }; +public: VisuGUI(); virtual ~VisuGUI(); @@ -81,7 +85,13 @@ public: VISU::TViewToPrs3d& getScalarBarsMap(); - + +signals: + void moduleDeactivated(); + void moduleActivated(); + void presentationCreated(VISU::Prs3d_i* thePrs); + void beforeObjectDelete(QString theEntry); + public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); @@ -123,6 +133,10 @@ protected slots: virtual void OnErasePrs(); // virtual void OnEraseAll(); + void OnToggleSelectionPanel(); + void OnSwitchSelectionMode(); + void OnSwitchSelectionMode( int ); + void OnMakeSurfaceframe(); void OnMakeInsideframe(); void OnMakeWireframe(); @@ -130,6 +144,8 @@ protected slots: void OnMakePoints(); void OnMakeShrink(); + void OnMakeFeatureEdges(); + void OnSetShadingOn(); void OnSetShadingOff(); @@ -162,13 +178,16 @@ protected slots: void OnCopyPresentation(); - void OnSelectionInfo(); - void OnTranslatePrs(); void OnArrangeActors(); void OnPlot3dFromCutPlane(); - void OnCacheProperties(); + void OnManageCache(); + + void OnFilterScalars(); + + void OnValuesLabeling(); + void OnValuesLabelingParams(); // MULTIPR void OnMultiprViewFullRes(); @@ -190,10 +209,16 @@ private: void createMenus(); void createToolBars(); void createPopupMenus(); + void createPanels(); + int addVtkFontPref( const QString& label, const int pId, const QString& param, const bool useSize ); private: - LightApp_Displayer* myDisplayer; - VISU::TViewToPrs3d myScalarBarsMap; + QMap< PanelId, VisuGUI_Panel* > myPanels; + VisuGUI_Slider* mySlider; + VisuGUI_Sweep* mySweep; + + LightApp_Displayer* myDisplayer; + VISU::TViewToPrs3d myScalarBarsMap; }; #endif diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 13cb18db..0abafd3f 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -75,6 +75,9 @@ #define VISU_SHRINK 4055 #define VISU_UNSHRINK 4056 +#define VISU_FEATURE_EDGES 4091 +#define VISU_FEATURE_EDGES_DISABLE 4092 + #define VISU_SHADING 4083 #define VISU_NOSHADING 4084 @@ -117,7 +120,7 @@ #define VISU_PLOT3D_FROM_CUTPLANE 4085 -#define VISU_CACHE_PROPERTIES 4090 +#define VISU_MANAGE_CACHE 4090 // MULTIPR #define VISU_MULTIPR_FULL_RES 4095 @@ -128,4 +131,18 @@ #define VISU_FILE_INFO 4100 #define VISU_EXPORT_MED 4101 +#define VISU_SELECTION_PANEL 4102 +#define VISU_ACTOR_SELECTION 4103 +#define VISU_CELL_SELECTION 4104 +#define VISU_POINT_SELECTION 4105 +#define VISU_GAUSS_POINT_SELECTION 4106 + +#define VISU_SLIDER_PANEL 4200 +#define VISU_SWEEP_PANEL 4300 +#define VISU_FILTERSCALARS 4301 + +#define VISU_VALUES_LABELING 4302 +#define VISU_VALUES_LABELING_PARAMS 4303 + + #endif diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 7dc9d39b..1a9dd664 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -28,11 +28,13 @@ #include "VISU_Result_i.hh" #include "VISU_PipeLine.hxx" +#include "VISU_DataSetActor.h" #include "LightApp_SelectionMgr.h" #include "LightApp_Application.h" #include "SVTK_ViewWindow.h" +#include #include "SUIT_Session.h" #include "SUIT_Desktop.h" @@ -41,6 +43,7 @@ #include "SUIT_OverrideCursor.h" #include "SALOME_Actor.h" +#include "VISU_ViewManager_i.hh" // QT Includes #include @@ -55,6 +58,10 @@ #include #include #include +#include +#include +#include +#include // VTK Includes #include @@ -67,6 +74,7 @@ #include #include #include +#include // OCCT Includes #include @@ -244,25 +252,31 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, mySelectionMgr(VISU::GetSelectionMgr(theModule)), myVisuGUI(theModule), myPrs3d(0), - myIsSelectPlane(false) + myIsSelectPlane(false), + myDSActor(0) { setWindowTitle(tr("TITLE")); setSizeGripEnabled(TRUE); setAttribute( Qt::WA_DeleteOnClose, true ); - QGridLayout* VisuGUI_ClippingDlgLayout = new QGridLayout(this); + QVBoxLayout* VisuGUI_ClippingDlgLayout = new QVBoxLayout(this); VisuGUI_ClippingDlgLayout->setSpacing(6); VisuGUI_ClippingDlgLayout->setMargin(11); + + QStackedWidget* aStackWidget = new QStackedWidget(this); + VisuGUI_ClippingDlgLayout->addWidget(aStackWidget); + // Local planes + QWidget* aLocalPlanes = new QWidget(aStackWidget); + QVBoxLayout* aLocalLayout = new QVBoxLayout(aLocalPlanes); + aStackWidget->addWidget(aLocalPlanes); // Controls for selecting, creating, deleting planes - QGroupBox* GroupPlanes = new QGroupBox (tr("GRP_PLANES"), this); - //GroupPlanes->setColumnLayout(0, Qt::Vertical); - //GroupPlanes->layout()->setSpacing(0); - //GroupPlanes->layout()->setMargin(0); + QGroupBox* GroupPlanes = new QGroupBox (tr("GRP_PLANES"), aLocalPlanes); QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes); GroupPlanesLayout->setAlignment(Qt::AlignTop); GroupPlanesLayout->setSpacing(6); GroupPlanesLayout->setMargin(11); + aLocalLayout->addWidget(GroupPlanes); ComboBoxPlanes = new QComboBox (GroupPlanes); GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0); @@ -281,30 +295,38 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, // Controls for defining plane parameters // Tab pane - QGroupBox* GroupParameters = new QGroupBox(tr("GRP_PARAMETERS"), this); - //GroupParameters->setColumnLayout(0, Qt::Vertical); - //GroupParameters->layout()->setSpacing(0); - //GroupParameters->layout()->setMargin(0); + QGroupBox* GroupParameters = new QGroupBox(tr("GRP_PARAMETERS"), aLocalPlanes); QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters); GroupParametersLayout->setAlignment(Qt::AlignTop); GroupParametersLayout->setSpacing(6); GroupParametersLayout->setMargin(11); + aLocalLayout->addWidget(GroupParameters); TabPane = new QTabWidget (GroupParameters); TabPane->addTab(createParamsTab() , tr("TAB_NON_STRUCTURED")); TabPane->addTab(createIJKParamsTab(), tr("TAB_IJK_STRUCTURED")); GroupParametersLayout->addWidget(TabPane, 0, 0); + + + + // "Show preview" and "Auto Apply" check boxes + QHBoxLayout* aCheckBoxLayout = new QHBoxLayout(this); + VisuGUI_ClippingDlgLayout->addLayout(aCheckBoxLayout); PreviewCheckBox = new QCheckBox (tr("SHOW_PREVIEW_CHK"), this); PreviewCheckBox->setChecked(true); + aCheckBoxLayout->addWidget(PreviewCheckBox); + aCheckBoxLayout->addStretch(); AutoApplyCheckBox = new QCheckBox (tr("AUTO_APPLY_CHK"), this); AutoApplyCheckBox->setChecked(false); + aCheckBoxLayout->addWidget(AutoApplyCheckBox); // Controls for "Ok", "Apply" and "Close" button QGroupBox* GroupButtons = new QGroupBox (this); + VisuGUI_ClippingDlgLayout->addWidget(GroupButtons); QSizePolicy aSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed ); aSizePolicy.setHeightForWidth( GroupButtons->sizePolicy().hasHeightForWidth() ); @@ -312,9 +334,6 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, aSizePolicy.setVerticalStretch( 0 ); GroupButtons->setSizePolicy( aSizePolicy ); GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - //GroupButtons->setColumnLayout(0, Qt::Vertical); - //GroupButtons->layout()->setSpacing(0); - //GroupButtons->layout()->setMargin(0); QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons); GroupButtons->setLayout(GroupButtonsLayout); GroupButtonsLayout->setAlignment(Qt::AlignTop); @@ -340,12 +359,6 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, buttonOk->setDefault(TRUE); GroupButtonsLayout->addWidget(buttonOk, 0, 0); - VisuGUI_ClippingDlgLayout->addWidget(GroupPlanes, 0, 0, 1, 2); - VisuGUI_ClippingDlgLayout->addWidget(GroupParameters, 1, 0, 1, 2); - VisuGUI_ClippingDlgLayout->addWidget(PreviewCheckBox, 2, 0); - VisuGUI_ClippingDlgLayout->addWidget(AutoApplyCheckBox, 2, 1); - VisuGUI_ClippingDlgLayout->addWidget(GroupButtons, 3, 0, 3, 2); - // Initial state VISU::RangeStepAndValidator(SpinBoxDistance, 0.0, 1.0, 0.01, 3); VISU::RangeStepAndValidator(SpinBoxRot1, -180.0, 180.0, 1, 3); @@ -488,6 +501,16 @@ QWidget* VisuGUI_ClippingDlg::createIJKParamsTab() // purpose : //================================================================================= void VisuGUI_ClippingDlg::ClickOnApply() +{ + applyLocalPlanes(); +} + + +//================================================================================= +// function : applyLocalPlanes() +// purpose : +//================================================================================= +void VisuGUI_ClippingDlg::applyLocalPlanes() { if (!myPrs3d) return; @@ -512,7 +535,8 @@ void VisuGUI_ClippingDlg::ClickOnApply() } // Try to apply new clipping - myPrs3d->RemoveAllClippingPlanes(); + //myPrs3d->RemoveAllClippingPlanes(); + removeAllClippingPlanes(myPrs3d); VISU::TPlanes::iterator anIter = myPlanes.begin(); for (; anIter != myPlanes.end(); anIter++) { @@ -537,7 +561,8 @@ void VisuGUI_ClippingDlg::ClickOnApply() if (isFailed) { // Restore previous clipping state because of failure. - myPrs3d->RemoveAllClippingPlanes(); + //myPrs3d->RemoveAllClippingPlanes(); + removeAllClippingPlanes(myPrs3d); TPlns::iterator anOldIter = anOldPlanes.begin(); for (; anOldIter != anOldPlanes.end(); anOldIter++) { @@ -555,6 +580,9 @@ void VisuGUI_ClippingDlg::ClickOnApply() } } + + + //================================================================================= // function : ClickOnOk() // purpose : @@ -804,9 +832,9 @@ void VisuGUI_ClippingDlg::Sinchronize() } buttonDelete ->setEnabled(anIsControlsEnable); - buttonApply ->setEnabled(anIsControlsEnable); - PreviewCheckBox ->setEnabled(anIsControlsEnable); - AutoApplyCheckBox ->setEnabled(anIsControlsEnable); + //buttonApply ->setEnabled(anIsControlsEnable); + // PreviewCheckBox ->setEnabled(anIsControlsEnable); + // AutoApplyCheckBox ->setEnabled(anIsControlsEnable); ComboBoxOrientation ->setEnabled(anIsControlsEnable); SpinBoxDistance ->setEnabled(anIsControlsEnable); @@ -1210,3 +1238,15 @@ void VisuGUI_ClippingDlg::SetPrs3d(VISU::Prs3d_i* thePrs) } else return; } + + +void VisuGUI_ClippingDlg::removeAllClippingPlanes(VISU::Prs3d_i* thePrs) +{ + for (int i = thePrs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) { + OrientedPlane* aPlane = dynamic_cast(thePrs->GetClippingPlane(i)); + if (aPlane) + thePrs->RemoveClippingPlane(i); + } +} + + diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index f14ac095..c35e1b93 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -44,6 +44,7 @@ class QComboBox; class QButtonGroup; class QSpinBox; class QTabWidget; +class QListWidget; class SALOME_Actor; @@ -54,11 +55,11 @@ class SVTK_ViewWindow; class LightApp_SelectionMgr; class VisuGUI; - class vtkPlaneSource; class vtkDataSetMapper; - class OrientedPlane; +class VISU_Actor; +class PreviewPlane; namespace VISU { class Prs3d_i; @@ -136,6 +137,11 @@ private: void SetPrs3d(VISU::Prs3d_i* thePrs); + VISU_Actor* getSelectedActor(); + + void applyLocalPlanes(); + + void removeAllClippingPlanes(VISU::Prs3d_i* thePrs); private: @@ -179,6 +185,9 @@ private: bool myIsSelectPlane; + VISU_Actor* myDSActor; + QList myPreviewList; + protected: QWidget* createParamsTab(); QWidget* createIJKParamsTab(); @@ -204,3 +213,5 @@ public slots: }; #endif // DIALOGBOX_TRANSPARENCYDLG_H + + diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index d16325ac..7cdb29cb 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -183,19 +183,16 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent) myVectorialFieldCombo = new QComboBox (GDeformation); GDeformationLayout->addWidget( myVectorialFieldCombo, 0, 1 ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); + QLabel* LabelDeformation2 = new QLabel (tr("LBL_DEFROMATION_SCALE"), GDeformation); GDeformationLayout->addWidget( LabelDeformation2, 1, 0 ); - myScaleSpn = new QtxDoubleSpinBox (0.0, 1.0E+38, 0.1, GDeformation); + myScaleSpn = new QtxDoubleSpinBox (0, 1.0E+38, 0.1, aPrecision*(-1), 38, GDeformation); myScaleSpn->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); GDeformationLayout->addWidget( myScaleSpn, 1, 1 ); connect(myVectorialFieldCombo, SIGNAL(activated(int)), this, SLOT(onVectorialFieldChanged(int))); connect(myScaleSpn, SIGNAL(valueChanged(double)), this, SLOT(onScaleFactorChanged(double))); - - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); - - myScaleSpn->setPrecision( aPrecision*(-1) ); - myScaleSpn->setDecimals(38); myScaleSpn->setValue(0.1); myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this); @@ -315,17 +312,17 @@ double VisuGUI_CutPlanesPane::getScaleFactor(){ void VisuGUI_CutPlanesPane::setScaleFactor(double theFactor){ double i=0.1; - while (1) { // Calculate Step & Precission - if ( int (theFactor/i) >= 0) - break; - else { - i = i*0.1; + if (theFactor > 0) { + while (1) { // Calculate Step & Precission + if ( int (theFactor/i) >= 0) + break; + else + i = i*0.1; } } myScaleSpn->setSingleStep(i); myScaleSpn->setValue(theFactor); - } void VisuGUI_CutPlanesPane::createPlanes() diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx deleted file mode 100644 index e3d180b9..00000000 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx +++ /dev/null @@ -1,496 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VisuGUI_DeformedShapeAndScalarMapDlg.cxx -// Author : Eugeny Nikolaev -// Module : VISU - -#include "VisuGUI_DeformedShapeAndScalarMapDlg.h" - -#include "VisuGUI_Tools.h" -#include "VisuGUI_InputPane.h" - -#include "VISU_Result_i.hh" -#include "VISU_DeformedShapeAndScalarMap_i.hh" -#include "VISU_ColoredPrs3dFactory.hh" - -#include "VISU_ScalarMapPL.hxx" -#include "VISU_DeformedShapeAndScalarMapPL.hxx" - -#include "VISU_Convertor.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define MYDEBUG 0 - -/*! - * Constructor - */ -VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule) - : VisuGUI_ScalarBarBaseDlg(theModule), - myIsAnimation(false), - myUpdateScalars(true), - myVisuGUI(theModule) -{ - setWindowTitle(tr("DLG_TITLE")); - setSizeGripEnabled(true); - - QVBoxLayout* TopLayout = new QVBoxLayout (this); - TopLayout->setSpacing(6); - TopLayout->setMargin(11); - - myTabBox = new QTabWidget (this); - - // Scalar Map on Deformed shape pane - QWidget* aBox = new QWidget (this); - QVBoxLayout* aVBLay = new QVBoxLayout( aBox ); - aVBLay->setMargin(11); - QFrame* TopGroup = new QFrame (aBox); - aVBLay->addWidget(TopGroup); - TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken); - TopGroup->setLineWidth(1); - QGridLayout* TopGroupLayout = new QGridLayout (TopGroup); - TopGroupLayout->setSpacing(6); - TopGroupLayout->setMargin(11); - - // Scale factor - QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup); - TopGroupLayout->addWidget(ScaleLabel, 0, 0); - - ScalFact = new QtxDoubleSpinBox (0.0, 1.0E+38, 0.1, TopGroup); - ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); - - ScalFact->setPrecision( aPrecision*(-1) ); - ScalFact->setDecimals( 32 ); - ScalFact->setValue(0.1); - TopGroupLayout->addWidget(ScalFact, 0, 1); - - // Fields combo box - QLabel* FieldLabel = new QLabel (tr("FIELD_ITEM"), TopGroup); - myFieldsCombo = new QComboBox (TopGroup); - - TopGroupLayout->addWidget(FieldLabel, 1, 0); - TopGroupLayout->addWidget(myFieldsCombo,1,1); - - // TimeStamps combo box - QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup); - myTimeStampsCombo = new QComboBox (TopGroup); - - TopGroupLayout->addWidget(TimeStampLabel, 2, 0); - TopGroupLayout->addWidget(myTimeStampsCombo,2,1); - TopGroupLayout->setRowStretch(3,5); - - // - myTabBox->addTab(aBox, tr("DEFORMED_SHAPE_AND_SCALAR_MAP_TAB")); - - // Scalar bar pane - myInputPane = new VisuGUI_InputPane(VISU::TDEFORMEDSHAPEANDSCALARMAP, theModule, this); - - myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB")); - myTabBox->addTab(myInputPane, tr("INPUT_TAB")); - - // Buttons - QGroupBox* GroupButtons = new QGroupBox (this); - QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - - QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons); - buttonOk->setAutoDefault(true); - buttonOk->setDefault(true); - QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons); - buttonCancel->setAutoDefault(true); - QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons); - buttonHelp->setAutoDefault(true); - - GroupButtonsLayout->addWidget(buttonOk); - GroupButtonsLayout->addSpacing(10); - GroupButtonsLayout->addStretch(); - GroupButtonsLayout->addWidget(buttonCancel); - GroupButtonsLayout->addWidget(buttonHelp); - - // Add Tab box and Buttons to the top layout - TopLayout->addWidget(myTabBox); - TopLayout->addWidget(GroupButtons); - - // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); - connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int))); - connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int))); -} - -VisuGUI_DeformedShapeAndScalarMapDlg::~VisuGUI_DeformedShapeAndScalarMapDlg() -{ -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, - bool theInit ) -{ - if( theInit ) - myPrsCopy = VISU::TSameAsFactory().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish); - setFactor(myPrsCopy->GetScale()); - myTimeStampsCombo->setDisabled(myIsAnimation); - - CORBA::String_var aFieldName(myPrsCopy->GetScalarFieldName()); - QString aIteration = GetFloatValueOfTimeStamp(myPrsCopy->GetScalarEntity(), - aFieldName.in(), - myPrsCopy->GetScalarTimeStampNumber()); - if (myEntity2Fields.size() == 0) - { - // find all fields and time stamps on it - _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI)); - LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI); - SALOME_ListIO selected; - aSel->selectedObjects(selected); - if (selected.Extent() > 0) { - Handle(SALOME_InteractiveObject) aIO = selected.First(); - if (aIO->hasEntry()) { - _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); - VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject ); - switch(aType){ - case VISU::TTIMESTAMP: { - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); - break; - } - case VISU::TFIELD: { - _PTR(SObject) newSObject; - if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject; - aSObject = aSObject->GetFather(); - break; - } - case VISU::TANIMATION: { - _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject); - for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) { - _PTR(SObject) aTmpChildSObj = aTmpIter->Value(); - _PTR(SObject) newSObject; - if(aTmpChildSObj->ReferencedObject(newSObject)){ - aSObject = newSObject; - aSObject->GetFather(); - break; - } - } - break; - }} - - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); - - mySelectionObj = aSObject; - CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); - if (CORBA::is_nil(anObject)) { - mySelectionObj = mySelectionObj->GetFather(); - } - } - } - - if (mySelectionObj) { - _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); - - for (aIter->InitEx(true); aIter->More(); aIter->Next()) { - _PTR(SObject) aChildSObj = aIter->Value(); - VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj); - if (!aRestoringMap.empty()) { - VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap); - if (aType == VISU::TTIMESTAMP) { - QString aMeshName = aRestoringMap["myMeshName"]; - CORBA::String_var aName = myPrsCopy->GetMeshName(); - if (aMeshName != aName.in()) - continue; - QString aFieldName = aRestoringMap["myFieldName"]; - QString aTimeIter = aRestoringMap["myTimeStampId"]; - QString aEntity = aRestoringMap["myEntityId"]; - VISU::Entity anEntity; - switch (aEntity.toInt()) { - case 0: anEntity = VISU::NODE; break; - case 1: anEntity = VISU::EDGE; break; - case 2: anEntity = VISU::FACE; break; - case 3: anEntity = VISU::CELL; break; - } - TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity]; - TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName]; - aTimeStampNumber2Time[aTimeIter.toInt()] = - GetFloatValueOfTimeStamp(anEntity, - aFieldName.toLatin1().constData(), - aTimeIter.toInt()); - } - } - } - } - AddAllFieldNames(); - } - int idx = myFieldsCombo->findText(aFieldName.in()); - if (idx >= 0) - myFieldsCombo->setCurrentIndex(idx); - else { - myFieldsCombo->addItem(aFieldName.in()); - myFieldsCombo->setCurrentIndex(myFieldsCombo->count()-1); - } - AddAllTimes(myFieldsCombo->currentText()); - idx = myTimeStampsCombo->findText(aIteration); - if (idx >= 0) - myTimeStampsCombo->setCurrentIndex(idx); - else { - myTimeStampsCombo->addItem(aIteration); - myTimeStampsCombo->setCurrentIndex(myTimeStampsCombo->count()-1); - } - SetScalarField( false ); - - VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit); - - if( !theInit ) - return; - - myInputPane->initFromPrsObject( myPrsCopy ); - myTabBox->setCurrentIndex( 0 ); -} - -double VisuGUI_DeformedShapeAndScalarMapDlg::getFactor() const -{ - return ScalFact->value(); -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::setFactor(double theFactor) -{ - double i=0.1; - while (1) { // Calculate Step & Precission - if ( int (theFactor/i) > 0) - break; - else { - i = i*0.1; - } - } - - ScalFact->setSingleStep(i); - - ScalFact->setValue(theFactor); -} - -int -VisuGUI_DeformedShapeAndScalarMapDlg -::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) -{ - if(!myInputPane->check() || !GetScalarPane()->check()) - return 0; - - int anIsOk = myInputPane->storeToPrsObject( myPrsCopy ); - anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy ); - - myPrsCopy->SetScale(getFactor()); - - myPrsCopy->SetScalarField(myPrsCopy->GetScalarEntity(), - getCurrentScalarFieldName().toLatin1().constData(), - myTimeStampID[ myTimeStampsCombo->currentIndex() ]); - - if(myUpdateScalars) - SetScalarField( false ); - - VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); - - return anIsOk; -} - -int VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarFieldNamePos(){ - return myFieldsCombo->currentIndex(); -} - -QString VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarFieldName(){ - return myFieldsCombo->currentText(); -} - -int VisuGUI_DeformedShapeAndScalarMapDlg::getCurrentScalarNbIterations(){ - return myTimeStampsCombo->count(); -} - -VISU::Entity -VisuGUI_DeformedShapeAndScalarMapDlg -::getCurrentScalarEntity() -{ - VISU::Entity anEntity = VISU::Entity(-1); - TEntity2Fields::const_iterator anIter = myEntity2Fields.begin(); - for(; anIter != myEntity2Fields.end(); anIter++){ - const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second; - TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin(); - for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){ - const QString& aFieldName = aFieldIter->first; - if (aFieldName == myFieldsCombo->currentText()) { - anEntity = anIter->first; - break; - } - } - } - return anEntity; -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::SetScalarField( const bool save_scalar_pane ){ - SetScalarField( myTimeStampID[ myTimeStampsCombo->currentIndex() ], "", save_scalar_pane ); -} - -void -VisuGUI_DeformedShapeAndScalarMapDlg -::SetScalarField(int theIter, - QString theFieldName, - const bool save_scalar_pane ) -{ - QApplication::setOverrideCursor(Qt::WaitCursor); - - if( save_scalar_pane ) - GetScalarPane()->storeToPrsObject(myPrsCopy); - - QString aFieldName; - - if(theFieldName.isEmpty()) - aFieldName = myFieldsCombo->currentText(); - else - aFieldName = theFieldName; - - VISU::Entity anEntity = getCurrentScalarEntity(); - - myPrsCopy->SetScalarField(anEntity, - aFieldName.toLatin1().constData(), - theIter); - - if( save_scalar_pane ) - UpdateScalarField(); - - QApplication::restoreOverrideCursor(); -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::accept() -{ - VisuGUI_ScalarBarBaseDlg::accept(); -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::reject() -{ - VisuGUI_ScalarBarBaseDlg::reject(); -} - -QString VisuGUI_DeformedShapeAndScalarMapDlg::GetContextHelpFilePath() -{ - return "scalar_map_on_deformed_shape_page.html"; -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::AddAllFieldNames(){ - TEntity2Fields::const_iterator anIter = myEntity2Fields.begin(); - for(; anIter != myEntity2Fields.end(); anIter++){ - const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second; - TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin(); - for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){ - const QString& aFieldName = aFieldIter->first; - myFieldsCombo->addItem(aFieldName); - } - } -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::AddAllTimes(const QString& theFieldName){ - TEntity2Fields::const_iterator anIter = myEntity2Fields.begin(); - for(; anIter != myEntity2Fields.end(); anIter++){ - const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second; - TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin(); - for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){ - const QString& aFieldName = aFieldIter->first; - if(theFieldName != aFieldName) - continue; - - myTimeStampID.clear(); - myTimeStampsCombo->clear(); - - const TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldIter->second; - TTimeStampNumber2Time::const_iterator aTimeStampIter = aTimeStampNumber2Time.begin(); - for(; aTimeStampIter != aTimeStampNumber2Time.end(); aTimeStampIter++){ - int aTimeStampNumber = aTimeStampIter->first; - myTimeStampID.push_back(aTimeStampNumber); - - QString aTimeStampTime = aTimeStampIter->second; - myTimeStampsCombo->addItem(aTimeStampTime); - } - return; - } - } -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::onFieldChanged(int){ - AddAllTimes(myFieldsCombo->currentText()); - SetScalarField(); - UpdateScalarField(); -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::onTimeStampChanged(int){ - SetScalarField(); - UpdateScalarField(); -} - -void VisuGUI_DeformedShapeAndScalarMapDlg::UpdateScalarField(){ - GetScalarPane()->initFromPrsObject(myPrsCopy); -} - -QString -VisuGUI_DeformedShapeAndScalarMapDlg -::GetFloatValueOfTimeStamp(VISU::Entity theEntity, - const std::string& theFieldName, - int theTimeStampNumber) -{ - QString aTime(""); - VISU::TEntity anEntity = VISU::TEntity(theEntity); - VISU::Result_i* theResult = myPrsCopy->GetCResult(); - VISU::Result_i::PInput anInput = theResult->GetInput(); - VISU::PField aField = anInput->GetField(myPrsCopy->GetCMeshName(), - anEntity, - theFieldName); - if(!aField) - return aTime; - - VISU::TValField& aValField = aField->myValField; - VISU::TValField::const_iterator aIter = aValField.find(theTimeStampNumber); - if(aIter != aValField.end()){ - VISU::PValForTime aValForTime = aIter->second; - aTime = VISU_Convertor::GenerateName(aValForTime->myTime).c_str(); - } - return aTime; -} diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h deleted file mode 100644 index 9daf4a58..00000000 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h +++ /dev/null @@ -1,116 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : VisuGUI_DeformedShapeAndScalarMapDlg.h -// Author : Eugeny Nikolaev -// Module : VISU - -#ifndef VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H -#define VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H - -#include "VisuGUI_Prs3dDlg.h" - -#include "VISUConfig.hh" - -#include - -#include -#include - -class SalomeApp_Module; -class VisuGUI_InputPane; -class QtxDoubleSpinBox; -class QComboBox; -class QTabWidget; - -namespace VISU -{ - class DeformedShapeAndScalarMap_i; -} - -class VisuGUI_DeformedShapeAndScalarMapDlg : public VisuGUI_ScalarBarBaseDlg -{ - Q_OBJECT - -public: - VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule); - ~VisuGUI_DeformedShapeAndScalarMapDlg(); - - double getFactor() const; - void setFactor(double theFactor); - - virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, - bool theInit ); - - virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs); - - int getCurrentScalarFieldNamePos(); - QString getCurrentScalarFieldName(); - int getCurrentScalarNbIterations(); - VISU::Entity getCurrentScalarEntity(); - void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true ); - -protected: - virtual QString GetContextHelpFilePath(); - -protected slots: - void accept(); - void reject(); - -private slots: - void onFieldChanged(int i=0); - void onTimeStampChanged(int i=0); - -private: - QtxDoubleSpinBox* ScalFact; - QTabWidget* myTabBox; - VisuGUI_ScalarBarPane* myScalarPane; - VisuGUI_InputPane* myInputPane; - QComboBox *myFieldsCombo; - QComboBox *myTimeStampsCombo; - - typedef std::map TTimeStampNumber2Time; // Times map definition (iteration time, real value of time) - typedef std::map TFieldName2TimeStamps; // Field name and enity to Times - typedef std::map TEntity2Fields; // Mesh to fields map - - TEntity2Fields myEntity2Fields; - int myCurrScalarIter; - bool myIsAnimation; - bool myUpdateScalars; - std::vector myTimeStampID; - - _PTR(SObject) mySelectionObj; - SALOME::GenericObjPtr myPrsCopy; - SalomeApp_Module* myVisuGUI; - -protected: - void UpdateScalarField(); - void SetScalarField( const bool = true ); - void AddAllFieldNames(); - void AddAllTimes(const QString& theFieldName); - QString GetFloatValueOfTimeStamp(VISU::Entity theEntity, - const std::string& theFieldName, - int theTimeStampNumber); -}; - -#endif // VISUGUI_DEFORMEDSHAPEDLS_H diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index 6f6aa2b4..9f4de1b4 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -89,14 +89,11 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule) QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup ); TopGroupLayout->addWidget(ScaleLabel, 0, 0); - ScalFact = new QtxDoubleSpinBox (0.0, 1.0E+38, 0.1, TopGroup); - ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); - ScalFact->setPrecision( aPrecision*(-1) ); - ScalFact->setDecimals(38); + ScalFact = new QtxDoubleSpinBox (0, 1.0E+38, 0.1, aPrecision*(-1), 38, TopGroup); + ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); ScalFact->setValue(0.1); TopGroupLayout->addWidget(ScalFact, 0, 1); @@ -176,16 +173,16 @@ void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, void VisuGUI_DeformedShapeDlg::setFactor(double theFactor) { double i=0.1; - while (1) { // Calculate Step & Precission - if ( int (theFactor/i) > 0) - break; - else { - i = i*0.1; + if (theFactor > 0) { + while (1) { // Calculate Step & Precission + if ( int (theFactor/i) > 0) + break; + else + i = i*0.1; } } ScalFact->setSingleStep(i); - ScalFact->setValue(theFactor); } @@ -263,8 +260,9 @@ bool VisuGUI_DeformedShapeDlg::onApply() // Create and Edit //////////////////////////////////////////////////////////////////////////////// -void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule) +VISU::Prs3d_i* VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule) { + VISU::DeformedShape_i* aPrs3d = NULL; _PTR(SObject) aTimeStamp; Handle(SALOME_InteractiveObject) anIO; VISU::ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode; @@ -281,10 +279,10 @@ void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule) QString aFieldName = aRestoringMap["myFieldName"]; QString aTimeStampId = aRestoringMap["myTimeStampId"]; - typedef VISU::DeformedShape_i TPrs3d_i; + //typedef VISU::DeformedShape_i TPrs3d_i; - TPrs3d_i* aPrs3d = - VISU::CreatePrs3dFromFactory(theModule, + aPrs3d = + VISU::CreatePrs3dFromFactory(theModule, aTimeStamp, aMeshName.toLatin1().data(), (VISU::Entity)anEntity.toInt(), @@ -316,6 +314,7 @@ void VisuGUI_DeformedShapeDlg::CreatePrs3d(VisuGUI* theModule) } } } + return aPrs3d; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h index 1449af50..d8ed8e7a 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h @@ -70,7 +70,7 @@ public: virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs); - static void CreatePrs3d(VisuGUI* theModule); + static VISU::Prs3d_i* CreatePrs3d(VisuGUI* theModule); static void EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d, Handle(SALOME_InteractiveObject)& theIO); void updatePrsCopy(); diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index 9cf7e830..df6fbc23 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -33,7 +33,7 @@ #include "VISU_ViewManager_i.hh" #include "VISU_Actor.h" -#include "VVTK_ViewModel.h" +//#include "VVTK_ViewModel.h" #include #include @@ -80,10 +80,10 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& theEntry, SALOM SALOME_View* aView = theView ? theView : GetActiveView(); VISU::VISUType aType = aBase->GetType(); VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aBase); - if( aView && (!CORBA::is_nil(aPrs3d) || aType == VISU::TCOLOREDPRS3DHOLDER) ){ - SVTK_Viewer* aViewer = dynamic_cast( aView ); - if (!aViewer) - aViewer = dynamic_cast( aView ); + if(!CORBA::is_nil(aPrs3d) || aType == VISU::TCOLOREDPRS3DHOLDER){ + SVTK_Viewer* aViewer = dynamic_cast( aView ); + //if (!aViewer) + //aViewer = dynamic_cast( aView ); if( aViewer ){ SUIT_ViewManager* aViewManager = aViewer->getViewManager(); SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); @@ -294,7 +294,7 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie dynamic_cast( VISU::GetServant( anObj ).in() ) ) return true; - if( viewer_type==SVTK_Viewer::Type() || viewer_type==VVTK_Viewer::Type()) + if( viewer_type==SVTK_Viewer::Type() /*|| viewer_type==VVTK_Viewer::Type()*/) { VISU::Base_i* aBase = dynamic_cast(VISU::GetServant(anObj).in()); diff --git a/src/VISUGUI/VisuGUI_FileInfoDlg.cxx b/src/VISUGUI/VisuGUI_FileInfoDlg.cxx deleted file mode 100644 index 78d8c090..00000000 --- a/src/VISUGUI/VisuGUI_FileInfoDlg.cxx +++ /dev/null @@ -1,78 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUI_FileInfoDlg.cxx -// Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. ( alexander.solovyov@opencascade.com) -// Module : VISU -// - -#include - -#include - -#include -#include -#include - -VisuGUI_FileInfoDlg::VisuGUI_FileInfoDlg( QWidget* parent, SALOME_MED::MedFileInfo* inf ) - : QtxDialog( parent, true, true, QtxDialog::OK ) -{ - setWindowTitle( tr( "CAPTION" ) ); - setSizeGripEnabled( true ); - - QLineEdit* fname = new QLineEdit( mainFrame() ); - fname->setReadOnly( true ); - QLineEdit* fsize = new QLineEdit( mainFrame() ); - fsize->setReadOnly( true ); - QLineEdit* medversion = new QLineEdit( mainFrame() ); - medversion->setReadOnly( true ); - fname->setMinimumWidth( 300 ); - - QGridLayout* lay = new QGridLayout( mainFrame() ); - lay->setMargin( 5 ); lay->setSpacing( 5 ); - lay->addWidget( new QLabel( tr( "FILE_NAME" ), mainFrame() ), 0, 0 ); - lay->addWidget( fname, 0, 1 ); - lay->addWidget( new QLabel( tr( "FILE_SIZE" ), mainFrame() ), 1, 0 ); - lay->addWidget( fsize, 1, 1 ); - lay->addWidget( new QLabel( tr( "MED_VERSION" ), mainFrame() ), 2, 0 ); - lay->addWidget( medversion, 2, 1 ); - - fname->setText( (char*)inf->fileName ); - fname->home( false ); - fsize->setText( QString::number( inf->fileSize ) ); - - QString version; - if( inf->major>=0 ) - { - version = QString::number( inf->major ); - if( inf->minor>=0 ) - { - version += "." + QString::number( inf->minor ); - if( inf->release>=0 ) - version += "." + QString::number( inf->release ); - } - } - medversion->setText( version ); -} - -VisuGUI_FileInfoDlg::~VisuGUI_FileInfoDlg() -{ -} diff --git a/src/VISUGUI/VisuGUI_FileInfoDlg.h b/src/VISUGUI/VisuGUI_FileInfoDlg.h deleted file mode 100644 index c755474b..00000000 --- a/src/VISUGUI/VisuGUI_FileInfoDlg.h +++ /dev/null @@ -1,41 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUI_FileInfoDlg.h -// Author : Alexandre SOLOVYOV, Open CASCADE S.A.S. ( alexander.solovyov@opencascade.com) -// - -#ifndef VISUGUI_FILEINFODLG_H -#define VISUGUI_FILEINFODLG_H - -#include -#include - -class VisuGUI_FileInfoDlg : public QtxDialog -{ - Q_OBJECT - -public: - VisuGUI_FileInfoDlg( QWidget*, SALOME_MED::MedFileInfo* ); - virtual ~VisuGUI_FileInfoDlg(); -}; - -#endif // VISUGUI_FILEINFODLG_H diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 14826a2f..bcc76d29 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -34,6 +34,7 @@ #include "VISU_ColoredPrs3dFactory.hh" #include "VISU_GaussPoints_i.hh" +#include "VISU_Prs3dUtils.hh" #include "VISU_GaussPointsPL.hxx" #include "VISU_OpenGLPointSpriteMapper.hxx" #include "VISU_Convertor.hxx" @@ -79,10 +80,10 @@ using namespace std; VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent): QWidget(parent) { - myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80; - myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12; - myVerTW = myVerTH = myVerLW = myVerLH = myVerBW = myVerBH = 0; - myHorTW = myHorTH = myHorLW = myHorLH = myHorBW = myHorBH = 0; + myVerX = 0.01; myVerY = 0.10; myVerW = 0.08; myVerH = 0.80; + myHorX = 0.10; myHorY = 0.01; myHorW = 0.80; myHorH = 0.08; + myVerTS = myVerLS = myVerBW = myVerBH = 0; + myHorTS = myHorLS = myHorBW = myHorBH = 0; Imin = 0.0; Imax = 0.0; myRangeMode = -1; @@ -476,22 +477,18 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs, thePrs->GetBarOrientation()); if(RBvert->isChecked()) { - myVerTW = thePrs->GetTitleWidth(); - myVerTH = thePrs->GetTitleHeight(); - myVerLW = thePrs->GetLabelWidth(); - myVerLH = thePrs->GetLabelHeight(); + myVerTS = thePrs->GetTitleSize(); + myVerLS = thePrs->GetLabelSize(); myVerBW = thePrs->GetBarWidth(); myVerBH = thePrs->GetBarHeight(); } else { - myHorTW = thePrs->GetTitleWidth(); - myHorTH = thePrs->GetTitleHeight(); - myHorLW = thePrs->GetLabelWidth(); - myHorLH = thePrs->GetLabelHeight(); + myHorTS = thePrs->GetTitleSize(); + myHorLS = thePrs->GetLabelSize(); myHorBW = thePrs->GetBarWidth(); myHorBH = thePrs->GetBarHeight(); } - myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat()); + myBarDlg->setLabelsPrecision( VISU::ToPrecision( thePrs->GetLabelsFormat() ) ); myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible()); SpacingSpin->setValue(thePrs->GetSpacing()); @@ -554,7 +551,8 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs, vtkFloatingPointType R, G, B; thePrs->GetTitleColor(R, G, B); - myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat()); + int lp = VISU::ToPrecision( thePrs->GetLabelsFormat() ); + myBarDlg->setLabelsPrecision( lp ); myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible()); myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)), @@ -597,12 +595,13 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) { thePrs->SetLabels(LabelSpin->value()); if(RBvert->isChecked()) { - thePrs->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + thePrs->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH); } else { - thePrs->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + thePrs->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH); } - thePrs->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data()); + std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() ); + thePrs->SetLabelsFormat( f.c_str() ); thePrs->SetUnitsVisible(myBarDlg->isUnitsVisible()); if (myIsStoreTextProp) { @@ -758,14 +757,14 @@ void VisuGUI_GaussScalarBarPane::onTextPref() void VisuGUI_GaussScalarBarPane::onBarPref() { if(RBvert->isChecked()) - myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH); else - myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH); if(myBarDlg->exec()) { if(RBvert->isChecked()) - myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH); else - myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH); } } diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index e23b9a1e..92210cce 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -101,8 +101,8 @@ class VisuGUI_GaussScalarBarPane : public QWidget//QVBox double Imin, Imax; double myHorX, myHorY, myHorW, myHorH; double myVerX, myVerY, myVerW, myVerH; - int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH; - int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH; + int myHorTS, myHorLS, myHorBW, myHorBH; + int myVerTS, myVerLS, myVerBW, myVerBH; int myRangeMode; bool myIsStoreTextProp; diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 4dd635c7..5466db2a 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -48,13 +48,13 @@ #include "SALOMEDSClient_ClientFactory.hxx" #include "SALOMEDSClient_IParameters.hxx" -#include "VVTK_ViewManager.h" -#include "VVTK_ViewWindow.h" -#include "VVTK_ViewModel.h" +//#include "VVTK_ViewManager.h" +//#include "VVTK_ViewWindow.h" +//#include "VVTK_ViewModel.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewManager.h" -#include "SVTK_MainWindow.h" +#include "SVTK_ViewWindow.h" #include "SVTK_RenderWindowInteractor.h" #include "VISU_Event.h" @@ -65,8 +65,6 @@ #include "VISU_GaussPtsAct.h" #include "VisuGUI_GaussPointsDlg.h" -#include "VisuGUI_Slider.h" - #include "VISU_Gen_i.hh" #include "VISU_Result_i.hh" #include "VISU_CutLines_i.hh" @@ -81,7 +79,7 @@ #include "VISU_SphereWidget.hxx" #include "SalomeApp_Study.h" -#include "VVTK_MainWindow.h" +//#include "VVTK_MainWindow.h" #include "VISU_View_i.hh" #ifndef DISABLE_VTKVIEWER @@ -125,6 +123,7 @@ #include + #ifdef _DEBUG_ static int MYDEBUG = 0; #else @@ -147,6 +146,8 @@ static int MYDEBUG = 0; #define GAUSS_RESTORE_CONFIGURATION 5702 #define GAUSS_RENAME_CONFIGURATION 5703 +using namespace std; + void CreateCurves( SalomeApp_Module* theModule, VISU::CutLines_i* thePrs, @@ -159,12 +160,12 @@ namespace VISU { //--------------------------------------------------------------- typedef void (SUIT_ViewWindow::* TViewVisibility)(); - void - SetViewVisibility(SalomeApp_Application* app, - TViewVisibility theViewVisibility) + void SetViewVisibility(SalomeApp_Application* app, + TViewVisibility theViewVisibility) { ViewManagerList l; - app->viewManagers( VVTK_Viewer::Type(), l ); + //app->viewManagers( VVTK_Viewer::Type(), l ); + app->viewManagers( SVTK_Viewer::Type(), l ); ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end(); for( ; anIt!=aLast; anIt++ ) if( SUIT_ViewManager* aViewManager = *anIt ) @@ -181,24 +182,20 @@ namespace VISU } //--------------------------------------------------------------- -VisuGUI_Module:: -VisuGUI_Module() : +VisuGUI_Module::VisuGUI_Module() : VisuGUI() { } //--------------------------------------------------------------- -VisuGUI_Module:: -~VisuGUI_Module() +VisuGUI_Module::~VisuGUI_Module() { } //--------------------------------------------------------------- -void -VisuGUI_Module:: -initialize( CAM_Application* theApp ) +void VisuGUI_Module::initialize( CAM_Application* theApp ) { VisuGUI::initialize( theApp ); @@ -212,9 +209,9 @@ initialize( CAM_Application* theApp ) createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 ); QPixmap aPixmap; - aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER")); - createAction( GAUSS_NEW_VIEWER, - tr("MEN_GAUSS_NEW_VIEWER"), + /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER")); + createAction( GAUSS_NEW_VIEWER, + tr("MEN_GAUSS_NEW_VIEWER"), aPixmap, tr("MEN_GAUSS_NEW_VIEWER"), tr("MEN_GAUSS_NEW_VIEWER"), @@ -226,12 +223,12 @@ initialize( CAM_Application* theApp ) int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 ); int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 ); createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 ); - + */ // Add actions to menus createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 ); //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 ); - QString aViewerType = VVTK_Viewer::Type(); + QString aViewerType = SVTK_Viewer::Type(); SUIT_Accel* accel = getApp()->accel(); accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType ); accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType ); @@ -245,10 +242,10 @@ initialize( CAM_Application* theApp ) accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType ); accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType ); accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType ); - + connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) ); - + // Prepare popup menus QtxPopupMgr* mgr = popupMgr(); QString aRule; @@ -302,7 +299,7 @@ initialize( CAM_Application* theApp ) #ifndef DISABLE_VTKVIEWER #ifndef DISABLE_SALOMEOBJECT viewers.append( SVTK_Viewer::Type() ); - viewers.append( VVTK_Viewer::Type() ); + //viewers.append( VVTK_Viewer::Type() ); #else viewers.append( VTKViewer_Viewer::Type() ); #endif @@ -359,14 +356,14 @@ initialize( CAM_Application* theApp ) this, SLOT(OnSaveConfiguration())); mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 ); mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), - "selcount>=0 and client='VVTK' and activeView='VVTK'" ); + "selcount>=0 and client='SVTK' and activeView='SVTK'" ); createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(), tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false, this, SLOT(OnOverwriteConfiguration())); mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 ); mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ), - "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='VVTK'" ); + "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" ); createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(), tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false, @@ -376,61 +373,55 @@ initialize( CAM_Application* theApp ) "selcount=1 and type='VISU::TGAUSSVIEW'" ); } -//--------------------------------------------------------------- -bool -VisuGUI_Module:: -activateModule( SUIT_Study* theStudy ) -{ - VisuGUI::activateModule( theStudy ); +// //--------------------------------------------------------------- +// bool VisuGUI_Module::activateModule( SUIT_Study* theStudy ) +// { +// VisuGUI::activateModule( theStudy ); - SetViewVisibility(getApp(),&SUIT_ViewWindow::show); - - return true; -} +// //SetViewVisibility(getApp(),&SUIT_ViewWindow::show); +// return true; +// } //--------------------------------------------------------------- -bool -VisuGUI_Module:: -deactivateModule( SUIT_Study* theStudy ) -{ - VisuGUI::deactivateModule( theStudy ); +// bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy ) +// { +// return VisuGUI::deactivateModule( theStudy ); - SetViewVisibility(getApp(),&SUIT_ViewWindow::hide); +// //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide); - return true; -} +// //return true; +// } //--------------------------------------------------------------- -SUIT_ViewManager* -VisuGUI_Module:: -onCreateViewManager() -{ - SalomeApp_Application* anApp = getApp(); - SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr(); - VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); - VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel(); - aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) ); - aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ), - aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) ); - new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); - anApp->addViewManager( aViewManager ); - - VVTK_ViewWindow* aViewWindow = ( VVTK_ViewWindow* )aViewManager->createViewWindow(); - if( aViewWindow ) - { - new VisuGUI_Slider( this, aViewWindow, anApp->selectionMgr() ); - } - - return aViewer->getViewManager(); -} +// SUIT_ViewManager* VisuGUI_Module::onCreateViewManager() +// { +// SalomeApp_Application* anApp = getApp(); +// SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr(); +// VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); +// VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel(); +// aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) ); +// aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) ); +// aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ), +// aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) ); +// aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ), +// aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) ); +// aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) ); +// aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ), +// aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ), +// aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) ); + +// new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); + +// anApp->addViewManager( aViewManager ); + +// return aViewer->getViewManager(); +// } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createPreferences() +void VisuGUI_Module::createPreferences() { VisuGUI::createPreferences(); @@ -438,15 +429,13 @@ createPreferences() createInsideCursorPreferences(); createOutsideCursorPreferences(); createPickingPreferences(); - createSpaceMousePreferences(); - createRecorderPreferences(); + // createSpaceMousePreferences(); + //createRecorderPreferences(); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createGaussPointsPreferences() +void VisuGUI_Module::createGaussPointsPreferences() { int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) ); int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab ); @@ -567,13 +556,49 @@ createGaussPointsPreferences() setPreferenceProperty( spacingPref, "min", 0.01 ); setPreferenceProperty( spacingPref, "max", 1.0 ); setPreferenceProperty( spacingPref, "step", 0.01 ); + + // spacemouse + int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab ); + setPreferenceProperty( spacemouseGr, "columns", 2 ); + int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func3_btn" ); //decrease_gauss_point_magnification + int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func4_btn" ); //increase_gauss_point_magnification + values.clear(); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) ); + indices.clear(); + indices.append( 1 ); + indices.append( 2 ); + indices.append( 3 ); + indices.append( 4 ); + indices.append( 5 ); + indices.append( 6 ); + indices.append( 7 ); + indices.append( 8 ); + indices.append( 9 ); // == button_* + indices.append( 10 ); + indices.append( 11 ); + setPreferenceProperty( spacemousePref3, "strings", values ); + setPreferenceProperty( spacemousePref3, "indexes", indices ); + setPreferenceProperty( spacemousePref4, "strings", values ); + setPreferenceProperty( spacemousePref4, "indexes", indices ); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createInsideCursorPreferences() +void VisuGUI_Module::createInsideCursorPreferences() { int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) ); @@ -659,9 +684,7 @@ createInsideCursorPreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -createOutsideCursorPreferences() +void VisuGUI_Module::createOutsideCursorPreferences() { int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) ); @@ -733,9 +756,7 @@ createOutsideCursorPreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -createPickingPreferences() +void VisuGUI_Module::createPickingPreferences() { int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) ); @@ -772,6 +793,10 @@ createPickingPreferences() int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab ); setPreferenceProperty( infoWindowGr, "columns", 2 ); + int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr, + LightApp_Preferences::Bool, "VISU", "picking_info_window" ); + setPreferenceProperty( infoWindowPref, "columns", 2 ); + int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr, LightApp_Preferences::IntSpin, "VISU", "picking_transparency" ); setPreferenceProperty( transparencyPref, "min", 0 ); @@ -793,6 +818,10 @@ createPickingPreferences() int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab ); setPreferenceProperty( cameraGr, "columns", 2 ); + int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr, + LightApp_Preferences::Bool, "VISU", "picking_camera_movement" ); + setPreferenceProperty( cameraPref, "columns", 2 ); + int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr, LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" ); setPreferenceProperty( zoomFactorPref, "min", 0.1 ); @@ -814,9 +843,7 @@ createPickingPreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -createSpaceMousePreferences() +void VisuGUI_Module::createSpaceMousePreferences() { int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) ); @@ -894,9 +921,7 @@ createSpaceMousePreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -createRecorderPreferences() +void VisuGUI_Module::createRecorderPreferences() { int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) ); @@ -930,29 +955,26 @@ createRecorderPreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnCreateGaussPoints() +void VisuGUI_Module::OnCreateGaussPoints() { double initialTime = vtkTimerLog::GetCPUTime(); - CreatePrs3d(this, VVTK_Viewer::Type()); + //CreatePrs3d(this, VVTK_Viewer::Type()); + Prs3d_i* aPrs = CreatePrs3d(this, SVTK_Viewer::Type()); + if (aPrs) + emit presentationCreated(aPrs); INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " << vtkTimerLog::GetCPUTime() - initialTime << " seconds" ); } -void -VisuGUI_Module:: -OnViewManagerAdded(SUIT_ViewManager* viewMgr) -{ - QString type = viewMgr->getViewModel()->getType(); - if ( type == VVTK_Viewer::Type() ) - connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), - this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) ); -} +// void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr) +// { +// QString type = viewMgr->getViewModel()->getType(); +// if ( type == VVTK_Viewer::Type() ) +// connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), +// this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) ); +// } -void -VisuGUI_Module:: -OnViewCreated(SUIT_ViewWindow* view) +void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view) { SVTK_ViewWindow* viewWindow = dynamic_cast( view ); if ( viewWindow ) { @@ -965,45 +987,41 @@ OnViewCreated(SUIT_ViewWindow* view) } } -void -VisuGUI_Module:: -setProperty( SVTK_ViewWindow* viewWindow, const QString& pref ) +void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref ) { if ( !viewWindow ) return; SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow(); + //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow(); int val; if ( pref == "speed_increment" ) { - val = resMgr->integerValue( "VISU", pref, 10 ); - aMainWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 10 ); + viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val ); } else if ( pref == "spacemouse_func1_btn" ) { - val = resMgr->integerValue( "VISU", pref, 1 ); - aMainWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 1 ); + viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val ); } else if ( pref == "spacemouse_func2_btn" ) { - val = resMgr->integerValue( "VISU", pref, 2 ); - aMainWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 2 ); + viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val ); } else if ( pref == "spacemouse_func3_btn" ) { val = resMgr->integerValue( "VISU", pref, 10 ); - aMainWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val ); + viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val ); } else if ( pref == "spacemouse_func4_btn" ) { val = resMgr->integerValue( "VISU", pref, 11 ); - aMainWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val ); + viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val ); } else if ( pref == "spacemouse_func5_btn" ) { - val = resMgr->integerValue( "VISU", pref, 9 ); - aMainWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 9 ); + viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val ); } } -void -VisuGUI_Module:: -setProperty( SVTK_ViewManager* vm, const QString& prop ) +void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop ) { if ( !vm ) return; @@ -1013,43 +1031,37 @@ setProperty( SVTK_ViewManager* vm, const QString& prop ) setProperty( dynamic_cast( windows[i] ), prop ); } -void -VisuGUI_Module:: -preferencesChanged( const QString& group, const QString& pref ) +void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref ) { VisuGUI::preferencesChanged(group,pref); - if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" || - pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" || - pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) { +// if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" || +// pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" || +// pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) { - // update properties of VVTK view windows - SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); - if ( vm ) - setProperty( dynamic_cast( vm ), pref ); - } +// // update properties of VVTK view windows +// SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); +// if ( vm ) +// setProperty( dynamic_cast( vm ), pref ); +// } } //--------------------------------------------------------------- -SUIT_ViewManager* -VisuGUI_Module:: -getViewManager(const QString& theType, +SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType, const bool theIsCreate) { if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate)) return aViewManager; - if (theIsCreate && theType == VVTK_Viewer::Type()) - return onCreateViewManager(); +// if (theIsCreate && theType == VVTK_Viewer::Type()) +// return onCreateViewManager(); return NULL; } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnEditGaussPoints() +void VisuGUI_Module::OnEditGaussPoints() { VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) @@ -1059,10 +1071,13 @@ OnEditGaussPoints() Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){ - // Create VVTK_ViewWindow, if it does not exist - if (VVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { + if (SVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { EditPrs3d(this, anIO, aPrs3d, aViewWindow); } + // Create VVTK_ViewWindow, if it does not exist +// if (VVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { +// EditPrs3d(this, anIO, aPrs3d, aViewWindow); +// } } } @@ -1070,10 +1085,9 @@ OnEditGaussPoints() //--------------------------------------------------------------- namespace { - void - GetViewParams(VVTK_MainWindow* theViewWindow, - const char* theSuffix, - std::ostringstream& theStr) + /* void GetViewParams(VVTK_MainWindow* theViewWindow, + const char* theSuffix, + std::ostringstream& theStr) { vtkFloatingPointType aColor[3]; vtkRenderer* aRenderer = theViewWindow->getRenderer(); @@ -1110,12 +1124,11 @@ namespace Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]); Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]); } - + */ //--------------------------------------------------------------- - void - SetViewParams(VVTK_MainWindow* theViewWindow, - const char* theSuffix, - const Storable::TRestoringMap& theMap) + /* void SetViewParams(VVTK_MainWindow* theViewWindow, + const char* theSuffix, + const Storable::TRestoringMap& theMap) { vtkFloatingPointType aColor[3]; aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble(); @@ -1152,11 +1165,10 @@ namespace aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble(); theViewWindow->SetScale(aScaleFactor); } - + */ //--------------------------------------------------------------- - void - GetViewParams(VVTK_MainWindow1* theViewWindow, - std::ostringstream& theStr) + /* void GetViewParams(VVTK_MainWindow1* theViewWindow, + std::ostringstream& theStr) { GetViewParams(theViewWindow,"1",theStr); @@ -1198,35 +1210,31 @@ namespace Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str()); } } - + */ //--------------------------------------------------------------- - void - SetViewParams(VVTK_MainWindow1* theViewWindow, - const Storable::TRestoringMap& theMap) + /*void SetViewParams(VVTK_MainWindow1* theViewWindow, + const Storable::TRestoringMap& theMap) { SetViewParams(theViewWindow,"1",theMap); } - + */ //--------------------------------------------------------------- - void - GetViewParams(VVTK_MainWindow2* theViewWindow, - std::ostringstream& theStr) + /*void GetViewParams(VVTK_MainWindow2* theViewWindow, + std::ostringstream& theStr) { GetViewParams(theViewWindow,"2",theStr); } - void - SetViewParams(VVTK_MainWindow2* theViewWindow, - const Storable::TRestoringMap& theMap) + void SetViewParams(VVTK_MainWindow2* theViewWindow, + const Storable::TRestoringMap& theMap) { SetViewParams(theViewWindow,"2",theMap); } - + */ //--------------------------------------------------------------- - std::string - GetViewParams(VVTK_ViewWindow* theViewWindow) + /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow) { std::ostringstream aStream; @@ -1241,7 +1249,7 @@ namespace return aStream.str(); } - + */ //--------------------------------------------------------------- struct TSelection { @@ -1266,8 +1274,7 @@ namespace myVisibleEntries(theVisibleEntries) {} - void - operator()(VISU_GaussPtsAct* theActor) + void operator()(VISU_GaussPtsAct* theActor) { if(theActor->GetVisibility()){ const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO(); @@ -1276,9 +1283,8 @@ namespace } }; - void - GetGaussPointsSelection(VVTK_ViewWindow* theViewWindow, - TVisibleEntries& theVisibleEntries) + /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow, + TVisibleEntries& theVisibleEntries) { // First find all visible Gauss Points presentations vtkRenderer* aRenderer = theViewWindow->getRenderer(); @@ -1307,16 +1313,14 @@ namespace } } } - + */ //--------------------------------------------------------------- - inline - void - CreateReference(_PTR(Study) theStudyDocument, - _PTR(StudyBuilder) theStudyBuilder, - _PTR(SObject) theFatherSObject, - const string& theRefEntry, - const TSelection& theSelection) + inline void CreateReference(_PTR(Study) theStudyDocument, + _PTR(StudyBuilder) theStudyBuilder, + _PTR(SObject) theFatherSObject, + const string& theRefEntry, + const TSelection& theSelection) { _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject); _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry); @@ -1335,11 +1339,10 @@ namespace //--------------------------------------------------------------- - void - SetGaussPointsSelection(VisuGUI* theModule, - VVTK_ViewWindow* theViewWindow, - _PTR(Study) theCStudy, - _PTR(SObject) theSObject) + /*void SetGaussPointsSelection(VisuGUI* theModule, + SVTK_ViewWindow* theViewWindow, + _PTR(Study) theCStudy, + _PTR(SObject) theSObject) { SVTK_Selector* aSelector = theViewWindow->GetSelector(); aSelector->ClearIObjects(); @@ -1354,7 +1357,7 @@ namespace PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if(VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in())){ // To set visiblity - VISU::UpdateViewer(theModule, aPrs3d, /*disp_only = */anIsFirst, /*highlight = */false); + VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false); anIsFirst = false; // To update selection @@ -1378,12 +1381,11 @@ namespace aSelector->EndPickCallback(); // To invoke selection changed signal } - + */ //--------------------------------------------------------------- - void - OnStoreConfiguration(SalomeApp_Module* theModule, - bool theIsNew) + /*void OnStoreConfiguration(SalomeApp_Module* theModule, + bool theIsNew) { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); if (CheckLock(aCStudy,GetDesktop(theModule))) @@ -1392,7 +1394,7 @@ namespace LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager(); - if(aViewManager->getType() == VVTK_Viewer::Type()){ + if(aViewManager->getType() == VVTK_Viewer::Type()){ SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); @@ -1466,49 +1468,42 @@ namespace //UpdateObjBrowser(theModule,true,aSObject); UpdateObjBrowser(theModule,true); } - } - } + } + }*/ //--------------------------------------------------------------- - template - void - SetMainWindowParams(VisuGUI* theModule, - _PTR(SObject) theSObject, - VVTK_ViewWindow* theViewWindow, - TMainWindow* theMainWindow) +/* template + void SetMainWindowParams(VisuGUI* theModule, + _PTR(SObject) theSObject, + VVTK_ViewWindow* theViewWindow, + TMainWindow* theMainWindow) { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject); if(!aMap.empty()) SetViewParams(theMainWindow, aMap); - } + }*/ } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnSaveConfiguration() -{ - ::OnStoreConfiguration(this,true); -} +// void VisuGUI_Module::OnSaveConfiguration() +// { +// ::OnStoreConfiguration(this,true); +// } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnOverwriteConfiguration() -{ - ::OnStoreConfiguration(this,false); -} +// void VisuGUI_Module::OnOverwriteConfiguration() +// { +// ::OnStoreConfiguration(this,false); +// } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnRestoreConfiguration() +/*void VisuGUI_Module::OnRestoreConfiguration() { LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); @@ -1524,9 +1519,8 @@ OnRestoreConfiguration() myConfigSObject = aSObject; Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject); if(!aMap.empty()){ - SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); - VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); - + SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView(); + Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt(); SVTK_Selector* aSelector = aViewWindow->GetSelector(); aSelector->SetSelectionMode(aSelectionMode); @@ -1594,37 +1588,35 @@ OnRestoreConfiguration() SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject); } } -} +}*/ //--------------------------------------------------------------- -bool -VisuGUI_Module:: -eventFilter( QObject * theWatched, QEvent * theEvent ) -{ - bool aRet = VisuGUI::eventFilter(theWatched,theEvent); - if(theEvent->type() == QEvent::Show){ - if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){ - SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); - VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); - if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){ - SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); - if(theWatched == anInteractor){ - SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); - anInteractor->removeEventFilter(this); - } - } - if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){ - SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); - if(theWatched == aMainWindow->GetInteractor()){ - SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); - anInteractor->removeEventFilter(this); - } - } - } - } - return aRet; -} +//bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent ) +//{ +// bool aRet = VisuGUI::eventFilter(theWatched,theEvent); +// if(theEvent->type() == QEvent::Show){ +// if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){ +// SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); +// VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); +// if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){ +// SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); +// if(theWatched == anInteractor){ +// SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); +// anInteractor->removeEventFilter(this); +// } +// } +// if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){ +// SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); +// if(theWatched == aMainWindow->GetInteractor()){ +// SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); +// anInteractor->removeEventFilter(this); +// } +// } +// } +// } +// return aRet; +//} const char gSeparator = '_'; // character used to separate parameter names @@ -1645,7 +1637,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) _PTR(IParameters) ip = ClientFactory::getIParameters(ap); // viewers counters are used for storing view_numbers in IParameters - int svtkViewers( 0 ), vvtkViewers( 0 ), plotViewers( 0 ); + int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 ); // componentName is used for encoding of entries when storing them in IParameters _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS ); @@ -1657,7 +1649,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since // VVTK is declared in VISU, so here we store VVTK view window parameters. // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters. - ip->setProperty( "ActiveGaussViewer", "-1" ); + /* ip->setProperty( "ActiveGaussViewer", "-1" ); getApp()->viewManagers( VVTK_Viewer::Type(), lst ); for ( it = lst.begin(); it != lst.end(); it++ ) { if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) { @@ -1674,7 +1666,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) vvtkViewers++; } } - + */ // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open.. /* @@ -1686,17 +1678,17 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) // main cycle to store parameters of displayed objects lst.clear(); getApp()->viewManagers( lst ); - vvtkViewers = svtkViewers = plotViewers = 0; + /*vvtkViewers = */svtkViewers = plotViewers = 0; for ( it = lst.begin(); it != lst.end(); it++ ) { SUIT_ViewManager* vman = *it; QString vType = vman->getType(); int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers : - vType == VVTK_Viewer::Type() ? &vvtkViewers : + //vType == VVTK_Viewer::Type() ? &vvtkViewers : vType == SPlot2d_Viewer::Type() ? &plotViewers : 0; // saving VTK actors' properties - if ( vType == SVTK_Viewer::Type() || // processing SVTK and VVTK viewers in the same - vType == VVTK_Viewer::Type() ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow) + if ( vType == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers in the same + vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow) QVector views = vman->getViews(); for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) { @@ -1783,8 +1775,8 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) QList curves; QList::Iterator itCurve; plotVF->getCurves( curves ); - - Plot2d_Curve* curve; + + //Plot2d_Curve* curve; for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) { if ( SPlot2d_Curve* sCurve = dynamic_cast( *itCurve ) ) { if ( sCurve->hasIO() ) { @@ -1853,24 +1845,24 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) std::vector paramValues = ip->getAllParameterValues( *entIt ); std::vector::iterator namesIt = paramNames.begin(); std::vector::iterator valuesIt = paramValues.begin(); - - if ( *entIt == "GaussViewer" ) { - // parameter names are view window's captions, values - visual parameters. - for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { - SUIT_ViewManager* vman = onCreateViewManager(); - SUIT_ViewWindow* vwin = vman->getActiveView(); - vwin->setWindowTitle( (*namesIt).c_str() ); - - // wait untill the window is really shown. This step fixes MANY bugs.. - while ( !vwin->isVisible() ) - qApp->processEvents(); - - vwin->setVisualParameters( (*valuesIt).c_str() ); - } - continue; // skip to next entry - } - - // entry is a normal entry - it should be "decoded" (setting base adress of component) + +// if ( *entIt == "GaussViewer" ) { +// // parameter names are view window's captions, values - visual parameters. +// for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { +// SUIT_ViewManager* vman = onCreateViewManager(); +// SUIT_ViewWindow* vwin = vman->getActiveView(); +// vwin->setWindowTitle( (*namesIt).c_str() ); + +// // wait untill the window is really shown. This step fixes MANY bugs.. +// while ( !vwin->isVisible() ) +// qApp->processEvents(); + +// vwin->setVisualParameters( (*valuesIt).c_str() ); +// } +// continue; // skip to next entry +// } + + // entry is a normal entry - it should be "decoded" (setting base adress of component) QString entry( ip->decodeEntry( *entIt ).c_str() ); //SRN: Added a check that the entry corresponds to Standard_Real object in the Study @@ -1890,8 +1882,8 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl; - if ( viewerType == SVTK_Viewer::Type().toLatin1().data() || - viewerType == VVTK_Viewer::Type().toLatin1().data() ) { + if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*|| + viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) { // used as inner map key for locating the actor. QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex ); @@ -1966,7 +1958,12 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) if ( !prs ) continue; - prs->RemoveAllClippingPlanes(); + //prs->RemoveAllClippingPlanes(); + for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) { + OrientedPlane* aPlane = dynamic_cast(prs->GetClippingPlane(i)); + if (aPlane) + prs->RemoveClippingPlane(i); + } if ( val != "Off" ) { QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts ); if ( vals.count() == 6 ) { // format check: 6 float values @@ -2012,8 +2009,8 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) SUIT_ViewModel* vmodel = (*it)->getViewModel(); if ( !vmodel ) continue; - if ( vmodel->getType() == SVTK_Viewer::Type() || // processing SVTK and VVTK viewers - vmodel->getType() == VVTK_Viewer::Type() ) { // in the same way + if ( vmodel->getType() == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers + vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView(); vtkView->getRenderer()->ResetCameraClippingRange(); vtkView->Repaint(); @@ -2039,19 +2036,19 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) */ // if active Gauss Viewer is set ( != -1) then raise the gauss view window. - bool ok; - QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str(); - int activeGaussViewer = activeGaussViewerStr.toInt( &ok ); - if ( ok && activeGaussViewer != -1 ) { - lst.clear(); - getApp()->viewManagers( VVTK_Viewer::Type(), lst ); - if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) { - SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView(); - if ( activeView ) { - activeView->activateWindow(); - //activeView->setFocus(); - } - } - } +// bool ok; +// QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str(); +// int activeGaussViewer = activeGaussViewerStr.toInt( &ok ); +// if ( ok && activeGaussViewer != -1 ) { +// lst.clear(); +// getApp()->viewManagers( VVTK_Viewer::Type(), lst ); +// if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) { +// SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView(); +// if ( activeView ) { +// activeView->activateWindow(); +// //activeView->setFocus(); +// } +// } +// } } diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h index 02abf76e..606ff7d4 100644 --- a/src/VISUGUI/VisuGUI_Module.h +++ b/src/VISUGUI/VisuGUI_Module.h @@ -50,9 +50,9 @@ public: virtual ~VisuGUI_Module(); - virtual - bool - eventFilter( QObject * theWatched, QEvent * theEvent ); + // virtual + // bool + // eventFilter( QObject * theWatched, QEvent * theEvent ); //! Redifined method of the module initializing. virtual @@ -81,16 +81,12 @@ public: void restoreVisualParameters(int savePoint); -public slots: + //public slots: //! Reimplemented method of the module deactivation. - virtual - bool - deactivateModule( SUIT_Study* ); + // virtual bool deactivateModule( SUIT_Study* ); //! Reimplemented method of the module activation. - virtual - bool - activateModule( SUIT_Study* ); + // virtual bool activateModule( SUIT_Study* ); protected: //! Create preferences for Gauss Points presentation. @@ -123,8 +119,8 @@ protected: createRecorderPreferences(); protected slots: - SUIT_ViewManager* - onCreateViewManager(); + // SUIT_ViewManager* + // onCreateViewManager(); void OnCreateGaussPoints(); @@ -132,8 +128,8 @@ protected slots: void OnViewCreated(SUIT_ViewWindow*); - void - OnViewManagerAdded(SUIT_ViewManager*); + // void + //OnViewManagerAdded(SUIT_ViewManager*); //! Reimplemented method of the Gauss Points edition. virtual @@ -141,25 +137,26 @@ protected slots: OnEditGaussPoints(); //! Virtual method of saving configuration. - virtual - void - OnSaveConfiguration(); + // virtual + // void + // OnSaveConfiguration(); //! Virtual method of overwriting configuration. - virtual - void - OnOverwriteConfiguration(); + // virtual + // void + // OnOverwriteConfiguration(); //! Virtual method of restoring configuration. - virtual - void - OnRestoreConfiguration(); + // virtual + // void + // OnRestoreConfiguration(); protected: _PTR(SObject) myConfigSObject; void setProperty( SVTK_ViewWindow*, const QString& ); // set a property (speed_increment, etc ) for SVTK ViewWindow void setProperty( SVTK_ViewManager*, const QString& ); // set a property for SVTK ViewWindow // set only 1 property for all ViewWindows of given view manager + }; #endif diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx index d8110578..54053865 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx @@ -42,6 +42,7 @@ #include "VISU_ScalarMapAct.h" #include "VISU_ScalarMap_i.hh" #include "VISU_Result_i.hh" +#include "VISU_Prs3dUtils.hh" #include "LightApp_Application.h" @@ -87,9 +88,9 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) setWindowTitle(tr("TIT_TEXT_PREF")); setSizeGripEnabled(TRUE); - QVBoxLayout* TopLayout = new QVBoxLayout(this); - TopLayout->setSpacing(6); - TopLayout->setMargin(11); + QVBoxLayout* aMainLay = new QVBoxLayout(this); + aMainLay->setSpacing(6); + aMainLay->setMargin(11); // "Title" grp QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this); @@ -109,7 +110,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) myTitleFont = new SVTK_FontWidget (aHBox); aHBLay->addWidget( myTitleFont ); - TopLayout->addWidget(aTitleGrp); + aMainLay->addWidget(aTitleGrp); // "Labels" grp QGroupBox* aLabelsGrp = new QGroupBox (tr("LBL_LABELS"), this); @@ -125,7 +126,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) myLabelFont = new SVTK_FontWidget (aHBox); aHBLay->addWidget( myLabelFont ); - TopLayout->addWidget(aLabelsGrp); + aMainLay->addWidget(aLabelsGrp); // Common buttons =========================================================== QGroupBox* GroupButtons = new QGroupBox( this ); @@ -151,7 +152,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) buttonHelp->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); - TopLayout->addWidget( GroupButtons ); + aMainLay->addWidget( GroupButtons ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); @@ -260,7 +261,8 @@ void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e ) Constructor */ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent ) - : QDialog( parent ) + : QDialog( parent ), + myOrientation( 1 ) { setModal( true ); setWindowTitle( tr( "TIT_BAR_PREF" ) ); @@ -268,109 +270,79 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent ) QString propertyName = QString( "scalar_bar_vertical_" ); - myTitleWidth = myTitleHeight = myLabelWidth = myLabelHeight = myBarWidth = myBarHeight = 0; + myTitleSize = myLabelSize = myBarWidth = myBarHeight = 0; myUnits = true; - myUnitsFormat = "%-#6.3g"; + myPrecision = 3; - QVBoxLayout* TopLayout = new QVBoxLayout( this ); - TopLayout->setSpacing( 6 ); - TopLayout->setMargin( 11 ); + QVBoxLayout* aMainLay = new QVBoxLayout( this ); + aMainLay->setSpacing( 5 ); + aMainLay->setMargin( 5 ); + + // dimensions + + QGroupBox* aDimGrp = new QGroupBox( this ); + QGridLayout* aDimGrpLay = new QGridLayout( aDimGrp ); + aDimGrpLay->setSpacing( 5 ); + aDimGrpLay->setMargin( 5 ); + + myTitleSizeSpin = new QSpinBox( aDimGrp ); + myTitleSizeSpin->setRange( 0, 100 ); + myTitleSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myTitleSizeSpin->setMinimumWidth( 70 ); + myTitleSizeSpin->setValue( 0 ); + myTitleSizeSpin->setSpecialValueText( tr( "AUTO" ) ); + QLabel* aTitleSizeLbl = new QLabel( tr( "LBL_TITLE_W" ), aDimGrp ); + + myLabelSizeSpin = new QSpinBox( aDimGrp ); + myLabelSizeSpin->setRange( 0, 100 ); + myLabelSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myLabelSizeSpin->setMinimumWidth( 70 ); + myLabelSizeSpin->setValue( 0 ); + myLabelSizeSpin->setSpecialValueText( tr( "AUTO" ) ); + QLabel* aLabelSizeLbl = new QLabel( tr( "LBL_LABEL_W" ), aDimGrp ); + + myBarWidthSpin = new QSpinBox( aDimGrp ); + myBarWidthSpin->setRange( 0, 100 ); + myBarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myBarWidthSpin->setMinimumWidth( 70 ); + myBarWidthSpin->setValue( 0 ); + myBarWidthSpin->setSpecialValueText( tr( "AUTO" ) ); + QLabel* aBarWidthLbl = new QLabel( tr( "LBL_BAR_W" ), aDimGrp ); + + myBarHeightSpin = new QSpinBox( aDimGrp ); + myBarHeightSpin->setRange( 0, 100 ); + myBarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myBarHeightSpin->setMinimumWidth( 70 ); + myBarHeightSpin->setValue( 0 ); + myBarHeightSpin->setSpecialValueText( tr( "AUTO" ) ); + QLabel* aBarHeightLbl = new QLabel( tr( "LBL_BAR_H" ), aDimGrp ); + + // format and units + + QLabel* aPrecLbl = new QLabel( tr( "PRECISION" ), aDimGrp ); + myPrecisionSpin = new QSpinBox( aDimGrp ); + myPrecisionSpin->setRange( 1, 100 ); + + myUnitsChk = new QCheckBox( tr( "LBL_SHOW_UNITS" ), aDimGrp ); + + // layout + + aDimGrpLay->addWidget( aTitleSizeLbl, 0, 0 ); + aDimGrpLay->addWidget( myTitleSizeSpin, 0, 1 ); + aDimGrpLay->addWidget( aLabelSizeLbl, 0, 2 ); + aDimGrpLay->addWidget( myLabelSizeSpin, 0, 3 ); + aDimGrpLay->addWidget( aBarWidthLbl, 1, 0 ); + aDimGrpLay->addWidget( myBarWidthSpin, 1, 1 ); + aDimGrpLay->addWidget( aBarHeightLbl, 1, 2 ); + aDimGrpLay->addWidget( myBarHeightSpin, 1, 3 ); + aDimGrpLay->addWidget( aPrecLbl, 2, 0 ); + aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 ); + aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 ); - QGroupBox* WidthHeightGroup = new QGroupBox ( this ); - QGridLayout* WidthHeightGroupLayout = new QGridLayout( WidthHeightGroup ); - WidthHeightGroupLayout->setAlignment( Qt::AlignTop ); - WidthHeightGroupLayout->setSpacing( 6 ); - WidthHeightGroupLayout->setMargin( 11 ); - - TitleWidthSpin = new QSpinBox( WidthHeightGroup ); - TitleWidthSpin->setRange( 0, 100 ); - TitleWidthSpin->setSingleStep( 1 ); - TitleWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - TitleWidthSpin->setMinimumWidth( 70 ); - TitleWidthSpin->setValue( 0 ); - TitleWidthSpin->setSpecialValueText( tr( "AUTO" ) ); - QLabel* LabelTitleWidth = new QLabel( tr( "LBL_TITLE_W" ), WidthHeightGroup ); - LabelTitleWidth->setBuddy( TitleWidthSpin ); - - TitleHeightSpin = new QSpinBox( WidthHeightGroup ); - TitleHeightSpin->setRange( 0, 100 ); - TitleHeightSpin->setSingleStep( 1 ); - TitleHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - TitleHeightSpin->setMinimumWidth( 70 ); - TitleHeightSpin->setValue( 0 ); - TitleHeightSpin->setSpecialValueText( tr( "AUTO" ) ); - QLabel* LabelTitleHeight = new QLabel( tr( "LBL_TITLE_H" ), WidthHeightGroup ); - LabelTitleHeight->setBuddy( TitleHeightSpin ); - - CBUnits = new QCheckBox( tr( "LBL_SHOW_UNITS" ), WidthHeightGroup ); - CBUnits->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - LabelWidthSpin = new QSpinBox( WidthHeightGroup ); - LabelWidthSpin->setRange( 0, 100 ); - LabelWidthSpin->setSingleStep( 1 ); - LabelWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - LabelWidthSpin->setMinimumWidth( 70 ); - LabelWidthSpin->setValue( 0 ); - LabelWidthSpin->setSpecialValueText( tr( "AUTO" ) ); - QLabel* LabelLabelWidth = new QLabel( tr( "LBL_LABEL_W" ), WidthHeightGroup ); - LabelLabelWidth->setBuddy( LabelWidthSpin ); - - LabelHeightSpin = new QSpinBox( WidthHeightGroup ); - LabelHeightSpin->setRange( 0, 100 ); - LabelHeightSpin->setSingleStep( 1 ); - LabelHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - LabelHeightSpin->setMinimumWidth( 70 ); - LabelHeightSpin->setValue( 0 ); - LabelHeightSpin->setSpecialValueText( tr( "AUTO" ) ); - QLabel* LabelLabelHeight = new QLabel( tr( "LBL_LABEL_H" ), WidthHeightGroup ); - LabelLabelHeight->setBuddy( LabelHeightSpin ); - - UnitsEdit = new QLineEdit( WidthHeightGroup ); - UnitsEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - UnitsEdit->setMinimumWidth( 35 ); - UnitsEdit->setText( myUnitsFormat ); - QLabel* UnitsLabel = new QLabel( tr( "LBL_UNITS_FORMAT" ), WidthHeightGroup ); - UnitsLabel->setBuddy( UnitsEdit ); - - BarWidthSpin = new QSpinBox( WidthHeightGroup ); - BarWidthSpin->setRange( 0, 100 ); - BarWidthSpin->setSingleStep( 1 ); - BarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - BarWidthSpin->setMinimumWidth( 70 ); - BarWidthSpin->setValue( 0 ); - BarWidthSpin->setSpecialValueText( tr( "AUTO" ) ); - QLabel* LabelBarWidth = new QLabel( tr( "LBL_BAR_W" ), WidthHeightGroup ); - LabelBarWidth->setBuddy( BarWidthSpin ); - - BarHeightSpin = new QSpinBox( WidthHeightGroup ); - BarHeightSpin->setRange( 0, 100 ); - BarHeightSpin->setSingleStep( 1 ); - BarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - BarHeightSpin->setMinimumWidth( 70 ); - BarHeightSpin->setValue( 0 ); - BarHeightSpin->setSpecialValueText( tr( "AUTO" ) ); - QLabel* LabelBarHeight = new QLabel( tr( "LBL_BAR_H" ), WidthHeightGroup ); - LabelBarHeight->setBuddy( BarHeightSpin ); - - WidthHeightGroupLayout->addWidget( LabelTitleWidth, 0, 0 ); - WidthHeightGroupLayout->addWidget( TitleWidthSpin, 0, 1 ); - WidthHeightGroupLayout->addWidget( LabelTitleHeight, 0, 2 ); - WidthHeightGroupLayout->addWidget( TitleHeightSpin, 0, 3 ); - WidthHeightGroupLayout->addWidget( CBUnits, 0, 4, 1, 2 ); - WidthHeightGroupLayout->addWidget( LabelLabelWidth, 1, 0 ); - WidthHeightGroupLayout->addWidget( LabelWidthSpin, 1, 1 ); - WidthHeightGroupLayout->addWidget( LabelLabelHeight, 1, 2 ); - WidthHeightGroupLayout->addWidget( LabelHeightSpin, 1, 3 ); - WidthHeightGroupLayout->addWidget( UnitsLabel, 1, 4 ); - WidthHeightGroupLayout->addWidget( UnitsEdit, 1, 5 ); - WidthHeightGroupLayout->addWidget( LabelBarWidth, 2, 0 ); - WidthHeightGroupLayout->addWidget( BarWidthSpin, 2, 1 ); - WidthHeightGroupLayout->addWidget( LabelBarHeight, 2, 2 ); - WidthHeightGroupLayout->addWidget( BarHeightSpin, 2, 3 ); - - TopLayout->addWidget( WidthHeightGroup ); + aMainLay->addWidget( aDimGrp ); // Common buttons =========================================================== + QGroupBox* GroupButtons = new QGroupBox( this ); QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); GroupButtonsLayout->setAlignment( Qt::AlignTop ); @@ -393,63 +365,66 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent ) GroupButtonsLayout->addWidget( buttonCancel ); GroupButtonsLayout->addWidget( buttonHelp ); - TopLayout->addWidget( GroupButtons ); + aMainLay->addWidget( GroupButtons ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); - connect( TitleWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); - connect( TitleHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); - connect( LabelWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); - connect( LabelHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); - connect( BarWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); - connect( BarHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); - connect( CBUnits, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePreview() ) ); - connect( UnitsEdit, SIGNAL( editingFinished() ), this, SIGNAL( updatePreview() ) ); + connect( myTitleSizeSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); + connect( myLabelSizeSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); + connect( myBarWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); + connect( myBarHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); + connect( myUnitsChk, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePreview() ) ); + connect( myPrecisionSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) ); } //---------------------------------------------------------------------------- -void VisuGUI_BarPrefDlg::setRatios( int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, - int barRatioWidth, int barRatioHeight ) +void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth, + int barRatioWidth, int barRatioHeight ) { - TitleWidthSpin->setValue( myTitleWidth = titleRatioWidth ); - TitleHeightSpin->setValue( myTitleHeight = titleRatioHeight ); - LabelWidthSpin->setValue( myLabelWidth = labelRatioWidth ); - LabelHeightSpin->setValue( myLabelHeight = labelRatioHeight ); - BarWidthSpin->setValue( myBarWidth = barRatioWidth ); - BarHeightSpin->setValue( myBarHeight = barRatioHeight ); + myTitleSizeSpin->setValue( myTitleSize = titleRatioSize ); + myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth ); + myBarWidthSpin->setValue( myBarWidth = barRatioWidth ); + myBarHeightSpin->setValue( myBarHeight = barRatioHeight ); } //---------------------------------------------------------------------------- -void VisuGUI_BarPrefDlg::getRatios( int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, - int& barRatioWidth, int& barRatioHeight ) +void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth, + int& barRatioWidth, int& barRatioHeight ) { - titleRatioWidth = TitleWidthSpin->value(); - titleRatioHeight = TitleHeightSpin->value(); - labelRatioWidth = LabelWidthSpin->value(); - labelRatioHeight = LabelHeightSpin->value(); - barRatioWidth = BarWidthSpin->value(); - barRatioHeight = BarHeightSpin->value(); + titleRatioSize = myTitleSizeSpin->value(); + labelRatioWidth = myLabelSizeSpin->value(); + barRatioWidth = myBarWidthSpin->value(); + barRatioHeight = myBarHeightSpin->value(); } //---------------------------------------------------------------------------- -void VisuGUI_BarPrefDlg::setLabelsFormat( const QString& format ) +void VisuGUI_BarPrefDlg::setLabelsPrecision( const int p ) { - UnitsEdit->setText( myUnitsFormat = format ); + myPrecisionSpin->setValue( p ); } +//---------------------------------------------------------------------------- +int VisuGUI_BarPrefDlg::getLabelsPrecision() const +{ + return myPrecisionSpin->value(); +} //---------------------------------------------------------------------------- -QString VisuGUI_BarPrefDlg::getLabelsFormat() +void VisuGUI_BarPrefDlg::setOrientation( const int ori ) { - return UnitsEdit->text(); + myOrientation = ori; } +//---------------------------------------------------------------------------- + +int VisuGUI_BarPrefDlg::getOrientation() const +{ + return myOrientation; +} //---------------------------------------------------------------------------- void VisuGUI_BarPrefDlg::onHelp() @@ -473,14 +448,14 @@ void VisuGUI_BarPrefDlg::onHelp() //---------------------------------------------------------------------------- void VisuGUI_BarPrefDlg::setUnitsVisible(bool isVisible) { - CBUnits->setChecked( myUnits = isVisible ); + myUnitsChk->setChecked( myUnits = isVisible ); } //---------------------------------------------------------------------------- bool VisuGUI_BarPrefDlg::isUnitsVisible() { - return CBUnits->isChecked(); + return myUnitsChk->isChecked(); } @@ -490,14 +465,12 @@ bool VisuGUI_BarPrefDlg::isUnitsVisible() */ void VisuGUI_BarPrefDlg::reject() { - TitleWidthSpin->setValue( myTitleWidth ); - TitleHeightSpin->setValue( myTitleHeight ); - LabelWidthSpin->setValue( myLabelWidth ); - LabelHeightSpin->setValue( myLabelHeight ); - BarWidthSpin->setValue( myBarWidth ); - BarHeightSpin->setValue( myBarHeight ); - CBUnits->setChecked( myUnits ); - UnitsEdit->setText( myUnitsFormat ); + myTitleSizeSpin->setValue( myTitleSize ); + myLabelSizeSpin->setValue( myLabelSize ); + myBarWidthSpin->setValue( myBarWidth ); + myBarHeightSpin->setValue( myBarHeight ); + myUnitsChk->setChecked( myUnits ); + myPrecisionSpin->setValue( myPrecision ); QDialog::reject(); } @@ -509,39 +482,26 @@ void VisuGUI_BarPrefDlg::reject() void VisuGUI_BarPrefDlg::accept() { QString dVal; - dVal.sprintf( UnitsEdit->text().toLatin1().data(), 1.1 ); - if ( dVal.toDouble() == 0. ) { - SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr ( "MSG_LABEL_FORMAT" ) ); + int aBWH = myOrientation == 1 ? myBarWidthSpin->value() : myBarHeightSpin->value(); + if( ( myLabelSizeSpin->value()+ aBWH ) > 100 ) + { + SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) ); + return; } - else { - if( - ( - TitleWidthSpin->value()+ - LabelWidthSpin->value()+ - BarWidthSpin->value() - > 100 - ) || - ( - TitleHeightSpin->value()+ - LabelHeightSpin->value()+ - BarHeightSpin->value() - > 100 - ) - ) { - SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) ); - } - else { - myTitleWidth = TitleWidthSpin->value(); - myTitleHeight = TitleHeightSpin->value(); - myLabelWidth = LabelWidthSpin->value(); - myLabelHeight = LabelHeightSpin->value(); - myBarWidth = BarWidthSpin->value(); - myBarHeight = BarHeightSpin->value(); - myUnits = CBUnits->isChecked(); - myUnitsFormat = UnitsEdit->text(); - QDialog::accept(); - } + + if ( myTitleSizeSpin->value() > 100 ) + { + SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE_TLT" ) ); + return; } + + myTitleSize = myTitleSizeSpin->value(); + myLabelSize = myLabelSizeSpin->value(); + myBarWidth = myBarWidthSpin->value(); + myBarHeight = myBarHeightSpin->value(); + myUnits = myUnitsChk->isChecked(); + myPrecision = myPrecisionSpin->value(); + QDialog::accept(); } @@ -583,10 +543,8 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.); myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.); myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.); - myVerTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0); - myVerTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0); - myVerLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0); - myVerLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0); + myVerTS = aResourceMgr->integerValue("VISU", propertyName + "title_size", 0); + myVerLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0); myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0); myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0); @@ -595,27 +553,21 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.); myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.); myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.); - myHorTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0); - myHorTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0); - myHorLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0); - myHorLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0); + myHorTS = aResourceMgr->integerValue("VISU", propertyName + "title_size", 0); + myHorLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0); myHorBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0); myHorBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0); - aMainLayout->setSpacing(6); - //setMargin(11); + //aMainLayout->setSpacing(6); // Range ============================================================ RangeGroup = new QButtonGroup ( this ); QGroupBox* aGB = new QGroupBox( tr("SCALAR_RANGE_GRP"),this ); aMainLayout->addWidget( aGB ); - //RangeGroup->setColumnLayout(0, Qt::Vertical ); - //RangeGroup->layout()->setSpacing( 0 ); - //RangeGroup->layout()->setMargin( 0 ); QGridLayout* RangeGroupLayout = new QGridLayout( aGB ); RangeGroupLayout->setAlignment( Qt::AlignTop ); - RangeGroupLayout->setSpacing( 6 ); - RangeGroupLayout->setMargin( 11 ); + //RangeGroupLayout->setSpacing( 6 ); + //RangeGroupLayout->setMargin( 11 ); myModeLbl = new QLabel("Scalar Mode", aGB); @@ -632,42 +584,39 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) MinEdit = new QLineEdit( aGB ); MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - MinEdit->setMinimumWidth( 70 ); + //MinEdit->setMinimumWidth( 70 ); MinEdit->setValidator( new QDoubleValidator(this) ); MinEdit->setText( "0.0" ); QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB); + MinLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); MinLabel->setBuddy(MinEdit); MaxEdit = new QLineEdit( aGB ); MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - MaxEdit->setMinimumWidth( 70 ); + //MaxEdit->setMinimumWidth( 70 ); MaxEdit->setValidator( new QDoubleValidator(this) ); MaxEdit->setText( "0.0" ); QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB); + MaxLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); MaxLabel->setBuddy(MaxEdit); - RangeGroupLayout->addWidget( myModeLbl, 0, 0 ); - RangeGroupLayout->addWidget( myModeCombo, 0, 1, 1, 4); - RangeGroupLayout->addWidget( CBLog, 1, 0, 1, 4); - RangeGroupLayout->addWidget( RBFrange, 2, 0, 1, 2); - RangeGroupLayout->addWidget( RBIrange, 2, 2, 1, 2); - RangeGroupLayout->addWidget( MinLabel, 3, 0 ); - RangeGroupLayout->addWidget( MinEdit, 3, 1 ); - RangeGroupLayout->addWidget( MaxLabel, 3, 2 ); - RangeGroupLayout->addWidget( MaxEdit, 3, 3 ); - - //TopLayout->addWidget( RangeGroup ); + RangeGroupLayout->addWidget( myModeLbl, 0, 0, 1, 1 ); + RangeGroupLayout->addWidget( myModeCombo, 0, 1, 1, 2); + RangeGroupLayout->addWidget( CBLog, 0, 3, 1, 1); + RangeGroupLayout->addWidget( RBFrange, 1, 0, 1, 2); + RangeGroupLayout->addWidget( RBIrange, 1, 2, 1, 2); + RangeGroupLayout->addWidget( MinLabel, 2, 0 ); + RangeGroupLayout->addWidget( MinEdit, 2, 1 ); + RangeGroupLayout->addWidget( MaxLabel, 2, 2 ); + RangeGroupLayout->addWidget( MaxEdit, 2, 3 ); // Colors and Labels ======================================================== QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this); aMainLayout->addWidget( ColLabGroup ); - //ColLabGroup->setColumnLayout(0, Qt::Vertical ); - //ColLabGroup->layout()->setSpacing( 0 ); - //ColLabGroup->layout()->setMargin( 0 ); QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup ); ColLabGroupLayout->setAlignment( Qt::AlignTop ); - ColLabGroupLayout->setSpacing( 6 ); - ColLabGroupLayout->setMargin( 11 ); + //ColLabGroupLayout->setSpacing( 6 ); + //ColLabGroupLayout->setMargin( 11 ); QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup); ColorSpin = new QSpinBox( ColLabGroup ); @@ -675,7 +624,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) ColorSpin->setMaximum( 256 ); ColorSpin->setSingleStep( 1 ); ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - ColorSpin->setMinimumWidth( 70 ); + //ColorSpin->setMinimumWidth( 70 ); ColorSpin->setValue( 64 ); QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup); @@ -685,7 +634,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) LabelSpin->setSingleStep( 1 ); LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - LabelSpin->setMinimumWidth( 70 ); + //LabelSpin->setMinimumWidth( 70 ); LabelSpin->setValue( 5 ); ColLabGroupLayout->addWidget( ColorLabel, 0, 0); @@ -693,19 +642,14 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) ColLabGroupLayout->addWidget( LabelLabel, 0, 2); ColLabGroupLayout->addWidget( LabelSpin, 0, 3); - //TopLayout->addWidget( ColLabGroup ); - // Orientation ========================================================== QButtonGroup* OrientGroup = new QButtonGroup ( this ); QGroupBox* OrientGB = new QGroupBox( tr("ORIENTATION_GRP"),this ); aMainLayout->addWidget( OrientGB ); - //OrientGroup->setColumnLayout(0, Qt::Vertical ); - //OrientGroup->layout()->setSpacing( 0 ); - //OrientGroup->layout()->setMargin( 0 ); QGridLayout* OrientGroupLayout = new QGridLayout( OrientGB ); OrientGroupLayout->setAlignment( Qt::AlignTop ); - OrientGroupLayout->setSpacing( 6 ); - OrientGroupLayout->setMargin( 11 ); + //OrientGroupLayout->setSpacing( 6 ); + //OrientGroupLayout->setMargin( 11 ); RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGB); RBvert->setChecked( true ); @@ -715,63 +659,53 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) OrientGroupLayout->addWidget( RBvert, 0, 0 ); OrientGroupLayout->addWidget( RBhori, 0, 1 ); - // TopLayout->addWidget( OrientGroup ); - // Origin =============================================================== QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this); aMainLayout->addWidget( OriginGroup ); - //OriginGroup->setColumnLayout(0, Qt::Vertical ); - //OriginGroup->layout()->setSpacing( 0 ); - // OriginGroup->layout()->setMargin( 0 ); QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup ); OriginGroupLayout->setAlignment( Qt::AlignTop ); - OriginGroupLayout->setSpacing( 6 ); - OriginGroupLayout->setMargin( 11 ); + //OriginGroupLayout->setSpacing( 6 ); + //OriginGroupLayout->setMargin( 11 ); QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup); XSpin = new QtxDoubleSpinBox( OriginGroup ); VISU::initSpinBox(XSpin, 0.0, +1.0); XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - XSpin->setMinimumWidth( 70 ); + //XSpin->setMinimumWidth( 70 ); XSpin->setValue( 0.01 ); QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup); YSpin = new QtxDoubleSpinBox( OriginGroup ); VISU::initSpinBox(YSpin, 0.0, +1.0); YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - YSpin->setMinimumWidth( 70 ); - YSpin->setValue( 0.01 ); + //YSpin->setMinimumWidth( 70 ); + YSpin->setValue( 0.1 ); OriginGroupLayout->addWidget( XLabel, 0, 0); OriginGroupLayout->addWidget( XSpin, 0, 1); OriginGroupLayout->addWidget( YLabel, 0, 2); OriginGroupLayout->addWidget( YSpin, 0, 3); - //TopLayout->addWidget( OriginGroup ); - // Dimensions ========================================================= QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this ); aMainLayout->addWidget( DimGroup ); - //DimGroup->setColumnLayout(0, Qt::Vertical ); - //DimGroup->layout()->setSpacing( 0 ); - //DimGroup->layout()->setMargin( 0 ); QGridLayout* DimGroupLayout = new QGridLayout( DimGroup ); DimGroupLayout->setAlignment( Qt::AlignTop ); - DimGroupLayout->setSpacing( 6 ); - DimGroupLayout->setMargin( 11 ); + //DimGroupLayout->setSpacing( 6 ); + //DimGroupLayout->setMargin( 11 ); QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup); WidthSpin = new QtxDoubleSpinBox( DimGroup ); VISU::initSpinBox(WidthSpin, 0.0, +1.0); WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - WidthSpin->setMinimumWidth( 70 ); + //WidthSpin->setMinimumWidth( 70 ); WidthSpin->setValue( 0.1 ); QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup); HeightSpin = new QtxDoubleSpinBox( DimGroup ); VISU::initSpinBox(HeightSpin, 0.0, +1.0); HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - HeightSpin->setMinimumWidth( 70 ); + //HeightSpin->setMinimumWidth( 70 ); HeightSpin->setValue( 0.8 ); DimGroupLayout->addWidget( WidthLabel, 0, 0); @@ -779,19 +713,10 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) DimGroupLayout->addWidget( HeightLabel, 0, 2); DimGroupLayout->addWidget( HeightSpin, 0, 3); - //TopLayout->addWidget( DimGroup ); - // Save check box =========================================================== QWidget* aSaveBox = new QWidget(this); aMainLayout->addWidget( aSaveBox ); - QVBoxLayout* aVBLay = new QVBoxLayout( aSaveBox ); - if (!thePreview) { - CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox); - aVBLay->addWidget( CBSave ); - } - else { - CBSave = 0; - } + QHBoxLayout* aVBLay = new QHBoxLayout( aSaveBox ); aVBLay->addWidget( myTextBtn = new QPushButton("Text properties...", aSaveBox) ); aVBLay->addWidget( myBarBtn = new QPushButton("Bar properties...", aSaveBox) ); @@ -801,28 +726,43 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) QGroupBox* CheckGroup = new QGroupBox("", this ); aMainLayout->addWidget( CheckGroup ); + //QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup ); QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup ); myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup); myPreviewCheck->setChecked(false); - CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 ); - - if ( thePreview ) { + CheckGroupLayout->addWidget(myPreviewCheck, 0, 0); + + myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup); + myHideBar->setChecked(false); + CheckGroupLayout->addWidget(myHideBar, 0, 1); + +// RKV : Begin + CBDistr = new QCheckBox (tr("SHOW_DISTRIBUTION"), CheckGroup); + CheckGroupLayout->addWidget(CBDistr, 1, 0); +// RKV : End + if (!thePreview) { + CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), CheckGroup); + CheckGroupLayout->addWidget( CBSave, 1, 1 ); + } + else { + CBSave = 0; myPreviewCheck->hide(); CheckGroup->hide(); } if(RBvert->isChecked()) { - myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH); } else { - myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH); } - myBarDlg->setLabelsFormat(aResourceMgr->stringValue("VISU", propertyName + "label_format", "%-#6.3g")); + int lp = aResourceMgr->integerValue( "VISU", propertyName + "scalar_bar_label_precision", 3 ); + myBarDlg->setLabelsPrecision( lp ); + myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true)); // signals and slots connections =========================================== - // connect( RangeGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( changeRange( int ) ) ); connect( RBFrange, SIGNAL( toggled( bool ) ), this, SLOT( onFieldRange( bool ) ) ); connect( RBIrange, SIGNAL( toggled( bool ) ), this, SLOT( onImposedRange( bool ) ) ); @@ -833,6 +773,9 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) ); connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) ); connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) ); + + connect( CBDistr, SIGNAL( toggled( bool ) ), this, SLOT( onShowDistribution( bool ) )); // RKV + connect( ColorSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() )); connect( LabelSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() )); connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() )); @@ -860,13 +803,13 @@ void VisuGUI_ScalarBarPane::storeToResources() { if(orient == 0) { sbX1=0.01; sbY1=0.1; - sbW=0.17; + sbW=0.1; sbH=0.8; } else { - sbX1=0.2; + sbX1=0.1; sbY1=0.01; - sbW=0.6; - sbH=0.12; + sbW=0.8; + sbH=0.08; } } @@ -903,6 +846,7 @@ void VisuGUI_ScalarBarPane::storeToResources() { aResourceMgr->setValue("VISU", "scalar_range_type", 0); aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic()); + aResourceMgr->setValue("VISU", "scalar_bar_show_distribution", isShowDistribution()); // RKV //// @@ -921,7 +865,7 @@ void VisuGUI_ScalarBarPane::storeToResources() { aTitleFont.setBold(isTitleBold); aTitleFont.setItalic(isTitleItalic); - aTitleFont.setUnderline(isTitleShadow); + aTitleFont.setOverline(isTitleShadow); QString titleFontFamily; switch (aTitleFontFamily) { @@ -956,7 +900,7 @@ void VisuGUI_ScalarBarPane::storeToResources() { aLabelFont.setBold(isLabelBold); aLabelFont.setItalic(isLabelItalic); - aLabelFont.setUnderline(isLabelShadow); + aLabelFont.setOverline(isLabelShadow); QString labelFontFamily; switch (aLabelFontFamily) { @@ -1040,6 +984,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) setRange( myScalarMap->GetMin(), myScalarMap->GetMax(), myScalarMap->IsRangeFixed() ); setScalarBarData( myScalarMap->GetNbColors(), myScalarMap->GetLabels() ); + setShowDistribution( myScalarMap->GetIsDistributionVisible() ); // "Title" CORBA::String_var aTitle = myScalarMap->GetTitle(); @@ -1053,24 +998,20 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) myScalarMap->GetBarOrientation()); if(RBvert->isChecked()) { - myVerTW = myScalarMap->GetTitleWidth(); - myVerTH = myScalarMap->GetTitleHeight(); - myVerLW = myScalarMap->GetLabelWidth(); - myVerLH = myScalarMap->GetLabelHeight(); + myVerTS = myScalarMap->GetTitleSize(); + myVerLS = myScalarMap->GetLabelSize(); myVerBW = myScalarMap->GetBarWidth(); myVerBH = myScalarMap->GetBarHeight(); - myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH); } else { - myHorTW = myScalarMap->GetTitleWidth(); - myHorTH = myScalarMap->GetTitleHeight(); - myHorLW = myScalarMap->GetLabelWidth(); - myHorLH = myScalarMap->GetLabelHeight(); + myHorTS = myScalarMap->GetTitleSize(); + myHorLS = myScalarMap->GetLabelSize(); myHorBW = myScalarMap->GetBarWidth(); myHorBH = myScalarMap->GetBarHeight(); - myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH); } - myBarDlg->setLabelsFormat(myScalarMap->GetLabelsFormat()); + myBarDlg->setLabelsPrecision( VISU::ToPrecision( myScalarMap->GetLabelsFormat() ) ); myBarDlg->setUnitsVisible(myScalarMap->IsUnitsVisible()); vtkFloatingPointType R, G, B; @@ -1095,6 +1036,8 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) myScalarMap->IsItalicLabel(), myScalarMap->IsShadowLabel()); + myHideBar->setChecked(!myScalarMap->IsBarVisible()); + // Draw Preview if (myPreviewCheck->isChecked()) { createScalarBar(); @@ -1147,26 +1090,29 @@ void VisuGUI_ScalarBarPane::createScalarBar() VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar(); myPreviewActor->GetScalarBar()->VisibilityOn(); myPreviewActor->PickableOff(); + //myPreviewActor->SetBarVisibility(!myHideBar->isChecked()); myScalarMapPL->SetScalarMode(myModeCombo->currentIndex()); if(isLogarithmic()) myScalarMapPL->SetScaling(VISU::LOGARITHMIC); else myScalarMapPL->SetScaling(VISU::LINEAR); - vtkFloatingPointType theRange[2]; - if(RBFrange->isChecked()) { - theRange[0] = myScalarMap->GetSourceMin(); - theRange[1] = myScalarMap->GetSourceMax(); + + if ( RBFrange->isChecked() ) { + myScalarMapPL->SetSourceRange(); } else { - theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble(); - theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble(); + vtkFloatingPointType aRange[2]; + aRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble(); + aRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble(); + myScalarMapPL->SetScalarRange( aRange ); } - myScalarMapPL->SetScalarRange(theRange); - myScalarMapPL->SetNbColors(sbCol); - + + myScalarMapPL->SetNbColors(sbCol); myScalarMapPL->Update(); aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable()); + aScalarBarActor->SetDistribution( myScalarMapPL->GetDistribution() ); + aScalarBarActor->SetDistributionVisibility( isShowDistribution() ); if (!myTextDlg->getTitleText().isEmpty()) { VISU::PValForTime aValForTime; @@ -1237,11 +1183,12 @@ void VisuGUI_ScalarBarPane::createScalarBar() (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); - int VerTW, VerTH, VerLW, VerLH, VerBW, VerBH; - myBarDlg->getRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH); - aScalarBarActor->SetRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH); + int VerTS, VerTH, VerLS, VerBW, VerBH; + myBarDlg->getRatios(VerTS, VerLS, VerBW, VerBH); + aScalarBarActor->SetRatios(VerTS, VerLS, VerBW, VerBH); - aScalarBarActor->SetLabelFormat(myBarDlg->getLabelsFormat().toLatin1().data()); + std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() ); + aScalarBarActor->SetLabelFormat( f.c_str() ); aScalarBarActor->Modified(); @@ -1286,12 +1233,13 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) { myScalarMap->SetPosition(XSpin->value(), YSpin->value()); myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value()); if(RBvert->isChecked()) { - myScalarMap->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myScalarMap->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH); } else { - myScalarMap->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myScalarMap->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH); } - myScalarMap->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data()); + std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() ); + myScalarMap->SetLabelsFormat( f.c_str() ); myScalarMap->SetUnitsVisible(myBarDlg->isUnitsVisible()); myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL); @@ -1300,13 +1248,16 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) { else myScalarMap->SetScaling(VISU::LINEAR); - if (RBFrange->isChecked()) { + if ( RBFrange->isChecked() ) { myScalarMap->SetSourceRange(); } else { - myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble()); + myScalarMap->SetRange( MinEdit->text().toDouble(), MaxEdit->text().toDouble() ); } myScalarMap->SetNbColors(ColorSpin->value()); myScalarMap->SetLabels(LabelSpin->value()); + myScalarMap->SetIsDistributionVisible(isShowDistribution()); // RKV + + myScalarMap->SetBarVisible(!myHideBar->isChecked()); if (isToSave()) storeToResources(); @@ -1394,13 +1345,19 @@ void VisuGUI_ScalarBarPane::onFieldRange( bool isOn ) void VisuGUI_ScalarBarPane::onImposedRange( bool isOn ) { if (isOn) { - myScalarMap->SetRange(myScalarMap->GetMin(), myScalarMap->GetMax()); + myScalarMap->SetRange( myScalarMap->GetMin(), myScalarMap->GetMax() ); MinEdit->setEnabled( true ); MaxEdit->setEnabled( true ); changeScalarMode(myModeCombo->currentIndex()); } } +void VisuGUI_ScalarBarPane::onShowDistribution( bool isOn ) +{ + myScalarMap->SetIsDistributionVisible(isOn); + updatePreview(); +} + void VisuGUI_ScalarBarPane::changeRange( int ) { if ( RBFrange->isChecked() ) { @@ -1408,7 +1365,7 @@ void VisuGUI_ScalarBarPane::changeRange( int ) MinEdit->setEnabled( false ); MaxEdit->setEnabled( false ); } else { - myScalarMap->SetRange(myScalarMap->GetMin(), myScalarMap->GetMax()); + myScalarMap->SetRange( myScalarMap->GetMin(), myScalarMap->GetMax() ); MinEdit->setEnabled( true ); MaxEdit->setEnabled( true ); } @@ -1536,6 +1493,18 @@ void VisuGUI_ScalarBarPane::setLogarithmic( bool on ) { CBLog->setChecked( on ); } +//---------------------------------------------------------------------------- +bool VisuGUI_ScalarBarPane::isShowDistribution() { + return CBDistr->isChecked(); +} + + +//---------------------------------------------------------------------------- +void VisuGUI_ScalarBarPane::setShowDistribution( bool on ) { + CBDistr->setChecked( on ); +} + +// RKV : End //---------------------------------------------------------------------------- bool VisuGUI_ScalarBarPane::isToSave() { return CBSave ? CBSave->isChecked() : false; @@ -1642,14 +1611,15 @@ void VisuGUI_ScalarBarPane::onTextPref() void VisuGUI_ScalarBarPane::onBarPref() { if(RBvert->isChecked()) - myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH); else - myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH); + myBarDlg->setOrientation( getOrientation() ); if(myBarDlg->exec()) { if(RBvert->isChecked()) - myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH); + myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH); else - myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH); + myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH); updatePreview(); } } diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.h b/src/VISUGUI/VisuGUI_Prs3dDlg.h index 86c0705a..0acefb0c 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.h +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.h @@ -105,18 +105,20 @@ class VisuGUI_BarPrefDlg: public QDialog VisuGUI_BarPrefDlg (QWidget* parent); ~VisuGUI_BarPrefDlg() {}; - void setRatios(int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, + void setRatios(int titleRatioSize, int labelRatioWidth, int barRatioWidth, int barRatioHeight); - void getRatios(int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, + void getRatios(int& titleRatioSize, int& labelRatioWidth, int& barRatioWidth, int& barRatioHeight); void setUnitsVisible(bool isVisible); bool isUnitsVisible(); - void setLabelsFormat( const QString& format); - QString getLabelsFormat(); + void setLabelsPrecision( const int p ); + int getLabelsPrecision() const; + + void setOrientation( const int ori ); + int getOrientation() const; + private: void keyPressEvent( QKeyEvent* e ); @@ -130,23 +132,20 @@ class VisuGUI_BarPrefDlg: public QDialog void onHelp(); protected: - QSpinBox* TitleWidthSpin; - QSpinBox* TitleHeightSpin; - QSpinBox* LabelWidthSpin; - QSpinBox* LabelHeightSpin; - QSpinBox* BarWidthSpin; - QSpinBox* BarHeightSpin; - QCheckBox* CBUnits; - QLineEdit* UnitsEdit; - - int myTitleWidth; - int myTitleHeight; - int myLabelWidth; - int myLabelHeight; + QSpinBox* myTitleSizeSpin; + QSpinBox* myLabelSizeSpin; + QSpinBox* myBarWidthSpin; + QSpinBox* myBarHeightSpin; + QCheckBox* myUnitsChk; + QSpinBox* myPrecisionSpin; + + int myTitleSize; + int myLabelSize; int myBarWidth; int myBarHeight; bool myUnits; - QString myUnitsFormat; + int myPrecision; + int myOrientation; }; @@ -175,6 +174,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox int getNbLabels(); bool isLogarithmic(); void setLogarithmic( bool on ); + bool isShowDistribution(); + void setShowDistribution( bool on ); bool isToSave(); void storeToResources(); @@ -205,6 +206,9 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox QCheckBox* CBSave; QCheckBox* CBLog; + QCheckBox* CBDistr; + QCheckBox* myHideBar; + QLabel* myModeLbl; QComboBox* myModeCombo; QPushButton* myTextBtn; @@ -214,8 +218,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox double myHorX, myHorY, myHorW, myHorH; double myVerX, myVerY, myVerW, myVerH; - int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH; - int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH; + int myHorTS, myHorLS, myHorBW, myHorBH; + int myVerTS, myVerTH, myVerLS, myVerBW, myVerBH; bool myIsStoreTextProp; private slots: @@ -228,7 +232,8 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox void onTextPref(); void onBarPref(); void onPreviewCheck(bool thePreview); - void updatePreview(); + void updatePreview(); + void onShowDistribution(bool); private: void createScalarBar(); diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 0fb0c6d4..21dc5ee5 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -280,61 +280,68 @@ namespace VISU //--------------------------------------------------------------- template - void + TPrs3d_i* CreatePrs3dInViewer(VisuGUI* theModule, _PTR(SObject) theTimeStampSObj, ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { + TPrs3d_i* aPrs = 0; // Create new TViewWindow instance, if it does not exist. typedef typename TViewer::TViewWindow TViewWindow; if (!GetViewWindow(theModule)) - return; + return aPrs; - CreateAndEditPrs3d - (theModule,theTimeStampSObj,thePublishInStudyMode); + aPrs = CreateAndEditPrs3d + (theModule,theTimeStampSObj,thePublishInStudyMode); theModule->application()->putInfo(QObject::tr("INF_DONE")); + return aPrs; } //---------------------------------------------------------------------------- template - void + TPrs3d_i* CreatePrs3d(VisuGUI* theModule, const QString& theDesiredViewerType = QString()) { + TPrs3d_i* aPrs = 0; if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) - return; + return aPrs; _PTR(SObject) aTimeStampSObj; Handle(SALOME_InteractiveObject) anIO; ColoredPrs3d_i::EPublishInStudyMode aPublishInStudyMode; if (!CheckTimeStamp(theModule,aTimeStampSObj,anIO,aPublishInStudyMode)) - return; - - if(aPublishInStudyMode == VISU::ColoredPrs3d_i::EPublishIndependently){ - CreatePrs3dInViewer - (theModule,aTimeStampSObj,aPublishInStudyMode); - return; + return aPrs; + + if(/*aPublishInStudyMode == */VISU::ColoredPrs3d_i::EPublishIndependently){ + // CreatePrs3dInViewer + // (theModule,aTimeStampSObj,aPublishInStudyMode); + aPrs = CreatePrs3dInViewer + (theModule,aTimeStampSObj,aPublishInStudyMode); + return aPrs; }else{ if(theDesiredViewerType.isNull()){ - if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()) - if (aViewManager->getType() == VVTK_Viewer::Type()){ - CreatePrs3dInViewer - (theModule,aTimeStampSObj,aPublishInStudyMode); - return; - } - CreatePrs3dInViewer - (theModule,aTimeStampSObj,aPublishInStudyMode); + if (/*SUIT_ViewManager* aViewManager = */theModule->getApp()->activeViewManager()) + /*if (aViewManager->getType() == VVTK_Viewer::Type()){ + aPrs = CreatePrs3dInViewer + (theModule,aTimeStampSObj,aPublishInStudyMode); + return aPrs; + }*/ + aPrs = CreatePrs3dInViewer + (theModule,aTimeStampSObj,aPublishInStudyMode); }else{ - if(theDesiredViewerType == VVTK_Viewer::Type()) - CreatePrs3dInViewer - (theModule,aTimeStampSObj,aPublishInStudyMode); - else - CreatePrs3dInViewer - (theModule,aTimeStampSObj,aPublishInStudyMode); + /*if(theDesiredViewerType == VVTK_Viewer::Type()) { + aPrs = CreatePrs3dInViewer + (theModule,aTimeStampSObj,aPublishInStudyMode); + } else {*/ + aPrs = CreatePrs3dInViewer + (theModule,aTimeStampSObj,aPublishInStudyMode); + //} } } + return aPrs; } diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx new file mode 100644 index 00000000..98dcd686 --- /dev/null +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -0,0 +1,458 @@ +// VISU VISUGUI : GUI of VISU component +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +// Author : Eugeny Nikolaev +// Module : VISU + +#include "VisuGUI_ScalarMapOnDeformedShapeDlg.h" + +#include "VisuGUI_Tools.h" +#include "VisuGUI_InputPane.h" + +#include "VISU_Result_i.hh" +#include "VISU_ScalarMapOnDeformedShape_i.hh" +#include "VISU_ColoredPrs3dFactory.hh" + +#include "VISU_ScalarMapPL.hxx" +#include "VISU_ScalarMapOnDeformedShapePL.hxx" + +#include "VISU_Convertor.hxx" + +#include "SalomeApp_Module.h" +#include "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SUIT_Desktop.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" + +#include "SALOME_ListIO.hxx" + +#include "SALOMEDSClient_AttributeString.hxx" +#include "SALOMEDSClient_AttributeName.hxx" + +#include +#include + +using namespace std; + +#define MYDEBUG 0 + +/*! + * Constructor + */ +VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule) + : VisuGUI_ScalarBarBaseDlg(theModule), + myIsAnimation(false), + myUpdateScalars(true), + myVisuGUI(theModule) +{ + setCaption(tr("DLG_TITLE")); + setSizeGripEnabled(TRUE); + + QVBoxLayout* TopLayout = new QVBoxLayout (this); + TopLayout->setSpacing(6); + TopLayout->setMargin(11); + + myTabBox = new QTabWidget (this); + + // Scalar Map on Deformed shape pane + QVBox* aBox = new QVBox (this); + aBox->setMargin(11); + QFrame* TopGroup = new QFrame (aBox, "TopGroup"); + TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken); + TopGroup->setLineWidth(1); + QGridLayout* TopGroupLayout = new QGridLayout (TopGroup); + TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + TopGroupLayout->setSpacing(6); + TopGroupLayout->setMargin(11); + + // Scale factor + QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup, "ScaleLabel"); + TopGroupLayout->addWidget(ScaleLabel, 0, 0); + + ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup); + ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + ScalFact->setPrecision(38); + ScalFact->setValue(0.1); + TopGroupLayout->addWidget(ScalFact, 0, 1); + + // Fields combo box + QLabel* FieldLabel = new QLabel (tr("FIELD_ITEM"), TopGroup, "FieldLabel"); + myFieldsCombo = new QComboBox (TopGroup,"Fields"); + + TopGroupLayout->addWidget(FieldLabel, 1, 0); + TopGroupLayout->addWidget(myFieldsCombo,1,1); + + // TimeStamps combo box + QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup, "TimeStampLabel"); + myTimeStampsCombo = new QComboBox (TopGroup,"TimeStamp"); + + TopGroupLayout->addWidget(TimeStampLabel, 2, 0); + TopGroupLayout->addWidget(myTimeStampsCombo,2,1); + + // + myTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB")); + + // Scalar bar pane + myInputPane = new VisuGUI_InputPane(VISU::TSCALARMAPONDEFORMEDSHAPE, theModule, this); + + myTabBox->addTab(GetScalarPane(), tr("SCALAR_BAR_TAB")); + myTabBox->addTab(myInputPane, tr("INPUT_TAB")); + + // Buttons + QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons"); + GroupButtons->setGeometry(QRect(10, 10, 281, 48)); + GroupButtons->setColumnLayout(0, Qt::Vertical); + GroupButtons->layout()->setSpacing(0); + GroupButtons->layout()->setMargin(0); + QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons->layout()); + GroupButtonsLayout->setAlignment(Qt::AlignTop); + GroupButtonsLayout->setSpacing(6); + GroupButtonsLayout->setMargin(11); + + QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons, "buttonOk"); + buttonOk->setAutoDefault(TRUE); + buttonOk->setDefault(TRUE); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + + GroupButtonsLayout->addItem(new QSpacerItem (5, 5, QSizePolicy::Expanding, + QSizePolicy::Minimum), 0, 1); + + QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel"); + buttonCancel->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + + QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); + + // Add Tab box and Buttons to the top layout + TopLayout->addWidget(myTabBox); + TopLayout->addWidget(GroupButtons); + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); + connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int))); + connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int))); +} + +VisuGUI_ScalarMapOnDeformedShapeDlg::~VisuGUI_ScalarMapOnDeformedShapeDlg() +{} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, + bool theInit ) +{ + if( theInit ) + myPrsCopy = VISU::TSameAsFactory().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish); + setFactor(myPrsCopy->GetScale()); + myTimeStampsCombo->setDisabled(myIsAnimation); + + CORBA::String_var aFieldName(myPrsCopy->GetScalarFieldName()); + QString aIteration = GetFloatValueOfTimeStamp(myPrsCopy->GetScalarEntity(), + aFieldName.in(), + myPrsCopy->GetScalarTimeStampNumber()); + if (myEntity2Fields.size() == 0) + { + // find all fields and time stamps on it + _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI)); + LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI); + SALOME_ListIO selected; + aSel->selectedObjects(selected); + if (selected.Extent() > 0) { + Handle(SALOME_InteractiveObject) aIO = selected.First(); + if (aIO->hasEntry()) { + _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); + VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject ); + switch(aType){ + case VISU::TTIMESTAMP: { + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + break; + } + case VISU::TFIELD: { + _PTR(SObject) newSObject; + if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject; + aSObject = aSObject->GetFather(); + break; + } + case VISU::TANIMATION: { + _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject); + for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) { + _PTR(SObject) aTmpChildSObj = aTmpIter->Value(); + _PTR(SObject) newSObject; + if(aTmpChildSObj->ReferencedObject(newSObject)){ + aSObject = newSObject; + aSObject->GetFather(); + break; + } + } + break; + }} + + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + + mySelectionObj = aSObject; + CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); + if (CORBA::is_nil(anObject)) { + mySelectionObj = mySelectionObj->GetFather(); + } + } + } + + if (mySelectionObj) { + _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); + + for (aIter->InitEx(true); aIter->More(); aIter->Next()) { + _PTR(SObject) aChildSObj = aIter->Value(); + VISU::Storable::TRestoringMap aRestoringMap = VISU::Storable::GetStorableMap(aChildSObj); + if (!aRestoringMap.empty()) { + VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aRestoringMap); + if (aType == VISU::TTIMESTAMP) { + QString aMeshName = aRestoringMap["myMeshName"]; + CORBA::String_var aName = myPrsCopy->GetMeshName(); + if (aMeshName != aName.in()) + continue; + QString aFieldName = aRestoringMap["myFieldName"]; + QString aTimeIter = aRestoringMap["myTimeStampId"]; + QString aEntity = aRestoringMap["myEntityId"]; + VISU::Entity anEntity; + switch (aEntity.toInt()) { + case 0: anEntity = VISU::NODE; break; + case 1: anEntity = VISU::EDGE; break; + case 2: anEntity = VISU::FACE; break; + case 3: anEntity = VISU::CELL; break; + } + TFieldName2TimeStamps& aFieldName2TimeStamps = myEntity2Fields[anEntity]; + TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldName2TimeStamps[aFieldName]; + aTimeStampNumber2Time[aTimeIter.toInt()] = + GetFloatValueOfTimeStamp(anEntity, + aFieldName.latin1(), + aTimeIter.toInt()); + } + } + } + } + AddAllFieldNames(); + } + myFieldsCombo->setCurrentText(aFieldName.in()); + AddAllTimes(myFieldsCombo->currentText()); + myTimeStampsCombo->setCurrentText(aIteration); + SetScalarField( false ); + + VisuGUI_ScalarBarBaseDlg::initFromPrsObject(myPrsCopy, theInit); + + if( !theInit ) + return; + + myInputPane->initFromPrsObject( myPrsCopy ); + myTabBox->setCurrentPage( 0 ); +} + +int +VisuGUI_ScalarMapOnDeformedShapeDlg +::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) +{ + if(!myInputPane->check() || !GetScalarPane()->check()) + return 0; + + int anIsOk = myInputPane->storeToPrsObject( myPrsCopy ); + anIsOk &= GetScalarPane()->storeToPrsObject( myPrsCopy ); + + myPrsCopy->SetScale(getFactor()); + + myPrsCopy->SetScalarField(myPrsCopy->GetScalarEntity(), + getCurrentScalarFieldName().latin1(), + myTimeStampID[ myTimeStampsCombo->currentItem() ]); + + if(myUpdateScalars) + SetScalarField( false ); + + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); + + return anIsOk; +} + +int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldNamePos(){ + return myFieldsCombo->currentItem(); +} + +QString VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarFieldName(){ + return myFieldsCombo->currentText(); +} + +int VisuGUI_ScalarMapOnDeformedShapeDlg::getCurrentScalarNbIterations(){ + return myTimeStampsCombo->count(); +} + +VISU::Entity +VisuGUI_ScalarMapOnDeformedShapeDlg +::getCurrentScalarEntity() +{ + VISU::Entity anEntity = VISU::Entity(-1); + TEntity2Fields::const_iterator anIter = myEntity2Fields.begin(); + for(; anIter != myEntity2Fields.end(); anIter++){ + const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second; + TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin(); + for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){ + const QString& aFieldName = aFieldIter->first; + if (aFieldName == myFieldsCombo->currentText()) { + anEntity = anIter->first; + break; + } + } + } + return anEntity; +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField( const bool save_scalar_pane ){ + SetScalarField( myTimeStampID[ myTimeStampsCombo->currentItem() ], "", save_scalar_pane ); +} + +void +VisuGUI_ScalarMapOnDeformedShapeDlg +::SetScalarField(int theIter, + QString theFieldName, + const bool save_scalar_pane ) +{ + QApplication::setOverrideCursor(Qt::waitCursor); + + if( save_scalar_pane ) + GetScalarPane()->storeToPrsObject(myPrsCopy); + + QString aFieldName; + + if(theFieldName.isEmpty()) + aFieldName = myFieldsCombo->currentText(); + else + aFieldName = theFieldName; + + VISU::Entity anEntity = getCurrentScalarEntity(); + + myPrsCopy->SetScalarField(anEntity, + aFieldName.latin1(), + theIter); + + if( save_scalar_pane ) + UpdateScalarField(); + + QApplication::restoreOverrideCursor(); +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::accept() +{ + VisuGUI_ScalarBarBaseDlg::accept(); +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::reject() +{ + VisuGUI_ScalarBarBaseDlg::reject(); +} + +QString VisuGUI_ScalarMapOnDeformedShapeDlg::GetContextHelpFilePath() +{ + return "scalar_map_on_deformed_shape_page.html"; +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllFieldNames(){ + TEntity2Fields::const_iterator anIter = myEntity2Fields.begin(); + for(; anIter != myEntity2Fields.end(); anIter++){ + const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second; + TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin(); + for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){ + const QString& aFieldName = aFieldIter->first; + myFieldsCombo->insertItem(aFieldName); + } + } +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllTimes(const QString& theFieldName){ + TEntity2Fields::const_iterator anIter = myEntity2Fields.begin(); + for(; anIter != myEntity2Fields.end(); anIter++){ + const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second; + TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin(); + for(; aFieldIter != aFieldName2TimeStamps.end(); aFieldIter++){ + const QString& aFieldName = aFieldIter->first; + if(theFieldName != aFieldName) + continue; + + myTimeStampID.clear(); + myTimeStampsCombo->clear(); + + const TTimeStampNumber2Time& aTimeStampNumber2Time = aFieldIter->second; + TTimeStampNumber2Time::const_iterator aTimeStampIter = aTimeStampNumber2Time.begin(); + for(; aTimeStampIter != aTimeStampNumber2Time.end(); aTimeStampIter++){ + int aTimeStampNumber = aTimeStampIter->first; + myTimeStampID.push_back(aTimeStampNumber); + + QString aTimeStampTime = aTimeStampIter->second; + myTimeStampsCombo->insertItem(aTimeStampTime); + } + return; + } + } +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::onFieldChanged(int){ + AddAllTimes(myFieldsCombo->currentText()); + SetScalarField(); + UpdateScalarField(); +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){ + SetScalarField(); + UpdateScalarField(); +} + +void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){ + GetScalarPane()->initFromPrsObject(myPrsCopy); +} + +QString +VisuGUI_ScalarMapOnDeformedShapeDlg +::GetFloatValueOfTimeStamp(VISU::Entity theEntity, + const std::string& theFieldName, + int theTimeStampNumber) +{ + QString aTime(""); + VISU::TEntity anEntity = VISU::TEntity(theEntity); + VISU::Result_i* theResult = myPrsCopy->GetCResult(); + VISU::Result_i::PInput anInput = theResult->GetInput(); + VISU::PField aField = anInput->GetField(myPrsCopy->GetCMeshName(), + anEntity, + theFieldName); + if(!aField) + return aTime; + + VISU::TValField& aValField = aField->myValField; + VISU::TValField::const_iterator aIter = aValField.find(theTimeStampNumber); + if(aIter != aValField.end()){ + VISU::PValForTime aValForTime = aIter->second; + aTime = VISU_Convertor::GenerateName(aValForTime->myTime).c_str(); + } + return aTime; +} diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h new file mode 100644 index 00000000..6974d688 --- /dev/null +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h @@ -0,0 +1,123 @@ +// VISU VISUGUI : GUI of VISU component +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VisuGUI_ScalarMapOnDeformedShapeDlg.h +// Author : Eugeny Nikolaev +// Module : VISU + +#ifndef VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H +#define VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H + +#include "VisuGUI_Prs3dDlg.h" + +#include "VISUConfig.hh" + +#include "QtxDblSpinBox.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +class SalomeApp_Module; +class VisuGUI_InputPane; + +namespace VISU +{ + class ScalarMapOnDeformedShape_i; +} + +class VisuGUI_ScalarMapOnDeformedShapeDlg : public VisuGUI_ScalarBarBaseDlg +{ + Q_OBJECT + +public: + VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule); + ~VisuGUI_ScalarMapOnDeformedShapeDlg(); + + double getFactor() + { return ScalFact->value(); } + void setFactor(double theFactor) + { ScalFact->setValue(theFactor); } + + virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, + bool theInit ); + + virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs); + + int getCurrentScalarFieldNamePos(); + QString getCurrentScalarFieldName(); + int getCurrentScalarNbIterations(); + VISU::Entity getCurrentScalarEntity(); + void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true ); + +protected: + virtual QString GetContextHelpFilePath(); + +protected slots: + void accept(); + void reject(); + +private slots: + void onFieldChanged(int i=0); + void onTimeStampChanged(int i=0); + +private: + QtxDblSpinBox* ScalFact; + QTabWidget* myTabBox; + VisuGUI_ScalarBarPane* myScalarPane; + VisuGUI_InputPane* myInputPane; + QComboBox *myFieldsCombo; + QComboBox *myTimeStampsCombo; + + typedef std::map TTimeStampNumber2Time; // Times map definition (iteration time, real value of time) + typedef std::map TFieldName2TimeStamps; // Field name and enity to Times + typedef std::map TEntity2Fields; // Mesh to fields map + + TEntity2Fields myEntity2Fields; + int myCurrScalarIter; + bool myIsAnimation; + bool myUpdateScalars; + std::vector myTimeStampID; + + _PTR(SObject) mySelectionObj; + SALOME::GenericObjPtr myPrsCopy; + SalomeApp_Module* myVisuGUI; + +protected: + void UpdateScalarField(); + void SetScalarField( const bool = true ); + void AddAllFieldNames(); + void AddAllTimes(const QString& theFieldName); + QString GetFloatValueOfTimeStamp(VISU::Entity theEntity, + const std::string& theFieldName, + int theTimeStampNumber); +}; + +#endif // VISUGUI_DEFORMEDSHAPEDLS_H diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index c4b6d44e..23544b40 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -1,739 +1,597 @@ // VISU VISUGUI : GUI of VISU component // -// 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 -// +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // // File : VisuGUI_Selection.cxx -// Author : Laurent CORNABE & Hubert ROLLAND +// Author : Sergey Anikin // Module : VISU -// $Header$ #include "VisuGUI_Selection.h" -#include "VisuGUI.h" -#include "VisuGUI_Tools.h" #include "VisuGUI_ViewTools.h" +#include "VisuGUI_Tools.h" + +#include "VISU_Result_i.hh" +#include "VISU_Gen_i.hh" #include "VISU_Actor.h" -#include "VISU_PrsObject_i.hh" -#include "VISU_Prs3d_i.hh" -#include "VISU_PipeLine.hxx" +#include "VISU_ScalarMapAct.h" #include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include "LightApp_VTKSelector.h" - -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_Session.h" -#include "SUIT_ResourceMgr.h" - -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" - -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" - -#include "VISU_ConvertorUtils.hxx" - -#include "utilities.h" - -// OCCT Includes -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// VTK Includes -#include -#include -#include -#include -#include - -// STL Includes -#include - -using namespace std; - - -inline -QString -GetNumber( const VISU::TStructuredId& theStructuredId, - size_t theId ) -{ - if ( theStructuredId[theId] < 0 ) - return "-"; - - return QString::number( theStructuredId[theId] ); +#include "LightApp_Study.h" + +using namespace VISU; + +////////////////////////////////////////////////// +// Class: VisuGUI_Selection +////////////////////////////////////////////////// + + +//--------------------------------------------------------------- +QVariant VisuGUI_Selection::parameter( const int ind, const QString& p ) const +{ + QVariant val( LightApp_Selection::parameter( ind, p ) ); + if ( !val.isValid() ) { + if ( p == "type" ) val = QVariant( type( ind ) ); + else if ( p == "nbComponents" ) val = QVariant( nbComponents( ind ) ); + else if ( p == "medEntity" ) val = QVariant( medEntity( ind ) ); + else if ( p == "medSource" ) val = QVariant( medSource( ind ) ); + else if ( p == "representation" ) val = QVariant( representation( ind ) ); + else if ( p == "nbTimeStamps" ) val = QVariant( nbTimeStamps( ind ) ); + else if ( p == "nbChildren" ) val = QVariant( nbChildren( ind ) ); + else if ( p == "nbNamedChildren") val = QVariant( nbNamedChildren( ind ) ); + else if ( p == "isVisible" ) val = QVariant( isVisible( ind ) ); + else if ( p == "isShrunk" ) val = QVariant( isShrunk( ind ) ); + else if ( p == "hasActor" ) val = QVariant( hasActor( ind ) ); + else if ( p == "isShading" ) val = QVariant( isShading( ind ) ); + else if ( p == "isScalarMapAct" ) val = QVariant( isScalarMapAct( ind ) ); + else if ( p == "isVisuComponent") val = QVariant( isVisuComponent( ind ) ); + else if ( p == "fullResolution" ) val = QVariant( fullResolution( ind ) ); + else if ( p == "mediumResolution" ) val = QVariant( mediumResolution( ind ) ); + else if ( p == "lowResolution" ) val = QVariant( lowResolution( ind ) ); + else if ( p == "resolutionState" ) val = QVariant( resolutionState( ind ) ); + else if ( p == "isValuesLabeled" ) val = QVariant( isValuesLabeled( ind ) ); + } + + return val; } -VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule): - QDialog(VISU::GetDesktop(theModule), - Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),//WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), - mySelectionMgr(NULL), - myModule(theModule) -{ - setModal( false ); - setAttribute( Qt::WA_DeleteOnClose, true ); - setWindowTitle( tr("WINDOW_TITLE" ) ); - setSizeGripEnabled(true); - - QGridLayout* TopLayout = new QGridLayout (this); - TopLayout->setSpacing(6); - TopLayout->setMargin(11); - TopLayout->setRowStretch(0, 0); - TopLayout->setRowStretch(1, 0); - TopLayout->setRowStretch(2, 1); - TopLayout->setRowStretch(3, 0); - - QGroupBox* aTypeBox = new QGroupBox (tr("MODE_TITLE"), this); - QHBoxLayout* aHBox = new QHBoxLayout(); - QButtonGroup* aBtnGroup = new QButtonGroup(); - - QRadioButton* aBtn = new QRadioButton (tr("MODE_POINT"), aTypeBox); - aHBox->addWidget( aBtn ); - aBtnGroup->addButton( aBtn, 0 ); - - aBtn = new QRadioButton (tr("MODE_CELL"), aTypeBox); - aHBox->addWidget( aBtn ); - aBtnGroup->addButton( aBtn, 1 ); - - aBtn = new QRadioButton (tr("MODE_ACTOR"), aTypeBox); - aHBox->addWidget( aBtn ); - aBtnGroup->addButton( aBtn, 2 ); - - aBtnGroup->button(0)->setChecked(true); +//--------------------------------------------------------------- +// Macro for converting VISU enumeration items into corresponding strings +#define ENUM2STRING( x, y ) \ + case y: \ + x = QString( #y ); \ + break - connect(aBtnGroup, SIGNAL(buttonClicked(int)), this, SLOT(onSelectionChange(int))); +QString VisuGUI_Selection::type( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + VISU::Base_i* aBase = anObjectInfo.myBase; + if(aBase){ + VISU::VISUType aType = aBase->GetType(); + if(aType == VISU::TCOLOREDPRS3DHOLDER){ + CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject); + VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject); + aType = aHolder->GetPrsType(); + } + switch (aType) { + ENUM2STRING( aResStr, VISU::TVISUGEN ); + ENUM2STRING( aResStr, VISU::TRESULT ); + ENUM2STRING( aResStr, VISU::TTABLE ); + ENUM2STRING( aResStr, VISU::TCURVE ); + ENUM2STRING( aResStr, VISU::TCONTAINER ); + ENUM2STRING( aResStr, VISU::TMESH ); + ENUM2STRING( aResStr, VISU::TSCALARMAP ); + ENUM2STRING( aResStr, VISU::TISOSURFACES ); + ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE ); + ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE ); + ENUM2STRING( aResStr, VISU::TCUTPLANES ); + ENUM2STRING( aResStr, VISU::TCUTLINES ); + ENUM2STRING( aResStr, VISU::TVECTORS ); + ENUM2STRING( aResStr, VISU::TSTREAMLINES ); + ENUM2STRING( aResStr, VISU::TPLOT3D ); + ENUM2STRING( aResStr, VISU::TANIMATION ); + } + } - aTypeBox->setLayout(aHBox); - TopLayout->addWidget(aTypeBox, 0, 0); + if(aResStr.isNull()){ + VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aMap); + switch (aType) { + ENUM2STRING( aResStr, VISU::TENTITY ); + ENUM2STRING( aResStr, VISU::TFAMILY ); + ENUM2STRING( aResStr, VISU::TGROUP ); + ENUM2STRING( aResStr, VISU::TVIEW3D ); + ENUM2STRING( aResStr, VISU::TFIELD ); + ENUM2STRING( aResStr, VISU::TTIMESTAMP ); + } + } - QWidget* aNamePane = new QWidget (this); - QGridLayout* aNameLay = new QGridLayout (aNamePane); + if(aResStr.isNull()){ + bool anIsExist; + QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist); + if ( anIsExist && aVal != "MESH" ) + aResStr = "VISU::T" + aVal; + } - QLabel* aMeshLbl = new QLabel (tr("MESH_NAME_LBL"), aNamePane); - myMeshName = new QLabel (aNamePane); + return aResStr; +} - QLabel* aFieldLbl = new QLabel (tr("FIELD_NAME_LBL"), aNamePane); - myFieldName = new QLabel (aNamePane); - aNameLay->addWidget(aMeshLbl, 0, 0); - aNameLay->addWidget(myMeshName, 0, 1); - aNameLay->addWidget(aFieldLbl, 1, 0); - aNameLay->addWidget(myFieldName, 1, 1); +//--------------------------------------------------------------- +QString VisuGUI_Selection::nbComponents( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist); + if ( isExist ) + aResStr = aVal; + return aResStr; +} - TopLayout->addWidget(aNamePane, 1, 0); - myWidgetStack = new QStackedWidget (this); +//--------------------------------------------------------------- +QString VisuGUI_Selection::resolutions( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; - // Create Points pane - myPointsPane = new QWidget (myWidgetStack); - QVBoxLayout* aVBoxLayout = new QVBoxLayout(myPointsPane); + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); - QGroupBox* aDataGrp = new QGroupBox ( tr("POINT_DATA_TITLE"), myPointsPane); - QGridLayout* aGridLay = new QGridLayout (aDataGrp); - aGridLay->setSpacing(6); + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myResolutions",&isExist); + if ( isExist ) + aResStr = aVal; - aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 ); - aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aDataGrp), 1, 0 ); - aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aDataGrp), 2, 0 ); - - myIDValLbl = new QLineEdit ("", aDataGrp); - aGridLay->addWidget( myIDValLbl, 0, 1 ); - QIntValidator* aIntValidator = new QIntValidator (myIDValLbl); - aIntValidator->setBottom(0); - myIDValLbl->setValidator(aIntValidator); - connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&))); - - myScalarValLbl = new QLabel ("", aDataGrp); - aGridLay->addWidget( myScalarValLbl, 1, 1 ); - - myVectorValLbl = new QLabel ("", aDataGrp); - myVectorValLbl->setMinimumWidth(150); - aGridLay->addWidget( myVectorValLbl, 2, 1 ); - - aVBoxLayout->addWidget( aDataGrp ); - - QGroupBox* aCoordGrp = new QGroupBox ( tr("POINT_COORD_TITLE"), myPointsPane); - aGridLay = new QGridLayout (aCoordGrp); - aGridLay->setSpacing(6); - - aGridLay->addWidget( new QLabel ("X:", aCoordGrp), 0, 0 ); - myXValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myXValLbl, 0, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("I:", aCoordGrp), 0, 2 ); - myIValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myIValLbl, 0, 3 ); - //ENK: 23.11.2006 - aGridLay->addWidget( new QLabel ("Y:", aCoordGrp), 1, 0 ); - myYValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myYValLbl, 1, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("J:", aCoordGrp), 1, 2 ); - myJValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myJValLbl, 1, 3 ); - //ENK: 23.11.2006 - aGridLay->addWidget( new QLabel ("Z:",aCoordGrp ), 2, 0 ); - myZValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myZValLbl, 2, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("K:", aCoordGrp), 2, 2 ); - myKValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myKValLbl, 2, 3 ); - //ENK: 23.11.2006 - - aVBoxLayout->addWidget( aCoordGrp ); - - myWidgetStack->addWidget(myPointsPane); - - // Create Cells pane - myCellsPane = new QWidget (myWidgetStack); - QGridLayout* aCellLayout = new QGridLayout (myCellsPane); - aCellLayout->setSpacing(6); - aCellLayout->setRowStretch(0, 0); - aCellLayout->setRowStretch(1, 1); - - QGroupBox* aCellGrp = new QGroupBox( tr("CELL_DATA_TITLE"), myCellsPane); - aGridLay = new QGridLayout (aCellGrp); - - aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aCellGrp), 0, 0); - myCellIDValLbl = new QLineEdit ("", aCellGrp); - myCellIDValLbl->setValidator(aIntValidator); - aGridLay->addWidget( myCellIDValLbl, 0, 1); - connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&))); - - aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aCellGrp), 1, 0); - myCellScalarValLbl = new QLabel ("", aCellGrp); - aGridLay->addWidget( myCellScalarValLbl, 1, 1); - aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aCellGrp), 2, 0); - myCellVectorValLbl = new QLabel ("", aCellGrp); - aGridLay->addWidget(myCellVectorValLbl , 2, 1); - - aCellLayout->addWidget(aCellGrp, 0, 0); - - myListPoints = new QTableWidget (myCellsPane); - myListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers ); - myListPoints->setColumnCount(9); - myListPoints->setRowCount(0); - myListPoints->setColumnWidth(0, 40); - myListPoints->setColumnWidth(1, 40); - myListPoints->setColumnWidth(2, 40); - myListPoints->setColumnWidth(3, 40); - myListPoints->setColumnWidth(4, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setColumnWidth(5, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setColumnWidth(6, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setSelectionMode(QAbstractItemView::NoSelection); - - QStringList aLabels; - aLabels.append( "ID" ); - aLabels.append( "X" ); - aLabels.append( "Y" ); - aLabels.append( "Z" ); - aLabels.append( "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( tr("CELL_DATA_SCALAR_HDR") ); - aLabels.append( tr("CELL_DATA_VECTOR_HDR") ); - myListPoints->setHorizontalHeaderLabels( aLabels ); - - aCellLayout->addWidget(myListPoints, 1, 0); - - myWidgetStack->addWidget(myCellsPane); - - // Actor Pane - myActorsPane = new QWidget (myWidgetStack); - aVBoxLayout = new QVBoxLayout(myActorsPane); - aVBoxLayout->setSpacing(6); - - QGroupBox* aPosGrp = new QGroupBox (tr("ACTOR_DATA_POSITION_TITLE"), myActorsPane); - aGridLay = new QGridLayout (aPosGrp); - aGridLay->setSpacing(6); - aGridLay->addWidget( new QLabel ("X:", aPosGrp), 0, 0); - myXPosLbl = new QLabel ("0", aPosGrp); - aGridLay->addWidget( myXPosLbl, 0, 1); - aGridLay->addWidget( new QLabel ("Y:", aPosGrp), 1, 0); - myYPosLbl = new QLabel ("0", aPosGrp); - aGridLay->addWidget( myYPosLbl, 1, 1); - aGridLay->addWidget( new QLabel ("Z:", aPosGrp), 2, 0); - myZPosLbl = new QLabel ("0", aPosGrp); - aGridLay->addWidget( myZPosLbl, 2, 1); - - aVBoxLayout->addWidget( aPosGrp ); - - QGroupBox* aSizeGrp = new QGroupBox ( tr("ACTOR_DATA_SIZE_TITLE"), myActorsPane); - aGridLay = new QGridLayout (aSizeGrp); - aGridLay->setSpacing(6); - aGridLay->addWidget( new QLabel ("dX:", aSizeGrp ), 0, 0); - myDXLbl = new QLabel ("0", aSizeGrp); - aGridLay->addWidget( myDXLbl, 0, 1); - aGridLay->addWidget( new QLabel ("dY:", aSizeGrp ), 1, 0); - myDYLbl = new QLabel ("0", aSizeGrp); - aGridLay->addWidget( myDYLbl, 1, 1); - aGridLay->addWidget( new QLabel ("dZ:", aSizeGrp ), 2, 0); - myDZLbl = new QLabel ("0", aSizeGrp); - aGridLay->addWidget( myDZLbl, 2, 1); - - aVBoxLayout->addWidget( aSizeGrp ); - - myWidgetStack->addWidget(myActorsPane); - - - TopLayout->addWidget(myWidgetStack, 2, 0); - - // Create buttons group - QWidget* aBtnBox = new QWidget (this); - QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox); - aBtnLayout->addStretch(); - - QPushButton* aCloseBtn = new QPushButton (tr("BUT_CLOSE"), aBtnBox); - aBtnLayout->addWidget(aCloseBtn); - connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close())); - - QPushButton* aHelpBtn = new QPushButton (tr("BUT_HELP"), aBtnBox); - aBtnLayout->addWidget(aHelpBtn); - connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); - - TopLayout->addWidget(aBtnBox, 3, 0); - - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - mySelectionMgr = anApp->selectionMgr(); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent())); - - //connect(visuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close())); - - myFl = false; - - // Activate Points pane - myWidgetStack->setCurrentWidget(myPointsPane); - if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule)) - aViewWindow->SetSelectionMode(NodeSelection); - onSelectionEvent(); + return aResStr; } -VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg() + +//--------------------------------------------------------------- +QString VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if ( !aViewWindow ) - return; + QString aResStr; - switch ( aViewWindow->SelectionMode() ) { - case NodeSelection: - case CellSelection: - aViewWindow->SetSelectionMode(ActorSelection); - break; - } + QString aResolutions = resolutions( ind ); + if(aResolutions.isEmpty()) + return aResStr; + + if(aResolutions.indexOf(theResoltuion) != -1) + aResStr = "1"; + else + aResStr = "0"; + + return aResStr; } -void VisuGUI_SelectionDlg::onSelectionChange (int theId) -{ - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if (!aViewWindow) return; - - switch (theId) { - case 0: // Points - myWidgetStack->setCurrentWidget(myPointsPane); - aViewWindow->SetSelectionMode(NodeSelection); - onPointIdEdit(myIDValLbl->text()); - break; - case 1: // Cells - myWidgetStack->setCurrentWidget(myCellsPane); - aViewWindow->SetSelectionMode(CellSelection); - onCellIdEdit(myCellIDValLbl->text()); - break; - case 2: // Actor - myWidgetStack->setCurrentWidget(myActorsPane); - aViewWindow->SetSelectionMode(ActorSelection); - onSelectionEvent(); - } + +//--------------------------------------------------------------- +QString VisuGUI_Selection::fullResolution( const int ind ) const +{ + return resolution( ind, 'F'); } -void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent) +//--------------------------------------------------------------- +QString VisuGUI_Selection::mediumResolution( const int ind ) const { - QDialog::closeEvent(theEvent); + return resolution( ind, 'M'); } -template QString getValue(TData* theData, int theId){ - if (vtkDataArray *aScalar = theData->GetScalars()){ - vtkFloatingPointType aVal = aScalar->GetTuple1(theId); - return QString::number(aVal); - } else { - return QString("No data"); + +//--------------------------------------------------------------- +QString VisuGUI_Selection::lowResolution( const int ind ) const +{ + return resolution( ind, 'L'); +} + + +//--------------------------------------------------------------- +QString VisuGUI_Selection::resolutionState( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myState",&isExist); + if ( isExist ) { + if ( aVal.toInt() == VISU::Result::FULL ) + aResStr = "F"; + if ( aVal.toInt() == VISU::Result::MEDIUM ) + aResStr = "M"; + if ( aVal.toInt() == VISU::Result::LOW ) + aResStr = "L"; + if ( aVal.toInt() == VISU::Result::HIDDEN ) + aResStr = "H"; } + + return aResStr; } -template QString getVector(TData* theData, int theId){ - if (vtkDataArray *aVector = theData->GetVectors()) { - vtkFloatingPointType *aVal = aVector->GetTuple3(theId); - return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]); - } else { - return QString("No data"); + +//--------------------------------------------------------------- +QString VisuGUI_Selection::medEntity( const int ind ) const +{ + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return QString(); + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist); + if ( isExist ) { + using namespace VISU; + TEntity anEntityId = TEntity(aVal.toInt()); + switch(anEntityId){ + case NODE_ENTITY : + return "NODE_ENTITY"; + case EDGE_ENTITY : + return "EDGE_ENTITY"; + case FACE_ENTITY : + return "FACE_ENTITY"; + case CELL_ENTITY : + return "CELL_ENTITY"; + default: + return QString(); + } } + return QString(); } -#define ABS(a) (a>=0)?a:-a - -void VisuGUI_SelectionDlg::onSelectionEvent() { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if (!aViewWindow) - return; - - switch (aViewWindow->SelectionMode()) { - case NodeSelection: - case CellSelection: - case ActorSelection: - break; - default: - close(); - delete this; - return; +QString VisuGUI_Selection::medSource( const int ind ) const +{ + _PTR(Study) aStudyDS = GetStudy()->studyDS(); + if(_PTR(SObject) aSObject = aStudyDS->FindObjectID((const char*)entry(ind).toLatin1())){ + VISU::Result_var aRes; + if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){ + using namespace VISU; + Result_i::ECreationId aCreationId = aResult->GetCreationId(); + switch(aCreationId){ + case Result_i::eImportFile : + return "eImportFile"; + case Result_i::eCopyAndImportFile : + return "eCopyAndImportFile"; + case Result_i::eImportMed : + return "eImportMed"; + case Result_i::eImportMedField : + return "eImportMedField"; + default: + return QString(); + } + } } + return QString(); +} - if (myFl) - return; - myFl = true; +QString VisuGUI_Selection::nbTimeStamps( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist); + if ( isExist ) + aResStr = aVal; + return aResStr; +} - int aType = myWidgetStack->indexOf(myWidgetStack->currentWidget()); - SVTK_Selector* aSelector = aViewWindow->GetSelector(); +//---------------------------------------------------------------------------- +template +struct TPopupDispatcher +{ + QString + operator()(const SalomeApp_Module* theModule, + const QString& theEntry) + { + if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){ + QString aType = aViewManager->getType(); + TPopupFunctor aFunctor; + if(aType == SVTK_Viewer::Type()) + return aFunctor.template Get(theModule, theEntry); + //else if(aType == VVTK_Viewer::Type()) + //return aFunctor.template Get(theModule, theEntry); + } + return QString(); + } +}; + + +//---------------------------------------------------------------------------- +template +bool +GetPrs3dSelectionInfo(const SalomeApp_Module* theModule, + const QString& theEntry, + VISU::Prs3d_i*& thePrs3d, + SVTK_ViewWindow*& theViewWindow, + VISU_Actor*& thenActor) +{ + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), (const char*)theEntry.toLatin1()); + thePrs3d = GetPrs3dFromBase(anObjectInfo.myBase); + if(!thePrs3d) + return false; + + typedef typename TViewer::TViewWindow TViewWindow; + theViewWindow = GetActiveViewWindow(theModule); + if(!theViewWindow) + return false; + + thenActor = FindActor(theViewWindow, thePrs3d); + if(!thenActor) + return false; + + return true; +} - _PTR(SObject) aSObject; - VISU::Prs3d_i* aPrs3d = NULL; - Handle(SALOME_InteractiveObject) anIO; - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myModule); - if(aSelectionInfo.size() == 1){ - // Get selected SObject - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo; - aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase); - if(aPrs3d){ - anIO = aSelectionItem.myIO; - aSObject = anObjectInfo.mySObject; - } +//---------------------------------------------------------------------------- +struct TViewFunctor +{ + template + QString + Get(const SalomeApp_Module* theModule, + const QString& theEntry) + { + VISU_Actor* anActor = NULL; + VISU::Prs3d_i* aPrs3d = NULL; + SVTK_ViewWindow* aViewWindow = NULL; + if(!GetPrs3dSelectionInfo(theModule, theEntry, aPrs3d, aViewWindow, anActor)) + return QString(); + + return get(aPrs3d, aViewWindow, anActor); } + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return QString(); + } +}; - if (aPrs3d) { - QString aMeshName("NULL"), aFieldName("NULL"); - if (aSObject) { - VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aSObject); - if (!aMap.empty()) { - aMeshName = VISU::Storable::FindValue(aMap, "myMeshName"); - aFieldName = VISU::Storable::FindValue(aMap, "myFieldName"); - } - } - myMeshName ->setText((aMeshName == "NULL") ? QString("No name") : aMeshName); - myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName); - - VISU_Actor* anVISUActor = - VISU::FindActor(VISU::GetAppStudy(myModule), aViewWindow, aSObject->GetID().c_str()); - if (anVISUActor) { - vtkFloatingPointType aCoord[6]; - anVISUActor->GetBounds(aCoord); - myXPosLbl->setText(QString::number( aCoord[0] )); - myYPosLbl->setText(QString::number( aCoord[2] )); - myZPosLbl->setText(QString::number( aCoord[4] )); - - myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) )); - myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) )); - myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) )); - - TColStd_IndexedMapOfInteger aMapIndex; - typedef std::vector TCoordArray; - typedef map TPointCoordsMap; - TPointCoordsMap aPointCoordsMap; - - aSelector->GetIndex(anIO, aMapIndex); - - vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput(); - vtkPointData* aPntData = aDataSet->GetPointData(); - - for (int ind = 1; ind <= aMapIndex.Extent(); ind++) { - int anID = aMapIndex(ind); - - switch (aType) { - case 0: - { - int aVTKID = anVISUActor->GetNodeVTKID(anID); - if(aVTKID >= 0){ - if ( aVTKID >= 0 ) { - vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID); - myXValLbl->setText( QString::number( aCoord[0] ) ); - myYValLbl->setText( QString::number( aCoord[1] ) ); - myZValLbl->setText( QString::number( aCoord[2] ) ); - myIDValLbl->setText( QString::number( anID ) ); - - if ( !VISU::IsElnoData( aDataSet ) ) { - myScalarValLbl->setText( getValue( aPntData, aVTKID ) ); - myVectorValLbl->setText( getVector( aPntData, aVTKID ) ); - } else { - myScalarValLbl->setText( "< ELNO data >" ); - myVectorValLbl->setText( "< ELNO data >" ); - } - - const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper(); - VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode( anID ); - myKValLbl->setText( GetNumber( aStructuredId, 2 ) ); - myJValLbl->setText( GetNumber( aStructuredId, 1 ) ); - myIValLbl->setText( GetNumber( aStructuredId, 0 ) ); - } - } - break; - } - case 1: - { - vtkCellData* aCellData = aDataSet->GetCellData(); - vtkCell* aCell = anVISUActor->GetElemCell(anID); - int aVTKID = anVISUActor->GetElemVTKID(anID); - if (aCell != NULL) { - int aNbOfPoints = aCell->GetNumberOfPoints(); - if ( aNbOfPoints > 0 ) { - myCellIDValLbl->setText( QString::number(anID) ); - myCellScalarValLbl->setText(getValue(aCellData, aVTKID)); - myCellVectorValLbl->setText(getVector(aCellData, aVTKID)); - - vtkIdList *aPointList = aCell->GetPointIds(); - for (int i = 0; i < aNbOfPoints; i++) { - int aNodeVTKId = aPointList->GetId(i); - vtkFloatingPointType* aCoord = aDataSet->GetPoint(aNodeVTKId); - vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aNodeVTKId); - TCoordArray aCoordArray(aCoord, aCoord + 3); - aPointCoordsMap[aNodeObjId] = aCoordArray; - } - } - } - } - break; - } - } +//---------------------------------------------------------------------------- +struct TGetRepesentationFunctor: TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + QString aResStr; + switch (theActor->GetRepresentation()) { + ENUM2STRING( aResStr, VISU::POINT ); + ENUM2STRING( aResStr, VISU::WIREFRAME ); + ENUM2STRING( aResStr, VISU::SHADED ); + ENUM2STRING( aResStr, VISU::INSIDEFRAME ); + ENUM2STRING( aResStr, VISU::SURFACEFRAME ); + ENUM2STRING( aResStr, VISU::FEATURE_EDGES ); + } + return aResStr; + } +}; + +QString VisuGUI_Selection::representation( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); +} + +//---------------------------------------------------------------------------- +SalomeApp_Study* VisuGUI_Selection::GetStudy() const + +{ + LightApp_Study* aLightStudy = const_cast( study() ); + return dynamic_cast( aLightStudy ); +} - myListPoints->setRowCount(aPointCoordsMap.size()); - TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin(); - - const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper(); - for (int i = 0; anIter != aPointCoordsMap.end() && i < myListPoints->rowCount(); anIter++, i++) { - myListPoints->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole ); - vtkIdType aNodeObjId = anIter->first; - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode(aNodeObjId); - QString aI = GetNumber(aStructuredId, 0); - QString aJ = GetNumber(aStructuredId, 1); - QString aK = GetNumber(aStructuredId, 2); - //ENK: 23.11.2006 - - QAbstractItemModel* aModel = myListPoints->model(); - aModel->setData( aModel->index(i,0), QVariant(QString::number( aNodeObjId )), Qt::DisplayRole ); - const TCoordArray& aCoordArray = anIter->second; - aModel->setData( aModel->index(i,1), QVariant(QString::number( aCoordArray[0] )), Qt::DisplayRole ); - aModel->setData( aModel->index(i,2), QVariant(QString::number( aCoordArray[1] )), Qt::DisplayRole ); - aModel->setData( aModel->index(i,3), QVariant(QString::number( aCoordArray[2] )), Qt::DisplayRole ); - aModel->setData( aModel->index(i,4), QVariant( aI ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176 - aModel->setData( aModel->index(i,5), QVariant( aJ ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176 - aModel->setData( aModel->index(i,6), QVariant( aK ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176 - - vtkIdType aNodeVTKId = anVISUActor->GetNodeVTKID(aNodeObjId); - aModel->setData( aModel->index(i,7), QVariant(getValue(aPntData, aNodeVTKId)), Qt::DisplayRole ); - aModel->setData( aModel->index(i,8), QVariant(getVector(aPntData, aNodeVTKId)), Qt::DisplayRole ); +//---------------------------------------------------------------------------- +int VisuGUI_Selection::nbChild( const int ind, const bool named ) const +{ + int cnt = 0; + SalomeApp_Study* aSStudy = GetStudy(); + if ( !aSStudy ) + return cnt; + _PTR(Study) aStudy = GetCStudy( aSStudy ); + if ( aStudy ){ + _PTR(SObject) SO = aStudy->FindObjectID( (const char*)entry( ind ).toLatin1() ); + if ( SO ){ + for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) { + _PTR(SObject) refSO; + if ( !Iter->Value()->ReferencedObject( refSO ) && ( !named || Iter->Value()->GetName().size() ) ) + cnt++; } - //for(int aColumnId = 0; aColumnId < 9; aColumnId++) - myListPoints->resizeColumnsToContents(); } - } else { - clearFields(); } - myFl = false; + return cnt; } -#undef ABS - - -void VisuGUI_SelectionDlg::clearFields() { - int aType = myWidgetStack->indexOf(myWidgetStack->currentWidget()); - switch (aType) { - case 0: - myXValLbl->setText( "" ); - myYValLbl->setText( "" ); - myZValLbl->setText( "" ); - myIValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myJValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myKValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myScalarValLbl->setText(""); - myVectorValLbl->setText(""); - break; - case 1: - myCellScalarValLbl->setText(""); - myCellVectorValLbl->setText(""); - myListPoints->setRowCount(0); - break; - case 2: - myXPosLbl->setText(""); - myYPosLbl->setText(""); - myZPosLbl->setText(""); - myDXLbl->setText(""); - myDYLbl->setText(""); - myDZLbl->setText(""); - } + +//---------------------------------------------------------------------------- +QString VisuGUI_Selection::nbChildren( const int ind ) const +{ + QString aResStr; + aResStr.setNum( nbChild( ind, false ) ); + return aResStr; +} + +//---------------------------------------------------------------------------- +QString VisuGUI_Selection::nbNamedChildren( const int ind ) const +{ + QString aResStr; + aResStr.setNum( nbChild( ind, true ) ); + return aResStr; } -typedef vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID); -bool onIdEdit (const QString& theText, - TGetVTKIdMethod theMethod, - bool theIsCell, - const SalomeApp_Module* theModule, - QLabel* theMeshName, - QString theValue, - QLabel* theFieldName) +//---------------------------------------------------------------------------- +struct TIsVisibleFunctor: TViewFunctor { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(theModule); - if (!aViewWindow) - return false; - SVTK_Selector* aSelector = aViewWindow->GetSelector(); - - _PTR(SObject) aSObject; - VISU::Prs3d_i* aPrs3d = NULL; - Handle(SALOME_InteractiveObject) anIO; - - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); - if(aSelectionInfo.size() == 1){ - // Get selected SObject - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo; - aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase); - if(aPrs3d){ - anIO = aSelectionItem.myIO; - aSObject = anObjectInfo.mySObject; - } + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return theActor->GetVisibility() ? "true" : "false"; } - if (aPrs3d) { - int anObjId = theText.toInt(); - VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine(); - int aVTKId = (aPipeLine->*theMethod)(anObjId); - if(aVTKId < 0) - return false; - - TColStd_MapOfInteger newIndices; - newIndices.Add(anObjId); - aSelector->AddOrRemoveIndex(anIO, newIndices, false); - aViewWindow->highlight(anIO, true, true); - - return true; - - } else { - theMeshName->setText(theValue); - theFieldName->setText(""); +}; + +QString VisuGUI_Selection::isVisible( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); +} + + +//---------------------------------------------------------------------------- +struct TIsShrunkFunctor: TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return theActor->IsShrunk() ? "1" : "0"; } - return false; +}; + +QString VisuGUI_Selection::isShrunk( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); } -void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText) -{ - if (myFl) return; - TGetVTKIdMethod aMethod = &VISU_PipeLine::GetNodeVTKID; - bool anIsSelected = onIdEdit(theText, - aMethod, - false, - myModule, - myMeshName, - tr("WRN_NO_AVAILABLE_DATA"), - myFieldName); - if (anIsSelected) - // as selection manager doesn't send signal currentSelectionChanged() - onSelectionEvent(); - else - clearFields(); + +//---------------------------------------------------------------------------- +QString VisuGUI_Selection::hasActor( const int ind ) const +{ + return representation( ind ).isEmpty() ? "0" : "1"; } -void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText) -{ - if (myFl) return; - TGetVTKIdMethod aMethod = &VISU_PipeLine::GetElemVTKID; - bool anIsSelected = onIdEdit(theText, - aMethod, - true, - myModule, - myMeshName, - tr("WRN_NO_AVAILABLE_DATA"), - myFieldName); - if (anIsSelected) - // as selection manager doesn't send signal currentSelectionChanged() - onSelectionEvent(); - else - clearFields(); + +//---------------------------------------------------------------------------- +struct TIsShadingFunctor: TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)) + return anActor->IsShading() ? "1" : "0"; + return QString(); + } +}; + +QString VisuGUI_Selection::isShading( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); } -void VisuGUI_SelectionDlg::onHelp() -{ - QString aHelpFileName = "selection_info_page.html"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) ); + +//---------------------------------------------------------------------------- +struct TIsScalarMapActFunctor: TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return dynamic_cast(theActor)? "1" : "0"; } +}; + + +//--------------------------------------------------------------- +QString VisuGUI_Selection::isScalarMapAct( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); } -void VisuGUI_SelectionDlg::keyPressEvent( QKeyEvent* e ) + +//---------------------------------------------------------------------------- +bool VisuGUI_Selection::isVisuComponent( const int ind ) const { - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; + SalomeApp_Study* study = GetStudy(); + if ( !study ) + return false; + + _PTR(SObject) obj = study->studyDS()->FindObjectID( (const char*)entry( ind ).toLatin1() ); + if ( !obj ) + return false; + CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj ); + if( CORBA::is_nil( anObj ) ) + return false; - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - onHelp(); - } + return dynamic_cast( VISU::GetServant( anObj ).in() ); } + +//---------------------------------------------------------------------------- +struct TIsValuesLabeled : TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return theActor && theActor->GetValuesLabeled() ? "true" : "false"; + } +}; + +QString VisuGUI_Selection::isValuesLabeled( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); +} + diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 0e6d2de1..2dcaf666 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -1,6 +1,6 @@ // VISU VISUGUI : GUI of VISU component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2005 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 @@ -22,82 +22,61 @@ // // // File : VisuGUI_Selection.h -// Author : Laurent CORNABE & Hubert ROLLAND +// Author : Sergey Anikin // Module : VISU -// $Header$ #ifndef VisuGUI_Selection_HeaderFile #define VisuGUI_Selection_HeaderFile -#include +#include -class QLabel; -class QStackedWidget; -//class QVBox; -class QLineEdit; -class QTableWidget; -class LightApp_SelectionMgr; -class SalomeApp_Application; -class SalomeApp_Module; +////////////////////////////////////////////////// +// Class: VisuGUI_Selection +////////////////////////////////////////////////// -class VisuGUI_SelectionDlg: public QDialog { - Q_OBJECT +class SalomeApp_Module; +class SalomeApp_Study; +class VisuGUI_Selection : public LightApp_Selection +{ public: - VisuGUI_SelectionDlg (const SalomeApp_Module* theModule); - virtual ~VisuGUI_SelectionDlg (); - -private: - void keyPressEvent( QKeyEvent* e ); - -protected: - void closeEvent (QCloseEvent* theEvent); - -private slots: - void onSelectionChange (int theId); - void onSelectionEvent (); - void onPointIdEdit (const QString& theText); - void onCellIdEdit (const QString& theText); - void onHelp(); + VisuGUI_Selection( SalomeApp_Module* theModule ) + : LightApp_Selection(), myModule( theModule ) {}; + virtual ~VisuGUI_Selection() {}; - private: - void clearFields (); + virtual QVariant parameter( const int, const QString& ) const; - QLabel* myMeshName; - QLabel* myFieldName; - - QStackedWidget* myWidgetStack; - QWidget* myPointsPane; - QWidget* myCellsPane; - QLabel* myXValLbl; - QLabel* myYValLbl; - QLabel* myZValLbl; - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - QLabel* myIValLbl; //!< used for structured mesh selection - QLabel* myJValLbl; //!< used for structured mesh selection - QLabel* myKValLbl; //!< used for structured mesh selection - //ENK: 23.11.2006 - - QLineEdit* myIDValLbl; - QLabel* myScalarValLbl; - QLabel* myVectorValLbl; +private: + QString type( const int ) const; + QString nbComponents( const int ) const; + QString medEntity( const int ) const; + QString medSource( const int ) const; + QString nbTimeStamps( const int ) const; + QString representation( const int ) const; + QString nbChildren( const int ) const; + QString nbNamedChildren( const int ) const; + QString isVisible( const int ) const; + QString isShrunk( const int ) const; + QString hasActor( const int ) const; + QString isShading( const int ) const; + QString isScalarMapAct( const int ) const; + bool isVisuComponent( const int ) const; + QString isValuesLabeled( const int ) const; + + QString fullResolution( const int ) const; + QString mediumResolution( const int ) const; + QString lowResolution( const int ) const; + QString resolutionState( const int ) const; - QTableWidget* myListPoints; - QLineEdit* myCellIDValLbl; - QLabel* myCellScalarValLbl; - QLabel* myCellVectorValLbl; +private: + int nbChild( const int, const bool ) const; + SalomeApp_Study* GetStudy() const; - QWidget* myActorsPane; - QLabel* myXPosLbl; - QLabel* myYPosLbl; - QLabel* myZPosLbl; - QLabel* myDXLbl; - QLabel* myDYLbl; - QLabel* myDZLbl; + QString resolutions( const int ) const; + QString resolution( const int, char theResoltuion ) const; - const SalomeApp_Module* myModule; - LightApp_SelectionMgr* mySelectionMgr; - bool myFl; +private: + SalomeApp_Module* myModule; }; #endif diff --git a/src/VISUGUI/VisuGUI_Slider.cxx b/src/VISUGUI/VisuGUI_Slider.cxx index 64379d60..8db0a28c 100644 --- a/src/VISUGUI/VisuGUI_Slider.cxx +++ b/src/VISUGUI/VisuGUI_Slider.cxx @@ -41,20 +41,21 @@ #include "VISU_Actor.h" -#include "VVTK_MainWindow.h" -#include "VVTK_ViewWindow.h" - #include "VISU_Gen_i.hh" -#include "VisuGUI_Module.h" +#include "VisuGUI.h" #include "VisuGUI_Tools.h" #include "VisuGUI_Prs3dTools.h" #include "VTKViewer_Algorithm.h" #include "SVTK_Functor.h" +#include "QtxDockWidget.h" +#include "QtxDoubleSpinBox.h" + #include #include +#include #include #include #include @@ -64,146 +65,209 @@ #include #include #include +#include +#include +#include #include +#include + +using namespace std; /*! Constructor */ -VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, - VVTK_ViewWindow* theViewWindow, +VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, + QMainWindow* theParent, LightApp_SelectionMgr* theSelectionMgr ) - : QtxToolBar( tr("TOOLBAR_TITLE"), theViewWindow->getMainWindow1() ), - myModule( theModule ), - myMainWindow( theViewWindow->getMainWindow1() ), - mySelectionMgr( theSelectionMgr ) + : QWidget( theParent ) + , myViewManager( VISU::GetVisuGen( theModule )->GetViewManager() ) + , mySelectionMgr( theSelectionMgr ) + , myModule( theModule ) { - //setLabel(); - //setCloseMode(QDockWindow::Undocked); - setMovable( true ); - - VISU::ViewManager_var aViewManager = VISU::GetVisuGen( myModule )->GetViewManager(); - VISU::View_var aView = aViewManager->GetCurrentView(); - if(!CORBA::is_nil(aView.in())) - myView3D = VISU::View3D::_narrow(aView); + setWindowTitle( tr("TITLE") ); + setObjectName( tr("TITLE") ); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - //setHorizontallyStretchable( true ); - - QWidget* aWidget = new QWidget( this ); - aWidget->setFocusPolicy(Qt::StrongFocus); - myWidgetAction = addWidget( aWidget ); - - QGridLayout* aLayout = new QGridLayout( aWidget ); - aLayout->setMargin( 11 ); - aLayout->setSpacing( 6 ); - - // Slider and time stamps - myFirstTimeStamp = new QLabel( aWidget ); - myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - aLayout->addWidget( myFirstTimeStamp, 0, 0, Qt::AlignHCenter ); - - mySlider = new QSlider( aWidget ); - mySlider->setMinimum( 0 ); - mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - mySlider->setOrientation( Qt::Horizontal ); - mySlider->setTracking( false ); - mySlider->setFocusPolicy(Qt::StrongFocus); - aLayout->addWidget( mySlider, 0, 1, 1, 8 ); - - myLastTimeStamp = new QLabel( aWidget ); - myLastTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - aLayout->addWidget( myLastTimeStamp, 0, 9, Qt::AlignHCenter ); - - myTimeStampsNumber = new QLabel( aWidget ); - myTimeStampsNumber->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - aLayout->addWidget( myTimeStampsNumber, 0, 10, Qt::AlignHCenter ); - - QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget ); - aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - aLayout->addWidget( aCacheMemoryLabel, 0, 11 ); - - myCacheMemory = new QLabel( aWidget ); - myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - QFontMetrics fm( myCacheMemory->font() ); - myCacheMemory->setFixedWidth( fm.width( "9.99E+99 Mb" ) ); - - aLayout->addWidget( myCacheMemory, 0, 12 ); - - // Buttons -#ifdef ENABLE_AVI_AND_MORE_BUTTONS - myMoreButton = new QToolButton( aWidget ); - myMoreButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - myMoreButton->setEnabled( false ); - myMoreButton->setCheckble( true ); - myMoreButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_MORE" ) ) ); - QToolTip::add( myMoreButton, tr( "MORE" ) ); - aLayout->addWidget( myMoreButton, 1, 0 ); - - myAVIButton = new QToolButton( aWidget ); - myAVIButton->setEnabled( false ); - myAVIButton->setCheckble( true ); - myAVIButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_AVI" ) ) ); - QToolTip::add( myAVIButton, tr( "AVI" ) ); - aLayout->addWidget( myAVIButton, 1, 1 ); -#endif - - aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 ); - - myFirstButton = new QToolButton( aWidget ); - myFirstButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) ); - aLayout->addWidget( myFirstButton, 1, 3 ); - - myPreviousButton = new QToolButton( aWidget ); - myPreviousButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) ); - aLayout->addWidget( myPreviousButton, 1, 4 ); - - myPlayButton = new QToolButton( aWidget ); - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) ); - myPlayButton->setCheckable( true ); - aLayout->addWidget( myPlayButton, 1, 5 ); - - myNextButton = new QToolButton( aWidget ); - myNextButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) ); - aLayout->addWidget( myNextButton, 1, 6 ); - - myLastButton = new QToolButton( aWidget ); - myLastButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) ); - aLayout->addWidget( myLastButton, 1, 7 ); - - aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 8 ); - - myTimeStampStrings = new QComboBox( aWidget ); - myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - myTimeStampStrings->setFocusPolicy(Qt::StrongFocus); - aLayout->addWidget( myTimeStampStrings, 1, 9 ); - - myTimeStampIndices = new QComboBox( aWidget ); - myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - myTimeStampIndices->setFocusPolicy(Qt::StrongFocus); - aLayout->addWidget( myTimeStampIndices, 1, 10 ); - - // Speed - QLabel* aSpeedLabel = new QLabel( tr( "SPEED" ), aWidget ); - aSpeedLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - aLayout->addWidget( aSpeedLabel, 1, 11 ); - - mySpeedBox = new QSpinBox( aWidget ); - mySpeedBox->setMinimum( 1 ); - mySpeedBox->setMaximum( 100 ); - mySpeedBox->setSingleStep( 1 ); - mySpeedBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); - mySpeedBox->setFocusPolicy(Qt::StrongFocus); - mySpeedBox->setValue( 50 ); - aLayout->addWidget( mySpeedBox, 1, 12 ); + //---------------------------------------------------------------------------- + QVBoxLayout* aVBoxLayout = new QVBoxLayout( this ); + + QTabWidget* aTabWidget = new QTabWidget( this ); + aTabWidget->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); + + aVBoxLayout->addWidget( aTabWidget ); + + { + QWidget* aParent = new QWidget(); + { + QGridLayout* aGridLayout = new QGridLayout( aParent ); + { + myFirstTimeStamp = new QLabel( aParent ); + myFirstTimeStamp->setAlignment( Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter ); + myFirstTimeStamp->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + aGridLayout->addWidget( myFirstTimeStamp, 0, 0, 1, 1 ); + + mySlider = new QSlider( aParent ); + mySlider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + mySlider->setFocusPolicy( Qt::StrongFocus ); + mySlider->setOrientation( Qt::Horizontal ); + mySlider->setTracking( false ); + mySlider->setMinimum( 0 ); + aGridLayout->addWidget( mySlider, 0, 1, 1, 3 ); + + myLastTimeStamp = new QLabel( aParent ); + aGridLayout->addWidget( myLastTimeStamp, 0, 4, 1, 1 ); + } + { + myFirstButton = new QToolButton( aParent ); + myFirstButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) ); + myFirstButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + aGridLayout->addWidget( myFirstButton, 1, 0, 1, 1 ); + + myPreviousButton = new QToolButton( aParent ); + myPreviousButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) ); + myPreviousButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + aGridLayout->addWidget( myPreviousButton, 1, 1, 1, 1 ); + + myPlayButton = new QToolButton( aParent ); + myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) ); + myPlayButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + myPlayButton->setCheckable( true ); + aGridLayout->addWidget( myPlayButton, 1, 2, 1, 1 ); + + myNextButton = new QToolButton( aParent ); + myNextButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) ); + myNextButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + aGridLayout->addWidget( myNextButton, 1, 3, 1, 1 ); + + myLastButton = new QToolButton( aParent ); + myLastButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) ); + myLastButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + aGridLayout->addWidget( myLastButton, 1, 4, 1, 1 ); + } + { + myTimeStampIndexes = new QComboBox( aParent ); + myTimeStampIndexes->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + myTimeStampIndexes->setFocusPolicy( Qt::StrongFocus ); + aGridLayout->addWidget( myTimeStampIndexes, 2, 0, 1, 2 ); + + myIsCycled = new QToolButton( aParent ); + myIsCycled->setText( tr( "IS_CYCLED" ) ); + myIsCycled->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + myIsCycled->setLayoutDirection( Qt::LeftToRight ); + myIsCycled->setCheckable( true ); + //myIsCycled->setEnabled( false ); + aGridLayout->addWidget( myIsCycled, 2, 2, 1, 1 ); + + myTimeStampStrings = new QComboBox( aParent ); + myTimeStampStrings->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + myTimeStampStrings->setFocusPolicy( Qt::StrongFocus ); + aGridLayout->addWidget( myTimeStampStrings, 2, 3, 1, 2 ); + } + } + + aTabWidget->addTab( aParent, tr( "NAVIGATION_TAB" ) ); + myPlayTab = aParent; + } + + { + QWidget* aParent = new QWidget(); + { + QVBoxLayout* aVBoxLayout = new QVBoxLayout( aParent ); + { + QHBoxLayout* aHBoxLayout = new QHBoxLayout(); + + myMinimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aParent ); + aHBoxLayout->addWidget( myMinimalMemoryButton ); + + QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + aHBoxLayout->addItem( aSpacerItem ); + + myLimitedMemoryButton = new QRadioButton( tr( "LIMITED_MEMORY" ), aParent ); + myLimitedMemoryButton->setChecked( true ); + aHBoxLayout->addWidget( myLimitedMemoryButton ); + + myLimitedMemory = new QtxDoubleSpinBox( aParent ); + myLimitedMemory->setMaximum( 10000 ); + myLimitedMemory->setValue( 512 ); + aHBoxLayout->addWidget( myLimitedMemory ); + + QLabel* aMemoryDimensionLabel = new QLabel( aParent ); + aMemoryDimensionLabel->setText( tr( "MEMORY_UNITS" ) ); + aHBoxLayout->addWidget( aMemoryDimensionLabel ); + + aVBoxLayout->addLayout( aHBoxLayout ); + } + { + QHBoxLayout* aHBoxLayout = new QHBoxLayout(); + + QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aParent ); + aUsedMemoryLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + aHBoxLayout->addWidget( aUsedMemoryLabel ); + + myUsedMemory = new QLineEdit( aParent ); + myUsedMemory->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); + //myUsedMemory->setEnabled( false ); + aHBoxLayout->addWidget( myUsedMemory ); + + QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + aHBoxLayout->addItem( aSpacerItem ); + + QLabel* aFreeMemoryLabel = new QLabel( tr( "AVAILABLE_MEMORY" ), aParent ); + aHBoxLayout->addWidget( aFreeMemoryLabel ); + + myFreeMemory = new QLineEdit( aParent ); + myFreeMemory->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); + //myFreeMemory->setEnabled( false ); + aHBoxLayout->addWidget( myFreeMemory ); + + aVBoxLayout->addLayout( aHBoxLayout ); + } + { + QHBoxLayout* aHBoxLayout = new QHBoxLayout(); + + QLabel* aLabel = new QLabel( tr( "SPEED" ), aParent ); + aLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); + aHBoxLayout->addWidget( aLabel ); + + mySpeedSlider = new QSlider( aParent ); + mySpeedSlider->setMinimum( 1 ); + mySpeedSlider->setMaximum( 100 ); + mySpeedSlider->setValue( mySpeedSlider->maximum() / 2 ); + mySpeedSlider->setPageStep( mySpeedSlider->maximum() / 5 ); + mySpeedSlider->setTickInterval( mySpeedSlider->pageStep() ); + mySpeedSlider->setOrientation( Qt::Horizontal ); + mySpeedSlider->setTickPosition( QSlider::TicksBelow ); + aHBoxLayout->addWidget( mySpeedSlider ); + + aVBoxLayout->addLayout( aHBoxLayout ); + } + + aTabWidget->addTab( aParent, tr( "PROPERTIES_TAB" ) ); + } + } + + { + QSpacerItem* aSpacerItem = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + aVBoxLayout->addItem( aSpacerItem ); + } + + + //---------------------------------------------------------------------------- + myPlayPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ); + myPausePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ); myTimer = new QTimer( this ); // Common + connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) ); + + connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) ); + connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionChanged() ) ); connect( myTimeStampStrings, SIGNAL( activated( int ) ), SLOT( onTimeStampActivated( int ) ) ); - connect( myTimeStampIndices, SIGNAL( activated( int ) ), SLOT( onTimeStampActivated( int ) ) ); + connect( myTimeStampIndexes, SIGNAL( activated( int ) ), SLOT( onTimeStampActivated( int ) ) ); connect( myFirstButton, SIGNAL( clicked() ), SLOT( onFirst() ) ); connect( myPreviousButton, SIGNAL( clicked() ), SLOT( onPrevious() ) ); @@ -213,22 +277,85 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, connect( mySlider, SIGNAL( valueChanged( int ) ), SLOT( onValueChanged( int ) ) ); - connect( mySpeedBox, SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) ); + connect( mySpeedSlider, SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) ); connect( myTimer, SIGNAL( timeout() ), SLOT( onTimeout() ) ); + //---------------------------------------------------------------------------- + connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), this, SLOT( onMemoryModeChanged( bool ) ) ); + connect( myLimitedMemory, SIGNAL( valueChanged( double ) ), this, SLOT( onMemorySizeChanged( double ) ) ); + + //---------------------------------------------------------------------------- enableControls( false ); - myMainWindow->addToolBar( Qt::BottomToolBarArea, this ); + QtxDockWidget* aQtxDockWidget = new QtxDockWidget( true, theParent ); + theParent->addDockWidget( Qt::BottomDockWidgetArea , aQtxDockWidget ); + aQtxDockWidget->setObjectName( objectName() ); + aQtxDockWidget->setWidget( this ); + + myToggleViewAction = aQtxDockWidget->toggleViewAction(); + myToggleViewAction->setIcon( QIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PANEL" ) ) ) ); + myToggleViewAction->setToolTip( tr( "MEN_SLIDER_PANE" ) ); + myToggleViewAction->setText( tr( "MEN_SLIDER_PANE" ) ); + myToggleViewAction->setCheckable( true ); + aQtxDockWidget->setVisible( false ); + + connect( myToggleViewAction, SIGNAL( toggled( bool ) ), this, SLOT( onToggleView( bool ) ) ); } -/*! - Destructor -*/ + +//---------------------------------------------------------------------------- VisuGUI_Slider::~VisuGUI_Slider() { } + +//---------------------------------------------------------------------------- +QAction* VisuGUI_Slider::toggleViewAction() +{ + return myToggleViewAction; +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Slider::onModuleDeactivated() +{ + setHidden( true ); +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Slider::onModuleActivated() +{ + setHidden( false ); +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Slider::onMemoryModeChanged( bool ) +{ + using namespace VISU; + SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( myModule ) ) ); + VISU::ColoredPrs3dCache_var aCache = GetVisuGen( myModule )->GetColoredPrs3dCache( aStudy ); + + if ( myLimitedMemoryButton->isChecked() ) { + aCache->SetMemoryMode( VISU::ColoredPrs3dCache::LIMITED ); + aCache->SetLimitedMemory( myLimitedMemory->value() ); + } else + aCache->SetMemoryMode( VISU::ColoredPrs3dCache::MINIMAL ); + + myLimitedMemory->setEnabled( myLimitedMemoryButton->isChecked() ); +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Slider::onMemorySizeChanged( double ) +{ + onMemoryModeChanged( myLimitedMemoryButton->isChecked() ); +} + + +//---------------------------------------------------------------------------- bool VisuGUI_Slider::checkHolderList() { THolderList aHolderList; @@ -243,16 +370,19 @@ bool VisuGUI_Slider::checkHolderList() return myHolderList.empty(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::enableControls( bool on ) { - widgetForAction( myWidgetAction )->setEnabled( on ); + myPlayTab->setEnabled( on ); + if( on ) { if( checkHolderList() ) return; myTimeStampStrings->clear(); - myTimeStampIndices->clear(); + myTimeStampIndexes->clear(); VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); @@ -264,7 +394,6 @@ void VisuGUI_Slider::enableControls( bool on ) myFirstTimeStamp->setText( aTimeStampsRange[0].myTime.in() ); myLastTimeStamp->setText( aTimeStampsRange[aLength-1].myTime.in() ); - myTimeStampsNumber->setText( QString("(") + QString::number( aLength ) + ")" ); int aPageStep = aLength / 10; aPageStep = std::max(aPageStep, 1); @@ -278,7 +407,7 @@ void VisuGUI_Slider::enableControls( bool on ) QString aTime = anInfo.myTime.in(); myTimeStampStrings->addItem( aTime ); - myTimeStampIndices->addItem( QString::number( aNumber ) ); + myTimeStampIndexes->addItem( QString::number( aNumber ) ); if( aNumber == aTimeStampNumber ) a_current_index = an_index; @@ -287,18 +416,31 @@ void VisuGUI_Slider::enableControls( bool on ) myTimeStampStrings->setFont(myTimeStampStrings->font()); myTimeStampStrings->updateGeometry(); - myTimeStampIndices->setFont(myTimeStampStrings->font()); - myTimeStampIndices->updateGeometry(); + myTimeStampIndexes->setFont(myTimeStampStrings->font()); + myTimeStampIndexes->updateGeometry(); if( a_current_index > mySlider->maximum() ) mySlider->setMaximum( aLength-1 ); myTimeStampStrings->setCurrentIndex( a_current_index ); - myTimeStampIndices->setCurrentIndex( a_current_index ); + myTimeStampIndexes->setCurrentIndex( a_current_index ); mySlider->setValue( a_current_index ); if( a_current_index <= mySlider->maximum() ) mySlider->setMaximum( aLength-1 ); + + using namespace VISU; + SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( myModule ) ) ); + VISU::ColoredPrs3dCache_var aCache = GetVisuGen( myModule )->GetColoredPrs3dCache( aStudy ); + + long aMb = 1024 * 1024; + double aLimitedMemory = aCache->GetLimitedMemory(); + myLimitedMemory->setValue( aLimitedMemory ); + + double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb; + double anUsedMemory = aCache->GetMemorySize(); + double aLimitedMemoryMax = max( anUsedMemory + aFreeMemory, aLimitedMemory ); + myLimitedMemory->setMaximum( aLimitedMemoryMax ); } else { @@ -307,18 +449,31 @@ void VisuGUI_Slider::enableControls( bool on ) } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::updateMemoryState() { if( checkHolderList() ) return; VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); - VISU::ColoredPrs3dCache_var aCache = aHolder->GetCache(); + CORBA::Float aCacheMemory = aCache->GetMemorySize(); - myCacheMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" ); + myUsedMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" ); + myUsedMemory->setFont( myUsedMemory->font() ); + myUsedMemory->updateGeometry(); + + + long aMb = 1024 * 1024; + double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb; + myFreeMemory->setText( QString::number( double( aFreeMemory ), 'E', 2 ) + " Mb" ); + myFreeMemory->setFont( myFreeMemory->font() ); + myFreeMemory->updateGeometry(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onSelectionChanged() { //cout << "VisuGUI_Slider::onSelectionChanged()" << endl; @@ -354,22 +509,31 @@ void VisuGUI_Slider::onSelectionChanged() } } - enableControls( !checkHolderList() ); + VISU::View_var aView = myViewManager->GetCurrentView(); + + enableControls( !checkHolderList() && !CORBA::is_nil( aView.in() ) ); + updateMemoryState(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onTimeStampActivated( int value ) { mySlider->setValue( value ); onValueChanged( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onFirst() { int value = mySlider->minimum(); mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onPrevious() { int value = mySlider->value() - 1; @@ -377,23 +541,35 @@ void VisuGUI_Slider::onPrevious() mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onPlay( bool on ) { - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); if( on ) { - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ) ); + myPlayButton->setIcon( myPausePixmap ); - int delay = int(5000.0 / double(mySpeedBox->value())); + int delay = int( 50.0 * mySpeedSlider->maximum() / mySpeedSlider->value() ); myTimer->start( delay ); } else { myTimer->stop(); - myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) ); + myPlayButton->setIcon( myPlayPixmap ); + } +} + + +//---------------------------------------------------------------------------- +void VisuGUI_Slider::onToggleView( bool on ) +{ + if ( !on ) { + onPlay( on ); } } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onNext() { int value = mySlider->value() + 1; @@ -401,34 +577,46 @@ void VisuGUI_Slider::onNext() mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onLast() { int value = mySlider->maximum(); mySlider->setValue( value ); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onValueChanged( int value ) { - if( checkHolderList() ){ + if ( checkHolderList() ) { enableControls( false ); return; } myTimeStampStrings->setCurrentIndex( value ); - myTimeStampIndices->setCurrentIndex( value ); + myTimeStampIndexes->setCurrentIndex( value ); VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front(); VISU::ColoredPrs3dHolder::TimeStampsRange_var aTimeStampsRange = aHolder->GetTimeStampsRange(); CORBA::Long aLength = aTimeStampsRange->length(); - if(value < 0 || aLength <= value) + if ( value < 0 || aLength <= value ) return; VISU::ColoredPrs3dHolder::BasicInput_var anInput = aHolder->GetBasicInput(); CORBA::Long aTimeStampNumber = anInput->myTimeStampNumber; CORBA::Long aNumber = aTimeStampsRange[ value ].myNumber; - if(aNumber == aTimeStampNumber) + if ( aNumber == aTimeStampNumber ) + return; + + VISU::View_var aView = myViewManager->GetCurrentView(); + if ( CORBA::is_nil( aView.in() ) ) { + enableControls( false ); return; + } + + VISU::View3D_var aView3D = VISU::View3D::_narrow( aView ); THolderList::const_iterator anIter = myHolderList.begin(); THolderList::const_iterator anIterEnd = myHolderList.end(); @@ -444,27 +632,40 @@ void VisuGUI_Slider::onValueChanged( int value ) QApplication::setOverrideCursor(Qt::WaitCursor); - aHolder->Apply( aPrs3d, anInput, myView3D ); + aHolder->Apply( aPrs3d, anInput, aView3D ); QApplication::restoreOverrideCursor(); } + aView3D->Destroy(); + updateMemoryState(); } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onSpeedChanged( int value ) { if(myPlayButton->isChecked()){ - int delay = int(5000.0 / double(mySpeedBox->value())); + int delay = int( 50.0 * mySpeedSlider->maximum() / mySpeedSlider->value() ); myTimer->start( delay ); } } + +//---------------------------------------------------------------------------- void VisuGUI_Slider::onTimeout() { int value = mySlider->value(); - if( value < mySlider->maximum() ) + if ( value < mySlider->maximum() ) { onNext(); - else - myPlayButton->setChecked( false ); + } else { + if ( myIsCycled->isChecked() ) + onFirst(); + else + myPlayButton->setChecked( false ); + } } + + +//---------------------------------------------------------------------------- diff --git a/src/VISUGUI/VisuGUI_Slider.h b/src/VISUGUI/VisuGUI_Slider.h index 1347b650..9bf08483 100644 --- a/src/VISUGUI/VisuGUI_Slider.h +++ b/src/VISUGUI/VisuGUI_Slider.h @@ -28,7 +28,9 @@ #ifndef VisuGUI_Slider_HeaderFile #define VisuGUI_Slider_HeaderFile -#include "QtxToolBar.h" +#include +#include + #include #include "SALOMEconfig.h" @@ -45,24 +47,28 @@ class QLineEdit; class QToolButton; class QSlider; class QSpinBox; +class QCheckBox; +class QRadioButton; +class QMainWindow; class QTimer; class QAction; -class VVTK_ViewWindow; -class VVTK_MainWindow; +class QtxDoubleSpinBox; class LightApp_SelectionMgr; +class VisuGUI; -class VisuGUI_Module; - -class VisuGUI_Slider : public QtxToolBar +class VisuGUI_Slider : public QWidget { - Q_OBJECT + Q_OBJECT; public: - VisuGUI_Slider( VisuGUI_Module* theModule, - VVTK_ViewWindow* theViewWindow, + VisuGUI_Slider( VisuGUI* theModule, + QMainWindow* theParent, LightApp_SelectionMgr* theSelectionMgr ); + virtual ~VisuGUI_Slider(); + + QAction* toggleViewAction(); public slots: virtual void onSelectionChanged(); @@ -81,29 +87,32 @@ public slots: virtual void onTimeout(); + virtual void onToggleView( bool ); + + void onMemoryModeChanged( bool ); + void onMemorySizeChanged( double ); + +protected slots: + void onModuleDeactivated(); + void onModuleActivated(); + protected: virtual void enableControls( bool ); virtual void updateMemoryState(); virtual bool checkHolderList(); private: - VisuGUI_Module* myModule; - VVTK_MainWindow* myMainWindow; LightApp_SelectionMgr* mySelectionMgr; - VISU::View3D_var myView3D; + VISU::ViewManager_var myViewManager; + VisuGUI* myModule; QSlider* mySlider; QLabel* myFirstTimeStamp; QLabel* myLastTimeStamp; - QLabel* myTimeStampsNumber; - QLabel* myCacheMemory; - -#ifdef ENABLE_AVI_AND_MORE_BUTTONS - QToolButton* myMoreButton; - QToolButton* myAVIButton; -#endif + QWidget* myPlayTab; + QToolButton* myIsCycled; QToolButton* myFirstButton; QToolButton* myPreviousButton; QToolButton* myPlayButton; @@ -111,16 +120,24 @@ private: QToolButton* myLastButton; QComboBox* myTimeStampStrings; - QComboBox* myTimeStampIndices; + QComboBox* myTimeStampIndexes; + + QSlider* mySpeedSlider; - QSpinBox* mySpeedBox; + QRadioButton* myMinimalMemoryButton; + QRadioButton* myLimitedMemoryButton; + QtxDoubleSpinBox* myLimitedMemory; - QTimer* myTimer; + QLineEdit* myUsedMemory; + QLineEdit* myFreeMemory; typedef std::vector THolderList; - THolderList myHolderList; + THolderList myHolderList; - QAction* myWidgetAction; + QTimer* myTimer; + QPixmap myPlayPixmap; + QPixmap myPausePixmap; + QAction* myToggleViewAction; }; #endif diff --git a/src/VISUGUI/VisuGUI_Table3dDlg.cxx b/src/VISUGUI/VisuGUI_Table3dDlg.cxx deleted file mode 100644 index 72d1ca18..00000000 --- a/src/VISUGUI/VisuGUI_Table3dDlg.cxx +++ /dev/null @@ -1,829 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUI_Table3dDlg.cxx -// Author : Laurent CORNABE & Hubert ROLLAND -// - -#include "VisuGUI_Table3dDlg.h" - -#include "VisuGUI.h" -#include "VisuGUI_Tools.h" -#include "VisuGUI_ViewTools.h" -#include "VisuGUI_InputPane.h" - -#include "VISU_ColoredPrs3dFactory.hh" -#include "VISU_ViewManager_i.hh" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SURFACE_PRS_ID 0 -#define CONTOUR_PRS_ID 1 - -//======================================================================= -//function : VisuGUI_Table3DPane -//purpose : -//======================================================================= -VisuGUI_Table3DPane::VisuGUI_Table3DPane( QWidget* parent ) - : QWidget( parent ), - myViewWindow( VISU::GetActiveViewWindow() ), - myPrs( 0 ), - myInitFromPrs( false ) -{ - QGridLayout* topLayout = new QGridLayout( this ); - topLayout->setMargin( 11 ); - topLayout->setSpacing( 6 ); - - // scale - QLabel* scaleLabel = new QLabel( tr( "SCALE" ), this ); - ScaleSpn = new QtxDoubleSpinBox( -1.e6, 1.e6, 0.1, this ); - // Presentation type - GBPrsTypeBox = new QGroupBox( tr( "PRESENTATION_TYPE" ), this ); - GBPrsType = new QButtonGroup( GBPrsTypeBox ); - QRadioButton* rb1 = new QRadioButton( tr( "SURFACE" ), GBPrsTypeBox ); - QRadioButton* rb2 = new QRadioButton( tr( "CONTOUR" ), GBPrsTypeBox ); - GBPrsType->addButton( rb1, SURFACE_PRS_ID ); - GBPrsType->addButton( rb2, CONTOUR_PRS_ID ); - QHBoxLayout* GBPrsTypeBoxLayout = new QHBoxLayout( GBPrsTypeBox ); - GBPrsTypeBoxLayout->setMargin( 11 ); - GBPrsTypeBoxLayout->setSpacing( 6 ); - GBPrsTypeBoxLayout->addWidget( rb1 ); - GBPrsTypeBoxLayout->addWidget( rb2 ); - - // nb Contours - QLabel* nbContLabel = new QLabel( tr( "NUMBER_CONTOURS" ), this ); - NbContoursSpn = new QSpinBox( this ); - NbContoursSpn->setMinimum( 1 ); - NbContoursSpn->setMaximum( 999 ); - NbContoursSpn->setSingleStep( 1 ); - - topLayout->addWidget( scaleLabel, 0, 0 ); - topLayout->addWidget( ScaleSpn, 0, 1 ); - topLayout->addWidget( GBPrsTypeBox, 1, 0, 1, 2 ); - topLayout->addWidget( nbContLabel, 2, 0 ); - topLayout->addWidget( NbContoursSpn, 2, 1 ); - topLayout->setRowStretch( 3, 5 ); - - // signals and slots connections - - connect( GBPrsType, SIGNAL( buttonClicked( int ) ), this, SLOT( onPrsType( int ) ) ); -} - -//======================================================================= -//function : destructor -//purpose : -//======================================================================= -VisuGUI_Table3DPane::~VisuGUI_Table3DPane() -{ -} - -//======================================================================= -//function : onPrsType -//purpose : -//======================================================================= -void VisuGUI_Table3DPane::onPrsType( int id ) -{ - NbContoursSpn->setEnabled( id == CONTOUR_PRS_ID ); -} - -//======================================================================= -//function : storeToPrsObject -//purpose : -//======================================================================= -int VisuGUI_Table3DPane::storeToPrsObject( VISU::PointMap3d_i* thePrs ) -{ - // scale - thePrs->SetScaleFactor( ScaleSpn->value() ); - - // prs type - thePrs->SetContourPrs( GBPrsType->checkedId() == CONTOUR_PRS_ID ); - - // nb contours - thePrs->SetNbOfContours( NbContoursSpn->value() ); - - return 1; -} - -//======================================================================= -//function : GetPrs -//purpose : -//======================================================================= -VISU::PointMap3d_i* VisuGUI_Table3DPane::GetPrs() -{ - return myPrs; -} - -//======================================================================= -//function : initFromPrsObject -//purpose : -//======================================================================= -void VisuGUI_Table3DPane::initFromPrsObject( VISU::PointMap3d_i* thePrs ) -{ - myInitFromPrs = true; - myPrs = thePrs; - - // scale - double aScale = thePrs->GetScaleFactor(); - if (aScale<0) - aScale = 0; - ScaleSpn->setValue( aScale ); - - // prs type - int id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID; - GBPrsType->button( id )->setChecked( true ); - onPrsType( id ); - - // nb contours - NbContoursSpn->setValue( thePrs->GetNbOfContours() ); -} - -//======================================================================= -//function : Table Scalar Bar -//purpose : -//======================================================================= - -VisuGUI_TableScalarBarPane::VisuGUI_TableScalarBarPane( QWidget* parent ) - : QWidget( parent ), - myBarPrs( 0 ) -{ - QGridLayout* topLayout = new QGridLayout( this ); - topLayout->setSpacing( 6 ); - topLayout->setMargin( 11 ); - - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - QString propertyName; - propertyName = QString( "scalar_bar_vertical_" ); - myVerX = aResourceMgr->doubleValue( "VISU", propertyName + "x", 0. ); - myVerY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. ); - myVerW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. ); - myVerH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. ); - myVerTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 ); - myVerTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 ); - myVerLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 ); - myVerLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 ); - myVerBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 ); - myVerBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 ); - - propertyName = QString( "scalar_bar_horizontal_" ); - myHorX = aResourceMgr->doubleValue( "VISU", propertyName + "x", 0. ); - myHorY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. ); - myHorW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. ); - myHorH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. ); - myHorTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 ); - myHorTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 ); - myHorLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 ); - myHorLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 ); - myHorBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 ); - myHorBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 ); - - // Range ============================================================ - RangeGroup = new QGroupBox( tr( "SCALAR_RANGE_GRP" ), this ); - QButtonGroup* RangeRB = new QButtonGroup( RangeGroup ); - QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup ); - RangeGroupLayout->setSpacing( 6 ); - RangeGroupLayout->setMargin( 11 ); - - CBLog = new QCheckBox( tr( "LOGARITHMIC_SCALING" ), RangeGroup ); - - RBFrange = new QRadioButton( tr( "FIELD_RANGE_BTN" ), RangeGroup ); - RBIrange = new QRadioButton( tr( "IMPOSED_RANGE_BTN" ), RangeGroup ); - RangeRB->addButton( RBFrange, 0 ); - RangeRB->addButton( RBIrange, 1 ); - RBFrange->setChecked( true ); - - MinEdit = new QLineEdit( RangeGroup ); - MinEdit->setMinimumWidth( 70 ); - MinEdit->setValidator( new QDoubleValidator( this ) ); - MinEdit->setText( "0.0" ); - QLabel* MinLabel = new QLabel( tr( "LBL_MIN" ), RangeGroup ); - MinLabel->setBuddy( MinEdit ); - - MaxEdit = new QLineEdit( RangeGroup ); - MaxEdit->setMinimumWidth( 70 ); - MaxEdit->setValidator( new QDoubleValidator( this ) ); - MaxEdit->setText( "0.0" ); - QLabel* MaxLabel = new QLabel( tr( "LBL_MAX" ), RangeGroup ); - MaxLabel->setBuddy( MaxEdit ); - - RangeGroupLayout->addWidget( CBLog, 1, 0, 1, 4 ); - RangeGroupLayout->addWidget( RBFrange, 2, 0, 1, 2 ); - RangeGroupLayout->addWidget( RBIrange, 2, 2, 1, 2 ); - RangeGroupLayout->addWidget( MinLabel, 3, 0 ); - RangeGroupLayout->addWidget( MinEdit, 3, 1 ); - RangeGroupLayout->addWidget( MaxLabel, 3, 2 ); - RangeGroupLayout->addWidget( MaxEdit, 3, 3 ); - - // Colors and Labels ======================================================== - QGroupBox* ColLabGroup = new QGroupBox( tr( "COLORS_LABELS_GRP" ), this ); - QHBoxLayout* ColLabGroupLayout = new QHBoxLayout( ColLabGroup ); - ColLabGroupLayout->setSpacing( 6 ); - ColLabGroupLayout->setMargin( 11 ); - - QLabel* ColorLabel = new QLabel( tr( "LBL_NB_COLORS" ), ColLabGroup ); - ColorSpin = new QSpinBox( ColLabGroup ); - ColorSpin->setMinimum( 2 ); - ColorSpin->setMaximum( 256 ); - ColorSpin->setSingleStep( 1 ); - ColorSpin->setMinimumWidth( 70 ); - ColorSpin->setValue( 64 ); - - QLabel* LabelLabel = new QLabel( tr( "LBL_NB_LABELS" ), ColLabGroup ); - LabelSpin = new QSpinBox( ColLabGroup ); - LabelSpin->setMinimum( 2 ); - LabelSpin->setMaximum( 65 ); - LabelSpin->setSingleStep( 1 ); - LabelSpin->setMinimumWidth( 70 ); - LabelSpin->setValue( 5 ); - - ColLabGroupLayout->addWidget( ColorLabel ); - ColLabGroupLayout->addWidget( ColorSpin ); - ColLabGroupLayout->addWidget( LabelLabel ); - ColLabGroupLayout->addWidget( LabelSpin ); - - // Orientation ========================================================== - QGroupBox* OrientGroup = new QGroupBox( tr( "ORIENTATION_GRP" ), this ); - QButtonGroup* OrientRB = new QButtonGroup( OrientGroup ); - QHBoxLayout* OrientGroupLayout = new QHBoxLayout( OrientGroup ); - OrientGroupLayout->setSpacing( 6 ); - OrientGroupLayout->setMargin( 11 ); - - RBvert = new QRadioButton( tr( "VERTICAL_BTN" ), OrientGroup ); - RBhori = new QRadioButton( tr( "HORIZONTAL_BTN" ), OrientGroup ); - OrientRB->addButton( RBvert, 0 ); - OrientRB->addButton( RBhori, 1 ); - RBvert->setChecked( true ); - OrientGroupLayout->addWidget( RBvert ); - OrientGroupLayout->addWidget( RBhori ); - - // Origin =============================================================== - QGroupBox* OriginGroup = new QGroupBox( tr( "ORIGIN_GRP" ), this ); - QHBoxLayout* OriginGroupLayout = new QHBoxLayout( OriginGroup ); - OriginGroupLayout->setSpacing( 6 ); - OriginGroupLayout->setMargin( 11 ); - - QLabel* XLabel = new QLabel( tr( "LBL_X" ), OriginGroup ); - XSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup ); - XSpin->setMinimumWidth( 70 ); - XSpin->setValue( 0.01 ); - - QLabel* YLabel = new QLabel( tr( "LBL_Y" ), OriginGroup ); - YSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup ); - YSpin->setMinimumWidth( 70 ); - YSpin->setValue( 0.01 ); - - OriginGroupLayout->addWidget( XLabel ); - OriginGroupLayout->addWidget( XSpin ); - OriginGroupLayout->addWidget( YLabel ); - OriginGroupLayout->addWidget( YSpin ); - - // Dimensions ========================================================= - QGroupBox* DimGroup = new QGroupBox( tr( "DIMENSIONS_GRP" ), this ); - QHBoxLayout* DimGroupLayout = new QHBoxLayout( DimGroup ); - DimGroupLayout->setSpacing( 6 ); - DimGroupLayout->setMargin( 11 ); - - QLabel* WidthLabel = new QLabel( tr( "LBL_WIDTH" ), DimGroup ); - WidthSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, DimGroup ); - WidthSpin->setMinimumWidth( 70 ); - WidthSpin->setValue( 0.1 ); - - QLabel* HeightLabel = new QLabel( tr( "LBL_HEIGHT" ), DimGroup ); - HeightSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, DimGroup ); - HeightSpin->setMinimumWidth( 70 ); - HeightSpin->setValue( 0.8 ); - - DimGroupLayout->addWidget( WidthLabel ); - DimGroupLayout->addWidget( WidthSpin ); - DimGroupLayout->addWidget( HeightLabel ); - DimGroupLayout->addWidget( HeightSpin ); - - myTextBtn = new QPushButton( tr( "Text properties..." ), this ); - myBarBtn = new QPushButton( tr( "Bar properties..." ), this ); - - // main layout ========================================================= - - topLayout->addWidget( RangeGroup, 0, 0, 1, 2 ); - topLayout->addWidget( ColLabGroup, 1, 0, 1, 2 ); - topLayout->addWidget( OrientGroup, 2, 0, 1, 2 ); - topLayout->addWidget( OriginGroup, 3, 0, 1, 2 ); - topLayout->addWidget( DimGroup, 4, 0, 1, 2 ); - topLayout->addWidget( myTextBtn, 5, 0 ); - topLayout->addWidget( myBarBtn, 5, 1 ); - - // init ================================================================ - - myTextDlg = new VisuGUI_TextPrefDlg( this ); - myTextDlg->setTitleVisible( true ); - myBarDlg = new VisuGUI_BarPrefDlg( this ); - - if ( RBvert->isChecked() ) { - myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH ); - } else { - myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH ); - } - - myBarDlg->setLabelsFormat( aResourceMgr->stringValue( "VISU", propertyName + "label_format", "%-#6.3g" ) ); - myBarDlg->setUnitsVisible( aResourceMgr->booleanValue( "VISU", propertyName + "display_units", true ) ); - - // signals and slots connections =========================================== - connect( RangeRB, SIGNAL( buttonClicked( int ) ), this, SLOT( changeRange( int ) ) ); - connect( OrientRB, SIGNAL( buttonClicked( int ) ), this, SLOT( changeDefaults( int ) ) ); - connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) ); - connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) ); - connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) ); - connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) ); - changeDefaults( 0 ); - myIsStoreTextProp = true; - myBusy = false; -} - -//---------------------------------------------------------------------------- - -void VisuGUI_TableScalarBarPane::onBarPref() -{ - if ( RBvert->isChecked() ) - myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH ); - else - myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH ); - if ( myBarDlg->exec() ) { - if ( RBvert->isChecked() ) - myBarDlg->getRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH ); - else - myBarDlg->getRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH ); - } -} - -//---------------------------------------------------------------------------- -/** - * Initialise dialog box from presentation object - */ -void VisuGUI_TableScalarBarPane::initFromPrsObject( VISU::PointMap3d_i* thePrs ) -{ - myBarPrs = dynamic_cast( thePrs ); - - if ( !myBarPrs ) - return; - - switch ( myBarPrs->GetScaling() ) { - case VISU::LOGARITHMIC: - CBLog->setChecked( true ); - break; - default: - CBLog->setChecked( false ); - } - - setRange( myBarPrs->GetMin(), myBarPrs->GetMax(), myBarPrs->IsRangeFixed() ); - - setScalarBarData( myBarPrs->GetNbColors(), myBarPrs->GetLabels() ); - - // "Title" - CORBA::String_var aTitle = myBarPrs->GetTitle(); - myTextDlg->setTitleText( aTitle.in() ); - myTitle = aTitle.in(); - - vtkFloatingPointType R, G, B; - myBarPrs->GetTitleColor( R, G, B ); - - setPosAndSize( myBarPrs->GetPosX(), - myBarPrs->GetPosY(), - myBarPrs->GetWidth(), - myBarPrs->GetHeight(), - myBarPrs->GetBarOrientation() ); - - myVerTW = myBarPrs->GetTitleWidth(); - myVerTH = myBarPrs->GetTitleHeight(); - myVerLW = myBarPrs->GetLabelWidth(); - myVerLH = myBarPrs->GetLabelHeight(); - myVerBW = myBarPrs->GetBarWidth(); - myVerBH = myBarPrs->GetBarHeight(); - myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH ); - - myBarDlg->setLabelsFormat( myBarPrs->GetLabelsFormat() ); - myBarDlg->setUnitsVisible( myBarPrs->IsUnitsVisible() ); - - myTextDlg->myTitleFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ), - myBarPrs->GetTitFontType(), - myBarPrs->IsBoldTitle(), - myBarPrs->IsItalicTitle(), - myBarPrs->IsShadowTitle() ); - - // "Labels" - myBarPrs->GetLabelColor( R, G, B ); - - myTextDlg->myLabelFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ), - myBarPrs->GetLblFontType(), - myBarPrs->IsBoldLabel(), - myBarPrs->IsItalicLabel(), - myBarPrs->IsShadowLabel() ); -} - -//---------------------------------------------------------------------------- -/** - * Store values to presentation object - */ -int VisuGUI_TableScalarBarPane::storeToPrsObject( VISU::PointMap3d_i* thePrs ) { - if( !myBarPrs ) - return 0; - - myBarPrs->SetPosition( XSpin->value(), YSpin->value() ); - myBarPrs->SetSize( WidthSpin->value(), HeightSpin->value() ); - - myBarPrs->SetRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH ); - - myBarPrs->SetLabelsFormat( myBarDlg->getLabelsFormat().toLatin1().constData() ); - myBarPrs->SetUnitsVisible( myBarDlg->isUnitsVisible() ); - - myBarPrs->SetBarOrientation( ( RBvert->isChecked() )? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL ); - if ( CBLog->isChecked() ) - myBarPrs->SetScaling( VISU::LOGARITHMIC ); - else - myBarPrs->SetScaling( VISU::LINEAR ); - - if ( RBFrange->isChecked() ) { - myBarPrs->SetSourceRange(); - } else { - myBarPrs->SetRange( MinEdit->text().toDouble(), MaxEdit->text().toDouble() ); - } - myBarPrs->SetNbColors( ColorSpin->value() ); - myBarPrs->SetLabels( LabelSpin->value() ); - - if ( myIsStoreTextProp ) { - // "Title" - myBarPrs->SetTitle( myTextDlg->getTitleText().toLatin1().constData() ); - - QColor aTitColor( 255, 255, 255 ); - int aTitleFontFamily = VTK_ARIAL; - bool isTitleBold = false; - bool isTitleItalic = false; - bool isTitleShadow = false; - - myTextDlg->myTitleFont->GetData( aTitColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow ); - - myBarPrs->SetBoldTitle( isTitleBold ); - myBarPrs->SetItalicTitle( isTitleItalic ); - myBarPrs->SetShadowTitle( isTitleShadow ); - myBarPrs->SetTitFontType( aTitleFontFamily ); - myBarPrs->SetTitleColor( aTitColor.red()/255., - aTitColor.green()/255., - aTitColor.blue()/255. ); - - // "Label" - QColor aLblColor( 255, 255, 255 ); - int aLabelFontFamily = VTK_ARIAL; - bool isLabelBold = false; - bool isLabelItalic = false; - bool isLabelShadow = false; - - myTextDlg->myLabelFont->GetData( aLblColor, aLabelFontFamily, isLabelBold, isLabelItalic, isLabelShadow ); - - myBarPrs->SetBoldLabel( isLabelBold); - myBarPrs->SetItalicLabel( isLabelItalic ); - myBarPrs->SetShadowLabel( isLabelShadow ); - myBarPrs->SetLblFontType( aLabelFontFamily ); - myBarPrs->SetLabelColor( aLblColor.red()/255., - aLblColor.green()/255., - aLblColor.blue()/255. ); - // myIsStoreTextProp = false; - } - return 1; -} - -//---------------------------------------------------------------------------- -/*! - Sets default values and range mode -*/ -void VisuGUI_TableScalarBarPane::setRange( double imin, double imax, bool sbRange ) -{ - MinEdit->setText( QString::number( imin ) ); - MaxEdit->setText( QString::number( imax ) ); - - if ( sbRange ) - RBIrange->setChecked( true ); - else - RBFrange->setChecked( true ); - - changeRange( sbRange ); -} - -//---------------------------------------------------------------------------- -/*! - Called when Range mode is changed -*/ -void VisuGUI_TableScalarBarPane::changeRange( int ) -{ - if ( RBFrange->isChecked() ) { - myBarPrs->SetSourceRange(); - MinEdit->setEnabled( false ); - MaxEdit->setEnabled( false ); - } else { - myBarPrs->SetRange( myBarPrs->GetMin(), myBarPrs->GetMax() ); - myBarPrs->SetRange( MinEdit->text().toDouble(), MaxEdit->text().toDouble() ); - MinEdit->setEnabled( true ); - MaxEdit->setEnabled( true ); - } - - MinEdit->setText( QString::number( myBarPrs->GetMin() ) ); - MaxEdit->setText( QString::number( myBarPrs->GetMax() ) ); -} - -//---------------------------------------------------------------------------- -/*! - Called when X,Y position is changed -*/ -void VisuGUI_TableScalarBarPane::XYChanged( double ) -{ - QtxDoubleSpinBox* snd = (QtxDoubleSpinBox*)sender(); - if ( snd == XSpin ) { - WidthSpin->setMaximum( 1.0 - XSpin->value() ); - } - if ( snd == YSpin ) { - HeightSpin->setMaximum( 1.0 - YSpin->value() ); - } -} - -//---------------------------------------------------------------------------- -/*! - -*/ -void VisuGUI_TableScalarBarPane::changeScalarMode( int ) -{ -//do nothing -} - -//---------------------------------------------------------------------------- -/*! - Sets size and position -*/ -void VisuGUI_TableScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert ) -{ - if ( vert ) { - myVerX = x; - myVerY = y; - myVerW = w; - myVerH = h; - RBvert->setChecked( true ); - } - else { - myHorX = x; - myHorY = y; - myHorW = w; - myHorH = h; - RBhori->setChecked( true ); - } - changeDefaults( 0 ); -} - -//---------------------------------------------------------------------------- -/*! - Sets colors and labels number -*/ -void VisuGUI_TableScalarBarPane::setScalarBarData( int colors, int labels ) -{ - ColorSpin->setValue( colors ); - LabelSpin->setValue( labels ); -} - -//---------------------------------------------------------------------------- -void VisuGUI_TableScalarBarPane::onTextPref() -{ - myTextDlg->storeBeginValues(); - myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp; -} - -//---------------------------------------------------------------------------- -VisuGUI_TableScalarBarPane::~VisuGUI_TableScalarBarPane() -{ -} - -//---------------------------------------------------------------------------- -/*! - Called when orientation is changed -*/ -void VisuGUI_TableScalarBarPane::changeDefaults( int ) -{ - if ( RBvert->isChecked() ) { - XSpin->setValue( myVerX ); - YSpin->setValue( myVerY ); - WidthSpin->setValue( myVerW ); - HeightSpin->setValue( myVerH ); - } - else { - XSpin->setValue( myHorX ); - YSpin->setValue( myHorY ); - WidthSpin->setValue( myHorW ); - HeightSpin->setValue( myHorH ); - } -} - -//======================================================================= -//function : Check -//purpose : Called when button is clicked, validates data and closes dialog -//======================================================================= -bool VisuGUI_TableScalarBarPane::check() -{ - double minVal = MinEdit->text().toDouble(); - double maxVal = MaxEdit->text().toDouble(); - if ( RBIrange->isChecked() ) { - if (minVal >= maxVal) { - SUIT_MessageBox::warning( this,tr("WRN_VISU"), - tr("MSG_MINMAX_VALUES") ); - return false; - } - } - - // check if logarithmic mode is on and check imposed range to not contain negative values - if ( CBLog->isChecked() ) { - if ( minVal <= 0.0 ) { - if ( RBIrange->isChecked() ) { - SUIT_MessageBox::warning( this, - tr("WRN_VISU"), - tr("WRN_LOGARITHMIC_RANGE") ); - } else { - if ( minVal == 0) - SUIT_MessageBox::warning( this, - tr("WRN_VISU"), - tr("WRN_LOGARITHMIC_RANGE") ); - else - SUIT_MessageBox::warning( this, - tr("WRN_VISU"), - tr("WRN_LOGARITHMIC_FIELD_RANGE") ); - RBIrange->setChecked(true); - changeRange(1); - } - return false; - } - } - return true; -} - -//======================================================================= -//function : Constructor -//purpose : -//======================================================================= -VisuGUI_Table3DDlg::VisuGUI_Table3DDlg ( SalomeApp_Module* theModule ) - : QDialog ( VISU::GetDesktop( theModule ) ) -{ - setModal( false ); - setWindowTitle( tr( "Point Map 3D Definition" ) ); - setSizeGripEnabled( true ); - - QVBoxLayout* TopLayout = new QVBoxLayout( this ); - TopLayout->setSpacing( 6 ); - TopLayout->setMargin( 11 ); - - myTabBox = new QTabWidget( this ); - myIsoPane = new VisuGUI_Table3DPane( this ); - myScalarBarPane = new VisuGUI_TableScalarBarPane( this ); - - myTabBox->addTab( myIsoPane, tr( "DLG_PREF_TITLE" ) ); - myTabBox->addTab( myScalarBarPane, tr( "DLG_PROP_TITLE" ) ); - - QGroupBox* GroupButtons = new QGroupBox( this ); - QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons ); - buttonOk->setAutoDefault( true ); - buttonOk->setDefault( true ); - QPushButton* buttonApply = new QPushButton( tr( "&Apply" ), GroupButtons ); - buttonApply->setAutoDefault( true ); - QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons ); - buttonCancel->setAutoDefault( true ); - QPushButton* buttonHelp = new QPushButton( tr( "&Help" ), GroupButtons ); - buttonHelp->setAutoDefault( true ); - - GroupButtonsLayout->addWidget( buttonOk ); - GroupButtonsLayout->addWidget( buttonApply ); - GroupButtonsLayout->addSpacing( 10 ); - GroupButtonsLayout->addStretch(); - GroupButtonsLayout->addWidget( buttonCancel ); - GroupButtonsLayout->addWidget( buttonHelp ); - - TopLayout->addWidget( myTabBox ); - TopLayout->addWidget( GroupButtons ); - - // signals and slots connections - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onApply() ) ); -} - -//======================================================================= -//function : Destructor -//purpose : -//======================================================================= -VisuGUI_Table3DDlg::~VisuGUI_Table3DDlg() -{ -} - -//======================================================================= -//function : accept -//purpose : -//======================================================================= -void VisuGUI_Table3DDlg::accept() -{ - if (myScalarBarPane->check()) - QDialog::accept(); -} - -//======================================================================= -//function : onApply -//purpose : -//======================================================================= -void VisuGUI_Table3DDlg::onApply() -{ - if (myScalarBarPane->check()) { - storeToPrsObject( myPrsCopy ); - myPrsCopy->UpdateActors(); - } -} - -//======================================================================= -//function : onHelp -//purpose : -//======================================================================= -void VisuGUI_Table3DDlg::onHelp() -{ - QString aHelpFileName = "table_3d_page.html"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) { - VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); - app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); - } - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning( this, QObject::tr("WRN_WARNING"), - tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) ); - } - -} - -//======================================================================= -//function : storeToPrsObject -//purpose : -//======================================================================= -int VisuGUI_Table3DDlg::storeToPrsObject( VISU::PointMap3d_i* thePrs ) -{ - int anIsOk = myIsoPane->storeToPrsObject( thePrs ); - anIsOk &= myScalarBarPane->storeToPrsObject( thePrs ); - - return anIsOk; -} - -//======================================================================= -//function : initFromPrsObject -//purpose : -//======================================================================= -void VisuGUI_Table3DDlg::initFromPrsObject( VISU::PointMap3d_i* thePrs ) -{ - myPrsCopy = thePrs; - myIsoPane->initFromPrsObject( thePrs ); - myScalarBarPane->initFromPrsObject( thePrs ); -} diff --git a/src/VISUGUI/VisuGUI_Table3dDlg.h b/src/VISUGUI/VisuGUI_Table3dDlg.h deleted file mode 100644 index 2257b483..00000000 --- a/src/VISUGUI/VisuGUI_Table3dDlg.h +++ /dev/null @@ -1,188 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : VisuGUI_Table3dDlg.h -// Author : Laurent CORNABE & Hubert ROLLAND -// - -#ifndef VISUGUI_TABLE3D_H -#define VISUGUI_TABLE3D_H - -#include "VisuGUI_Prs3dDlg.h" - -#include -#include - -class QTabWidget; -class QButtonGroup; -class QGroupBox; -class QComboBox; -class QCheckBox; -class QLineEdit; -class QRadioButton; -class QPushButton; -class QSpinBox; -class QtxDoubleSpinBox; -class VisuGUI_TextPrefDlg; -class VisuGUI_BarPrefDlg; -class SVTK_ViewWindow; -class SalomeApp_Module; - -namespace VISU -{ - class PointMap3d_i; -}; - -class VisuGUI_Table3DPane : public QWidget -{ - Q_OBJECT - -public: - VisuGUI_Table3DPane( QWidget* ); - ~VisuGUI_Table3DPane(); - - void initFromPrsObject( VISU::PointMap3d_i* ); - int storeToPrsObject( VISU::PointMap3d_i* ); - - VISU::PointMap3d_i* GetPrs(); - -private slots: - void onPrsType( int ); - -private: - bool myInitFromPrs; - - SVTK_ViewWindow* myViewWindow; - VISU::PointMap3d_i* myPrs; - - QtxDoubleSpinBox* ScaleSpn; - QGroupBox* GBPrsTypeBox; - QButtonGroup* GBPrsType; - QSpinBox* NbContoursSpn; -}; - -class VisuGUI_TableScalarBarPane : public QWidget -{ - Q_OBJECT - -public: - VisuGUI_TableScalarBarPane( QWidget* ); - ~VisuGUI_TableScalarBarPane(); - - void setRange( double, double, bool ); - void setDefaultRange( double, double ); - int getOrientation(); - void setPosAndSize( double, double, double, double, bool ); - void setScalarBarData( int, int ); - bool isIRange(); - double getMin(); - double getMax(); - double getX(); - double getY(); - double getWidth(); - double getHeight(); - int getNbColors(); - int getNbLabels(); - bool isLogarithmic(); - void setLogarithmic( bool on ); - // bool isToSave() {return CBSave ? CBSave->isChecked() : false;} - - void storeToResources(); - - void initFromPrsObject( VISU::PointMap3d_i* ); - int storeToPrsObject( VISU::PointMap3d_i* ); - - bool check(); - -private slots: - void changeDefaults( int ); - void changeRange( int ); - void XYChanged( double ); - void changeScalarMode( int ); - void onTextPref(); - void onBarPref(); - -private: - QGroupBox* RangeGroup; - QRadioButton* RBFrange; - QRadioButton* RBIrange; - QLineEdit* MinEdit; - QLineEdit* MaxEdit; - - QRadioButton* RBhori; - QRadioButton* RBvert; - - QtxDoubleSpinBox* XSpin; - QtxDoubleSpinBox* YSpin; - - QtxDoubleSpinBox* WidthSpin; - QtxDoubleSpinBox* HeightSpin; - - QSpinBox* ColorSpin; - QSpinBox* LabelSpin; - - QCheckBox* CBSave; - QCheckBox* CBLog; - QComboBox* myModeCombo; - QPushButton* myTextBtn; - QPushButton* myBarBtn; - VisuGUI_TextPrefDlg* myTextDlg; - VisuGUI_BarPrefDlg* myBarDlg; - - double myHorX, myHorY, myHorW, myHorH; - double myVerX, myVerY, myVerW, myVerH; - int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH; - int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH; - bool myIsStoreTextProp; - - std::string myTitle; - VISU::PointMap3d_i* myBarPrs; - - bool myBusy; -}; - -/////////////////////////////////////////////////////// - -class VisuGUI_Table3DDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_Table3DDlg( SalomeApp_Module* ); - ~VisuGUI_Table3DDlg(); - - virtual void initFromPrsObject( VISU::PointMap3d_i* ); - virtual int storeToPrsObject( VISU::PointMap3d_i* ); - -protected slots: - void accept(); - void onHelp(); - void onApply(); - -private: - QTabWidget* myTabBox; - VisuGUI_Table3DPane* myIsoPane; - VisuGUI_TableScalarBarPane* myScalarBarPane; - - SALOME::GenericObjPtr myPrsCopy; -}; - -#endif // VISUGUI_TABLE3D_H diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 6df04f65..65535af7 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -37,7 +37,7 @@ #include "VISU_Prs3d_i.hh" #include "VISU_Result_i.hh" #include "VISU_Table_i.hh" -#include "VISU_Mesh_i.hh" +//#include "VISU_Mesh_i.hh" #include "VISU_ViewManager_i.hh" #include "VISU_Actor.h" @@ -79,6 +79,7 @@ #include #include +using namespace std; //============================================================================= namespace VISU @@ -415,6 +416,15 @@ namespace VISU _PTR(GenericAttribute) anAttr; _PTR(AttributeString) aComment; + _PTR(SObject) aRefSObject; + if (aSObject->ReferencedObject(aRefSObject)) { + // It can be a reference on curve, published under a container. IPAL 20317 + VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(theModule), aRefSObject->GetID()); + VISU::Base_i* aRefBase = aRefObjectInfo.myBase; + if( (aRefBase && aRefBase->GetType() == VISU::TCURVE) || (aRefBase && aRefBase->GetType() == VISU::TMESH) ) + return true; + } + bool isUnderVISU = false; _PTR(SObject) aFatherSObject = aSObject->GetFather(); if (aFatherSObject->FindAttribute(anAttr, "AttributeName")) { @@ -587,10 +597,13 @@ namespace VISU switch (theType) { case VISU::SHRINK: if (aPrs3d) { - if (anActor->IsShrunk()) - anActor->UnShrink(); - else - anActor->SetShrink(); + if (anActor->IsShrunk()) + anActor->UnShrink(); + else + anActor->SetShrink(); + if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { + aMesh->SetShrink(true); + } } else if (aTable) { if (anActorBase->IsShrunk()) anActorBase->UnShrink(); @@ -1050,7 +1063,7 @@ namespace VISU for (int i = 0; i < clist.count(); i++) { tmpCurve = dynamic_cast(clist.at(i)); if (tmpCurve && tmpCurve->hasIO() && - theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) { + theCurve->GetEntry() == tmpCurve->getIO()->getEntry()) { plotCurve = tmpCurve; } else if (theDisplaying == VISU::eDisplayOnly) { @@ -1168,8 +1181,7 @@ namespace VISU //************************************************************ // Others - - void + VISU::Mesh_i* CreateMesh(VisuGUI* theModule, const Handle(SALOME_InteractiveObject)& theIO, SVTK_ViewWindow* theViewWindow) @@ -1184,11 +1196,11 @@ namespace VISU VISU::Result_var aResult; VISU::Result_i* pResult = CheckResult(theModule, aResultSObj, aResult); if (pResult == NULL) - return; + return NULL; Storable::TRestoringMap aMap = Storable::GetStorableMap(aResultSObj); if (aMap.empty()) - return; + return NULL; CORBA::Object_var aMesh; string aComment = Storable::FindValue(aMap,"myComment").toLatin1().data(); @@ -1226,7 +1238,7 @@ namespace VISU SUIT_MessageBox::warning (GetDesktop(theModule), QObject::tr("WRN_VISU"), QObject::tr("ERR_CANT_BUILD_PRESENTATION") ); - return; + return NULL; } if (theViewWindow) { @@ -1260,6 +1272,7 @@ namespace VISU theModule->application()->putInfo(QObject::tr("INF_DONE")); // Make "Save" button active theModule->getApp()->updateActions(); + return pPresent; } // ======================================================================================== @@ -1302,6 +1315,7 @@ namespace VISU case VISU::TPLOT3D: case VISU::TSCALARMAPONDEFORMEDSHAPE: case VISU::TDEFORMEDSHAPEANDSCALARMAP: + case VISU::TMESH: { PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); if (aServant.in()) { @@ -1438,4 +1452,21 @@ namespace VISU spinBox->setDecimals( decimals ); } //------------------------------------------------------------ + bool getClippingPlanesFolder(_PTR(Study) theStudy, _PTR(SObject)& theSObject) + { + _PTR(SComponent) aVisuSO = theStudy->FindComponent("VISU"); + if (!aVisuSO) return false; + _PTR(SObject) aFolder = theStudy->FindObject(CLIP_PLANES_FOLDER); + if (!aFolder) { + _PTR(StudyBuilder) aBuilder = theStudy->NewBuilder(); + aFolder = aBuilder->NewObject(aVisuSO); + + _PTR(GenericAttribute) anAttr; + anAttr = aBuilder->FindOrCreateAttribute(aFolder,"AttributeName"); + _PTR(AttributeName) aName(anAttr); + aName->SetValue(CLIP_PLANES_FOLDER); + } + theSObject = aFolder; + return true; + } } diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index e5d8510b..156b9a36 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -58,6 +58,7 @@ class VisuGUI; #include #include +#include "VISU_Mesh_i.hh" namespace VISU { @@ -121,6 +122,11 @@ namespace VISU VISU::Prs3d_i* GetPrs3dFromBase(Base_i* theBase); + bool GetPrs3dSelectionInfo( const SalomeApp_Module* theModule, + VISU::Prs3d_i*& thePrs3d, + SVTK_ViewWindow*& theViewWindow, + VISU_Actor*& thenActor ); + //---------------------------------------------------------------------------- void Add(LightApp_SelectionMgr* theSelectionMgr, const Handle(SALOME_InteractiveObject)& theIO); @@ -215,9 +221,9 @@ namespace VISU /*! Create mesh presentation and display it in \a theViewWindow. * If \a theViewWindow is NULL, no displaying will be done. */ - void CreateMesh(VisuGUI* theModule, - const Handle(SALOME_InteractiveObject)& theIO, - SVTK_ViewWindow* theViewWindow); + VISU::Mesh_i* CreateMesh(VisuGUI* theModule, + const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ViewWindow* theViewWindow); // Others std::vector GetPrs3dList (const SalomeApp_Module* theModule, @@ -232,6 +238,10 @@ namespace VISU VISU::Prs3d_i* thePrs3d); void initSpinBox( QSpinBox*, int, int, int = 1 ); void initSpinBox( QDoubleSpinBox*, double, double, double = 0.1, int = 6 ); + +#define CLIP_PLANES_FOLDER "Clipping Planes" + + bool getClippingPlanesFolder(_PTR(Study) theStudy, _PTR(SObject)& theSObject); } #endif diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx index 1f624abb..10b210c9 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.cxx +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -90,13 +90,10 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule) // Scale factor ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup ); - ScalFact = new QtxDoubleSpinBox( 1e-20, 1.0E+38, 0.1, TopGroup ); - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); - ScalFact->setPrecision( aPrecision*(-1) ); - ScalFact->setDecimals( 32 ); + ScalFact = new QtxDoubleSpinBox( 0, 1.0E+38, 0.1, aPrecision*(-1), 32, TopGroup ); ScalFact->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); ScalFact->setValue( 0.1 ); @@ -330,16 +327,16 @@ void VisuGUI_VectorsDlg::enableSetColor() void VisuGUI_VectorsDlg::setScaleFactor( double theFactor ) { double i=0.1; - while (1) { // Calculate Step & Precission - if ( int (theFactor/i) > 0) - break; - else { - i = i*0.1; + if (theFactor > 0) { // Calculate Step & Precission + while (1) { + if ( int (theFactor/i) > 0) + break; + else + i = i*0.1; } } ScalFact->setSingleStep(i); - ScalFact->setValue( theFactor ); } diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index d61e29bb..55e733fa 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -42,8 +42,8 @@ #include "SalomeApp_Module.h" #include "SalomeApp_Application.h" -#include "VVTK_ViewModel.h" -#include "VVTK_ViewWindow.h" +//#include "VVTK_ViewModel.h" +//#include "VVTK_ViewWindow.h" #include "SVTK_Functor.h" #include "SVTK_ViewModel.h" @@ -65,7 +65,7 @@ #include #include -class VVTK_Viewer; +//class VVTK_Viewer; namespace VISU { diff --git a/src/VISU_I/Makefile.am b/src/VISU_I/Makefile.am index 0bc6b6ac..b6b07c84 100644 --- a/src/VISU_I/Makefile.am +++ b/src/VISU_I/Makefile.am @@ -34,16 +34,19 @@ salomeinclude_HEADERS = \ VISU_MultiResult_i.hh \ VISU_PrsObject_i.hh \ VISU_Table_i.hh \ + VISU_ResultUtils.hh \ VISU_PointMap3d_i.hh \ VISU_Prs3d_i.hh \ VISU_Mesh_i.hh \ VISU_ColoredPrs3d_i.hh \ + VISU_CorbaMedConvertor.hxx \ VISU_ScalarMap_i.hh \ VISU_IsoSurfaces_i.hh \ VISU_DeformedShape_i.hh \ VISU_Plot3D_i.hh \ VISU_CutPlanes_i.hh \ VISU_CutLines_i.hh \ + VISU_Prs3dUtils.hh \ VISU_Vectors_i.hh \ VISU_StreamLines_i.hh \ VISU_GaussPoints_i.hh \ @@ -51,11 +54,14 @@ salomeinclude_HEADERS = \ VISU_View_i.hh \ VISU_TimeAnimation.h \ VISU_DeformedShapeAndScalarMap_i.hh \ + VISU_ColoredPrs3dCache_i.hh \ + VISU_ColoredPrs3dHolder_i.hh \ VISU_ColoredPrs3dFactory.hh \ VISU_MonoColorPrs_i.hh \ VISU_Deformation_i.hh \ VISU_OptionalDeformation_i.hh \ - SALOME_GenericObjPointer.hh + SALOME_GenericObjPointer.hh \ + VISU_ClippingPlaneMgr.hxx libVISUEngineImpl_la_SOURCES = \ @@ -92,7 +98,8 @@ libVISUEngineImpl_la_SOURCES = \ VISU_MonoColorPrs_i.cc \ VISU_Deformation_i.cc \ VISU_OptionalDeformation_i.cc \ - SALOME_GenericObjPointer.cc + SALOME_GenericObjPointer.cc \ + VISU_ClippingPlaneMgr.cxx MOC_FILES = VISU_TimeAnimation_moc.cxx nodist_libVISUEngineImpl_la_SOURCES= $(MOC_FILES) @@ -114,7 +121,6 @@ libVISUEngineImpl_la_CPPFLAGS= \ -I$(srcdir)/../CONVERTOR \ -I$(srcdir)/../PIPELINE \ -I$(srcdir)/../OBJECT \ - -I$(srcdir)/../VVTK \ -I$(srcdir)/../GUITOOLS \ -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix @@ -149,7 +155,6 @@ libVISUEngineImpl_la_LIBADD= \ ../CONVERTOR/libVisuConvertor.la \ ../PIPELINE/libVisuPipeLine.la \ ../OBJECT/libVisuObject.la \ - ../VVTK/libVVTK.la \ ../GUITOOLS/libVISUGUITOOLS.la if MED_ENABLE_MULTIPR diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index 073d07c8..c8f788b9 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -47,6 +47,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; namespace VISU { diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 9e833c82..547a4f3a 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -39,8 +39,8 @@ #include "VTKViewer_Algorithm.h" #include "SVTK_Functor.h" +#include "SVTK_ViewWindow.h" -#include "VVTK_ViewWindow.h" #include "SUIT_ResourceMgr.h" #include @@ -55,6 +55,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; + namespace { //---------------------------------------------------------------------------- @@ -365,6 +367,15 @@ VISU::ColoredPrs3dCache_i { std::string aFolderName = VISU::ColoredPrs3dCache_i::GetFolderName(); SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName.c_str()); + if (CORBA::is_nil(aSObject)) { + aSObject = theStudy->FindObject("3D Cache System"); + if (!CORBA::is_nil(aSObject)) { + SALOMEDS::StudyBuilder_var aBuilder = theStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" ); + SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); + aNameAttr->SetValue( GetFolderName().c_str() ); + } + } if(!CORBA::is_nil(aSObject)){ CORBA::Object_var anObject = aSObject->GetObject(); VISU::ColoredPrs3dCache_var aCache = VISU::ColoredPrs3dCache::_narrow(anObject); @@ -477,7 +488,8 @@ std::string VISU::ColoredPrs3dCache_i ::GetFolderName() { - return "3D Cache System"; + //return "3D Cache System"; + return "Presentations"; } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index ead20807..dc08a938 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -27,6 +27,8 @@ #ifndef VISU_ColoredPrs3dCache_i_HeaderFile #define VISU_ColoredPrs3dCache_i_HeaderFile +#include "VISU_I.hxx" + #include "VISU_ColoredPrs3dFactory.hh" #include "SALOME_GenericObjPointer.hh" @@ -103,7 +105,7 @@ namespace VISU * This interface is responsible for memory management of 3d presentations. * One cache corresponds to one study. */ - class ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache, + class VISU_I_EXPORT ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache, public virtual SALOME::GenericObj_i, public virtual RemovableObject_i { diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.cc b/src/VISU_I/VISU_ColoredPrs3dFactory.cc index 0aee75f2..69e33eb6 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.cc +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.cc @@ -44,6 +44,7 @@ //static int MYDEBUG = 0; #endif +using namespace std; namespace VISU { diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index 98b54763..8a76cd06 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -40,6 +40,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; + //--------------------------------------------------------------- int VISU::ColoredPrs3dHolder_i::myNbHolders = 0; diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh b/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh index 840d537e..dd28b077 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.hh @@ -27,6 +27,7 @@ #ifndef VISU_ColoredPrs3dHolder_i_HeaderFile #define VISU_ColoredPrs3dHolder_i_HeaderFile +#include "VISU_I.hxx" #include "VISU_PrsObject_i.hh" #include "SALOME_GenericObj_i.hh" @@ -41,7 +42,7 @@ namespace VISU * created on fields. It is publishing in the object browser in a separate folder * and can be controled by viewer's slider. */ - class ColoredPrs3dHolder_i : public virtual POA_VISU::ColoredPrs3dHolder, + class VISU_I_EXPORT ColoredPrs3dHolder_i : public virtual POA_VISU::ColoredPrs3dHolder, public virtual SALOME::GenericObj_i, public virtual PrsObject_i { diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 1f153a75..9a9f742d 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -46,6 +46,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; //--------------------------------------------------------------- namespace @@ -180,7 +181,8 @@ ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) : myOrientation( VISU::ColoredPrs3dBase::HORIZONTAL ), myColoredPL(NULL), myIsFixedRange(false), - myIsRestored(true) + myIsRestored(true)/* RKV : Begin*/, + myIsDistributionVisible(false)/* RKV : End*/ {} //--------------------------------------------------------------- @@ -694,21 +696,24 @@ VISU::ColoredPrs3d_i SetNbColors(anOrigin->GetNbColors()); SetUnitsVisible(anOrigin->IsUnitsVisible()); - SetLabelsFormat(anOrigin->GetLabelsFormat()); - + SetIsDistributionVisible(anOrigin->GetIsDistributionVisible()); + SetLabelsFormat( anOrigin->GetLabelsFormat() ); + SetBarOrientation(anOrigin->GetBarOrientation()); SetMinMaxController( anOrigin ); - if(anOrigin->IsRangeFixed()) - SetRange(anOrigin->GetMin(), anOrigin->GetMax()); + if ( anOrigin->IsRangeFixed() ) + SetRange( anOrigin->GetMin(), anOrigin->GetMax() ); else SetSourceRange(); + SetScalarFilterRange( anOrigin->GetScalarFilterMin(), anOrigin->GetScalarFilterMax() ); + UseScalarFiltering( anOrigin->IsScalarFilterUsed() ); + SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY()); SetSize(anOrigin->GetWidth(), anOrigin->GetHeight()); - SetRatios(anOrigin->GetTitleWidth(), anOrigin->GetTitleHeight(), - anOrigin->GetLabelWidth(), anOrigin->GetLabelHeight(), + SetRatios(anOrigin->GetTitleSize(), anOrigin->GetLabelSize(), anOrigin->GetBarWidth(), anOrigin->GetBarHeight()); SetLabels(anOrigin->GetLabels()); @@ -778,21 +783,74 @@ VISU::ColoredPrs3d_i return myColoredPL->GetScalarRange()[1]; } + //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i -::SetRange(CORBA::Double theMin, CORBA::Double theMax) +::SetRange( CORBA::Double theMin, CORBA::Double theMax ) { VISU::TSetModified aModified(this); vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; ProcessVoidEvent(new TVoidMemFun1ArgEvent (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange)); - UseFixedRange(true); } +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax ) +{ + VISU::TSetModified aModified(this); + + vtkFloatingPointType aScalarRange[ 2 ] = { theMin, theMax }; + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetScalarFilterRange, aScalarRange) ); +} + + +//---------------------------------------------------------------------------- +CORBA::Double +VISU::ColoredPrs3d_i +::GetScalarFilterMin() +{ + vtkFloatingPointType aScalarRange[ 2 ]; + GetSpecificPL()->GetScalarFilterRange( aScalarRange ); + + return aScalarRange[ 0 ]; +} + + +//---------------------------------------------------------------------------- +CORBA::Double +VISU::ColoredPrs3d_i +::GetScalarFilterMax() +{ + vtkFloatingPointType aScalarRange[ 2 ]; + GetSpecificPL()->GetScalarFilterRange( aScalarRange ); + + return aScalarRange[ 1 ]; +} + + +//---------------------------------------------------------------------------- +CORBA::Boolean +VISU::ColoredPrs3d_i +::IsScalarFilterUsed() +{ + return myColoredPL->IsScalarFilterUsed(); +} + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::UseScalarFiltering( CORBA::Boolean theUseScalarFilter ) +{ + return myColoredPL->UseScalarFiltering( theUseScalarFilter ); +} + //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i @@ -805,7 +863,7 @@ VISU::ColoredPrs3d_i ProcessVoidEvent(new TVoidMemFunEvent (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange)); }else{ - vtkFloatingPointType aScalarRange[2] = {GetSourceMin(), GetSourceMax()}; + vtkFloatingPointType aScalarRange[ 2 ] = {GetSourceMin(), GetSourceMax()}; ProcessVoidEvent(new TVoidMemFun1ArgEvent (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange)); } @@ -949,14 +1007,11 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i -::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight, - CORBA::Long theLabelWidth, CORBA::Long theLabelHeight, +::SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize, CORBA::Long theBarWidth, CORBA::Long theBarHeight) { - bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth); - anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight); - anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth); - anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight); + bool anIsSameValue = VISU::CheckIsSameValue(myTitleSize, theTitleSize); + anIsSameValue &= VISU::CheckIsSameValue(myLabelSize, theLabelSize); anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth); anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight); if(anIsSameValue) @@ -964,10 +1019,8 @@ VISU::ColoredPrs3d_i VISU::TSetModified aModified(this); - myTitleWidth = theTitleWidth; - myTitleHeight = theTitleHeight; - myLabelWidth = theLabelWidth; - myLabelHeight = theLabelHeight; + myTitleSize = theTitleSize; + myLabelSize = theLabelSize; myBarWidth = theBarWidth; myBarHeight = theBarHeight; myParamsTime.Modified(); @@ -976,33 +1029,17 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- CORBA::Long VISU::ColoredPrs3d_i -::GetTitleWidth() +::GetTitleSize() { - return myTitleWidth; -} - -//---------------------------------------------------------------------------- -CORBA::Long -VISU::ColoredPrs3d_i -::GetTitleHeight() -{ - return myTitleHeight; + return myTitleSize; } //---------------------------------------------------------------------------- CORBA::Long VISU::ColoredPrs3d_i -::GetLabelWidth() +::GetLabelSize() { - return myLabelWidth; -} - -//---------------------------------------------------------------------------- -CORBA::Long -VISU::ColoredPrs3d_i -::GetLabelHeight() -{ - return myLabelHeight; + return myLabelSize; } //---------------------------------------------------------------------------- @@ -1043,6 +1080,8 @@ VISU::ColoredPrs3d_i return myNumberOfLabels; } +//---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i @@ -1433,12 +1472,15 @@ VISU::ColoredPrs3d_i // Scalar Range int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); - if(aRangeType == 1){ + if ( aRangeType == 1 ) { float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0); float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); - SetRange(aMin, aMax); + SetRange( aMin, aMax ); } - UseFixedRange(aRangeType == 1); + UseFixedRange( aRangeType == 1 ); + + bool isFiltered = aResourceMgr->booleanValue("VISU", "scalar_bar_filter_by_scalars", false); + UseScalarFiltering( isFiltered ); int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 ); SetNbColors(aNumberOfColors); @@ -1446,8 +1488,10 @@ VISU::ColoredPrs3d_i bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true ); SetUnitsVisible(isUnits); - QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" ); - SetLabelsFormat(aLabelsFormat.toLatin1().data()); + SetIsDistributionVisible( aResourceMgr->booleanValue("VISU", "scalar_bar_show_distribution", false) ); // RKV + + int lp = aResourceMgr->integerValue( "VISU", "scalar_bar_label_precision", 3 ); + SetLabelsFormat( VISU::ToFormat( lp ).c_str() ); // Orientation int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0); @@ -1459,32 +1503,26 @@ VISU::ColoredPrs3d_i // Scalar Bar origin QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" ); - vtkFloatingPointType aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2; + vtkFloatingPointType aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.1; aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin); myPosition[0] = aXorigin; - vtkFloatingPointType aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012; + vtkFloatingPointType aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.01; aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin); myPosition[1] = aYorigin; // Scalar Bar size - myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6; + myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.08 : 0.8; myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth); - myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12; + myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.08; myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight); - myTitleWidth = 0; - myTitleWidth = aResourceMgr->integerValue("VISU", propertyName + "title_width", myTitleWidth); + myTitleSize = 0; + myTitleSize = aResourceMgr->integerValue("VISU", propertyName + "title_size", myTitleSize); - myTitleHeight = 0; - myTitleHeight = aResourceMgr->integerValue("VISU", propertyName + "title_height", myTitleHeight); - - myLabelWidth = 0; - myLabelWidth = aResourceMgr->integerValue("VISU", propertyName + "label_width", myLabelWidth); - - myLabelHeight = 0; - myLabelHeight = aResourceMgr->integerValue("VISU", propertyName + "label_height", myLabelHeight); + myLabelSize = 0; + myLabelSize = aResourceMgr->integerValue("VISU", propertyName + "label_size", myLabelSize); myBarWidth = 0; myBarWidth = aResourceMgr->integerValue("VISU", propertyName + "bar_width", myBarWidth); @@ -1522,7 +1560,7 @@ VISU::ColoredPrs3d_i myIsBoldTitle = f.bold(); myIsItalicTitle = f.italic(); - myIsShadowTitle = f.underline(); + myIsShadowTitle = f.overline(); } QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) ); @@ -1547,7 +1585,7 @@ VISU::ColoredPrs3d_i myIsBoldLabel = f.bold(); myIsItalicLabel = f.italic(); - myIsShadowLabel = f.underline(); + myIsShadowLabel = f.overline(); } QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) ); @@ -1557,7 +1595,41 @@ VISU::ColoredPrs3d_i myLabelColor[0] = aLabelColor.red() / 255.; myLabelColor[1] = aLabelColor.green() / 255.; myLabelColor[2] = aLabelColor.blue() / 255.; + + // Parameters of labels displaed field values + myValLblFontType = VTK_ARIAL; + myIsBoldValLbl = true; + myIsItalicValLbl = myIsShadowValLbl = false; + myValLblFontSize = 12; + if( aResourceMgr->hasValue( "VISU", "values_labeling_font" ) ) + { + // family + QFont f = aResourceMgr->fontValue( "VISU", "values_labeling_font" ); + if ( f.family() == "Arial" ) + myValLblFontType = VTK_ARIAL; + else if ( f.family() == "Courier" ) + myValLblFontType = VTK_COURIER; + else if ( f.family() == "Times" ) + myValLblFontType = VTK_TIMES; + + // size + if ( f.pointSize() > -1 ) + myValLblFontSize = f.pointSize(); + + // color + QColor aColor = aResourceMgr->colorValue( + "VISU", "values_labeling_color", QColor( 255, 255, 255 ) ); + myValLblFontColor[ 0 ] = aColor.red() / 255.; + myValLblFontColor[ 1 ] = aColor.green() / 255.; + myValLblFontColor[ 2 ] = aColor.blue()/ 255.; + + // bold, italic, shadow + myIsBoldValLbl = f.bold(); + myIsItalicValLbl = f.italic(); + myIsShadowValLbl = f.overline(); + } + return this; } @@ -1603,10 +1675,20 @@ VISU::ColoredPrs3d_i Build(ERestore); - SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt()); - float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble(); - float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble(); - SetRange(aMin, aMax); + SetScalarMode(VISU::Storable::FindValue( theMap,"myScalarMode" ).toInt() ); + { + float aMin = VISU::Storable::FindValue( theMap, "myScalarRange[0]" ).toDouble(); + float aMax = VISU::Storable::FindValue( theMap, "myScalarRange[1]" ).toDouble(); + SetRange( aMin, aMax ); + } + { + bool isFiltered = VISU::Storable::FindValue( theMap, "myIsFilteredByScalars", "0" ).toInt(); + float aMin = VISU::Storable::FindValue( theMap, "myScalarFilterRange[0]" ).toDouble(); + float aMax = VISU::Storable::FindValue( theMap, "myScalarFilterRange[1]" ).toDouble(); + SetScalarFilterRange( aMin, aMax ); + UseScalarFiltering( isFiltered ); + } + SetIsDistributionVisible(VISU::Storable::FindValue(theMap,"myIsDistributionVisible", "0").toInt()); UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt()); @@ -1621,10 +1703,8 @@ VISU::ColoredPrs3d_i myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble(); myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble(); myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble(); - myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt(); - myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt(); - myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt(); - myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt(); + myTitleSize = VISU::Storable::FindValue(theMap,"myTitleSize").toInt(); + myLabelSize = VISU::Storable::FindValue(theMap,"myLabelSize").toInt(); myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt(); myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt(); @@ -1657,6 +1737,18 @@ VISU::ColoredPrs3d_i } } } + + // Parameters of labels displayed field values + + myValLblFontType = VISU::Storable::FindValue( theMap, "myValLblFontType", "0" ).toInt(); + myIsBoldValLbl = VISU::Storable::FindValue( theMap, "myIsBoldValLbl", "1" ).toInt(); + myIsItalicValLbl = VISU::Storable::FindValue( theMap, "myIsItalicValLbl", "0" ).toInt(); + myIsShadowValLbl = VISU::Storable::FindValue( theMap, "myIsShadowValLbl", "0" ).toInt(); + myValLblFontSize = VISU::Storable::FindValue( theMap, "myValLblFontSize", "12" ).toDouble(); + myValLblFontColor[ 0 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[0]", "1" ).toFloat(); + myValLblFontColor[ 1 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[1]", "1" ).toFloat(); + myValLblFontColor[ 2 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[2]", "1" ).toFloat(); + return this; } @@ -1676,6 +1768,12 @@ VISU::ColoredPrs3d_i Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() ); Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() ); Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() ); + + Storable::DataToStream( theStr, "myIsFilteredByScalars", IsScalarFilterUsed() ); + Storable::DataToStream( theStr, "myScalarFilterRange[0]", GetScalarFilterMin() ); + Storable::DataToStream( theStr, "myScalarFilterRange[1]", GetScalarFilterMax() ); + + Storable::DataToStream( theStr, "myIsDistributionVisible", GetIsDistributionVisible() ); // RKV Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) ); Storable::DataToStream( theStr, "myOrientation", myOrientation ); @@ -1683,15 +1781,15 @@ VISU::ColoredPrs3d_i Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits ); Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels ); + Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() ); + Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] ); Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] ); Storable::DataToStream( theStr, "myWidth", myWidth ); Storable::DataToStream( theStr, "myHeight", myHeight ); - Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth ); - Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight ); - Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth ); - Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight ); + Storable::DataToStream( theStr, "myTitleSize", myTitleSize ); + Storable::DataToStream( theStr, "myLabelSize", myLabelSize ); Storable::DataToStream( theStr, "myBarWidth", myBarWidth ); Storable::DataToStream( theStr, "myBarHeight", myBarHeight ); @@ -1710,6 +1808,18 @@ VISU::ColoredPrs3d_i Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] ); Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] ); Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] ); + + // Parameters of labels displayed field values + + Storable::DataToStream( theStr, "myValLblFontType", myValLblFontType ); + Storable::DataToStream( theStr, "myIsBoldValLbl", myIsBoldValLbl ); + Storable::DataToStream( theStr, "myIsItalicValLbl", myIsItalicValLbl ); + Storable::DataToStream( theStr, "myIsShadowValLbl", myIsShadowValLbl ); + Storable::DataToStream( theStr, "myValLblFontSize", myValLblFontSize ); + Storable::DataToStream( theStr, "myValLblFontColor[0]", myValLblFontColor[ 0 ] ); + Storable::DataToStream( theStr, "myValLblFontColor[1]", myValLblFontColor[ 1 ] ); + Storable::DataToStream( theStr, "myValLblFontColor[2]", myValLblFontColor[ 2 ] ); + std::ostringstream aGeomNameList; std::string aMeshName = GetCMeshName(); @@ -1740,6 +1850,15 @@ VISU::ColoredPrs3d_i } +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetMapScale(double theMapScale) +{ + GetSpecificPL()->SetMapScale(theMapScale); +} + + //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i @@ -1832,3 +1951,181 @@ VISU::ColoredPrs3d_i aStudyBuilder->CommitCommand(); return this; } + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3d_i +::SetIsDistributionVisible(CORBA::Boolean isVisible) +{ + if( myIsDistributionVisible != isVisible ){ + VISU::TSetModified aModified(this); + myIsDistributionVisible = isVisible; + myParamsTime.Modified(); + } +} + +//---------------------------------------------------------------------------- +CORBA::Boolean +VISU::ColoredPrs3d_i +::GetIsDistributionVisible() +{ + return myIsDistributionVisible; +} + +//---------------------------------------------------------------------------- + + +int +VISU::ColoredPrs3d_i +::GetValLblFontType() const +{ + return myValLblFontType; +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::SetValLblFontType( const int theType ) +{ + if ( myValLblFontType == theType ) + return; + + VISU::TSetModified aModified( this ); + + myValLblFontType = theType; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- + +double +VISU::ColoredPrs3d_i +::GetValLblFontSize() const +{ + return myValLblFontSize; +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::SetValLblFontSize( const double theSize ) +{ + if ( VISU::CheckIsSameValue( myValLblFontSize, theSize ) ) + return; + + VISU::TSetModified aModified( this ); + + myValLblFontSize = theSize; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::GetValLblFontColor( vtkFloatingPointType& theR, + vtkFloatingPointType& theG, + vtkFloatingPointType& theB ) const +{ + theR = myValLblFontColor[ 0 ]; + theG = myValLblFontColor[ 1 ]; + theB = myValLblFontColor[ 2 ]; +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::SetValLblFontColor( const vtkFloatingPointType theR, + const vtkFloatingPointType theG, + const vtkFloatingPointType theB ) +{ + if ( VISU::CheckIsSameValue( myValLblFontColor[ 0 ], theR ) && + VISU::CheckIsSameValue( myValLblFontColor[ 1 ], theG ) && + VISU::CheckIsSameValue (myValLblFontColor[ 2 ], theB ) ) + return; + + VISU::TSetModified aModified(this); + + myValLblFontColor[ 0 ] = theR; + myValLblFontColor[ 1 ] = theG; + myValLblFontColor[ 2 ] = theB; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- + +bool +VISU::ColoredPrs3d_i +::IsBoldValLbl() const +{ + return myIsBoldValLbl; +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::SetBoldValLbl( const bool theVal ) +{ + if ( myIsBoldValLbl == theVal ) + return; + + VISU::TSetModified aModified( this ); + + myIsBoldValLbl = theVal; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- + +bool +VISU::ColoredPrs3d_i +::IsItalicValLbl() const +{ + return myIsItalicValLbl; +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::SetItalicValLbl( const bool theVal ) +{ + if ( myIsItalicValLbl == theVal ) + return; + + VISU::TSetModified aModified( this ); + + myIsItalicValLbl = theVal; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- + +bool +VISU::ColoredPrs3d_i +::IsShadowValLbl() const +{ + return myIsShadowValLbl; +} + +//---------------------------------------------------------------------------- + +void +VISU::ColoredPrs3d_i +::SetShadowValLbl( const bool theVal ) +{ + if ( myIsShadowValLbl == theVal ) + return; + + VISU::TSetModified aModified( this ); + + myIsShadowValLbl = theVal; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- + diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index c2035a21..d150f686 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -284,8 +284,7 @@ namespace VISU virtual void - SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight, - CORBA::Long theLabelWidth, CORBA::Long theLabelHeight, + SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize, CORBA::Long theBarWidth, CORBA::Long theBarHeight); virtual @@ -298,19 +297,11 @@ namespace VISU virtual CORBA::Long - GetTitleWidth(); - - virtual - CORBA::Long - GetTitleHeight(); + GetTitleSize(); virtual CORBA::Long - GetLabelWidth(); - - virtual - CORBA::Long - GetLabelHeight(); + GetLabelSize(); virtual CORBA::Long @@ -355,6 +346,40 @@ namespace VISU CORBA::Boolean IsUnitsVisible(); + /*! + * Set the visibility of a distribution curve. + * \param theIs is used to switch on/off the visibility of a distribution curve. + */ + virtual void SetIsDistributionVisible(CORBA::Boolean theIs); + + //! Gets current visibility of a distribution curve + virtual CORBA::Boolean GetIsDistributionVisible(); + + //! Gets current filtering by scalars mode + virtual CORBA::Boolean IsScalarFilterUsed(); + + virtual void UseScalarFiltering( CORBA::Boolean theUseScalarFilter ); + + /*! + * Sets scalar range - min and max boundaries of the scalar bar. + * \param theMin Min boundary of the scalar bar. + * \param theMax Max boundary of the scalar bar. + * \param theIsFilter if true then filter by scalars. + */ + virtual + void + SetScalarFilterRange( CORBA::Double theMin, CORBA::Double theMax ); + + //---------------------------------------------------------------------------- + virtual + CORBA::Double + GetScalarFilterMin(); + + //---------------------------------------------------------------------------- + virtual + CORBA::Double + GetScalarFilterMax(); + //---------------------------------------------------------------------------- //! Gets memory size actually used by the presentation (Mb). virtual @@ -537,12 +562,68 @@ namespace VISU vtkFloatingPointType theG, vtkFloatingPointType theB); + virtual + void + SetMapScale(double theMapScale = 1.0); + VISU_ColoredPL* GetSpecificPL() const { return myColoredPL; } + virtual + int + GetValLblFontType() const; + + virtual + void + SetValLblFontType( const int theType ); + + virtual + double + GetValLblFontSize() const; + + virtual + void + SetValLblFontSize( const double theSize ); + + virtual + bool + IsBoldValLbl() const; + + virtual + void + SetBoldValLbl( const bool theVal ); + + virtual + bool + IsItalicValLbl() const; + + virtual + void + SetItalicValLbl( const bool theVal ); + + virtual + bool + IsShadowValLbl() const; + + virtual + void + SetShadowValLbl( const bool theVal ); + + virtual + void + GetValLblFontColor( vtkFloatingPointType& theR, + vtkFloatingPointType& theG, + vtkFloatingPointType& theB ) const; + + virtual + void + SetValLblFontColor( const vtkFloatingPointType theR, + const vtkFloatingPointType theG, + const vtkFloatingPointType theB ); + //---------------------------------------------------------------------------- protected: /*! @@ -650,11 +731,11 @@ namespace VISU int myNumberOfLabels; std::string myLabelsFormat; + VISU::ColoredPrs3dBase::Orientation myOrientation; vtkFloatingPointType myPosition[2], myWidth, myHeight, - myTitleWidth, myTitleHeight, - myLabelWidth, myLabelHeight, + myTitleSize, myLabelSize, myBarWidth, myBarHeight; //Font management @@ -673,6 +754,15 @@ namespace VISU VISU_ColoredPL* myColoredPL; bool myIsFixedRange; + bool myIsDistributionVisible; // RKV + + // Result labels + int myValLblFontType; + double myValLblFontSize; + bool myIsBoldValLbl; + bool myIsItalicValLbl; + bool myIsShadowValLbl; + vtkFloatingPointType myValLblFontColor[ 3 ]; }; diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 1bdcf0ae..367749de 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -1194,8 +1194,16 @@ VISU_MEDConvertor vtkIdType aDataType = VTK_DOUBLE; SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField); - if(aFieldDouble->_is_nil()) - aDataType = VTK_LONG; + if(aFieldDouble->_is_nil()){ + if (sizeof(long) == 4 ) // Size of CORBA::Long is always 4 (see CORBA_basetypes.h) + //Fix for IPAL20325 Crash on create presentation for imported field + aDataType = VTK_LONG; + else if (sizeof(int) == 4) + aDataType = VTK_INT; + else { + throw std::runtime_error("Can't map CORBA::Long to a VTK type"); + } + } aField->Init(aMEDField->getNumberOfComponents(), aDataType); aFieldMap[aFieldName.in()] = aField; diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index e329711c..af649133 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -46,6 +46,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; //--------------------------------------------------------------- size_t diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index 4592dea6..dcd1acfc 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -41,7 +41,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif - +using namespace std; //---------------------------------------------------------------------------- size_t diff --git a/src/VISU_I/VISU_Deformation_i.cc b/src/VISU_I/VISU_Deformation_i.cc deleted file mode 100755 index 507a9476..00000000 --- a/src/VISU_I/VISU_Deformation_i.cc +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_Deformation_i.cc -// Author : -// Module : VISU - -#include "VISU_Deformation_i.hh" -#include "VISU_Result_i.hh" -#include "VISU_Prs3dUtils.hh" - -#include "VISU_DeformationPL.hxx" -#include "VISU_Convertor.hxx" -#include "VISU_DeformationPL.hxx" -#include "VISUConfig.hh" - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//--------------------------------------------------------------- -VISU::Deformation_i::Deformation_i(VISU::ColoredPrs3d_i *thePrs3d): - myColoredPrs3d(thePrs3d) -{ - if(MYDEBUG) MESSAGE("Deformation_i::Deformation_i()"); -} - -//--------------------------------------------------------------- -VISU::Deformation_i::~Deformation_i() -{ - if(MYDEBUG) MESSAGE("Deformation_i::~Deformation_i()"); -} - -//--------------------------------------------------------------- -void VISU::Deformation_i::SetScale(CORBA::Double theScale) -{ - if(MYDEBUG) MESSAGE("Deformation_i::SetScale()"); - - VISU::TSetModified aModified(GetColoredPrs3d()); - - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificDeformedPL(), &VISU_DeformationPL::SetScale, theScale)); -} - -//--------------------------------------------------------------- -void VISU::Deformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){ - - if(MYDEBUG) MESSAGE("Deformation_i::InitDeformedPipeLine()"); - myDeformationPL = theDeformedPipeLine; -} - -//--------------------------------------------------------------- -CORBA::Double -VISU::Deformation_i -::GetScale() -{ - if(MYDEBUG) MESSAGE("Deformation_i::GetScale()"); - return GetSpecificDeformedPL()->GetScale(); -} - -//--------------------------------------------------------------- -VISU::Entity VISU::Deformation_i::GetVectorialFieldEntity(){ - return myVectorialEntity; -} - -//--------------------------------------------------------------- -char* VISU::Deformation_i::GetVectorialFieldName(){ - return CORBA::string_dup(myVectorialFieldName.c_str()); -} - -//--------------------------------------------------------------- -void VISU::Deformation_i:: -DeformationToStream(std::ostringstream& theStr) -{ - Storable::DataToStream(theStr,"myScaleFactor", GetScale()); - Storable::DataToStream(theStr,"myVectorialField", GetVectorialFieldName()); - Storable::DataToStream(theStr,"myVectorialEntiry", GetVectorialFieldEntity()); - -} - -//--------------------------------------------------------------- -void -VISU::Deformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap) -{ - SetScale(VISU::Storable::FindValue(theMap,"myScaleFactor").toDouble()); - VISU::Entity anEntity = VISU::Entity(VISU::Storable::FindValue(theMap, "myVectorialEntiry").toInt()); - - SetVectorialField(anEntity, - VISU::Storable::FindValue(theMap, "myVectorialField").toLatin1().constData()); -} - -//--------------------------------------------------------------- -void -VISU::Deformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){ - if(const Deformation_i* aPrs = dynamic_cast(aDeformedPrs)) { - Deformation_i* anOrigin = const_cast(aPrs); - - CORBA::String_var aVectorialFieldName = anOrigin->GetVectorialFieldName(); - VISU::Entity anEntity = anOrigin->GetVectorialFieldEntity(); - this->SetVectorialField(anEntity, - aVectorialFieldName); - this->SetScale(anOrigin->GetScale()); - } -} - -void VISU::Deformation_i::SetVectorialField(Entity theEntity, const char* theFieldName){ - if(MYDEBUG) MESSAGE("CutPlanes_i::SetVectorialField()"); - - bool anIsModified = false; - if(!anIsModified) - anIsModified |= GetVectorialFieldEntity() != theEntity; - - if(!anIsModified) - anIsModified |= GetVectorialFieldName() != theFieldName; - - if(!anIsModified) - return; - - ColoredPrs3d_i *aColoredPrs = GetColoredPrs3d(); - int aTimeStampNumber = aColoredPrs->GetTimeStampNumber(); - - VISU::TEntity aEntity = VISU::TEntity(theEntity); - - VISU::Result_i::PInput anInput = aColoredPrs->GetCResult()->GetInput(aColoredPrs->GetCMeshName(), - theEntity, - theFieldName, - aTimeStampNumber); - - PField aVectorialField = anInput->GetField(aColoredPrs->GetCMeshName(), aEntity, theFieldName); - - VISU::PUnstructuredGridIDMapper anIDMapper = - anInput->GetTimeStampOnMesh(aColoredPrs->GetCMeshName(), - aEntity, - theFieldName, - aTimeStampNumber); - if(GetSpecificDeformedPL() && anIDMapper) { - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificDeformedPL(), &VISU_DeformationPL::SetVectorialField, anIDMapper)); - - VISU::TSetModified aModified(GetColoredPrs3d()); - - myVectorialEntity = theEntity; - myVectorialFieldName = theFieldName; - myVectorialField = anIDMapper; - } -}; diff --git a/src/VISU_I/VISU_Deformation_i.hh b/src/VISU_I/VISU_Deformation_i.hh deleted file mode 100755 index 821b2735..00000000 --- a/src/VISU_I/VISU_Deformation_i.hh +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_Deformation_i.hxx -// Author : -// Module : VISU - -#ifndef VISU_Deformation_i_HeaderFile -#define VISU_Deformation_i_HeaderFile - -#include "VISU_I.hxx" -#include "VISU_ColoredPrs3d_i.hh" -#include "VISU_DeformationPL.hxx" - - - -namespace VISU{ - - class VISU_I_EXPORT Deformation_i : public virtual POA_VISU::Deformation - { - Deformation_i(const Deformation_i&); - public: - typedef VISU::Deformation TInterface; - - Deformation_i(VISU::ColoredPrs3d_i* theColoredPrs3d); - virtual ~Deformation_i(); - - virtual - void - SetScale(CORBA::Double theScale); - - virtual - CORBA::Double - GetScale(); - - virtual - void - DeformationToStream(std::ostringstream& theStr); - - virtual - void - RestoreDeformation(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap); - - virtual - void - SameAsDeformation(const Deformation_i *aDeformedPrs); - - virtual - VISU::Entity - GetVectorialFieldEntity(); - - virtual - char* - GetVectorialFieldName(); - - virtual void SetVectorialField(Entity theEntity, const char* theFieldName); - - protected: - virtual - void - InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine); - - VISU_DeformationPL* - GetSpecificDeformedPL() const - { - return myDeformationPL; - } - - ColoredPrs3d_i* GetColoredPrs3d(){ - return myColoredPrs3d; - } - - - private: - VISU_DeformationPL *myDeformationPL; - - PField myVectorialField; - VISU::Entity myVectorialEntity; - std::string myVectorialFieldName; - ColoredPrs3d_i *myColoredPrs3d; - - }; -} - -#endif diff --git a/src/VISU_I/VISU_DeformedShapeAndScalarMap_i.cc b/src/VISU_I/VISU_DeformedShapeAndScalarMap_i.cc deleted file mode 100644 index 9667e0c3..00000000 --- a/src/VISU_I/VISU_DeformedShapeAndScalarMap_i.cc +++ /dev/null @@ -1,404 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_DeformedShapeAndScalarMap_i.cc -// Author : Eugeny Nikolaev -// Module : VISU - -#include "VISU_DeformedShapeAndScalarMap_i.hh" -#include "VISU_Prs3dUtils.hh" -#include "VISU_Result_i.hh" - -#include "VISU_ScalarMapAct.h" -#include "VISU_DeformedShapeAndScalarMapPL.hxx" -#include "VISU_Convertor.hxx" - -#include "SUIT_ResourceMgr.h" -#include "SALOME_Event.h" - -#include -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -static int INCMEMORY = 4+12; - - -//--------------------------------------------------------------- -size_t -VISU::DeformedShapeAndScalarMap_i -::IsPossible(Result_i* theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Long theTimeStampNumber, - bool theIsMemoryCheck) -{ - size_t aResult = 0; - try{ - aResult = TSuperClass::IsPossible(theResult, - theMeshName, - theEntity, - theFieldName, - theTimeStampNumber, - false); - if(theIsMemoryCheck && aResult){ - VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName, - theEntity, - theFieldName, - theTimeStampNumber); - VISU::PField aField = anInput->GetField(theMeshName, - (VISU::TEntity)theEntity, - theFieldName); - if(aField->myNbComp <= 1) - return 0; - - bool anIsEstimated = true; - size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName, - (VISU::TEntity)theEntity, - theFieldName, - theTimeStampNumber, - anIsEstimated); - if(anIsEstimated) - aSize *= INCMEMORY; - aResult = VISU_PipeLine::CheckAvailableMemory(aSize); - if(MYDEBUG) - MESSAGE("DeformedShapeAndScalarMap_i::IsPossible - CheckAvailableMemory = "<(theOrigin)){ - DeformedShapeAndScalarMap_i* anOrigin = const_cast(aPrs3d); - CORBA::String_var aFieldName = anOrigin->GetScalarFieldName(); - - SetScalarField(anOrigin->GetScalarEntity(), - aFieldName, - anOrigin->GetScalarTimeStampNumber()); - Update(); - } -} - - -//--------------------------------------------------------------- -void -VISU::DeformedShapeAndScalarMap_i -::SetScale(CORBA::Double theScale) -{ - VISU::TSetModified aModified(this); - - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedShapeAndScalarMapPL::SetScale, theScale)); -} - - -//--------------------------------------------------------------- -CORBA::Double -VISU::DeformedShapeAndScalarMap_i -::GetScale() -{ - return myDeformedShapeAndScalarMapPL->GetScale(); -} - - -//--------------------------------------------------------------- -void -VISU::DeformedShapeAndScalarMap_i -::CreatePipeLine(VISU_PipeLine* thePipeLine) -{ - if(!thePipeLine){ - myDeformedShapeAndScalarMapPL = VISU_DeformedShapeAndScalarMapPL::New(); - }else - myDeformedShapeAndScalarMapPL = dynamic_cast(thePipeLine); - - myDeformedShapeAndScalarMapPL->GetMapper()->SetScalarVisibility(1); - - TSuperClass::CreatePipeLine(myDeformedShapeAndScalarMapPL); -} - - -//--------------------------------------------------------------- -bool -VISU::DeformedShapeAndScalarMap_i -::CheckIsPossible() -{ - return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); -} - - -//--------------------------------------------------------------- -VISU_Actor* -VISU::DeformedShapeAndScalarMap_i -::CreateActor() -{ - VISU_Actor* anActor = TSuperClass::CreateActor(true); - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - int aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2); - bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false); - anActor->SetRepresentation(aDispMode); - if (toShrink) - anActor->SetShrink(); - anActor->SetVTKMapping(false); - return anActor; -} - - -//--------------------------------------------------------------- -void -VISU::DeformedShapeAndScalarMap_i -::UpdateActor(VISU_Actor* theActor) -{ - if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ - anActor->SetBarVisibility(true); - GetPipeLine()->GetMapper()->SetScalarVisibility(1); - } - TSuperClass::UpdateActor(theActor); -} - - -//--------------------------------------------------------------- -void -VISU::DeformedShapeAndScalarMap_i -::SetField(VISU::PField theField) -{ - TSuperClass::SetField(theField); - - if(!myScalarField) - myScalarField = theField; -} - - -//--------------------------------------------------------------- -void -VISU::DeformedShapeAndScalarMap_i -::SetScalarField(VISU::Entity theEntity, - const char* theFieldName, - CORBA::Long theTimeStampNumber) -{ - bool anIsModified = false; - - if(!anIsModified) - anIsModified |= myScalarEntity != theEntity; - - if(!anIsModified) - anIsModified |= myScalarFieldName != theFieldName; - - if(!anIsModified) - anIsModified |= myScalarTimeStampNumber != theTimeStampNumber; - - if(!anIsModified) - return; - - VISU::TSetModified aModified(this); - - VISU::TEntity aEntity = VISU::TEntity(theEntity); - VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(), - theEntity, - theFieldName, - theTimeStampNumber); - myScalarField = anInput->GetField(GetCMeshName(), aEntity, theFieldName); - - VISU::PUnstructuredGridIDMapper anIDMapper = - anInput->GetTimeStampOnMesh(GetCMeshName(), - aEntity, - theFieldName, - theTimeStampNumber); - - vtkUnstructuredGrid* anOutput = anIDMapper->GetUnstructuredGridOutput(); - if(myDeformedShapeAndScalarMapPL && anOutput) - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedShapeAndScalarMapPL::SetScalars, anOutput)); - - myScalarEntity = theEntity; - myScalarFieldName = theFieldName; - myScalarTimeStampNumber = theTimeStampNumber; - - SetTitle(theFieldName); - SetScalarMode(GetScalarMode()); - if(!IsRangeFixed() && IsPipeLineExists()) - SetSourceRange(); - - myParamsTime.Modified(); -} - - -//--------------------------------------------------------------- -VISU::Entity -VISU::DeformedShapeAndScalarMap_i -::GetScalarEntity() -{ - return myScalarEntity; -} - - -//--------------------------------------------------------------- -char* -VISU::DeformedShapeAndScalarMap_i -::GetScalarFieldName() -{ - return CORBA::string_dup(myScalarFieldName.c_str()); -} - - -//--------------------------------------------------------------- -CORBA::Long -VISU::DeformedShapeAndScalarMap_i -::GetScalarTimeStampNumber() -{ - return myScalarTimeStampNumber; -} - - -//--------------------------------------------------------------- -VISU::PField -VISU::DeformedShapeAndScalarMap_i -::GetScalarField() -{ - return myScalarField; -} diff --git a/src/VISU_I/VISU_DeformedShapeAndScalarMap_i.hh b/src/VISU_I/VISU_DeformedShapeAndScalarMap_i.hh deleted file mode 100644 index 35827d1d..00000000 --- a/src/VISU_I/VISU_DeformedShapeAndScalarMap_i.hh +++ /dev/null @@ -1,179 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File: VISU_DeformedShapeAndScalarMap_i.hh -// Author: Eugeny Nikolaev -// Module : VISU - -#ifndef VISU_DeformedShapeAndScalarMap_i_HeaderFile -#define VISU_DeformedShapeAndScalarMap_i_HeaderFile - -#include "VISU_ScalarMap_i.hh" - -class VISU_DeformedShapeAndScalarMapPL; - -namespace VISU -{ - //---------------------------------------------------------------------------- - //! Class of Scalar Map on Deformed Shape presentation. - class VISU_I_EXPORT DeformedShapeAndScalarMap_i : public virtual POA_VISU::DeformedShapeAndScalarMap, - public virtual ScalarMap_i - { - static int myNbPresent; - DeformedShapeAndScalarMap_i(const DeformedShapeAndScalarMap_i&); - - public: - //---------------------------------------------------------------------------- - typedef ScalarMap_i TSuperClass; - typedef VISU::DeformedShapeAndScalarMap TInterface; - - explicit - DeformedShapeAndScalarMap_i(EPublishInStudyMode thePublishInStudyModep); - - virtual - ~DeformedShapeAndScalarMap_i(); - - virtual - VISU::VISUType - GetType() - { - return VISU::TDEFORMEDSHAPEANDSCALARMAP; - } - - virtual - void - SetScale(CORBA::Double theScale); - - virtual - CORBA::Double - GetScale(); - - virtual - void - SameAs(const Prs3d_i* theOrigin); - - VISU_DeformedShapeAndScalarMapPL* - GetSpecificPL() - { - return myDeformedShapeAndScalarMapPL; - } - - protected: - //! Redefines VISU_ColoredPrs3d_i::SetField - virtual - void - SetField(VISU::PField theField); - - //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine - virtual - void - CreatePipeLine(VISU_PipeLine* thePipeLine); - - //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible - virtual - bool - CheckIsPossible(); - - public: - //! Redefines VISU_ColoredPrs3d_i::IsPossible - static - size_t - IsPossible(Result_i* theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Long theTimeStampNumber, - bool theIsMemoryCheck); - - //! Redefines VISU_ColoredPrs3d_i::IsPossible - virtual - Storable* - Create(const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Long theTimeStampNumber); - - //! Redefines VISU_ColoredPrs3d_i::ToStream - virtual - void - ToStream(std::ostringstream& theStr); - - //! Redefines VISU_ColoredPrs3d_i::Restore - virtual - Storable* - Restore(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap); - - static const std::string myComment; - - virtual - const char* - GetComment() const; - - virtual - QString - GenerateName(); - - virtual - const char* - GetIconName(); - - virtual - VISU_Actor* - CreateActor(); - - virtual - void - UpdateActor(VISU_Actor* theActor) ; - - virtual - void - SetScalarField(VISU::Entity theEntity, - const char* theFieldName, - CORBA::Long theTimeStampNumber); - - virtual - VISU::Entity - GetScalarEntity(); - - virtual - char* - GetScalarFieldName(); - - virtual - CORBA::Long - GetScalarTimeStampNumber(); - - virtual - VISU::PField - GetScalarField(); - - private: - VISU_DeformedShapeAndScalarMapPL *myDeformedShapeAndScalarMapPL; - - PField myScalarField; - VISU::Entity myScalarEntity; - std::string myScalarFieldName; - CORBA::Long myScalarTimeStampNumber; - }; -} -#endif diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index a4811982..fd6ee897 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -45,6 +45,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; //--------------------------------------------------------------- size_t diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 93da7d73..53922a9e 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -179,6 +179,28 @@ namespace VISU //--------------------------------------------------------------------------- + void SetClippingPlane(Prs3d_i* thePrs, string theName, + std::ostream& theStr, + std::string thePrefix) + { + VISU_CutPlaneFunction* aPlane; + VISU_Gen_i* aGen = VISU_Gen_i::GetVisuGenImpl(); + VISU_ClippingPlaneMgr& aMgr = aGen->GetClippingPlaneMgr(); + int aId; + for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) { + aPlane = dynamic_cast(thePrs->GetClippingPlane(i)); + if (aPlane) { + if (!aPlane->isAuto()) { + aId = aMgr.GetPlaneId(aPlane); + if (aId > -1) { + theStr<GetOffset(x,y,z); theStr<IsBarVisible()? "True" : "False"; theStr<IsShrank()? "True" : "False")<<")"<GetOrigin(aOrigin); + aPlane->GetNormal(aDir); + + theStr<isAuto()<<",\""<getName()<<"\")"<GetDefaultScript("Post-Pro", aPrefix.c_str()); diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 2fa93815..af6412b4 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -56,6 +56,8 @@ static int MYDEBUG = 0; static int INCMEMORY = 10; +using namespace std; + //---------------------------------------------------------------------------- size_t VISU::GaussPoints_i @@ -851,7 +853,11 @@ VISU_Actor* VISU::GaussPoints_i ::CreateActor() { - return OnCreateActor1(); + VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New(); + if(OnCreateActor(anActor)) + return anActor; + return NULL; + // return OnCreateActor1(); } //---------------------------------------------------------------------------- @@ -877,8 +883,7 @@ VISU::GaussPoints_i theScalarBar->SetTitle(GetScalarBarTitle().c_str()); theScalarBar->SetOrientation(GetBarOrientation()); theScalarBar->SetNumberOfLabels(GetLabels()); - theScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(), - GetLabelWidth(), GetLabelHeight(), + theScalarBar->SetRatios(GetTitleSize(), GetLabelSize(), GetBarWidth(), GetBarHeight()); theScalarBar->SetLabelFormat(GetLabelsFormat()); @@ -994,7 +999,24 @@ VISU::GaussPoints_i theActor->SetRepresentation( VTK_POINTS ); else theActor->SetRepresentation( VTK_SURFACE ); + + // Update values labels + + vtkTextProperty* aProp = anActor->GetsValLabelsProps(); + if ( aProp ) + { + aProp->SetFontFamily( GetValLblFontType() ); + aProp->SetFontSize( GetValLblFontSize() ); + aProp->SetBold( IsBoldValLbl() ); + aProp->SetItalic( IsItalicValLbl() ); + aProp->SetShadow( IsShadowValLbl() ); + + vtkFloatingPointType anRGB[ 3 ]; + GetValLblFontColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] ); + aProp->SetColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] ); + } } + TSuperClass::UpdateActor(theActor); } diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 0732d558..74c07067 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -94,6 +94,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; + extern "C" VISU_I_EXPORT VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB, @@ -215,6 +217,7 @@ namespace VISU Storable::RegistryStorableEngine(ColoredPrs3dHolder_i::myComment.c_str(),&(ColoredPrs3dHolder_i::StorableEngine)); Storable::RegistryStorableEngine(ColoredPrs3dCache_i::myComment.c_str(),&(ColoredPrs3dCache_i::StorableEngine)); + Storable::RegistryStorableEngine(PointMap3d_i::myComment.c_str(),&(PointMap3d_i::StorableEngine)); Storable::RegistryStorableEngine(Table_i::myComment.c_str(),&(Table_i::StorableEngine)); Storable::RegistryStorableEngine(Curve_i::myComment.c_str(),&(Curve_i::StorableEngine)); Storable::RegistryStorableEngine(Container_i::myComment.c_str(),&(Container_i::StorableEngine)); @@ -258,6 +261,7 @@ namespace VISU CORBA::String_var aStudyName = aListOfOpenStudies[0]; //aFileInfo.setFile(aStudyName.in()); myStudyDocument = aStudyManager->GetStudyByName(aStudyName/*aFileInfo.baseName()*/); + myClippingPlaneMgr.SetStudy(GetStudy(myStudyDocument)); }else if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : there is no opened study in StudyManager !!!"); } @@ -538,6 +542,7 @@ namespace VISU std::string aStudyName (aName.in()); if(MYDEBUG) MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'"); myStudyDocument = SALOMEDS::Study::_duplicate(theStudy); + myClippingPlaneMgr.SetStudy(GetStudy(myStudyDocument)); ProcessVoidEvent(new TEvent(aStudyName)); @@ -1430,4 +1435,74 @@ namespace VISU { return ColoredPrs3dCache_i::GetInstance(theStudy); } + + + CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name) + { + return myClippingPlaneMgr.CreateClippingPlane(X, Y, Z, dX, dY, dZ, isAuto, name); + } + + + void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name) + { + myClippingPlaneMgr.EditClippingPlane(id, X, Y, Z, dX, dY, dZ, isAuto, name); + } + + /* Returns clipping plane by its Id */ + VISU::ClippingPlane* VISU_Gen_i::GetClippingPlane(CORBA::Long id) + { + VISU_CutPlaneFunction* aPlane = myClippingPlaneMgr.GetClippingPlane(id); + + if (aPlane != NULL) { + double aOrigin[3]; + double aDir[3]; + aPlane->GetOrigin(aOrigin); + aPlane->GetNormal(aDir); + + VISU::ClippingPlane* aRetPlane = new VISU::ClippingPlane; + aRetPlane->X = aOrigin[0]; + aRetPlane->Y = aOrigin[1]; + aRetPlane->Z = aOrigin[2]; + aRetPlane->dX = aDir[0]; + aRetPlane->dY = aDir[1]; + aRetPlane->dZ = aDir[2]; + aRetPlane->isAuto = aPlane->isAuto(); + + aRetPlane->name = aPlane->getName().c_str(); + return aRetPlane; + } + return NULL; + } + + /* Deletes clipping plane by its Id */ + CORBA::Boolean VISU_Gen_i::DeleteClippingPlane(CORBA::Long id) + { + return myClippingPlaneMgr.DeleteClippingPlane(id); + } + + /* Applyes a clipping plane with Id to presentation thePrs */ + CORBA::Boolean VISU_Gen_i::ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id) + { + VISU::Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(thePrs).in()); + return myClippingPlaneMgr.ApplyClippingPlane(aPrs, id); + } + + /* Detaches a clipping plane with Id from presentation thePrs */ + CORBA::Boolean VISU_Gen_i::DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id) + { + VISU::Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(thePrs).in()); + return myClippingPlaneMgr.DetachClippingPlane(aPrs, id); + } + + /* Get number of clipping planes */ + CORBA::Long VISU_Gen_i::GetClippingPlanesNb() + { + return myClippingPlaneMgr.GetClippingPlanesNb(); + } + + } diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 1043ed2a..63cbf179 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -30,6 +30,7 @@ #include "SALOME_Component_i.hxx" #include "SALOME_NamingService.hxx" #include "VISU_ColoredPrs3d_i.hh" +#include "VISU_ClippingPlaneMgr.hxx" #include @@ -41,6 +42,8 @@ namespace VISU public virtual Base_i { SALOMEDS::Study_var myStudyDocument; + VISU_ClippingPlaneMgr myClippingPlaneMgr; + VISU_Gen_i(const VISU::VISU_Gen_i &); public: VISU_Gen_i(CORBA::ORB_ptr theORB, @@ -361,6 +364,33 @@ namespace VISU virtual VISU::ColoredPrs3dCache_ptr GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy); + + + virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name); + + virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name); + + /* Returns clipping plane by its Id */ + virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id); + + /* Deletes clipping plane by its Id */ + virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id); + + /* Applyes a clipping plane with Id to presentation thePrs */ + virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id); + + /* Detaches a clipping plane with Id from presentation thePrs */ + virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id); + + /* Get number of clipping planes */ + virtual CORBA::Long GetClippingPlanesNb(); + + VISU_ClippingPlaneMgr& GetClippingPlaneMgr() { return myClippingPlaneMgr; } + }; } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 90e3b18a..6d637875 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -43,6 +43,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; + //--------------------------------------------------------------- size_t VISU::IsoSurfaces_i diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 3886da2a..a4a67ff3 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -46,6 +46,8 @@ static int MYDEBUG = 0; static int INCMEMORY = 4; +using namespace std; + //---------------------------------------------------------------------------- namespace { @@ -127,6 +129,8 @@ VISU::Mesh_i SetMeshName(theMeshName.c_str()); myEntity = int(theEntity);//jfa IPAL9284 mySubMeshName = theFamilyName; + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + myIsShrank = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); return Build(false); } @@ -189,6 +193,8 @@ VISU::Mesh_i throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!"); if (!theRestoring) { myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2)); + myIsShrank = (myPresentType == VISU::SHRINK); + if(myEntity == VISU::NODE_ENTITY) myPresentType = VISU::POINT; SetName((const char*)GenerateName().toLatin1(), false); @@ -397,7 +403,9 @@ VISU::Mesh_i return; VISU::TSetModified aModified(this); - + if (theType == VISU::SHRINK) { + myIsShrank = true; + } myPresentType = theType; myParamsTime.Modified(); } @@ -444,6 +452,8 @@ VISU::Mesh_i myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt()); + myIsShrank = (VISU::Storable::FindValue(theMap,"myIsShrank", "0").toInt() == 1)? true: false; + myCellColor.R = VISU::Storable::FindValue(theMap,"myCellColor.R").toDouble(); myCellColor.G = VISU::Storable::FindValue(theMap,"myCellColor.G").toDouble(); myCellColor.B = VISU::Storable::FindValue(theMap,"myCellColor.B").toDouble(); @@ -485,6 +495,8 @@ VISU::Mesh_i Storable::DataToStream( theStr, "myPresentType", int(myPresentType) ); + Storable::DataToStream( theStr, "myIsShrank", (myIsShrank? "1":"0")); + Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R ); Storable::DataToStream( theStr, "myCellColor.G", myCellColor.G ); Storable::DataToStream( theStr, "myCellColor.B", myCellColor.B ); @@ -508,8 +520,21 @@ VISU::Mesh_i try{ VISU::Prs3d_i::CreateActor(anActor); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); - if (toShrink) anActor->SetShrink(); + //bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); + //if (toShrink) anActor->SetShrink(); + if (anActor->IsShrunkable()) { + if (myIsShrank) + anActor->SetShrink(); + else + anActor->UnShrink(); + } + anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) ); + anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false), + aResourceMgr->booleanValue("VISU", "show_boundary_edges", false), + aResourceMgr->booleanValue("VISU", "show_manifold_edges", false), + aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) ); + anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) ); + UpdateActor(anActor); }catch (...) { anActor->Delete(); @@ -528,6 +553,12 @@ VISU::Mesh_i if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor"); VISU::Prs3d_i::UpdateActor(anActor); anActor->SetRepresentation(myPresentType); + if (anActor->IsShrunkable()) { + if (myIsShrank) + anActor->SetShrink(); + else + anActor->UnShrink(); + } anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B); anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B); anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B); @@ -535,3 +566,20 @@ VISU::Mesh_i } //---------------------------------------------------------------------------- + + +void VISU::Mesh_i::SetShrink(CORBA::Boolean toShrink) +{ + if(toShrink == myIsShrank) + return; + VISU::TSetModified aModified(this); + myIsShrank = toShrink; + myParamsTime.Modified(); +} + +//---------------------------------------------------------------------------- +CORBA::Boolean VISU::Mesh_i::IsShrank() +{ + return myIsShrank; +} + diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index b0395f14..02d4efbc 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -95,6 +95,11 @@ namespace VISU VISU::PresentationType GetPresentationType(); + + virtual void SetShrink(CORBA::Boolean toShrink); + + virtual CORBA::Boolean IsShrank(); + VISU_MeshPL* GetSpecificPL() const { return myMeshPL; @@ -114,6 +119,7 @@ namespace VISU SALOMEDS::Color myCellColor; SALOMEDS::Color myNodeColor; SALOMEDS::Color myLinkColor; + bool myIsShrank; public: static diff --git a/src/VISU_I/VISU_MonoColorPrs_i.cc b/src/VISU_I/VISU_MonoColorPrs_i.cc deleted file mode 100644 index 28afbc8d..00000000 --- a/src/VISU_I/VISU_MonoColorPrs_i.cc +++ /dev/null @@ -1,186 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_MonoColorPrs_i.cxx -// Author : Vitaly Smetannikov -// Module : VISU - - -#include "VISU_MonoColorPrs_i.hh" -#include "VISU_Prs3dUtils.hh" -#include "VISU_PipeLineUtils.hxx" -#include "VISU_ScalarMapAct.h" - -#include "VISU_PipeLine.hxx" - -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//--------------------------------------------------------------- -VISU::MonoColorPrs_i -::MonoColorPrs_i(EPublishInStudyMode thePublishInStudyMode): - ColoredPrs3d_i(thePublishInStudyMode), - ScalarMap_i(thePublishInStudyMode) -{ - if(MYDEBUG) MESSAGE("MonoColorPrs_i::MonoColorPrs_i"); -} - -//--------------------------------------------------------------- -void -VISU::MonoColorPrs_i -::SameAs(const Prs3d_i* theOrigin) -{ - TSuperClass::SameAs(theOrigin); - - if(const MonoColorPrs_i* aPrs3d = dynamic_cast(theOrigin)){ - MonoColorPrs_i* anOrigin = const_cast(aPrs3d); - SetColor(anOrigin->GetColor()); - ShowColored(anOrigin->IsColored()); - } -} - - -//--------------------------------------------------------------- -VISU::Storable* -VISU::MonoColorPrs_i -::Create(const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Long theTimeStampNumber) -{ - myIsColored = false; - myColor.R = myColor.G = myColor.B = 0.5; - return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); -} - -//--------------------------------------------------------------- -VISU::Storable* -VISU::MonoColorPrs_i -::Restore(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap) -{ - if(!TSuperClass::Restore(theSObject, theMap)) - return NULL; - - myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt(); - myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble(); - myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble(); - myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble(); - - return this; -} - -//--------------------------------------------------------------- -void -VISU::MonoColorPrs_i -::ToStream(std::ostringstream& theStr) -{ - TSuperClass::ToStream(theStr); - - Storable::DataToStream( theStr, "myIsColored", myIsColored ); - Storable::DataToStream( theStr, "myColor.R", myColor.R ); - Storable::DataToStream( theStr, "myColor.G", myColor.G ); - Storable::DataToStream( theStr, "myColor.B", myColor.B ); -} - - -//--------------------------------------------------------------- -VISU::MonoColorPrs_i::~MonoColorPrs_i() -{ - if(MYDEBUG) MESSAGE("MonoColorPrs_i::~MonoColorPrs_i()"); -} - -//--------------------------------------------------------------- -CORBA::Boolean VISU::MonoColorPrs_i::IsColored() -{ - return myIsColored; -} - - - -//--------------------------------------------------------------- -void -VISU::MonoColorPrs_i::ShowColored(CORBA::Boolean theColored) -{ - if(myIsColored == theColored) - return; - myIsColored = theColored; - myParamsTime.Modified(); -} - -//--------------------------------------------------------------- -SALOMEDS::Color VISU::MonoColorPrs_i::GetColor() -{ - return myColor; -} - -//--------------------------------------------------------------- -void VISU::MonoColorPrs_i::SetColor(const SALOMEDS::Color& theColor) -{ - bool anIsSameValue = VISU::CheckIsSameValue(myColor.R, theColor.R); - anIsSameValue &= VISU::CheckIsSameValue(myColor.G, theColor.G); - anIsSameValue &= VISU::CheckIsSameValue(myColor.B, theColor.B); - if(anIsSameValue) - return; - - VISU::TSetModified aModified(this); - - myColor = theColor; - myParamsTime.Modified(); -} - -//--------------------------------------------------------------- -VISU_Actor* VISU::MonoColorPrs_i::CreateActor(bool toSupressShrinking) -{ - VISU_Actor* anActor = TSuperClass::CreateActor(toSupressShrinking); - anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); - return anActor; -} - -//--------------------------------------------------------------- -VISU_Actor* VISU::MonoColorPrs_i::CreateActor() -{ - return CreateActor(false); -} - -//--------------------------------------------------------------- -void VISU::MonoColorPrs_i::UpdateActor(VISU_ActorBase* theActor) -{ - if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ - if(IsColored()){ - anActor->SetBarVisibility(true); - GetPipeLine()->GetMapper()->SetScalarVisibility(1); - }else{ - anActor->SetBarVisibility(false); - GetPipeLine()->GetMapper()->SetScalarVisibility(0); - anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); - } - TSuperClass::UpdateActor(theActor); - } -} - diff --git a/src/VISU_I/VISU_MonoColorPrs_i.hh b/src/VISU_I/VISU_MonoColorPrs_i.hh deleted file mode 100644 index 50fff308..00000000 --- a/src/VISU_I/VISU_MonoColorPrs_i.hh +++ /dev/null @@ -1,83 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_MonoColorPrs_i.hxx -// Author : Vitaly Smetannikov -// Module : VISU - - -#ifndef VISU_MonoColorPrs_i_HeaderFile -#define VISU_MonoColorPrs_i_HeaderFile - -#include -#include "VISU_ScalarMap_i.hh" - -namespace VISU -{ - //---------------------------------------------------------------------------- - class VISU_I_EXPORT MonoColorPrs_i : public virtual POA_VISU::MonoColorPrs, - public virtual ScalarMap_i - { - MonoColorPrs_i(const MonoColorPrs_i&); - - public: - //---------------------------------------------------------------------------- - typedef ScalarMap_i TSuperClass; - typedef VISU::MonoColorPrs TInterface; - - explicit MonoColorPrs_i(EPublishInStudyMode thePublishInStudyModep); - - virtual void SameAs(const Prs3d_i* theOrigin); - - virtual ~MonoColorPrs_i(); - - virtual CORBA::Boolean IsColored(); - - virtual void ShowColored(CORBA::Boolean theColored); - - virtual SALOMEDS::Color GetColor(); - - virtual void SetColor(const SALOMEDS::Color& theColor); - - protected: - SALOMEDS::Color myColor; - bool myIsColored; - - public: - virtual Storable* Create(const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Long theTimeStampNumber); - - virtual void ToStream(std::ostringstream& theStr); - - virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap); - - virtual VISU_Actor* CreateActor(); - - virtual VISU_Actor* CreateActor(bool toSupressShrinking); - - virtual void UpdateActor(VISU_ActorBase* theActor); - }; -}; -#endif diff --git a/src/VISU_I/VISU_OptionalDeformation_i.cc b/src/VISU_I/VISU_OptionalDeformation_i.cc deleted file mode 100755 index 77a12298..00000000 --- a/src/VISU_I/VISU_OptionalDeformation_i.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_OptionalDeformation_i.cc -// Author : -// Module : VISU - -#include "VISU_OptionalDeformation_i.hh" -#include "VISU_Result_i.hh" -#include "VISU_Prs3dUtils.hh" -#include "VISUConfig.hh" - -#include "VISU_OptionalDeformationPL.hxx" - - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//--------------------------------------------------------------- -VISU::OptionalDeformation_i::OptionalDeformation_i(VISU::ColoredPrs3d_i *theColoredPrs3d): - Deformation_i(theColoredPrs3d) -{ - if(MYDEBUG) MESSAGE("OptionalDeformation_i::OptionalDeformation_i()"); -} - -//--------------------------------------------------------------- -VISU::OptionalDeformation_i::~OptionalDeformation_i() -{ - if(MYDEBUG) MESSAGE("OptionalDeformation_i::~OptionalDeformation_i()"); -} - -//--------------------------------------------------------------- -void VISU::OptionalDeformation_i::UseDeformation(CORBA::Boolean theFlag){ - if(MYDEBUG) MESSAGE("OptionalDeformation_i::UseDeformation()"); - - VISU::TSetModified aModified(GetColoredPrs3d()); - - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificDeformedPL(), &VISU_OptionalDeformationPL::UseDeformation, theFlag)); -} - -//--------------------------------------------------------------- -CORBA::Boolean VISU::OptionalDeformation_i::IsDeformed(){ - - if(MYDEBUG) MESSAGE("OptionalDeformation_i::IsDeformed()"); - return GetSpecificDeformedPL()->IsDeformed(); -} - - -void VISU::OptionalDeformation_i::InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine){ - - if(MYDEBUG) MESSAGE("OptionalDeformation_i::InitDeformedPipeLine()"); - myOptionalDeformationPL = dynamic_cast(theDeformedPipeLine); - - TSuperClass::InitDeformedPipeLine(myOptionalDeformationPL); -} - -//--------------------------------------------------------------- -void VISU::OptionalDeformation_i:: -DeformationToStream(std::ostringstream& theStr) -{ - Storable::DataToStream(theStr,"IsDeformed", IsDeformed()); - if(IsDeformed()) - TSuperClass::DeformationToStream(theStr); -} - -//--------------------------------------------------------------- -void -VISU::OptionalDeformation_i::RestoreDeformation(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap) -{ - UseDeformation(Storable::FindValue(theMap,"IsDeformed").toInt()); - if(IsDeformed()) - TSuperClass::RestoreDeformation(theSObject,theMap); -} - - - -void -VISU::OptionalDeformation_i::SameAsDeformation(const Deformation_i *aDeformedPrs){ - - if(const OptionalDeformation_i* aPrs3d = dynamic_cast(aDeformedPrs)){ - OptionalDeformation_i* anOrigin = const_cast(aPrs3d); - UseDeformation(anOrigin->IsDeformed()); - - if(anOrigin->IsDeformed()){ - TSuperClass::SameAsDeformation(aDeformedPrs); - } - } -} diff --git a/src/VISU_I/VISU_OptionalDeformation_i.hh b/src/VISU_I/VISU_OptionalDeformation_i.hh deleted file mode 100755 index ac6a08ff..00000000 --- a/src/VISU_I/VISU_OptionalDeformation_i.hh +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_Deformation_i.hxx -// Author : -// Module : VISU - -#ifndef VISU_OptionalDeformation_i_HeaderFile -#define VISU_OptionalDeformation_i_HeaderFile - -#include "VISU_I.hxx" -#include "VISU_Deformation_i.hh" -#include "VISU_OptionalDeformationPL.hxx" - -namespace VISU { - class VISU_I_EXPORT OptionalDeformation_i : public virtual POA_VISU::OptionalDeformation, - public virtual Deformation_i - { - OptionalDeformation_i(const OptionalDeformation_i&); - public: - typedef VISU::OptionalDeformation TInterface; - typedef Deformation_i TSuperClass; - - OptionalDeformation_i(VISU::ColoredPrs3d_i* theModifiedEngine); - virtual ~OptionalDeformation_i(); - - virtual void UseDeformation(CORBA::Boolean theFlag); - virtual CORBA::Boolean IsDeformed(); - - - virtual - void - DeformationToStream(std::ostringstream& theStr); - - virtual - void - RestoreDeformation(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap); - - virtual - void - SameAsDeformation(const Deformation_i *aDeformedPrs); - - protected: - virtual - void InitDeformedPipeLine(VISU_DeformationPL* theDeformedPipeLine); - - VISU_OptionalDeformationPL* - GetSpecificDeformedPL() const - { - return myOptionalDeformationPL; - } - - private: - VISU_OptionalDeformationPL* myOptionalDeformationPL; - - }; -} -#endif diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 3f8ff658..a5ecb5d8 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -34,6 +34,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; //--------------------------------------------------------------- size_t diff --git a/src/VISU_I/VISU_PointMap3d_i.cc b/src/VISU_I/VISU_PointMap3d_i.cc deleted file mode 100644 index 2885a351..00000000 --- a/src/VISU_I/VISU_PointMap3d_i.cc +++ /dev/null @@ -1,1276 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_PointMap3d_i.cc -// Author : Dmitry Matveitchev -// Module : VISU - -#include "VISU_PointMap3d_i.hh" - -#include "VISU_CutLines_i.hh" -#include "VISU_Result_i.hh" -#include "VISU_ViewManager_i.hh" -#include "VISU_ScalarBarActor.hxx" -#include "SUIT_ResourceMgr.h" - -#include "SALOME_Event.h" -#include "VISU_Prs3dUtils.hh" -#include "SPlot2d_Curve.h" -#include "VISU_PipeLineUtils.hxx" - -#include "VISU_TableReader.hxx" -#include "VISU_ConvertorUtils.hxx" -#include "VISU_DeformedGridPL.hxx" - -#include "SALOME_InteractiveObject.hxx" -#include "VISU_Gen_i.hh" - -#include -#include - -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//---------------------------------------------------------------- -// PointMap3d Object -//---------------------------------------------------------------- -int VISU::PointMap3d_i::myNbPresent = 0; -const string VISU::PointMap3d_i::myComment = "POINTMAP3D"; -/*! - Generate unique name -*/ -QString VISU::PointMap3d_i::GenerateName() -{ - return VISU::GenerateName( "Table3D - ", ++myNbPresent ); -} -/*! - Gets comment string -*/ -const char* VISU::PointMap3d_i::GetComment() const -{ - return myComment.c_str(); -} -/*! - Constructor -*/ -VISU::PointMap3d_i::PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry ) - : Table_i(theStudy, theObjectEntry), - myActorCollection(vtkActorCollection::New()), - myIsActiveState(true) -{ - if(MYDEBUG) MESSAGE("PointMap3d_i::PointMap3d_i - this = "<FindObjectID(theObjectEntry); - myOffset[0] = myOffset[1] = myOffset[2] = 0; - myActorCollection->Delete(); -} -/*! - Destructor -*/ -VISU::PointMap3d_i::~PointMap3d_i() -{ - if(MYDEBUG) MESSAGE("PointMap3d_i::~PointMap3d_i - this = "< TSignal; - const TSignal& mySignal; - - TInvokeSignalEvent(const TSignal& theSignal): - mySignal(theSignal) - {} - - virtual - void - Execute() - { - mySignal(); - } - }; -} - -//---------------------------------------------------------------------------- -void -VISU::PointMap3d_i -::SetTitle( const char* theTitle ) -{ - SetName( theTitle, true ); -} - -//---------------------------------------------------------------------------- -char* -VISU::PointMap3d_i -::GetTitle() -{ - return CORBA::string_dup( GetName().c_str() ); -} - -//---------------------------------------------------------------------------- -SALOMEDS::SObject_var -VISU::PointMap3d_i -::GetSObject() const -{ - return mySObj; -} - -//---------------------------------------------------------------------------- -std::string -VISU::PointMap3d_i -::GetObjectEntry() -{ - CORBA::String_var anEntry = mySObj->GetID(); - return anEntry.in(); -} - -//---------------------------------------------------------------------------- -Handle(SALOME_InteractiveObject) -VISU::PointMap3d_i -::GetIO() -{ - if( myIO.IsNull() ) - myIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str()); - - return myIO; -} - -//---------------------------------------------------------------------------- -/*! - Creates table3d object -*/ -VISU::Storable* VISU::PointMap3d_i::Create() -{ - // generate name ... - SetName(GetTableTitle().toLatin1().constData(), false); - - if ( GetName() == "" ) { - if ( !mySObj->_is_nil() ) { - CutLines_i* pCutLines = NULL; - CORBA::Object_var anObj = SObjectToObject(mySObj); - if(!CORBA::is_nil(anObj)){ - VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj); - if(!aCutLines->_is_nil()) - pCutLines = dynamic_cast(GetServant(aCutLines).in()); - } - if (!pCutLines) - if (mySObj->GetName()) SetName(mySObj->GetName(), false); - } - } - - if ( GetName() == "" ) - SetName(GenerateName().toLatin1().constData(), false); - - // Create Pipeline - myTablePL = VISU_DeformedGridPL::New(); - myTablePL->SetPolyDataIDMapper(GetTableIDMapper()); - myTablePL->Update(); - - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - - bool isUnits = aResourceMgr->booleanValue( "VISU", "scalar_bar_display_units", true ); - SetUnitsVisible(isUnits); - - SetSourceRange(); - - if( aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false) ) - SetScaling(VISU::LOGARITHMIC); - else - SetScaling(VISU::LINEAR); - - int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 ); - SetNbColors(aNumberOfColors); - - int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); - UseFixedRange(aRangeType == 1); - if(aRangeType == 1){ - float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0); - float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); - SetRange(aMin, aMax); - } - - QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" ); - SetLabelsFormat(aLabelsFormat.toLatin1().constData()); - - // Orientation - int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0); - if(anOrientation == 1) - SetBarOrientation(VISU::ColoredPrs3dBase::HORIZONTAL); - else - SetBarOrientation(VISU::ColoredPrs3dBase::VERTICAL); - - // Scalar Bar origin - QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" ); - - vtkFloatingPointType aXorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2; - aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin); - myPosition[0] = aXorigin; - - vtkFloatingPointType aYorigin = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012; - aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin); - myPosition[1] = aYorigin; - - // Scalar Bar size - myWidth = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6; - myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth); - - myHeight = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12; - myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight); - - myTitleWidth = aResourceMgr->doubleValue("VISU", propertyName + "title_width", 0); - myTitleHeight = aResourceMgr->doubleValue("VISU", propertyName + "title_height", 0); - myLabelWidth = aResourceMgr->doubleValue("VISU", propertyName + "label_width", 0); - myLabelHeight = aResourceMgr->doubleValue("VISU", propertyName + "label_height", 0); - myBarWidth = aResourceMgr->doubleValue("VISU", propertyName + "bar_width", 0); - myBarHeight = aResourceMgr->doubleValue("VISU", propertyName + "bar_height", 0); - - // Nb of Labels - myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 ); - - // Fonts properties definition - myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true; - myTitFontType = VTK_ARIAL; - - if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){ - QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" ); - if ( f.family() == "Arial" ) - myTitFontType = VTK_ARIAL; - else if ( f.family() == "Courier" ) - myTitFontType = VTK_COURIER; - else if ( f.family() == "Times" ) - myTitFontType = VTK_TIMES; - - myIsBoldTitle = f.bold(); - myIsItalicTitle = f.italic(); - myIsShadowTitle = f.underline(); - } - - QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) ); - - myTitleColor[0] = aTextColor.red() / 255; - myTitleColor[1] = aTextColor.green() / 255; - myTitleColor[2] = aTextColor.blue() / 255; - - myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true; - myLblFontType = VTK_ARIAL; - - if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){ - QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" ); - if ( f.family() == "Arial" ) - myLblFontType = VTK_ARIAL; - else if ( f.family() == "Courier" ) - myLblFontType = VTK_COURIER; - else if ( f.family() == "Times" ) - myLblFontType = VTK_TIMES; - - myIsBoldLabel = f.bold(); - myIsItalicLabel = f.italic(); - myIsShadowLabel = f.underline(); - } - - QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) ); - - myLabelColor[0] = aLabelColor.red() / 255; - myLabelColor[1] = aLabelColor.green() / 255; - myLabelColor[2] = aLabelColor.blue() / 255; - - // scalar bar default position - bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0); - int aPlace = 1; - if (anIsArrangeBar){ - aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0); - } - if(myBarOrientation == VISU::ColoredPrs3dBase::HORIZONTAL){ - myPosition[1] += myHeight*(aPlace-1); - } else { - myPosition[0] += myWidth*(aPlace-1); - } - - return Build( false ); -} - -/* - GetIDMapper -*/ - -VISU::PTableIDMapper -VISU::PointMap3d_i -::GetTableIDMapper() -{ - //Initialisate table mapper - SALOMEDS::GenericAttribute_var anAttr; - mySObj->FindAttribute(anAttr, "AttributeTableOfReal"); - SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr); - - PTableIDMapper aTableIDMapper( new TTableIDMapper() ); - TTable2D& aTable2D = *aTableIDMapper; - - aTable2D.myTitle = aTableOfReal->GetTitle(); - - SALOMEDS::StringSeq_var aColStrList = aTableOfReal->GetColumnTitles(); - SALOMEDS::StringSeq_var aRowStrList = aTableOfReal->GetRowTitles(); - - for ( int i = 0; i < aRowStrList->length(); i++ ) { - aTable2D.myColumnTitles.push_back( aRowStrList[ i ].in() ); - } - - int aCols = aTableOfReal->GetNbColumns(); - int aRows = aTableOfReal->GetNbRows(); - - for (int i=1; i<=aCols; i++) { - TTable2D::TRow aRow; - aRow.myTitle = aColStrList[ i-1 ].in(); - for (int j=1; j<=aRows; j++) { - double aVal = aTableOfReal->GetValue(j, i); - QString aValStr = QString::number(aVal); - aRow.myValues.push_back( aValStr.toLatin1().constData() ); - } - if( aRow.myValues.size() > 0 ) - aTable2D.myRows.push_back( aRow ); - } - - return aTableIDMapper; -} - -/* - Create Actor -*/ -VISU_PointMap3dActor* VISU::PointMap3d_i::CreateActor() -{ - VISU_PointMap3dActor* anActor = VISU_PointMap3dActor::New(); - anActor->SetPipeLine(myTablePL); - anActor->SetFactory(this); - - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); - int aDispMode = aResourceMgr->integerValue("VISU", "point_map_represent", 2); - bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false); - anActor->SetRepresentation(aDispMode); - if (toShrink) anActor->SetShrink(); - - Handle (SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str()); - anActor->setIO(anIO); - - myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::UpdateFromFactory,anActor)); - // myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,anActor)); - - myActorCollection->AddItem(anActor); - - UpdateActor( anActor ); - - return anActor; -} - -/* - Update Actor -*/ -void VISU::PointMap3d_i::UpdateActor(VISU_ActorBase* theActor) -{ - if(VISU_PointMap3dActor* anActor = dynamic_cast(theActor)){ - Update(); - VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar(); - aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable()); - aScalarBar->SetTitle(GetTitle()); - aScalarBar->SetOrientation(GetBarOrientation()); - aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport(); - aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY()); - aScalarBar->SetWidth(GetWidth()); - aScalarBar->SetHeight(GetHeight()); - aScalarBar->SetNumberOfLabels(GetLabels()); - aScalarBar->SetRatios(myTitleWidth, myTitleHeight, - myLabelWidth, myLabelHeight, - myBarWidth, myBarHeight); - aScalarBar->SetNumberOfLabels(GetLabels()); - aScalarBar->SetLabelFormat(GetLabelsFormat()); - - vtkFloatingPointType anRGB[3]; - - vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); - aTitleProp->SetFontFamily(GetTitFontType()); - - GetTitleColor(anRGB[0],anRGB[1],anRGB[2]); - aTitleProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); - - IsBoldTitle()? aTitleProp->BoldOn() : aTitleProp->BoldOff(); - IsItalicTitle()? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); - IsShadowTitle()? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); - - vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); - aLabelProp->SetFontFamily(GetLblFontType()); - - GetLabelColor(anRGB[0],anRGB[1],anRGB[2]); - aLabelProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); - - IsBoldLabel()? aLabelProp->BoldOn() : aLabelProp->BoldOff(); - IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); - IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); - - aScalarBar->Modified(); - } - theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]); -} - -void -VISU::PointMap3d_i -::UpdateActors() -{ - if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "< - (GetSpecificPL(), &VISU_PipeLine::Update)); - - ProcessVoidEvent(new VISU::TInvokeSignalEvent(myUpdateActorsSignal)); -} - -//---------------------------------------------------------------------------- -void -VISU::PointMap3d_i -::Update() -{ - if(GetMTime() < myUpdateTime.GetMTime()) - return; - - if(MYDEBUG) MESSAGE("PointMap3d_i::Update - this = "< - (GetSpecificPL(), &VISU_PipeLine::Update)); - myUpdateTime.Modified(); - }catch(std::exception&){ - throw; - }catch(...){ - throw std::runtime_error("PointMap3d_i::Update >> unexpected exception was caught!!!"); - } -} - -//---------------------------------------------------------------------------- -unsigned long int -VISU::PointMap3d_i -::GetMTime() -{ - unsigned long int aTime = myParamsTime.GetMTime(); - if( GetSpecificPL() ) - aTime = std::max(aTime, GetSpecificPL()->GetMTime()); - return aTime; -} - -/*! - Builds presentation of table -*/ -VISU::Storable* VISU::PointMap3d_i::Build( int theRestoring ) -{ - - // look for reference SObject with table attribute - SALOMEDS::SObject_var SO = mySObj; - - if ( !SO->_is_nil() ) { - CutLines_i* pCutLines = NULL; - CORBA::Object_var anObj = SObjectToObject(SO); - if(!CORBA::is_nil(anObj)){ - VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj); - if(!aCutLines->_is_nil()) - pCutLines = dynamic_cast(GetServant(aCutLines).in()); - } - SALOMEDS::Study_var aStudy = GetStudyDocument(); - SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr; - // look for component - if ( !theRestoring ) { - SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( GetStudyDocument() ); - // create SObject and set attributes - QString aComment; - if(pCutLines) - aComment.sprintf("myComment=%s;mySourceId=CutLines",GetComment()); - else{ - aComment.sprintf("myComment=%s;mySourceId=TableAttr",GetComment()); - SALOMEDS::SObject_var aFatherSObject = SO->GetFather(); - if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){ - SALOMEDS::AttributeString_var aCommentAttr = - SALOMEDS::AttributeString::_narrow(anAttr); - CORBA::String_var aValue = aCommentAttr->Value(); - Storable::TRestoringMap aMap; - Storable::StringToMap(aValue.in(),aMap); - bool anIsExist; - QString aMethodName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist); - if(anIsExist){ - if(aMethodName == "ImportTables"){ - aComment.sprintf("myComment=%s;mySourceId=TableFile",GetComment()); - } - } - } - } - - string anEntry = CreateAttributes( GetStudyDocument(), - SO->GetID(),//SComponent->GetID(), - "ICON_TREE_TABLE", - GetID(), - GetName(), - "", - aComment.toLatin1().constData(), - pCutLines ); - // create SObject referenced to real table object - mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID( anEntry.c_str() )); - if(pCutLines) { - pCutLines->BuildTableOfReal(mySObj); - } - // mpv (PAL5357): reference attributes are unnecessary now - //SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj ); - //Builder->Addreference( refSO, SO ); - } - - return this; - } - return NULL; -} -/*! - Restores table object from stream -*/ -VISU::Storable* VISU::PointMap3d_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO) -{ - if(MYDEBUG) MESSAGE(GetComment()); - SetName(VISU::Storable::FindValue(theMap,"myName").toLatin1().constData(), false); - myTitle = VISU::Storable::FindValue(theMap,"myTitle").toLatin1().constData(); - myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() ); - mySObj = SALOMEDS::SObject::_duplicate(SO); - - //Create PipeLine - myTablePL = VISU_DeformedGridPL::New(); - myTablePL->SetPolyDataIDMapper(GetTableIDMapper()); - myTablePL->Update(); - - //Restore Other Values - - float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble(); - float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble(); - SetRange(aMin, aMax); - - UseFixedRange(VISU::Storable::FindValue(theMap,"myIsFixedRange", "0").toInt()); - - SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt()); - SetUnitsVisible(VISU::Storable::FindValue(theMap,"myUnitsVisible", "1").toInt()); - SetLabelsFormat(VISU::Storable::FindValue(theMap,"myLabelsFormat", "%-#6.3g").toLatin1().constData()); - SetBarOrientation((VISU::ColoredPrs3dBase::Orientation)VISU::Storable::FindValue(theMap,"myBarOrientation").toInt()); - - SetTitle(VISU::Storable::FindValue(theMap,"myTitle").toLatin1().constData()); - myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt(); - myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble(); - myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble(); - myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble(); - myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble(); - myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt(); - myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt(); - myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt(); - myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt(); - myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt(); - myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt(); - - myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt(); - myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt(); - myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt(); - myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt(); - myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat(); - myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat(); - myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat(); - - myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt(); - myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt(); - myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt(); - myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt(); - myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat(); - myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat(); - myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat(); - - myParamsTime.Modified(); - return Build( true ); -} -/*! - Flushes table data into stream -*/ -void VISU::PointMap3d_i::ToStream( std::ostringstream& theStr ) -{ - Storable::DataToStream( theStr, "myName", GetName().c_str() ); - Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); - Storable::DataToStream( theStr, "myOrientation", myOrientation ); - - Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() ); - Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() ); - Storable::DataToStream( theStr, "myIsFixedRange", IsRangeFixed() ); - - Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) ); - Storable::DataToStream( theStr, "myBarOrientation", myBarOrientation ); - - Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); - Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits ); - Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels ); - Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() ); - Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] ); - Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] ); - Storable::DataToStream( theStr, "myWidth", myWidth ); - Storable::DataToStream( theStr, "myHeight", myHeight ); - Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth ); - Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight ); - Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth ); - Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight ); - Storable::DataToStream( theStr, "myBarWidth", myBarWidth ); - Storable::DataToStream( theStr, "myBarHeight", myBarHeight ); - - Storable::DataToStream( theStr, "myTitFontType", myTitFontType ); - Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle ); - Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle ); - Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle ); - Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] ); - Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] ); - Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] ); - - Storable::DataToStream( theStr, "myLblFontType", myLblFontType ); - Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel ); - Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel ); - Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel ); - Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] ); - Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] ); - Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] ); -} -/*! - Called from engine to restore table from the file -*/ -VISU::Storable* VISU::PointMap3d_i::StorableEngine(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap, - const std::string& thePrefix, - CORBA::Boolean theIsMultiFile) -{ - SALOMEDS::Study_var aStudy = theSObject->GetStudy(); - VISU::PointMap3d_i* pResent = new VISU::PointMap3d_i( aStudy, "" ); - return pResent->Restore( theMap, theSObject); -} -/*! - Gets title for the original table object -*/ -QString VISU::PointMap3d_i::GetTableTitle() -{ - SALOMEDS::SObject_var SO = mySObj; - SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeTableOfInteger_var anInt; - SALOMEDS::AttributeTableOfReal_var aReal; - if ( !SO->_is_nil() ) { - if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) { - anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr ); - CORBA::String_var aString = anInt->GetTitle(); - return aString.in(); - } - else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) { - aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr ); - CORBA::String_var aString = aReal->GetTitle(); - return aString.in(); - } - } - return ""; -} - -//--------------------------------------------------------------- -void VISU::PointMap3d_i::RemoveFromStudy() -{ - struct TRemoveFromStudy: public SALOME_Event - { - VISU::PointMap3d_i* myRemovable; - TRemoveFromStudy(VISU::PointMap3d_i* theRemovable): - myRemovable(theRemovable) - {} - - virtual - void - Execute() - { - VISU::RemoveFromStudy(myRemovable->GetSObject(),false); - } - }; - - // Remove the table with all curves - ProcessVoidEvent(new TRemoveFromStudy(this)); -} - -//---------------------------------------------------------------- -void VISU::PointMap3d_i::SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz) -{ - myOffset[0] = theDx; - myOffset[1] = theDy; - myOffset[2] = theDz; - myParamsTime.Modified(); -} - -void VISU::PointMap3d_i::GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz) -{ - theDx = myOffset[0]; - theDy = myOffset[1]; - theDz = myOffset[2]; -} - -CORBA::Float VISU::PointMap3d_i::GetMemorySize() -{ - CORBA::Float aSize = GetSpecificPL()->GetMemorySize(); - - int anEnd = myActorCollection->GetNumberOfItems(); - for(int anId = 0; anId < anEnd; anId++) - if(vtkObject* anObject = myActorCollection->GetItemAsObject(anId)) - if(VISU_Actor* anActor = dynamic_cast(anObject)){ - aSize += anActor->GetMemorySize(); - //cout<<"Prs3d_i::GetMemorySize - "<GetValue(1, 1); - - for (int i=1; i<=aTableOfReal->GetNbColumns(); i++) - for (int j=1; j<=aTableOfReal->GetNbRows(); j++) { - double aVal = aTableOfReal->GetValue(j, i); - if (aVal < aMin) - aMin = aVal; - } - - return aMin; -} - -CORBA::Double VISU::PointMap3d_i::GetMaxTableValue() -{ - SALOMEDS::GenericAttribute_var anAttr; - mySObj->FindAttribute(anAttr, "AttributeTableOfReal"); - SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr); - double aMax = aTableOfReal->GetValue(1, 1); - - for (int i=1; i<=aTableOfReal->GetNbColumns(); i++) - for (int j=1; j<=aTableOfReal->GetNbRows(); j++) { - double aVal = aTableOfReal->GetValue(j, i); - if (aVal > aMax) - aMax = aVal; - } - - return aMax; -} - -CORBA::Double VISU::PointMap3d_i::GetMax() -{ - return myTablePL->GetScalarRange()[1]; -} - -void VISU::PointMap3d_i::SetRange(CORBA::Double theMin, CORBA::Double theMax) -{ - vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetScalarRange, aScalarRange)); - - UseFixedRange(true); -} - -CORBA::Double VISU::PointMap3d_i::GetSourceMin() -{ - vtkFloatingPointType aRange[2]; - GetSpecificPL()->GetSourceRange(aRange); - return aRange[0]; -} - -CORBA::Double VISU::PointMap3d_i::GetSourceMax() -{ - vtkFloatingPointType aRange[2]; - GetSpecificPL()->GetSourceRange(aRange); - return aRange[1]; -} - -void VISU::PointMap3d_i::SetSourceRange() -{ - GetSpecificPL()->SetSourceRange(); - ProcessVoidEvent(new TVoidMemFunEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetSourceRange)); - - UseFixedRange(false); -} - -CORBA::Boolean VISU::PointMap3d_i::IsRangeFixed() -{ - return myIsFixedRange; -} - -void VISU::PointMap3d_i::UseFixedRange(bool theRange) -{ - if(myIsFixedRange == theRange) - return; - - myIsFixedRange = theRange; -} - -void VISU::PointMap3d_i::SetPosition(CORBA::Double theX, CORBA::Double theY) -{ - bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX); - anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY); - if(anIsSameValue) - return; - - myPosition[0] = theX; - myPosition[1] = theY; -} - -CORBA::Double VISU::PointMap3d_i::GetPosX() -{ - return myPosition[0]; -} - -CORBA::Double VISU::PointMap3d_i::GetPosY() -{ - return myPosition[1]; -} - -void VISU::PointMap3d_i::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) -{ - bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth); - anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight); - if(anIsSameValue) - return; - - myWidth = theWidth; - myHeight = theHeight; -} - -CORBA::Double VISU::PointMap3d_i::GetHeight() -{ - return myHeight; -} - -CORBA::Double VISU::PointMap3d_i::GetWidth() -{ - return myWidth; -} - -void VISU::PointMap3d_i::SetNbColors(CORBA::Long theNbColors) -{ - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetNbColors, theNbColors)); -} - -CORBA::Long VISU::PointMap3d_i::GetNbColors() -{ - return GetSpecificPL()->GetNbColors(); -} - -void VISU::PointMap3d_i::SetLabels(CORBA::Long theNbLabels) -{ - if(myNumberOfLabels == theNbLabels) - return; - - myNumberOfLabels = theNbLabels; -} - -CORBA::Long VISU::PointMap3d_i::GetLabels() -{ - return myNumberOfLabels; -} - -void VISU::PointMap3d_i::SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theBarOrientation) -{ - if(myBarOrientation == theBarOrientation) - return; - - myBarOrientation = theBarOrientation; -} - -VISU::ColoredPrs3dBase::Orientation VISU::PointMap3d_i::GetBarOrientation() -{ - return myBarOrientation; -} - -//------------------- ScaledPrs3d Methods ----------------------- - -void VISU::PointMap3d_i::SetScaling(VISU::Scaling theScaling) -{ - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetScaling, theScaling)); -} - -VISU::Scaling VISU::PointMap3d_i::GetScaling() -{ - return VISU::Scaling(GetSpecificPL()->GetScaling()); -} - -//------------------- Check Table on Positive Values ------------ -bool VISU::PointMap3d_i::IsPositiveTable() -{ - SALOMEDS::GenericAttribute_var anAttr; - mySObj->FindAttribute(anAttr, "AttributeTableOfReal"); - SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr); - - for (int i=1; i<=aTableOfReal->GetNbColumns(); i++) - for (int j=1; j<=aTableOfReal->GetNbRows(); j++) { - double aVal = aTableOfReal->GetValue(j, i); - if (aVal < 0) - return false; - } - - return true; -} - -//------------------- Plot3dBase Methods ------------------------ - -void VISU::PointMap3d_i::SetScaleFactor (CORBA::Double theScaleFactor) -{ - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetScaleFactor, theScaleFactor)); -} - -CORBA::Double VISU::PointMap3d_i::GetScaleFactor () -{ - return myTablePL->GetScaleFactor(); -} - -void VISU::PointMap3d_i::SetContourPrs (CORBA::Boolean theIsContourPrs ) -{ - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetContourPrs, theIsContourPrs)); -} - -CORBA::Boolean VISU::PointMap3d_i::GetIsContourPrs() -{ - return myTablePL->GetIsContourPrs(); -} - -void VISU::PointMap3d_i::SetNbOfContours (CORBA::Long theNb) -{ - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (GetSpecificPL(), &VISU_DeformedGridPL::SetNumberOfContours, theNb)); -} - -CORBA::Long VISU::PointMap3d_i::GetNbOfContours () -{ - return myTablePL->GetNumberOfContours(); -} - -//-------------------- Actor Factory Methods -------------------- - -bool VISU::PointMap3d_i::GetActiveState () -{ - return myIsActiveState; -} - -void VISU::PointMap3d_i::SetActiveState ( bool theState ) -{ - myIsActiveState = theState; -} - -void VISU::PointMap3d_i::RemoveActor (VISU_ActorBase* theActor) -{ - myActorCollection->RemoveItem(theActor); -} - -void VISU::PointMap3d_i::RemoveActors () -{ - ProcessVoidEvent(new TInvokeSignalEvent(myRemoveActorsFromRendererSignal)); - myActorCollection->RemoveAllItems(); -} - - -//-----------------------Text Properties & Label Properties------------------ -bool VISU::PointMap3d_i::IsBoldTitle() -{ - return myIsBoldTitle; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetBoldTitle(bool theIsBoldTitle) -{ - if(myIsBoldTitle == theIsBoldTitle) - return; - - myIsBoldTitle = theIsBoldTitle; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -bool VISU::PointMap3d_i::IsItalicTitle() -{ - return myIsItalicTitle; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetItalicTitle(bool theIsItalicTitle) -{ - if(myIsItalicTitle == theIsItalicTitle) - return; - - myIsItalicTitle = theIsItalicTitle; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -bool VISU::PointMap3d_i::IsShadowTitle() -{ - return myIsShadowTitle; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetShadowTitle(bool theIsShadowTitle) -{ - if(myIsShadowTitle == theIsShadowTitle) - return; - - myIsShadowTitle = theIsShadowTitle; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -int VISU::PointMap3d_i::GetTitFontType() -{ - return myTitFontType; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetTitFontType(int theTitFontType) -{ - if(myTitFontType == theTitFontType) - return; - - myTitFontType = theTitFontType; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::GetTitleColor(vtkFloatingPointType& theR, - vtkFloatingPointType& theG, - vtkFloatingPointType& theB) -{ - theR = myTitleColor[0]; - theG = myTitleColor[1]; - theB = myTitleColor[2]; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetTitleColor(vtkFloatingPointType theR, - vtkFloatingPointType theG, - vtkFloatingPointType theB) -{ - bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR); - anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG); - anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB); - if(anIsSameValue) - return; - - myTitleColor[0] = theR; - myTitleColor[1] = theG; - myTitleColor[2] = theB; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -bool VISU::PointMap3d_i::IsBoldLabel() -{ - return myIsBoldLabel; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetBoldLabel(bool theIsBoldLabel) -{ - if(myIsBoldLabel == theIsBoldLabel) - return; - - myIsBoldLabel = theIsBoldLabel; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -bool VISU::PointMap3d_i::IsItalicLabel() -{ - return myIsItalicLabel; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetItalicLabel(bool theIsItalicLabel) -{ - if(myIsItalicLabel == theIsItalicLabel) - return; - - myIsItalicLabel = theIsItalicLabel; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -bool VISU::PointMap3d_i::IsShadowLabel() -{ - return myIsShadowLabel; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetShadowLabel(bool theIsShadowLabel) -{ - if(myIsShadowLabel == theIsShadowLabel) - return; - - myIsShadowLabel = theIsShadowLabel; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -int VISU::PointMap3d_i::GetLblFontType() -{ - return myLblFontType; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetLblFontType(int theLblFontType) -{ - if(myLblFontType == theLblFontType) - return; - - myLblFontType = theLblFontType; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::GetLabelColor(vtkFloatingPointType& theR, - vtkFloatingPointType& theG, - vtkFloatingPointType& theB) -{ - theR = myLabelColor[0]; - theG = myLabelColor[1]; - theB = myLabelColor[2]; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetLabelColor(vtkFloatingPointType theR, - vtkFloatingPointType theG, - vtkFloatingPointType theB) -{ - bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR); - anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG); - anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB); - if(anIsSameValue) - return; - - myLabelColor[0] = theR; - myLabelColor[1] = theG; - myLabelColor[2] = theB; - myParamsTime.Modified(); -} - -//---------------------------------------------------------------------------- -CORBA::Long VISU::PointMap3d_i::GetTitleWidth() -{ - return myTitleWidth; -} - -//---------------------------------------------------------------------------- -CORBA::Long VISU::PointMap3d_i::GetTitleHeight() -{ - return myTitleHeight; -} - -//---------------------------------------------------------------------------- -CORBA::Long VISU::PointMap3d_i::GetLabelWidth() -{ - return myLabelWidth; -} - -//---------------------------------------------------------------------------- -CORBA::Long VISU::PointMap3d_i::GetLabelHeight() -{ - return myLabelHeight; -} - -//---------------------------------------------------------------------------- -CORBA::Long VISU::PointMap3d_i::GetBarWidth() -{ - return myBarWidth; -} - -//---------------------------------------------------------------------------- -CORBA::Long VISU::PointMap3d_i::GetBarHeight() -{ - return myBarHeight; -} - -//---------------------------------------------------------------------------- -void -VISU::PointMap3d_i::SetLabelsFormat(const char* theFormat) -{ - if( myLabelsFormat != theFormat ){ - myLabelsFormat = theFormat; - myParamsTime.Modified(); - } -} - -//---------------------------------------------------------------------------- -char* VISU::PointMap3d_i::GetLabelsFormat() -{ - return CORBA::string_dup(myLabelsFormat.c_str()); -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetUnitsVisible(CORBA::Boolean isVisible) -{ - if( myIsUnits != isVisible ){ - myIsUnits = isVisible; - myParamsTime.Modified(); - } -} - -//---------------------------------------------------------------------------- -CORBA::Boolean VISU::PointMap3d_i::IsUnitsVisible() -{ - return myIsUnits; -} - -//---------------------------------------------------------------------------- -void VISU::PointMap3d_i::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight, - CORBA::Long theLabelWidth, CORBA::Long theLabelHeight, - CORBA::Long theBarWidth, CORBA::Long theBarHeight) -{ - bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth); - anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight); - anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth); - anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight); - anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth); - anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight); - if(anIsSameValue) - return; - - myTitleWidth = theTitleWidth; - myTitleHeight = theTitleHeight; - myLabelWidth = theLabelWidth; - myLabelHeight = theLabelHeight; - myBarWidth = theBarWidth; - myBarHeight = theBarHeight; - myParamsTime.Modified(); -} diff --git a/src/VISU_I/VISU_PointMap3d_i.hh b/src/VISU_I/VISU_PointMap3d_i.hh deleted file mode 100644 index 593721ec..00000000 --- a/src/VISU_I/VISU_PointMap3d_i.hh +++ /dev/null @@ -1,272 +0,0 @@ -// VISU OBJECT : interactive object for VISU entities implementation -// -// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// File : VISU_PointMap3d_i.hh -// Author : -// Module : VISU - -#ifndef VISU_PointMap3d_i_HeaderFile -#define VISU_PointMap3d_i_HeaderFile - -#include "VISU_PrsObject_i.hh" -#include "SALOME_GenericObj_i.hh" - -#include "VISU_TableReader.hxx" -#include "VISU_PointMap3dActor.h" -#include "VISU_Table_i.hh" -#include "VISU_ActorFactory.h" -#include "VISU_DeformedGridPL.hxx" - -#include -#include - -namespace VISU -{ - - struct TActorFactory; - - //============================================================================== - class VISU_I_EXPORT PointMap3d_i : public virtual POA_VISU::PointMap3d, - public virtual SALOME::GenericObj_i, - public virtual TActorFactory, - public virtual Table_i - { - static int myNbPresent; - PointMap3d_i( const PointMap3d_i& ); - public: - PointMap3d_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry); - - virtual ~PointMap3d_i(); - virtual VISU::VISUType GetType() { return VISU::TPOINTMAP3D;}; - - virtual void SetTitle( const char* theTitle ); - virtual char* GetTitle(); - - virtual void RemoveFromStudy(); - virtual void UpdateActor(VISU_ActorBase* thePointMap3dActor); - virtual void UpdateActors(); - - virtual void Update(); - - virtual Handle(SALOME_InteractiveObject) GetIO(); - - //----------- override Prs3d methods ----------------------------- - - //! Move the 3D presentation according to the given offset parameters - virtual void SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz); - - //! Gets offset parameters for the 3D presentation - virtual void GetOffset(CORBA::Float& theDx, CORBA::Float& theDy, CORBA::Float& theDz); - - //! Gets memory size actually used by the presentation (Mb). - virtual CORBA::Float GetMemorySize(); - - //----------- override ColoredPrs3dBase methods ------------------ - - virtual CORBA::Double GetMin(); - virtual CORBA::Double GetMax(); - virtual CORBA::Double GetMinTableValue(); - virtual CORBA::Double GetMaxTableValue(); - virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax); - - virtual CORBA::Double GetSourceMin(); - virtual CORBA::Double GetSourceMax(); - virtual void SetSourceRange(); - - virtual CORBA::Boolean IsRangeFixed(); - - virtual void SetPosition(CORBA::Double X, CORBA::Double Y); - virtual CORBA::Double GetPosX(); - virtual CORBA::Double GetPosY(); - - virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight); - - virtual void SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight, - CORBA::Long theLabelWidth, CORBA::Long theLabelHeight, - CORBA::Long theBarWidth, CORBA::Long theBarHeight); - - virtual CORBA::Double GetWidth(); - virtual CORBA::Double GetHeight(); - - virtual void SetNbColors(CORBA::Long theNbColors); - virtual CORBA::Long GetNbColors(); - - virtual void SetLabels(CORBA::Long theNbLabels); - virtual CORBA::Long GetLabels(); - - virtual void SetLabelsFormat(const char* theFormat); - virtual char* GetLabelsFormat(); - - virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation); - virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation(); - - void UseFixedRange(bool theUseFixedRange); - - // ScaledMap Methods - - virtual VISU::Scaling GetScaling(); - virtual void SetScaling(VISU::Scaling theScaling); - - bool IsPositiveTable(); - - // Plot3dBase methods - - void SetScaleFactor (CORBA::Double theScaleFactor); - CORBA::Double GetScaleFactor(); - - void SetContourPrs (CORBA::Boolean theIsContourPrs ); - CORBA::Boolean GetIsContourPrs(); - - void SetNbOfContours (CORBA::Long); - CORBA::Long GetNbOfContours(); - - VISU_DeformedGridPL* GetSpecificPL() const { return myTablePL; } - - // TActorFactory Methods - - //! Gets know whether the factory instance can be used for actor management or not - virtual bool GetActiveState(); - - virtual void SetActiveState(bool theState); - - //! Return modified time of the factory - virtual unsigned long int GetMTime(); - - //! To unregister the actor - virtual void RemoveActor(VISU_ActorBase* theActor); - virtual void RemoveActors(); - - //------ Text Properties & Label Properties ------------------------ - - virtual bool IsBoldTitle(); - virtual void SetBoldTitle(bool isBold); - virtual bool IsItalicTitle(); - virtual void SetItalicTitle(bool isItalic); - virtual bool IsShadowTitle(); - virtual void SetShadowTitle(bool isShadow); - virtual int GetTitFontType(); - virtual void SetTitFontType(int theType); - virtual void GetTitleColor(vtkFloatingPointType& theR, - vtkFloatingPointType& theG, - vtkFloatingPointType& theB); - virtual void SetTitleColor(vtkFloatingPointType theR, - vtkFloatingPointType theG, - vtkFloatingPointType theB); - - virtual bool IsBoldLabel(); - virtual void SetBoldLabel(bool isBold); - virtual bool IsItalicLabel(); - virtual void SetItalicLabel(bool isItalic); - virtual bool IsShadowLabel(); - virtual void SetShadowLabel(bool isShadow); - virtual int GetLblFontType(); - virtual void SetLblFontType(int theType); - virtual void GetLabelColor(vtkFloatingPointType& theR, - vtkFloatingPointType& theG, - vtkFloatingPointType& theB); - virtual void SetLabelColor(vtkFloatingPointType theR, - vtkFloatingPointType theG, - vtkFloatingPointType theB); - - //------------------------------------------------------------------- - virtual CORBA::Long GetTitleWidth(); - virtual CORBA::Long GetTitleHeight(); - virtual CORBA::Long GetLabelWidth(); - virtual CORBA::Long GetLabelHeight(); - virtual CORBA::Long GetBarWidth(); - virtual CORBA::Long GetBarHeight(); - - virtual void SetUnitsVisible(CORBA::Boolean isVisible); - virtual CORBA::Boolean IsUnitsVisible(); - - //------------------------------------------------------------------- - - protected: - Storable* Build(int theRestoring); - - VISU::Table::Orientation myOrientation; - VISU::ColoredPrs3dBase::Orientation myBarOrientation; - std::string myTitle; - std::string myScalarBarTitle; - bool myIsUnits; - SALOMEDS::SObject_var mySObj; - int myNumberOfLabels; - std::string myLabelsFormat; - vtkFloatingPointType myPosition[2], - myWidth, myHeight, - myTitleWidth, myTitleHeight, - myLabelWidth, myLabelHeight, - myBarWidth, myBarHeight; - bool myIsFixedRange; - CORBA::Float myOffset[3]; - bool myIsActiveState; - vtkTimeStamp myParamsTime; - vtkTimeStamp myUpdateTime; - - Handle(SALOME_InteractiveObject) myIO; - - - //Font management - bool myIsBoldTitle; - bool myIsItalicTitle; - bool myIsShadowTitle; - int myTitFontType; - vtkFloatingPointType myTitleColor[3]; - - bool myIsBoldLabel; - bool myIsItalicLabel; - bool myIsShadowLabel; - int myLblFontType; - vtkFloatingPointType myLabelColor[3]; - - boost::signal0 myUpdateActorsSignal; - boost::signal0 myRemoveActorsFromRendererSignal; - vtkSmartPointer myActorCollection; - - public: - // virtual Storable* Create( const VISU::PTableIDMapper& theTableIDMapper ); - virtual Storable* Create(); - VISU_PointMap3dActor* CreateActor(); - VISU::PTableIDMapper GetTableIDMapper(); - - SALOMEDS::SObject_var GetSObject() const; - VISU_DeformedGridPL* myTablePL; - - virtual Storable* Restore( const Storable::TRestoringMap& theMap, - SALOMEDS::SObject_ptr SO); - - static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject, - const Storable::TRestoringMap& theMap, - const std::string& thePrefix, - CORBA::Boolean theIsMultiFile); - - virtual void ToStream( std::ostringstream& theStr ); - static const std::string myComment; - virtual const char* GetComment() const; - virtual QString GenerateName(); - virtual QString GetTableTitle(); - - virtual std::string GetObjectEntry(); - }; -} - -#endif diff --git a/src/VISU_I/VISU_Prs3dUtils.cc b/src/VISU_I/VISU_Prs3dUtils.cc index 652e781e..fd5bebd1 100644 --- a/src/VISU_I/VISU_Prs3dUtils.cc +++ b/src/VISU_I/VISU_Prs3dUtils.cc @@ -70,6 +70,59 @@ namespace VISU ProcessVoidEvent(new TEvent(this)); } + //---------------------------------------------------------------------------- + + std::string ToFormat( const int thePrec ) + { + // "%-#6.3g" + char str[ 255 ]; + sprintf( str, "%%-#.%dg", thePrec ); + return str; + } //---------------------------------------------------------------------------- + + int ToPrecision( const char* theFormat ) + { + int N = strlen( theFormat ); + int k = -1; + char str[ 255 ]; + bool isOk = false; + for ( int i = 0; i < N; i++ ) + { + if ( theFormat[ i ] == '.' ) + k = 0; + else if ( theFormat[ i ] == 'g' ) + { + str[ k ] = 0; + isOk = true; + break; + } + else if ( k >= 0 ) + str[ k++ ] = theFormat[ i ]; + } + + int res = 0; + if ( isOk ) + res = atoi( str ); + + return res; + } }; + + + + + + + + + + + + + + + + + diff --git a/src/VISU_I/VISU_Prs3dUtils.hh b/src/VISU_I/VISU_Prs3dUtils.hh index 2f4bf8b9..5c300342 100644 --- a/src/VISU_I/VISU_Prs3dUtils.hh +++ b/src/VISU_I/VISU_Prs3dUtils.hh @@ -31,7 +31,6 @@ #include - namespace VISU { //---------------------------------------------------------------------------- @@ -44,6 +43,9 @@ namespace VISU ~TSetModified(); }; + Standard_EXPORT std::string ToFormat( const int thePrec ); + Standard_EXPORT int ToPrecision( const char* theFormat ); + //---------------------------------------------------------------------------- } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 55e2bd1d..d0cf322e 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -593,6 +593,12 @@ GetClippingPlane(vtkIdType theID) const return GetPipeLine()->GetClippingPlane(theID); } +//---------------------------------------------------------------------------- +void VISU::Prs3d_i::RemoveClippingPlane(vtkIdType theID) +{ + GetPipeLine()->RemoveClippingPlane(theID); +} + //---------------------------------------------------------------------------- void VISU::Prs3d_i diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index 461df40f..60fd16af 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -223,6 +223,8 @@ namespace VISU vtkPlane* GetClippingPlane(vtkIdType theID) const; + void RemoveClippingPlane(vtkIdType theID); + void SetPlaneParam(vtkFloatingPointType theDir[3], vtkFloatingPointType theDist, diff --git a/src/VISU_I/VISU_ResultUtils.cc b/src/VISU_I/VISU_ResultUtils.cc index 2ba4a286..d80281d4 100644 --- a/src/VISU_I/VISU_ResultUtils.cc +++ b/src/VISU_I/VISU_ResultUtils.cc @@ -48,6 +48,8 @@ static int MYTIMEDEBUG = 0; static int MYTIMEDEBUG = 0; #endif +using namespace std; + namespace VISU { //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 2d8e89da..5d47138b 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -69,6 +69,7 @@ static int MYDEBUG = 1; static int MYDEBUG = 0; #endif +using namespace std; namespace VISU { @@ -799,10 +800,9 @@ VISU::Result_i if(MYDEBUG) MESSAGE("Result_i::Restore - aFileName = " << myFileInfo.filePath().toLatin1().data() << "; " << myFileInfo.isFile()); - const char* aPathLatin = myFileInfo.filePath().toLatin1().data(); - if (HDFascii::isASCII(aPathLatin)) { - MESSAGE("ConvertFromASCIIToHDF(" << aPathLatin << ")"); - char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aPathLatin); + if (HDFascii::isASCII(myFileInfo.filePath().toLatin1().data())) { + MESSAGE("ConvertFromASCIIToHDF(" << myFileInfo.filePath().toLatin1().data() << ")"); + char* aResultPath = HDFascii::ConvertFromASCIIToHDF(myFileInfo.filePath().toLatin1().data()); MESSAGE("ConvertFromASCIIToHDF() DONE : " << aResultPath); char* aHDFFileName = new char[strlen(aResultPath) + 19]; sprintf(aHDFFileName, "%shdf_from_ascii.hdf", aResultPath); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc new file mode 100644 index 00000000..ac6a8322 --- /dev/null +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -0,0 +1,404 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : VISU_ScalarMapOnDeformedShape_i.cc +// Author : Eugeny Nikolaev +// Module : VISU + +#include "VISU_ScalarMapOnDeformedShape_i.hh" +#include "VISU_Prs3dUtils.hh" +#include "VISU_Result_i.hh" + +#include "VISU_ScalarMapAct.h" +#include "VISU_ScalarMapOnDeformedShapePL.hxx" +#include "VISU_Convertor.hxx" + +#include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" + +#include +#include +#include + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +static int INCMEMORY = 4+12; + + +//--------------------------------------------------------------- +size_t +VISU::ScalarMapOnDeformedShape_i +::IsPossible(Result_i* theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck) +{ + size_t aResult = 0; + try{ + aResult = TSuperClass::IsPossible(theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber, + false); + if(theIsMemoryCheck && aResult){ + VISU::Result_i::PInput anInput = theResult->GetInput(theMeshName, + theEntity, + theFieldName, + theTimeStampNumber); + VISU::PField aField = anInput->GetField(theMeshName, + (VISU::TEntity)theEntity, + theFieldName); + if(aField->myNbComp <= 1) + return 0; + + bool anIsEstimated = true; + size_t aSize = anInput->GetTimeStampOnMeshSize(theMeshName, + (VISU::TEntity)theEntity, + theFieldName, + theTimeStampNumber, + anIsEstimated); + if(anIsEstimated) + aSize *= INCMEMORY; + aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + if(MYDEBUG) + MESSAGE("ScalarMapOnDeformedShape_i::IsPossible - CheckAvailableMemory = "<(theOrigin)){ + ScalarMapOnDeformedShape_i* anOrigin = const_cast(aPrs3d); + CORBA::String_var aFieldName = anOrigin->GetScalarFieldName(); + + SetScalarField(anOrigin->GetScalarEntity(), + aFieldName, + anOrigin->GetScalarTimeStampNumber()); + Update(); + } +} + + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::SetScale(CORBA::Double theScale) +{ + VISU::TSetModified aModified(this); + + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScale, theScale)); +} + + +//--------------------------------------------------------------- +CORBA::Double +VISU::ScalarMapOnDeformedShape_i +::GetScale() +{ + return myScalarMapOnDeformedShapePL->GetScale(); +} + + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::CreatePipeLine(VISU_PipeLine* thePipeLine) +{ + if(!thePipeLine){ + myScalarMapOnDeformedShapePL = VISU_ScalarMapOnDeformedShapePL::New(); + }else + myScalarMapOnDeformedShapePL = dynamic_cast(thePipeLine); + + myScalarMapOnDeformedShapePL->GetMapper()->SetScalarVisibility(1); + + TSuperClass::CreatePipeLine(myScalarMapOnDeformedShapePL); +} + + +//--------------------------------------------------------------- +bool +VISU::ScalarMapOnDeformedShape_i +::CheckIsPossible() +{ + return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); +} + + +//--------------------------------------------------------------- +VISU_Actor* +VISU::ScalarMapOnDeformedShape_i +::CreateActor() +{ + VISU_Actor* anActor = TSuperClass::CreateActor(true); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2); + bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false); + anActor->SetRepresentation(aDispMode); + if (toShrink) + anActor->SetShrink(); + anActor->SetVTKMapping(false); + return anActor; +} + + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::UpdateActor(VISU_Actor* theActor) +{ + if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ + anActor->SetBarVisibility(true); + GetPipeLine()->GetMapper()->SetScalarVisibility(1); + } + TSuperClass::UpdateActor(theActor); +} + + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::SetField(VISU::PField theField) +{ + TSuperClass::SetField(theField); + + if(!myScalarField) + myScalarField = theField; +} + + +//--------------------------------------------------------------- +void +VISU::ScalarMapOnDeformedShape_i +::SetScalarField(VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theTimeStampNumber) +{ + bool anIsModified = false; + + if(!anIsModified) + anIsModified |= myScalarEntity != theEntity; + + if(!anIsModified) + anIsModified |= myScalarFieldName != theFieldName; + + if(!anIsModified) + anIsModified |= myScalarTimeStampNumber != theTimeStampNumber; + + if(!anIsModified) + return; + + VISU::TSetModified aModified(this); + + VISU::TEntity aEntity = VISU::TEntity(theEntity); + VISU::Result_i::PInput anInput = GetCResult()->GetInput(GetCMeshName(), + theEntity, + theFieldName, + theTimeStampNumber); + myScalarField = anInput->GetField(GetCMeshName(), aEntity, theFieldName); + + VISU::PUnstructuredGridIDMapper anIDMapper = + anInput->GetTimeStampOnMesh(GetCMeshName(), + aEntity, + theFieldName, + theTimeStampNumber); + + vtkUnstructuredGrid* anOutput = anIDMapper->GetUnstructuredGridOutput(); + if(myScalarMapOnDeformedShapePL && anOutput) + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScalars, anOutput)); + + myScalarEntity = theEntity; + myScalarFieldName = theFieldName; + myScalarTimeStampNumber = theTimeStampNumber; + + SetTitle(theFieldName); + SetScalarMode(GetScalarMode()); + if(!IsRangeFixed() && IsPipeLineExists()) + SetSourceRange(); + + myParamsTime.Modified(); +} + + +//--------------------------------------------------------------- +VISU::Entity +VISU::ScalarMapOnDeformedShape_i +::GetScalarEntity() +{ + return myScalarEntity; +} + + +//--------------------------------------------------------------- +char* +VISU::ScalarMapOnDeformedShape_i +::GetScalarFieldName() +{ + return CORBA::string_dup(myScalarFieldName.c_str()); +} + + +//--------------------------------------------------------------- +CORBA::Long +VISU::ScalarMapOnDeformedShape_i +::GetScalarTimeStampNumber() +{ + return myScalarTimeStampNumber; +} + + +//--------------------------------------------------------------- +VISU::PField +VISU::ScalarMapOnDeformedShape_i +::GetScalarField() +{ + return myScalarField; +} diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh new file mode 100644 index 00000000..83f2e64d --- /dev/null +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -0,0 +1,179 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File: VISU_ScalarMapOnDeformedShape_i.hh +// Author: Eugeny Nikolaev +// Module : VISU + +#ifndef VISU_ScalarMapOnDeformedShape_i_HeaderFile +#define VISU_ScalarMapOnDeformedShape_i_HeaderFile + +#include "VISU_ScalarMap_i.hh" + +class VISU_ScalarMapOnDeformedShapePL; + +namespace VISU +{ + //---------------------------------------------------------------------------- + //! Class of Scalar Map on Deformed Shape presentation. + class VISU_I_EXPORT ScalarMapOnDeformedShape_i : public virtual POA_VISU::ScalarMapOnDeformedShape, + public virtual ScalarMap_i + { + static int myNbPresent; + ScalarMapOnDeformedShape_i(const ScalarMapOnDeformedShape_i&); + + public: + //---------------------------------------------------------------------------- + typedef ScalarMap_i TSuperClass; + typedef VISU::ScalarMapOnDeformedShape TInterface; + + explicit + ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyModep); + + virtual + ~ScalarMapOnDeformedShape_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TSCALARMAPONDEFORMEDSHAPE; + } + + virtual + void + SetScale(CORBA::Double theScale); + + virtual + CORBA::Double + GetScale(); + + virtual + void + SameAs(const Prs3d_i* theOrigin); + + VISU_ScalarMapOnDeformedShapePL* + GetSpecificPL() + { + return myScalarMapOnDeformedShapePL; + } + + protected: + //! Redefines VISU_ColoredPrs3d_i::SetField + virtual + void + SetField(VISU::PField theField); + + //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine + virtual + void + CreatePipeLine(VISU_PipeLine* thePipeLine); + + //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible + virtual + bool + CheckIsPossible(); + + public: + //! Redefines VISU_ColoredPrs3d_i::IsPossible + static + size_t + IsPossible(Result_i* theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theTimeStampNumber, + bool theIsMemoryCheck); + + //! Redefines VISU_ColoredPrs3d_i::IsPossible + virtual + Storable* + Create(const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theTimeStampNumber); + + //! Redefines VISU_ColoredPrs3d_i::ToStream + virtual + void + ToStream(std::ostringstream& theStr); + + //! Redefines VISU_ColoredPrs3d_i::Restore + virtual + Storable* + Restore(SALOMEDS::SObject_ptr theSObject, + const Storable::TRestoringMap& theMap); + + static const std::string myComment; + + virtual + const char* + GetComment() const; + + virtual + QString + GenerateName(); + + virtual + const char* + GetIconName(); + + virtual + VISU_Actor* + CreateActor(); + + virtual + void + UpdateActor(VISU_Actor* theActor) ; + + virtual + void + SetScalarField(VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theTimeStampNumber); + + virtual + VISU::Entity + GetScalarEntity(); + + virtual + char* + GetScalarFieldName(); + + virtual + CORBA::Long + GetScalarTimeStampNumber(); + + virtual + VISU::PField + GetScalarField(); + + private: + VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL; + + PField myScalarField; + VISU::Entity myScalarEntity; + std::string myScalarFieldName; + CORBA::Long myScalarTimeStampNumber; + }; +} +#endif diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index f0aba10a..85e40ce6 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -53,6 +53,7 @@ static int MYDEBUG = 0; static int INCMEMORY = 4; +using namespace std; //---------------------------------------------------------------------------- size_t @@ -171,7 +172,8 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU::ScalarMap_i:: ScalarMap_i(EPublishInStudyMode thePublishInStudyMode) : - ColoredPrs3d_i(thePublishInStudyMode) + ColoredPrs3d_i(thePublishInStudyMode), + myShowBar(true) {} //---------------------------------------------------------------------------- @@ -191,7 +193,7 @@ VISU::ScalarMap_i ScalarMap_i* anOrigin = const_cast(aPrs3d); SetScaling(anOrigin->GetScaling()); - + SetBarVisible(anOrigin->IsBarVisible()); Update(); } } @@ -217,6 +219,7 @@ VISU::ScalarMap_i else SetScaling(VISU::LINEAR); + myShowBar = true; return this; } @@ -239,6 +242,9 @@ VISU::ScalarMap_i SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt())); + QString aVal = VISU::Storable::FindValue(theMap,"myShowBar", "1"); + SetBarVisible((aVal.toInt() == 1)? true : false); + // Check if the icon needs to be updated, update if necessary SALOMEDS::Study_var aStudy = theSObject->GetStudy(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); @@ -261,6 +267,7 @@ VISU::ScalarMap_i TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myScaling", GetScaling() ); + Storable::DataToStream( theStr, "myShowBar", (IsBarVisible()? 1:0) ); } @@ -362,6 +369,14 @@ VISU::ScalarMap_i return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); } +void VISU::ScalarMap_i::SetBarVisible(CORBA::Boolean theVisible) +{ + if (myShowBar == theVisible) + return; + VISU::TSetModified aModified(this); + myShowBar = theVisible; + myParamsTime.Modified(); +} //---------------------------------------------------------------------------- void @@ -378,14 +393,6 @@ VISU::ScalarMap_i TSuperClass::CreatePipeLine(myScalarMapPL); } -//---------------------------------------------------------------------------- -void -VISU::ScalarMap_i -::SetMapScale(double theMapScale) -{ - GetSpecificPL()->SetMapScale(theMapScale); -} - //---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i @@ -394,7 +401,7 @@ VISU::ScalarMap_i VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New(); try{ TSuperClass::CreateActor(anActor); - anActor->SetBarVisibility(true); + anActor->SetBarVisibility(myShowBar); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "scalar_map_represent", 2); bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false); @@ -402,6 +409,14 @@ VISU::ScalarMap_i anActor->SetRepresentation(aDispMode); if (toShrink && !toSupressShrinking) anActor->SetShrink(); anActor->SetShading(toUseShading); + + anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) ); + anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false), + aResourceMgr->booleanValue("VISU", "show_boundary_edges", false), + aResourceMgr->booleanValue("VISU", "show_manifold_edges", false), + aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) ); + anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) ); + UpdateActor(anActor); }catch(...){ anActor->Delete(); @@ -424,16 +439,28 @@ VISU::ScalarMap_i ::UpdateActor(VISU_ActorBase* theActor) { if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ + VISU_LookupTable * aLookupTable = GetSpecificPL()->GetBarTable(); + + if ( IsScalarFilterUsed() ) { + aLookupTable->ForceBuild(); + static unsigned char MARK_COLOR[] = { 255, 255, 255 }; + aLookupTable->MarkValueByColor( GetScalarFilterMin(), MARK_COLOR ); + aLookupTable->MarkValueByColor( GetScalarFilterMax(), MARK_COLOR ); + } + VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar(); - aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable()); + aScalarBar->SetLookupTable( aLookupTable ); + + aScalarBar->SetDistribution( GetSpecificPL()->GetDistribution() ); + aScalarBar->SetDistributionVisibility( GetIsDistributionVisible() ); + aScalarBar->SetTitle(GetScalarBarTitle().c_str()); aScalarBar->SetOrientation(GetBarOrientation()); aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport(); aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY()); aScalarBar->SetWidth(GetWidth()); aScalarBar->SetHeight(GetHeight()); - aScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(), - GetLabelWidth(), GetLabelHeight(), + aScalarBar->SetRatios(GetTitleSize(), GetLabelSize(), GetBarWidth(), GetBarHeight()); aScalarBar->SetNumberOfLabels(GetLabels()); aScalarBar->SetLabelFormat(GetLabelsFormat()); @@ -460,7 +487,25 @@ VISU::ScalarMap_i IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); + anActor->SetBarVisibility(myShowBar); + aScalarBar->Modified(); + + // Update values labels + + vtkTextProperty* aProp = anActor->GetsValLabelsProps(); + if ( aProp ) + { + aProp->SetFontFamily( GetValLblFontType() ); + aProp->SetFontSize( GetValLblFontSize() ); + aProp->SetBold( IsBoldValLbl() ); + aProp->SetItalic( IsItalicValLbl() ); + aProp->SetShadow( IsShadowValLbl() ); + + vtkFloatingPointType anRGB[ 3 ]; + GetValLblFontColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] ); + aProp->SetColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] ); + } } TSuperClass::UpdateActor(theActor); } diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 44a7ba96..4a74f9df 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -98,6 +98,10 @@ namespace VISU { return myScalarMapPL; } + + virtual CORBA::Boolean IsBarVisible() { return myShowBar; } + + virtual void SetBarVisible(CORBA::Boolean theVisible); protected: //! Redefines VISU_ColoredPrs3d_i::DoSetInput @@ -163,10 +167,6 @@ namespace VISU Restore(SALOMEDS::SObject_ptr theSObject, const Storable::TRestoringMap& theMap); - virtual - void - SetMapScale(double theMapScale = 1.0); - virtual void SameAs(const Prs3d_i* theOrigin); @@ -193,6 +193,7 @@ namespace VISU private: VISU_ScalarMapPL* myScalarMapPL; + bool myShowBar; }; } diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 01ebfa16..6b0d58ac 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -45,6 +45,7 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +using namespace std; //--------------------------------------------------------------- size_t diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 0910d8dc..4cbc5cc0 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -38,6 +38,8 @@ #include "utilities.h" +using namespace std; + #ifdef _DEBUG_ static int MYDEBUG = 0; #else @@ -514,6 +516,14 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring ) true ); // create SObject referenced to real table object mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID(anEntry.c_str())); + + // Set icon + SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + anAttr = aStudyBuilder->FindOrCreateAttribute( mySObj, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + aPixmap ->SetPixMap("ICON_TREE_CURVE"); } return this; } @@ -1029,6 +1039,14 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring ) aComment.toLatin1().data(), true ); mySObj = SALOMEDS::SObject::_duplicate(GetStudyDocument()->FindObjectID(anEntry.c_str())); + + // Set icon + SALOMEDS::StudyBuilder_var aStudyBuilder = GetStudyDocument()->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + anAttr = aStudyBuilder->FindOrCreateAttribute( mySObj, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + aPixmap ->SetPixMap("ICON_TREE_CONTAINER"); } return this; } diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 0fc2b12e..13be9942 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -81,6 +81,7 @@ #include #endif +using namespace std; //------------------------------------------------------------------------ namespace VISU diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index 1ef9bab6..9dab489f 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -46,6 +46,7 @@ static int MYDEBUG = 0; static int INCMEMORY = 4+12; +using namespace std; //--------------------------------------------------------------- size_t diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index c388740b..8ebf690f 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -28,6 +28,7 @@ #define VISU_View_i_HeaderFile #include "VISUConfig.hh" +#include "SALOME_GenericObj_i.hh" class QWidget; @@ -46,7 +47,8 @@ namespace VISU class Curve_i; class VISU_I_EXPORT View_i : public virtual POA_VISU::View, - public virtual Storable + public virtual SALOME::GenericObj_i, + public virtual Storable { public: View_i (SalomeApp_Application *theApplication, @@ -125,7 +127,7 @@ namespace VISU //=========================================================================== class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot, - public virtual View_i + public virtual View_i { public: typedef VISU::XYPlot TInterface; @@ -216,7 +218,7 @@ namespace VISU //=========================================================================== class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D, - public virtual View_i + public virtual View_i { public: typedef VISU::View3D TInterface; diff --git a/src/VISU_SWIG/Makefile.am b/src/VISU_SWIG/Makefile.am index d237a8dd..a37018e6 100644 --- a/src/VISU_SWIG/Makefile.am +++ b/src/VISU_SWIG/Makefile.am @@ -26,18 +26,22 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am -lib_LTLIBRARIES= libVISU_Swigcmodule.la -dist_libVISU_Swigcmodule_la_SOURCES= VISU_Gen_s.cc -nodist_libVISU_Swigcmodule_la_SOURCES= libVISU_Swig_wrap.cxx +SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) +SWIG_DEF = libVISU_Swig.i -SWIG_DEF = libVISU_Swig.i -SWIG_FLAGS= @SWIG_FLAGS@ -I$(srcdir) +salomeinclude_HEADERS = $(SWIG_DEF) VISU_Gen_s.hh + +# Libraries targets +lib_LTLIBRARIES = _libVISU_Swig.la +dist__libVISU_Swig_la_SOURCES = $(SWIG_DEF) VISU_Gen_s.hh VISU_Gen_s.cc +nodist__libVISU_Swig_la_SOURCES = libVISU_Swig_wrap.cxx libVISU_Swig.py: libVISU_Swig_wrap.cxx + libVISU_Swig_wrap.cxx: $(SWIG_DEF) $(SWIG) $(SWIG_FLAGS) -o $@ $< -libVISU_Swigcmodule_la_CPPFLAGS= \ +_libVISU_Swig_la_CPPFLAGS = \ -ftemplate-depth-32 \ $(PYTHON_INCLUDES) \ $(HDF5_INCLUDES) \ @@ -49,20 +53,20 @@ libVISU_Swigcmodule_la_CPPFLAGS= \ $(BOOST_CPPFLAGS) \ -I$(srcdir)/../CONVERTOR -I$(srcdir)/../PIPELINE -libVISU_Swigcmodule_la_LDFLAGS= $(PYTHON_LIBS) ../CONVERTOR/libVisuConvertor.la ../PIPELINE/libVisuPipeLine.la +_libVISU_Swig_la_LDFLAGS = -module +_libVISU_Swig_la_LIBADD = $(PYTHON_LIBS) ../CONVERTOR/libVisuConvertor.la ../PIPELINE/libVisuPipeLine.la -dist_salomescript_DATA= libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \ +dist_salomescript_DATA = batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \ visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py \ visu_table.py visu_big_table.py visu_view.py visu_delete.py \ visu_swig_test.py visu_split_views.py \ visu_succcessive_animation.py visu_apply_properties.py visu_apply_properties_successive.py \ + batch_test_events.py batchmode_visu_view.py test_events.py visu_cache.py visu_pointmap3d.py \ VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \ VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py -dist_sharedpkgpython_DATA= VISU_shared_modules.py -CLEANFILES= libVISU_Swig.py libVISU_Swig_wrap.cxx +nodist_salomescript_DATA = libVISU_Swig.py -install-exec-hook: $(libdir)/_libVISU_Swig.so +dist_sharedpkgpython_DATA = VISU_shared_modules.py -$(libdir)/_libVISU_Swig.so: - ( cd $(libdir); ln -sf libVISU_Swigcmodule.so _libVISU_Swig.so; ) +CLEANFILES = libVISU_Swig.py libVISU_Swig_wrap.cxx diff --git a/src/VISU_SWIG/visu_pointmap3d.py b/src/VISU_SWIG/visu_pointmap3d.py deleted file mode 100755 index f16d6ee0..00000000 --- a/src/VISU_SWIG/visu_pointmap3d.py +++ /dev/null @@ -1,57 +0,0 @@ -import os -import VISU -from visu_gui import * - -aTableFile = os.getenv('DATA_DIR') + '/Tables/table_test.xls' - -aTableSObject = myVisu.ImportTables(aTableFile) - -aTable = None -if aTableSObject: - anIsFound, aSObject = aTableSObject.FindSubObject(1) - if anIsFound: - aTable = aSObject.GetObject() - -aViewManager = myVisu.GetViewManager(); -aView = aViewManager.Create3DView() -if aView is None : print "Creating View Error" -print aTable - -##########Get Values################ -aScaleFactor = aTable.GetScaleFactor(); -anIsContourPrs = aTable.GetIsContourPrs(); -aNbOfContours = aTable.GetNbOfContours(); -aScaling = aTable.GetScaling(); -aMin = aTable.GetMin(); -aMax = aTable.GetMax(); -aSourceMin = aTable.GetSourceMin(); -aSourceMax = aTable.GetSourceMax(); -aPosX = aTable.GetPosX(); -aPosY = aTable.GetPosY(); -aHeight = aTable.GetHeight(); -aWidth = aTable.GetWidth(); -aNbColors = aTable.GetNbColors(); -aLabels = aTable.GetLabels(); -aBarOrientation = aTable.GetBarOrientation(); - - -print "Get Values:" -print "aScaleFactor = ", aScaleFactor -print "anIsContourPrs = ", anIsContourPrs -print "aNbOfContours = ", aNbOfContours -print "aScaling = ", aScaling -print "===== SCALAR BAR =======" -print "aMin = ", aMin -print "aMax = ", aMax -print "aSourceMin = ", aSourceMin -print "aSourceMax = ", aSourceMax -print "aPosX = ", aPosX -print "aPosY = ", aPosY -print "aHeight = ", aHeight -print "aWidth = ", aWidth -print "aNbColors = ", aNbColors -print "aLabels = ", aLabels -print "aBarOrientation = ", aBarOrientation - -aView.DisplayOnly( aTable ) -aView.FitAll() \ No newline at end of file diff --git a/src/VVTK/Makefile.am b/src/VVTK/Makefile.am index c09b3d46..8afb0e31 100755 --- a/src/VVTK/Makefile.am +++ b/src/VVTK/Makefile.am @@ -29,46 +29,17 @@ lib_LTLIBRARIES= libVVTK.la # header files salomeinclude_HEADERS= \ VVTK.h \ - VVTK_ViewManager.h \ - VVTK_ViewModel.h \ - VVTK_InteractorStyle.h \ - VVTK_PickingDlg.h \ - VVTK_SegmentationCursorDlg.h \ VVTK_PrimitiveBox.h \ - VVTK_SizeBox.h \ - VVTK_ViewWindow.h \ - VVTK_MainWindow.h \ - VVTK_ImageWriter.h \ - VVTK_ImageWriterMgr.h \ - VVTK_RecorderDlg.h \ - VVTK_Recorder.h + VVTK_SizeBox.h dist_libVVTK_la_SOURCES= \ - VVTK_ViewManager.cxx \ - VVTK_ViewModel.cxx \ - VVTK_InteractorStyle.cxx \ - VVTK_PickingDlg.cxx \ - VVTK_SegmentationCursorDlg.cxx \ VVTK_PrimitiveBox.cxx \ - VVTK_SizeBox.cxx \ - VVTK_ViewWindow.cxx \ - VVTK_Renderer.cxx \ - VVTK_MainWindow.cxx \ - VVTK_ImageWriter.cxx \ - VVTK_ImageWriterMgr.cxx \ - VVTK_RecorderDlg.cxx \ - VVTK_Recorder.cxx + VVTK_SizeBox.cxx MOC_FILES= \ - VVTK_ViewWindow_moc.cxx \ - VVTK_ViewModel_moc.cxx \ - VVTK_ViewManager_moc.cxx \ - VVTK_PickingDlg_moc.cxx \ - VVTK_SegmentationCursorDlg_moc.cxx \ - VVTK_RecorderDlg_moc.cxx \ VVTK_PrimitiveBox_moc.cxx \ - VVTK_SizeBox_moc.cxx \ - VVTK_MainWindow_moc.cxx + VVTK_SizeBox_moc.cxx + nodist_libVVTK_la_SOURCES=$(MOC_FILES) libVVTK_la_CPPFLAGS= \ diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 456b2715..158542a5 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -58,25 +58,19 @@ #include //---------------------------------------------------------------------------- -VVTK_MainWindow -::VVTK_MainWindow(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): +VVTK_MainWindow::VVTK_MainWindow(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow): SVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myInteractorStyle(VVTK_InteractorStyle::New()), myControllerIncrement(VVTK_ControllerIncrement::New()), myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New()) { myToolMgr = new QtxActionToolMgr( this ); - myInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer()); - myControllerIncrement->Delete(); - myInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer()); + myControllerIncrement->Delete(); myControllerOnKeyDown->Delete(); - myInteractorStyle->Delete(); - // Recording myRecordingToolBar = new QToolBar(tr("LBL_TOOLBAR_RECORD_LABEL"), this); addToolBar(Qt::LeftToolBarArea, myRecordingToolBar ); @@ -132,9 +126,7 @@ QtxActionToolMgr* VVTK_MainWindow::toolMgr() const } //---------------------------------------------------------------------------- -void -VVTK_MainWindow -::Initialize(SVTK_RenderWindowInteractor* theInteractor) +void VVTK_MainWindow::Initialize(SVTK_RenderWindowInteractor* theInteractor) { vtkInteractorStyle* aStyle = theInteractor->GetInteractorStyle(); if(SVTK_InteractorStyle *anInteractorStyle = dynamic_cast(aStyle)){ @@ -189,17 +181,6 @@ void VVTK_MainWindow::onDumpView() QApplication::restoreOverrideCursor(); } -//---------------------------------------------------------------------------- -void -VVTK_MainWindow -::OnInteractorStyleSwitch(bool theIsGaussStyleOn) -{ - if ( theIsGaussStyleOn ) - this->PushInteractorStyle(myInteractorStyle.GetPointer()); - else - this->PopInteractorStyle(); -} - //---------------------------------------------------------------------------- void VVTK_MainWindow::OnStartRecording() { @@ -256,9 +237,7 @@ void VVTK_MainWindow::OnStopRecording() } //---------------------------------------------------------------------------- -void -VVTK_MainWindow -::action( const int accelAction ) +void VVTK_MainWindow::action( const int accelAction ) { if ( accelAction == SUIT_Accel::ZoomFit ) onFitAll(); @@ -269,13 +248,11 @@ VVTK_MainWindow } //---------------------------------------------------------------------------- -VVTK_MainWindow1 -::VVTK_MainWindow1(QSplitter* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): +VVTK_MainWindow1::VVTK_MainWindow1(QSplitter* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow): VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myStyleSwitchAction(NULL), mySplitter(theParent), myPickingDlg(NULL) { @@ -285,23 +262,6 @@ VVTK_MainWindow1 QPixmap aPixmap; QtxAction* anAction; - aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) ); - anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"), - aPixmap, - tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ), - 0, - this, - //"VVTK/SVTK StyleSwitch", - true); - anAction->setCheckable(true); - anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH")); - - myPtsToolBar->addAction( anAction ); - myStyleSwitchAction = anAction; - - if( theResourceMgr->integerValue( "VISU", "mouse_behaviour", true ) == 1 ) - myStyleSwitchAction->toggle(); - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH")); myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), aPixmap, @@ -356,18 +316,12 @@ VVTK_MainWindow1 myPtsToolBar->addAction( aSegmentationAction ); } -void -VVTK_MainWindow1 -::Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer) +void VVTK_MainWindow1::Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer1* theRenderer) { myRenderer = theRenderer; VVTK_MainWindow::Initialize(theInteractor); - if( myStyleSwitchAction->isChecked() ) - PushInteractorStyle(myInteractorStyle.GetPointer()); - connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); - mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() ); mySegmentationCursorDlg->SetInteractor( theInteractor ); @@ -375,31 +329,25 @@ VVTK_MainWindow1 myPickingDlg->SetInteractor( theInteractor ); } -VVTK_MainWindow1 -::~VVTK_MainWindow1() +VVTK_MainWindow1::~VVTK_MainWindow1() {} //---------------------------------------------------------------------------- -VVTK_MainWindow2* -VVTK_MainWindow1 -::CreateMainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow) +VVTK_MainWindow2* VVTK_MainWindow1::CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow) { myMainWindow2 = new VVTK_MainWindow2(theParent, theName, theResourceMgr, - theViewWindow, - myStyleSwitchAction); + theViewWindow); return myMainWindow2; } //---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::OnSelectionModeSwitch(bool theIsSelectionOn) +void VVTK_MainWindow1::OnSelectionModeSwitch(bool theIsSelectionOn) { if ( theIsSelectionOn && !isVisible() ) return; @@ -419,9 +367,7 @@ VVTK_MainWindow1 myPickingDlg->hide(); } -void -VVTK_MainWindow1 -::OnSelectionChanged() +void VVTK_MainWindow1::OnSelectionChanged() { Selection_Mode aSelectionMode = SelectionMode(); if(myPickingAction->isChecked() && aSelectionMode != GaussPointSelection) @@ -432,54 +378,40 @@ VVTK_MainWindow1 //---------------------------------------------------------------------------- -VISU_WidgetCtrl* -VVTK_MainWindow1 -::GetWidgetCtrl() +VISU_WidgetCtrl* VVTK_MainWindow1::GetWidgetCtrl() { return myRenderer->GetWidgetCtrl(); } -VISU_InsideCursorSettings* -VVTK_MainWindow1 -::GetInsideCursorSettings() +VISU_InsideCursorSettings* VVTK_MainWindow1::GetInsideCursorSettings() { return mySegmentationCursorDlg->GetInsideCursorSettings(); } -VISU_OutsideCursorSettings* -VVTK_MainWindow1 -::GetOutsideCursorSettings() +VISU_OutsideCursorSettings* VVTK_MainWindow1::GetOutsideCursorSettings() { return mySegmentationCursorDlg->GetOutsideCursorSettings(); } -VISU_PickingSettings* -VVTK_MainWindow1 -::GetPickingSettings() +VISU_PickingSettings* VVTK_MainWindow1::GetPickingSettings() { return myPickingDlg->GetPickingSettings(); } //---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::SetPlanesSegementation(bool theIsOn) +void VVTK_MainWindow1::SetPlanesSegementation(bool theIsOn) { myPlaneSegmentationAction->setChecked( theIsOn ); OnSegmentationSwitch(myPlaneSegmentationAction); } -void -VVTK_MainWindow1 -::SetSphereSegementation(bool theIsOn) +void VVTK_MainWindow1::SetSphereSegementation(bool theIsOn) { mySphereSegmentationAction->setChecked( theIsOn ); OnSegmentationSwitch(mySphereSegmentationAction); } -void -VVTK_MainWindow1 -::OnSegmentationSwitch(QtxAction* theAction) +void VVTK_MainWindow1::OnSegmentationSwitch(QtxAction* theAction) { bool anIsSegmentationOn = myPlaneSegmentationAction->isChecked() || mySphereSegmentationAction->isChecked(); @@ -516,9 +448,7 @@ VVTK_MainWindow1 } } -void -VVTK_MainWindow1 -::OnSegmentationSwitch() +void VVTK_MainWindow1::OnSegmentationSwitch() { QtxAction* anAction = ( QtxAction* )sender(); OnSegmentationSwitch(anAction); @@ -526,30 +456,20 @@ VVTK_MainWindow1 //---------------------------------------------------------------------------- -VVTK_MainWindow2 -::VVTK_MainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow, - QtxAction* theStyleSwitchAction): - VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myStyleSwitchAction(theStyleSwitchAction) +VVTK_MainWindow2::VVTK_MainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow): + VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow) {} -VVTK_MainWindow2 -::~VVTK_MainWindow2() +VVTK_MainWindow2::~VVTK_MainWindow2() {} //---------------------------------------------------------------------------- -void -VVTK_MainWindow2 -::Initialize(SVTK_RenderWindowInteractor* theInteractor) +void VVTK_MainWindow2::Initialize(SVTK_RenderWindowInteractor* theInteractor) { VVTK_MainWindow::Initialize(theInteractor); - - if( myStyleSwitchAction->isChecked() ) - PushInteractorStyle(myInteractorStyle.GetPointer()); - connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); } diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 24718220..068774ea 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -57,49 +57,28 @@ public: SUIT_ViewWindow* theViewWindow); //! Reimplement SVTK_MainWindow::Initialize - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor); + virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); //! Destroy instance of the class - virtual - ~VVTK_MainWindow(); + virtual ~VVTK_MainWindow(); public slots: - virtual - void - onDumpView(); + virtual void onDumpView(); - //! To change active interactor style at run-time - virtual - void - OnInteractorStyleSwitch(bool theIsGaussStyleOn); + virtual void action( const int ); - virtual - void - action( const int ); + virtual void OnStartRecording(); - virtual - void - OnStartRecording(); + virtual void OnPlayRecording(); - virtual - void - OnPlayRecording(); + virtual void OnPauseRecording(); - virtual - void - OnPauseRecording(); - - virtual - void - OnStopRecording(); + virtual void OnStopRecording(); protected: virtual QtxActionToolMgr* toolMgr() const; - vtkSmartPointer myInteractorStyle; vtkSmartPointer myControllerIncrement; vtkSmartPointer myControllerOnKeyDown; @@ -128,69 +107,53 @@ public: SUIT_ViewWindow* theViewWindow); //! Reimplement VVTK_MainWindow::Initialize - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer); + virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer1* theRenderer); //! Destroy instance of the class - virtual - ~VVTK_MainWindow1(); + virtual ~VVTK_MainWindow1(); //! Create instance of the segmented VVTK_MainWindow /*! The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time. So, it is necessary to synhronize them through sharing some common pointers. */ - VVTK_MainWindow2* - CreateMainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow); + VVTK_MainWindow2* CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow); VISU_WidgetCtrl* GetWidgetCtrl(); - void - SetPlanesSegementation(bool theIsOn); + void SetPlanesSegementation(bool theIsOn); - void - SetSphereSegementation(bool theIsOn); + void SetSphereSegementation(bool theIsOn); - VISU_InsideCursorSettings* - GetInsideCursorSettings(); + VISU_InsideCursorSettings* GetInsideCursorSettings(); //! Get contained VISU_OutsideCursorSettings - VISU_OutsideCursorSettings* - GetOutsideCursorSettings(); + VISU_OutsideCursorSettings* GetOutsideCursorSettings(); //! Get contained VISU_PickingSettings - VISU_PickingSettings* - GetPickingSettings(); + VISU_PickingSettings* GetPickingSettings(); public slots: //! To activate/ deactivate the segementation cursor at run-time - void - OnSegmentationSwitch();//bool theIsSegmentationOn); + void OnSegmentationSwitch();//bool theIsSegmentationOn); - void - OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); + void OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); //! To change active selection mode at run-time - virtual - void - OnSelectionModeSwitch(bool theIsSelectionOn); + virtual void OnSelectionModeSwitch(bool theIsSelectionOn); //! To adjust to the current selection mode - virtual - void - OnSelectionChanged(); + virtual void OnSelectionChanged(); protected: VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view - QtxAction* myStyleSwitchAction; //!< Action for switch interactor style QToolBar* myPtsToolBar; //!< Additional tool bar //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor @@ -218,21 +181,13 @@ class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow, - QtxAction* theStyleSwitchAction); + SUIT_ViewWindow* theViewWindow); public: //! Destroy instance of the class - virtual - ~VVTK_MainWindow2(); + virtual ~VVTK_MainWindow2(); //! Reimplement SVTK_MainWindow::Initialize - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor); - - protected: - // Refer to the VVTK_MainWindow1::myStyleSwitchAction instance - QtxAction* myStyleSwitchAction; + virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); }; diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index 18b42fee..52d14ff1 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -24,7 +24,7 @@ #include "VVTK_PickingDlg.h" #include "VISU_GaussPtsAct.h" -#include "VISU_GaussPtsSettings.h" +#include "VISU_PickingSettings.h" #include "VISU_GaussPointsPL.hxx" #include "SUIT_MessageBox.h" @@ -454,29 +454,84 @@ VVTK_PickingDlg::~VVTK_PickingDlg() void VVTK_PickingDlg::AddActor( VISU_GaussPtsAct* theActor ) { - theActor->SetPickingSettings( myPickingSettings.GetPointer() ); + //theActor->SetPickingSettings( myPickingSettings.GetPointer() ); } void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor ) { - theActor->SetPickingSettings( NULL ); + //theActor->SetPickingSettings( NULL ); } void VVTK_PickingDlg::Update() { - myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); - myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); - myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); - myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); - myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() ); - myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); - myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); - myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); - - vtkFloatingPointType* aColor = myPickingSettings->GetColor(); - mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); + float aCursorSize = 0.5; + float aPyramidHeight = 10.0; + float aPointTolerance = 0.1; + QColor aColor = Qt::yellow; + int anInfoWindowTransparency = 50; + int anInfoWindowPosition = VISU_PickingSettings::BelowPoint; + float aZoomFactor = 1.5; + int aStepNumber = 10; + bool aDisplayParentMesh = false; + + //if( !myPickingSettings->GetInitial() ) + { + myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); + myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); + myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); + myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); + myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() ); + myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); + myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); + myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); + + vtkFloatingPointType* aColor = myPickingSettings->GetColor(); + + //QPalette aPalette( mySelectionColorButton->palette() ); + /*aPalette.setColor( mySelectionColorButton->backgroundRole(), + QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); + mySelectionColorButton->setPalette( aPalette );*/ + mySelectionColorButton->setColor( + QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); + + return; + } + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + + aCursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize ); + myCursorSizeSpinBox->setValue( aCursorSize ); + + aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight ); + myPyramidHeightSpinBox->setValue( aPyramidHeight ); + + aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance ); + myPointToleranceSpinBox->setValue( aPointTolerance ); + + aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor ); + //QPalette aPalette( mySelectionColorButton->palette() ); + //aPalette.setColor( mySelectionColorButton->backgroundRole(), aColor ); + mySelectionColorButton->setColor( aColor ); + + anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ); + myTransparencySpinBox->setValue( anInfoWindowTransparency ); + + anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition ); + myPositionComboBox->setCurrentIndex( anInfoWindowPosition ); + + aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor ); + myZoomFactorSpinBox->setValue( aZoomFactor ); + + aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber ); + myStepNumberSpinBox->setValue( aStepNumber ); + + aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh ); + myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh ); + onClickApply(); } @@ -566,6 +621,8 @@ void VVTK_PickingDlg::KeyPressed() void VVTK_PickingDlg::onClickApply() { + //myPickingSettings->SetInitial( false ); + myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() ); myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() ); myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() ); diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 8b56aede..d0e3d6a1 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -194,7 +194,7 @@ VVTK_Renderer anActor->SetHighlightProperty(myGaussHighlightProperty.GetPointer()); anActor->SetInsideCursorSettings(myInsideCursorSettings); - anActor->SetPickingSettings(myPickingSettings); + //anActor->SetPickingSettings(myPickingSettings); } } @@ -210,7 +210,7 @@ VVTK_Renderer anActor->SetHighlightProperty(NULL); anActor->SetInsideCursorSettings(NULL); - anActor->SetPickingSettings(NULL); + //anActor->SetPickingSettings(NULL); } } diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx index 977d3848..5a071c84 100644 --- a/src/VVTK/VVTK_ViewModel.cxx +++ b/src/VVTK/VVTK_ViewModel.cxx @@ -33,35 +33,33 @@ #include //--------------------------------------------------------------- -VVTK_Viewer -::VVTK_Viewer() +VVTK_Viewer::VVTK_Viewer() { } //--------------------------------------------------------------- -VVTK_Viewer -::~VVTK_Viewer() +VVTK_Viewer::~VVTK_Viewer() { } //--------------------------------------------------------------- -SUIT_ViewWindow* -VVTK_Viewer -::createView( SUIT_Desktop* theDesktop ) +SUIT_ViewWindow* VVTK_Viewer::createView( SUIT_Desktop* theDesktop ) { TViewWindow* aViewWindow = new TViewWindow (theDesktop); aViewWindow->Initialize(this); aViewWindow->setBackgroundColor( backgroundColor() ); aViewWindow->SetTrihedronSize( trihedronSize() ); + aViewWindow->SetProjectionMode( projectionMode() ); + aViewWindow->SetInteractionStyle( interactionStyle() ); + aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() ); + aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) ); return aViewWindow; } //--------------------------------------------------------------- -void -VVTK_Viewer -::Display(const SALOME_VTKPrs* thePrs) +void VVTK_Viewer::Display(const SALOME_VTKPrs* thePrs) { // try do downcast object if(const SVTK_Prs* aPrs = dynamic_cast(thePrs)){ @@ -106,9 +104,7 @@ namespace VVTK } //--------------------------------------------------------------- -bool -VVTK_Viewer -::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) +bool VVTK_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) { QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)