From a34b3cc2d7803e5a8120003e06fca798ab1698d4 Mon Sep 17 00:00:00 2001 From: abd Date: Wed, 7 Feb 2007 12:31:00 +0000 Subject: [PATCH] Merging with WPdev --- .../VISU/sources/static/examples_VISU.html | 2538 ++++++++--------- .../VISU/sources/static/overview_VISU.html | 504 ++-- idl/VISU_Gen.idl | 120 +- resources/SalomeApp.xml | 14 +- resources/Visu_add.png | Bin 0 -> 389 bytes resources/Visu_cutplanes.png | Bin 0 -> 389 bytes resources/Visu_remove.png | Bin 0 -> 383 bytes resources/Visu_tree_container.png | Bin 0 -> 425 bytes resources/Visu_tree_curve.png | Bin 0 -> 363 bytes resources/Visu_tree_cutlines.png | Bin 0 -> 773 bytes resources/Visu_tree_cutlines_gr.png | Bin 0 -> 868 bytes resources/Visu_tree_cutplanes.png | Bin 0 -> 1168 bytes resources/Visu_tree_cutplanes_gr.png | Bin 0 -> 960 bytes resources/Visu_tree_deformed.png | Bin 0 -> 1057 bytes resources/Visu_tree_deformed_gr.png | Bin 0 -> 924 bytes resources/Visu_tree_gauss_points.png | Bin 0 -> 460 bytes resources/Visu_tree_isosurfaces.png | Bin 0 -> 1033 bytes resources/Visu_tree_isosurfaces_gr.png | Bin 0 -> 864 bytes resources/Visu_tree_mesh.png | Bin 0 -> 413 bytes resources/Visu_tree_plot3d.png | Bin 0 -> 1205 bytes resources/Visu_tree_plot3d_gr.png | Bin 0 -> 918 bytes resources/Visu_tree_result.png | Bin 0 -> 421 bytes .../Visu_tree_scalarmapondeformedshape.png | Bin 0 -> 1140 bytes .../Visu_tree_scalarmapondeformedshape_gr.png | Bin 0 -> 965 bytes resources/Visu_tree_scalars.png | Bin 0 -> 1118 bytes resources/Visu_tree_scalars_gr.png | Bin 0 -> 928 bytes resources/Visu_tree_streamlines.png | Bin 0 -> 908 bytes resources/Visu_tree_streamlines_gr.png | Bin 0 -> 898 bytes resources/Visu_tree_table.png | Bin 0 -> 306 bytes resources/Visu_tree_vectors.png | Bin 0 -> 1199 bytes resources/Visu_tree_vectors_gr.png | Bin 0 -> 952 bytes src/CONVERTOR/Makefile.in | 3 +- src/CONVERTOR/VISUConvertor.cxx | 1 + src/CONVERTOR/VISUConvertor.hxx | 47 + src/CONVERTOR/VISU_Convertor.cxx | 3 +- src/CONVERTOR/VISU_Convertor.hxx | 9 +- src/CONVERTOR/VISU_ConvertorUtils.hxx | 4 +- src/CONVERTOR/VISU_Convertor_impl.cxx | 96 +- src/CONVERTOR/VISU_Convertor_impl.hxx | 53 +- src/CONVERTOR/VISU_IDMapper.cxx | 43 + src/CONVERTOR/VISU_IDMapper.hxx | 59 +- src/CONVERTOR/VISU_MedConvertor.cxx | 189 +- src/CONVERTOR/VISU_MedConvertor.hxx | 4 +- src/ENGINE/VISU_Engine_i.cc | 37 +- src/ENGINE/VISU_Engine_i.hh | 4 +- src/GUITOOLS/Makefile.in | 3 +- src/GUITOOLS/VisuGUITools.h | 47 + src/GUITOOLS/VisuGUI_TableDlg.cxx | 8 +- src/GUITOOLS/VisuGUI_TableDlg.h | 4 +- src/OBJECT/VISU_Actor.h | 11 +- src/OBJECT/VISU_GaussPtsAct.cxx | 8 +- src/OBJECT/VISU_GaussPtsSettings.h | 9 +- src/OBJECT/VISU_MeshAct.cxx | 1 - src/OBJECT/VISU_MeshAct.h | 9 - src/OBJECT/VISU_ScalarMapAct.cxx | 187 +- src/OBJECT/VISU_ScalarMapAct.h | 56 + src/PIPELINE/Makefile.in | 7 +- src/PIPELINE/VISUPipeLine.cxx | 49 +- src/PIPELINE/VISUPipeline.hxx | 47 + src/PIPELINE/VISU_CutLinesPL.cxx | 3 +- src/PIPELINE/VISU_CutLinesPL.hxx | 3 +- src/PIPELINE/VISU_CutPlanesPL.cxx | 6 +- src/PIPELINE/VISU_CutPlanesPL.hxx | 7 +- src/PIPELINE/VISU_DeformedShapePL.cxx | 9 +- src/PIPELINE/VISU_DeformedShapePL.hxx | 9 +- src/PIPELINE/VISU_Extractor.cxx | 2 +- src/PIPELINE/VISU_GaussPointsPL.hxx | 3 +- src/PIPELINE/VISU_ImplicitFunctionWidget.hxx | 4 +- src/PIPELINE/VISU_IsoSurfacesPL.cxx | 10 +- src/PIPELINE/VISU_IsoSurfacesPL.hxx | 9 +- src/PIPELINE/VISU_MeshPL.hxx | 3 +- src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx | 65 +- src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx | 8 +- src/PIPELINE/VISU_PipeLine.cxx | 1 + src/PIPELINE/VISU_PipeLine.hxx | 4 +- src/PIPELINE/VISU_PipeLineUtils.hxx | 1 + src/PIPELINE/VISU_PlanesWidget.hxx | 3 +- src/PIPELINE/VISU_Plot3DPL.cxx | 8 +- src/PIPELINE/VISU_Plot3DPL.hxx | 8 +- src/PIPELINE/VISU_PrsMergerPL.cxx | 403 +++ src/PIPELINE/VISU_PrsMergerPL.hxx | 190 ++ src/PIPELINE/VISU_ScalarBarActor.cxx | 2 +- src/PIPELINE/VISU_ScalarBarActor.hxx | 3 +- src/PIPELINE/VISU_ScalarBarCtrl.hxx | 4 +- .../VISU_ScalarMapOnDeformedShapePL.cxx | 18 +- .../VISU_ScalarMapOnDeformedShapePL.hxx | 12 +- src/PIPELINE/VISU_ScalarMapPL.hxx | 4 +- src/PIPELINE/VISU_SphereWidget.hxx | 3 +- src/PIPELINE/VISU_StreamLinesPL.cxx | 6 +- src/PIPELINE/VISU_StreamLinesPL.hxx | 4 +- src/PIPELINE/VISU_VectorsPL.hxx | 4 +- src/PIPELINE/VISU_WidgetCtrl.hxx | 3 +- src/VISUGUI/VISU_images.po | 82 +- src/VISUGUI/VISU_msg_en.po | 49 +- src/VISUGUI/VisuGUI.cxx | 228 +- src/VISUGUI/VisuGUI.h | 10 +- src/VISUGUI/VisuGUI_ActionsDef.h | 3 +- src/VISUGUI/VisuGUI_BuildProgressDlg.cxx | 8 +- src/VISUGUI/VisuGUI_ClippingDlg.cxx | 71 +- src/VISUGUI/VisuGUI_ClippingDlg.h | 3 + src/VISUGUI/VisuGUI_CursorDlg.cxx | 9 +- src/VISUGUI/VisuGUI_CutLinesDlg.cxx | 116 +- src/VISUGUI/VisuGUI_CutLinesDlg.h | 1 + src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 8 +- src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx | 8 +- src/VISUGUI/VisuGUI_EditContainerDlg.cxx | 8 +- src/VISUGUI/VisuGUI_Factory.cxx | 11 + src/VISUGUI/VisuGUI_GaussPointsDlg.cxx | 8 +- src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx | 8 +- src/VISUGUI/VisuGUI_Module.cxx | 20 +- src/VISUGUI/VisuGUI_NameDlg.cxx | 8 +- src/VISUGUI/VisuGUI_OffsetDlg.cxx | 8 +- src/VISUGUI/VisuGUI_Plot3DDlg.cxx | 8 +- src/VISUGUI/VisuGUI_PopupTools.cxx | 2 +- src/VISUGUI/VisuGUI_Prs3dTools.h | 9 + src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 219 +- src/VISUGUI/VisuGUI_ScalarBarDlg.h | 44 +- .../VisuGUI_ScalarMapOnDeformedShapeDlg.cxx | 18 +- src/VISUGUI/VisuGUI_Selection.cxx | 84 +- src/VISUGUI/VisuGUI_Selection.h | 5 + src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx | 8 +- src/VISUGUI/VisuGUI_StreamLinesDlg.cxx | 20 +- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 254 +- src/VISUGUI/VisuGUI_TimeAnimation.h | 8 +- src/VISUGUI/VisuGUI_Tools.cxx | 45 +- src/VISUGUI/VisuGUI_TransparencyDlg.cxx | 8 +- src/VISUGUI/VisuGUI_VectorsDlg.cxx | 8 +- src/VISU_I/Makefile.in | 12 +- src/VISU_I/VISUConfig.cc | 12 +- src/VISU_I/VISUConfig.hh | 44 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 71 +- src/VISU_I/VISU_ColoredPrs3d_i.hh | 19 +- src/VISU_I/VISU_CorbaMedConvertor.cxx | 377 ++- src/VISU_I/VISU_CorbaMedConvertor.hxx | 30 +- src/VISU_I/VISU_CutLines_i.cc | 79 +- src/VISU_I/VISU_CutLines_i.hh | 16 +- src/VISU_I/VISU_CutPlanes_i.cc | 22 +- src/VISU_I/VISU_CutPlanes_i.hh | 11 +- src/VISU_I/VISU_DeformedShape_i.cc | 25 +- src/VISU_I/VISU_DeformedShape_i.hh | 11 +- src/VISU_I/VISU_DumpPython.cc | 67 +- src/VISU_I/VISU_GaussPoints_i.cc | 2 +- src/VISU_I/VISU_GaussPoints_i.hh | 7 +- src/VISU_I/VISU_Gen_i.cc | 92 +- src/VISU_I/VISU_Gen_i.hh | 3 +- src/VISU_I/VISU_I.hxx | 47 + src/VISU_I/VISU_IsoSurfaces_i.cc | 21 +- src/VISU_I/VISU_IsoSurfaces_i.hh | 11 +- src/VISU_I/VISU_Mesh_i.cc | 13 + src/VISU_I/VISU_Mesh_i.hh | 3 +- src/VISU_I/VISU_Plot3D_i.cc | 22 +- src/VISU_I/VISU_Plot3D_i.hh | 11 +- src/VISU_I/VISU_Prs3d_i.cc | 101 +- src/VISU_I/VISU_Prs3d_i.hh | 5 +- src/VISU_I/VISU_PrsMerger_i.cc | 571 ++++ src/VISU_I/VISU_PrsMerger_i.hh | 219 ++ src/VISU_I/VISU_PrsObject_i.hh | 2 +- src/VISU_I/VISU_Result_i.cc | 391 ++- src/VISU_I/VISU_Result_i.hh | 10 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 72 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 38 +- src/VISU_I/VISU_ScalarMap_i.cc | 11 +- src/VISU_I/VISU_ScalarMap_i.hh | 5 +- src/VISU_I/VISU_StreamLines_i.cc | 13 +- src/VISU_I/VISU_StreamLines_i.hh | 6 +- src/VISU_I/VISU_Table_i.cc | 40 +- src/VISU_I/VISU_Table_i.hh | 7 +- src/VISU_I/VISU_TimeAnimation.cxx | 1113 ++++++-- src/VISU_I/VISU_TimeAnimation.h | 54 +- src/VISU_I/VISU_Vectors_i.cc | 13 + src/VISU_I/VISU_Vectors_i.hh | 6 +- src/VISU_I/VISU_ViewManager_i.hh | 4 +- src/VISU_I/VISU_View_i.cc | 17 +- src/VISU_I/VISU_View_i.hh | 18 +- src/VISU_SWIG/Makefile.in | 1 + src/VISU_SWIG/VISU_Example_02.py | 13 +- src/VISU_SWIG/visu.py | 120 +- src/VISU_SWIG/visu_apply_properties.py | 119 + .../visu_apply_properties_successive.py | 135 + src/VISU_SWIG/visu_succcessive_animation.py | 95 + src/VVTK/VVTK.h | 2 +- src/VVTK/VVTK_MainWindow.cxx | 6 +- src/VVTK/VVTK_PickingDlg.cxx | 8 +- src/VVTK/VVTK_PrimitiveBox.cxx | 2 +- src/VVTK/VVTK_PrimitiveBox.h | 4 +- src/VVTK/VVTK_Recorder.cxx | 5 +- src/VVTK/VVTK_RecorderDlg.cxx | 8 +- src/VVTK/VVTK_Renderer.cxx | 4 +- src/VVTK/VVTK_Renderer.h | 3 +- src/VVTK/VVTK_SegmentationCursorDlg.cxx | 19 +- src/VVTK/VVTK_SegmentationCursorDlg.h | 4 +- src/VVTK/VVTK_SizeBox.h | 4 +- 192 files changed, 7886 insertions(+), 2813 deletions(-) create mode 100644 resources/Visu_add.png create mode 100644 resources/Visu_cutplanes.png create mode 100644 resources/Visu_remove.png create mode 100644 resources/Visu_tree_container.png create mode 100644 resources/Visu_tree_curve.png create mode 100755 resources/Visu_tree_cutlines.png create mode 100644 resources/Visu_tree_cutlines_gr.png create mode 100755 resources/Visu_tree_cutplanes.png create mode 100644 resources/Visu_tree_cutplanes_gr.png create mode 100755 resources/Visu_tree_deformed.png create mode 100644 resources/Visu_tree_deformed_gr.png create mode 100644 resources/Visu_tree_gauss_points.png create mode 100755 resources/Visu_tree_isosurfaces.png create mode 100644 resources/Visu_tree_isosurfaces_gr.png create mode 100644 resources/Visu_tree_mesh.png create mode 100755 resources/Visu_tree_plot3d.png create mode 100644 resources/Visu_tree_plot3d_gr.png create mode 100644 resources/Visu_tree_result.png create mode 100755 resources/Visu_tree_scalarmapondeformedshape.png create mode 100644 resources/Visu_tree_scalarmapondeformedshape_gr.png create mode 100755 resources/Visu_tree_scalars.png create mode 100644 resources/Visu_tree_scalars_gr.png create mode 100755 resources/Visu_tree_streamlines.png create mode 100644 resources/Visu_tree_streamlines_gr.png create mode 100644 resources/Visu_tree_table.png create mode 100755 resources/Visu_tree_vectors.png create mode 100644 resources/Visu_tree_vectors_gr.png create mode 100755 src/CONVERTOR/VISUConvertor.hxx create mode 100755 src/GUITOOLS/VisuGUITools.h create mode 100755 src/PIPELINE/VISUPipeline.hxx create mode 100644 src/PIPELINE/VISU_PrsMergerPL.cxx create mode 100644 src/PIPELINE/VISU_PrsMergerPL.hxx create mode 100755 src/VISU_I/VISU_I.hxx create mode 100644 src/VISU_I/VISU_PrsMerger_i.cc create mode 100644 src/VISU_I/VISU_PrsMerger_i.hh create mode 100644 src/VISU_SWIG/visu_apply_properties.py create mode 100644 src/VISU_SWIG/visu_apply_properties_successive.py create mode 100644 src/VISU_SWIG/visu_succcessive_animation.py diff --git a/doc/salome/tui/VISU/sources/static/examples_VISU.html b/doc/salome/tui/VISU/sources/static/examples_VISU.html index 40e26ee9..bd5bca94 100755 --- a/doc/salome/tui/VISU/sources/static/examples_VISU.html +++ b/doc/salome/tui/VISU/sources/static/examples_VISU.html @@ -1,1270 +1,1270 @@ - - - - - - - - Main Page - - - - -   -
- - - - - - - - -
- - -
-
- -

Examples

-      Interfaces:
-
- VISU::Base

- VISU::VISU_Gen
- VISU::PrsObject
-

- VISU::Result
-
- VISU::Prs3d

- VISU::Mesh
- VISU::ScalarMap
- VISU::CutPlanes
- VISU::CutLines
- VISU::IsoSurfaces
- VISU::DeformedShape
- VISU::Vectors
- VISU::StreamLines
-
- VISU::Table
- VISU::Curve
- VISU::Container
-
- VISU::ViewManager

- VISU::View
- VISU::View3D
- VISU::TableView
- VISU::XYPlot
- -

Base

- - - - - - - - - - - - -
IdType - VISU::Base::GetID   -
-
- -

#Returns ID of the object. That is IOR of CORBA representation a VISU -object.
-

- -

aSObject = myLocalStudy.FindObjectIOR(theResult.GetID())
-

- - - - - - - - - - - -
VISUType - VISU::Base::GetType   -
- -

#Returns the type of the presentable object. It can be used for quick -class definition of an VISU object
-
- if aVISUObject.GetType() == VISU.TSCALARMAP :
-     #do something ...
-

- -


-

-

VISU_Gen
-

- - - - - - - - - - - - - -
void VISU::VISU_Gen::SetCurrentStudy - in SALOMEDS::Study   theStudy -
-
-
- -

- - - - - - - -
- - - - - - - - - - - -
SALOMEDS::Study -VISU::VISU_Gen::GetCurrentStudy   -
-
-
-
- #It is very important to set SALOMEDS::Study for VISU Engine before you -start any work with them.
- #Every object that you will create will be assigned to the study you set -before.
- #It can be done like this:
-

- -

aStudy = myStudyManager.NewStudy("A foo Study")
- if aStudy is None : raise RuntimeError, "Error"
- else : print "OK"
-     theVisuGen.SetCurrentStudy(aStudy)
-     #to do every things you like
-     ...
-

- -

- - - - - - - -
- - - - - - - - - - - -
ViewManager -VISU::VISU_Gen::GetViewManager   -
-
-
- - - - - - - - - -
  -

Gets the ViewManager which is used for creation of post-processing -presentations.

-
-
- #In order to display any VISU::PrsObject in propriate viewer you must take -VISU::ViewManager interface
-

- -

aViewManager = myVisuGen.GetViewManager()
- #to do something for displaing some presentation
- ...
-

- -

- - - - - - - -
- - - - - - - - - - - - -
SALOMEDS::SObject -VISU::VISU_Gen::ImportTables in string   theFileName -
-
-
- - - - - - - - - -
  -

Imports tables from a file and create TableAttribute in Sudy -

-
-
- #It is possible to import some ASCII files that include text table representation. -One file can consist from more than one table.
-

- -

aSObject = myVisuGen.ImportTables("/MyPresicousFileOfTables.txt")
-

- -

- - - - - - - -
- - - - - - - - - - - - -
Result -VISU::VISU_Gen::ImportFile in string   theFileName -
-
-
- - - - - - - - - -
  -

Imports data from a file.

-
-
- #It is possible import a med files to VISU
-

- -

aResult = myVisuGen.ImportFile("/ItIsDreamOfMyLife.med")
-

- -

- - - - - - - -
- - - - - - - - - - - - -
Result -VISU::VISU_Gen::ImportMed in SALOMEDS::SObject   theMedSObject -
-
-
- - - - - - - - - -
  -

Imports data from a MED object.

-
-
- #
-

- -

- - - - - - - -
- - - - - - - - - - - - -
Result -VISU::VISU_Gen::ImportMedField in SALOME_MED::FIELD   theField -
-
-
- - - - - - - - - -
  -

Imports data from a MED field.

-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mesh -VISU::VISU_Gen::MeshOnEntity in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity

-

-
-
- - - - - - - - - -
  -

Creates a Mesh on the basis of the data generated in other sources -(MED object or file).

-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mesh -VISU::VISU_Gen::FamilyMeshOnEntity in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFamilyName

-

-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mesh -VISU::VISU_Gen::GroupMesh in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in string   theGroupName

-

-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ScalarMap -VISU::VISU_Gen::ScalarMapOnField in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFieldName, -

-

-
in double   theIteration

-

-
-
- - - - - - - - - -
  -

Creates a scalar bar presentation.

- -
-
Parameters:
-
- - - - - - - - - - - - - - - - - - - - - - - - -
theResult  Data generated in other sources. (MED object or file) -
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can -be scalar or vector.
theIteration  Number of iteration on the field
-
-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DeformedShape -VISU::VISU_Gen::DeformedShapeOnField in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFieldName, -

-

-
in double   theIteration

-

-
-
- - - - - - - - - -
  -

Creates a deformed shape presentation.

- -
-
Parameters:
-
- - - - - - - - - - - - - - - - - - - - - - - - -
theResult  Data generated in other sources. (MED object or file) -
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can -be scalar or vector.
theIteration  Number of iteration on the field
-
-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Vectors -VISU::VISU_Gen::VectorsOnField in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFieldName, -

-

-
in double   theIteration

-

-
-
- - - - - - - - - -
  -

Creates a vector presentation.

- -
-
Parameters:
-
- - - - - - - - - - - - - - - - - - - - - - - - -
theResult  Data generated in other sources. (MED object or file) -
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can -be scalar or vector.
theIteration  Number of iteration on the field
-
-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IsoSurfaces -VISU::VISU_Gen::IsoSurfacesOnField in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFieldName, -

-

-
in double   theIteration

-

-
-
- - - - - - - - - -
  -

Creates an iso surface presentation.

- -
-
Parameters:
-
- - - - - - - - - - - - - - - - - - - - - - - - -
theResult  Data generated in other sources. (MED object or file) -
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can -be scalar or vector.
theIteration  Number of iteration on the field
-
-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StreamLines -VISU::VISU_Gen::StreamLinesOnField in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFieldName, -

-

-
in double   theIteration

-

-
-
- - - - - - - - - -
  -

Creates an stream lines presentation.

- -
-
Parameters:
-
- - - - - - - - - - - - - - - - - - - - - - - - -
theResult  Data generated in other sources. (MED object or file) -
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can -be scalar or vector.
theIteration  Number of iteration on the field
-
-
-
-

- -

- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CutPlanes -VISU::VISU_Gen::CutPlanesOnField in Result   theResult, -

-

-
in string   theMeshName, -

-

-
in Entity   theEntity, -

-

-
in string   theFieldName, -

-

-
in double   theIteration

-

-
-
- - - - - -
  -

Creates a presentation of cut planes.

- -
-
Parameters:
-
- - - - - - - - - - - - - - - - + + + + + + + + Main Page + + + + +   +
+
theResult  Data generated in other sources. (MED object or file) -
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName 
+ + + + + + + +
+ + +
+ + +

Examples

+      Interfaces:
+
+ VISU::Base

+ VISU::VISU_Gen
+ VISU::PrsObject
+

+ VISU::Result
+
+ VISU::Prs3d

+ VISU::Mesh
+ VISU::ScalarMap
+ VISU::CutPlanes
+ VISU::CutLines
+ VISU::IsoSurfaces
+ VISU::DeformedShape
+ VISU::Vectors
+ VISU::StreamLines
+
+ VISU::Table
+ VISU::Curve
+ VISU::Container
+
+ VISU::ViewManager

+ VISU::View
+ VISU::View3D
+ VISU::TableView
+ VISU::XYPlot
+ +

Base

+ + + + + + + + + + + + +
IdType + VISU::Base::GetID   +
+
+ +

#Returns ID of the object. That is IOR of CORBA representation a VISU +object.
+

+ +

aSObject = myLocalStudy.FindObjectIOR(theResult.GetID())
+

+ + + + + + + + + + + +
VISUType + VISU::Base::GetType   +
+ +

#Returns the type of the presentable object. It can be used for quick +class definition of an VISU object
+
+ if aVISUObject.GetType() == VISU.TSCALARMAP :
+     #do something ...
+

+ +


+

+

VISU_Gen
+

+ + + + + + + + + + + + + +
void VISU::VISU_Gen::SetCurrentStudy + in SALOMEDS::Study   theStudy +
+
+
+ +

+ + + + + + + +
+ + + + + + + + + + + +
SALOMEDS::Study +VISU::VISU_Gen::GetCurrentStudy   +
+
+
+
+ #It is very important to set SALOMEDS::Study for VISU Engine before you +start any work with them.
+ #Every object that you will create will be assigned to the study you set +before.
+ #It can be done like this:
+

+ +

aStudy = myStudyManager.NewStudy("A foo Study")
+ if aStudy is None : raise RuntimeError, "Error"
+ else : print "OK"
+     theVisuGen.SetCurrentStudy(aStudy)
+     #to do every things you like
+     ...
+

+ +

+ + + + + + + +
+ + + + + + + + + + + +
ViewManager +VISU::VISU_Gen::GetViewManager   +
+
+
+ + + + + + + + + +
  +

Gets the ViewManager which is used for creation of post-processing +presentations.

+
+
+ #In order to display any VISU::PrsObject in propriate viewer you must take +VISU::ViewManager interface
+

+ +

aViewManager = myVisuGen.GetViewManager()
+ #to do something for displaing some presentation
+ ...
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + +
SALOMEDS::SObject +VISU::VISU_Gen::ImportTables in string   theFileName +
+
+
+ + + + + + + + + +
  +

Imports tables from a file and create TableAttribute in Sudy +

+
+
+ #It is possible to import some ASCII files that include text table representation. +One file can consist from more than one table.
+

+ +

aSObject = myVisuGen.ImportTables("/MyPresicousFileOfTables.txt")
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + +
Result +VISU::VISU_Gen::ImportFile in string   theFileName +
+
+
+ + + + + + + + + +
  +

Imports data from a file.

+
+
+ #It is possible import a med files to VISU
+

+ +

aResult = myVisuGen.ImportFile("/ItIsDreamOfMyLife.med")
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + +
Result +VISU::VISU_Gen::ImportMed in SALOMEDS::SObject   theMedSObject +
+
+
+ + + + + + + + + +
  +

Imports data from a MED object.

+
+
+ #
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + +
Result +VISU::VISU_Gen::ImportMedField in SALOME_MED::FIELD   theField +
+
+
+ + + + + + + + + +
  +

Imports data from a MED field.

+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Mesh +VISU::VISU_Gen::MeshOnEntity in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity

+

+
+
+ + + + + + + + + +
  +

Creates a Mesh on the basis of the data generated in other sources +(MED object or file).

+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Mesh +VISU::VISU_Gen::FamilyMeshOnEntity in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFamilyName

+

+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Mesh +VISU::VISU_Gen::GroupMesh in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in string   theGroupName

+

+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ScalarMap +VISU::VISU_Gen::ScalarMapOnField in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFieldName, +

+

+
in double   theIteration

+

+
+
+ + + + + + + + + +
  +

Creates a scalar bar presentation.

+ +
+
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
theResult  Data generated in other sources. (MED object or file) +
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can +be scalar or vector.
theIteration  Number of iteration on the field
+
+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DeformedShape +VISU::VISU_Gen::DeformedShapeOnField in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFieldName, +

+

+
in double   theIteration

+

+
+
+ + + + + + + + + +
  +

Creates a deformed shape presentation.

+ +
+
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
theResult  Data generated in other sources. (MED object or file) +
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can +be scalar or vector.
theIteration  Number of iteration on the field
+
+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Vectors +VISU::VISU_Gen::VectorsOnField in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFieldName, +

+

+
in double   theIteration

+

+
+
+ + + + + + + + + +
  +

Creates a vector presentation.

+ +
+
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
theResult  Data generated in other sources. (MED object or file) +
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can +be scalar or vector.
theIteration  Number of iteration on the field
+
+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IsoSurfaces +VISU::VISU_Gen::IsoSurfacesOnField in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFieldName, +

+

+
in double   theIteration

+

+
+
+ + + + + + + + + +
  +

Creates an iso surface presentation.

+ +
+
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
theResult  Data generated in other sources. (MED object or file) +
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can +be scalar or vector.
theIteration  Number of iteration on the field
+
+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
StreamLines +VISU::VISU_Gen::StreamLinesOnField in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFieldName, +

+

+
in double   theIteration

+

+
+
+ + + + + + + + + +
  +

Creates an stream lines presentation.

+ +
+
Parameters:
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
theResult  Data generated in other sources. (MED object or file) +
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName  Group of data attributed to the MESH. The data can +be scalar or vector.
theIteration  Number of iteration on the field
+
+
+
+

+ +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CutPlanes +VISU::VISU_Gen::CutPlanesOnField in Result   theResult, +

+

+
in string   theMeshName, +

+

+
in Entity   theEntity, +

+

+
in string   theFieldName, +

+

+
in double   theIteration

+

+
+
+ + + + + +
  +

Creates a presentation of cut planes.

+ +
+
Parameters:
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/doc/salome/tui/VISU/sources/static/overview_VISU.html b/doc/salome/tui/VISU/sources/static/overview_VISU.html index 844abd40..f6f54eaa 100755 --- a/doc/salome/tui/VISU/sources/static/overview_VISU.html +++ b/doc/salome/tui/VISU/sources/static/overview_VISU.html @@ -1,252 +1,252 @@ - - - - - - Main Page - - - -  -
theResult  Data generated in other sources. (MED object or file) +
theMeshName  One of the meshes presented in MED file
theEntity  Type of entity where the field is defined
theFieldName 
- - - - - - -
-
-
- - -

General overview -

-

Table of contents

- - -
-

1. Introduction

-

Post-processing module VISU for SALOME is destined for visualization of data - produced by other components. VISU provides various forms of data visualization - including:

- -
    -
  • Data tables,
  • -
  • XY plots based on data from tables,
  • -
  • 3D presentations,
  • -
      -
    • Scalar Map,
    • -
    • Deformed Shape,
    • -
    • Vectors,
    • -
    • Iso Surfaces,
    • -
    • Cut Planes,
    • -
    • Stream Lines,
    • -
    • Cut Lines.
    • -
    -
-Back to the contents -

2. Defintions

-

The following terms are used for presentation of the VISU module:

-
-
Study
-
manages data produced by various component of SALOME platform. More detailed description of the SALOME Study can be found in the document named "Data Structure and Persistence Specifications".
-
Component
-
a SALOME software module that implements predefined interfaces. -The component provides the data for the SALOME study in a form of links (stored in the Study) -to the specific data stored in the component. All components are CORBA servers and it allows them -to be running on different host stations.
-
Geometry
a coherent set of data produced by component GEOM or any other geometry tool -and imported using geometry exchange interface (like BRep, IGES and so on).
-
Mesh
a collection of elements used as a support for numeric simulation.
-
Field
the set of results of the same type allocated to mesh elements. -Fields can be one of next types: scalars, vectors, tensors, matrices, character strings.
-
-Back to the contents -

3. Forms of data visualization

-

3.1 Data tables

-

Table represents data in spreadsheet-like form. For these purposes the QTable - widget will be provided. This widget can be reused in any module for any dialog - box as a control. For post-processing data visualization needs this widget is - used inside of Table window (based on non-modal window frame). Data represented - in Table window of post-processing module is be editable.

-

3.2 XY plots

-

XY plot represents calculation data in form of 2D (XY) plotting. -XY plot view is shown in a separated view window (non-modal dialog box), which can be moved in any position of the screen for convenience. -The QWT extension of QT toolkit is used for XY plotting. -QWT provides unlimited number of displayed curves (data sets) and supports logarithmic scale, zooming, and selection.

- -

3.3 3D presentations

-

A 3D presentation shows geometry, mesh and fields in 3D space. -Provides selection, rotation, zooming, scaling, and panning of 3d scene. -Color bar for scalar data presentation is supplied. -For 3D presentation window of the current implementation of VTK viewer in study window is used.

-Back to the contents -

4. Data structure

-

Source data for post-processing module can be imported from MED file or MED object in study data structure (CORBA object) can be used for this purposes.

-

In case of import MED file the data from this file will be converted in form of VTK Data Source format and stored in VISU data structure. In case of using of MED object from study the label in VISU data structure will be created with reference to the corresponded MED object.

-

Available result data is displayed under corresponded MED data label. For every result the number of presentations can be created dependently on result type.

-

Presentation is represented in data structure in form of list of presentation creation parameters. This could be:

-
    -
  • Presentation type (table, XY plot, 3d view);
  • -
  • Presentation subtype (for example for 3d: scalar map, iso-surfaces, combined view and so on);
  • -
  • Parameters of the presentation dependently on its type (number of colors, type of scale, font parameters, grid parameters and so on).
  • -
-

Parameters of presentation are persistent data, which will be stored in study file.

- - -
-Back to the contents -

5. VISU module features and services

-

The functionality of the VISU module is provided by a set of classes which are combined into -the VISU package. -

The API reference of the VISU component can be found here.

-

5.1 Base class

-

This is a root class for all objects of the VISU module.

-

The API reference for this class can be found here.

- -

5.2 ViewManager class

-

This class is used for management of the view windows (creation and deletion).

-

The API reference for this class can be found here.

- -

5.3 View class

-

View class is a base for all other classes, necessary for creation of different views .

- -
-

The API reference for this class can be found here.

- -

5.3.1 3dView class

-

This class provides a set of methods for creation of a 3d view window.

-

The API reference for this class can be found here.

- -

5.3.2 TableView class

-

This class provides a set of methods for creation of a Table view window.

-

The API reference for this class can be found here.

- -

5.3.3 XYPlotView class

-

This class provides a set of methods for creation of a XYPlot view window.

-

The API reference for this class can be found here.

- -

5.4 Result class

-

This class serves for inner representation of data generated in other sources. -(MED object or file) This data is needed for further construction of graphical presentations.

-

The API reference for this class can be found here.

-

5.5 PrsObject class

-

It is the root class of all presentable objects.

-
-

The API reference for this class can be found here.

- -

5.5.1 Curve class

-

Manages presentation parameters of one curve. -This object can be used for presentation of set of curves using Container class.

-

The API reference for this class can be found here.

- -

5.5.2 Table class

-

Manages presentation parameters of a table.

-

The API reference for this class can be found here.

- -

5.5.3 Container class

-

This class is provided in order to create one presentation using several presentable objects. This can provide combination of a set of curves to display them in XY plot view. -

-

The API reference for this class can be found here.

- -

5.5.4 Prs3d class

-

Root class for all 3D presentations.

-

The API reference for this class can be found here.

- -

5.5.5 Mesh class

-

Manages presentation parameters of a 3D presentattion of a mesh. -This object can be used for presentation of set of curves using Container class.

-

The API reference for this class can be found here.

- -

5.5.6 ScalarMap class

-

Manages presentation parameters of the scalar bar.

-

The API reference for this class can be found here.

- -

5.5.7 CutLines class

-

Manages presentation parameters of the cut lines presentation.

-

The API reference for this class can be found here.

- -

5.5.8 CutPlanes class

-

Manages presentation parameters of the cut planes presentation.

-

The API reference for this class can be found here.

- -

5.5.9 IsoSurfaces class

-

Manages presentation parameters of the iso surfaces presentation.

-

The API reference for this class can be found here.

- -

5.5.10 DeformedShape class

-

Manages presentation parameters of the deformed shape presentation.

-

The API reference for this class can be found here.

- -

5.5.11 Vectors class

-

Manages presentation parameters of the vector presentation.

-

The API reference for this class can be found here.

- -

5.5.12 StreamLines class

-

Manages presentation parameters of the streamlines presentation.

-

The API reference for this class can be found here.

- -

5.6 Animation class

-

This class provides a set of methods used for:

-
    -
  • generating different animations,
  • -
  • setting the parameters of the animations,
  • -
  • playing these animations in the VISU module.
  • -
-

The API reference for this class can be found here.

- -

5.7 VISU_Gen class

-

This is the main clas of the VISU component in SALOME application. It is used for , -using the views provided by ViewManager. This class provides a set of methods used for:

-
    -
  • creation of all types of post-processing presentations from given Result and Table object reference
  • -
  • creation of animations
  • - -
-

The API reference for this class can be found here.

-Back to the contents - - + + + + + + Main Page + + + +  +
+ + + + + + +
+
+
+ + +

General overview +

+

Table of contents

+ + +
+

1. Introduction

+

Post-processing module VISU for SALOME is destined for visualization of data + produced by other components. VISU provides various forms of data visualization + including:

+ +
    +
  • Data tables,
  • +
  • XY plots based on data from tables,
  • +
  • 3D presentations,
  • +
      +
    • Scalar Map,
    • +
    • Deformed Shape,
    • +
    • Vectors,
    • +
    • Iso Surfaces,
    • +
    • Cut Planes,
    • +
    • Stream Lines,
    • +
    • Cut Lines.
    • +
    +
+Back to the contents +

2. Defintions

+

The following terms are used for presentation of the VISU module:

+
+
Study
+
manages data produced by various component of SALOME platform. More detailed description of the SALOME Study can be found in the document named "Data Structure and Persistence Specifications".
+
Component
+
a SALOME software module that implements predefined interfaces. +The component provides the data for the SALOME study in a form of links (stored in the Study) +to the specific data stored in the component. All components are CORBA servers and it allows them +to be running on different host stations.
+
Geometry
a coherent set of data produced by component GEOM or any other geometry tool +and imported using geometry exchange interface (like BRep, IGES and so on).
+
Mesh
a collection of elements used as a support for numeric simulation.
+
Field
the set of results of the same type allocated to mesh elements. +Fields can be one of next types: scalars, vectors, tensors, matrices, character strings.
+
+Back to the contents +

3. Forms of data visualization

+

3.1 Data tables

+

Table represents data in spreadsheet-like form. For these purposes the QTable + widget will be provided. This widget can be reused in any module for any dialog + box as a control. For post-processing data visualization needs this widget is + used inside of Table window (based on non-modal window frame). Data represented + in Table window of post-processing module is be editable.

+

3.2 XY plots

+

XY plot represents calculation data in form of 2D (XY) plotting. +XY plot view is shown in a separated view window (non-modal dialog box), which can be moved in any position of the screen for convenience. +The QWT extension of QT toolkit is used for XY plotting. +QWT provides unlimited number of displayed curves (data sets) and supports logarithmic scale, zooming, and selection.

+ +

3.3 3D presentations

+

A 3D presentation shows geometry, mesh and fields in 3D space. +Provides selection, rotation, zooming, scaling, and panning of 3d scene. +Color bar for scalar data presentation is supplied. +For 3D presentation window of the current implementation of VTK viewer in study window is used.

+Back to the contents +

4. Data structure

+

Source data for post-processing module can be imported from MED file or MED object in study data structure (CORBA object) can be used for this purposes.

+

In case of import MED file the data from this file will be converted in form of VTK Data Source format and stored in VISU data structure. In case of using of MED object from study the label in VISU data structure will be created with reference to the corresponded MED object.

+

Available result data is displayed under corresponded MED data label. For every result the number of presentations can be created dependently on result type.

+

Presentation is represented in data structure in form of list of presentation creation parameters. This could be:

+
    +
  • Presentation type (table, XY plot, 3d view);
  • +
  • Presentation subtype (for example for 3d: scalar map, iso-surfaces, combined view and so on);
  • +
  • Parameters of the presentation dependently on its type (number of colors, type of scale, font parameters, grid parameters and so on).
  • +
+

Parameters of presentation are persistent data, which will be stored in study file.

+ + +
+Back to the contents +

5. VISU module features and services

+

The functionality of the VISU module is provided by a set of classes which are combined into +the VISU package. +

The API reference of the VISU component can be found here.

+

5.1 Base class

+

This is a root class for all objects of the VISU module.

+

The API reference for this class can be found here.

+ +

5.2 ViewManager class

+

This class is used for management of the view windows (creation and deletion).

+

The API reference for this class can be found here.

+ +

5.3 View class

+

View class is a base for all other classes, necessary for creation of different views .

+ +
+

The API reference for this class can be found here.

+ +

5.3.1 3dView class

+

This class provides a set of methods for creation of a 3d view window.

+

The API reference for this class can be found here.

+ +

5.3.2 TableView class

+

This class provides a set of methods for creation of a Table view window.

+

The API reference for this class can be found here.

+ +

5.3.3 XYPlotView class

+

This class provides a set of methods for creation of a XYPlot view window.

+

The API reference for this class can be found here.

+ +

5.4 Result class

+

This class serves for inner representation of data generated in other sources. +(MED object or file) This data is needed for further construction of graphical presentations.

+

The API reference for this class can be found here.

+

5.5 PrsObject class

+

It is the root class of all presentable objects.

+
+

The API reference for this class can be found here.

+ +

5.5.1 Curve class

+

Manages presentation parameters of one curve. +This object can be used for presentation of set of curves using Container class.

+

The API reference for this class can be found here.

+ +

5.5.2 Table class

+

Manages presentation parameters of a table.

+

The API reference for this class can be found here.

+ +

5.5.3 Container class

+

This class is provided in order to create one presentation using several presentable objects. This can provide combination of a set of curves to display them in XY plot view. +

+

The API reference for this class can be found here.

+ +

5.5.4 Prs3d class

+

Root class for all 3D presentations.

+

The API reference for this class can be found here.

+ +

5.5.5 Mesh class

+

Manages presentation parameters of a 3D presentattion of a mesh. +This object can be used for presentation of set of curves using Container class.

+

The API reference for this class can be found here.

+ +

5.5.6 ScalarMap class

+

Manages presentation parameters of the scalar bar.

+

The API reference for this class can be found here.

+ +

5.5.7 CutLines class

+

Manages presentation parameters of the cut lines presentation.

+

The API reference for this class can be found here.

+ +

5.5.8 CutPlanes class

+

Manages presentation parameters of the cut planes presentation.

+

The API reference for this class can be found here.

+ +

5.5.9 IsoSurfaces class

+

Manages presentation parameters of the iso surfaces presentation.

+

The API reference for this class can be found here.

+ +

5.5.10 DeformedShape class

+

Manages presentation parameters of the deformed shape presentation.

+

The API reference for this class can be found here.

+ +

5.5.11 Vectors class

+

Manages presentation parameters of the vector presentation.

+

The API reference for this class can be found here.

+ +

5.5.12 StreamLines class

+

Manages presentation parameters of the streamlines presentation.

+

The API reference for this class can be found here.

+ +

5.6 Animation class

+

This class provides a set of methods used for:

+
    +
  • generating different animations,
  • +
  • setting the parameters of the animations,
  • +
  • playing these animations in the VISU module.
  • +
+

The API reference for this class can be found here.

+ +

5.7 VISU_Gen class

+

This is the main clas of the VISU component in SALOME application. It is used for , +using the views provided by ViewManager. This class provides a set of methods used for:

+
    +
  • creation of all types of post-processing presentations from given Result and Table object reference
  • +
  • creation of animations
  • + +
+

The API reference for this class can be found here.

+Back to the contents + + diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 2f1d27f9..751a8364 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -43,6 +43,8 @@ module VISU { //------------------------------------------------------- typedef string IdType; + typedef sequence string_array; + /*! * This enumeration contains a set of elements defining the type * of the scaling, which can be applied on different presentations. @@ -76,6 +78,7 @@ module VISU { TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */ TSCALARMAPONDEFORMEDSHAPE, /*!< Scalar map on deformed shape 3D presentation object */ TGAUSSPOINTS, /*!< Gauss Points 3D presentation object */ + TPRSMERGER, /*!< PRS merger 3D presentation object */ TPLOT3D, /*!< Plot3D 3D presentation object */ TCUTPLANES, /*!< Cut planes 3D presentation object */ TCUTLINES, /*!< Cut lines 3D presentation object */ @@ -534,6 +537,44 @@ module VISU { * Gets the type of orientation of the scalar bar (to provide backward compatibility). */ Orientation GetBarOrientation(); + + /*! + * PrsMerger method: + * Set mesh on group as geometry of presentation.(clear all previously added groups). + * \param theMeshName - mesh name + * \param theGroupName - group name + */ + void SetMeshOnGroup(in string theMeshName, + in string theGroupName); + + /*! + * PrsMerger method: + * Add group as geometry of presentation. + * \param theMeshName - mesh name + * \param theGroupName - group name + */ + long AddMeshOnGroup(in string theMeshName, + in string theGroupName); + + + /*! + * PrsMerger method: + * Set scalar map of presentation. + * \param theMeshName - mesh name + * \param theFieldName - the name of scalar field + * \param theStampsNum - the iteration number for scalar field + * \param theEntity - entity of scalar field + */ + void SetScalarMap(in string theMeshName, + in Entity theEntity, + in string theFieldName, + in long theStampsNum); + + /*! + * PrsMerger method: + * Remove all groups.(The scalar map will be placed on all mesh). + */ + void RemoveAllGeom(); }; //------------------------------------------------------- @@ -583,6 +624,7 @@ module VISU { void SetColor(in SALOMEDS::Color theColor); }; + //------------------------------------------------------- /*! \brief Scalar Map on Deformed shape presentation interface * @@ -624,6 +666,27 @@ module VISU { void SetScalarField(in string theMeshName,in string theFieldName, in long theIteration,in Entity theEntity); + + /*! + * Get scalar iteration number + */ + long GetScalarLIteration(); + + /*! + * Get scalar entity + */ + Entity GetScalarEEntity(); + + /*! + * Get scalar field name + */ + string GetScalarCFieldName(); + + /*! + * Get mesh name + */ + string GetScalarCMeshName(); + }; //------------------------------------------------------- /*! @@ -964,6 +1027,25 @@ module VISU { * Gets the number of cut lines. */ long GetNbLines(); + + /*! Invert all curves of corresponding table + * \param theInvert - Invert all curves, if value is TRUE, else not. + */ + void SetAllCurvesInverted(in boolean theInvert); + + /*! Checks the orientation of all curves + * \retval TRUE - if all curves are inverted, else FALSE + */ + boolean IsAllCurvesInverted(); + + /*! Sets values which cutlines would be shown: aboslute or relative values + * \param theAbsLength - boolean value, TRUE or false. + */ + void SetUseAbsoluteLength(in boolean theAbsLength); + + /*! Checks values of cutlines: using aboslute or relative values + */ + boolean IsUseAbsoluteLength(); }; /*! \brief Interface of the stream lines representation @@ -1134,10 +1216,21 @@ module VISU { * of calculations are taken in one definite moment. */ interface Animation : Base { + /*! + * This enumeration contains a set of available animation modes. + */ + enum AnimationMode{ PARALLEL, /*!< parallel mode of animation. */ + SUCCCESSIVE /*!< succcessive mode of animation. */ + }; + /*! Defines the field which will be used as a base for generation of the animation. * \param theObject The %SObject corresponding to the field. */ - void addField(in SALOMEDS::SObject theObject); + boolean addField(in SALOMEDS::SObject theObject); + + /*! Remove all fields from Animation object. + */ + void clearFields(); /*! Generates presentations on the basis of the field. * \param theFieldNum The number of the field, which will be used @@ -1302,6 +1395,9 @@ module VISU { */ void setCycling(in boolean theCycle); + boolean isCleaningMemoryAtEachFrame(); + void setCleaningMemoryAtEachFrame(in boolean theCycle); + SALOMEDS::SObject publishInStudy(); void saveAnimation(); @@ -1309,6 +1405,28 @@ module VISU { void restoreFromStudy(in SALOMEDS::SObject theSObj); boolean isSavedInStudy(); + + /*! + * Sets the animation mode. + * \param theMode The value of this parameter is taken from the AnimationMode enumeration. + */ + void setAnimationMode(in AnimationMode theMode); + + /*! + * Gets the animation mode. + */ + AnimationMode getAnimationMode(); + + /*! + * Apply the presentation properties to all fields. The exception is raised in the following cases: + * 1) presentations for the given field is not yet created; + * 2) invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i; + * 3) the MED file is not the same; + * 4) the mesh name is not the same; + * 5) the field name is not the same; + * 6) the entity is not the same. + */ + void ApplyProperties(in long theFieldNum, in ColoredPrs3d thePrs); }; /*! \brief Interface %Result diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 5488527c..646e9430 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -4,8 +4,14 @@ - - + + + + + + + + @@ -48,6 +54,10 @@ + + + + diff --git a/resources/Visu_add.png b/resources/Visu_add.png new file mode 100644 index 0000000000000000000000000000000000000000..a7e93b8ecac973cac892d230e9478e3111c6e243 GIT binary patch literal 389 zcmV;00eb$4P) zK~xyi<&-gM!!Q6vpMwVv9%S&6E94r1LTcy`UqR={5JIQW6X*)gU{C`AH@C2VsQp*})VH>8G2NxUwDW%uxsH2%TrZ!mXRuH;i*<#`a?mza-o@dUrpbg9x zlV-Si0;j`Ut-2zm{JG_OL7k_(ep|D8T|EpKidaDWxQ1bpCIA$hf_$C_Z6`{p#^EgR z0`qzPeW6QD_LBV(J*Z)O5=9Zkrr>-!V`}65Q7Lu%ahN_$5wRdi6UOQIu7*w@)vm%? ji@jR5@7qBQ|6x7>8r)~mUG1Zr00000NkvXXu0mjf)Ha+e literal 0 HcmV?d00001 diff --git a/resources/Visu_cutplanes.png b/resources/Visu_cutplanes.png new file mode 100644 index 0000000000000000000000000000000000000000..5e92cf6511bf81e7ce3a9acbbb2fbb07ab2d7979 GIT binary patch literal 389 zcmV;00eb$4P)I95{Iz+_^bb*Q$vH}Yr*@sBvmLBL!?Po(c z)R)Mg-~0Y&EGh>6bv@iXtqO4y>~TtV_&$uq&9Y&Nl_#tiZ0i9CT_ALUX4x?JyNr2n z6P61j8Gt`|RXcZqNN!L9ab$+}hEHq1io~C7!$x>m|tf!4-<6dOXHzpLB z2ol+muL`d==xKiUE(Eq8+p=)H>LO%57s^az#u#c-=My@YCQ3lY zl+4a7W@gl*lw=bDB6Cj;JF|bnuyE`?cViJ;{u!D%7ZMiBnwO>;h5N64QgkniWgw3- jPyy7Y9*gc}u?*k`Ui`0HGf01Z00000NkvXXu0mjfBypsi literal 0 HcmV?d00001 diff --git a/resources/Visu_remove.png b/resources/Visu_remove.png new file mode 100644 index 0000000000000000000000000000000000000000..e85afb6224acc7d2a0649e3c2465a0dde5566e67 GIT binary patch literal 383 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3&Vd9T(EcfWS|IVfk$L9 z0|U1p2s75F#7_hYvX^-Jy0Ty6;^3CCzBA9xg@J*Q$J50zMB?((DYjXM4J6v+rFrFS zPCQTzKViz$dgX%RzNT{%6$yjCvg z@#5m|z4L!8aIM<*H%7a6oypf-&*V7ec@9W0GpT&iOL)=D_~x5+-&w)xO(oY%*YrDy z`<&mlwqWTL^UE9hjW0{ADRozf*^p!Pg~?oA`q=s8=aCtA?H-kTEdDDGOg zne*O50awANo1Sd2Pmp@N_eIs4^92&Ny%RR7cnY(Zf1TUOoBH b{tD}E@5F0KG3$(gLB-(d>gTe~DWM4fmUx*s literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_container.png b/resources/Visu_tree_container.png new file mode 100644 index 0000000000000000000000000000000000000000..40aa4d3392f64b58f09d9368873aa0c2cb8e0ef4 GIT binary patch literal 425 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx-l>?%6qyvhE&{2`t$$4J+rd1@`PXKPc*Q6`+Mp?f3o#PUzdr_Yz&M?I?ggoNaLOT zxWLuCFXE92i$a6L3wxesp3|pK|NejF%9s5&w`?xpdG!A8O!jH+#~Bz|6epNmzjo~( z`^6JoA0(Ls95mPt@Gxq&B-XSwTw!7naFclOdH>HZ#s9CLKhMyetCO1W;Q8}(1`Y)t zeSuH*K0GasuNav)-Z3e#=O~{DX`j{q;f3=y(VMCYzfzV7DmySN+`%ByU~qY2?y;x! z0=z)u^)&43<|rBzvfcTA!ff$xc{T>74#qTN!;9_j>L*AzFdW?5uugKm;)yIqrVhdI zI0v>JbLQkWVTl3I2(nD~0cv2hqMOxkn6V&1e+ RZD6o6c)I$ztaD0e0stZon)d(z literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_curve.png b/resources/Visu_tree_curve.png new file mode 100644 index 0000000000000000000000000000000000000000..e17c5f4fef89ea63d186770a1510244b51302a9a GIT binary patch literal 363 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hTb^mK6yskoK&=l_3uW@TmN3BS&taA0HLP*7vzVsv0=%=ydzc*0|@28N`jOr`7G z42(ybd<*Wcui3GB&JDFkrVzopr0D60Q AEdT%j literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_cutlines.png b/resources/Visu_tree_cutlines.png new file mode 100755 index 0000000000000000000000000000000000000000..f6ffc7cf7561f84221d9f2923da9fa9145f52685 GIT binary patch literal 773 zcmV+g1N!`lP)6(7sFl?0m`Iyw56wu>&;QRIlP^n_kd(+m| zQ7hFV-BI-tpfrB(1a9TaqFfjwozCR%clQvjdgJPL1}`wuXrG8iALhXXppeTWaRKj- zOime**jt81MmW@SiFeb=mF4RcvW4l_FYc#y#w`IhLO^D8RQ*-r#J#JDE>B~aF98@y zNK%#uo{p*vd*|X?X+J1`&!&X>+rXG#i;-|}b1rg5Bhj`l$Y(ju8EPgJRM4=B-iM_K z2ts8#7cZPf`bY|a4Zygg_>RR?H%(w9jF!X*sbFW&%yWF{5~{h2Wgq~AEBKcE`jdl& z_7ec+6bD)DJmc)}Y0x}Tl37gU;cF6A^eFYcW=t0j1HhMGAa%srIU4T(VAt2%oE`3j zutv;$Et)GXQ`9WT3yPn|h#a}X#&O$Wmm+u-P(ODr`tC?4*X$}_lrcj>Wf;`*LM5TwK7Z2i!ySJW{#i|!U z3R*q)kRrl*s0R@*J-Faj6eJy8GT;39JOpbi;(LDh@$!3l zM00Uob5CYYHAKB$-|xEai?(f-ZQGu-EbB@>pI@7sn_Fuw)$Zd(b8%kJoN5Sw<>h6& zP$+!ldEP>)RKjr_9LK@7ZA{Z7m&-K_!+5z;sayqUE!DIHa2G$_Q!bZx_xt^Gn_+HY z!#CL4`U9;s0S3)%LbKgMN?DUKY4m!pA3k&_TLq8+dP@8{91g!239MlR2hy2QgtiewoI!XlK@jlc#pLb+TIhcc00com#v7pq z3Nf>94245Zu);1YAc`WcU+V#aTsFfG7tUHTLE@(t0He`}L6T*cx=kotk|g0+`Wc70 zL?RVY6rpuI-d_pMfB&5?0S;P?yDc8~FZ1!nhr~L>_kCm%kr)yk#wevw2>1=?jd^)| z`aRy?aU4JcytBCijzNK6=yW;^qZEdMaB~~q_t~iocvX{LPN^I?fP8K01G-ibrPL(= zT#M1k96ORGtyYVECxQ+r4ZiR5(5(>8LPWyT&p#(5FWC9$tv@lV`_2L1X5JVvaXKML z658!HV%x{e3A9r5`+YV%w~zMGz}q*zx+0p3^ZKz*F6`a&>@!< zFk7%ZrY0RGCmr0$BD1rzYY(RB(fw!6=+B>eQXIYc_4<7>{heyHx)WHiEUWB!9>rqu ucBxc4U9ZD!CYj{{ z|0SNQaLvRGin;s@!*Fj#l@3*`uQmWfe2S(vWIUN$$7xwjKPfW&E+f zR91R@Pg8qVPI=#JO^x)7ejFRCejWYY-R+>PYuP!5peJ3pfpkxm@x&lnmH$9_rF6JY zG;MgRu~}$28#NVr?A8U*-t~*~6mh3>NqTm5a)#XBl0CEq75{+{mtUzUf9-k9t%lls zSx(5|8~w&PS56h7pq#`4$=l>Nr+pH&p*;zPTocxZ{7vgCOym9`+`uB5!x!?y*`Oa@{vId+6m%XVYzTyrLF8 zsr87`JYV;P&(E!}7$Jx)yJkU=_(e<+P4+u**se7MumXdbQ5GXkh(-rW3yCf_HQ;D$ z(2O7DZ(z1yGAIPT0yXKUX#jM#lj)X59_NUiZB zl(ydmyHlf>N;X&f>Jp);iC-_9$VM$&fC~+?l;*;o+ zp@>D!#dO4oVvE%3n1vi8cu|(K+%`n{MWZ)%UP33Y-b2}~I^x(?qv#Q}e8AAAvYD)& zACv=HF7ki=oKP|8P>+YUhIb3PO#+kMCs1rd$Bp}c%pz^7^#?7A1D6Im@`ehuUrw!z z>8W(79NdoFjYno!mh)RbCJHvcQaW6-pOehPt@X_ujZQ}}1-wG87_M;KRPT=cznD#H zBJ7T-*8=vtxiT#y$e$hI8`Z&&AI7n?JIovyw!-Y72ZPx`lKR|&^cN4RFdkem!V~Bl zuh$JWVI%gyhqNMRpKC+$)gv^X#(dRJszhCDraC(MolbR8hbM3>m|V4P-5m4hn@)^z doM9Jmgz&vVna`u@mU_PjNK?~OE+;8!{|D(l8XW)t literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_cutplanes_gr.png b/resources/Visu_tree_cutplanes_gr.png new file mode 100644 index 0000000000000000000000000000000000000000..bbc472726cafdb5fe2d18a6e1df8f832a6591974 GIT binary patch literal 960 zcmV;x13&zUP)P+}5J=N?J)^Cy%@GU+<5N>pPtG>@|MhPM@EpIa0DL~* zru@>f(DdxI*X#BAMTFj-9!`h)sjaMLY;5dOyZhlsyS{DtbaGa0o!Gkr?JlXLq{O?Z z$>`#H$Gqm6r*JqN1cO07jxCUVq#n21O*kC(cV8R){>0gWt(yx~1h@lGN?GP^u3QN3 z`5@D|Ycr( zFdh;9Xg-Cp@C*)r3tDm+u7AVr_or~~`M+&J;QljA$}pMkbdWHjQW%ARhQy*M2T+?J zRtCPj4n8rpBe@PDIS~$;PVjhmgyr9LlmR0nBf3TwP^ZxHuCmcKKt^0)xRR85I{4D| zCi(FtY-w}6o_>f|!)IVxVeD7P0+g1PM$IB-RQfHlvM%tB>ZC`;IqV+isO>zSr7*ul zbo|;72UAzM?Q&qetZ@CPh-)jX&nSdN=P^R;<~vpe5QQNonAFJZQy5kS2@^)2!gWJ& zR!g9JJU_1kEEE{??Ab8P=zxvE5wPlDQh))UwZ^en0Xw)(D$e&Od3*bo#pc%53IJ_- zXNF#rHAmHzi_|q*Ze5wzNpmPNP`q+vjlOL~SVaLE-FlKkWm{tV8lJ7Gt*uSXHuyyY z82ZggU@rp`*AfqEns(Xlvhl(jt8`v0!sGFf?N;>nCpa*ed$YJ~dqq=I)31NqG*e$G z6l@y@@tEi|rm6M~SxY+pvkSQYE%}jlzsQ=OVI4~?Chu1x+ i0-Ax{A`z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZS^qROgDhJAbXF#rS*3z}w49vy?dd?uD+ulMg{`19ju95XX>90w-{!~2hn2|)Qb zNNV>0@lSvNLN-8$-`r*shpeLH@3(Il1OlTO{-4;zuztgChAUU^F=WR7Ss?tEgWp5iP75{zz#vmD)$iTtym*L#?I}GnWPG<0P zT*NTB{69nXR}KbU78ZtJpoXWPzeIld{-qlrfIu#g%-xw@`wtulSXV8<9V0ixQ`44~qVq#=wIs4b~D;onq002P%zW)RV9Ul%9MN9zn(#`+`5E20J%Ekad>45-NPyqm>q51#{rU3x2 z#QFe30Q>--G&BHMT37%8{QUqA4-o(k5Do|eh=t+*|9}7g{$*h1<7aqz>I%d2_6CNq z!aodamNGN&i~VC@2Zp=e|6dHt%uE@=Bf`Pn69QT!E+)>v%gwtKAb`Mu$il_N@b1!8 z2E#Ya3=5YqGU(`VGR*DZV&LQb%fRvbC&Nw)3kI)%I`$tUxgy4ju+E zQ8AFycLCJ}0iFF1OU7dW2q0j{aQpTmCJNHLmyv-n z45<0t&!0aT*xA`J3;+lq7BO~im&Ul_E$@GRWnkf81*R~dW>KJKUcs|K%^^U|9~kfe bfB*vk#6t~l8d@uf00000NkvXXu0mjf0K3Yz literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_deformed_gr.png b/resources/Visu_tree_deformed_gr.png new file mode 100644 index 0000000000000000000000000000000000000000..1d619f4f3e8393eaaf72e3a578115cf0539dad94 GIT binary patch literal 924 zcmV;N17rM&P)7AzwD?}wCIJWBQE(QgWiioU( z&Bo1IQRp@gjG>)}4eFRfM@5izmQh!eqAMmITg#HQrpwlJNxuB!_kCWtXuB8QyXX1w z@bW%VYDdsw)p$R=C;>>4)T+5W7t2>O054dUbrc}o9a^JTSDOH$(Wo*%Ki}sHga)eG zJG7;-(`O zPlws;y;gJja2-GHD&w7z{{>XyXS3N)e$VAy!qyo@%ViUf6ig7ck=7@-qgn zpDPipQTgtk&dHQv?2!RVrBbBma8ldRi786h)_b|JcpdlntBejU;Bneme$nFjFY-KC zt#aw1hZ#6>q;d5P?ou2M?9F$e&;EwKqO)>rAN%_jc=A~Vy|9e*GxRy^oY-C#DIefe=tQd4MKmmWc@)qi;L-C1axOg;#Vh2L}g{Wf>uaVp*0_0nAIX z5~8Yss_8?#d)|rXx{R4O8G2vmgU=m!JRXLI1~E+&UDr_*WjPoO7At^n{?4yNmaZ() z|8WbB%pCW=xdlV0IHwZq-o1-JAOJwISi~?4R8^e-kZ%G;%b7()Ax?b51MGaSjjFLI z)mt|b4u@%KYNAjmtl46*cnCmEcZaM*A|c7Hx^nH_ZQ7~V&Y*3740Znqf$=o;em~i4 z768k#Fbo6JG)KF-y2jGoA?v?Sl$+g#C8OClHNv+)(0Jl|Y(5{EOop4~!m=!Yap1W% zWdcBv74wgI#HZ(R8`{;{+B#P*mqXJuG)+TQ)f=j+9@I4Ljh>z!QL#z4*7>%PsR7Hf y`deFDw>q89_WJsI+-`Tu?RI}XJUlFJt@A%r>sJky6qOkO0000|!cd>XFnE{D@!Z;!`TY zog_bcL#F7Q7FZgNMPXL4xbVQ{oLVbDSL1dU?nJ?p3hif|L%%9jvT@x0Id322J2WuCs$@ ziXX$vg!@8M=m;Ca-h;=>?if`JEw~Ovepe9-Kk79_6`(lZkcmk96?`>;HDZ zD}2QV>?hX3LMng9>m&M&vm!2vsEa78E34(G@%#b)%4F;a7cGzg0000z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ|Nj>j`u|^0@V_Gi!~dMh%I^RH#Du0fn?t8Y_{WFI41b+M7zCgU&o=g%32|C-tirk~F+y#B__pen$` zaO&D020tb?hF?g^nV6Uu00IbRfD{ndaq72ud^%mp@HZ!s!F)nA!xss52KLAQ8P**B z%`o>X55rI9{|u~vkW3+V43K>UP<=l?cF#{cR-{V4_c-vI)MnORW(GN*DK15+{|!ygfK zhAky$7_MDqVW^MeV)(N6Kf`t*eg;8C28Mq?TmSt0$&kas!m!BLh=Eg5fn`a~>j%CLC z##st}P4?syKuioo0H6aHz5)%{#=*(ptgFlLMYwF{BfKRBAy+9sW3$a|BS_sw+?gRQ7|;KE&; zdpP%Uu39>h7j8m&c2P}EPUerF{N(h?)yq50o!vHm{pVI9*$OsRtiAY5E^#woEgi{A zdUjC(OiWB9lv2k(ocn6zYS&RVV;|s*4fAa2CH7{+EPXBno-kYrbEv~%`N>`AZKcuC z(bU@7+SzisJaVmXn#M0D(XYJ7J+rTJ_^{!^$CmVfCRS1$>TF|Owv30j1*+BRo7HM{ z?-lQMg33Acqq{Jlp5j2xXJOvbeVe8-Z+XlZ0uj{qpolOyIG7z88j}A0en~uhLfSH8 z68r3o?0Dz_`J(K|6Z;)`_w|H~(I(Q>C9AG0>#i$3TGzq=p65N+Xf*g;=Ljm7(J$;K zc>g`7Mt@}H9pRCj;q+UZyc~<-TZ@Lj9DwRECQ>uTh;F}2!cMn@_w-7rBPH4U5EDn9 z?lJPM(=N8NL)KhZZn&Ui-2(;-lhm? z*r61^TFV>BB>8+E&+~q(*XtvNLcuN<_sLccE*?d`zXo&XI3}=OZ?b3tuB-|Nn>AYP zNpgh(kx1l>=XuYMkB?Wj9fko~8<&b~@HpJ~?k7NN^`N+JJy6~Od;gv<)9G}@ahwxV qQ&Z>vzM}f4cmA)NEEo6P!v6yYt31(=5s2Ub0000?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx-l>?3VXUZhE&{2`t$$4J+mrl8z> zGBZ%<$Wzt{X%p0P4xB#Sy>R13!8c3|3`~L%h9_DbZXb}y5SYU&w0`~i|NI{h*0VJ* z9D2nRvu(az?JUL>GZSxb%S|vl!OFnclBjJqJMoc%9f$I6kfj%xd03d3m=1htDr(EJAr`Adu>nw=z%x%CxCtXQ1fz@Rik x{KDTJJ_aU^ITJWiC2GWgW+*ScDXDOP!NBh+o6i3UOMyYj;OXk;vd$@?2>{x6h0*{3 literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_plot3d.png b/resources/Visu_tree_plot3d.png new file mode 100755 index 0000000000000000000000000000000000000000..ac6442501f4e0af6ddb48651ada8760e713f936b GIT binary patch literal 1205 zcmV;m1WNmfP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ=D@jB_RCwBAU|?WK0^)6j`Gu;dPn=dcabOoi_0$Ut z3;|yl1miw29G3Qps$>8NASSQ@aeo*X;=VC(e*VF*{e%yL`KOZ%OHRcwSid~VutLs=VWs{@22Lih zQilJ3m>Iq?a4~G#lF4xUmMjB60D(oX-Oyy1{!>?!G!3MB}{$#j3*@WTveKm%E|KBqJ1Q0V&Ozg?Ku&k|u6B#aY=raV~ zThGA!`ya!6@g#;MqxlS99&#}}{Vu`~AH0a+hcySo|7%PPJnbJDK3J+Suqi740|+2+ zAbR>sTxsgnWq9(9i^2KzK?b(JKN-#l7%_Zg<6~g^^P53}?*)UZ>TQOI;D)-#LTf z^-Bc?cgZIV-@b@3TzaI*@aUBc!vg^Y20znH3_C4+7>?UnGW`DbjR7Elz+vF;q>!a2 z_nTqehAj-m1qBSOtjr92d^`-IBD@UN@-G#95Li-D1aouRI#mVr-z510-9Gw^WoF!1s6GcYs$XE0Q{&#>d_Cx#18 zUNH!AzGq;0xRBw|FL?$VTRjGV00J4nbmPVih7TVf+w@aI1x!`+AP7&zG38MHJt7y$wZWWY^JOUttOxcH`fckeOq z@bEA&voSNUu(B}x|Mwpp_aFnA7?~J;|NhOu%FN2JZTmI`Ru)zUb}sfm009O705@Xw Tf_jN+00000NkvXXu0mjf?N2YQ literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_plot3d_gr.png b/resources/Visu_tree_plot3d_gr.png new file mode 100644 index 0000000000000000000000000000000000000000..e73180bc9525c02a7edc5e0a691f6b7a5cc6aa3e GIT binary patch literal 918 zcmV;H18Mw;P)e9gP0}>EG0QATGo5q=C3C|y4I;P=sdhN`pv;%m^g$`QQbgt- z2121PB4fe?=fhyQ>O++wQirvI!dfk~+my*RiR};@lhh^cO--7#xi|OtVAoCX!4D4S z;e6-!aQKdrO(lf86gfAm@E2*T@M(# z{!>BM-_l@W!~bG7l@RSVNJNyOp&_5&?|;>Hw;ipl?~9CHiLu3hk@k3e$#d;m2-t1G zn}8b#18f5N`}=o3cm3C?i`~xzzDOr2tu^s&dMhU;2iaIgwG|oZjQz6y+R`bi+{+a2 zD8R$O)!&cDOz*o@XJ_waR!p6SqT;ko<|aCDN`nS~rQm(Kz2F+1zX>SivZxwh0c`uM z;#~GAI4c%qUkhHV%GmTFTt{cSE>g)k*-V80_23f%|55d+U(HO8h7 zku1;f$!sr={rLl<+aBT5T`PDTj(<+K3StLLbPnjcF-bHU9R}p|v13wd3dpM8E8<0@ z2|3sCg0v16<;TUnQt9=GfiA|dF1ZT>l1`_?A_B2k>|;PUEOMahD=86>I!-wgc}aLy zgnc3hPkbpdjTmQjF$Q!gJg`d^2H)rv5tLXg_E9F2>AO7NO?IuBCkm5j<~lPidsy`} zx4oUPX^EPc)-J= zVdHjtuACZvrC%B5Og5Fc6XjyD=q?tE{15Hf=$AHsA)88UPLto|&#S81<8rxtfj|IV s*YW%PxmvCE;rRIY*V$C!(%rPb0cb95C|pAgyZ`_I07*qoM6N<$g6G7fjsO4v literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_result.png b/resources/Visu_tree_result.png new file mode 100644 index 0000000000000000000000000000000000000000..a9eccf9ebd0ea4dd785a241abc1bea7c90dd4a12 GIT binary patch literal 421 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx-l>?N_)CEhE&{2`t$$4J+mrEcqS5?GWR7z`&0f6|_H`XD1m5;Kc{AG6T&vxiqoT5bbs zNtZC${ws;M`Nq+s1!f-lK(&X2gig3DP}||V_3CU%qs?z6migNr5x6jyMf`q%RX<|} z$Kgje;x?EA^)Babm{quo;ThM2xCVx%7U z3!XDGIxsvmVR%yRG|Lg_^8<|@S!_ literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_scalarmapondeformedshape.png b/resources/Visu_tree_scalarmapondeformedshape.png new file mode 100755 index 0000000000000000000000000000000000000000..77c346c617fe52c70382034ff3698e6ad98d9f67 GIT binary patch literal 1140 zcmV-)1dIELP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<>PbXFRCwBAV88^@Y~oTcf%JEG5BG(K4jxiHxbL8< zh=>S^qROgDhJAbXF#rS*3z}w49vy?dd?uD+ulMg{`19ju95XX>90w-{!~2hn2|)Qb zNNV>0@lSvNLN-8$-`r*shpeLH@3(Il1OlTO{-4;zuztgChAUU^F=WR7Ss?tEgWp5iP75{zz#vmD)$iTtym*L#?I}GnWPG<0P zT*NTB{69nXR}KbU78ZtJpoXWPzeIld{-qlrfIu#g%-xw@`wtulSXV8<9V0ixQ`44~qVq#=wIs4b~D;onq002P%zW)RV9Ul%9MN9zn(#`+`5E20J%Ekad>45-NPyqm>q51#{rU3x2 z#QFe30Q>--G&BHMT37%8{QUqA4-o(k5Do|eh=t+*|9}7g{$*h1<7aqz>I%d2_6CNq z!aodamNGN&i~VC@2Zp=e|6dHt%uE@=Bf`Pn69QT!E+)>v%gwtKAb`Mu$il_N@b1!8 z2E#Ya3=5YqGU(`VGR*DZV&Lcb!@$h+hhe>w6N6`DI0Mtae+(jmA`Ifz_y7wG z58DL@2tNi33_t$`1!?^R1ONhvk&%h{`+rAUj`Eet3?ECEGR$zVU|{(FgF&!rBf~mP z1qKmDCWhmVjtriQ7BL*{>bxR*_^__=jF~{o8Nu-n5I`*dnHd;3?W7qd_J3yhuO7j` zYADPg7e0d_IzN@+$B`opjIZ7@a40J?oSi)FiXaF3d5LE)xY^&nwE*fp48*?x0*H}G zOZGe8o=%P*{i_&$@N+PzY`MvhMFvK}}Gq3{1c-XlZM0t1^?l!k>P;z!W zDLa2|5m3W*Ahrc!XCMv%VkUq9V)}dSF~^tsr3~ut7#ZUAY#G=kgcx`@c^HJ0lo(Vl zUtzEh4PL|f_;CkNaRCqmJq%0`5TF6XoB#pDBF4_`(im5~<^9jE3@kurbFp$Vh>D6b za0`o_<$C%wQRK+sG@!zAAPxlL8$c`x#Fv10G7!H62rvL}LoIRxEQAjL0000y5guH~-e#=U;iM#9+0hqg@%4WLd5=8jW?KP$*bYQPFnh%y9YIuL#x@_n7`A1pF@7ner{rOZhqh4ra6TZUX4-o{~S1-&JSlay^MmV zi3R**R=tXpZYL62;L9&Q<>i+~DRmpz`OpU1PQ}2{q%erVTW6Rvx3iFR|!TF2wBh)i`8n$MD}e!oBG^rVlmp zY^9$oLuR!2Dv}22l7XvYvcD#f3+G=G!^2+#Se+IO0QzWv70)FYygrk8V<93*65()|a5&7grg5^Q1b}Cno0Xzt$F>9H zUArcL`vCRbcJ%REzpJOcC1$hv5uh%SNPJ~kT53N$GQw@M`Nh16iG6FeSz6yl@&7t! ncMOU3dLlpnfxXpfSugnqwKrq3(YK=&00000NkvXXu0mjfzn{sV literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_scalars.png b/resources/Visu_tree_scalars.png new file mode 100755 index 0000000000000000000000000000000000000000..d0c93c58b69d1adbc51ca9c7f60da6173f20138c GIT binary patch literal 1118 zcmV-k1flzhP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<)Ja4^RCwBAV891hSZkORHNP_}%6wN)X8EqB#`N99 zg!wxkKjU|x?DuKYr#b@!5H78*42+CboQ*U8i@f~xpZDwD|1bW_|Nr}w@BhkG-2cmp zIQ~nCGyL!EoA@6ffLO3-j$zkHTg)74%)pf%!@$D0fg$wo9tN&o-x#v9{w z#l~>w<`0H@cVGMf2p}dj&Dk8fwTro(W-_qFrZKR7xyFXtTznC`fLny z7jiS0y=G;2dz^vcE8|xNfB-@_z>Q5Vh~fXA-wgjh{9t&`B*;+BvYA2c|09NVI~f^b z)7Ti^&-ur|kolj1=^Xq9u5u$fB<4-WaazM zrWgry_9vjTzcMfyFfy=+J!ANG{Rcya=4FQI%Y_-f-2BVHxQvnEU(-*9Q~_3oi`v=@ zZdR5I@{*E200M}GkyGLakK+uE|L=kBFl1o(6U@M%sk)9qf72v}xATEM{PdsUFVLMo zru|{a;bvv{9~H?^U|_)T{p)uIP7Y26fB*nN0KWeM0RQ~}{_Ohz{wMGN{Y&%!2o1mh z4E*2#PVvD2`2qs~01E&B0fYbm_4NDzwhRdXLoF=;`1kk#5D*Xm85bD_0*Hy>H_&E1 z28RD(ObkFrGW=(L$G`qCO5R>@A z&c<#H5I{@}VnEH|%nVF_fQm&=GH9}2XIS!YGQ;mbObl$_KoP{ma1j`2KSabC`1p7k zxVg9)gam~c*jU+Ofi|812p|>)CRPS!aV7>9-fIkw%*Pp)FiZzp`kg`iKMTXnhu;}y zPJF|#fL(zhAUm0XgPE0qo0FS?ot^z66BE-zR#sL9fB<6o_xdHr+uR7CU!OAk{Cl3E z1em&h0iFHuIuO4QWth9djKSI2h(U;-gMpiahe1e4hym#IW&i&DI}dUnKmf6D|Nov+ z$R|AK`P2UlFMmifTw`Jb`sqIdn;;`YVv;C>nwlEJuOGh{c(`~N_=WfxxVgDcFfuZ( z{r~?zI0XU(5aYsm3&o{nq#wL|{gUC=&tJey$Ouo@fByUddXtfXjf0IrfLDNllZ*2P k6C;xgQ1e@u8h`);0Ce>zQZwP8Z~y=R07*qoM6N<$f)yb78vpTt3Wp!8^lsF*=3N%h#J;lOqpA!f+b7{H@CBv^F2p>pX2+U_kFsM$aT@@`uqFx zz4(2^^6@ssHqzsBVsv!0F_B30-p}Ws`{>+-S7f=Y#Up?D$)FHiJ=j*cJ+J?B1TZi# zP#GT_{3;B?W4f+$e&!n5#aUFU$ZOT7^+|h}Uw>I(VKHRl^G(j~Xx=IS=pFnzy2m`vBk%9V*wamTK%$<~v645a ztJxqndzEj#i}3!tF{BfqT>-HUM7Gw~8HTYIt!-CTNAoJ#SyYLMKUMm{wAyv&Q)NAy zQHKsi)U8}X1uNC6@J>>#+DWyNNUDscIRc?A2_u;irj3YHgH}RRmnj<__NK$kq(?Go zk&bJG=fLr|9VDkS#4O6&gZ-Z$QLE9JMiClz0)H;fjmw5(PFw9X}8D4UI88l5h6W z(9nRCavng#2ZVydilC{2n6^NvVufO0qX6O%`%SQTHsDISiu(F`q?AZ0$F@E(3LF8| zWMO&tS*>vC39s|Cw#=pi^#}}8kP`uG4UJ?n8Kjgy8-_6kpxx=JtyE1Wy8nn$dY+!> zx13gAuydt=??*@>xN8NB?6hfXYr}Qje5q9G$!4>`y}ov(1L&fF%FOY)ewmSQ98)hN z{U{}Oll@25&`q1?JF`Ti(MzuDp6KuIUwTX?=cN{@bT{}~dHl!*5>1G}GxHBcxgpgw zol2$dnx;81G&D5Nf6xJzUQWlh>&*Xfudn?v{r?77v{0mI+;wUI0000z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<0!c(cRCwBAG%zq=zzG-`85nlfB(Y#mtA=Bo4VG3ueRSAB7WC1a54X3_{Yr1!0;c4SpPAw|C9d<5I|TBVEp}? z`;UNR@4KSXgm)h7458oGGR$I|%fRvE2Lr=opl%MJqJRGxmdn&J00aWrSg(3WRDZ^CeMGUMT85o`w^D#`=&cndY@(&aU3@mw{82|zZ!vMyA{}}!VNzHqd zl*Hiie~7=JN*%41__yd=-?Hph;EmxZ0-=kH$(2GY_D00D&Qg1>(mzOW00 zs+$TiEMl!>-~+1oUc}B&c|wYTCDDf=NJEo>n~w*m>@UN=zyFv40tm?fV3hs&#rltv zXVbH)#{X74%Na%ge`jE5=VK_{F39jN&F{aHzW$kC-+zWNf&!U|2^iLl{{aGsh3We@ zd9dz(z!2sZ>bPCCz{A#VFT;dyQy4x!;%E4CkCEYppa6rKh~OV)CMLW8jQ@Z919}sL zK>#3tSiWgm-DU(v%FoZg7@nkLFzA~8W?1~InSqt_9|P}328QZwTntQkb_|9ps>gs< z{@~`}hHC}^fB<5-Ii>sWe+E`ojsMRX!gpAzTvkcA*R~SBj;$z^N#>nvQ%5R41WAY5Vh2ab~I{F)b z|M~Op|Ns9O1^@&QIy42+L}nqM>E0RRESVyCbB5vYg*m6%z9b`98T zSr$quewmqOv{c2)tB2VY8)ZMURLs!d0^lD(p-?!Zl-e7OM)5q4x!F0s7CTry)kPxu zJ@2YZbj8Qvf(BOu5Rj!6vteXHYiVgog+ig{48uT5iSPT&|2#$Zolz3v8Xvo7>9l6y zQk*YetLDmWfe86Pp=1J-%jG`9Fo?xsxUS2M*$kNjN2$602IuS#=`7E|SQS@awz&TE zv-Cdo1Z!(+nb%LBKE8QEi&6^5ad2Ii;_Y?TlMi#b?j;_p%pkwB`1X|GtL|QoJ%5Nu zB*L!7#^&E9C$H;&32Fdr+h*m~Eynv#a&P-hcFQ@mnF#YIBbcPy$H8$NJC#b6 z%tB}1m_{JvhR4$5`+2b2;(|QN12Tsb2#Rm(eA2py6Z`fdr9{_tlv0?cIR#+;{@!sE zVUjHKmU*7;jn7GGISNi3@tNXc{WkVAH&Lln&@>I-_X&r?n5OwDfO+0Ih{U9c9PQ3c z%2?R%3u>o4-k9Icd`BA(B@z^iMS>u}_kEO7)1gr4j-cZeS2Qe);}N1nEy7fMkges% zVil{&1ovr>&*uR)1uH=iJk!(Dqq6;NfeG;BA4wZf07igVj0K*z%{Sw=O+KH;FpSL^ zGYsR{z`(%LU9Ws)Ayc)rVaa5&5$N+gui1579LHIcQeGY!8k*u?X#Z7b{)cRT+g?0v z(btiIVPjv-@4(4GzCyA`kS_y6l_~>6Lo)-z&;LOBB?CjL0RzLU1O^7H84L{K`IF+0 zx&hU$@N{tuskoK&=l_3uW>p4-h6o21Wo6~aWemFMEF21A63mdKI;Vst0J>*aBLDyZ literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_vectors.png b/resources/Visu_tree_vectors.png new file mode 100755 index 0000000000000000000000000000000000000000..5ff8c7bf319025efc668a5091d4824f4b7a174a4 GIT binary patch literal 1199 zcmXYxdrT8{5XZ0d2^3o&Knq9<2xOObGntU7tGr6BMV_Ke zGCMb6QQUL`0ofuB%R}W^Dnn(?q%A0{;Dc6L?YqC#ZGU|4o4e#bxm+$+oxbBe7bg!V z0B}i3PTXa8>RXWr_Q=qpJi9p-CTD*M;Jo^+F!1enGsvxKGXLY zrAaSuKT-3QXfiC7CmmdFMY6U%mEW+0KNeX^bvZ1bCCu}alr+6l&7}*&Ltk}C%Crn- zMHY?OB5IoFFF$neC09-{4rYs^6qviwHdGKaGutE6m?p-LGrVHrD!5H3JNw|VFO*zP zxh>qtA`-Fj00|&L4ptkc_O%IHLck%oG|GetxdA-rS61Qi`Wl3Y!0`PA%rFEiuXK>` zI$Z-Ik$~}QH=uqAyfEqw4*z0s9u(u@2yZRORR(yo(h;=UMWB0jfkK%HIIIHjcq^zi zS_o=y1I0(Xfi(RHfIt9^P77MyYxoa?_1$tv7Vq~wTk}c-D+mVoO&JP44otwws^A%u36XZ}vrUnf|EH+xb<=`$EEndUM1aZF8`jLofUMKOgZEQmF_>jP1~NEQ%`Xwp%?aSA7@nv#Itc&&p>BlJg{4@ zO&fbP9TuOXyAQN9i|MrNEYx|uustIqa;RUrOxZ9r)=v(tsx4@pn!Sj!%26IC4__l7 zbMta>)cDjFQk3647ngD4swAJMH&P~#UheaVmKz6sRkRB+EA|_-sZH@|Yxr&$?Yygv2M}JE~+e zT=QQ?e5_)@()M8O&k>{BN>}_KNVR=Za!$_9U5M%58TA&sRW3T12w^Us7S{{vtLrgL5arilLrB<8;k)aC5Ly@X;pRP!l@A-;$M*;SX+GxX*pfML z=Y?(U{r1yg`C)D*r-*23bFypq^*^KHJTNfu xO4uZ7bsLFwK3v60CI8gEnpR(uu+x#sfd`i>HjGWEr1s|mDM>pL+qZI#{{ybI7AXJ# literal 0 HcmV?d00001 diff --git a/resources/Visu_tree_vectors_gr.png b/resources/Visu_tree_vectors_gr.png new file mode 100644 index 0000000000000000000000000000000000000000..3a7e1142ea4faa8cab61f59bd3c008ec5ed35aeb GIT binary patch literal 952 zcmV;p14sOcP)ffj1ZqX@;+q%ROd6iHfZF=;|$Qy1>syKSOT zV^YLKBZ;MH7uxt(RZ^QKvMMM>9aEG7GT^{4ckVDPbDwh`E~=*WtiPP(*NBb)N}_6xvyeR$7A06??FL^uHVtm=~` zKTIf^VW9t0Jjo>xwP-AVfU@yEkH7t4cd(!$`yOr}FaZz%=x-^qoR^4H%f!gi*)@Zr z9w1tkLCNhRu15%D7BN@XsI<0F4u^>=3IJmI=xpIkTe`TW`W=T-3w%ENA}voWqZf}5 zi!1zeyN|YkZ(z+w?Kp?IGs#jcK~&SIzxneu`G<>*AB}x-SqsQAxs5C>iSH<7YuHpI zLLrq<#Np15qvWJs{Px|{ie{?X@lRqOg^a_yOt?2B-s;)RG+1+i@#*L4xXA{aDqeQ;eD z$8m5>69=DQE=Q$OiKf%(8rkS+LPG4PDnceteQ}7-Y!<9+cExzfSa* zUnwW+u`J7IZ*MQlrX%FG216WsY>Jz=ZlJ0vs;VM{&hK|FV44Egb#Yx6?%!wQ#7Xj< zofw8O_uq|<>r(MtACNRnBb&`)Sq`S9v$eHFG#Wt&f$ca5+r}_-JW09)5Ri}xz7I9A z$TH9jkk98aj0%oxlUEetu^Iq$A*k|P49on}=RtwI6z$vAY(YbPa|ZYxU}#7qnN%St zqZSm3#Uf&1ft}OS$fk)C42=y94Y})Qdwm(;jb~Sv%u4lJ!1KVx!9m?CZ@%Z< a%>NAvDv+S<=GeOc0000 aCon(CreateConvertor(theFileName)); //aCon->GetSize(); //return; diff --git a/src/CONVERTOR/VISUConvertor.hxx b/src/CONVERTOR/VISUConvertor.hxx new file mode 100755 index 00000000..f58b9faa --- /dev/null +++ b/src/CONVERTOR/VISUConvertor.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VISUConvertor.hxx +// Author : Oleg UVAROV +// Module : VISU + +#ifndef _VISUConvertor_HXX_ +#define _VISUConvertor_HXX_ + +#ifdef WNT + #if defined VISU_CONVERTOR_EXPORTS + #if defined WIN32 + #define VISU_CONVERTOR_EXPORT __declspec( dllexport ) + #else + #define VISU_CONVERTOR_EXPORT + #endif + #else + #if defined WIN32 + #define VISU_CONVERTOR_EXPORT __declspec( dllimport ) + #else + #define VISU_CONVERTOR_EXPORT + #endif + #endif +#else + #define VISU_CONVERTOR_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/CONVERTOR/VISU_Convertor.cxx b/src/CONVERTOR/VISU_Convertor.cxx index c18100d3..8df5d205 100644 --- a/src/CONVERTOR/VISU_Convertor.cxx +++ b/src/CONVERTOR/VISU_Convertor.cxx @@ -84,7 +84,7 @@ VISU_Convertor int iEnd = strlen(aName); static int VtkHighLevelLength = 12; //25 if(iEnd > VtkHighLevelLength) iEnd = VtkHighLevelLength; - char aNewName[iEnd+1]; + char* aNewName = new char[iEnd+1]; aNewName[iEnd] = '\0'; strncpy(aNewName,aName,iEnd); replace(aNewName,aNewName+iEnd,' ','_'); @@ -92,5 +92,6 @@ VISU_Convertor aName = aNewName; else aName.sprintf("%s_%d",aNewName,theTimeId); + delete[] aNewName; return aName.latin1(); } diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index f6564a32..6b556b74 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -32,6 +32,7 @@ \brief The file contains definitions for basic classes of the VISU CONVERTER package */ +#include "VISUConvertor.hxx" #include "VISU_IDMapper.hxx" #include "VISU_ConvertorDef.hxx" @@ -101,6 +102,7 @@ namespace VISU //--------------------------------------------------------------- + VISU_CONVERTOR_EXPORT bool operator<(const PSubProfile& theLeft, const PSubProfile& theRight); @@ -129,6 +131,7 @@ namespace VISU //--------------------------------------------------------------- + VISU_CONVERTOR_EXPORT bool operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight); @@ -230,6 +233,7 @@ namespace VISU //--------------------------------------------------------------- //! The utility function allows to write vtkUnstructuredGrid to a file with defined name + VISU_CONVERTOR_EXPORT void WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName); @@ -251,7 +255,7 @@ namespace VISU Also, it can perform some additional work to calculate expected amount of memory to build defined VTK representation */ -class VISU_Convertor +class VISU_CONVERTOR_EXPORT VISU_Convertor { protected: std::string myName; @@ -407,8 +411,9 @@ public: extern "C" { +VISU_CONVERTOR_EXPORT //! Instatiate proper VISU_Convertor subclass - VISU_Convertor* + VISU_Convertor* CreateConvertor(const std::string& theFileName); }; diff --git a/src/CONVERTOR/VISU_ConvertorUtils.hxx b/src/CONVERTOR/VISU_ConvertorUtils.hxx index c44d5c43..0c4664ad 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.hxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.hxx @@ -31,6 +31,8 @@ #include +#include "VISUConvertor.hxx" + #include "MED_Utilities.hxx" class vtkUnstructuredGrid; @@ -46,7 +48,7 @@ namespace VISU{ void WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName); - class TTimerLog + class VISU_CONVERTOR_EXPORT TTimerLog { int myIsDebug; double myCPUTime; diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index c39f28fe..6cbea3fb 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -57,7 +57,7 @@ static vtkFloatingPointType ERR_SIZE_CALC = 1.00; static int MYVTKDEBUG = 0; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; static int MYDEBUGWITHFILES = 0; //#define _DEXCEPT_ #else @@ -1485,17 +1485,19 @@ namespace //--------------------------------------------------------------- - void + bool GetMeshOnProfile(const PMeshImpl& theMesh, const PMeshOnEntityImpl& theMeshOnEntity, const PProfileImpl& theProfile) { INITMSG(MYDEBUG,"GetMeshOnProfile - anEntity = "<myEntity<myMeshOnEntity && theProfile->myMeshOnEntity != theMeshOnEntity.get()) + return false; + if(theProfile->myIsVTKDone) - return; - - theProfile->myMeshOnEntity = theMeshOnEntity.get(); + return true; + const TVTKAppendFilter& anAppendFilter = theProfile->GetFilter(); anAppendFilter->SetPoints(GetPoints(theMesh)); @@ -1533,9 +1535,11 @@ namespace } } anAppendFilter->Update(); // Fix on VTK + theProfile->myMeshOnEntity = theMeshOnEntity.get(); theProfile->myNamedPointCoords = theMesh->myNamedPointCoords; theProfile->myIsVTKDone = true; + return true; } @@ -1646,6 +1650,8 @@ namespace } } } + //theSource->Update(); + aFloatArray->Delete(); aDataArray->Delete(); } @@ -1887,6 +1893,12 @@ VISU_Convertor_impl EGeometry aEGeom = anIter->first; vtkIdType aVGeom = VISUGeom2VTK(aEGeom); PSubMeshImpl aSubMesh = anIter->second; + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aSubMesh->myIsStructured = aMesh->myIsStructured; + aSubMesh->myType = aMesh->myType; + aSubMesh->myGrilleStructure = aMesh->myGrilleStructure; + aSubMesh->myObjID2StructureID = aMesh->myObjID2StructureID; + //ENK: 23.11.2006 const TVTKSource& aSource = aSubMesh->GetSource(); aSource->SetPoints(GetPoints(aMesh)); GetCellsOnSubMesh(aSource,aMeshOnEntity,aSubMesh,aVGeom); @@ -1901,7 +1913,12 @@ VISU_Convertor_impl aSubMeshArr[anID] = aSubMesh; } aMeshOnEntity->myNamedPointCoords = aMesh->myNamedPointCoords; - + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aMeshOnEntity->myIsStructured = aMesh->myIsStructured; + aMeshOnEntity->myType = aMesh->myType; + aMeshOnEntity->myGrilleStructure = aMesh->myGrilleStructure; + aMeshOnEntity->myObjID2StructureID = aMesh->myObjID2StructureID; + //ENK: 23.11.2006 aMeshOnEntity->myIsVTKDone = true; if(MYDEBUGWITHFILES){ @@ -1963,7 +1980,12 @@ VISU_Convertor_impl GetCellsOnFamily(aSource,aMeshOnEntity,aFamily); aFamily->myNamedPointCoords = aMesh->myNamedPointCoords; - + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aFamily->myIsStructured = aMesh->myIsStructured; + aFamily->myType = aMesh->myType; + aFamily->myGrilleStructure = aMesh->myGrilleStructure; + aFamily->myObjID2StructureID = aMesh->myObjID2StructureID; + //ENK: 23.11.2006 aFamily->myIsVTKDone = true; if(MYDEBUGWITHFILES){ @@ -2041,7 +2063,12 @@ VISU_Convertor_impl aFamilyArr[anID] = aFamily; } aGroup->myNamedPointCoords = aMesh->myNamedPointCoords; - + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aGroup->myIsStructured = aMesh->myIsStructured; + aGroup->myType = aMesh->myType; + aGroup->myGrilleStructure = aMesh->myGrilleStructure; + aGroup->myObjID2StructureID = aMesh->myObjID2StructureID; + //ENK: 23.11.2006 aGroup->myIsVTKDone = true; if(MYDEBUGWITHFILES){ @@ -2073,15 +2100,20 @@ VISU_Convertor_impl const VISU::PProfileImpl& theProfile, const VISU::TEntity& theEntity) { - LoadMeshOnEntity(theMesh,theMeshOnEntity); - GetMeshOnEntity(theMeshOnEntity->myMeshName,theMeshOnEntity->myEntity); - GetMeshOnProfile(theMesh,theMeshOnEntity,theProfile); - - theIDMapperFilter->myIDMapper = theProfile; - TVTKOutput* anOutput = theIDMapperFilter->GetVTKOutput(); - const TVTKSource& aSource = theIDMapperFilter->mySource.GetSource(); - ::GetTimeStampOnProfile(aSource,theField,theValForTime,theEntity); - + TVTKOutput* anOutput = NULL; + try{ + LoadMeshOnEntity(theMesh,theMeshOnEntity); + GetMeshOnEntity(theMeshOnEntity->myMeshName,theMeshOnEntity->myEntity); + if(GetMeshOnProfile(theMesh,theMeshOnEntity,theProfile)){ + theIDMapperFilter->myIDMapper = theProfile; + anOutput = theIDMapperFilter->GetVTKOutput(); + const TVTKSource& aSource = theIDMapperFilter->mySource.GetSource(); + ::GetTimeStampOnProfile(aSource,theField,theValForTime,theEntity); + } + }catch(std::exception& exc){ + MSG(MYDEBUG,"Follow exception was occured :\n"<myIsVTKDone){ LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime); - TVTKOutput* anOutput; - try{ - anOutput = GetTimeStampOnProfile(aMesh, - aVTKMeshOnEntity, - aField, - aValForTime, - anIDMapperFilter, - aValForTime->myProfile, - aMeshOnEntity->myEntity); - }catch(std::exception& exc){ - MSG(MYDEBUG,"Follow exception was occured :\n"<myProfile, + aMeshOnEntity->myEntity); + if(!anOutput) anOutput = GetTimeStampOnProfile(aMesh, aMeshOnEntity, aField, @@ -2139,8 +2168,13 @@ VISU_Convertor_impl anIDMapperFilter, aValForTime->myProfile, aVTKMeshOnEntity->myEntity); - } + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + anIDMapperFilter->myIsStructured = aMesh->myIsStructured; + anIDMapperFilter->myType = aMesh->myType; + anIDMapperFilter->myGrilleStructure = aMesh->myGrilleStructure; + anIDMapperFilter->myObjID2StructureID = aMesh->myObjID2StructureID; + //ENK: 23.11.2006 anIDMapperFilter->myIsVTKDone = true; if(MYDEBUGWITHFILES){ @@ -2530,8 +2564,10 @@ VISU_Convertor_impl aVTKMeshOnEntity = aMeshOnEntityMap[VISU::CELL_ENTITY]; else if(aMeshOnEntityMap.find(VISU::FACE_ENTITY) != aMeshOnEntityMap.end()) aVTKMeshOnEntity = aMeshOnEntityMap[VISU::FACE_ENTITY]; - else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end()) + else if(aMeshOnEntityMap.find(VISU::EDGE_ENTITY) != aMeshOnEntityMap.end()) aVTKMeshOnEntity = aMeshOnEntityMap[VISU::EDGE_ENTITY]; + else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end()) + aVTKMeshOnEntity = aMeshOnEntityMap[VISU::NODE_ENTITY]; }else aVTKMeshOnEntity = aMeshOnEntity; diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 60692833..6acbaadf 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -39,6 +39,7 @@ class vtkUnstructuredGrid; class VTKViewer_AppendFilter; class VISU_MergeFilter; +#include "VISUConvertor.hxx" #include "VISU_Convertor.hxx" #include "MED_SliceArray.hxx" @@ -57,11 +58,11 @@ namespace VISU ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1}; //! Get number of nodes for defined geometrical type - vtkIdType + VISU_CONVERTOR_EXPORT vtkIdType VISUGeom2NbNodes(EGeometry theGeom); //! Maps VISU geometrical type to VTK one - vtkIdType + VISU_CONVERTOR_EXPORT vtkIdType VISUGeom2VTK(EGeometry theGeom); //--------------------------------------------------------------- @@ -80,7 +81,7 @@ namespace VISU //--------------------------------------------------------------- //! Define an utility base class which is repsonsible for preventing repetion - struct TIsVTKDone: virtual TBaseStructure + struct VISU_CONVERTOR_EXPORT TIsVTKDone: virtual TBaseStructure { TIsVTKDone(); bool myIsDone; //!< Say, is the corresponding MED entity already loaded into intermediate data structure @@ -90,7 +91,7 @@ namespace VISU //--------------------------------------------------------------- //! Define an utility base class which allow to keep calculated number of cells and their size - struct TSizeCounter: virtual TIsVTKDone + struct VISU_CONVERTOR_EXPORT TSizeCounter: virtual TIsVTKDone { TSizeCounter(); vtkIdType myNbCells; //!< Number of cells contained into corresponding sublclass @@ -100,7 +101,7 @@ namespace VISU //--------------------------------------------------------------- //! Define a container for VTK representation - class TSource: public virtual TSizeCounter + class VISU_CONVERTOR_EXPORT TSource: public virtual TSizeCounter { protected: mutable TVTKSource mySource; @@ -123,7 +124,7 @@ namespace VISU /*! This container allow to combine other VTK representation into single one. */ - class TAppendFilter: public virtual TIsVTKDone, + class VISU_CONVERTOR_EXPORT TAppendFilter: public virtual TIsVTKDone, public virtual TIDMapper { protected: @@ -140,6 +141,7 @@ namespace VISU TVTKOutput* GetVTKOutput(); }; + typedef SharedPtr PAppendFilter; //--------------------------------------------------------------- @@ -147,7 +149,7 @@ namespace VISU /*! This container allow to assign data to mesh and represent them into single VTK representation */ - class TMergeFilter: public virtual TIsVTKDone, + class VISU_CONVERTOR_EXPORT TMergeFilter: public virtual TIsVTKDone, public virtual TIDMapper { protected: @@ -173,7 +175,7 @@ namespace VISU typedef TCSlice TCCoordSlice; //! This class is responsible for representation of mesh nodes - class TPointCoords: public virtual TBaseStructure + class VISU_CONVERTOR_EXPORT TPointCoords: public virtual TBaseStructure { protected: vtkIdType myDim; //!< Dimension of the nodal coordinates @@ -227,7 +229,7 @@ namespace VISU In additition to its base functionlity it support mapping of VTK to object numeration and keeps names for each of nodes. */ - class TNamedPointCoords: public virtual TPointCoords + class VISU_CONVERTOR_EXPORT TNamedPointCoords: public virtual TPointCoords { protected: typedef TVector TPointsDim; @@ -271,7 +273,7 @@ namespace VISU //--------------------------------------------------------------- //! Specialize TMesh to provide VTK mapping for nodes - struct TMeshImpl: virtual TMesh, + struct VISU_CONVERTOR_EXPORT TMeshImpl: virtual TMesh, virtual TIsVTKDone { PNamedPointCoords myNamedPointCoords; //!< Keeps intermediate representation of the nodes @@ -289,7 +291,7 @@ namespace VISU typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; //! Specialize TSubProfile to provide VTK mapping - struct TSubProfileImpl: virtual TSubProfile, + struct VISU_CONVERTOR_EXPORT TSubProfileImpl: virtual TSubProfile, virtual TSource { TSubProfileImpl(); @@ -321,7 +323,7 @@ namespace VISU typedef std::map TGeom2SubProfile; //! Specialize TProfile to provide VTK mapping for MED TIMESTAMP mesh - struct TProfileImpl: virtual TProfile, + struct VISU_CONVERTOR_EXPORT TProfileImpl: virtual TProfile, virtual TAppendFilter { TProfileImpl(); @@ -385,7 +387,7 @@ namespace VISU //--------------------------------------------------------------- //! Specialize TIDMapper to provide VTK mapping for MED TIMESTAMP mesh - struct TIDMapperFilter: virtual TMergeFilter + struct VISU_CONVERTOR_EXPORT TIDMapperFilter: virtual TMergeFilter { PAppendFilter myIDMapper; //!< Responsible for numbering TSource mySource; //!< Keeps assigned data @@ -433,7 +435,7 @@ namespace VISU typedef SharedPtr PGaussImpl; //! Specialize TGauss to provide more detail information of the MED GAUSS entity for VTK mapping - struct TGaussImpl: virtual TGauss + struct VISU_CONVERTOR_EXPORT TGaussImpl: virtual TGauss { EGeometry myGeom; //!< Define, to which geometrical type the MED GAUSS entity belongs std::string myName; //!< Keeps name of the MED GAUSS entity @@ -449,7 +451,7 @@ namespace VISU //--------------------------------------------------------------- //! Specialize TGaussSubMesh to provide VTK mapping for the entity - struct TGaussSubMeshImpl: virtual TGaussSubMesh, + struct VISU_CONVERTOR_EXPORT TGaussSubMeshImpl: virtual TGaussSubMesh, virtual TSource { TGaussSubMeshImpl(); @@ -479,7 +481,7 @@ namespace VISU typedef std::map TGeom2GaussSubMesh; //! Specialize TGaussMesh to provide VTK mapping for the entity - struct TGaussMeshImpl: virtual TGaussMesh, + struct VISU_CONVERTOR_EXPORT TGaussMeshImpl: virtual TGaussMesh, virtual TAppendFilter { TGaussMeshImpl(); @@ -509,7 +511,7 @@ namespace VISU //--------------------------------------------------------------- //! Specialize TGaussPtsIDMapper to provide VTK mapping for MED TIMESTAMP mesh - struct TGaussPtsIDFilter: virtual TIDMapperFilter, + struct VISU_CONVERTOR_EXPORT TGaussPtsIDFilter: virtual TIDMapperFilter, virtual TGaussPtsIDMapper { PGaussPtsIDMapper myGaussPtsIDMapper; @@ -532,7 +534,8 @@ namespace VISU typedef TVector TCell2Connect; //! The class is responsible for mapping of cells of defined geometrical type - struct TSubMeshImpl: virtual TSource + struct VISU_CONVERTOR_EXPORT TSubMeshImpl: virtual TSource, + virtual TStructured // ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing { //! To implement the TIDMapper::GetElemObjID @@ -556,7 +559,7 @@ namespace VISU typedef TVector TSubMeshArr; //! Specialize TMeshOnEntity to provide VTK mapping for the entity - struct TMeshOnEntityImpl: virtual TMeshOnEntity, + struct VISU_CONVERTOR_EXPORT TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TAppendFilter, virtual TSizeCounter { @@ -603,7 +606,7 @@ namespace VISU typedef std::map TGeom2SubMeshID; //! Specialize TFamily to provide VTK mapping for the entity - struct TFamilyImpl: virtual TFamily, + struct VISU_CONVERTOR_EXPORT TFamilyImpl: virtual TFamily, virtual TSource { //! Reimplement the TIDMapper::GetNodeObjID @@ -644,7 +647,7 @@ namespace VISU typedef TVector TFamilyArr; //! Specialize TGroup to provide VTK mapping for the entity - struct TGroupImpl: virtual TGroup, + struct VISU_CONVERTOR_EXPORT TGroupImpl: virtual TGroup, virtual TAppendFilter { //! Calculate pair of values - number of cells and its size @@ -682,7 +685,7 @@ namespace VISU typedef TVector TMinMaxArr; //! Specialize TField to provide VTK mapping for the entity - struct TFieldImpl: virtual TField + struct VISU_CONVERTOR_EXPORT TFieldImpl: virtual TField { vtkIdType myDataSize; //!< Keeps size of the assigned data @@ -711,7 +714,7 @@ namespace VISU typedef TVector TValueSliceArr; //! Define a container to get access to data assigned to mesh - struct TMeshValue + struct VISU_CONVERTOR_EXPORT TMeshValue { TValue myValue; //!< Keeps all values as one dimensional sequence @@ -749,7 +752,7 @@ namespace VISU typedef std::map TGeom2NbGauss; //! Specialize TValForTime to provide VTK mapping for the entity - struct TValForTimeImpl: virtual TValForTime + struct VISU_CONVERTOR_EXPORT TValForTimeImpl: virtual TValForTime { PGaussPtsIDFilter myGaussPtsIDFilter; //!< Keep VTK representation for mesh and data on Gauss Points PIDMapperFilter myIDMapperFilter; //!< Keep VTK representation for ordinary mesh and data @@ -780,7 +783,7 @@ namespace VISU It implements VISU_Convertor public interface and declare new pure virtual functions to fill its intermediate data structure from a MED source */ -class VISU_Convertor_impl: public VISU_Convertor +class VISU_CONVERTOR_EXPORT VISU_Convertor_impl: public VISU_Convertor { public: VISU_Convertor_impl(); diff --git a/src/CONVERTOR/VISU_IDMapper.cxx b/src/CONVERTOR/VISU_IDMapper.cxx index 2a70b379..fff045da 100644 --- a/src/CONVERTOR/VISU_IDMapper.cxx +++ b/src/CONVERTOR/VISU_IDMapper.cxx @@ -30,6 +30,49 @@ namespace VISU { + //--------------------------------------------------------------- + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + bool + TStructured + ::IsStructured() const + { + return myIsStructured; + } + + TIdTypeVector + TStructured + ::GetStructure() + { + return myGrilleStructure; + } + + TIdTypeVector + TStructured + ::GetIndexesOfNode(vtkIdType theNodeId) + { + TIdTypeVector aNullVec; + if(!IsStructured()) + return aNullVec; + TObj2IdTypeVector::const_iterator aIter = myObjID2StructureID.find(theNodeId); + if(aIter!=myObjID2StructureID.end()) + return aIter->second; + else + return aNullVec; + } + + vtkIdType + TStructured + ::GetObjectIDByIndexes(TIdTypeVector theVec) + { + TObj2IdTypeVector::const_iterator aIter = myObjID2StructureID.begin(); + for(;aIter!=myObjID2StructureID.end();aIter++){ + if(theVec == aIter->second) + return aIter->first; + } + return -1; + } + //ENK: 23.11.2006 + //--------------------------------------------------------------- vtkFloatingPointType* TIDMapper diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx index a488a210..8f47b7a0 100644 --- a/src/CONVERTOR/VISU_IDMapper.hxx +++ b/src/CONVERTOR/VISU_IDMapper.hxx @@ -32,10 +32,14 @@ \brief The file contains declarations for basic interfaces that defines mapping of mesh elements */ +#include "VISUConvertor.hxx" + #include "MED_SharedPtr.hxx" +#include "MED_Vector.hxx" #include "VTKViewer.h" #include +#include class vtkUnstructuredGrid; class vtkCell; @@ -43,10 +47,61 @@ class vtkCell; namespace VISU { using MED::SharedPtr; + using MED::TVector; + + typedef TVector TIdTypeVector; + typedef std::map TObj2IdTypeVector; + + struct VISU_CONVERTOR_EXPORT TStructured + { + TStructured(): + myIsStructured(false), + myType(true) + {} + + virtual + bool + IsStructured() const; + + /*! + * Get structure of grille + * see also MED::TGrilleInfo::GetGrilleStructure + * see also MED::TGrilleInfo::GetNbIndexes + */ + virtual TIdTypeVector + GetStructure(); + + /*! + * Gets i,j,k by object id + * return -1, if not found + */ + virtual TIdTypeVector + GetIndexesOfNode(vtkIdType theNodeId); + + /*! + * Gets object id by i,j,k + * return -1, if not found + */ + virtual vtkIdType + GetObjectIDByIndexes(TIdTypeVector theVec); + + public: + bool myIsStructured; //!< To define mesh type (structured - true, non structured - false) + bool myType; //!< To define structured mesh is polair + + /*!provides grille structure for structured grid. + * Example: {3,4,5}, 3 nodes in X axe, 4 nodes in Y axe, ... + */ + TIdTypeVector myGrilleStructure; + + TObj2IdTypeVector myObjID2StructureID;//!< map of object id to i,j,k ids of structured grid nodes + + }; + //--------------------------------------------------------------- //! Defines a basic class for intemediate data structures - struct TBaseStructure + struct VISU_CONVERTOR_EXPORT TBaseStructure: virtual TStructured { //! Just to provide possibility of dynamic navigation through the class hierarchy virtual ~TBaseStructure() @@ -64,7 +119,7 @@ namespace VISU Where object ID means ID which attached to corresponding MED entity. For example, each MED node can have its own ID as well as any other mesh cell */ - struct TIDMapper: virtual TBaseStructure + struct VISU_CONVERTOR_EXPORT TIDMapper: virtual TBaseStructure { //! Get node object ID for corresponding VTK ID virtual diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 77c4351b..5ef4aa56 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -56,10 +56,10 @@ using MED::TFloat; using MED::EBooleen; #ifdef _DEBUG_ -static int MYDEBUG = 0; -static int MYVALUEDEBUG = 0; -static int MY_FAMILY_DEBUG = 0; -static int MY_GROUP_DEBUG = 0; +static int MYDEBUG = 1; +static int MYVALUEDEBUG = 1; +static int MY_FAMILY_DEBUG = 1; +static int MY_GROUP_DEBUG = 1; //#define _DEXCEPT_ #else static int MYDEBUG = 0; @@ -71,8 +71,8 @@ static int MY_GROUP_DEBUG = 0; #define _LOAD_FAMILIES_ #define _EDF_NODE_IDS_ -namespace -{ +//namespace +//{ //--------------------------------------------------------------- vtkIdType MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType) @@ -144,7 +144,7 @@ namespace MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity) { switch(theMEDEntity){ - case MED::eNOEUD: return NODE_ENTITY; + case MED::eNOEUD: return VISU::NODE_ENTITY; case MED::eARETE: return EDGE_ENTITY; case MED::eFACE: return FACE_ENTITY; case MED::eMAILLE: return CELL_ENTITY; @@ -158,7 +158,7 @@ namespace VTKEntityToMED(TEntity theVTKEntity) { switch(theVTKEntity){ - case NODE_ENTITY: return MED::eNOEUD; + case VISU::NODE_ENTITY: return MED::eNOEUD; case EDGE_ENTITY: return MED::eARETE; case FACE_ENTITY: return MED::eFACE; case CELL_ENTITY: return MED::eMAILLE; @@ -439,7 +439,7 @@ namespace TTimerLog aTimerLog(MYDEBUG,"InitGaussMesh"); INITMSG(MYDEBUG,"InitGaussMesh"<myName; TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin(); + + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + int iMax,jMax,kMax; + iMax=jMax=kMax=0; + + MED::TIntVector aIntVec; + if(theGrilleInfo->GetGrilleType()!=MED::eGRILLE_STANDARD) + for(int i=0;imyDim;i++) + aIntVec.push_back(theGrilleInfo->GetNbIndexes(i)); + else + aIntVec = theGrilleInfo->GetGrilleStructure(); + + theMesh->myGrilleStructure = aIntVec; + + switch((theMesh->GetStructure()).size()){ + case 3: kMax=theMesh->GetStructure()[2]; + case 2: jMax=theMesh->GetStructure()[1]; + case 1: iMax=theMesh->GetStructure()[0]; + } + + int iii=0; + TVectorID aIndexes; + switch(theMesh->myDim){ + case 1: + for(int i=1;i<=iMax;i++) + (theMesh->myObjID2StructureID[i-1]).push_back(i); + break; + case 2: + for(int j=1;j<=jMax;j++) + for(int i=1;i<=iMax;i++){ + (theMesh->myObjID2StructureID[iii]).push_back(i); + (theMesh->myObjID2StructureID[iii]).push_back(j); + iii++; + } + break; + case 3: + for(int k=1;k<=kMax ;k++) + for(int j=1;j<=jMax;j++) + for(int i=1;i<=iMax;i++) + { + (theMesh->myObjID2StructureID[iii]).push_back(i); + (theMesh->myObjID2StructureID[iii]).push_back(j); + (theMesh->myObjID2StructureID[iii]).push_back(k); + iii++; + } + } + //ENK: 23.11.2006 + for(; anEntityIter != theEntityInfo.end(); anEntityIter++){ const MED::EEntiteMaillage& aMEntity = anEntityIter->first; const MED::TGeom2Size& aGeom2Size = anEntityIter->second; @@ -891,7 +939,7 @@ namespace const MED::TFamilyID2NbCells& aFam2NbCells = MED::GetFamilyID2NbCells(aGrilleInfo); - MED::TFamilyInfoSet::iterator aFamInter = theFamilyInfoSet.begin(); + MED::TFamilyInfoSet::const_iterator aFamInter = theFamilyInfoSet.begin(); for(;aFamInter != theFamilyInfoSet.end();aFamInter++){ TInt anId = (*aFamInter)->GetId(); @@ -1132,7 +1180,7 @@ namespace } }; -} +//} //--------------------------------------------------------------- @@ -1141,16 +1189,17 @@ VISU_Convertor* CreateConvertor(const string& theFileName) { if(MED::PWrapper aMed = MED::CrWrapper(theFileName,true)) - return new VISU_MedConvertor(theFileName); + return new VISU_MedConvertor(theFileName, aMed); return NULL; } VISU_MedConvertor -::VISU_MedConvertor(const string& theFileName): +::VISU_MedConvertor(const string& theFileName, MED::PWrapper theMed): myIsEntitiesDone(false), myIsFieldsDone(false), myIsGroupsDone(false), - myIsMinMaxDone(false) + myIsMinMaxDone(false), + myMed(theMed) { myFileInfo.setFile(QString(theFileName.c_str())); myName = myFileInfo.baseName().latin1(); @@ -1167,9 +1216,8 @@ VISU_MedConvertor TSetIsDone aSetIsDone(myIsEntitiesDone); TTimerLog aTimerLog(MYDEBUG,"BuildEntities"); - MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); - TInt aNbMeshes = aMed->GetNbMeshes(); + TInt aNbMeshes = myMed->GetNbMeshes(); TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildEntities aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); TInt aDim = aMeshInfo->GetDim(); MED::EMaillage aType = aMeshInfo->GetType(); @@ -1198,8 +1246,8 @@ VISU_MedConvertor if(aType == MED::eNON_STRUCTURE){ - if(MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo)){ - MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo); + if(MED::PNodeInfo aNodeInfo = myMed->GetPNodeInfo(aMeshInfo)){ + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); aMesh->myNbPoints = aNodeInfo->GetNbElem(); aMesh->myEntityInfo = anEntityInfo; @@ -1215,7 +1263,7 @@ VISU_MedConvertor BuildMeshOnEntityMap(aMesh, anEntityInfo, aNodeInfo, - aMed); + myMed); #ifndef _DEXCEPT_ }catch(std::exception& exc){ @@ -1227,7 +1275,7 @@ VISU_MedConvertor } } // NON STRUCTURED MESH else { - MED::PGrilleInfo aGrilleInfo = aMed->GetPGrilleInfo(aMeshInfo); + MED::PGrilleInfo aGrilleInfo = myMed->GetPGrilleInfo(aMeshInfo); MED::TEntityInfo anEntityInfo; anEntityInfo[MED::eNOEUD][MED::ePOINT1] = aGrilleInfo->GetNbNodes(); @@ -1235,7 +1283,10 @@ VISU_MedConvertor aMesh->myNbPoints = aGrilleInfo->GetNbNodes(); aMesh->myEntityInfo = anEntityInfo; - + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aMesh->myIsStructured = true; + aMesh->myType = (MED::eGRILLE_POLAIRE == aGrilleInfo->GetGrilleType()); + //ENK: 23.11.2006 #ifndef _DEXCEPT_ try{ #endif @@ -1244,7 +1295,7 @@ VISU_MedConvertor BuildMeshGrilleOnEntityMap(aMesh, anEntityInfo, aGrilleInfo, - aMed); + myMed); #ifndef _DEXCEPT_ }catch(std::exception& exc){ @@ -1279,9 +1330,8 @@ VISU_MedConvertor TSetIsDone aSetIsDone(myIsFieldsDone); TTimerLog aTimerLog(MYDEBUG,"BuildFields"); - MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); - TInt aNbMeshes = aMed->GetNbMeshes(); + TInt aNbMeshes = myMed->GetNbMeshes(); TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildFields - aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); @@ -1304,11 +1354,11 @@ VISU_MedConvertor #ifndef _DEXCEPT_ try{ #endif - MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo); + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); BuildFieldMap(aMesh, anEntityInfo, - aMed); + myMed); #ifndef _DEXCEPT_ }catch(std::exception& exc){ MSG(MYDEBUG,"Follow exception was occured in:\n"<GetNbMeshes(); + TInt aNbMeshes = myMed->GetNbMeshes(); TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildMinMax - aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); @@ -1367,23 +1416,23 @@ VISU_MedConvertor #ifndef _DEXCEPT_ try{ #endif - TInt aNbFields = aMed->GetNbFields(); + TInt aNbFields = myMed->GetNbFields(); INITMSG(MYDEBUG, "- aMeshName = '"<GetEntityInfo(aMeshInfo); + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); for(TInt iField = 1; iField <= aNbFields; iField++){ TTimerLog aTimerLog(MYDEBUG,"BuildMinMax - GetPFieldInfo()"); - MED::PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField); + MED::PFieldInfo aFieldInfo = myMed->GetPFieldInfo(aMeshInfo,iField); std::string aFieldName = aFieldInfo->GetName(); INITMSG(MYDEBUG,"- aFieldName = '"<GetNbTimeStamps(aFieldInfo, + TInt aNbTimeStamps = myMed->GetNbTimeStamps(aFieldInfo, anEntityInfo, aMEntity, aGeom2Size); @@ -1417,12 +1466,12 @@ VISU_MedConvertor try{ #endif #endif - MED::PTimeStampInfo aTimeStampInfo = aMed->GetPTimeStampInfo(aFieldInfo, + MED::PTimeStampInfo aTimeStampInfo = myMed->GetPTimeStampInfo(aFieldInfo, aMEntity, aGeom2Size, iTimeStamp); - MED::PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo, + MED::PTimeStampVal aTimeStampVal = myMed->GetPTimeStampVal(aTimeStampInfo, aMKey2Profile, aKey2Gauss); @@ -1543,9 +1592,8 @@ VISU_MedConvertor TSetIsDone aSetIsDone(myIsGroupsDone); TTimerLog aTimerLog(MYDEBUG,"BuildGroups"); - MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1()); - TInt aNbMeshes = aMed->GetNbMeshes(); + TInt aNbMeshes = myMed->GetNbMeshes(); TMeshMap& aMeshMap = myMeshMap; INITMSG(MYDEBUG,"BuildGroups - aNbMeshes = "<GetPMeshInfo(iMesh); + MED::PMeshInfo aMeshInfo = myMed->GetPMeshInfo(iMesh); std::string aMeshName = aMeshInfo->GetName(); TMeshMap::const_iterator anIter = aMeshMap.find(aMeshName); @@ -1568,27 +1616,27 @@ VISU_MedConvertor MED::EMaillage aType = aMeshInfo->GetType(); - MED::TEntityInfo anEntityInfo = aMed->GetEntityInfo(aMeshInfo); + MED::TEntityInfo anEntityInfo = myMed->GetEntityInfo(aMeshInfo); MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = - MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,anEntityInfo); + MED::GetEntity2TGeom2ElemInfo(myMed,aMeshInfo,anEntityInfo); #ifndef _DEXCEPT_ try{ #endif - MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo); + MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(myMed,aMeshInfo); if(aType == MED::eNON_STRUCTURE) BuildFamilyMap(aMesh, anEntityInfo, anEntity2TGeom2ElemInfo, aFamilyInfoSet, - aMed); + myMed); else BuildGrilleFamilyMap(aMesh, anEntityInfo, aFamilyInfoSet, - aMed); + myMed); BuildGroupMap(aMesh, aFamilyInfoSet); @@ -1622,15 +1670,14 @@ VISU_MedConvertor TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnEntity"); INITMSG(MYDEBUG,"LoadMeshOnEntity"<myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - if(anEntity == NODE_ENTITY){ - isPointsUpdated += LoadPoints(aMed,theMesh); + if(anEntity == VISU::NODE_ENTITY){ + isPointsUpdated += LoadPoints(myMed,theMesh); }else{ - isPointsUpdated += LoadPoints(aMed,theMesh); - isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); + isPointsUpdated += LoadPoints(myMed,theMesh); + isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity); } return (isPointsUpdated || isCellsOnEntityUpdated); @@ -1647,15 +1694,14 @@ VISU_MedConvertor TTimerLog aTimerLog(MYDEBUG,"LoadFamilyOnEntity"); INITMSG(MYDEBUG,"LoadFamilyOnEntity"<myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - if(anEntity == NODE_ENTITY){ - isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily); + if(anEntity == VISU::NODE_ENTITY){ + isPointsUpdated += LoadPointsOnFamily(myMed,theMesh,theFamily); }else{ - isPointsUpdated += LoadPoints(aMed,theMesh); - isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,theMeshOnEntity,theFamily); + isPointsUpdated += LoadPoints(myMed,theMesh); + isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,theMeshOnEntity,theFamily); } return (isPointsUpdated || isCellsOnEntityUpdated); @@ -1671,18 +1717,17 @@ VISU_MedConvertor TTimerLog aTimerLog(MYDEBUG,"LoadMeshOnGroup"); INITMSG(MYDEBUG,"LoadMeshOnGroup"<myEntity; const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; - isPointsUpdated += LoadPoints(aMed,theMesh); - if(anEntity == NODE_ENTITY){ - isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily); + isPointsUpdated += LoadPoints(myMed,theMesh); + if(anEntity == VISU::NODE_ENTITY){ + isPointsUpdated += LoadPointsOnFamily(myMed,theMesh,aFamily); }else{ - isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily); + isCellsOnEntityUpdated += LoadCellsOnFamily(myMed,theMesh,aMeshOnEntity,aFamily); } } @@ -1701,14 +1746,12 @@ VISU_MedConvertor TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnMesh"); INITMSG(MYDEBUG,"LoadValForTimeOnMesh"<myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - isPointsUpdated += LoadPoints(aMed,theMesh); - if(anEntity != NODE_ENTITY) - isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); - int isFieldUpdated = LoadValForTimeOnMesh(aMed,theMesh,theMeshOnEntity,theField,theValForTime); + isPointsUpdated += LoadPoints(myMed,theMesh); + if(anEntity != VISU::NODE_ENTITY) + isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity); + int isFieldUpdated = LoadValForTimeOnMesh(myMed,theMesh,theMeshOnEntity,theField,theValForTime); return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated); } @@ -1725,13 +1768,11 @@ VISU_MedConvertor TTimerLog aTimerLog(MYDEBUG,"LoadValForTimeOnGaussPts"); INITMSG(MYDEBUG,"LoadValForTimeOnGaussPts"<myEntity; int isPointsUpdated = 0, isCellsOnEntityUpdated = 0; - if(anEntity != NODE_ENTITY) - isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity); - int isFieldUpdated = LoadValForTimeOnGaussPts(aMed,theMesh,theMeshOnEntity,theField,theValForTime); + if(anEntity != VISU::NODE_ENTITY) + isCellsOnEntityUpdated += LoadCellsOnEntity(myMed,theMesh,theMeshOnEntity); + int isFieldUpdated = LoadValForTimeOnGaussPts(myMed,theMesh,theMeshOnEntity,theField,theValForTime); return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated); } @@ -1748,7 +1789,7 @@ VISU_MedConvertor //Check on existing family PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY]; aMeshOnEntity->myMeshName = theMesh->myName; - aMeshOnEntity->myEntity = NODE_ENTITY; + aMeshOnEntity->myEntity = VISU::NODE_ENTITY; INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<myIsDone<<"'\n"); diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index c467f0c1..a16d04fe 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -21,6 +21,7 @@ #include "VISU_Convertor_impl.hxx" +#include "MED_Wrapper.hxx" #include "MED_Common.hxx" #include "MED_Structures.hxx" @@ -201,7 +202,7 @@ class VISU_MedConvertor: public VISU_Convertor_impl bool myIsMinMaxDone; public: - VISU_MedConvertor(const std::string& theFileName); + VISU_MedConvertor(const std::string& theFileName, MED::PWrapper theMed); virtual VISU_Convertor* @@ -221,6 +222,7 @@ public: protected: QFileInfo myFileInfo; + MED::PWrapper myMed; // mpv : bug 13568: one med per converter virtual int diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index 0563dad2..2ec5f966 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -20,7 +20,6 @@ #include "VISU_Engine_i.hh" #include "utilities.h" -#include CORBA_SERVER_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) #include "SALOME_NamingService.hxx" @@ -34,22 +33,41 @@ static int MYDEBUG = 1; static int MYDEBUG = 0; #endif +#ifdef WNT +#ifdef VISU_ENGINE_EXPORTS +#define VISU_ENGINE_EXPORT __declspec(dllexport) +#else +#define VISU_ENGINE_EXPORT __declspec(dllimport) +#endif +#else +#define VISU_ENGINE_EXPORT +#endif + UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); extern "C" { +VISU_ENGINE_EXPORT PortableServer::ObjectId * VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, const char *interfaceName) { - if(MYDEBUG) MESSAGE("VisuEngine_factory : "<getId() ; } } namespace VISU{ //=========================================================================== - VISU_Gen_i::VISU_Gen_i(CORBA::ORB_ptr orb, + VISU_Gen_i::VISU_Gen_i(SALOME::Session_ptr session, + CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, @@ -58,11 +76,11 @@ namespace VISU{ { _thisObj = this ; _id = _poa->activate_object(_thisObj); - SALOME_NamingService aNamingService(orb); - CORBA::Object_ptr anObject = aNamingService.Resolve("/Kernel/Session"); - SALOME::Session_var aSession = SALOME::Session::_narrow(anObject); - //aSession->GetInterface(); - Engines::Component_var aComponent = aSession->GetComponent("libVISUEngineImpl.so"); +#ifndef WIN32 + Engines::Component_var aComponent = session->GetComponent("libVISUEngineImpl.so"); +#else + Engines::Component_var aComponent = session->GetComponent("VISUEngineImpl.dll"); +#endif myVisuGen = VISU::VISU_Gen::_narrow(aComponent); } @@ -321,7 +339,6 @@ namespace VISU{ return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - Table_ptr VISU_Gen_i::CreateTable(const char* theTableEntry){ return myVisuGen->CreateTable(theTableEntry); } diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index 3f605b43..f4be8865 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -24,6 +24,7 @@ #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(VISU_Gen) #include CORBA_SERVER_HEADER(MED) +#include CORBA_SERVER_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) @@ -37,7 +38,8 @@ namespace VISU{ VISU_Gen_i(); VISU_Gen_i(const VISU::VISU_Gen_i &); public: - VISU_Gen_i(CORBA::ORB_ptr orb, + VISU_Gen_i(SALOME::Session_ptr session, + CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, const char *instanceName, diff --git a/src/GUITOOLS/Makefile.in b/src/GUITOOLS/Makefile.in index f4e549f4..02b7a33b 100644 --- a/src/GUITOOLS/Makefile.in +++ b/src/GUITOOLS/Makefile.in @@ -35,7 +35,8 @@ VPATH=.:@srcdir@ # header files EXPORT_HEADERS= \ - VisuGUI_TableDlg.h + VisuGUI_TableDlg.h \ + VisuGUITools.h # .po files to transform in .qm #PO_FILES = \ diff --git a/src/GUITOOLS/VisuGUITools.h b/src/GUITOOLS/VisuGUITools.h new file mode 100755 index 00000000..d8fbf8a6 --- /dev/null +++ b/src/GUITOOLS/VisuGUITools.h @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VisuGUITools.h +// Author : Oleg UVAROV +// Module : VISU + +#ifndef _VisuGUITools_H_ +#define _VisuGUITools_H_ + +#ifdef WNT + #if defined VISU_GUITOOLS_EXPORTS + #if defined WIN32 + #define VISU_GUITOOLS_EXPORT __declspec( dllexport ) + #else + #define VISU_GUITOOLS_EXPORT + #endif + #else + #if defined WIN32 + #define VISU_GUITOOLS_EXPORT __declspec( dllimport ) + #else + #define VISU_GUITOOLS_EXPORT + #endif + #endif +#else + #define VISU_GUITOOLS_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/GUITOOLS/VisuGUI_TableDlg.cxx b/src/GUITOOLS/VisuGUI_TableDlg.cxx index e5cc2c85..5dc1a547 100644 --- a/src/GUITOOLS/VisuGUI_TableDlg.cxx +++ b/src/GUITOOLS/VisuGUI_TableDlg.cxx @@ -313,9 +313,15 @@ void VisuGUI_TableDlg::onHelp() if (app) app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/GUITOOLS/VisuGUI_TableDlg.h b/src/GUITOOLS/VisuGUI_TableDlg.h index 76eaa105..44621d27 100644 --- a/src/GUITOOLS/VisuGUI_TableDlg.h +++ b/src/GUITOOLS/VisuGUI_TableDlg.h @@ -33,7 +33,9 @@ class VisuGUI_TableWidget; #include -class VisuGUI_TableDlg : public QDialog +#include "VisuGUITools.h" + +class VISU_GUITOOLS_EXPORT VisuGUI_TableDlg : public QDialog { Q_OBJECT diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index 3651a0a2..4a3874aa 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -32,6 +32,7 @@ #include "SALOME_Actor.h" #include "VISU_ActorFactory.h" #include "VISU_BoostSignals.h" +#include "SVTK_DeviceActor.h" #include #include @@ -45,12 +46,20 @@ class vtkInteractorStyle; class VTKViewer_ShrinkFilter; class VISU_PipeLine; -#ifdef _WIN_32 +#ifdef _WIN32 #define VTKOCC_EXPORT __declspec (dllexport) #else #define VTKOCC_EXPORT VTK_EXPORT #endif +namespace SVTK +{ + namespace Representation + { + const Type Surfaceframe = Insideframe + 1; + } +} + namespace VISU { class Prs3d_i; diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index ac8ca239..1eaff4b9 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -254,8 +254,6 @@ VISU_GaussPtsAct { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::RemoveFromRender - this = "<RemoveFromRender(theRenderer); theRenderer->RemoveActor(myTextActor.GetPointer()); @@ -264,6 +262,8 @@ VISU_GaussPtsAct myCursorPyramid->RemoveFromRender(theRenderer); myCursorPyramidSelected->RemoveFromRender(theRenderer); myScalarBarCtrl->RemoveFromRender(theRenderer); + + Superclass::RemoveFromRender(theRenderer); } void @@ -1148,10 +1148,10 @@ void VISU_GaussPtsAct1 ::RemoveFromRender(vtkRenderer* theRenderer) { - Superclass::RemoveFromRender(theRenderer); - myInsideDeviceActor->RemoveFromRender(theRenderer); myOutsideDeviceActor->RemoveFromRender(theRenderer); + + Superclass::RemoveFromRender(theRenderer); } void diff --git a/src/OBJECT/VISU_GaussPtsSettings.h b/src/OBJECT/VISU_GaussPtsSettings.h index da3e70d3..473ddd10 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.h +++ b/src/OBJECT/VISU_GaussPtsSettings.h @@ -36,6 +36,7 @@ class vtkImageData; +#include "VISU_Actor.h" //============================================================================ namespace VISU @@ -48,7 +49,7 @@ namespace VISU //! Base class of Gauss Points settings. -class VISU_GaussPtsSettings : public vtkObject +class VTKOCC_EXPORT VISU_GaussPtsSettings : public vtkObject { public: vtkTypeMacro( VISU_GaussPtsSettings, vtkObject ); @@ -103,7 +104,7 @@ class VISU_GaussPtsSettings : public vtkObject * Clamp, Texture, Alpha threshold, Const size and Color. * Used by Gauss Points Actor. */ -class VISU_InsideCursorSettings : public VISU_GaussPtsSettings +class VTKOCC_EXPORT VISU_InsideCursorSettings : public VISU_GaussPtsSettings { public: vtkTypeMacro( VISU_InsideCursorSettings, vtkObject ); @@ -134,7 +135,7 @@ class VISU_InsideCursorSettings : public VISU_GaussPtsSettings * Clamp, Texture, Alpha threshold, Const size and Color. * Used by Gauss Points Actor. */ -class VISU_OutsideCursorSettings : public VISU_GaussPtsSettings +class VTKOCC_EXPORT VISU_OutsideCursorSettings : public VISU_GaussPtsSettings { public: vtkTypeMacro( VISU_OutsideCursorSettings, vtkObject ); @@ -170,7 +171,7 @@ class VISU_OutsideCursorSettings : public VISU_GaussPtsSettings * Camera movement steps number and Display parent mesh. * Used by Gauss Points Actor. */ -class VISU_PickingSettings : public vtkObject +class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject { public: enum { BelowPoint = 0, TopLeftCorner }; diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index 17a8072d..31873bcd 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -27,7 +27,6 @@ // $Header$ #include "VISU_MeshAct.h" -#include "SVTK_DeviceActor.h" #include #include diff --git a/src/OBJECT/VISU_MeshAct.h b/src/OBJECT/VISU_MeshAct.h index bc358e6b..0f047615 100644 --- a/src/OBJECT/VISU_MeshAct.h +++ b/src/OBJECT/VISU_MeshAct.h @@ -30,15 +30,6 @@ #define VISU_MeshAct_HeaderFile #include "VISU_Actor.h" -#include "SVTK_DeviceActor.h" - -namespace SVTK -{ - namespace Representation - { - const Type Surfaceframe = Insideframe + 1; - } -} class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor { diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index e9ce7e18..ea2c6dfd 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -29,12 +29,17 @@ #include "VISU_ScalarMapAct.h" #include "VISU_LookupTable.hxx" #include "VISU_ScalarBarActor.hxx" +#include "VISU_PipeLine.hxx" #include #include #include +#include +#include +#include vtkStandardNewMacro(VISU_ScalarMapAct); +static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT; VISU_ScalarMapAct ::VISU_ScalarMapAct() @@ -50,12 +55,135 @@ VISU_ScalarMapAct aProperty->SetSpecular(0.0); myProperty->DeepCopy(aProperty); + + vtkMatrix4x4 *m; + m = vtkMatrix4x4::New(); + + mySurfaceActor= SVTK_DeviceActor::New(); + mySurfaceActor->SetRepresentation(SVTK::Representation::Surface); + mySurfaceActor->SetProperty(aProperty); + mySurfaceActor->SetUserMatrix(m); + + myEdgeActor = SVTK_DeviceActor::New(); + myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe); + myEdgeActor->SetUserMatrix(m); + myEdgeActor->GetProperty()->SetColor(255.,255.,255.); + + m->Delete(); } VISU_ScalarMapAct ::~VISU_ScalarMapAct() { myScalarBar->Delete(); + mySurfaceActor->Delete(); + myEdgeActor->Delete(); +} + +void +VISU_ScalarMapAct +::ShallowCopyPL(VISU_PipeLine* thePipeLine) +{ + VISU_Actor::ShallowCopyPL(thePipeLine); + + myEdgeActor->GetMapper()->ScalarVisibilityOff(); + + vtkDataSet* aDatsSet = mySurfaceActor->GetDataSetMapper()->GetInput(); + mySurfaceActor->GetMapper()->ShallowCopy(thePipeLine->GetMapper()); + // To restore mapper input from pipeline + mySurfaceActor->GetDataSetMapper()->SetInput(aDatsSet); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetMapperInput(vtkDataSet* theDataSet) +{ + Superclass::SetMapperInput(theDataSet); + + mySurfaceActor->SetInput(theDataSet); + myEdgeActor->SetInput(theDataSet); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetTransform(VTKViewer_Transform* theTransform) +{ + Superclass::SetTransform(theTransform); + + mySurfaceActor->SetTransform(theTransform); + myEdgeActor->SetTransform(theTransform); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetShrinkable(bool theIsShrinkable) +{ + Superclass::SetShrinkable(theIsShrinkable); + + mySurfaceActor->SetShrinkable(theIsShrinkable); +} + +void +VISU_ScalarMapAct +::SetShrinkFactor(vtkFloatingPointType theValue) +{ + Superclass::SetShrinkFactor(theValue); + + mySurfaceActor->SetShrinkFactor(theValue); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetShrink() +{ + if(myRepresentation == VTK_POINTS) + return; + + Superclass::SetShrink(); + + mySurfaceActor->SetShrink(); +} + +void +VISU_ScalarMapAct +::UnShrink() +{ + Superclass::UnShrink(); + + mySurfaceActor->UnShrink(); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetOpacity(vtkFloatingPointType theValue) +{ + mySurfaceActor->GetProperty()->SetOpacity(theValue); +} + +vtkFloatingPointType +VISU_ScalarMapAct +::GetOpacity() +{ + return mySurfaceActor->GetProperty()->GetOpacity(); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetLineWidth(vtkFloatingPointType theLineWidth) +{ + mySurfaceActor->GetProperty()->SetLineWidth(theLineWidth); +} + +vtkFloatingPointType +VISU_ScalarMapAct::GetLineWidth() +{ + return mySurfaceActor->GetProperty()->GetLineWidth(); } void @@ -116,7 +244,13 @@ VISU_ScalarMapAct ::SetRepresentation(int theMode) { bool anIsShanding = IsShading(); + Superclass::SetRepresentation(theMode); + if(theMode == SVTK::Representation::Surfaceframe) + mySurfaceActor->SetRepresentation(SVTK::Representation::Surface); + else + mySurfaceActor->SetRepresentation(theMode); + SetShading(anIsShanding); } @@ -125,7 +259,7 @@ void VISU_ScalarMapAct ::SetShading(bool theOn) { - vtkProperty* aProperty = GetProperty(); + vtkProperty* aProperty = mySurfaceActor->GetProperty(); if (theOn) { @@ -136,14 +270,59 @@ VISU_ScalarMapAct { aProperty->SetAmbient(1.0); aProperty->SetDiffuse(0.0); - } + } } bool VISU_ScalarMapAct ::IsShading() { - vtkProperty* aProperty = GetProperty(); + vtkProperty* aProperty = mySurfaceActor->GetProperty(); - return (aProperty->GetAmbient() == 0 && aProperty->GetDiffuse() == 1); + return (fabs(aProperty->GetAmbient()) < EPS && fabs(aProperty->GetDiffuse() - 1.) < EPS); } + +int +VISU_ScalarMapAct +::RenderOpaqueGeometry(vtkViewport *ren) +{ + GetMatrix(myEdgeActor->GetUserMatrix()); + GetMatrix(mySurfaceActor->GetUserMatrix()); + + using namespace SVTK::Representation; + if( GetRepresentation() == Surfaceframe ){ + mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren); + mySurfaceActor->RenderOpaqueGeometry(ren); + + myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren); + myEdgeActor->RenderOpaqueGeometry(ren); + } + else{ + mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren); + mySurfaceActor->RenderOpaqueGeometry(ren); + } + return 1; +} + +int +VISU_ScalarMapAct +::RenderTranslucentGeometry(vtkViewport *ren) +{ + GetMatrix(myEdgeActor->GetUserMatrix()); + GetMatrix(mySurfaceActor->GetUserMatrix()); + + using namespace SVTK::Representation; + if( GetRepresentation() == Surfaceframe ){ + mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren); + mySurfaceActor->RenderTranslucentGeometry(ren); + + myEdgeActor->SetAllocatedRenderTime(this->AllocatedRenderTime/2.0,ren); + myEdgeActor->RenderTranslucentGeometry(ren); + } + else{ + mySurfaceActor->SetAllocatedRenderTime(this->AllocatedRenderTime,ren); + mySurfaceActor->RenderTranslucentGeometry(ren); + } + return 1; +} + diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index 0b6a4839..ea6ebaf8 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -44,10 +44,59 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor ~VISU_ScalarMapAct(); + virtual + void + ShallowCopyPL(VISU_PipeLine* thePipeLine); + + //! Apply view transformation + virtual + void + SetTransform(VTKViewer_Transform* theTransform); + + virtual + void + SetShrinkable(bool theIsShrinkable); + + virtual + void + SetShrinkFactor(vtkFloatingPointType theFactor = 0.8); + + virtual + void + SetShrink(); + + virtual + void + UnShrink(); + + virtual + void + SetOpacity(vtkFloatingPointType theValue); + + virtual + vtkFloatingPointType + GetOpacity(); + + virtual + void + SetLineWidth(vtkFloatingPointType theLineWidth); + + virtual + vtkFloatingPointType + GetLineWidth(); + virtual void AddToRender(vtkRenderer* theRenderer); + virtual + int + RenderOpaqueGeometry(vtkViewport *ren); + + virtual + int + RenderTranslucentGeometry(vtkViewport *ren); + virtual void RemoveFromRender(vtkRenderer* theRenderer); @@ -82,8 +131,15 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor protected: VISU_ScalarMapAct(); + + virtual + void + SetMapperInput(vtkDataSet* theDataSet); + bool myBarVisibility; VISU_ScalarBarActor* myScalarBar; + SVTK_DeviceActor* mySurfaceActor; + SVTK_DeviceActor* myEdgeActor; }; #endif diff --git a/src/PIPELINE/Makefile.in b/src/PIPELINE/Makefile.in index 198eadde..853f337d 100644 --- a/src/PIPELINE/Makefile.in +++ b/src/PIPELINE/Makefile.in @@ -57,7 +57,9 @@ EXPORT_HEADERS = \ VISU_PlanesWidget.hxx \ VISU_SphereWidget.hxx \ VISU_WidgetCtrl.hxx \ - VISU_ScalarMapOnDeformedShapePL.hxx + VISU_ScalarMapOnDeformedShapePL.hxx \ + VISU_PrsMergerPL.hxx \ + VISUPipeline.hxx # Libraries targets @@ -87,7 +89,8 @@ LIB_SRC = \ VISU_SphereWidget.cxx \ VISU_WidgetCtrl.cxx \ VISU_ScalarBarCtrl.cxx \ - VISU_ScalarMapOnDeformedShapePL.cxx + VISU_ScalarMapOnDeformedShapePL.cxx \ + VISU_PrsMergerPL.cxx # Executables targets diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 2af09bb9..6bf73009 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -56,9 +56,11 @@ using namespace std; static int isOnlyMesh = false; -int main(int argc, char** argv){ - try{ - if(argc > 1){ +int main(int argc, char** argv) +{ + try { + if(argc > 1) + { vtkRenderWindow *renWin = vtkRenderWindow::New(); vtkRenderer *ren = vtkRenderer::New(); renWin->AddRenderer(ren); @@ -76,28 +78,29 @@ int main(int argc, char** argv){ 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); + if(isOnlyMesh) + { + const VISU::TEntity& anEntity = VISU::CELL_ENTITY; + aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity); - VISU::PIDMapper anIDMapper = - aConvertor->GetMeshOnEntity(aMeshName,anEntity); - VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); + VISU::PIDMapper anIDMapper = + aConvertor->GetMeshOnEntity(aMeshName,anEntity); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); - VISU_MeshPL* aPresent = VISU_MeshPL::New(); - aPresent->SetInput(aDataSet); - aPresent->Build(); + VISU_MeshPL* aPresent = VISU_MeshPL::New(); + aPresent->SetInput(aDataSet); + aPresent->Build(); - vtkActor* aActor = vtkActor::New(); - aActor->SetMapper(aPresent->GetMapper()); - aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME); - //ren->ResetCameraClippingRange(); + vtkActor* aActor = vtkActor::New(); + aActor->SetMapper(aPresent->GetMapper()); + aActor->GetProperty()->SetRepresentation(VTK_WIREFRAME); + //ren->ResetCameraClippingRange(); - ren->AddActor(aActor); + ren->AddActor(aActor); - renWin->Render(); - iren->Start(); - return 0; + renWin->Render(); + iren->Start(); + return 0; } //Import fields aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); @@ -164,9 +167,11 @@ int main(int argc, char** argv){ } } } - }catch(std::exception& exc){ + } + catch(std::exception& exc){ MESSAGE("Follow exception was occured :\n"<IsPartDefault(i)) SetPartPosition(i, aPipeLine->GetPartPosition(i)); } - VISU_ScalarMapPL::ShallowCopy(thePipeLine); + Superclass::ShallowCopy(thePipeLine); } void VISU_CutPlanesPL ::Init() { - VISU_ScalarMapPL::Init(); + Superclass::Init(); SetNbParts(10); myBasePlane[0] = YZ; @@ -110,7 +110,7 @@ VISU_CutPlanesPL CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds, myPartPosition,myPartCondition,myDisplacement[0]); - VISU_ScalarMapPL::Update(); + Superclass::Update(); } void diff --git a/src/PIPELINE/VISU_CutPlanesPL.hxx b/src/PIPELINE/VISU_CutPlanesPL.hxx index cea06cb2..e92e4ac8 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.hxx +++ b/src/PIPELINE/VISU_CutPlanesPL.hxx @@ -27,18 +27,19 @@ #ifndef VISU_CutPlanesPL_HeaderFile #define VISU_CutPlanesPL_HeaderFile -#include "VISU_ScalarMapPL.hxx" +#include "VISUPipeline.hxx" +#include "VISU_PrsMergerPL.hxx" #include class vtkAppendPolyData; -class VISU_CutPlanesPL : public VISU_ScalarMapPL{ +class VISU_PIPELINE_EXPORT VISU_CutPlanesPL : public VISU_PrsMergerPL{ protected: VISU_CutPlanesPL(); VISU_CutPlanesPL(const VISU_CutPlanesPL&); public: - vtkTypeMacro(VISU_CutPlanesPL,VISU_ScalarMapPL); + vtkTypeMacro(VISU_CutPlanesPL,VISU_PrsMergerPL); static VISU_CutPlanesPL* New(); virtual diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 43314db9..0a69dc9b 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -57,7 +57,7 @@ VISU_DeformedShapePL if(VISU_DeformedShapePL *aPipeLine = dynamic_cast(thePipeLine)){ SetScale(aPipeLine->GetScale()); } - VISU_ScalarMapPL::ShallowCopy(thePipeLine); + TSupperClass::ShallowCopy(thePipeLine); } vtkFloatingPointType @@ -103,11 +103,12 @@ void VISU_DeformedShapePL ::Init() { - VISU_ScalarMapPL::Init(); + TSupperClass::Init(); vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); vtkDataSet* aDataSet = GetInput2(); + //vtkDataSet* aDataSet = GetScalars()->GetInput(); vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); static double EPS = 1.0 / VTK_LARGE_FLOAT; @@ -129,14 +130,14 @@ void VISU_DeformedShapePL ::Update() { - VISU_ScalarMapPL::Update(); + TSupperClass::Update(); } void VISU_DeformedShapePL ::SetMapScale(vtkFloatingPointType theMapScale) { - VISU_ScalarMapPL::SetMapScale(theMapScale); + TSupperClass::SetMapScale(theMapScale); myWarpVector->SetScaleFactor(myScaleFactor*theMapScale); Modified(); diff --git a/src/PIPELINE/VISU_DeformedShapePL.hxx b/src/PIPELINE/VISU_DeformedShapePL.hxx index 96c3d0eb..6b745aec 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.hxx +++ b/src/PIPELINE/VISU_DeformedShapePL.hxx @@ -27,14 +27,17 @@ #ifndef VISU_DeformedShapePL_HeaderFile #define VISU_DeformedShapePL_HeaderFile -#include "VISU_ScalarMapPL.hxx" +#include "VISUPipeline.hxx" +#include "VISU_PrsMergerPL.hxx" class vtkCellDataToPointData; class SALOME_Transform; class vtkWarpVector; -class VISU_DeformedShapePL : public VISU_ScalarMapPL +class VISU_PIPELINE_EXPORT VISU_DeformedShapePL : public VISU_PrsMergerPL { + typedef VISU_PrsMergerPL TSupperClass; + protected: VISU_DeformedShapePL(); VISU_DeformedShapePL(const VISU_DeformedShapePL&); @@ -43,7 +46,7 @@ protected: ~VISU_DeformedShapePL(); public: - vtkTypeMacro(VISU_DeformedShapePL,VISU_ScalarMapPL); + vtkTypeMacro(VISU_DeformedShapePL,TSupperClass); static VISU_DeformedShapePL* diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index 82eec5dc..c33d071a 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -100,7 +100,7 @@ void VISU_Extractor::Execute(){ output->GetPointData()->CopyVectorsOn(); int aNbElems = input->GetNumberOfPoints(); vtkPointData *inData = input->GetPointData(), *outData = output->GetPointData(); - if(inData->GetAttribute(vtkDataSetAttributes::VECTORS)) + if(!inData->GetAttribute(vtkDataSetAttributes::SCALARS)) execute(aNbElems,myScalarMode,inData,outData); else output->GetPointData()->CopyScalarsOn(); diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 4acd793f..f0698f4f 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -28,6 +28,7 @@ #ifndef VISU_GaussPointsPL_HeaderFile #define VISU_GaussPointsPL_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_ScalarMapPL.hxx" #include "VISU_Convertor.hxx" @@ -52,7 +53,7 @@ class SALOME_Transform; * This class uses the special mapper (VISU_OpenGLPointSpriteMapper) * for rendering the Gauss Points as Point Sprites. */ -class VISU_GaussPointsPL : public VISU_ScalarMapPL +class VISU_PIPELINE_EXPORT VISU_GaussPointsPL : public VISU_ScalarMapPL { protected: VISU_GaussPointsPL(); diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx index 3d26ba25..55632fd5 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx @@ -31,6 +31,8 @@ #include +#include "VISUPipeline.hxx" + #include "VTKViewer.h" class VISU_UnScaledActor: public vtkFollower @@ -58,7 +60,7 @@ protected: class vtkImplicitFunction; -class VISU_ImplicitFunctionWidget : public vtk3DWidget +class VISU_PIPELINE_EXPORT VISU_ImplicitFunctionWidget : public vtk3DWidget { public: vtkTypeRevisionMacro(VISU_ImplicitFunctionWidget,vtk3DWidget); diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index 2d0be6cc..c8b9eaea 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -60,7 +60,7 @@ VISU_IsoSurfacesPL vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()}; SetRange(aRange); } - VISU_ScalarMapPL::ShallowCopy(thePipeLine); + TSupperClass::ShallowCopy(thePipeLine); } int @@ -82,7 +82,7 @@ void VISU_IsoSurfacesPL ::SetScaling(int theScaling) { - VISU_ScalarMapPL::SetScaling(theScaling); + TSupperClass::SetScaling(theScaling); SetRange(myRange); } void @@ -118,7 +118,7 @@ void VISU_IsoSurfacesPL ::Init() { - VISU_ScalarMapPL::Init(); + TSupperClass::Init(); SetNbParts(10); vtkFloatingPointType aScalarRange[2]; @@ -139,14 +139,14 @@ void VISU_IsoSurfacesPL ::Update() { - VISU_ScalarMapPL::Update(); + TSupperClass::Update(); } void VISU_IsoSurfacesPL ::SetMapScale(vtkFloatingPointType theMapScale) { - VISU_ScalarMapPL::SetMapScale(theMapScale); + TSupperClass::SetMapScale(theMapScale); vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()}; vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]}; diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.hxx b/src/PIPELINE/VISU_IsoSurfacesPL.hxx index 2049a761..0063314b 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.hxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.hxx @@ -27,13 +27,16 @@ #ifndef VISU_IsoSurfacesPL_HeaderFile #define VISU_IsoSurfacesPL_HeaderFile -#include "VISU_ScalarMapPL.hxx" +#include "VISUPipeline.hxx" +#include "VISU_PrsMergerPL.hxx" class vtkContourFilter; class vtkCellDataToPointData; -class VISU_IsoSurfacesPL : public VISU_ScalarMapPL +class VISU_PIPELINE_EXPORT VISU_IsoSurfacesPL : public VISU_PrsMergerPL { + typedef VISU_ScalarMapPL TSupperClass; + protected: VISU_IsoSurfacesPL(); VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&); @@ -42,7 +45,7 @@ protected: ~VISU_IsoSurfacesPL(); public: - vtkTypeMacro(VISU_IsoSurfacesPL,VISU_ScalarMapPL); + vtkTypeMacro(VISU_IsoSurfacesPL,TSupperClass); static VISU_IsoSurfacesPL* diff --git a/src/PIPELINE/VISU_MeshPL.hxx b/src/PIPELINE/VISU_MeshPL.hxx index 6ada3e68..60053f61 100644 --- a/src/PIPELINE/VISU_MeshPL.hxx +++ b/src/PIPELINE/VISU_MeshPL.hxx @@ -27,9 +27,10 @@ #ifndef VISU_MeshPL_HeaderFile #define VISU_MeshPL_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_PipeLine.hxx" -class VISU_MeshPL : public VISU_PipeLine{ +class VISU_PIPELINE_EXPORT VISU_MeshPL : public VISU_PipeLine{ protected: VISU_MeshPL(); VISU_MeshPL(const VISU_MeshPL&); diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 680a21ab..6f0edac8 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -27,6 +27,8 @@ #include "VISU_OpenGLPointSpriteMapper.hxx" +#include + #include #include #include @@ -45,16 +47,19 @@ #include #include -#include - #include #include #include -#ifndef GLX_GLXEXT_LEGACY -#define GLX_GLXEXT_LEGACY +#ifndef WNT +# ifndef GLX_GLXEXT_LEGACY +# define GLX_GLXEXT_LEGACY +# endif +# include +# include +#else +# include #endif -#include #ifndef VTK_IMPLEMENT_MESA_CXX vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "Revision$"); @@ -139,65 +144,71 @@ static PFNGLBINDBUFFERARBPROC vglBindBufferARB = NULL static PFNGLBUFFERDATAARBPROC vglBufferDataARB = NULL; static PFNGLDELETEBUFFERSARBPROC vglDeleteBuffersARB = NULL; +#ifndef WNT +#define GL_GetProcAddress( x ) glXGetProcAddressARB( (const GLubyte*)x ) +#else +#define GL_GetProcAddress( x ) wglGetProcAddress( (const LPCSTR)x ) +#endif + bool InitializeARB() { - vglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)glXGetProcAddressARB( (const GLubyte*)"glShaderSourceARB" ); + vglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)GL_GetProcAddress( "glShaderSourceARB" ); if( !vglShaderSourceARB ) return false; - vglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glCreateShaderObjectARB" ); + vglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)GL_GetProcAddress( "glCreateShaderObjectARB" ); if( !vglCreateShaderObjectARB ) return false; - vglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)glXGetProcAddressARB( (const GLubyte*)"glCompileShaderARB" ); + vglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)GL_GetProcAddress( "glCompileShaderARB" ); if( !vglCompileShaderARB ) return false; - vglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glCreateProgramObjectARB" ); + vglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)GL_GetProcAddress( "glCreateProgramObjectARB" ); if( !vglCreateProgramObjectARB ) return false; - vglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glAttachObjectARB" ); + vglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)GL_GetProcAddress( "glAttachObjectARB" ); if( !vglAttachObjectARB ) return false; - vglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)glXGetProcAddressARB( (const GLubyte*)"glLinkProgramARB" ); + vglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)GL_GetProcAddress( "glLinkProgramARB" ); if( !vglLinkProgramARB ) return false; - vglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)glXGetProcAddressARB( (const GLubyte*)"glUseProgramObjectARB" ); + vglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)GL_GetProcAddress( "glUseProgramObjectARB" ); if( !vglUseProgramObjectARB ) return false; - vglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGetObjectParameterivARB" ); + vglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)GL_GetProcAddress( "glGetObjectParameterivARB" ); if( !vglGetObjectParameterivARB ) return false; - vglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGetInfoLogARB" ); + vglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)GL_GetProcAddress( "glGetInfoLogARB" ); if( !vglGetInfoLogARB ) return false; - vglGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGetAttribLocationARB" ); + vglGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC)GL_GetProcAddress( "glGetAttribLocationARB" ); if( !vglGetAttribLocationARB ) return false; - vglVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)glXGetProcAddressARB( (const GLubyte*)"glVertexAttrib1fARB" ); + vglVertexAttrib1fARB = (PFNGLVERTEXATTRIB1FARBPROC)GL_GetProcAddress( "glVertexAttrib1fARB" ); if( !vglVertexAttrib1fARB ) return false; - vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)glXGetProcAddressARB( (const GLubyte*)"glGenBuffersARB" ); + vglGenBuffersARB = (PFNGLGENBUFFERSARBPROC)GL_GetProcAddress( "glGenBuffersARB" ); if( !vglGenBuffersARB ) return false; - vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)glXGetProcAddressARB( (const GLubyte*)"glBindBufferARB" ); + vglBindBufferARB = (PFNGLBINDBUFFERARBPROC)GL_GetProcAddress( "glBindBufferARB" ); if( !vglBindBufferARB ) return false; - vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)glXGetProcAddressARB( (const GLubyte*)"glBufferDataARB" ); + vglBufferDataARB = (PFNGLBUFFERDATAARBPROC)GL_GetProcAddress( "glBufferDataARB" ); if( !vglBufferDataARB ) return false; - vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)glXGetProcAddressARB( (const GLubyte*)"glDeleteBuffersARB" ); + vglDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)GL_GetProcAddress( "glDeleteBuffersARB" ); if( !vglDeleteBuffersARB ) return false; @@ -429,6 +440,11 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaT //----------------------------------------------------------------------------- bool VISU_OpenGLPointSpriteMapper::InitExtensions() { + if( this->ExtensionsInitialized ) + return true; + + InitializeARB(); + char* ext = (char*)glGetString( GL_EXTENSIONS ); //cout << "OpenGL extensions : " << ext << endl; @@ -438,7 +454,6 @@ bool VISU_OpenGLPointSpriteMapper::InitExtensions() strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL ) { vtkWarningMacro(<<"Initializing ARB extensions failed"); - this->UseOpenGLMapper = true; return false; @@ -464,7 +479,7 @@ float ViewToDisplay( vtkRenderer* theRenderer ) theRenderer->ViewToDisplay(); theRenderer->GetDisplayPoint( p2 ); - vtkFloatingPointType coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 ); + vtkFloatingPointType coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2. ); //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl; //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl; //cout << "ZOOM : " << coefficient << endl; @@ -481,11 +496,9 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) bool isUseThisMapper = !( this->UseOpenGLMapper || this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere ); - if( !this->ExtensionsInitialized && isUseThisMapper ) - { + if( isUseThisMapper ) if( !this->InitExtensions() ) return; - } if( !isUseThisMapper ) { @@ -816,7 +829,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints, aVertex.vy = aCoords[1]; aVertex.vz = aCoords[2]; - int aRed, aGreen, aBlue; + int aRed = 0, aGreen = 0, aBlue = 0; if( theColors && this->PointSpriteMode != 1 ) { unsigned char *col = theColors->GetPointer(pts[0] << 2); diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx index 7af9a27a..4a8703b1 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx @@ -32,6 +32,10 @@ # pragma warning ( disable : 4275 ) #endif +#ifdef WIN32 +#include +#endif + #include #include @@ -62,6 +66,8 @@ class vtkXMLImageDataReader; typedef GLuint GLhandleARB; #endif +#include "VISUPipeline.hxx" + //---------------------------------------------------------------------------- //! OpenGL Point Sprites PolyData Mapper. /*! @@ -72,7 +78,7 @@ typedef GLuint GLhandleARB; * usage of the pipeline is larger than this limit, the mapper will divide * the data into pieces and render each in a for loop. */ -class VISU_OpenGLPointSpriteMapper : public MAPPER_SUPERCLASS +class VISU_PIPELINE_EXPORT VISU_OpenGLPointSpriteMapper : public MAPPER_SUPERCLASS { public: //! The Point Sprites rendering mode. diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 91e05edb..9c553cf9 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -59,6 +59,7 @@ VISU_PipeLine { if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<Delete(); diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index c90080ce..30e94715 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -31,6 +31,7 @@ #include #include +#include "VISUPipeline.hxx" #include "VISU_IDMapper.hxx" class vtkCell; @@ -81,7 +82,7 @@ class SALOME_ExtractGeometry; typedef VISU::TVTKOutput TInput; -class VISU_PipeLine : public vtkObject{ +class VISU_PIPELINE_EXPORT VISU_PipeLine : public vtkObject{ public: vtkTypeMacro(VISU_PipeLine,vtkObject); virtual @@ -209,7 +210,6 @@ public: protected: VISU_PipeLine(); - VISU_PipeLine(const VISU_PipeLine&); virtual TInput* diff --git a/src/PIPELINE/VISU_PipeLineUtils.hxx b/src/PIPELINE/VISU_PipeLineUtils.hxx index 57e6347b..4f87eaea 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.hxx +++ b/src/PIPELINE/VISU_PipeLineUtils.hxx @@ -27,6 +27,7 @@ #ifndef VISU_PipeLineUtils_HeaderFile #define VISU_PipeLineUtils_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_FieldTransform.hxx" #include "VISU_LookupTable.hxx" #include "VISU_Extractor.hxx" diff --git a/src/PIPELINE/VISU_PlanesWidget.hxx b/src/PIPELINE/VISU_PlanesWidget.hxx index 5c00c895..77d3dcd0 100644 --- a/src/PIPELINE/VISU_PlanesWidget.hxx +++ b/src/PIPELINE/VISU_PlanesWidget.hxx @@ -29,6 +29,7 @@ #ifndef __VISU_PlanesWidget_h #define __VISU_PlanesWidget_h +#include "VISUPipeline.hxx" #include "VISU_ImplicitFunctionWidget.hxx" class vtkActor; class vtkPolyDataMapper; @@ -49,7 +50,7 @@ class vtkImplicitFunction; class VISU_UnScaledActor; class vtkDataSet; -class VISU_PlanesWidget : public VISU_ImplicitFunctionWidget +class VISU_PIPELINE_EXPORT VISU_PlanesWidget : public VISU_ImplicitFunctionWidget { public: // Description: diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 2b87e56f..e5de36c4 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -77,7 +77,7 @@ ShallowCopy(VISU_PipeLine *thePipeLine) SetContourPrs( aPipeLine->GetIsContourPrs() ); SetNumberOfContours( aPipeLine->GetNumberOfContours() ); } - VISU_ScalarMapPL::ShallowCopy(thePipeLine); + TSupperClass::ShallowCopy(thePipeLine); } VISU_CutPlanesPL::PlaneOrientation @@ -133,7 +133,7 @@ void VISU_Plot3DPL:: Init() { - VISU_ScalarMapPL::Init(); + TSupperClass::Init(); myOrientation = GetOrientation(GetInput2()); SetScaleFactor(GetScaleFactor(GetInput2())); @@ -213,7 +213,7 @@ Update() myWarpScalar->SetNormal(aPlaneNormal); - VISU_ScalarMapPL::Update(); + TSupperClass::Update(); } void @@ -388,7 +388,7 @@ void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos, void VISU_Plot3DPL::SetMapScale(vtkFloatingPointType theMapScale) { - VISU_ScalarMapPL::SetMapScale(theMapScale); + TSupperClass::SetMapScale(theMapScale); if ( myIsContour ) { vtkFloatingPointType aRange[2]; diff --git a/src/PIPELINE/VISU_Plot3DPL.hxx b/src/PIPELINE/VISU_Plot3DPL.hxx index cb237fa7..5dc4f32d 100644 --- a/src/PIPELINE/VISU_Plot3DPL.hxx +++ b/src/PIPELINE/VISU_Plot3DPL.hxx @@ -27,7 +27,8 @@ #ifndef VISU_Plot3DPL_HeaderFile #define VISU_Plot3DPL_HeaderFile -#include "VISU_ScalarMapPL.hxx" +#include "VISUPipeline.hxx" +#include "VISU_PrsMergerPL.hxx" #include "VISU_CutPlanesPL.hxx" class vtkWarpScalar; @@ -35,13 +36,14 @@ class vtkContourFilter; class vtkGeometryFilter; class vtkCellDataToPointData; -class VISU_Plot3DPL : public VISU_ScalarMapPL{ +class VISU_PIPELINE_EXPORT VISU_Plot3DPL : public VISU_PrsMergerPL{ + typedef VISU_ScalarMapPL TSupperClass; protected: VISU_Plot3DPL(); VISU_Plot3DPL(const VISU_Plot3DPL&); public: - vtkTypeMacro(VISU_Plot3DPL,VISU_ScalarMapPL); + vtkTypeMacro(VISU_Plot3DPL,TSupperClass); static VISU_Plot3DPL* New(); virtual ~VISU_Plot3DPL(); diff --git a/src/PIPELINE/VISU_PrsMergerPL.cxx b/src/PIPELINE/VISU_PrsMergerPL.cxx new file mode 100644 index 00000000..9b46c9fb --- /dev/null +++ b/src/PIPELINE/VISU_PrsMergerPL.cxx @@ -0,0 +1,403 @@ +// 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_PrsMergerPL.cxx +// Author: Eugeny Nikolaev +// Module : VISU + +#include "VISU_PrsMergerPL.hxx" +#include "VISU_MeshPL.hxx" +#include "VISU_ScalarMapPL.hxx" +#include "VISU_MergeFilter.hxx" +#include "VISU_IDMapper.hxx" +#include "VTKViewer_AppendFilter.h" + +#include "VISU_PipeLineUtils.hxx" + +#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 + + +using namespace std; + +vtkStandardNewMacro(VISU_PrsMergerPL); + +VISU_PrsMergerPL +::VISU_PrsMergerPL() +{ + myScalars = NULL; + + //myMergeFilter->Delete(); + myMeshGeometryList.clear(); +} + +VISU_PrsMergerPL +::~VISU_PrsMergerPL() +{ + myMeshGeometryList.clear(); +} + +void +VISU_PrsMergerPL +::RemoveAllGeom() +{ + myMeshGeometryList.clear(); + this->Execute(); +} + +void +VISU_PrsMergerPL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ + if (MYDEBUG) MESSAGE("ShallowCopy"); + VISU_PrsMergerPL* aPipeLine = dynamic_cast(thePipeLine); + if(this == aPipeLine){ + TSupperClass::ShallowCopy(thePipeLine); + return; + } + if(aPipeLine){ + int aNbGeoms = aPipeLine->GetNbGeometry(); + if (MYDEBUG) MESSAGE("aNbGeoms="<GetGeometry(i),false); + } + SetScalars(aPipeLine->GetScalars(),true); + } + TSupperClass::ShallowCopy(thePipeLine); +} + +bool +VISU_PrsMergerPL +::SetGeometry(VISU_PipeLine* theGeometry,bool theUpdate) +{ + myMeshGeometryList.clear(); + if(this->checkGeometry(theGeometry)){ + myMeshGeometryList.push_back(theGeometry); + if (MYDEBUG) MESSAGE("this->GetGeometry(0)->GetIDMapper()="<GetGeometry(0)->GetIDMapper()); + + if(theUpdate) + this->Execute(); + + return true; + } else + return false; + +} + +int +VISU_PrsMergerPL +::AddBackGeometry(VISU_PipeLine* theGeometry,bool theUpdate) +{ + if(theGeometry == NULL) return -1; + int aGeomNum = this->GetGeometryNumber(theGeometry); + if(aGeomNum == -1){ + bool aCheckGeom = this->checkGeometry(theGeometry); + if(aCheckGeom){ + myMeshGeometryList.push_back(theGeometry); + + if(theUpdate) + this->Execute(); + + return (myMeshGeometryList.size()-1); + } else { + return -1; + } + } else { + return aGeomNum; + } +} + +int +VISU_PrsMergerPL +::GetGeometryNumber(VISU_PipeLine* theGeometry) +{ + TPipeLine aPipeLine = theGeometry; + TPipeLines::const_iterator aIter = myMeshGeometryList.begin(); + for(int i=0;aIter != myMeshGeometryList.end();aIter++,i++){ + if( theGeometry == (*aIter).GetPointer() ) + return i; + } + + return -1; +} + +void +VISU_PrsMergerPL +::RemoveGeometryById(int theId) +{ + if(theId >=0 && theId < myMeshGeometryList.size()){ + TPipeLines::iterator aIter = myMeshGeometryList.begin(); + for(;aIter != myMeshGeometryList.end();aIter++){ + if( myMeshGeometryList[theId] == (*aIter)){ + myMeshGeometryList.erase(aIter); + this->Execute(); + break; + } + } + } +} + +VISU_PipeLine* +VISU_PrsMergerPL +::GetGeometry(int theId) +{ + if(theId >=0 && theId < myMeshGeometryList.size()){ + return myMeshGeometryList[theId].GetPointer(); + } + else + return NULL; +} + +VISU_PipeLine* +VISU_PrsMergerPL +::GetScalars() +{ + return myScalars.GetPointer(); +} + +int +VISU_PrsMergerPL +::GetNbGeometry() +{ + return myMeshGeometryList.size(); +} + +bool +VISU_PrsMergerPL +::SetScalars(VISU_PipeLine* theInput,bool theUpdate) +{ + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetScalars()"); + if ( this->checkScalars( theInput ) ){ + myScalars = theInput; + VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); + myScalarRanges = aScalarMap->GetScalarRange(); + if(theUpdate) + this->Execute(); + return true; + } else + return false; +} + +void +VISU_PrsMergerPL +::Init() +{ + Superclass::Init(); + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Init() this="<Execute(); +} + +void +VISU_PrsMergerPL +::Update() +{ + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Update()"); + Superclass::Update(); + Execute(); +} + +void +VISU_PrsMergerPL +::Build() +{ + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Build()"); + TSupperClass::Build(); // call DoHook method +} + +void +VISU_PrsMergerPL +::SetInitialRange() +{ + myMapper->UseLookupTableScalarRangeOff(); +} + +bool +VISU_PrsMergerPL +::checkGeometry(const VISU_PipeLine* thePipeLine) +{ + const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper(); + int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints(); + if (this->GetNbGeometry() > 0){ + const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper(); + int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); + if(aNbPoints2 != aNbPoints) + return false; + } else if (this->GetScalars()) { + const VISU::PIDMapper& aMapper2 = this->GetScalars()->GetIDMapper(); + int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); + if(aNbPoints2 != aNbPoints) + return false; + } + return true; +} + +bool +VISU_PrsMergerPL +::checkScalars(const VISU_PipeLine* thePipeLine) +{ + const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper(); + int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints(); + if (this->GetNbGeometry() > 0){ + const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper(); + int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints(); + if(aNbPoints2 != aNbPoints) + return false; + } + return true; +} + +void +VISU_PrsMergerPL +::Execute(){ + /* Where are next situations: + * 1. Timestamp on entity=NODE + * 1.1 Group Cell - OK + * 1.2 Group Cell + Point - ERR (remove points groups) + * 1.3 Group Node - ERR (remove points groups) + * 2. Timesatamp on entity=CELL + * 2.1 Group Cell - OK + * 2.2 Group Point - ERR (remove points groups) + */ + + + + if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Execute()"); + + if(myMeshGeometryList.size() != 0) + { + + typedef std::vector TVec; + + vtkUnstructuredGrid* output = vtkUnstructuredGrid::New(); + TVec aObjIds; // vector with object ids + vtkFloatArray* newArray = vtkFloatArray::New(); + + VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); + const VISU::PIDMapper& aScalarMapper = myScalars->GetIDMapper(); + + // copy points to output from input scalar map + output->SetPoints(aScalarMapper->GetVTKOutput()->GetPoints()); + + int newCellId; + int anbGeoms = this->GetNbGeometry(); + for(int i=0; i < anbGeoms; i++) { + VISU_PipeLine* aCurrGeometry = this->GetGeometry(i); + const VISU::PIDMapper& aGM = aCurrGeometry->GetIDMapper(); + int aNbCells = aGM->GetVTKOutput()->GetNumberOfCells(); + if (aNbCells >0 ) + if (aGM->GetVTKOutput()->GetCell(0)->GetCellType() == VTK_VERTEX ) + continue; + + vtkIdList* ptIds = vtkIdList::New(); + ptIds->Allocate(VTK_CELL_SIZE); + + for(int j=0; j < aNbCells; j++){ + + int anObjID = aGM->GetElemObjID(j); + aObjIds.push_back(anObjID); + + // copy cells to output from input geoms + aGM->GetVTKOutput()->GetCellPoints(j, ptIds); + newCellId = output->InsertNextCell(aGM->GetVTKOutput()->GetCellType(j),ptIds); + } + ptIds->Delete(); + } + + + //copy array values + vtkDataArray* da; + if((da = aScalarMapper->GetVTKOutput()->GetPointData()->GetArray("VISU_FIELD"))){ + output->GetPointData()->AddArray(da); + vtkDataArray* vc = aScalarMapper->GetVTKOutput()->GetPointData()->GetVectors(); + if(vc) + output->GetPointData()->SetVectors(vc); + } + if((da = aScalarMapper->GetVTKOutput()->GetCellData()->GetArray("VISU_FIELD"))){ + if(MYDEBUG){ + MESSAGE("aScalarMapper NumberOfComponents="<GetNumberOfComponents()); + MESSAGE("aScalarMapper NumberOfTuples ="<GetNumberOfTuples()); + } + + newArray->SetNumberOfComponents(da->GetNumberOfComponents()); + newArray->SetNumberOfTuples(aObjIds.size()); + newArray->SetName("VISU_FIELD"); + + TVec::const_iterator aIdsIter = aObjIds.begin(); + for(int i=0; aIdsIter != aObjIds.end(); aIdsIter++){ + int anObjID = *aIdsIter; + int aVTKID = aScalarMapper->GetElemVTKID(anObjID); + newArray->SetTuple(i,da->GetTuple(aVTKID)); + i++; + } + output->GetCellData()->AddArray(newArray); + + // need in vectors array and scalars array + if(vtkDataArray* vc = aScalarMapper->GetVTKOutput()->GetCellData()->GetVectors()){ + output->GetCellData()->SetVectors(newArray); + } + else if(vtkDataArray* sc = aScalarMapper->GetVTKOutput()->GetCellData()->GetScalars()) + output->GetCellData()->SetScalars(newArray); + } + + if(MYDEBUG){ + MESSAGE("output:"); + output->Print(cout); + } + + + SetInput(output); + + output->Delete(); + newArray->Delete(); + } + else + { + if(myScalars != NULL) + { + VISU_ScalarMapPL* aScalarMap = dynamic_cast(this->GetScalars()); + VISU_PrsMergerPL* aPrsMerger = dynamic_cast(this->GetScalars()); + if(aScalarMap != NULL){ + SetInput(aScalarMap->GetInput()); + } + } + } +} diff --git a/src/PIPELINE/VISU_PrsMergerPL.hxx b/src/PIPELINE/VISU_PrsMergerPL.hxx new file mode 100644 index 00000000..572c0839 --- /dev/null +++ b/src/PIPELINE/VISU_PrsMergerPL.hxx @@ -0,0 +1,190 @@ +// 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_PrsMergerPL.hxx +// Author: Eugeny Nikolaev +// Module : VISU + +#ifndef VISU_PrsMergerPL_HeaderFile +#define VISU_PrsMergerPL_HeaderFile + +#include "VISUPipeline.hxx" + +#include "VISU_ScalarMapPL.hxx" + +class VISU_PIPELINE_EXPORT VISU_PrsMergerPL : public VISU_ScalarMapPL +{ + typedef VISU_ScalarMapPL TSupperClass; + +protected: + VISU_PrsMergerPL(); + VISU_PrsMergerPL(const VISU_PrsMergerPL&); + + virtual + ~VISU_PrsMergerPL(); + +public: + + typedef TVTKSmartPtr TPipeLine; + typedef std::vector TPipeLines; + + vtkTypeMacro(VISU_PrsMergerPL,TSupperClass); + + static + VISU_PrsMergerPL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + /*! + * Add geometry of presentation to myMeshGeometryList. + * \params theGeometry - visu pipeline with geometry. + * \params theUpdate - update pipeline if true. + * \retval TRUE - if geometry and scalars on the common mesh, esle FALSE. + */ + virtual + bool + SetGeometry(VISU_PipeLine* theGeometry,bool theUpdate=true); + + /*! + * Add geometry to back of myMeshGeometryList. + * \params theInput - visu pipeline with geometry. + * \params theUpdate - update pipeline if true. + * \retval index of added geometry. (must be >= 0) + * \retval -1, if geometry not added. + */ + virtual + int + AddBackGeometry(VISU_PipeLine* theGeometry,bool theUpdate=true); + + /*! + * Get geometry id of myMeshGeometryList. + * \retval index of geometry. (must be >= 0) + * \retval -1 - if geometry not exists. + */ + virtual + int + GetGeometryNumber(VISU_PipeLine* theGeometry); + + /*! + * Remove geometry with id = theId from myMeshGeometryList. + * the id in [0,...] + */ + virtual + void + RemoveGeometryById(int theId); + + /*! Removes all geometries. + */ + virtual + void + RemoveAllGeom(); + + /*! + * Gets geometry of presentation by id. + * \retval VISU_MeshPL - pointer + * the id in [0,...] + */ + virtual + VISU_PipeLine* + GetGeometry(int theId=0); + + /*! + * Gets number of geometrys + * \retval int - number + */ + virtual + int + GetNbGeometry(); + + /*! + * Sets scalar values and ids by VISU_ScalarMapPL object. + * \params theInput - visu pipeline with scalar values + * \params theUpdate - update pipeline if true. + * \retval TRUE - if scalars and geometry on the common mesh, esle FALSE. + */ + virtual + bool + SetScalars(VISU_PipeLine* theInput,bool theUpdate=false); + + /*! + * Gets input VISU_ScalarMapPL, which contain scalar values and ids. + */ + virtual + VISU_PipeLine* + GetScalars(); + + virtual + void + Init(); + + virtual + void + Build(); + + /*! + * Calculate presentation, by merging of Geometry and Scalar Values. + */ + virtual + void + Update(); + + /*! + * Set ranges of scalar values by input myScalars ranges. + */ + void SetInitialRange(); + +protected: + TPipeLines myMeshGeometryList; + + TPipeLine myScalars; + + vtkFloatingPointType* myScalarRanges; + +private: + + /*! + * Check if thePipeLine and "first element of list myMeshGeometryList" or + * "myScalars", has + * common DataPoints (simple check number of points). + * \retval TRUE - if has common points, esle FALSE. + */ + bool + checkGeometry(const VISU_PipeLine* thePipeLine); + + + /*! + * Check if thePipeLine and first element of list myMeshGeometryList, has + * common DataPoints (simple check number of points). + * \retval TRUE - if has common points, esle FALSE. + */ + bool + checkScalars(const VISU_PipeLine* thePipeLine); + + void + Execute(); + +}; + +#endif diff --git a/src/PIPELINE/VISU_ScalarBarActor.cxx b/src/PIPELINE/VISU_ScalarBarActor.cxx index 3a9ea673..058f3025 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.cxx +++ b/src/PIPELINE/VISU_ScalarBarActor.cxx @@ -531,7 +531,7 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, if(isLogTable && 0 < i && i < this->NumberOfLabels - 1){ // SALOME specific vtkFloatingPointType lval = log10(range[0]) + (vtkFloatingPointType)i/(this->NumberOfLabels-1) * (log10(range[1])-log10(range[0])); - val = pow(10,lval); + val = pow((double)10,(double)lval); }else{ val = range[0] + (vtkFloatingPointType)i/(this->NumberOfLabels-1) * (range[1]-range[0]); } diff --git a/src/PIPELINE/VISU_ScalarBarActor.hxx b/src/PIPELINE/VISU_ScalarBarActor.hxx index e9bebc1e..598f70ae 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.hxx +++ b/src/PIPELINE/VISU_ScalarBarActor.hxx @@ -27,6 +27,7 @@ #ifndef VISU_ScalarBarActor_HeaderFile #define VISU_ScalarBarActor_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_LookupTable.hxx" #include @@ -45,7 +46,7 @@ class vtkTextProperty; #define VTK_ORIENT_VERTICAL 1 #endif -class VISU_ScalarBarActor : public vtkActor2D +class VISU_PIPELINE_EXPORT VISU_ScalarBarActor : public vtkActor2D { public: vtkTypeRevisionMacro(VISU_ScalarBarActor,vtkActor2D); diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx index 6a13c868..17f75414 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.hxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.hxx @@ -27,6 +27,8 @@ #ifndef VISU_ScalarBarCtrl_HeaderFile #define VISU_ScalarBarCtrl_HeaderFile +#include "VISUPipeline.hxx" + #include #include "VTKViewer.h" @@ -35,7 +37,7 @@ class vtkRenderer; class vtkLookupTable; class vtkScalarBarActor; -class VISU_ScalarBarCtrl : public vtkObject +class VISU_PIPELINE_EXPORT VISU_ScalarBarCtrl : public vtkObject { public: vtkTypeMacro(VISU_ScalarBarCtrl, vtkObject); diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx index 16759ec6..60c3bf5b 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -84,7 +84,7 @@ void VISU_ScalarMapOnDeformedShapePL ::Init() { - if (GetScalars() == NULL) SetScalars(GetInput2()); + if (GetScalarsUnstructuredGrid() == NULL) SetScalars(GetInput2()); Superclass::Init(); @@ -134,8 +134,7 @@ VISU_ScalarMapOnDeformedShapePL { this->UpdateScalars(); - vtkFloatingPointType aRange[2]; - GetSourceRange(aRange); + vtkFloatingPointType* aRange = GetScalarRange(); vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]}; if(myBarTable->GetScale() == VTK_SCALE_LOG10) @@ -173,10 +172,7 @@ VISU_ScalarMapOnDeformedShapePL VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast(thePipeLine); if(aPipeLine){ SetScale(aPipeLine->GetScale()); - SetScalars(aPipeLine->GetScalars()); - vtkFloatingPointType aRange[2]; - aPipeLine->GetSourceRange(aRange); - SetScalarRange(aRange); + SetScalars(aPipeLine->GetScalarsUnstructuredGrid()); } Superclass::ShallowCopy(thePipeLine); } @@ -190,7 +186,7 @@ VISU_ScalarMapOnDeformedShapePL ::SetScalars(vtkDataSet *theScalars) { myScalars = theScalars; - vtkUnstructuredGrid* aScalars = GetScalars(); + vtkUnstructuredGrid* aScalars = GetScalarsUnstructuredGrid(); vtkCellData *aInCellData = GetInput()->GetCellData(); if(aScalars->GetPointData()->GetScalars()) @@ -215,7 +211,7 @@ VISU_ScalarMapOnDeformedShapePL */ vtkUnstructuredGrid* VISU_ScalarMapOnDeformedShapePL -::GetScalars() +::GetScalarsUnstructuredGrid() { return myScalars.GetPointer(); } @@ -240,8 +236,7 @@ vtkFloatingPointType VISU_ScalarMapOnDeformedShapePL ::GetScale() { - vtkFloatingPointType aScale=myDeformVectors->GetScaleFactor(); - return aScale; + return myScaleFactor; } /*! @@ -251,6 +246,7 @@ void VISU_ScalarMapOnDeformedShapePL ::SetMapScale(vtkFloatingPointType theMapScale) { + TSupperClass::SetMapScale(theMapScale); // enk::added myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale); Modified(); } diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx index 66553b30..6ac481af 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx @@ -27,7 +27,8 @@ #ifndef VISU_ScalarMapOnDeformedShapePL_HeaderFile #define VISU_ScalarMapOnDeformedShapePL_HeaderFile -#include "VISU_ScalarMapPL.hxx" +#include "VISUPipeline.hxx" +#include "VISU_PrsMergerPL.hxx" class vtkMergeFilter; class vtkWarpVector; @@ -35,8 +36,11 @@ class vtkUnstructuredGrid; class vtkCellDataToPointData; class vtkPointDataToCellData; -class VISU_ScalarMapOnDeformedShapePL : public VISU_ScalarMapPL +class VISU_PIPELINE_EXPORT VISU_ScalarMapOnDeformedShapePL : public VISU_PrsMergerPL { + + typedef VISU_PrsMergerPL TSupperClass; + protected: VISU_ScalarMapOnDeformedShapePL(); @@ -44,7 +48,7 @@ protected: VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&); public: - vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_ScalarMapPL); + vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_PrsMergerPL); static VISU_ScalarMapOnDeformedShapePL* New(); @@ -59,7 +63,7 @@ public: virtual void GetSourceRange(vtkFloatingPointType theRange[2]); virtual void SetScalars(vtkDataSet *theScalars); - virtual vtkUnstructuredGrid* GetScalars(); + virtual vtkUnstructuredGrid* GetScalarsUnstructuredGrid(); public: //! Redefined method for initialization of the pipeline. diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index de07ce2a..b1b328a1 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -28,6 +28,7 @@ #ifndef VISU_ScalrMapPL_HeaderFile #define VISU_ScalrMapPL_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_PipeLine.hxx" #include "VISU_ScalarBarActor.hxx" @@ -39,11 +40,10 @@ class VISU_FieldTransform; //============================================================================ -class VISU_ScalarMapPL : public VISU_PipeLine +class VISU_PIPELINE_EXPORT VISU_ScalarMapPL : public VISU_PipeLine { protected: VISU_ScalarMapPL(); - VISU_ScalarMapPL(const VISU_ScalarMapPL&); virtual ~VISU_ScalarMapPL(); diff --git a/src/PIPELINE/VISU_SphereWidget.hxx b/src/PIPELINE/VISU_SphereWidget.hxx index 0a9ac514..1248d273 100755 --- a/src/PIPELINE/VISU_SphereWidget.hxx +++ b/src/PIPELINE/VISU_SphereWidget.hxx @@ -20,6 +20,7 @@ #ifndef __VISU_SphereWidget_h #define __VISU_SphereWidget_h +#include "VISUPipeline.hxx" #include "VISU_ImplicitFunctionWidget.hxx" class VISU_UnScaledActor; @@ -36,7 +37,7 @@ class vtkSphere; class vtkImplicitSum; class vtkImplicitFunction; // -class VISU_SphereWidget : public VISU_ImplicitFunctionWidget +class VISU_PIPELINE_EXPORT VISU_SphereWidget : public VISU_ImplicitFunctionWidget { public: // Description: diff --git a/src/PIPELINE/VISU_StreamLinesPL.cxx b/src/PIPELINE/VISU_StreamLinesPL.cxx index b1f7471c..22d3f8b7 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.cxx +++ b/src/PIPELINE/VISU_StreamLinesPL.cxx @@ -30,7 +30,7 @@ #include "VISU_UsedPointsFilter.hxx" #include "VTKViewer_GeometryFilter.h" -#include +#include #include #include @@ -494,7 +494,7 @@ void VISU_StreamLinesPL ::Init() { - VISU_ScalarMapPL::Init(); + VISU_PrsMergerPL::Init(); vtkPointSet* aDataSet = myExtractor->GetOutput(); vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet); vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet); @@ -519,7 +519,7 @@ void VISU_StreamLinesPL ::Update() { - VISU_ScalarMapPL::Update(); + VISU_PrsMergerPL::Update(); } void diff --git a/src/PIPELINE/VISU_StreamLinesPL.hxx b/src/PIPELINE/VISU_StreamLinesPL.hxx index 7c020dac..bcee487f 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.hxx +++ b/src/PIPELINE/VISU_StreamLinesPL.hxx @@ -27,6 +27,7 @@ #ifndef VISU_StreamLinesPL_HeaderFile #define VISU_StreamLinesPL_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_DeformedShapePL.hxx" #include @@ -37,8 +38,7 @@ class vtkCellCenters; class VTKViewer_GeometryFilter; class VISU_UsedPointsFilter; -class VISU_StreamLinesPL : public VISU_DeformedShapePL -{ +class VISU_PIPELINE_EXPORT VISU_StreamLinesPL : public VISU_DeformedShapePL{ protected: VISU_StreamLinesPL(); VISU_StreamLinesPL(const VISU_StreamLinesPL&); diff --git a/src/PIPELINE/VISU_VectorsPL.hxx b/src/PIPELINE/VISU_VectorsPL.hxx index fd83f022..6b5add7c 100644 --- a/src/PIPELINE/VISU_VectorsPL.hxx +++ b/src/PIPELINE/VISU_VectorsPL.hxx @@ -27,6 +27,7 @@ #ifndef VISU_VectorsPL_HeaderFile #define VISU_VectorsPL_HeaderFile +#include "VISUPipeline.hxx" #include "VISU_DeformedShapePL.hxx" class VTKViewer_TransformFilter; @@ -39,8 +40,7 @@ class vtkLineSource; class vtkGlyph3D; -class VISU_VectorsPL : public VISU_DeformedShapePL -{ +class VISU_PIPELINE_EXPORT VISU_VectorsPL : public VISU_DeformedShapePL{ protected: VISU_VectorsPL(); VISU_VectorsPL(const VISU_VectorsPL&); diff --git a/src/PIPELINE/VISU_WidgetCtrl.hxx b/src/PIPELINE/VISU_WidgetCtrl.hxx index 856fbcc7..78c283d8 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.hxx +++ b/src/PIPELINE/VISU_WidgetCtrl.hxx @@ -29,6 +29,7 @@ #ifndef __VISU_WidgetCtrl_hxx #define __VISU_WidgetCtrl_hxx +#include "VISUPipeline.hxx" #include #include "VTKViewer.h" @@ -43,7 +44,7 @@ class VISU_PlanesWidget; class VISU_SphereWidget; class VISU_ImplicitFunctionWidget; -class VISU_WidgetCtrl : public vtkImplicitFunction +class VISU_PIPELINE_EXPORT VISU_WidgetCtrl : public vtkImplicitFunction { public: static VISU_WidgetCtrl *New(); diff --git a/src/VISUGUI/VISU_images.po b/src/VISUGUI/VISU_images.po index afee2ba5..15dc4652 100644 --- a/src/VISUGUI/VISU_images.po +++ b/src/VISUGUI/VISU_images.po @@ -54,7 +54,7 @@ msgid "ICON_ISO_SURFACES" msgstr "Visu_isosurfaces.png" msgid "ICON_CUT_PLANES" -msgstr "Visu_cutplane.png" +msgstr "Visu_cutplanes.png" msgid "ICON_CUT_LINES" msgstr "Visu_cutlines.png" @@ -65,6 +65,80 @@ msgstr "Visu_streamlines.png" msgid "ICON_PLOT2D" msgstr "Visu_plot2d.png" +# Tree icons for presentations + +msgid "ICON_TREE_RESULT" +msgstr "Visu_tree_result.png" + +msgid "ICON_TREE_TABLE" +msgstr "Visu_tree_table.png" + +msgid "ICON_TREE_CURVE" +msgstr "Visu_tree_curve.png" + +msgid "ICON_TREE_CONTAINER" +msgstr "Visu_tree_container.png" + +msgid "ICON_TREE_MESH" +msgstr "Visu_tree_mesh.png" + +msgid "ICON_TREE_SCALAR_MAP" +msgstr "Visu_tree_scalars.png" + +msgid "ICON_TREE_SCALAR_MAP_GROUPS" +msgstr "Visu_tree_scalars_gr.png" + +msgid "ICON_TREE_DEFORMED_SHAPE" +msgstr "Visu_tree_deformed.png" + +msgid "ICON_TREE_DEFORMED_SHAPE_GROUPS" +msgstr "Visu_tree_deformed_gr.png" + +msgid "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE" +msgstr "Visu_tree_scalarmapondeformedshape.png" + +msgid "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE_GROUPS" +msgstr "Visu_tree_scalarmapondeformedshape_gr.png" + +msgid "ICON_TREE_VECTORS" +msgstr "Visu_tree_vectors.png" + +msgid "ICON_TREE_VECTORS_GROUPS" +msgstr "Visu_tree_vectors_gr.png" + +msgid "ICON_TREE_ISO_SURFACES" +msgstr "Visu_tree_isosurfaces.png" + +msgid "ICON_TREE_ISO_SURFACES_GROUPS" +msgstr "Visu_tree_isosurfaces_gr.png" + +msgid "ICON_TREE_CUT_PLANES" +msgstr "Visu_tree_cutplanes.png" + +msgid "ICON_TREE_CUT_PLANES_GROUPS" +msgstr "Visu_tree_cutplanes_gr.png" + +msgid "ICON_TREE_CUT_LINES" +msgstr "Visu_tree_cutlines.png" + +msgid "ICON_TREE_CUT_LINES_GROUPS" +msgstr "Visu_tree_cutlines_gr.png" + +msgid "ICON_TREE_STREAM_LINES" +msgstr "Visu_tree_streamlines.png" + +msgid "ICON_TREE_STREAM_LINES_GROUPS" +msgstr "Visu_tree_streamlines_gr.png" + +msgid "ICON_TREE_PLOT_3D" +msgstr "Visu_tree_plot3d.png" + +msgid "ICON_TREE_PLOT_3D_GROUPS" +msgstr "Visu_tree_plot3d_gr.png" + +msgid "ICON_TREE_GAUSS_POINTS" +msgstr "Visu_tree_gauss_points.png" + # Representation menu msgid "ICON_POINTS" @@ -132,3 +206,9 @@ msgstr "Visu_recording_stop.png" msgid "ICON_LOAD_TEXTURE" msgstr "Visu_load_texture.png" + +msgid "ICON_ADD" +msgstr "Visu_add.png" + +msgid "ICON_REMOVE" +msgstr "Visu_remove.png" diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index eebc49c8..de870423 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -52,6 +52,9 @@ msgstr "The object can't be built" msgid "ERR_CANT_CREATE_ACTOR" msgstr "Can't create actor for this presentation" +msgid "ERR_CANT_CREATE_ANIMATION" +msgstr "Can't create animation for these fields:\n number of time stamps or number of components is not the same!" + # Preferences for VISU module (VisuGUI.cxx) msgid "VISU_SCALAR_BAR" @@ -111,6 +114,12 @@ msgstr "Height:" msgid "VISU_PREF_SECOND_TAB" msgstr "Scalar range, Sweep, MED import, Shading" +msgid "PRS_ON_GROUPS" +msgstr "Build presentation on groups" + +msgid "NO_GROUPS" +msgstr "No groups in the mesh" + msgid "VISU_SCALAR_RANGE" msgstr "Scalar range" @@ -147,6 +156,24 @@ msgstr "Max:" msgid "VISU_SWEEPING_PREF" msgstr "Sweeping preferences" +msgid "VISU_LINEAR_SWEEP" +msgstr "Linear" + +msgid "VISU_U_SWEEP" +msgstr "Cosinusoidal" + +msgid "VISU_SWEEPING_MODES" +msgstr "Mode of the sweeping " + +msgid "VISU_IS2PI" +msgstr "Parameter varies:" + +msgid "PERIOD_2PI" +msgstr "From -PI to PI" + +msgid "PERIOD_PI" +msgstr "From 0 to PI" + msgid "VISU_TIME_STEP" msgstr "Time step(second)" @@ -156,6 +183,9 @@ msgstr "Number of cycles" msgid "VISU_NB_STEPS" msgstr "Number of steps" +msgid "VISU_CUTLINE_PREF" +msgstr "CutLine preferences" + msgid "VISU_PREF_MED_IMPORT" msgstr "MED files import" @@ -168,6 +198,9 @@ msgstr "Representation properties" msgid "VISU_USE_SHADING" msgstr "Use Shading" +msgid "VISU_DISP_ONLY" +msgstr "Display only on creation" + msgid "VISU_SHRINK" msgstr "Shrink" @@ -212,8 +245,17 @@ msgstr "Representation Toolbar" msgid "VisuGUI::MEN_SHOW_ANIMATION" msgstr "Show..." -msgid "VisuGUI::MEN_ANIMATION" -msgstr "Animation..." +msgid "VisuGUI::MEN_PARALLEL_ANIMATION" +msgstr "Parallel Animation..." + +msgid "VisuGUI::MEN_SUCCCESSIVE_ANIMATION" +msgstr "Successive Animation..." + +msgid "PARALLEL_ANIMATION" +msgstr "Parallel Animation" + +msgid "SUCCESSIVE_ANIMATION" +msgstr "Successive Animation" msgid "VisuGUI::MEN_CELL_COLOR" msgstr "Cell color" @@ -460,6 +502,9 @@ msgstr "minimal and maximal" msgid "VisuGUI_CutLinesDlg::LBL_INVERT_CURVES" msgstr "Invert all curves" +msgid "VisuGUI_CutLinesDlg::LBL_ABSOLUTE_LENGTH" +msgstr "Use absolute length" + msgid "VisuGUI_CutLinesDlg::LBL_GENERATE_CURVES" msgstr "Generate Curves" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 8266ce94..46252b0d 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -107,7 +107,7 @@ #include "VisuGUI_BuildProgressDlg.h" #include "VisuGUI_TransparencyDlg.h" -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" #include "VisuGUI_ScalarBarDlg.h" #include "VISU_DeformedShape_i.hh" @@ -152,6 +152,10 @@ static int MYDEBUG = 1; static int MYDEBUG = 0; #endif +#ifdef WIN32 +#define usleep(A) _sleep(A/1000) +#endif + ////////////////////////////////////////////////// // Class: VisuGUI ////////////////////////////////////////////////// @@ -545,7 +549,7 @@ void VisuGUI:: OnCreateScalarMap() { - CreatePrs3d(this); + CreatePrs3d(this); } @@ -751,7 +755,7 @@ OnEditScalarMap() { Handle(SALOME_InteractiveObject) anIO; if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) - EditPrs3d(this, anIO, aPrs3d); + EditPrs3d(this, anIO, aPrs3d); } void @@ -1118,7 +1122,7 @@ OnDeleteObjects() int i = 0, nbSelected = aList.Extent(); if (nbSelected < 1) return; - const char* entries [nbSelected]; + const char** entries = new const char*[nbSelected]; Handle(SALOME_InteractiveObject) anIO; for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) { anIO = it.Value(); @@ -1176,6 +1180,8 @@ OnDeleteObjects() } } + delete [] entries; + // Finish transaction aStudyBuilder->CommitCommand(); mgr->clearSelected(); @@ -1608,12 +1614,24 @@ OnSweep() 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(i)/aSteps; + float aPercents; + if( aMode == 1 ){ //if selected Periodic mode of sweeping + float aT = ( is2Pi == 1 ? -PI + 2. * PI * float(i)/aSteps : PI * float(i)/aSteps ); + //This is necessary in order for animation to retrun to the initial picture + aPercents = (1.-cos( aT ))/2.; + } + else //if selected Linear mode of sweeping + aPercents = float(i)/aSteps; aPrsObject->SetMapScale(aPercents); aPrsObject->UpdateActor(aActor); vw->getRenderWindow()->Render(); @@ -1630,40 +1648,46 @@ OnSweep() void VisuGUI:: -OnTimeAnimation() +OnTimeAnimation(int theMode) { if (!VISU::GetActiveViewWindow(this)) return; _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); VisuGUI_TimeAnimationDlg* aAnimationDlg = - new VisuGUI_TimeAnimationDlg (this, aCStudy); + new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode); LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; aSelectionMgr->selectedObjects(aListIO); - bool isDefined = false; - long aNbTimes = 0; SALOME_ListIteratorOfListIO It (aListIO); for (; It.More(); It.Next()) { _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry()); - if (!aSObject) continue; - if (getValue(aSObject, "myComment") == QString("FIELD")) { - long aNumber = getValue(aSObject, "myNbTimeStamps").toLong(); - if (aNumber > 1) { - if (!isDefined) { - aNbTimes = aNumber; - aAnimationDlg->addField(aSObject); - isDefined = true; - } else if (aNbTimes == aNumber) { - aAnimationDlg->addField(aSObject); - } - } + if ( !aAnimationDlg->addField(aSObject) ) { + SUIT_MessageBox::warn1(GetDesktop(this), + tr("WRN_VISU"), + tr("ERR_CANT_CREATE_ANIMATION"), + tr("BUT_OK")); + delete aAnimationDlg; + return; } } - if (isDefined) aAnimationDlg->show(); - else delete aAnimationDlg; + aAnimationDlg->show(); +} + +void +VisuGUI:: +OnParallelTimeAnimation() +{ + OnTimeAnimation(0); +} + +void +VisuGUI:: +OnSucccessiveTimeAnimation() +{ + OnTimeAnimation(1); } //************************************************************************ @@ -1690,9 +1714,9 @@ OnShowAnimation() VISU::Storable::TRestoringMap aMap; _PTR(GenericAttribute) anAttr; - if (!aSObj->FindAttribute(anAttr, "AttributeComment")) return; + if (!aSObj->FindAttribute(anAttr, "AttributeString")) return; - _PTR(AttributeComment) aComment (anAttr); + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::StrToMap(strIn, aMap); @@ -1731,10 +1755,10 @@ OnCopyPresentation() aSameMesh->SameAs(aMeshPrs); } break; - case VISU::TSCALARMAP: + case VISU::TPRSMERGER: { - VISU::ScalarMap_i* aScalarPrs = dynamic_cast(aPrsObject); - VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true); + VISU::PrsMerger_i* aScalarPrs = dynamic_cast(aPrsObject); + VISU::PrsMerger_i* aSameScalar = new VISU::PrsMerger_i(aScalarPrs->GetResult(),true); aSameScalar->SameAs(aScalarPrs); } break; @@ -2256,9 +2280,14 @@ createActions() this, SLOT(OnSelectionInfo())); aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION")); - createAction( VISU_ANIMATION, tr("MEN_ANIMATION"), QIconSet(aPixmap), - tr("MEN_ANIMATION"), "", 0, aParent, false, - this, SLOT(OnTimeAnimation())); + createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIconSet(aPixmap), + tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false, + this, SLOT(OnParallelTimeAnimation())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION")); + createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIconSet(aPixmap), + tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false, + this, SLOT(OnSucccessiveTimeAnimation())); aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL")); createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIconSet(aPixmap), @@ -2443,7 +2472,8 @@ createPopupMenus() mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 ); mgr->insert( action( VISU_SWEEP ), -1, -1, -1 ); - mgr->insert( action( VISU_ANIMATION ), -1, -1, -1 ); + mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 ); + mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 ); mgr->insert( separator(), -1, -1, -1 ); @@ -2461,7 +2491,7 @@ createPopupMenus() // Rules - QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " + QString aPrsAll ("'VISU::TPRSMERGER' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'"); // VISU root commands @@ -2524,13 +2554,13 @@ createPopupMenus() // 3D presentations commands QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}"; - QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}"; - QString aSurfFrameType = " and $type in {'VISU::TMESH'}"; - QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " + QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TPRSMERGER' 'VISU::TDEFORMEDSHAPE'}"; + QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TPRSMERGER''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; + QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TPRSMERGER' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; - QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' " + QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TPRSMERGER' 'VISU::TISOSURFACE' " "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; - QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " + QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TPRSMERGER' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }"; aRule = "selcount=1"; @@ -2584,7 +2614,7 @@ createPopupMenus() mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true ); mgr->setRule( action( VISU_EDIT_SCALARMAP ), - "selcount=1 and type='VISU::TSCALARMAP'", true ); + "selcount=1 and type='VISU::TPRSMERGER'", true ); mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ), "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true ); mgr->setRule( action( VISU_EDIT_SCALARMAPONDEFORMEDSHAPE ), @@ -2616,11 +2646,19 @@ createPopupMenus() aRule += " and $type in {'VISU::TFIELD'}"; aRule += " and nbTimeStamps>1"; aRule += " and activeView in {'VTKViewer' 'VVTK'}"; - mgr->setRule( action( VISU_ANIMATION ), aRule, true ); + mgr->setRule( action( VISU_PARALLELANIMATION ), aRule, true ); + + aRule = "client='ObjectBrowser' and selcount>0"; + aRule += " and $type in {'VISU::TFIELD'}"; + aRule += " and nbTimeStamps>0"; + aRule += " and activeView in {'VTKViewer' 'VVTK'}"; + mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule, true ); aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}"; mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true ); mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true ); + mgr->setRule( action( VISU_EDIT_PLOT3D ), + "selcount=1 and type='VISU::TPLOT3D'", true ); //aRule = "client='ObjectBrowser' and type='MEDFIELD'"; //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true ); @@ -2655,8 +2693,8 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject); if (CORBA::is_nil(aCORBAObject)) { _PTR(GenericAttribute) anAttr; - if (aSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aSObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::TRestoringMap pMap; @@ -2695,8 +2733,8 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q if ( !aSObject ) continue; _PTR(GenericAttribute) anAttr; - if (aSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aSObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::TRestoringMap pMap; @@ -2880,6 +2918,20 @@ extern "C" { void VisuGUI::createPreferences() { + // TAB: "MED import" + int importTab = addPreference( tr( "MED import" ) ); + + // group: "MED files import" + int importGr = addPreference( tr( "MED files import" ), importTab ); + setPreferenceProperty( importGr, "columns", 1 ); + addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" ); + addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" ); + addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" ); + addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" ); + addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" ); + addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" ); + addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" ); + // TAB: "Scalar Bar" int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) ); @@ -3021,11 +3073,34 @@ void VisuGUI::createPreferences() int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab ); addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" ); - int srangeTab = addPreference( tr( "Sweep, MED import" ) ); + // TAB: "CutLines" + int cutLineTab = addPreference( tr( "CutLines" ) ); + // group: "CutLines preferences" + int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab ); + setPreferenceProperty( cutLineGr, "columns", 1 ); + addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" ); + addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" ); + addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" ); + 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", 1 ); + + 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_U_SWEEP" ) ); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( modeSw, "strings", sweep_modes ); + setPreferenceProperty( modeSw, "indexes", indices ); int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); @@ -3033,22 +3108,33 @@ void VisuGUI::createPreferences() 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 ); + setPreferenceProperty( nbsteps, "max", 200 ); - // group: "MED files import" - int importGr = addPreference( tr( "MED files import" ), srangeTab ); - setPreferenceProperty( importGr, "columns", 1 ); - addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" ); - addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" ); - addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" ); - addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" ); - addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" ); - addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" ); - addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" ); + // group: "Animation preferences" + int animationGr = addPreference( tr( "Animation preferences" ), srangeTab ); + setPreferenceProperty( animationGr, "columns", 1 ); + + 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" ); + + setPreferenceProperty( speed, "min", 1 ); + setPreferenceProperty( speed, "max", 99 ); // TAB: Representation ; group: "Representation properties" int representationTab = addPreference( tr( "Representation" ) ); @@ -3069,14 +3155,14 @@ void VisuGUI::createPreferences() mesh_indices.append( 2 ); QStringList modes1 = mesh_modes; - modes1.remove( "Surfaceframe" ); + modes1.remove( "Insideframe" ); QValueList indices1 = mesh_indices; - indices1.remove( 4 ); + indices1.remove( 3 ); QStringList modes2 = modes1; - modes2.remove( "Insideframe" ); + modes2.remove( "Surfaceframe" ); QValueList indices2 = indices1; - indices2.remove( 3 ); + indices2.remove( 4 ); QStringList modes3 = modes2; modes3.remove( "Surface" ); @@ -3090,8 +3176,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", modes1 ); - setPreferenceProperty( scalar_map_represent, "indexes", indices1 ); + setPreferenceProperty( scalar_map_represent, "strings", mesh_modes ); + setPreferenceProperty( scalar_map_represent, "indexes", mesh_indices ); 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" ); @@ -3110,8 +3196,8 @@ void VisuGUI::createPreferences() addPreference( "", representGr, LightApp_Preferences::Space ); int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" ); - setPreferenceProperty( deformed_shape_represent, "strings", modes1 ); - setPreferenceProperty( deformed_shape_represent, "indexes", indices1 ); + setPreferenceProperty( deformed_shape_represent, "strings", mesh_modes ); + setPreferenceProperty( deformed_shape_represent, "indexes", mesh_indices ); 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" ); @@ -3130,12 +3216,16 @@ void VisuGUI::createPreferences() addPreference( "", representGr, LightApp_Preferences::Space ); int scalar_def_represent = addPreference( tr( "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" ); - setPreferenceProperty( scalar_def_represent, "strings", modes2 ); - setPreferenceProperty( scalar_def_represent, "indexes", indices2 ); + setPreferenceProperty( scalar_def_represent, "strings", modes1 ); + setPreferenceProperty( scalar_def_represent, "indexes", indices1 ); addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" ); addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + addPreference( tr( "VISU_DISP_ONLY" ), representGr, + LightApp_Preferences::Bool, "VISU", "display_only" ); } void VisuGUI::preferencesChanged( const QString& a, const QString& b) @@ -3207,12 +3297,6 @@ VisuGUI return getApp()->getViewManager(theType,theIsCreate); } -TViewToPrs3d -VisuGUI -::getScalarBarsMap() -{ - return myScalarBarsMap; -} LightApp_Displayer* VisuGUI::displayer() { if( !myDisplayer ) diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 93c912eb..bb480782 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -72,12 +72,13 @@ public: getViewManager(const QString& theType, const bool theIsCreate); - VISU::TViewToPrs3d getScalarBarsMap(); VISU::TViewToPrs3d myScalarBarsMap; + VISU::TViewToPrs3d getScalarBarsMap() { return myScalarBarsMap; } public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); + virtual void OnEraseAll(); protected slots: void OnImportFromFile(); @@ -111,7 +112,7 @@ protected slots: virtual void OnDisplayPrs(); virtual void OnDisplayOnlyPrs(); virtual void OnErasePrs(); - virtual void OnEraseAll(); + // virtual void OnEraseAll(); void OnMakeSurfaceframe(); void OnMakeInsideframe(); @@ -145,7 +146,8 @@ protected slots: void OnRename(); void OnClippingPlanes(); void OnSweep(); - void OnTimeAnimation(); + void OnParallelTimeAnimation(); + void OnSucccessiveTimeAnimation(); void OnShowAnimation(); void OnCopyPresentation(); @@ -159,6 +161,8 @@ protected slots: protected: virtual LightApp_Selection* createSelection() const; + void OnTimeAnimation(int theMode); + private: void createActions(); void createMenus(); diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 0eaa8676..4f78df4b 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -96,7 +96,8 @@ #define VISU_CREATE_TABLE 4063 #define VISU_SWEEP 4064 #define VISU_SELECTION_INFO 4065 -#define VISU_ANIMATION 4066 +#define VISU_PARALLELANIMATION 4066 +#define VISU_SUCCCESSIVEANIMATION 4067 #define VISU_ERASE_ALL 4070 #define VISU_GLOBAL_SELECTION 4071 diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx index c1c9988d..e1dace81 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -268,9 +268,15 @@ void VisuGUI_BuildProgressDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 87195d31..cef3b80d 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -348,16 +348,17 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, VISU::RangeStepAndValidator(SpinBoxRot1, -180.0, 180.0, 1, 3); VISU::RangeStepAndValidator(SpinBoxRot2, -180.0, 180.0, 1, 3); - ComboBoxOrientation->insertItem(tr("PARALLEL_XOY_COMBO_ITEM")); - ComboBoxOrientation->insertItem(tr("PARALLEL_YOZ_COMBO_ITEM")); - ComboBoxOrientation->insertItem(tr("PARALLEL_ZOX_COMBO_ITEM")); - SpinBoxDistance->setValue(0.5); myPrs3d = 0; myIsSelectPlane = false; onSelectionChanged(); + ComboBoxOrientation->insertItem(tr("PARALLEL_XOY_COMBO_ITEM")); + ComboBoxOrientation->insertItem(tr("PARALLEL_YOZ_COMBO_ITEM")); + ComboBoxOrientation->insertItem(tr("PARALLEL_ZOX_COMBO_ITEM")); + + // signals and slots connections : connect(ComboBoxPlanes , SIGNAL(activated(int)) , this, SLOT(onSelectPlane(int))); connect(buttonNew , SIGNAL(clicked()) , this, SLOT(ClickOnNew())); @@ -391,6 +392,7 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, VisuGUI_ClippingDlg::~VisuGUI_ClippingDlg() { // no need to delete child widgets, Qt does it all for us + SetPrs3d(NULL); std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); VISU::RenderViewWindow(VISU::GetActiveViewWindow(myVisuGUI)); } @@ -607,7 +609,9 @@ void VisuGUI_ClippingDlg::onSelectionChanged() PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if (!aServant.in()) return; - myPrs3d = dynamic_cast(aServant.in()); + VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); + SetPrs3d(aPrs3d); + if (myPrs3d) { std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); myPlanes.clear(); @@ -684,8 +688,11 @@ void VisuGUI_ClippingDlg::onSelectPlane(int theIndex) //================================================================================= void VisuGUI_ClippingDlg::ClickOnNew() { - if(!AutoApplyCheckBox->isChecked()) - ClickOnApply(); + Handle(SALOME_InteractiveObject) anIO; + CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO); + if (CORBA::is_nil(anObject)) return; + + SetCurrentPlaneParam(); if (!myPrs3d) return; @@ -797,6 +804,29 @@ void VisuGUI_ClippingDlg::Sinchronize() ButtonGroupIJKAxis ->setEnabled(anIsControlsEnable); SpinBoxIJKIndex ->setEnabled(anIsControlsEnable); CheckBoxIJKPlaneReverse->setEnabled(anIsControlsEnable); + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + if(myPrs3d) + if(myPrs3d->GetPL()->GetIDMapper()->IsStructured()){ + VISU::TIdTypeVector aVec = myPrs3d->GetPL()->GetIDMapper()->GetStructure(); + switch(aVec.size()){ + case 1: + ButtonGroupIJKAxis->find(0)->setEnabled(true); + ButtonGroupIJKAxis->find(1)->setEnabled(false); + ButtonGroupIJKAxis->find(2)->setEnabled(false); + break; + case 2: + ButtonGroupIJKAxis->find(0)->setEnabled(true); + ButtonGroupIJKAxis->find(1)->setEnabled(true); + ButtonGroupIJKAxis->find(2)->setEnabled(false); + break; + case 3: + ButtonGroupIJKAxis->find(0)->setEnabled(true); + ButtonGroupIJKAxis->find(1)->setEnabled(true); + ButtonGroupIJKAxis->find(2)->setEnabled(true); + break; + } + } + //ENK: 23.11.2006 } //================================================================================= @@ -1036,17 +1066,28 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() double maxDot = 0; const vector *curValues, *values = 0; VISU::Result_i* result = myPrs3d->GetResult(); - for (i = 0; i < 3; ++i) { + int aNbAxes = 3; + if(myPrs3d->GetPL()->GetIDMapper()->IsStructured() && + !myPrs3d->GetPL()->GetIDMapper()->myType) + aNbAxes = (myPrs3d->GetPL()->GetIDMapper()->GetStructure()).size(); + for (i = 0; i < aNbAxes; ++i) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i; curValues = result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir); if (curValues) { double dot = normal * dir; - if (Abs(dot) > Abs(maxDot)) { + //ENK: 23.11.2006 - PAL13176 + if(i==0){ + maxDot = dot; + gridDir = dir; + values = curValues; + gridAxId = i; + } else if (Abs(dot) >= Abs(maxDot)) { maxDot = dot; gridDir = dir; values = curValues; gridAxId = i; } + //ENK: 23.11.2006 } if (Abs (planeNormal[ maxAx ]) < Abs (planeNormal[ i ])) maxAx = i; @@ -1152,3 +1193,15 @@ void VisuGUI_ClippingDlg::keyPressEvent( QKeyEvent* e ) ClickOnHelp(); } } + +void VisuGUI_ClippingDlg::SetPrs3d(VISU::Prs3d_i* thePrs) +{ + if(thePrs != myPrs3d){ + if(myPrs3d) + myPrs3d->Destroy(); + if(thePrs) + thePrs->Register(); + myPrs3d = thePrs; + } else + return; +} diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index be9dcb20..4d8c8977 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -136,6 +136,9 @@ public: private: void keyPressEvent( QKeyEvent* e ); + + void SetPrs3d(VISU::Prs3d_i* thePrs); + private: diff --git a/src/VISUGUI/VisuGUI_CursorDlg.cxx b/src/VISUGUI/VisuGUI_CursorDlg.cxx index d309c740..45de30f6 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.cxx +++ b/src/VISUGUI/VisuGUI_CursorDlg.cxx @@ -26,6 +26,7 @@ // Module : VISU // $Header$ +#include using namespace std; #include "VisuGUI.h" @@ -135,9 +136,15 @@ void VisuGUI_CursorDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index d189683f..5a1b4e66 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -62,9 +62,6 @@ using namespace std; -bool VisuGUI_CutLinesDlg::MYGenerateTable = true; -bool VisuGUI_CutLinesDlg::MYGenerateCurve = true; - VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), @@ -135,8 +132,12 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) myAllCurvesInvertedCheck->setChecked(false); aPlaneLayout->addWidget(myAllCurvesInvertedCheck); + myUseAbsoluteLengthCheck = new QCheckBox(tr("LBL_ABSOLUTE_LENGTH"), aPlanePane); + myUseAbsoluteLengthCheck->setChecked(false); + aPlaneLayout->addWidget(myUseAbsoluteLengthCheck); + myCreateTable = new QCheckBox (tr("LBL_GENERATE_TABLE"), aPlanePane); - myCreateTable->setChecked(MYGenerateTable); + myCreateTable->setChecked(true); aPlaneLayout->addWidget( myCreateTable ); QHBox* aCheckPane = new QHBox(aPlanePane); @@ -144,8 +145,8 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) aCheckPane->setStretchFactor(aLbl, 0); myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane); aCheckPane->setStretchFactor(aCheckPane, 0); - myCurvesCheck->setChecked(MYGenerateCurve); - myCurvesCheck->setEnabled(MYGenerateTable); + myCurvesCheck->setChecked(true); + myCurvesCheck->setEnabled(true); QLabel* aLbl2 = new QLabel(" ", aCheckPane); aCheckPane->setStretchFactor(aLbl2, 1); aPlaneLayout->addWidget( aCheckPane ); @@ -289,6 +290,12 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs) myPrs = thePrs; myScalarPane->initFromPrsObject(thePrs); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + myPreviewCheck->setChecked( aResourceMgr->booleanValue("VISU", "show_preview", false) ); + myCreateTable->setChecked( aResourceMgr->booleanValue("VISU", "generate_data_table", true) ); + myCurvesCheck->setChecked( aResourceMgr->booleanValue("VISU", "generate_curves", true) ); + myCurvesCheck->setEnabled( aResourceMgr->booleanValue("VISU", "generate_curves", true) ); + myRotXSpn->setValue(thePrs->GetRotateX()*180./PI); myRotYSpn->setValue(thePrs->GetRotateY()*180./PI); myPosSpn->setValue(thePrs->GetDisplacement()); @@ -303,8 +310,8 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs) hasInit = true; myCutLines = new VISU::CutLines_i(thePrs->GetResult(),false); myCutLines->SameAs(thePrs); - myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted()); - if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true); + myAllCurvesInvertedCheck->setChecked(myCutLines->IsAllCurvesInverted()); + myUseAbsoluteLengthCheck->setChecked(myCutLines->IsUseAbsoluteLength()); myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) ); myCBSetDef->setChecked(thePrs->IsDefault()); DrawTable(); @@ -342,6 +349,7 @@ int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs) } if (myAllCurvesInvertedCheck->isChecked()) thePrs->SetAllCurvesInverted(true); + thePrs->SetUseAbsoluteLength(myUseAbsoluteLengthCheck->isChecked()); return 1; } @@ -751,93 +759,9 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) void VisuGUI_CutLinesDlg::accept() { - //if ( !VisuGUI::CheckActiveStudyLock() ) { - // reject(); - // return; - //} - MYGenerateTable = myCreateTable->isChecked(); - MYGenerateCurve = myCurvesCheck->isChecked(); - // if (myScalarPane->check()) { - /*jfa tmp:((QWidget*)sender())->setDisabled(true); - storeToPrsObject(myPrs); - if (myIsCreation) { - if (isGenerateTable()) { - visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry()); - if (isGenerateCurves()) { - SALOMEDSClient_Study* aStudy = study()->studyDS(); - SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry()); - if( aSObject ) { - SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject ); - SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder(); - for ( ;aIter->More(); aIter->Next()) { - SALOMEDSClient_SObject* aTblObj = aIter->Value(); - if ( aTblObj ) { - SALOMEDSClient_GenericAttribute* anAttr; - if (aTblObj->FindAttribute(anAttr, "AttributeName")) { - visuGUI->CreatePlot(aTblObj); - } - } - } - } - } - } - if (GET_VTK_VIEWWINDOW(myMgr)) { - try { - visuGUI->CreateActor(myPrs); - } catch (...) { - reject(); - return; - } - GET_VTK_VIEWWINDOW(myMgr)->onFitAll(); - } - } else { - visuGUI->RecreateActor(myPrs); - if (VTKViewer_ViewWindow* vf = GET_VTK_VIEWWINDOW(myMgr)) { - if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) { - vf->getRenderer()->ResetCameraClippingRange(); - vf->Repaint(); - } - } - // Remove old Table - SALOMEDSClient_Study* aStudy = study()->studyDS(); - SALOMEDSClient_SObject* aSObject = aStudy->FindObjectID(myPrs->GetEntry()); - if( aSObject ) { - SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject ); - SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder(); - for ( ;aIter->More(); aIter->Next()) { - SALOMEDSClient_SObject* aTblObj = aIter->Value(); - if ( aTblObj ) { - SALOMEDSClient_GenericAttribute* anAttr; - if (aTblObj->FindAttribute(anAttr, "AttributeName")) { - aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child - break; - } - } - } - if (isGenerateTable()) { - visuGUI->GetVisuGen()->CreateTable(aSObject->GetID().c_str()); - if (isGenerateCurves()) { - SALOMEDSClient_Study* aStudy = study()->studyDS(); - SALOMEDSClient_ChildIterator* aIter = aStudy->NewChildIterator( aSObject ); - SALOMEDSClient_StudyBuilder* aBuilder = aStudy->NewBuilder(); - for ( ;aIter->More(); aIter->Next()) { - SALOMEDSClient_SObject* aTblObj = aIter->Value(); - if ( aTblObj ) { - SALOMEDSClient_GenericAttribute* anAttr; - if (aTblObj->FindAttribute(anAttr, "AttributeName")) { - visuGUI->CreatePlot(aTblObj); - } - } - } - } - } - } - } - VisuGUI::application()->objectBrowser()->updateTree();*/ myScalarPane->deletePreview(); deletePlanes(); QDialog::accept(); - // } } void VisuGUI_CutLinesDlg::reject() @@ -926,9 +850,15 @@ void VisuGUI_CutLinesDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.h b/src/VISUGUI/VisuGUI_CutLinesDlg.h index 8b0e1da4..85139515 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.h +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.h @@ -110,6 +110,7 @@ private: SALOME_Actor* myPreviewActorGlyphs; QCheckBox* myPreviewCheck; QCheckBox* myAllCurvesInvertedCheck; + QCheckBox* myUseAbsoluteLengthCheck; VISU::CutLines_i* myPrs; diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index 2666f0cf..dab4e24b 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -564,9 +564,15 @@ void VisuGUI_CutPlanesDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index 2a092922..5bbe4c89 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -169,9 +169,15 @@ void VisuGUI_DeformedShapeDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx index 52defc0a..9850d1f4 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx @@ -456,9 +456,15 @@ void VisuGUI_EditContainerDlg::onHelp() if (app) app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_Factory.cxx b/src/VISUGUI/VisuGUI_Factory.cxx index c7fe8352..5ef7af88 100644 --- a/src/VISUGUI/VisuGUI_Factory.cxx +++ b/src/VISUGUI/VisuGUI_Factory.cxx @@ -30,7 +30,18 @@ #include "CAM_Module.h" +#ifdef WNT +#ifdef VISU_VISUGUI_EXPORTS +#define VISU_VISUGUI_EXPORT __declspec(dllexport) +#else +#define VISU_VISUGUI_EXPORT __declspec(dllimport) +#endif +#else +#define VISU_VISUGUI_EXPORT +#endif + extern "C" { +VISU_VISUGUI_EXPORT CAM_Module* createModule() { diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 2c0e864d..8531c225 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -744,9 +744,15 @@ void VisuGUI_GaussPointsDlg::onHelp() if (app) app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx index 909c730d..7c4d3e8d 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx @@ -239,9 +239,15 @@ void VisuGUI_IsoSurfacesDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 3cab58e2..06beae6b 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -1315,8 +1315,8 @@ namespace Storable::DataToStream(aStream,"mySubId",theSelection.mySubId); _PTR(GenericAttribute) anAttr; - anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeComment"); - _PTR(AttributeComment) aComment(anAttr); + anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeString"); + _PTR(AttributeString) aComment(anAttr); aComment->SetValue(aStream.str()); } @@ -1346,8 +1346,8 @@ namespace // To update selection _PTR(GenericAttribute) anAttr; - if(aChildSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); + if(aChildSObject->FindAttribute(anAttr,"AttributeString")){ + _PTR(AttributeString) aComment(anAttr); QString aStream(aComment->Value().c_str()); Storable::TRestoringMap aMap; @@ -1419,8 +1419,8 @@ namespace Handle(SALOME_InteractiveObject) anIO = aListIter.Value(); _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); _PTR(GenericAttribute) anAttr; - if(aSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); + if(aSObject->FindAttribute(anAttr,"AttributeString")){ + _PTR(AttributeString) aComment(anAttr); std::string aCommentValue(aComment->Value()); if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){ aComment->SetValue(aValue.c_str()); @@ -1474,8 +1474,8 @@ namespace _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); _PTR(GenericAttribute) anAttr; - if(theSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); + if(theSObject->FindAttribute(anAttr,"AttributeString")){ + _PTR(AttributeString) aComment(anAttr); QString aStream(aComment->Value().c_str()); Storable::TRestoringMap aMap; Storable::StrToMap(aStream,aMap); @@ -1521,8 +1521,8 @@ OnRestoreConfiguration() _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); myConfigSObject = aSObject; _PTR(GenericAttribute) anAttr; - if(aSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); + if(aSObject->FindAttribute(anAttr,"AttributeString")){ + _PTR(AttributeString) aComment(anAttr); QString aStream(aComment->Value().c_str()); Storable::TRestoringMap aMap; Storable::StrToMap(aStream,aMap); diff --git a/src/VISUGUI/VisuGUI_NameDlg.cxx b/src/VISUGUI/VisuGUI_NameDlg.cxx index f0bf79f7..60b252af 100644 --- a/src/VISUGUI/VisuGUI_NameDlg.cxx +++ b/src/VISUGUI/VisuGUI_NameDlg.cxx @@ -151,9 +151,15 @@ void VisuGUI_NameDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.cxx b/src/VISUGUI/VisuGUI_OffsetDlg.cxx index 7e535ac6..33ba4ba2 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.cxx +++ b/src/VISUGUI/VisuGUI_OffsetDlg.cxx @@ -245,9 +245,15 @@ void VisuGUI_OffsetDlg::onHelp() if (app) app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index 79564c95..abbdd3f6 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -631,9 +631,15 @@ void VisuGUI_Plot3DDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_PopupTools.cxx b/src/VISUGUI/VisuGUI_PopupTools.cxx index 45d034d9..a434301a 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.cxx +++ b/src/VISUGUI/VisuGUI_PopupTools.cxx @@ -93,7 +93,7 @@ QString VisuGUI_Selection::type( const int ind ) const ENUM2STRING( aResStr, VISU::TCURVE ); ENUM2STRING( aResStr, VISU::TCONTAINER ); ENUM2STRING( aResStr, VISU::TMESH ); - ENUM2STRING( aResStr, VISU::TSCALARMAP ); + ENUM2STRING( aResStr, VISU::TPRSMERGER ); ENUM2STRING( aResStr, VISU::TISOSURFACE ); ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE ); ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE ); diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 62b46d51..7557683f 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -32,6 +32,8 @@ #include "VisuGUI_ViewTools.h" #include "VisuGUI_DialogRunner.h" +#include + #include namespace VISU @@ -178,11 +180,18 @@ namespace VISU if (aPrs3d) { SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0); + if(aResourceMgr->booleanValue("VISU","display_only",false)){ + theModule->OnEraseAll(); + } + if (!aValue) { if (TDlg* aDlg = new TDlg(theModule)) { // dialog box in creation mode aDlg->initFromPrsObject(aPrs3d); if (runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) { + if(aResourceMgr->booleanValue("VISU","display_only",false)){ + if(SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule, false)) aPlot2d->EraseAll(); + } // Optionally, create table and curves for cut lines QApplication::setOverrideCursor(Qt::waitCursor); CreateCurves( theModule, diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 45e47f88..b9d6724f 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -38,9 +38,8 @@ #include "VISUConfig.hh" #include "VISU_Convertor.hxx" -#include "VISU_ScalarMapPL.hxx" -#include "VISU_ScalarMap_i.hh" #include "VISU_ScalarMapAct.h" +#include "VISU_Result_i.hh" #include "LightApp_Application.h" @@ -55,6 +54,7 @@ #include +using namespace VISU; using namespace std; @@ -81,6 +81,50 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref): setSpacing(6); //setMargin(11); + // Presentation type ================================================ + myMainGroupBox = new QGroupBox(tr(""), this, "myMainGroupBox"); + myMainGroupBox->setColumnLayout(0, Qt::Vertical ); + myMainGroupBox->layout()->setSpacing( 0 ); + myMainGroupBox->layout()->setMargin( 0 ); + QGridLayout* aMainGroupBoxLayout = new QGridLayout( myMainGroupBox->layout() ); + myMainGroupBox->setAlignment( Qt::AlignTop ); + aMainGroupBoxLayout->setSpacing( 6 ); + aMainGroupBoxLayout->setMargin( 11 ); + + myOnGroupsCB = new QCheckBox (tr("PRS_ON_GROUPS"), myMainGroupBox); + myOnGroupsCB->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + // Lists of groups and add/remove buttons + QPixmap addImage ( aResourceMgr->loadPixmap("VISU", tr("ICON_ADD"))); + QPixmap removeImage ( aResourceMgr->loadPixmap("VISU", tr("ICON_REMOVE"))); + + myAllGroups = new VisuGUI_ListBox(myMainGroupBox, "myAllGroups"); + myAllGroups->setSelectionMode(QListBox::Extended); + + myAddButton = new QToolButton(myMainGroupBox); + myAddButton->setPixmap( addImage ); + + myRemoveButton = new QToolButton(myMainGroupBox); + myRemoveButton->setPixmap( removeImage ); + + mySelectedGroups = new VisuGUI_ListBox(myMainGroupBox, "mySelectedGroups"); + mySelectedGroups->setSelectionMode(QListBox::Extended); + + // Layouting + QVBoxLayout* buttonsLayout = new QVBoxLayout(); + buttonsLayout->addWidget(myAddButton); + buttonsLayout->addSpacing(6); + buttonsLayout->addWidget(myRemoveButton); + buttonsLayout->addStretch(); + + aMainGroupBoxLayout->addMultiCellWidget( myOnGroupsCB, 0, 0, 0, 2); + aMainGroupBoxLayout->addWidget( myAllGroups, 1, 0 ); + aMainGroupBoxLayout->addLayout( buttonsLayout, 1, 1 ); + aMainGroupBoxLayout->addWidget( mySelectedGroups, 1, 2 ); + aMainGroupBoxLayout->setRowStretch(1, 10); + + mySelectedGroups->installEventFilter(this); + // Range ============================================================ RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup"); RangeGroup->setColumnLayout(0, Qt::Vertical ); @@ -259,6 +303,11 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref): CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 ); // signals and slots connections =========================================== + connect( myOnGroupsCB, SIGNAL( toggled( bool ) ), this, SLOT( onTypeChanged() ) ); + connect( myAllGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) ); + connect( mySelectedGroups, SIGNAL( doubleClicked( QListBoxItem* ) ), this, SLOT( onListDoubleClicked( QListBoxItem* ) ) ); + connect( myAddButton, SIGNAL(clicked()), this, SLOT(onAdd())); + connect( myRemoveButton, SIGNAL(clicked()), this, SLOT(onRemove())); connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) ); connect( myModeCombo, SIGNAL( activated( int ) ), this, SLOT( changeScalarMode( int ) ) ); connect( OrientGroup, SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) ); @@ -271,6 +320,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref): connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() )); connect( HeightSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() )); connect( CBLog, SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() )); + onTypeChanged(); changeRange( 0 ); changeDefaults( 0 ); myIsStoreTextProp = false; @@ -546,9 +596,46 @@ void VisuGUI_ScalarBarPane::storeToResources() { /** * Initialise dialog box from presentation object */ -void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { +void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::PrsMerger_i* thePrs) { initFromResources(); myScalarMap = thePrs; + + // type of presentation and groups + VISU::Result_i* theResult = myScalarMap->GetResult(); + VISU_Convertor* aInput = theResult->GetInput(); + + const VISU::TMeshMap& aMeshMap = aInput->GetMeshMap(); + + VISU::TMeshMap::const_iterator aMeshIter = aMeshMap.find(thePrs->GetMeshName()); + if(aMeshIter!=aMeshMap.end()){ + const PMesh& aMesh = aMeshIter->second; + const TGroupMap& aGroupMap = aMesh->myGroupMap; + TGroupMap::const_iterator aGroupIter = aGroupMap.begin(); + for(;aGroupIter!=aGroupMap.end();aGroupIter++) + { + const string& aGroupName = aGroupIter->first; + if(thePrs->CheckGroup(&aGroupName[0])) + myAllGroups->insertItem( QString(aGroupName) ); + } + } + + if (myAllGroups->count() < 1) + { + myAllGroups->insertItem( tr("NO_GROUPS") ); + myMainGroupBox->setEnabled(false); + } + else + { + // Get names of the groups + string_array_var aGroupNames = thePrs->getGroupNames(); + for(int i=0; ilength(); i++) + mySelectedGroups->insertItem( QString(aGroupNames[i]) ); + + if (mySelectedGroups->count() > 0) + myOnGroupsCB->setChecked(true); + } + + // myTitle = thePrs->GetTitle(); setPosAndSize( thePrs->GetPosX(), thePrs->GetPosY(), @@ -563,7 +650,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { setLogarithmic(false); } vtkFloatingPointType aRange[2]; - thePrs->GetScalarMapPL()->GetSourceRange(aRange); + thePrs->GetPrsMergerPL()->GetSourceRange(aRange); Rmin = aRange[0]; Rmax = aRange[1]; setRange( thePrs->GetMin(), thePrs->GetMax(), /*0.0, 0.0,*/ thePrs->IsRangeFixed() ); @@ -651,9 +738,9 @@ void VisuGUI_ScalarBarPane::createScalarBar() if (myScalarMap == NULL) return; if (!check()) return; - myScalarMapPL = VISU_ScalarMapPL::New(); - if(myScalarMap->GetScalarMapPL()) - myScalarMapPL->ShallowCopy(myScalarMap->GetScalarMapPL()); + myScalarMapPL = VISU_PrsMergerPL::New(); + if(myScalarMap->GetPrsMergerPL()) + myScalarMapPL->ShallowCopy(myScalarMap->GetPrsMergerPL()); if ( myBusy ) return; @@ -766,10 +853,33 @@ void VisuGUI_ScalarBarPane::deletePreview() if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) vf->Repaint(); } + +/*! + Event filter +*/ +bool VisuGUI_ScalarBarPane::eventFilter (QObject* object, QEvent* event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent* aKeyEvent = (QKeyEvent*)event; + if (object == mySelectedGroups && aKeyEvent->key() == Key_Delete) + onRemove(); + } + return QObject::eventFilter(object, event); +} + /** * Store values to presentation object */ -int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) { +int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::PrsMerger_i* thePrs) { + thePrs->RemoveAllGeom(); + + if (myOnGroupsCB->isChecked()) + { + QString aMeshName = thePrs->GetMeshName(); + for (int i = 0; i < mySelectedGroups->count(); i++) + thePrs->AddMeshOnGroup( aMeshName , mySelectedGroups->text(i) ); + } + thePrs->SetScalarMode(myModeCombo->currentItem()); thePrs->SetPosition(XSpin->value(), YSpin->value()); thePrs->SetSize(WidthSpin->value(), HeightSpin->value()); @@ -833,6 +943,71 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) { return 1; } +/*! + Called when the checkbox is toggled +*/ +void VisuGUI_ScalarBarPane::onTypeChanged( ) +{ + bool toEnable = myOnGroupsCB->isChecked(); + if (!toEnable) + { + myAllGroups->clearSelection(); + mySelectedGroups->clearSelection(); + } + myAllGroups->setEnabled( toEnable ); + mySelectedGroups->setEnabled( toEnable ); + myAddButton->setEnabled( toEnable ); + myRemoveButton->setEnabled( toEnable ); +} + +/*! + Called when add button is clicked, adds item to choosen groups +*/ +void VisuGUI_ScalarBarPane::onAdd() +{ + QStringList aList; + + for (int i = 0; i < myAllGroups->count(); i++) + if (myAllGroups->isSelected(i)) + aList.append(myAllGroups->text(i)); + + for (int i = 0; i < mySelectedGroups->count(); i++) + aList.remove(mySelectedGroups->text(i)); + + mySelectedGroups->insertStringList(aList); +} + +/*! + Called when remove button is clicked, remove selected items from choosen +*/ +void VisuGUI_ScalarBarPane::onRemove() +{ + QPtrList aList; + aList.setAutoDelete(false); + for (int i = 0; i < mySelectedGroups->count(); i++) + if (mySelectedGroups->isSelected(i)) + aList.append(mySelectedGroups->item(i)); + + for (int i = 0; i < aList.count(); i++) + delete aList.at(i); +} + +/*! + Called when an item of listbox is double-clicked +*/ +void VisuGUI_ScalarBarPane::onListDoubleClicked( QListBoxItem* theItem ) +{ + QListBox* aListBox = theItem->listBox(); + + if (aListBox == myAllGroups) + { + if (!mySelectedGroups->findItem( theItem->text(), Qt::ExactMatch )) + mySelectedGroups->insertItem(theItem->text()); + } + else if (aListBox == mySelectedGroups) + delete theItem; +} + /*! Called when orientation is changed */ @@ -916,7 +1091,7 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode ) vtkFloatingPointType aRange[2]; int aMode = myScalarMap->GetScalarMode(); myScalarMap->SetScalarMode(theMode); - myScalarMap->GetScalarMapPL()->GetSourceRange(aRange); + myScalarMap->GetPrsMergerPL()->GetSourceRange(aRange); MinEdit->setText( QString::number( aRange[0] ) ); MaxEdit->setText( QString::number( aRange[1] ) ); myScalarMap->SetScalarMode(aMode); @@ -1116,6 +1291,22 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); } +/*! + Set values in the dialog from the presentation +*/ +void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::PrsMerger_i* thePrs) +{ + myScalarPane->initFromPrsObject(thePrs); +} + +/*! + Set values to presentation from the dialog +*/ +int VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::PrsMerger_i* thePrs) +{ + return myScalarPane->storeToPrsObject(thePrs); +} + /*! Called when button is clicked, validates data and closes dialog */ @@ -1247,9 +1438,15 @@ void VisuGUI_TextPrefDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } @@ -1297,3 +1494,5 @@ void VisuGUI_TextPrefDlg::keyPressEvent( QKeyEvent* e ) onHelp(); } } + + diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.h b/src/VISUGUI/VisuGUI_ScalarBarDlg.h index d9d0f6f2..404e0653 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.h @@ -43,8 +43,9 @@ #include #include "QtxDblSpinBox.h" +#include "QtxListBox.h" -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class QButtonGroup; class QGroupBox; @@ -58,7 +59,7 @@ class QComboBox; class QVBox; class QToolButton; -class QtxDblSpinBox; +class QListBoxItem; class SalomeApp_Module; class SVTK_FontWidget; class VISU_ScalarMapAct; @@ -100,6 +101,19 @@ class VisuGUI_TextPrefDlg: public QDialog }; +class VisuGUI_ListBox: public QtxListBox +{ + Q_OBJECT; + + public: + VisuGUI_ListBox( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ) + : QtxListBox(parent, name, f) {}; + ~VisuGUI_ListBox() {}; + + virtual QSize sizeHint() const { return minimumSizeHint(); }; +}; + + class VisuGUI_ScalarBarPane : public QVBox { Q_OBJECT; @@ -129,13 +143,22 @@ class VisuGUI_ScalarBarPane : public QVBox void initFromResources(); void storeToResources(); - void initFromPrsObject(VISU::ScalarMap_i* thePrs); - int storeToPrsObject(VISU::ScalarMap_i* thePrs); + void initFromPrsObject(VISU::PrsMerger_i* thePrs); + int storeToPrsObject(VISU::PrsMerger_i* thePrs); bool check(); void deletePreview(); + bool eventFilter (QObject* object, QEvent* event); + protected: + QGroupBox* myMainGroupBox; + QCheckBox* myOnGroupsCB; + VisuGUI_ListBox* myAllGroups; + VisuGUI_ListBox* mySelectedGroups; + QToolButton* myAddButton; + QToolButton* myRemoveButton; + QButtonGroup* RangeGroup; QRadioButton* RBFrange; QRadioButton* RBIrange; @@ -168,6 +191,11 @@ class VisuGUI_ScalarBarPane : public QVBox bool myIsStoreTextProp; private slots: + void onTypeChanged(); + void onListDoubleClicked( QListBoxItem* theItem ); + void onAdd(); + void onRemove(); + void changeDefaults( int ); void changeRange( int ); void XYChanged( double ); @@ -182,8 +210,8 @@ class VisuGUI_ScalarBarPane : public QVBox QCheckBox* myPreviewCheck; VISU_ScalarMapAct* myPreviewActor; - VISU::ScalarMap_i* myScalarMap; - VISU_ScalarMapPL* myScalarMapPL; + VISU::PrsMerger_i* myScalarMap; + VISU_PrsMergerPL* myScalarMapPL; std::string myTitle; bool myBusy; @@ -203,8 +231,8 @@ class VisuGUI_ScalarBarDlg : public QDialog void initFromResources() {myScalarPane->initFromResources();} void storeToResources() {myScalarPane->storeToResources();} - void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);} - int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);} + void initFromPrsObject(VISU::PrsMerger_i* thePrs); + int storeToPrsObject(VISU::PrsMerger_i* thePrs); private: void keyPressEvent( QKeyEvent* e ); diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index b65bf0c2..0fcffa52 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -47,7 +47,7 @@ #include "SALOME_ListIO.hxx" -#include "SALOMEDSClient_AttributeComment.hxx" +#include "SALOMEDSClient_AttributeString.hxx" #include "SALOMEDSClient_AttributeName.hxx" #include @@ -188,8 +188,8 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); _PTR(GenericAttribute) anTmpAttr; - if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) { - _PTR(AttributeComment) aTmpComment (anTmpAttr); + if (aSObject->FindAttribute(anTmpAttr, "AttributeString")) { + _PTR(AttributeString) aTmpComment (anTmpAttr); string aTmpComm = aTmpComment->Value(); QString aTmpstrIn (aTmpComm.c_str()); VISU::Storable::TRestoringMap aTmpaMap; @@ -247,8 +247,8 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj); _PTR(GenericAttribute) anAttr; - if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aChildSObj->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::TRestoringMap aMap; @@ -397,9 +397,15 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::onHelp() if (app) app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 6ddd429f..c017a26c 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -163,14 +163,26 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule): myVectorValLbl = new QLabel ("", aDataGrp); myVectorValLbl->setMinimumWidth(150); - QGroupBox* aCoordGrp = new QGroupBox (2, Qt::Horizontal, "Coordinates", myPointsPane); + QGroupBox* aCoordGrp = new QGroupBox (4, Qt::Horizontal, "Coordinates", myPointsPane); aCoordGrp->layout()->setSpacing(6); new QLabel ("X:", aCoordGrp); myXValLbl = new QLabel ("", aCoordGrp); + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + new QLabel ("I:", aCoordGrp); + myIValLbl = new QLabel ("-", aCoordGrp); + //ENK: 23.11.2006 new QLabel ("Y:", aCoordGrp); myYValLbl = new QLabel ("", aCoordGrp); + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + new QLabel ("J:", aCoordGrp); + myJValLbl = new QLabel ("-", aCoordGrp); + //ENK: 23.11.2006 new QLabel ("Z:",aCoordGrp ); myZValLbl = new QLabel ("", aCoordGrp); + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + new QLabel ("K:", aCoordGrp); + myKValLbl = new QLabel ("-", aCoordGrp); + //ENK: 23.11.2006 myWidgetStack->addWidget(myPointsPane, 0); @@ -198,20 +210,26 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule): myListPoints = new QTable (myCellsPane); myListPoints->setReadOnly(true); - myListPoints->setNumCols(6); + myListPoints->setNumCols(9); myListPoints->setNumRows(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(QTable::NoSelection); QHeader* aHeader = myListPoints->horizontalHeader(); aHeader->setLabel( 0, "ID" ); aHeader->setLabel( 1, "X" ); aHeader->setLabel( 2, "Y" ); aHeader->setLabel( 3, "Z" ); - aHeader->setLabel( 4, "Scalar" ); - aHeader->setLabel( 5, "Vector" ); + aHeader->setLabel( 4, "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aHeader->setLabel( 5, "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aHeader->setLabel( 6, "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aHeader->setLabel( 7, "Scalar" ); + aHeader->setLabel( 8, "Vector" ); aCellLayout->addWidget(myListPoints, 1, 0); @@ -397,8 +415,8 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { VISU::Storable::TRestoringMap aMap; if (aSObject) { _PTR(GenericAttribute) anAttr; - if (aSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aSObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); std::string aString = aComment->Value(); QString strIn( aString.c_str() ); VISU::Storable::StrToMap(strIn, aMap); @@ -450,6 +468,23 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { myIDValLbl->setText( QString::number(anID) ); myScalarValLbl->setText(getValue(aPntData, aVTKID)); myVectorValLbl->setText(getVector(aPntData, aVTKID)); + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + const VISU::PIDMapper& aMapper = aPrs3d->GetPL()->GetIDMapper(); + VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anID); + switch(aVec.size()){ + case 3: + myKValLbl->setText(QString::number(aVec[2])); + case 2: + myJValLbl->setText(QString::number(aVec[1])); + case 1: + myIValLbl->setText(QString::number(aVec[0])); + break; + default: + myIValLbl->setText("-"); + myJValLbl->setText("-"); + myKValLbl->setText("-"); + } + //ENK: 23.11.2006 } break; case 1: @@ -482,16 +517,38 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { myListPoints->setNumRows(aPointsMap.size()); PointsMap::const_iterator It = aPointsMap.begin(); + + const VISU::PIDMapper& aMapper = aPrs3d->GetPL()->GetIDMapper(); for (int i = 0; It != aPointsMap.end() && i < myListPoints->numRows(); It++, i++) { myListPoints->verticalHeader()->setLabel(i, QString::number( i )); int id = It->first; + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(id); + QString aI,aJ,aK; + aI = "-"; + aJ = "-"; + aK = "-"; + switch(aVec.size()){ + case 3: + aK = QString::number(aVec[2]); + case 2: + aJ = QString::number(aVec[1]); + case 1: + aI = QString::number(aVec[0]); + break; + } + //ENK: 23.11.2006 + myListPoints->setText(i, 0, QString::number( id )); vtkFloatingPointType* aCoord = It->second; myListPoints->setText(i, 1, QString::number( aCoord[0] )); myListPoints->setText(i, 2, QString::number( aCoord[1] )); myListPoints->setText(i, 3, QString::number( aCoord[2] )); - myListPoints->setText(i, 4, getValue(aPntData, id)); - myListPoints->setText(i, 5, getVector(aPntData, id)); + myListPoints->setText(i, 4, aI);//ENK: 23.11.2006 - PAL13176 + myListPoints->setText(i, 5, aJ);//ENK: 23.11.2006 - PAL13176 + myListPoints->setText(i, 6, aK);//ENK: 23.11.2006 - PAL13176 + myListPoints->setText(i, 7, getValue(aPntData, id)); + myListPoints->setText(i, 8, getVector(aPntData, id)); } } } else { @@ -509,6 +566,9 @@ void VisuGUI_SelectionDlg::clearFields() { 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 myIDValLbl->setText( "" ); myScalarValLbl->setText(""); myVectorValLbl->setText(""); @@ -629,9 +689,15 @@ void VisuGUI_SelectionDlg::onHelp() if (app) app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index a6517bc1..ef118b82 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -72,6 +72,11 @@ private slots: 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; diff --git a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx index 81e8fcc1..5c46ede4 100644 --- a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx +++ b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx @@ -490,9 +490,15 @@ void VisuGUI_SetupPlot2dDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index 7a1820c1..dee64cdb 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -108,8 +108,8 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); _PTR(GenericAttribute) anTmpAttr; - if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) { - _PTR(AttributeComment) aTmpComment (anTmpAttr); + if (aSObject->FindAttribute(anTmpAttr, "AttributeString")) { + _PTR(AttributeString) aTmpComment (anTmpAttr); string aTmpComm = aTmpComment->Value(); QString aTmpstrIn (aTmpComm.c_str()); VISU::Storable::TRestoringMap aTmpaMap; @@ -183,8 +183,8 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) } _PTR(GenericAttribute) anAttr; - if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aChildSObj->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::TRestoringMap aMap; @@ -539,8 +539,8 @@ VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh (VISU::VISUType theType, QStri for (aIter->InitEx(true); aIter->More(); aIter->Next() ) { SALOMEDSClient_SObject* aChildSObj = aIter->Value(); SALOMEDSClient_GenericAttribute* anAttr; - if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { - SALOMEDSClient_AttributeComment* aComment = dynamic_cast( anAttr ); + if (aChildSObj->FindAttribute(anAttr, "AttributeString")) { + SALOMEDSClient_AttributeString* aComment = dynamic_cast( anAttr ); CORBA::String_var aComm = aComment->Value().c_str(); QString strIn(aComm.in()); aMap.clear(); @@ -622,9 +622,15 @@ void VisuGUI_StreamLinesDlg::onHelp() if (app) app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 91d6fd39..27f53ab9 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -485,7 +485,14 @@ SetupDlg::SetupDlg (QWidget* theParent, double aMaxTime = myAnimator->getMaxTime(); double aMinTime = myAnimator->getMinTime(); - double aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1); + double aStep; + if ( myAnimator->getAnimationMode() == 0 ) + aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1); + else { // succcessive animation mode + std::pair aLastFieldFrame(myAnimator->getNbFields() - 1, + myAnimator->getFieldData(myAnimator->getNbFields() - 1).myNbTimes - 1); + aStep = (aMaxTime - aMinTime) / myAnimator->getAbsoluteFrameNumber(aLastFieldFrame); + } QLabel* aMinLbl = new QLabel("From", aRangeGrp); aMinLbl->setEnabled(myUseRangeChk->isChecked()); @@ -535,15 +542,26 @@ SetupDlg::SetupDlg (QWidget* theParent, // Find names of fields for (int i = 0; i < myAnimator->getNbFields(); i++) { _PTR(SObject) aSO = myAnimator->getFieldData(i).myField; - aFieldNames.append(VISU::getValue(aSO, "myName")); + QString aFieldName(VISU::getValue(aSO, "myName")); + if ( myAnimator->getAnimationMode() == 0 ) + aFieldNames.append(aFieldName); + else if ( myAnimator->getAnimationMode() == 1 ) { + QString aFileName(VISU::getValue(aSO->GetFather()->GetFather()->GetFather(),"myInitFileName")); + aFileName = aFileName.right(aFileName.length() - (aFileName.findRev("/") + 1)); + aFieldNames.append(aFileName + QString(" : ") + aFieldName); + } } myFieldLst->insertStringList(aFieldNames); - myFieldLst->setSelected(0, true); - connect( myFieldLst, SIGNAL( highlighted(int) ), - this, SLOT( onFieldChange(int) ) ); - - - QVBox* aSetupBox = new QVBox(aPropFrame); + + if ( myAnimator->getAnimationMode() == 0 ) { + myFieldLst->setSelected(0, true); + connect( myFieldLst, SIGNAL( highlighted(int) ), + this, SLOT( onFieldChange(int) ) ); + } + else if ( myAnimator->getAnimationMode() == 1 ) + myFieldLst->setSelectionMode(QListBox::NoSelection); + + QVBox* aSetupBox = new QVBox(aPropFrame); aSetupBox->setSpacing(5); QVGroupBox* aPropBox = new QVGroupBox("Properties", aSetupBox); @@ -561,7 +579,7 @@ SetupDlg::SetupDlg (QWidget* theParent, connect( myPropBtn, SIGNAL( clicked() ), this, SLOT( onPreferencesDlg() ) ); - if (myAnimator->getNbFields() > 1) { + if (myAnimator->getNbFields() > 1 && myAnimator->getAnimationMode() == 0) { myArrangeBtn = new QPushButton("Arrange...", aSetupBox); connect( myArrangeBtn, SIGNAL( clicked() ), this, SLOT( onArrangeDlg() ) ); } @@ -595,7 +613,6 @@ enum PrsComboItem { //------------------------------------------------------------------------ void SetupDlg::onFieldChange (int theIndex) { - FieldData& aData = myAnimator->getFieldData(theIndex); myTypeCombo->clear(); myTypeId2ComboId.clear(); myComboId2TypeId.clear(); @@ -621,9 +638,40 @@ void SetupDlg::onFieldChange (int theIndex) myTypeId2ComboId[TPLOT3D_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TPLOT3D_ITEM);; - _PTR(SObject) aSObject = aData.myField; - long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong(); - if (aNumComp > 1) { + bool anEnableItems = false; + bool anEnableGP = false; + VISU::VISUType aPrsType; + if ( myAnimator->getAnimationMode() == 0 ) { // parallel animation mode + + FieldData& aData = myAnimator->getFieldData(theIndex); + _PTR(SObject) aSObject = aData.myField; + long aNumComp = VISU::getValue(aSObject, "myNumComponent").toLong(); + anEnableItems = (aNumComp > 1); + + long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong(); + anEnableGP = (anEntityId == VISU::CELL); + + aPrsType = aData.myPrsType; + + } + else if ( myAnimator->getAnimationMode() == 1 ) { // succcessive animation mode + + for (int i = 0; i < myAnimator->getNbFields(); i++) { + _PTR(SObject) aSO = myAnimator->getFieldData(i).myField; + long aNumComp = VISU::getValue(aSO, "myNumComponent").toLong(); + anEnableItems = (aNumComp > 1); + + long anEntityId = VISU::getValue(aSO, "myEntityId").toLong(); + anEnableGP = (anEntityId == VISU::CELL); + + if ( !anEnableItems && !anEnableGP ) break; + } + + aPrsType = myAnimator->getFieldData(0).myPrsType; + + } + + if (anEnableItems) { myTypeCombo->insertItem("Deformed Shape"); // item 5 myTypeId2ComboId[TDEFORMEDSHAPE_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TDEFORMEDSHAPE_ITEM);; @@ -641,15 +689,14 @@ void SetupDlg::onFieldChange (int theIndex) myComboId2TypeId.push_back(TSCALARMAPONDEFORMEDSHAPE_ITEM);; } - long anEntityId = VISU::getValue(aSObject, "myEntityId").toLong(); - if(anEntityId == VISU::CELL){ + if(anEnableGP){ myTypeCombo->insertItem("Gauss Points"); // item 8 myTypeId2ComboId[TGAUSSPOINTS_ITEM] = myComboId2TypeId.size(); myComboId2TypeId.push_back(TGAUSSPOINTS_ITEM);; } - switch (aData.myPrsType) { - case VISU::TSCALARMAP: //Scalar Map + switch (aPrsType) { + case VISU::TPRSMERGER: //Scalar Map myTypeCombo->setCurrentItem(myTypeId2ComboId[TSCALARMAP_ITEM]); break; case VISU::TISOSURFACE: //Iso Surfaces @@ -686,41 +733,50 @@ void SetupDlg::onFieldChange (int theIndex) //------------------------------------------------------------------------ void SetupDlg::onTypeChanged (int theIndex) { - FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem()); int aType = myComboId2TypeId[theIndex]; - switch (aType) { - case TSCALARMAP_ITEM: //Scalar Map - aData.myPrsType = VISU::TSCALARMAP; - break; - case TISOSURFACE_ITEM: //Iso Surfaces - aData.myPrsType = VISU::TISOSURFACE; - break; - case TCUTPLANES_ITEM: //Cut Planes - aData.myPrsType = VISU::TCUTPLANES; - break; - case TCUTLINES_ITEM: //Cut Lines - aData.myPrsType = VISU::TCUTLINES; - break; - case TPLOT3D_ITEM: //Plot 3D - aData.myPrsType = VISU::TPLOT3D; - break; - case TDEFORMEDSHAPE_ITEM: //Deformed Shape - aData.myPrsType = VISU::TDEFORMEDSHAPE; - break; - case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape - aData.myPrsType = VISU::TSCALARMAPONDEFORMEDSHAPE; - break; - case TVECTORS_ITEM: //Vectors - aData.myPrsType = VISU::TVECTORS; - break; - case TSTREAMLINES_ITEM: //Stream Lines - aData.myPrsType = VISU::TSTREAMLINES; - break; - case TGAUSSPOINTS_ITEM: //Gauss Points - aData.myPrsType = VISU::TGAUSSPOINTS; - break; + + for (int i = 0; i < myAnimator->getNbFields(); i++) { + FieldData& aData = ( myAnimator->getAnimationMode() == 0 ) ? + myAnimator->getFieldData(myFieldLst->currentItem()) : + myAnimator->getFieldData(i); + + switch (aType) { + case TSCALARMAP_ITEM: //Scalar Map + aData.myPrsType = VISU::TPRSMERGER; + break; + case TISOSURFACE_ITEM: //Iso Surfaces + aData.myPrsType = VISU::TISOSURFACE; + break; + case TCUTPLANES_ITEM: //Cut Planes + aData.myPrsType = VISU::TCUTPLANES; + break; + case TCUTLINES_ITEM: //Cut Lines + aData.myPrsType = VISU::TCUTLINES; + break; + case TPLOT3D_ITEM: //Plot 3D + aData.myPrsType = VISU::TPLOT3D; + break; + case TDEFORMEDSHAPE_ITEM: //Deformed Shape + aData.myPrsType = VISU::TDEFORMEDSHAPE; + break; + case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape + aData.myPrsType = VISU::TSCALARMAPONDEFORMEDSHAPE; + break; + case TVECTORS_ITEM: //Vectors + aData.myPrsType = VISU::TVECTORS; + break; + case TSTREAMLINES_ITEM: //Stream Lines + aData.myPrsType = VISU::TSTREAMLINES; + break; + case TGAUSSPOINTS_ITEM: //Gauss Points + aData.myPrsType = VISU::TGAUSSPOINTS; + break; + } + myAnimator->clearData(aData); + + if ( myAnimator->getAnimationMode() == 0 ) // parallel animation mode + break; } - myAnimator->clearData(aData); //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP); //myAnimator->generatePresentations(myFieldLst->currentItem()); } @@ -732,13 +788,21 @@ namespace template void EditPrs(VisuGUI* theModule, - FieldData& theData) + FieldData& theData, + VISU_TimeAnimation* theAnimator) { TDialog* aDlg = new TDialog(theModule); aDlg->initFromPrsObject(dynamic_cast(theData.myPrs[0])); - if (aDlg->exec()) + if (aDlg->exec()) { for (int i = 0; i < theData.myNbFrames; i++) aDlg->storeToPrsObject(dynamic_cast(theData.myPrs[i])); + if ( theAnimator->getAnimationMode() == 1 ) { + for (int i = 1; i < theAnimator->getNbFields(); i++) { + for (int j = 0; j < theAnimator->getFieldData(i).myNbFrames; j++) + aDlg->storeToPrsObject(dynamic_cast(theAnimator->getFieldData(i).myPrs[j])); + } + } + } delete aDlg; } } @@ -747,9 +811,26 @@ namespace void SetupDlg::onPreferencesDlg() { SUIT_OverrideCursor c; - FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem()); + + int id = ( myAnimator->getAnimationMode() == 0 ) ? myFieldLst->currentItem() : 0; + FieldData& aData = myAnimator->getFieldData(id); if (aData.myPrs.empty()) - myAnimator->generatePresentations(myFieldLst->currentItem()); + myAnimator->generatePresentations(id); + + if ( myAnimator->getAnimationMode() == 1 ) { + for (int i = 0; i < myAnimator->getNbFields(); i++) { + if ( i != id && myAnimator->getFieldData(i).myPrs.empty() ) myAnimator->generatePresentations(i); + } + } + + if(!aData.myNbFrames || !aData.myPrs[0]){ + QApplication::restoreOverrideCursor(); + SUIT_MessageBox::warn1(this, + tr("ERROR"), + VisuGUI_TimeAnimationDlg::tr("MSG_NO_ANIMATIONDATA"), + tr("&OK")); + return; + } if(!aData.myNbFrames || !aData.myPrs[0]){ QApplication::restoreOverrideCursor(); @@ -764,27 +845,27 @@ void SetupDlg::onPreferencesDlg() switch (aType) { case TSCALARMAP_ITEM: //Scalar Map c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TISOSURFACE_ITEM: //Iso Surfaces c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TCUTPLANES_ITEM: //Cut Planes c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TCUTLINES_ITEM: //Cut Lines c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TPLOT3D_ITEM: //Plot 3D c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TDEFORMEDSHAPE_ITEM: //Deformed Shape c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TSCALARMAPONDEFORMEDSHAPE_ITEM: //Scalar Map on Deformed Shape c.suspend(); @@ -810,15 +891,15 @@ void SetupDlg::onPreferencesDlg() break; case TVECTORS_ITEM: //Vectors c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TSTREAMLINES_ITEM: //Stream Lines c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; case TGAUSSPOINTS_ITEM: //Gauss Points c.suspend(); - EditPrs(myModule,aData); + EditPrs(myModule,aData,myAnimator); break; } } @@ -985,7 +1066,7 @@ static const char * pauseIco[] = { static QPixmap MYpausePixmap(pauseIco); -VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Study) theStudy) : +VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Study) theStudy, int theMode) : QDialog(VISU::GetDesktop(theModule), "VisuGUI_TimeAnimationDlg", false, @@ -994,15 +1075,19 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu myStudy(theStudy), mySetupDlg(NULL) { - setCaption("Animation"); + if ( theMode == 0 ) + setCaption(tr("PARALLEL_ANIMATION")); + else if ( theMode == 1 ) + setCaption(tr("SUCCESSIVE_ANIMATION")); setSizeGripEnabled( TRUE ); isClosing = false; + myCloseBtnClicked = false; myAnimator = new VISU_TimeAnimation (theStudy); - myAnimator->setSpeed(1); myAnimator->setViewer(VISU::GetActiveViewWindow(theModule)); connect(myAnimator, SIGNAL(frameChanged(long, double)), this, SLOT(onExecution(long, double))); connect(myAnimator, SIGNAL(stopped()), this, SLOT(onStop())); + myAnimator->setAnimationMode(theMode); QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6); aMainLayout->setSpacing(5); @@ -1076,12 +1161,13 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu QLCDNumber* aSpeedNum = new QLCDNumber( 2, myPlayFrame ); aSpeedNum->setSegmentStyle(QLCDNumber::Flat); - aSpeedNum->display(1); + aSpeedNum->display((int)myAnimator->getSpeed()); TopLayout->addWidget(aSpeedNum, 4, 3); QwtWheel* aWheel = new QwtWheel(myPlayFrame); aWheel->setOrientation(Qt::Vertical); aWheel->setRange(1, 99, 1); + aWheel->setValue((int)myAnimator->getSpeed()); connect( aWheel, SIGNAL(valueChanged(double)), aSpeedNum, SLOT(display(double)) ); connect( aWheel, SIGNAL(valueChanged(double)), @@ -1185,6 +1271,11 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu TopLayout->addMultiCellWidget(aSaveBox, 7, 7, 0, 3); + QCheckBox* aCleanMemCheck = new QCheckBox("Clean memory at each frame",myPlayFrame); + aCleanMemCheck->setChecked(myAnimator->isCleaningMemoryAtEachFrame()); + connect(aCleanMemCheck, SIGNAL(toggled(bool)), myAnimator, SLOT(setCleaningMemoryAtEachFrameSlot(bool))); + TopLayout->addMultiCellWidget(aCleanMemCheck, 8, 8, 0, 3); + aMainLayout->addWidget(myPlayFrame); // Animation publishing in study @@ -1206,7 +1297,7 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu aBtnLayout->addStretch(); QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox); - connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close())); + connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose())); QPushButton* aHelpBtn = new QPushButton(tr("BUT_HELP"), aBtnBox); connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); @@ -1228,7 +1319,8 @@ VisuGUI_TimeAnimationDlg::~VisuGUI_TimeAnimationDlg() if(myAnimator != NULL){ delete myAnimator; myAnimator = NULL; - VISU::GetActiveViewWindow(myModule)->Repaint(); + if ( VISU::GetActiveViewWindow(myModule) ) + VISU::GetActiveViewWindow(myModule)->Repaint(); } } @@ -1243,10 +1335,10 @@ void VisuGUI_TimeAnimationDlg::onTypeChange (int index) } //------------------------------------------------------------------------ -void VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject) +bool VisuGUI_TimeAnimationDlg::addField (_PTR(SObject) theSObject) { myPlayFrame->setEnabled(false); - myAnimator->addField(theSObject); + return myAnimator->addField(theSObject); } //------------------------------------------------------------------------ @@ -1351,6 +1443,12 @@ void VisuGUI_TimeAnimationDlg::reject() QDialog::reject(); } +void VisuGUI_TimeAnimationDlg::onClose() +{ + myCloseBtnClicked = true; + close(); +} + //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) { @@ -1363,8 +1461,8 @@ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) // * Destroing data in myAnimator before study closed. // * It needed for correcting destroing of myAnimator, which // * depend from SVTK_RenderWindowInteractor() e.t.c. - if(theEvent->type() == QEvent::Close){ - for (int i = 0; i < myAnimator->getNbFields(); i++) + if(theEvent->type() == QEvent::Close && !myCloseBtnClicked){ + for (int i = 0; (myAnimator != NULL) && (i < myAnimator->getNbFields()); i++) myAnimator->clearData(myAnimator->getFieldData(i)); myAnimator->clearFieldData(); } @@ -1494,9 +1592,15 @@ void VisuGUI_TimeAnimationDlg::onHelp() if (app) app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } @@ -1521,6 +1625,8 @@ void VisuGUI_TimeAnimationDlg::restoreFromStudy(_PTR(SObject) theAnimation) { myAnimator->restoreFromStudy(theAnimation); mySaveBtn->setEnabled(myAnimator->isSavedInStudy()); + if ( myAnimator->getAnimationMode() == 1 ) + setCaption(tr("SUCCESSIVE_ANIMATION")); } //------------------------------------------------------------------------ diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index 604cd24b..f717b3f6 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -143,10 +143,10 @@ class VisuGUI_TimeAnimationDlg: public QDialog { Q_OBJECT public: - VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy); + VisuGUI_TimeAnimationDlg(VisuGUI* theModule, _PTR(Study) theStudy, int theMode=0); ~VisuGUI_TimeAnimationDlg(); - void addField(_PTR(SObject) theField); + bool addField(_PTR(SObject) theField); void clearView(); void restoreFromStudy(_PTR(SObject) theAnimation); @@ -157,7 +157,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog virtual void keyPressEvent(QKeyEvent* theEvent); virtual void reject(); void stopAnimation(); - + private slots: void onTypeChange(int index); void onPlayPressed(); @@ -181,6 +181,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog void onPicsFormatChanged(); /*!Sets path for myAnimator (dumpTo(...)), from myPathEdit.*/ void onPathChanged(); + void onClose(); private: QSlider* mySlider; @@ -201,6 +202,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog QComboBox* myPicsFormat; QLineEdit* myPathEdit; bool isClosing; + bool myCloseBtnClicked; QCloseEvent* myEvent; QCheckBox* mySaveAVICheck; diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index f9ea32df..85572b50 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -68,6 +68,8 @@ #include #include +#include + //============================================================================= namespace VISU @@ -195,8 +197,8 @@ namespace VISU Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","VISU"); VISU_Gen_var aVISU = VISU_Gen::_narrow(aComponent); if(!CORBA::is_nil(aVISU)){ - aGen = VISU_Gen_i::GetVisuGenImpl(); - aGen->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(theModule)))); + if( aGen = VISU_Gen_i::GetVisuGenImpl() ) + aGen->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(theModule)))); } } if(!aGen) @@ -224,8 +226,8 @@ namespace VISU VISU::Storable::TRestoringMap aMap; if (theSObject) { _PTR(GenericAttribute) anAttr; - if (theSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (theSObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); std::string aValue = aComment->Value(); QString aString (aValue.c_str()); VISU::Storable::StrToMap(aString, aMap); @@ -257,8 +259,8 @@ namespace VISU _PTR(SObject) aSObject = aStudy->FindObjectID(theEntry.latin1()); if (aSObject) { _PTR(GenericAttribute) anAttr; - if (theMap && aSObject->FindAttribute(anAttr,"AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (theMap && aSObject->FindAttribute(anAttr,"AttributeString")) { + _PTR(AttributeString) aComment (anAttr); std::string aValue = aComment->Value(); QString aString (aValue.c_str()); VISU::Storable::StrToMap(aString, *theMap); @@ -388,14 +390,17 @@ namespace VISU // (first sub-level) or is a child of such an object string aNAME, aVisuNAME = GetVisuGen(theModule)->ComponentDataType(); _PTR(GenericAttribute) anAttr; - _PTR(AttributeComment) aComment; + _PTR(AttributeString) aComment; bool isUnderVISU = false; _PTR(SObject) aFatherSObject = aSObject->GetFather(); - if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aFatherSObject->FindAttribute(anAttr, "AttributeName")) { + // mkr : 24.11.2006 : use AttributeName and module title for correct "Delete" + // popup item displaying in object browser popup + _PTR(AttributeName) aComment (anAttr); aNAME = aComment->Value(); - if (aNAME == aVisuNAME) { + QString aVisuTITLE = theModule->getApp()->moduleTitle(QString(aVisuNAME)); + if (!aVisuTITLE.compare(QString(aNAME))) { isUnderVISU = true; } } @@ -409,8 +414,8 @@ namespace VISU isUnderVISU = false; aFatherSObject = aFatherSObject->GetFather(); - if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (aFatherSObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); aNAME = aComment->Value(); if (aNAME == aVisuNAME) { isUnderVISU = true; @@ -418,7 +423,7 @@ namespace VISU } if (!isUnderVISU) { // Father is not directly under VISU component - return false; + return false; } } } @@ -1000,6 +1005,7 @@ namespace VISU } } aPlot->Repaint(); + aPlot->fitAll(); } void @@ -1105,6 +1111,10 @@ namespace VISU Utils_Timer timer; timer.Start(); #endif + if(GetResourceMgr()->booleanValue("VISU","display_only",false)){ + const VisuGUI* av = dynamic_cast(theModule); + if(av)(const_cast(av))->OnEraseAll(); + } PublishMeshInView(theModule, pPresent, theViewWindow); SetFitAll(theViewWindow); #ifdef CHECKTIME @@ -1121,6 +1131,9 @@ namespace VISU } } + SalomeApp_Module* aModule = (SalomeApp_Module*)theModule; + UpdateObjBrowser(aModule, false, aResultSObj); + theModule->application()->putInfo(QObject::tr("INF_DONE")); // Make "Save" button active theModule->getApp()->updateActions(); @@ -1156,7 +1169,7 @@ namespace VISU if (!CORBA::is_nil(aVisuObj)) { VISU::VISUType aType = aVisuObj->GetType(); switch (aType) { - case VISU::TSCALARMAP: + case VISU::TPRSMERGER: case VISU::TISOSURFACE: case VISU::TDEFORMEDSHAPE: case VISU::TCUTPLANES: @@ -1199,8 +1212,8 @@ namespace VISU } } else { _PTR(GenericAttribute) anAttr; - if (theObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (theObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::TRestoringMap pMap; diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx index 2739cf7a..2904e209 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx @@ -186,9 +186,15 @@ void VisuGUI_TransparencyDlg::ClickOnHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx index b9c660c0..53961573 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.cxx +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -438,9 +438,15 @@ void VisuGUI_VectorsDlg::onHelp() app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); } else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index 41b9c67e..38c65440 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -55,17 +55,21 @@ LIB_SRC = \ VISU_TimeAnimation.cxx \ VISU_CorbaMedConvertor.cxx \ VISU_DumpPython.cc \ - VISU_ScalarMapOnDeformedShape_i.cc + VISU_ScalarMapOnDeformedShape_i.cc \ + VISU_PrsMerger_i.cc LIB_MOC = \ VISU_TimeAnimation.h LIB_SERVER_IDL = \ + MED_Gen.idl \ MED.idl \ VISU_Gen.idl \ SALOME_Component.idl \ SALOME_Exception.idl \ - SALOME_GenericObj.idl + SALOME_GenericObj.idl \ + SALOME_ModuleCatalog.idl \ + SALOME_Session.idl LIB_CLIENT_IDL = \ SALOMEDS.idl \ @@ -100,7 +104,9 @@ EXPORT_HEADERS = \ VISU_ViewManager_i.hh \ VISU_View_i.hh \ VISU_TimeAnimation.h \ - VISU_ScalarMapOnDeformedShape_i.hh + VISU_ScalarMapOnDeformedShape_i.hh \ + VISU_PrsMerger_i.hh \ + VISU_I.hxx # additionnal information to compil and link file CPPFLAGS += \ diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index 72c1635d..6d5618c9 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -265,8 +265,8 @@ namespace VISU{ SALOMEDS::SObject_var aFieldSO; for(;anIter->More();anIter->Next()) { SALOMEDS::GenericAttribute_var anAttr; - if (anIter->Value()->FindAttribute(anAttr,"AttributeComment")) { - SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr); + if (anIter->Value()->FindAttribute(anAttr,"AttributeString")) { + SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr); CORBA::String_var aString = aCmnt->Value(); string aValue(aString); if (aValue == theComment) { @@ -308,8 +308,8 @@ namespace VISU{ aPRef->SetValue(thePersistentRef); } if(strcmp(theComment,"") != 0){ - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); - SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeString"); + SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr); aCmnt->SetValue(theComment); if(MYDEBUG) INFOS("CreateAttributes - Comment = "<SetValue(thePersistentRef); } if (strcmp(theComment, "") != 0) { - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); - _PTR(AttributeComment) aCmnt (anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeString"); + _PTR(AttributeString) aCmnt (anAttr); aCmnt->SetValue(theComment); if (MYDEBUG) INFOS("CreateAttributes - Comment = " << theComment); } diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index 48ea0f5f..c4efc6ad 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -27,6 +27,8 @@ #ifndef __VISU_CONFIG_H__ #define __VISU_CONFIG_H__ +#include "VISU_I.hxx" + // IDL headers #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(VISU_Gen) @@ -64,14 +66,14 @@ class SUIT_ResourceMgr; namespace VISU { - SUIT_Session *GetSession(); - SUIT_ResourceMgr *GetResourceMgr(); + VISU_I_EXPORT SUIT_Session *GetSession(); + VISU_I_EXPORT SUIT_ResourceMgr *GetResourceMgr(); //=========================================================================== class VISU_Gen_i; - class Base_i : public virtual POA_VISU::Base, + class VISU_I_EXPORT Base_i : public virtual POA_VISU::Base, public virtual PortableServer::RefCountServantBase { public: @@ -101,7 +103,7 @@ namespace VISU //=========================================================================== - class Mutex{ + class VISU_I_EXPORT Mutex{ QMutex* myMutex; int isQAppLocked; public: @@ -111,7 +113,7 @@ namespace VISU //=========================================================================== - class Storable : public virtual Base_i { + class VISU_I_EXPORT Storable : public virtual Base_i { protected: virtual void ToStream(std::ostringstream& theStr) = 0; public: @@ -133,7 +135,7 @@ namespace VISU }; //=========================================================================== - class RemovableObject_i : public virtual POA_VISU::RemovableObject, + class VISU_I_EXPORT RemovableObject_i : public virtual POA_VISU::RemovableObject, public virtual Storable { public: @@ -141,40 +143,40 @@ namespace VISU }; //=========================================================================== - const CORBA::Boolean IsMultifile(); - QString GenerateName(const std::string& theFmt, int theId); + VISU_I_EXPORT const CORBA::Boolean IsMultifile(); + VISU_I_EXPORT QString GenerateName(const std::string& theFmt, int theId); - PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject); - CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject); - CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr); + VISU_I_EXPORT PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject); + VISU_I_EXPORT CORBA::Object_var ClientSObjectToObject(_PTR(SObject) theSObject); + VISU_I_EXPORT CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr); - _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument); - SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument); + VISU_I_EXPORT _PTR(SComponent) ClientFindOrCreateVisuComponent(_PTR(Study) theStudyDocument); + VISU_I_EXPORT SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument); - std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, + VISU_I_EXPORT std::string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, const char* theFatherEntry, const char* theRefFatherEntry, const char* theIOR, const char* theName, const char* thePersistentRef, const char* theComment, CORBA::Boolean theCreateNew = true); - std::string CreateAttributes(_PTR(Study) theStudyDocument, + VISU_I_EXPORT std::string CreateAttributes(_PTR(Study) theStudyDocument, const char* theFatherEntry, const char* theRefFatherEntry, const char* theIOR, const char* theName, const char* thePersistentRef, const char* theComment, CORBA::Boolean theCreateNew = true); - std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, + VISU_I_EXPORT std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, const char* theComment, int IsAllLevels = true); - SALOMEDS::SObject_var GetSObject(_PTR(SObject)); - _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study)); + VISU_I_EXPORT SALOMEDS::SObject_var GetSObject(_PTR(SObject)); + VISU_I_EXPORT _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study)); - SALOMEDS::Study_var GetDSStudy(_PTR(Study)); + VISU_I_EXPORT SALOMEDS::Study_var GetDSStudy(_PTR(Study)); - void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, + VISU_I_EXPORT void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, bool theIsAttrOnly = true, bool theDestroySubObjects = false); - void RemoveFromStudy(_PTR(SObject) theSObject, + VISU_I_EXPORT void RemoveFromStudy(_PTR(SObject) theSObject, bool theIsAttrOnly = true, bool theDestroySubObjects = false); } diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 275d3e2e..08657c70 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -104,13 +104,13 @@ VISU::ColoredPrs3d_i DoHook(); ColoredPrs3d_i* anOrigin = const_cast(aPrs3d); - - myField = anOrigin->GetField(); - myMeshName = myField->myMeshName; - myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity; - myIteration = anOrigin->GetIteration(); - myFieldName = anOrigin->GetFieldName(); - + if(myMeshName == ""){ + myField = anOrigin->GetField(); + myMeshName = myField->myMeshName; + myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity; + myIteration = anOrigin->GetIteration(); + myFieldName = anOrigin->GetFieldName(); + } Build(-1); TSuperClass::SameAs(theOrigin); @@ -143,13 +143,25 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SameAsParams(const ColoredPrs3d_i* theOrigin) +::SameAsParams(const ColoredPrs3d_i* theOrigin, + const std::string& theMeshName, const std::string& theFieldName, + VISU::Entity theEntity, int theIteration, + bool theIsFixedRange) { - int anIteration = GetIteration(); - SameAs(theOrigin); - myIteration = anIteration; + myMeshName = theMeshName; + myFieldName = theFieldName; + myEntity = (VISU::TEntity)theEntity; + myIteration = theIteration; + int aScalarMode = (const_cast(theOrigin))->GetScalarMode(); + SameAs(theOrigin); + + myIsFixedRange = theIsFixedRange; + Build(-1); + + SetScalarMode(aScalarMode); // mkr : IPAL14030 + Update(); } @@ -271,9 +283,18 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetTitle(const char* theName) -{ - myTitle = theName; +::SetTitle(const char* theTitle) +{ + // mkr : IPAL14030 + std::strstream aStream; + const VISU::TValField& aValField = myField->myValField; + const VISU::PValForTime aValForTime = aValField.find(myIteration)->second; + aStream<myTime)<myValField; const VISU::PValForTime aValForTime = aValField.find(myIteration)->second; aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str()); - if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1(); + if (theRestoring == 0) SetTitle(myFieldName.c_str()); } if(myAddToStudy){ myName = GenerateName().latin1(); @@ -695,6 +725,17 @@ VISU::ColoredPrs3d_i CORBA::String_var anIOR = GetID(); CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); mySObject = myStudy->FindObjectIOR(anIOR); + + // Set icon + if (GetIconName() != 0) + { + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + aPixmap ->SetPixMap(GetIconName()); + } } #ifndef _DEXCEPT_ }catch(std::exception& exc){ diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index b5417b22..2bb473ea 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -34,11 +34,11 @@ class VISU_ScalarMapPL; namespace VISU { //============================================================================ - class ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d, + class VISU_I_EXPORT ColoredPrs3d_i : public virtual POA_VISU::ColoredPrs3d, public virtual Prs3d_i { - ColoredPrs3d_i(); ColoredPrs3d_i(const ColoredPrs3d_i&); + public: //---------------------------------------------------------------------------- typedef Prs3d_i TSuperClass; @@ -124,7 +124,7 @@ namespace VISU virtual void - SetTitle(const char* theName); + SetTitle(const char* theTitle); virtual char* @@ -134,6 +134,7 @@ namespace VISU protected: VISU::ScalarMap::Orientation myOrientation; std::string myTitle; + std::string myScalarBarTitle; int myNumberOfLabels; vtkFloatingPointType myPosition[2], myWidth, myHeight; @@ -164,7 +165,10 @@ namespace VISU * Is used in VISU_TimeAnimation class implementation. */ void - SameAsParams(const ColoredPrs3d_i* theOrigin); + SameAsParams(const ColoredPrs3d_i* theOrigin, + const std::string& theMeshName, const std::string& theFieldName, + VISU::Entity theEntity, int theIteration, + bool theIsFixedRange); virtual const VISU::PField& GetField() const; @@ -272,6 +276,9 @@ namespace VISU vtkFloatingPointType theG, vtkFloatingPointType theB); + std::string + GetScalarBarTitle(); + //---------------------------------------------------------------------------- protected: PField myField; @@ -305,6 +312,10 @@ namespace VISU virtual void DoHook(); + + virtual + const char* + GetIconName() = 0; }; } diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 26b5074b..0713b496 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -173,6 +173,30 @@ namespace return VISU::eNONE; } + //--------------------------------------------------------------- + medGeometryElement + VISUGeomToMED(int theGeom) + { + switch(theGeom){ + case VISU::ePOINT1: return MED_POINT1; + case VISU::eSEG2: return MED_SEG2; + case VISU::eTRIA3: return MED_TRIA3; + case VISU::eQUAD4: return MED_QUAD4; + case VISU::eTETRA4: return MED_TETRA4; + case VISU::eHEXA8: return MED_HEXA8; + case VISU::ePENTA6: return MED_PENTA6; + case VISU::ePYRA5: return MED_PYRA5; + + case VISU::eSEG3: return MED_SEG3; + case VISU::eTRIA6: return MED_TRIA6; + case VISU::eQUAD8: return MED_QUAD8; + case VISU::eTETRA10: return MED_TETRA10; + case VISU::eHEXA20: return MED_HEXA20; + case VISU::ePENTA15: return MED_PENTA15; + case VISU::ePYRA13: return MED_PYRA13; + } + return medGeometryElement(-1); + } //--------------------------------------------------------------- medGeometryElement @@ -317,7 +341,210 @@ namespace return aMeshOnEntity; } - + + + PCSubProfile + CrSubProfile(const VISU::PCMesh theMesh, + const VISU::PCField theField, + const VISU::TCMeshOnEntity& theMeshOnEntity, + SALOME_MED::medGeometryElement theMGeom, + // SALOME_MED::long_array_var theGeom2Profile) + int nbElts) + { + if (MYDEBUG) MESSAGE("CrSubProfile"); + VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom); + vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom); + + PCSubProfile aSubProfile(new TCSubProfile()); + aSubProfile->myGeom = aEGeom; + aSubProfile->myMGeom = theMGeom; + aSubProfile->myStatus = eAddAll; + if(MYDEBUG) MESSAGE("theMGeom = "<myStatus = eRemoveAll; + else if( aTimeStampIter == (theMeshOnEntity.myCellsFirstIndex).end() && + theMGeom == SALOME_MED::MED_POINT1) + { + if(nbElts>0){ + aSubProfile->myName = ""; + aSubProfile->myStatus = eAddPart; + + aSubProfile->myNbCells = nbElts; + aSubProfile->myCellsSize = aSubProfile->myNbCells; + } + } + else + { + if(nbElts>0){ + aSubProfile->myName = ""; + aSubProfile->myStatus = eAddPart; + + aSubProfile->myNbCells = nbElts; + aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes; + } + } + + if (MYDEBUG) MESSAGE("CrSubProfile done"); + return aSubProfile; + } + + TProfileKey + GetProfileKey(const VISU::PCMesh theMesh, + const VISU::PCField theField, + const VISU::PCValForTime theValForTime, + const VISU::TCMeshOnEntity& theMeshOnEntity) + { + if (MYDEBUG) MESSAGE("GetProfileKey"); + + TProfileKey aProfileKey; + + const TCellsFirstIndex& aFirstIndex = theMeshOnEntity.myCellsFirstIndex; + TCellsFirstIndex::const_iterator anIter = aFirstIndex.begin(); + int aNbElts = 0; + if(anIter==aFirstIndex.end() && + (theValForTime->myField->getSupport()->getEntity() == SALOME_MED::MED_NODE)) + { + SALOME_MED::medGeometryElement aMGeom = SALOME_MED::MED_POINT1; + + try{ + aNbElts = theValForTime->myField->getSupport()->getNumberOfElements(SALOME_MED::MED_NONE); + if(MYDEBUG)MESSAGE("aMGeom="<myField->getSupport()->getNumberOfElements(aMGeom);"); + } + + PCSubProfile aSubProfile = CrSubProfile(theMesh, + theField, + theMeshOnEntity, + aMGeom, + aNbElts); + aProfileKey.insert(aSubProfile); + } + + for(; anIter != aFirstIndex.end(); anIter++){ + SALOME_MED::medGeometryElement aMGeom = anIter->first; + try{ + aNbElts = theValForTime->myField->getSupport()->getNumberOfElements(aMGeom); + if(MYDEBUG)MESSAGE("aMGeom="<myField->getSupport()->getNumberOfElements(aMGeom);"); + continue; + } + PCSubProfile aSubProfile = CrSubProfile(theMesh, + theField, + theMeshOnEntity, + aMGeom, + aNbElts); + aProfileKey.insert(aSubProfile); + } + + if (MYDEBUG) MESSAGE("GetProfileKey done"); + return aProfileKey; + } + + void + InitProfile(VISU::PCMesh theMesh, + VISU::PCField theField, + VISU::PCValForTime theValForTime, + VISU::TCMeshOnEntity& theMeshOnEntity) + { + if (MYDEBUG) MESSAGE("InitProfile"); + + TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap; + + TProfileKey aProfileKey = GetProfileKey(theMesh, + theField, + theValForTime, + theMeshOnEntity); + + TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey); + if(anIter != aProfileMap.end()){ + theValForTime->myProfile = anIter->second; + if(MYDEBUG) MESSAGE("aProfileMap.find(aProfileKey) aProfile->myGeom="); + }else{ + PCProfile aProfile(new TCProfile()); + TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; + + TProfileKey::const_iterator anIter = aProfileKey.begin(); + for(; anIter != aProfileKey.end(); anIter++){ + PCSubProfile aSubProfile(*anIter); + + if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll) + aProfile->myIsAll = false; + + VISU::EGeometry aEGeom = aSubProfile->myGeom; + aGeom2SubProfile[aEGeom] = aSubProfile; + } + + aProfileMap[aProfileKey] = aProfile; + theValForTime->myProfile = aProfile; + } + if (MYDEBUG) MESSAGE("InitProfile done"); + } + + void + LoadProfile(VISU::PCMesh theMesh, + VISU::PCField theField, + VISU::PCValForTime theValForTime, + VISU::PCMeshOnEntity theMeshOnEntity) + { + PCProfile aProfile = theValForTime->myProfile; + if (MYDEBUG) MESSAGE("LoadProfile aProfile->myIsDone="<myIsDone); + if(aProfile->myIsDone) + return; + + const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; + TGeom2SubProfile::const_iterator aGeom2SubProfileIter = aGeom2SubProfile.begin(); + if(aGeom2SubProfileIter==aGeom2SubProfile.end()){ + MESSAGE("Warning! No geom 2 sub profile"); + } + for(;aGeom2SubProfileIter!=aGeom2SubProfile.end();aGeom2SubProfileIter++){ + VISU::EGeometry aEGeom = aGeom2SubProfileIter->first; + medGeometryElement aMGeom = VISUGeomToMED(aEGeom); + PCSubProfile aSubProfile = aGeom2SubProfileIter->second; + SALOME_MED::long_array_var aGeom2ProfileIds; + std::vector aGeom2Profile; + if(!theValForTime->myField->getSupport()->isOnAllElements()){ + try{ + if(aMGeom == SALOME_MED::MED_POINT1) + aGeom2ProfileIds = theValForTime->myField->getSupport()->getNumberFromFile(SALOME_MED::MED_NONE); + else + aGeom2ProfileIds = theValForTime->myField->getSupport()->getNumberFromFile(aMGeom); + int aLen = aGeom2ProfileIds->length(); + if(MYDEBUG) MESSAGE(" - aMGeom="<" << anId << endl; + } + if(MYDEBUG) cout << endl; + } catch(...) { + continue; + } + } else { + SALOME_MED::medEntityMesh aMEntity = theValForTime->myField->getSupport()->getEntity(); + int aNbElts = theMesh->myMesh->getNumberOfElements(aMEntity,aMGeom); + for(int i=0;i0){ + TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID; + int aSize = aGeom2Profile.size(); + aSubMeshID.resize(aSize); + + + for(int anId = 0; anId < aSize; anId++){ + aSubMeshID[anId] = aGeom2Profile[anId]-1; // ENKENKENKENKENEKENKENKN + } + } + + } + + + aProfile->myIsDone = true; + if (MYDEBUG) MESSAGE("LoadProfile done"); + } } @@ -1014,6 +1241,7 @@ VISU_MEDConvertor TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect; aCell2Connect.resize(aNbElem); + if(MYDEBUG) MESSAGE("LoadPoints - aNbElem="<myNbComp; - if(theField->myEntity == NODE_ENTITY){ - VISU::EGeometry aEGeom = VISU::ePOINT1; - int aNbGauss = theValForTime->GetNbGauss(aEGeom); - const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords; - int aNbElem = aCoords.GetNbPoints(); - - if(MYDEBUG) MESSAGE("ImportField - aNbElem = "<GetMeshValue(VISU::ePOINT1); - aMeshValue.Init(aNbElem,aNbGauss,aNbComp); - for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){ - TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem); - for(int iGauss = 0; iGauss < aNbGauss; iGauss++){ - TValueSlice& aValueSlice = aValueSliceArr[iGauss]; - for(int iComp = 0; iComp < aNbComp; iComp++){ - aValueSlice[iComp] = theArray[anId++]; + + if(MYDEBUG) MESSAGE("- aNbComp = "<mySupport->getName(); + + if(theMeshOnEntity->mySupport->isOnAllElements() && + strcmp(aSupportName.in(),"SupportOnAll_MED_") > 0){ + + if(theField->myEntity == NODE_ENTITY){ + VISU::EGeometry aEGeom = VISU::ePOINT1; + int aNbGauss = theValForTime->GetNbGauss(aEGeom); + const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords; + int aNbElem = aCoords.GetNbPoints(); + + if(MYDEBUG) MESSAGE("ImportField - aNbElem = "<GetMeshValue(VISU::ePOINT1); + aMeshValue.Init(aNbElem,aNbGauss,aNbComp); + for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){ + TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem); + for(int iGauss = 0; iGauss < aNbGauss; iGauss++){ + TValueSlice& aValueSlice = aValueSliceArr[iGauss]; + for(int iComp = 0; iComp < aNbComp; iComp++){ + aValueSlice[iComp] = theArray[anId++]; + } + } + } + } else { + SALOME_MED::medGeometryElement* aGeomElems; + const TEntity& aVEntity = theField->myEntity; + int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems); + for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){ + SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom]; + VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + int aNbGauss = theValForTime->GetNbGauss(aEGeom); + const TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex; + TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMGeom); + if(aCellsFirstIndexIter != aCellsFirstIndex.end()){ + const TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second; + if(MYDEBUG) + MESSAGE("ImportField - aMGeom = "<GetMeshValue(aEGeom); + aMeshValue.Init(aNbElem,aNbGauss,aNbComp); + for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++, anId += aNbComp){ + TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem); + for(int iGauss = 0; iGauss < aNbGauss; iGauss++){ + TValueSlice& aValueSlice = aValueSliceArr[iGauss]; + for(int iComp = 0; iComp < aNbComp; iComp++) + aValueSlice[iComp] = theArray[aStart+anId+iComp]; + } + } } } } - }else{ - SALOME_MED::medGeometryElement* aGeomElems; - const TEntity& aVEntity = theField->myEntity; - int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems); - for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){ - SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom]; - VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + return 1; + } + + if(MYDEBUG) MESSAGE("Loading profile"); + theField->myDataSize = 0; + + InitProfile(theMesh,theField,theValForTime,theMeshOnEntity); + + LoadProfile(theMesh,theField,theValForTime,theMeshOnEntity); + + PCProfile aProfile = theValForTime->myProfile; + TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile; + + TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin(); + for(; anIter != aGeom2SubProfile.end(); anIter++){ + VISU::EGeometry aEGeom = anIter->first; + PCSubProfile aSubProfile(anIter->second); + + int aNbElem = aSubProfile->myNbCells; + theField->myDataSize += aNbElem*aNbComp; + + if(aSubProfile->myStatus != eRemoveAll){ int aNbGauss = theValForTime->GetNbGauss(aEGeom); - const TCMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex; - TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMGeom); - if(aCellsFirstIndexIter != aCellsFirstIndex.end()){ - const TCMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second; - if(MYDEBUG) - MESSAGE("ImportField - aMGeom = "<GetMeshValue(aEGeom); - aMeshValue.Init(aNbElem,aNbGauss,aNbComp); - for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++, anId += aNbComp){ - TValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem); - for(int iGauss = 0; iGauss < aNbGauss; iGauss++){ - TValueSlice& aValueSlice = aValueSliceArr[iGauss]; - for(int iComp = 0; iComp < aNbComp; iComp++) - aValueSlice[iComp] = theArray[aStart+anId+iComp]; + + if(MYDEBUG) MESSAGE("- aEGeom = "<myIDMapperFilter; if(anIDMapperFilter->myIsVTKDone) @@ -1339,6 +1620,11 @@ VISU_MEDConvertor theValForTime->myProfile = aProfile; SALOME_MED::FIELD_var aMEDField = theValForTime->myField; + + SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport(); + + if(aMEDSupport->isOnAllElements()) aProfile->myIsDone = true; + SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField); if(!aFieldDouble->_is_nil()){ SALOME_MED::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE); @@ -1354,5 +1640,6 @@ VISU_MEDConvertor anIDMapperFilter->myIsVTKDone = true; + MESSAGE("VISU_MEDConvertor::LoadField done"); return 1; } diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx index 97d47041..23770373 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.hxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.hxx @@ -37,6 +37,8 @@ namespace VISU { + typedef std::pair TIndexAndSize; // + typedef std::map TCellsFirstIndex; // key: SALOME_MED::medGeometryElement //--------------------------------------------------------------- struct TCMesh: virtual TMeshImpl { @@ -44,16 +46,40 @@ namespace VISU }; typedef SharedPtr PCMesh; + //--------------------------------------------------------------- + struct TCSubProfile: virtual TSubProfileImpl + { + SALOME_MED::medGeometryElement myMGeom; + }; + typedef SharedPtr PCSubProfile; //--------------------------------------------------------------- struct TCProfile: virtual TProfileImpl {}; typedef SharedPtr PCProfile; + //--------------------------------------------------------------- + struct TCGauss: virtual TGaussImpl + { + }; + typedef SharedPtr PCGauss; + + struct TCGaussSubMesh: virtual TGaussSubMeshImpl + { + }; + typedef SharedPtr PCGaussSubMesh; + //--------------------------------------------------------------- - struct TCSubMesh: virtual TSubMeshImpl + struct TCGaussMesh: virtual TGaussMeshImpl {}; + typedef SharedPtr PCGaussMesh; + + + //--------------------------------------------------------------- + struct TCSubMesh: virtual TSubMeshImpl + { + }; typedef SharedPtr PCSubMesh; @@ -61,8 +87,6 @@ namespace VISU struct TCMeshOnEntity: virtual TMeshOnEntityImpl { SALOME_MED::SUPPORT_var mySupport; - typedef std::pair TIndexAndSize; - typedef std::map TCellsFirstIndex; TCellsFirstIndex myCellsFirstIndex; }; typedef SharedPtr PCMeshOnEntity; diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index a44b5216..6d1ec82e 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -50,7 +50,7 @@ static int MYDEBUG = 0; int VISU::CutLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration, int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); } int VISU::CutLines_i::myNbPresent = 0; @@ -67,7 +67,9 @@ CutLines_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), - myCutLinesPL(NULL) + TSuperClass(theResult,theAddToStudy), + myCutLinesPL(NULL), + myUseAbsLength(false) {} @@ -78,7 +80,9 @@ CutLines_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), - myCutLinesPL(NULL) + TSuperClass(theResult,theSObject), + myCutLinesPL(NULL), + myUseAbsLength(false) { } @@ -93,7 +97,12 @@ void VISU::CutLines_i::CopyCurvesInverted(const TCurvesInv& theCurves){ VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + SetAllCurvesInverted( aResourceMgr->booleanValue("VISU", "invert_all_curves", false) ); + SetUseAbsoluteLength( aResourceMgr->booleanValue("VISU", "use_absolute_length", false) ); + + return this; } @@ -110,6 +119,8 @@ VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap) SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()), Storable::FindValue(theMap,"aRot[1][0]").toDouble(), Storable::FindValue(theMap,"aRot[1][1]").toDouble()); + SetUseAbsoluteLength(VISU::Storable::FindValue(theMap,"myUseAbsLength").toInt()); + if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt()) SetDefault(); else @@ -140,7 +151,7 @@ VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap) void VISU::CutLines_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); + TSuperClass::ToStream(theStr); int aNbLines = GetNbLines(); @@ -161,8 +172,10 @@ void VISU::CutLines_i::ToStream(std::ostringstream& theStr){ aStrPos.append(QString::number(GetLinePosition(i)) + "|"); aStrCon.append(QString::number(IsDefaultPosition(i)) + "|"); } + Storable::DataToStream( theStr, "myLinePosition", aStrPos.latin1()); Storable::DataToStream( theStr, "myLineCondition", aStrCon.latin1()); + Storable::DataToStream( theStr,"myUseAbsLength", IsUseAbsoluteLength()); // Storing the map - \a myMapCurvesInverted QString aStrCurvesInverted; @@ -284,6 +297,13 @@ void VISU::CutLines_i::SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolea myMapCurvesInverted[theCurveNumber] = theInvert; } +/*! It control the way the length of cutlines is shown: using aboslute or relative values +* \param theAbsLength - boolean value, TRUE or false. +*/ +void VISU::CutLines_i::SetUseAbsoluteLength(CORBA::Boolean theAbsLength){ + myUseAbsLength = theAbsLength; +} + /*! Checks orientation of curve. * \param theCurveNumber - integer value, number of cut line. * \retval TRUE - if line in the table is inverted, else FALSE. @@ -304,14 +324,24 @@ void VISU::CutLines_i::DoHook(){ if(!myPipeLine) myPipeLine = VISU_CutLinesPL::New(); myCutLinesPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::DoHook(); +} + +const char* +VISU::CutLines_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_CUT_LINES"; + else + return "ICON_TREE_CUT_LINES_GROUPS"; } VISU_Actor* VISU::CutLines_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2); @@ -369,18 +399,27 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<(theOrigin)){ + CutLines_i* anOrigin = const_cast(aPrs3d); + myUseAbsLength = anOrigin->IsUseAbsoluteLength(); + CopyCurvesInverted(anOrigin->GetCurvesInverted()); + } +} + diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 6464d210..1de77bdd 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -27,20 +27,19 @@ #ifndef VISU_CutLines_i_HeaderFile #define VISU_CutLines_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class VISU_CutLinesPL; namespace VISU{ - class CutLines_i : public virtual POA_VISU::CutLines, - public virtual ScalarMap_i + class VISU_I_EXPORT CutLines_i : public virtual POA_VISU::CutLines, + public virtual PrsMerger_i { static int myNbPresent; - CutLines_i(); CutLines_i(const CutLines_i&); public: - typedef ScalarMap_i TSuperClass; + typedef PrsMerger_i TSuperClass; explicit CutLines_i(Result_i* theResult, @@ -89,6 +88,9 @@ namespace VISU{ virtual void SetCurveInverted(CORBA::Long theCurveNumber,CORBA::Boolean theInvert); virtual CORBA::Boolean IsCurveInverted(CORBA::Long theCurveNumber); + virtual void SetUseAbsoluteLength(CORBA::Boolean theAbsLength); + virtual CORBA::Boolean IsUseAbsoluteLength() {return myUseAbsLength;} + virtual void SetNbLines(CORBA::Long theNb); virtual CORBA::Long GetNbLines(); typedef VISU::CutLines TInterface; @@ -101,8 +103,11 @@ namespace VISU{ protected: virtual void DoHook(); + virtual const char* GetIconName(); + VISU_CutLinesPL *myCutLinesPL; TCurvesInv myMapCurvesInverted; + CORBA::Boolean myUseAbsLength; public: static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, @@ -113,6 +118,7 @@ namespace VISU{ virtual void ToStream(std::ostringstream& theStr); virtual Storable* Restore(const Storable::TRestoringMap& theMap); + virtual void SameAs( const Prs3d_i* Origin ); virtual VISU_Actor* diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index c4b952e5..300957a4 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -43,7 +43,7 @@ static int MYDEBUG = 0; int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration, int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); } @@ -62,6 +62,7 @@ CutPlanes_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), + TSuperClass(theResult,theAddToStudy), myCutPlanesPL(NULL) {} @@ -73,6 +74,7 @@ CutPlanes_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), + TSuperClass(theResult,theSObject), myCutPlanesPL(NULL) { } @@ -81,7 +83,7 @@ CutPlanes_i(Result_i* theResult, VISU::Storable* VISU::CutPlanes_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); } @@ -105,7 +107,7 @@ VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myNbPlanes", int(GetNbPlanes())); Storable::DataToStream( theStr, "myDisplacement", GetDisplacement()); @@ -182,14 +184,24 @@ void VISU::CutPlanes_i::DoHook(){ if(!myPipeLine) myPipeLine = VISU_CutPlanesPL::New(); myCutPlanesPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::DoHook(); +} + +const char* +VISU::CutPlanes_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_CUT_PLANES"; + else + return "ICON_TREE_CUT_PLANES_GROUPS"; } VISU_Actor* VISU::CutPlanes_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "cut_planes_represent", 1); diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index de65dbb7..083e2cf2 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -27,20 +27,19 @@ #ifndef VISU_CutPlanes_i_HeaderFile #define VISU_CutPlanes_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class VISU_CutPlanesPL; namespace VISU{ - class CutPlanes_i : public virtual POA_VISU::CutPlanes, - public virtual ScalarMap_i + class VISU_I_EXPORT CutPlanes_i : public virtual POA_VISU::CutPlanes, + public virtual PrsMerger_i { static int myNbPresent; - CutPlanes_i(); CutPlanes_i(const CutPlanes_i&); public: - typedef ScalarMap_i TSuperClass; + typedef PrsMerger_i TSuperClass; explicit CutPlanes_i(Result_i* theResult, @@ -77,6 +76,8 @@ namespace VISU{ protected: virtual void DoHook(); + virtual const char* GetIconName(); + VISU_CutPlanesPL *myCutPlanesPL; public: diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 8c2920dc..eea75028 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -49,7 +49,7 @@ int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshNa const char* theFieldName, int theIteration, int isMemoryCheck) { try{ - if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0; + if(!TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0; const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName); return aField->myNbComp > 1; }catch(std::exception& exc){ @@ -74,6 +74,7 @@ DeformedShape_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), + TSuperClass(theResult,theAddToStudy), myDeformedShapePL(NULL) { if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i"); @@ -87,6 +88,7 @@ DeformedShape_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), + TSuperClass(theResult,theSObject), myDeformedShapePL(NULL) { if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i"); @@ -110,7 +112,7 @@ VISU::Storable* VISU::DeformedShape_i::Create(const char* theMeshName, VISU::Ent { myIsColored = false; myColor.R = myColor.G = myColor.B = 0.5; - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); } @@ -129,7 +131,7 @@ VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& th void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myFactor", GetScale() ); @@ -158,10 +160,21 @@ void VISU::DeformedShape_i::DoHook(){ myDeformedShapePL = dynamic_cast(myPipeLine); myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); - ScalarMap_i::DoHook(); + TSuperClass::DoHook(); } +const char* +VISU::DeformedShape_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_DEFORMED_SHAPE"; + else + return "ICON_TREE_DEFORMED_SHAPE_GROUPS"; +} + + void VISU::DeformedShape_i::SetMapScale(double theMapScale){ myDeformedShapePL->SetMapScale(theMapScale); } @@ -171,7 +184,7 @@ VISU_Actor* VISU::DeformedShape_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) { - VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO, true); + VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true); anActor->SetVTKMapping(false); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "deformed_shape_represent", 1); @@ -199,6 +212,6 @@ void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) { myPipeLine->GetMapper()->SetScalarVisibility(0); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); } - VISU::ScalarMap_i::UpdateActor(theActor); + TSuperClass::UpdateActor(theActor); } } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 42854699..e27a0e8b 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -27,20 +27,19 @@ #ifndef VISU_DeformedShape_i_HeaderFile #define VISU_DeformedShape_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class VISU_DeformedShapePL; namespace VISU{ - class DeformedShape_i : public virtual POA_VISU::DeformedShape, - public virtual ScalarMap_i + class VISU_I_EXPORT DeformedShape_i : public virtual POA_VISU::DeformedShape, + public virtual PrsMerger_i { static int myNbPresent; - DeformedShape_i(); DeformedShape_i(const DeformedShape_i&); public: - typedef ScalarMap_i TSuperClass; + typedef PrsMerger_i TSuperClass; explicit DeformedShape_i(Result_i* theResult, @@ -67,6 +66,8 @@ namespace VISU{ protected: virtual void DoHook(); + + virtual const char* GetIconName(); VISU_DeformedShapePL *myDeformedShapePL; SALOMEDS::Color myColor; diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index a2e810a8..64ac9f50 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -30,6 +30,7 @@ #include "VISU_Prs3d_i.hh" #include "VISU_Mesh_i.hh" +#include "VISU_PrsMerger_i.hh" #include "VISU_ScalarMap_i.hh" #include "VISU_IsoSurfaces_i.hh" #include "VISU_DeformedShape_i.hh" @@ -249,7 +250,27 @@ namespace VISU return thePrefix; } - + //=========================================================================== + std::string + PrsMergerToPython(SALOMEDS::SObject_ptr theSObject, + VISU::PrsMerger_i* theServant, + std::ostream& theStr, + std::string& theName, + const std::string& theConstructorName, + const std::string& theArgumentName, + std::string thePrefix) + { + thePrefix = ScalarMapToPython(theSObject,theServant,theStr,theName,theConstructorName,theArgumentName,thePrefix); + string_array_var aGroupNames = theServant->getGroupNames(); + for(int i=0; ilength(); i++) + { + theStr<GetMeshName()<<"','" + <GetScale()<<")"<IsColored()<<")"<GetColor(); @@ -299,9 +320,9 @@ namespace VISU { SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::SObject_var aFatherSObject = theSObject->GetFather(); - if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){ - SALOMEDS::AttributeComment_var aComment = - SALOMEDS::AttributeComment::_narrow(anAttr); + if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){ + SALOMEDS::AttributeString_var aComment = + SALOMEDS::AttributeString::_narrow(anAttr); CORBA::String_var aValue = aComment->Value(); Storable::TRestoringMap aMap; Storable::StrToMap(aValue.in(),aMap); @@ -716,8 +737,9 @@ namespace VISU } break; case VISU::TSCALARMAP: - if(ScalarMap_i* aServant = dynamic_cast(GetServant(anObj).in())){ - thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnField",theArgumentName,thePrefix); + case VISU::TPRSMERGER: + if(PrsMerger_i* aServant = dynamic_cast(GetServant(anObj).in())){ + thePrefix = PrsMergerToPython(theSObject,aServant,theStr,aName,"ScalarMapOnField",theArgumentName,thePrefix); theStr<(GetServant(anObj).in())){ - thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnDeformedShapeOnField",theArgumentName,thePrefix); + thePrefix = PrsMergerToPython(theSObject,aServant,theStr,aName,"ScalarMapOnDeformedShapeOnField",theArgumentName,thePrefix); theStr<GetSourceRangeMin()<<","<GetSourceRangeMax()<<")"<GetScale()<<")"<(GetServant(anObj).in())){ - thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"IsoSurfacesOnField",theArgumentName,thePrefix); + thePrefix = PrsMergerToPython(theSObject,aServant,theStr,aName,"IsoSurfacesOnField",theArgumentName,thePrefix); theStr<GetNbSurfaces()<<")"<(GetServant(anObj).in())){ - thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutPlanesOnField",theArgumentName,thePrefix); + thePrefix = PrsMergerToPython(theSObject,aServant,theStr,aName,"CutPlanesOnField",theArgumentName,thePrefix); std::string aParam; switch(aServant->GetOrientationType()){ @@ -881,7 +903,7 @@ namespace VISU return; case VISU::TCUTLINES: if(CutLines_i* aServant = dynamic_cast(GetServant(anObj).in())){ - thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"CutLinesOnField",theArgumentName,thePrefix); + thePrefix = PrsMergerToPython(theSObject,aServant,theStr,aName,"CutLinesOnField",theArgumentName,thePrefix); std::string aParam; switch(aServant->GetOrientationType()){ @@ -916,6 +938,9 @@ namespace VISU if(!aServant->IsDefault()) theStr<GetBasePlanePosition()<<")"<IsUseAbsoluteLength(); + theStr<GetNbLines(); theStr<(GetServant(anObj).in())) { - thePrefix = ScalarMapToPython(theSObject, aServant, theStr, aName,"Plot3DOnField", theArgumentName, thePrefix); + thePrefix = PrsMergerToPython(theSObject, aServant, theStr, aName,"Plot3DOnField", theArgumentName, thePrefix); std::string aParam; switch(aServant->GetOrientationType()){ @@ -1013,9 +1038,9 @@ namespace VISU case VISU::TTABLE: if(dynamic_cast(GetServant(anObj).in())){ SALOMEDS::GenericAttribute_var anAttr; - if(theSObject->FindAttribute(anAttr,"AttributeComment")){ + if(theSObject->FindAttribute(anAttr,"AttributeString")){ using namespace SALOMEDS; - AttributeComment_var aComment = AttributeComment::_narrow(anAttr); + AttributeString_var aComment = AttributeString::_narrow(anAttr); CORBA::String_var aValue = aComment->Value(); Storable::TRestoringMap aMap; Storable::StrToMap(aValue.in(),aMap); @@ -1100,9 +1125,9 @@ namespace VISU } } else { /*if(!CORBA::is_nil(anObj))*/ SALOMEDS::GenericAttribute_var anAttr; - if (theSObject->FindAttribute(anAttr,"AttributeComment")) { - SALOMEDS::AttributeComment_var aComment = - SALOMEDS::AttributeComment::_narrow(anAttr); + if (theSObject->FindAttribute(anAttr,"AttributeString")) { + SALOMEDS::AttributeString_var aComment = + SALOMEDS::AttributeString::_narrow(anAttr); CORBA::String_var aValue = aComment->Value(); Storable::TRestoringMap aMap; Storable::StrToMap(aValue.in(),aMap); @@ -1141,7 +1166,7 @@ namespace VISU theStr<SetTitle(myTitle.c_str()); + theScalarBar->SetTitle(GetScalarBarTitle().c_str()); theScalarBar->SetOrientation(myOrientation); theScalarBar->SetNumberOfLabels(myNumberOfLabels); diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index c80ef747..7284996f 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -39,13 +39,12 @@ class VISU_GaussPointsPL; namespace VISU { //! Class of the Gauss Points presentation. - class GaussPoints_i : public virtual POA_VISU::GaussPoints, + class VISU_I_EXPORT GaussPoints_i : public virtual POA_VISU::GaussPoints, public virtual VISU::TGaussPtsActorFactory, public virtual MinMaxCunsomer, public virtual ColoredPrs3d_i { static int myNbPresent; - GaussPoints_i(); GaussPoints_i(const GaussPoints_i&); public: @@ -255,6 +254,10 @@ namespace VISU void DoHook(); + virtual + const char* + GetIconName() {return "ICON_TREE_GAUSS_POINTS";} + virtual VISU_PipeLine* GetPipeLine(); diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index ebac78cb..ed164927 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -43,6 +43,7 @@ #include "VISU_Table_i.hh" #include "VISU_TimeAnimation.h" #include "VISU_ScalarMapOnDeformedShape_i.hh" +#include "VISU_PrsMerger_i.hh" #include "VISU_Actor.h" @@ -68,9 +69,10 @@ #include #include CORBA_SERVER_HEADER(SALOME_Session) #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) +#include CORBA_SERVER_HEADER(MED_Gen) // QT Includes -#include +#include #include #include @@ -112,7 +114,7 @@ static int MYDEBUG = 0; UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); -extern "C" VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB, +extern "C" VISU_I_EXPORT VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, SALOME_NamingService* theNamingService, QMutex* theMutex) @@ -202,7 +204,7 @@ namespace VISU void RegistryStorable() { Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore)); Storable::Registry(Mesh_i::myComment.c_str(),&(Restore)); - Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore)); + Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore)); Storable::Registry(GaussPoints_i::myComment.c_str(),&(Restore)); Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore)); Storable::Registry(CutPlanes_i::myComment.c_str(),&(Restore)); @@ -215,6 +217,7 @@ namespace VISU Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore)); Storable::Registry(Container_i::myComment.c_str(),&(Container_i::Restore)); Storable::Registry(ScalarMapOnDeformedShape_i::myComment.c_str(),&(Restore)); + Storable::Registry(PrsMerger_i::myComment.c_str(),&(Restore)); } @@ -252,18 +255,18 @@ namespace VISU CORBA::Double theIteration) { #ifndef _DEXCEPT_ -#ifdef NO_CAS_CATCH +# ifdef NO_CAS_CATCH try{ OCC_CATCH_SIGNALS; -#else +# else CASCatch_TRY{ try{ -#endif +# endif #endif if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration))) return true; #ifndef _DEXCEPT_ -#ifdef NO_CAS_CATCH +# ifdef NO_CAS_CATCH }catch(Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); INFOS("Follow signal was occured :\n"<GetMessageString()); @@ -272,7 +275,7 @@ namespace VISU }catch(...){ INFOS("Unknown exception was occured!"); } -#else +# else }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<GetMessageString()); } -#endif +# endif #endif return false; - } + } VISU_Gen_i::~VISU_Gen_i(){ if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); } - void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject) + void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject, SALOMEDS::StudyBuilder_ptr theBuilder) { SALOMEDS::GenericAttribute_var anAttr; - if ( theSObject->FindAttribute(anAttr, "AttributeComment") ) { - SALOMEDS::AttributeComment_var aAttComment = SALOMEDS::AttributeComment::_narrow(anAttr); + bool isAttrStringFound = false; + + if( theSObject->FindAttribute(anAttr, "AttributeComment") ) { + //SRN: Replace an AttributeComment with AttributeString + SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); + string aValue = aComment->Value(); + theBuilder->RemoveAttribute(theSObject, "AttributeComment"); + anAttr = theBuilder->FindOrCreateAttribute(theSObject, "AttributeString"); + SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); + aStringAttr->SetValue(aValue.c_str()); + isAttrStringFound = true; + + } + + if ( isAttrStringFound || theSObject->FindAttribute(anAttr, "AttributeString") ) { + SALOMEDS::AttributeString_var aAttComment = SALOMEDS::AttributeString::_narrow(anAttr); if ( aAttComment ) { string aValue = aAttComment->Value(); if ( aValue.compare("") ) { @@ -315,6 +332,7 @@ namespace VISU else if ( !aComment.compare(QString("CONTAINER")) ) aVISUType = VISU::TCONTAINER; else if ( !aComment.compare(QString("MESH")) ) aVISUType = VISU::TMESH; else if ( !aComment.compare(QString("SCALARMAP")) ) aVISUType = VISU::TSCALARMAP; + else if ( !aComment.compare(QString("PRSMERGER")) ) aVISUType = VISU::TPRSMERGER; else if ( !aComment.compare(QString("ISOSURFACE")) ) aVISUType = VISU::TISOSURFACE; else if ( !aComment.compare(QString("DEFORMEDSHAPE")) ) aVISUType = VISU::TDEFORMEDSHAPE; else if ( !aComment.compare(QString("SCALARMAPONDEFORMEDSHAPE")) ) aVISUType = VISU::TSCALARMAPONDEFORMEDSHAPE; @@ -360,12 +378,14 @@ namespace VISU SALOMEDS::Study_var aStudy = theComponent->GetStudy(); SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + for (anIter->InitEx(true); anIter->More(); anIter->Next()) { SALOMEDS::SObject_var aSObject = anIter->Value(); - CorrectSObjectType(aSObject); + CorrectSObjectType(aSObject, aStudyBuilder); } - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); TCollection_AsciiString aTmpDir (const_cast(aDir.c_str())); VisuTmpDir = aTmpDir.ToCString(); @@ -491,19 +511,22 @@ namespace VISU QString aPrefix(""); if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str(); QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str(); + QString tmpDir = QDir::convertSeparators( QString(aTmpDir.ToCString()) );; static QString aCommand; - aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1()); + aCommand.sprintf(" %s %s%s",aFileInfo.filePath().latin1(),tmpDir.latin1(),aFileName.latin1()); + aCommand = QDir::convertSeparators( aCommand ); + aCommand.prepend( COPY_COMMAND ); - int aRes = system(aCommand); - if(aRes){ + if(system(aCommand.latin1())){ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<FindComponent("MED")->_is_nil()) + { + SALOME_LifeCycleCORBA aLCC(SalomeApp_Application::namingService()); + Engines::Component_var aComponent = aLCC.FindOrLoad_Component("FactoryServer","MED"); + SALOME_MED::MED_Gen_var aMedEngine = SALOME_MED::MED_Gen::_narrow(aComponent); + + if(!CORBA::is_nil(aMedEngine)) + { + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); + aStudyBuilder->LoadWith( myStudyDocument->FindComponent( "MED" ), aMedEngine ); + } + } } else { INFOS("CORBA::is_nil(theStudy)"); } @@ -841,7 +878,8 @@ namespace VISU const char* theFieldName, CORBA::Double theIteration) { - return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn(); + //return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn(); + return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult, @@ -1100,10 +1138,11 @@ namespace VISU aFileName += aFileInfo.fileName().latin1(); static QString aCommand; string aFullFileName = aTmpDir + aFileName; - aCommand.sprintf("cp %s %s", - aFileInfo.filePath().latin1(), - aFullFileName.c_str()); - if(system(aCommand) == -1) { + aCommand.sprintf(" %s %s",aFileInfo.filePath().latin1(), aFullFileName.c_str() ); + aCommand = QDir::convertSeparators( aCommand ); + aCommand.prepend( COPY_COMMAND ); + + if(system(aCommand.latin1()) == -1) { if(MYDEBUG) MESSAGE("VISU_Gen_i::Copy - Cann't execute the command :"<FindOrCreateAttribute(aResultSO, "AttributeComment"); + SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeString"); Storable* aStorable = Storable::Create(aResultSO,aFileName,aString); diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index 1a5f6f82..e2da330a 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -37,7 +37,7 @@ namespace VISU class ColoredPrs3d_i; bool - CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, + VISU_I_EXPORT CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, @@ -48,7 +48,6 @@ namespace VISU public virtual Base_i { SALOMEDS::Study_var myStudyDocument; - VISU_Gen_i(); VISU_Gen_i(const VISU::VISU_Gen_i &); public: VISU_Gen_i(CORBA::ORB_ptr theORB, diff --git a/src/VISU_I/VISU_I.hxx b/src/VISU_I/VISU_I.hxx new file mode 100755 index 00000000..9da28057 --- /dev/null +++ b/src/VISU_I/VISU_I.hxx @@ -0,0 +1,47 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VISU_I.hxx +// Author : Oleg UVAROV +// Module : VISU + +#ifndef _VISU_I_HXX_ +#define _VISU_I_HXX_ + +#ifdef WNT +# if defined VISU_I_EXPORTS +# define VISU_I_EXPORT __declspec( dllexport ) +# else +# define VISU_I_EXPORT __declspec( dllimport ) +# endif +# define COPY_COMMAND "copy /Y" +# define MOVE_COMMAND "move /Y" +# define DELETE_COMMAND "del /F" +#else +# define VISU_I_EXPORT +# define COPY_COMMAND "cp" +# define MOVE_COMMAND "mv" +# define DELETE_COMMAND "rm -f" +#endif + + + +#endif \ No newline at end of file diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 0f0077bc..03559ba3 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -43,7 +43,7 @@ static int MYDEBUG = 0; int VISU::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration, int isMemoryCheck) { - return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); + return TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck); } int VISU::IsoSurfaces_i::myNbPresent = 0; @@ -60,6 +60,7 @@ IsoSurfaces_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), + TSuperClass(theResult,theAddToStudy), myIsoSurfacesPL(NULL) {} @@ -71,6 +72,7 @@ IsoSurfaces_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), + TSuperClass(theResult,theSObject), myIsoSurfacesPL(NULL) { } @@ -79,7 +81,7 @@ IsoSurfaces_i(Result_i* theResult, VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); } @@ -96,7 +98,7 @@ VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theM } void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){ - ScalarMap_i::ToStream(theStr); + TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myNbSurface", int(GetNbSurfaces()) ); Storable::DataToStream( theStr, "myRange[0]", GetSubMin() ); @@ -135,15 +137,24 @@ void VISU::IsoSurfaces_i::DoHook(){ if(!myPipeLine) myPipeLine = VISU_IsoSurfacesPL::New(); myIsoSurfacesPL = dynamic_cast(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::DoHook(); } +const char* +VISU::IsoSurfaces_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_ISO_SURFACES"; + else + return "ICON_TREE_ISO_SURFACES_GROUPS"; +} VISU_Actor* VISU::IsoSurfaces_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2); diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 56db9093..a4fc56b9 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -27,20 +27,19 @@ #ifndef VISU_IsoSurfaces_i_HeaderFile #define VISU_IsoSurfaces_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class VISU_IsoSurfacesPL; namespace VISU{ - class IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces, - public virtual ScalarMap_i + class VISU_I_EXPORT IsoSurfaces_i : public virtual POA_VISU::IsoSurfaces, + public virtual PrsMerger_i { static int myNbPresent; - IsoSurfaces_i(); IsoSurfaces_i(const IsoSurfaces_i&); public: - typedef ScalarMap_i TSuperClass; + typedef PrsMerger_i TSuperClass; explicit IsoSurfaces_i(Result_i* theResult, @@ -64,6 +63,8 @@ namespace VISU{ protected: virtual void DoHook(); + virtual const char* GetIconName(); + VISU_IsoSurfacesPL* myIsoSurfacesPL; public: diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index ababd507..c10839bf 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -96,6 +96,10 @@ void VISU::Mesh_i::RemoveFromStudy() } }; + // Unset icon + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + aStudyBuilder->RemoveAttribute(GetSObject(), "AttributePixMap"); + ProcessVoidEvent(new TRemoveFromStudy(this)); } @@ -294,6 +298,15 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) CORBA::String_var aString = GetID(); anIOR->SetValue(aString); } + + // Set icon + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + aPixmap->SetPixMap("ICON_TREE_MESH"); + }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<(myPipeLine); - ScalarMap_i::DoHook(); + TSuperClass::DoHook(); +} + +const char* +VISU::Plot3D_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_PLOT_3D"; + else + return "ICON_TREE_PLOT_3D_GROUPS"; } VISU_Actor* VISU::Plot3D_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { - if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "plot3d_represent", 2); diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index d509b545..d7453f57 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -21,20 +21,19 @@ #ifndef VISU_Plot3D_i_HeaderFile #define VISU_Plot3D_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class VISU_Plot3DPL; namespace VISU { - class Plot3D_i : public virtual POA_VISU::Plot3D, - public virtual ScalarMap_i + class VISU_I_EXPORT Plot3D_i : public virtual POA_VISU::Plot3D, + public virtual PrsMerger_i { static int myNbPresent; - Plot3D_i(); Plot3D_i(const Plot3D_i&); public: - typedef ScalarMap_i TSuperClass; + typedef PrsMerger_i TSuperClass; explicit Plot3D_i (Result_i* theResult, bool theAddToStudy = true); @@ -75,6 +74,8 @@ namespace VISU { protected: virtual void DoHook(); + virtual const char* GetIconName(); + VISU_Plot3DPL *myPlot3DPL; public: diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 70d0e429..461b04f4 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -91,18 +91,36 @@ VISU::Prs3d_i } } +struct TRemoveActorsFromRendererEvent: public SALOME_Event +{ + typedef boost::signal0 TRemoveActorsFromRendererSignalType; + const TRemoveActorsFromRendererSignalType& myRemoveActorsFromRendererSignalVar; + + TRemoveActorsFromRendererEvent + (const TRemoveActorsFromRendererSignalType& theRemoveActorsFromRendererSignalVar): + myRemoveActorsFromRendererSignalVar(theRemoveActorsFromRendererSignalVar) + {} + + virtual + void + Execute() + { + myRemoveActorsFromRendererSignalVar(); + } +}; + VISU::Prs3d_i -::~Prs3d_i() +::~Prs3d_i() { if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<Delete(); myResult->Destroy(); } //---------------------------------------------------------------------------- -VISU::Storable* +VISU::Storable* VISU::Prs3d_i ::Restore(const Storable::TRestoringMap& theMap) { @@ -125,7 +143,7 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- -SALOMEDS::SObject_var +SALOMEDS::SObject_var VISU::Prs3d_i ::GetSObject() { @@ -137,25 +155,25 @@ VISU::Prs3d_i return mySObject; } -Result_i* +Result_i* VISU::Prs3d_i -::GetResult() const -{ +::GetResult() const +{ return myResult; } -const std::string& +const std::string& VISU::Prs3d_i -::GetMeshName() const -{ - return myMeshName; +::GetMeshName() const +{ + return myMeshName; } //---------------------------------------------------------------------------- void VISU::Prs3d_i -::Update() +::Update() { if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<GetMapper(); vtkDataSet *aDataSet = aMapper->GetInput(); @@ -185,7 +203,7 @@ VISU::Prs3d_i void VISU::Prs3d_i -::RemoveFromStudy() +::RemoveFromStudy() { struct TRemoveFromStudy: public SALOME_Event { @@ -198,7 +216,7 @@ VISU::Prs3d_i myRemovable(theRemovable), myRemoveFromStudySignal(theRemoveFromStudySignal) {} - + virtual void Execute() @@ -213,21 +231,21 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- -VISU_PipeLine* +VISU_PipeLine* VISU::Prs3d_i ::GetPipeLine() { return GetPL(); } -VISU_PipeLine* +VISU_PipeLine* VISU::Prs3d_i ::GetPL() { return myPipeLine; } -vtkUnstructuredGrid* +vtkUnstructuredGrid* VISU::Prs3d_i:: GetInput() { @@ -274,7 +292,7 @@ VISU::Prs3d_i void VISU::Prs3d_i -::RemoveActor(VISU_Actor* theActor) +::RemoveActor(VISU_Actor* theActor) { if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "< +#include +#include +#include + +using namespace VISU; +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +static int INCMEMORY = 4; + +int VISU::PrsMerger_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, int theIteration, int isMemoryCheck) +{ + try{ + float aSize = INCMEMORY* + theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration); + bool aResult = true; + if(isMemoryCheck){ + aResult = VISU_PipeLine::CheckAvailableMemory(aSize); + MESSAGE("PrsMerger_i::IsPossible - CheckAvailableMemory = "<GetStudyDocument()), + Prs3d_i(theResult,theAddToStudy), + ColoredPrs3d_i(theResult,theAddToStudy), + ScalarMap_i(theResult,theAddToStudy), + myPrsMergerPL(NULL), + myScalarsPL(VISU_ScalarMapPL::New()) +{ +} + +VISU::PrsMerger_i:: +PrsMerger_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject): + PrsObject_i(theResult->GetStudyDocument()), + Prs3d_i(theResult,theSObject), + ColoredPrs3d_i(theResult,theSObject), + ScalarMap_i(theResult,theSObject), + myPrsMergerPL(NULL), + myScalarsPL(VISU_ScalarMapPL::New()) +{ +} + +VISU::Storable* VISU::PrsMerger_i::Create(const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, int theIteration) +{ + if (MYDEBUG) MESSAGE("PrsMerger_i::Create"); + myIsColored = true; + myColor.R = myColor.G = myColor.B = 0.5; + VISU::Storable* aRes = TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration); + this->SetScalarMap(theMeshName,theEntity,theFieldName,theIteration); + + return aRes; +} + +VISU::Storable* VISU::PrsMerger_i::Restore(const Storable::TRestoringMap& theMap) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::Restore"); + + TSuperClass::Restore(theMap); + + SetScalarMap(myMeshName.c_str(), + VISU::Entity(myEntity), + myFieldName.c_str(), + myIteration); + // myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1(); + QStringList aStrSubMeshName = QStringList::split("|",VISU::Storable::FindValue(theMap,"myGeomNameList") ); + QStringList aStrEntity = QStringList::split("|",VISU::Storable::FindValue(theMap,"myGeomEntityList") ); + int aC1 = aStrSubMeshName.count(); + int aC2 = aStrEntity.count(); + if(aC1 != aC2){ + // warning situation + return this; + } + if(aC1 == 1) + if(aStrSubMeshName[0] == QString("NULL")) + return this; + + for(int i=0;i < aC2;i++){ + std::string aSubMeshName = aStrSubMeshName[i]; + int aEntity = aStrEntity[i].toInt(); + if(aEntity == -1){ + // add group + AddMeshOnGroup(myMeshName.c_str(), + aSubMeshName.c_str()); + } else if (aEntity >= 0){ + // entity and family + if(aSubMeshName == ""){ + // entity + SetMeshOnEntity(myMeshName.c_str(), + VISU::Entity(aEntity)); + } else { + // family + SetFamilyOnEntity(myMeshName.c_str(), + VISU::Entity(aEntity), + aSubMeshName.c_str()); + } + + } + } + + return this; +} + +void +VISU::PrsMerger_i +::SetMapScale(double theMapScale) +{ + myPrsMergerPL->SetMapScale(theMapScale); +} + +void VISU::PrsMerger_i::ToStream(std::ostringstream& theStr) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::ToStream:"); + TSuperClass::ToStream(theStr); + + QString aStrSubMeshName,aStrEntity; + TNameAndEntityList::iterator aIter = myGeomNameEntityList.begin(); + for(;aIter!=myGeomNameEntityList.end();aIter++){ + std::string aStr = aIter->first + "|"; + aStrSubMeshName.append(aStr.c_str()); + aStrEntity.append(QString::number(aIter->second) + "|"); + } + + Storable::DataToStream( theStr, "myMeshName", myMeshName.c_str() ); + Storable::DataToStream( theStr, "myGeomNameList", aStrSubMeshName.latin1()); + Storable::DataToStream( theStr, "myGeomEntityList", aStrEntity.latin1()); + +} + +void VISU::PrsMerger_i::clearMeshList() +{ + VISU_PrsMergerPL::TPipeLines::const_iterator aIter = myMeshPLList.begin(); + for(int i=0;aIter != myMeshPLList.end();aIter++,i++){ + ((*aIter).GetPointer())->Delete(); + } + myMeshPLList.clear(); + myGeomNameEntityList.clear(); +} + +void VISU::PrsMerger_i::RemoveAllGeom() +{ + clearMeshList(); + myPrsMergerPL->RemoveAllGeom(); + + UpdateIcon(); +} + + +VISU::PrsMerger_i::~PrsMerger_i(){ + if(MYDEBUG) if (MYDEBUG) MESSAGE("PrsMerger_i::~PrsMerger_i()"); + this->clearMeshList(); +} + +void +VISU::PrsMerger_i +::SameAs(const Prs3d_i* theOrigin) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs: this="<(theOrigin)){ + PrsMerger_i* anOrigin = const_cast(aPrs3d); + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SameAs: theOrigin="<SetScalarMap(myMeshName.c_str(),VISU::Entity(myEntity),myFieldName.c_str(),myIteration); + string_array_var aGroupNames = anOrigin->getGroupNames(); + RemoveAllGeom(); + for(int i=0;ilength();i++){ + this->AddMeshOnGroup(myMeshName.c_str(),aGroupNames[i]); + } + Update(); + } +} + +VISU_Actor* +VISU::PrsMerger_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::CreateActor this="<GetInput()->GetMeshOnGroup(theMeshName,theGroupName); + + VISU_MeshPL* aTmpMesh = VISU_MeshPL::New(); + aTmpMesh->SetIDMapper(anIDMapper); + + if(myPrsMergerPL->SetGeometry(aTmpMesh)){ + this->clearMeshList(); + myMeshPLList.push_back(aTmpMesh); + TPairStringAndInt aPair((std::string)theGroupName,-1); + myGeomNameEntityList.push_back(aPair); + } + else + aTmpMesh->Delete(); + + UpdateIcon(); +} + +CORBA::Long +VISU::PrsMerger_i:: +AddMeshOnGroup(const char* theMeshName, + const char* theGroupName) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::AddMeshOnGroup |"<< theGroupName <<"| this="<GetInput()->GetMeshOnGroup(theMeshName,theGroupName); + if(!anIDMapper) + MESSAGE("Warning: There are no mesh with group=|"<Delete(); +} + +void +VISU::PrsMerger_i:: +SetScalarMap(const char* theMeshName, + const VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theStampsNum) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap this="<GetInput()->GetTimeStampOnMesh(theMeshName,(VISU::TEntity)theEntity,theFieldName,int(theStampsNum)); + + myEntity = (VISU::TEntity)theEntity; + myFieldName = theFieldName; + myIteration = theStampsNum; + + myScalarsPL->SetIDMapper(anIDMapper); + myPrsMergerPL->SetScalars(myScalarsPL); +} + +void +VISU::PrsMerger_i:: +SetScalarMap(VISU_PipeLine* thePipeLine) +{ + if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap"); + VISU_ScalarMapPL* aInputScalars = dynamic_cast(thePipeLine); + VISU::PIDMapper anIDMapper = aInputScalars->GetIDMapper(); + myScalarsPL->SetIDMapper(anIDMapper); + if(aInputScalars) + myPrsMergerPL->SetScalars(myScalarsPL); +} + +void +VISU::PrsMerger_i:: +RemoveGeometryByName(const char* theName) +{ + // not implemented yet. +} + +void +VISU::PrsMerger_i:: +RemoveGeometryById(CORBA::Long theId) +{ + if(myGeomNameEntityList.size() != myMeshPLList.size()){ + // warning situation. Some information lost + // check myGeomNameEntityList and myMeshPLList + } + + if(theId >=0 && (int)theId < myMeshPLList.size()){ + VISU_PrsMergerPL::TPipeLines::iterator aIter = myMeshPLList.begin(); + for(;aIter != myMeshPLList.end();aIter++){ + if( myMeshPLList[theId] == (*aIter)){ + myMeshPLList.erase(aIter); + break; + } + } + } + if(theId >=0 && (int)theId < myGeomNameEntityList.size()){ + TNameAndEntityList::iterator aIter = myGeomNameEntityList.begin(); + for(;aIter != myGeomNameEntityList.end();aIter++){ + if( myGeomNameEntityList[theId] == (*aIter) ){ + myGeomNameEntityList.erase(aIter); + break; + } + } + } + myPrsMergerPL->RemoveGeometryById((int)theId); +} + +void +VISU::PrsMerger_i +::DoHook(){ + if(!myPipeLine) myPipeLine = VISU_PrsMergerPL::New(); + myPrsMergerPL = dynamic_cast(myPipeLine); + myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); + TSuperClass::DoHook(); +} + +const char* +VISU::PrsMerger_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_SCALAR_MAP"; + else + return "ICON_TREE_SCALAR_MAP_GROUPS"; +} + +void VISU::PrsMerger_i +::UpdateIcon() +{ + if (mySObject->_is_nil()) + return; + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); + + // Check if the icon needs to be updated, update if necessary + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + + if ( aPixmap->GetPixMap() != (std::string)GetIconName() ) + aPixmap->SetPixMap(GetIconName()); + + // Update Object Browser + SUIT_Session* aSession = SUIT_Session::session(); + QPtrList anApplications = aSession->applications(); + QPtrListIterator anIter (anApplications); + while (SUIT_Application* aSApp = anIter.current()) { + SalomeApp_Application* anApp = dynamic_cast(aSApp); + if (!anApp) return; + SalomeApp_Study* aStudy = dynamic_cast(anApp->activeStudy()); + if (!aStudy) return; + if (_PTR(Study) aCStudy = aStudy->studyDS()) { + if (myStudy->StudyId() == aCStudy->StudyId()) { + anApp->updateObjectBrowser(); + break; + } + } + ++anIter; + } +} + +CORBA::Long +VISU::PrsMerger_i +::GetNumberOfGeom() +{ + if(myPrsMergerPL) + return myPrsMergerPL->GetNbGeometry(); + else + return 0; +} + +string_array* +VISU::PrsMerger_i +::getGroupNames() +{ + string_array_var myseq = new string_array; + if(myPrsMergerPL){ + vector aGroupNames; + TNameAndEntityList::const_iterator aIter = myGeomNameEntityList.begin(); + for(;aIter!=myGeomNameEntityList.end();aIter++){ + TPairStringAndInt aPair = (*aIter); + if(aPair.second == -1) + aGroupNames.push_back(aPair.first); + } + myseq->length(aGroupNames.size()); + vector::const_iterator aNamesIter = aGroupNames.begin(); + for(int i=0;aNamesIter!=aGroupNames.end();i++,aNamesIter++){ + myseq[i] = CORBA::string_dup((*aNamesIter).c_str()); + } + } + return myseq._retn(); +} + +bool +VISU::PrsMerger_i +::CheckGroup(const char* theGroupName) +{ + if (MYDEBUG) MESSAGE("PrsMerger_i::CheckGroup :|"<GetInput()->GetMeshOnGroup(aMeshName,theGroupName); + if (MYDEBUG) MESSAGE("anIDMapper="<GetVTKOutput()->GetNumberOfCells()>0){ + int aVtkCellType = anIDMapper->GetVTKOutput()->GetCellType(0); + if (MYDEBUG) MESSAGE("CellType="< TPairStringAndInt; + typedef std::vector TNameAndEntityList; + + explicit + PrsMerger_i(Result_i* theResult, + bool theAddToStudy); + explicit + PrsMerger_i(Result_i* theResult, + SALOMEDS::SObject_ptr theSObject); + virtual void SameAs(const Prs3d_i* theOrigin); + virtual ~PrsMerger_i(); + + virtual VISU::VISUType GetType() { return VISU::TPRSMERGER;}; + + virtual CORBA::Boolean IsColored() { return myIsColored; } + virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; } + + virtual SALOMEDS::Color GetColor() { return myColor;} + virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;} + + VISU_PrsMergerPL* GetPrsMergerPL(){ return myPrsMergerPL;} + + protected: + virtual void DoHook(); + virtual const char* GetIconName(); + void UpdateIcon(); + void clearMeshList(); + + VISU_PrsMergerPL* myPrsMergerPL; + VISU_PrsMergerPL::TPipeLines myMeshPLList; + VISU_ScalarMapPL* myScalarsPL; + + SALOMEDS::Color myColor; + bool myIsColored; + + /*! Warning! This variable must be maked as list, if + * you we will need in different mesh entities (ENTITY,FAMILY,GROUP) as geometries. + */ + TNameAndEntityList myGeomNameEntityList; + + public: + static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, int theIteration, int isMemoryCheck = true); + + virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity, + const char* theFieldName, int theIteration); + + virtual void ToStream(std::ostringstream& theStr); + + virtual Storable* Restore(const Storable::TRestoringMap& theMap); + + virtual + void + SetMapScale(double theMapScale = 1.0); + + static const std::string myComment; + virtual const char* GetComment() const; + virtual QString GenerateName(); + + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + + virtual + VISU_Actor* + CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking); + + virtual void UpdateActor(VISU_Actor* theActor) ; + + /*! + * Sets geometry of mesh as group + */ + virtual void SetMeshOnGroup(const char* theMeshName, + const char* theGroupName); + + /*! + * Add geometry of mesh as group + * \retval the id of added group. + */ + virtual CORBA::Long AddMeshOnGroup(const char* theMeshName, + const char* theGroupName); + + /*! + * Remove geometry from list by Name + */ + virtual void RemoveGeometryByName(const char* theName); + + /*! + * Removes geometry from list by id + * Note: theId number in [0,...] + * + * Waring: if you delete not 0 element, others indexes will be increased. + * Example: + * 0,1,2,3,4 - indexes + * remove 2 index + * new sequence: + * 0,1,2,3,4 , where are 0 = 0, 1 = 1, 3 = 2, 4 = 3. + */ + virtual void RemoveGeometryById(CORBA::Long theId); + + + /*! + * Sets geometry of mesh as family on entity + */ + virtual void SetFamilyOnEntity(const char* theMeshName, + const VISU::Entity theEntity, + const char* theFamilyName); + + /*! + * Sets geometry of mesh as mesh on entity + */ + virtual void SetMeshOnEntity(const char* theMeshName, + const VISU::Entity theEntity); + + + /*! + * Sets scalars as scalar map + */ + virtual void SetScalarMap(const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theStampsNum); + + /*! + * Get number of geometries. + */ + CORBA::Long GetNumberOfGeom(); + + + /*! + * Get group names. + */ + string_array* getGroupNames(); + + /*! + * Sets scalars as scalar map + */ + void SetScalarMap(VISU_PipeLine* thePipeLine); + + /*! + * Removes all geometries. + */ + virtual void RemoveAllGeom(); + + + /*! Warning! + * see \a myGeomNameEntityList + */ + virtual CORBA::Long GetMeshGeometryPlace(CORBA::Long theId){return CORBA::Long(1);};// must bee filled + + /*! + * Return true, if group is good, esle false. + * May be used, if SetScalarMap(...) olready . + */ + bool CheckGroup(const char* theGroupName); + + }; + +} + +#endif diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index 31e7f714..c9bc3de6 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -30,7 +30,7 @@ #include "VISUConfig.hh" namespace VISU{ - class PrsObject_i : public virtual POA_VISU::PrsObject, + class VISU_I_EXPORT PrsObject_i : public virtual POA_VISU::PrsObject, public virtual RemovableObject_i { PrsObject_i(const PrsObject_i&); diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index db7457fb..908ab06a 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -52,6 +52,7 @@ #include #include #include +#include // VTK Includes #include @@ -247,8 +248,8 @@ namespace VISU aName->SetValue(theName); } if (theComment != "") { - anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeComment"); - _PTR(AttributeComment) aCmnt (anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeString"); + _PTR(AttributeString) aCmnt (anAttr); aCmnt->SetValue(theComment); } return aNewObj->GetID(); @@ -281,8 +282,8 @@ namespace VISU aName->SetValue(theName); } if (theComment != "") { - anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeComment"); - _PTR(AttributeComment) aCmnt (anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeString"); + _PTR(AttributeString) aCmnt (anAttr); aCmnt->SetValue(theComment); } } @@ -1039,11 +1040,22 @@ VISU::Result_i theIsAtOnce = true; if(Build(SALOMEDS::SObject::_nil(),theIsAtOnce)){ + + // Set icon + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributePixMap_var aPixmap; + + anAttr = aStudyBuilder->FindOrCreateAttribute( mySObject, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + aPixmap ->SetPixMap("ICON_TREE_RESULT"); + if(theIsBuildAll) return BuildAll(); return true; } - + return false; } @@ -1166,8 +1178,11 @@ Create(const char* theFileName) if(mySourceId == eRestoredFile){ std::string aTmpDir(SALOMEDS_Tool::GetTmpDir()); static QString aCommand; - aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.c_str()); - if(system(aCommand) == -1){ + aCommand.sprintf(" %s %s", myFileInfo.absFilePath().latin1(), aTmpDir.c_str() ); + aCommand = QDir::convertSeparators( aCommand ); + aCommand.prepend( COPY_COMMAND ); + + if(system(aCommand.latin1()) == -1){ MESSAGE("Create - Can't execute the command :"<FindAttribute(anAttr, "AttributeComment")) - throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!"); - SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr); + if (!theSObject->FindAttribute(anAttr, "AttributeString")) + throw std::runtime_error("Build - There is no AttributeString for the SObject !!!"); + SALOMEDS::AttributeString_var aCmnt = SALOMEDS::AttributeString::_narrow(anAttr); aCmnt->SetValue(aComment.latin1()); } bool anIsBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false); @@ -1547,10 +1568,20 @@ VISU::Result_i MESSAGE("Result_i::~Result_i() - this = "<second; - VISU::PIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName, - CELL_ENTITY); - VISU::TVTKOutput* aMesh = anIDMapper->GetVTKOutput(); + if(!theMesh->IsStructured() || theMesh->myType){ - if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) { - MESSAGE( "No cells in the mesh: " << theMeshName ); - return components; - } - - // define axis directions and min cell size in each direction - const int nbAxes = 3; - int iAx; - gp_Vec axDirs[ nbAxes ]; - float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX }; - bool axesComputed = false; - for ( vtkIdType iCell = 0; iCell < aMesh->GetNumberOfCells(); ++iCell ) - { - vtkCell* cell = aMesh->GetCell( iCell ); - int nbPnt = cell->GetNumberOfPoints(); - if ( nbPnt != 8 ) - continue; - vtkPoints * points = cell->GetPoints(); - vtkFloatingPointType* coords[ 4 ]; - coords[0] = points->GetPoint( 0 ); - coords[1] = points->GetPoint( 1 ); - coords[2] = points->GetPoint( 3 ); - coords[3] = points->GetPoint( 4 ); - gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] ); - for ( iAx = 0; iAx < nbAxes; ++iAx ) - { - vtkFloatingPointType* coo = coords[ iAx + 1 ]; - gp_Pnt p( coo[0], coo[1], coo[2] ); - // min size - vtkFloatingPointType size = p0.SquareDistance( p ); - if ( size > FLT_MIN && size < minSize[ iAx ] ) - minSize[ iAx ] = size; - // axis direction - if ( !axesComputed ) { - gp_Vec dir( p0, p ); - if ( dir.SquareMagnitude() <= DBL_MIN ) - break; - axDirs[ iAx ] = dir; - } + VISU::PIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName, + CELL_ENTITY); + + VISU::TVTKOutput* aMesh = anIDMapper->GetVTKOutput(); + + if ( !aMesh || aMesh->GetNumberOfCells() == 0 ) { + MESSAGE( "No cells in the mesh: " << theMeshName ); + return components; } - if ( iAx == nbAxes ) - axesComputed = true; - } - if ( !axesComputed ) { - MESSAGE("No good hexahedrons in the mesh: " << theMeshName ); - return components; - } - - // compute axes dirs - gInfo = & myMeshName2GridInfoMap[ theMeshName ]; - for ( iAx = 0; iAx < nbAxes; ++iAx ) - { - int iPrev = ( iAx == 0 ) ? 2 : iAx - 1; - int iNext = ( iAx == 2 ) ? 0 : iAx + 1; - gInfo->myAxis[ iAx ] = axDirs[ iPrev ] ^ axDirs[ iNext ]; - } - - // get and sort intermediate component values - projections of nodes - // on axis direction; define bnd box - set< vtkFloatingPointType > comps[ 3 ]; - Bnd_Box box; - vtkPoints * points = aMesh->GetPoints(); - vtkIdType iP, nbP = aMesh->GetNumberOfPoints(); - for ( iP = 0; iP < nbP; ++iP ) - { - vtkFloatingPointType* coo = points->GetPoint( iP ); - gp_Pnt p( coo[0], coo[1], coo[2] ); - box.Add( p ); + + // define axis directions and min cell size in each direction + const int nbAxes = 3; + int iAx; + gp_Vec axDirs[ nbAxes ]; + float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX }; + bool axesComputed = false; + for ( vtkIdType iCell = 0; iCell < aMesh->GetNumberOfCells(); ++iCell ) + { + vtkCell* cell = aMesh->GetCell( iCell ); + int nbPnt = cell->GetNumberOfPoints(); + if ( nbPnt != 8 ) + continue; + vtkPoints * points = cell->GetPoints(); + vtkFloatingPointType* coords[ 4 ]; + coords[0] = points->GetPoint( 0 ); + coords[1] = points->GetPoint( 1 ); + coords[2] = points->GetPoint( 3 ); + coords[3] = points->GetPoint( 4 ); + gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] ); + for ( iAx = 0; iAx < nbAxes; ++iAx ) + { + vtkFloatingPointType* coo = coords[ iAx + 1 ]; + gp_Pnt p( coo[0], coo[1], coo[2] ); + // min size + vtkFloatingPointType size = p0.SquareDistance( p ); + if ( size > FLT_MIN && size < minSize[ iAx ] ) + minSize[ iAx ] = size; + // axis direction + if ( !axesComputed ) { + gp_Vec dir( p0, p ); + if ( dir.SquareMagnitude() <= DBL_MIN ) + break; + axDirs[ iAx ] = dir; + } + } + if ( iAx == nbAxes ) + axesComputed = true; + } + if ( !axesComputed ) { + MESSAGE("No good hexahedrons in the mesh: " << theMeshName ); + return components; + } + + // compute axes dirs + gInfo = & myMeshName2GridInfoMap[ theMeshName ]; + for ( iAx = 0; iAx < nbAxes; ++iAx ) + { + int iPrev = ( iAx == 0 ) ? 2 : iAx - 1; + int iNext = ( iAx == 2 ) ? 0 : iAx + 1; + gInfo->myAxis[ iAx ] = axDirs[ iPrev ] ^ axDirs[ iNext ]; + } + + // get and sort intermediate component values - projections of nodes + // on axis direction; define bnd box + set< vtkFloatingPointType > comps[ 3 ]; + Bnd_Box box; + vtkPoints * points = aMesh->GetPoints(); + vtkIdType iP, nbP = aMesh->GetNumberOfPoints(); + for ( iP = 0; iP < nbP; ++iP ) + { + vtkFloatingPointType* coo = points->GetPoint( iP ); + gp_Pnt p( coo[0], coo[1], coo[2] ); + box.Add( p ); + for ( iAx = 0; iAx < nbAxes; ++iAx ) { + const gp_Dir& dir = gInfo->myAxis[ iAx ]; + vtkFloatingPointType dot = dir.XYZ() * p.XYZ(); + comps[ iAx ].insert( dot ); + } + } + + // find a range of projections of bnd box corners on each axis + vtkFloatingPointType range[3], firstValue[3]; + double x[2],y[2],z[2]; + box.Get(x[0],y[0],z[0],x[1],y[1],z[1]); for ( iAx = 0; iAx < nbAxes; ++iAx ) { - const gp_Dir& dir = gInfo->myAxis[ iAx ]; - vtkFloatingPointType dot = dir.XYZ() * p.XYZ(); - comps[ iAx ].insert( dot ); + set< vtkFloatingPointType > bndComps; + const gp_Dir& dir = gInfo->myAxis[ iAx ]; + for ( int iX = 0; iX < 2; ++iX ) { + for ( int iY = 0; iY < 2; ++iY ) { + for ( int iZ = 0; iZ < 2; ++iZ ) { + gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] ); + vtkFloatingPointType dot = dir.XYZ() * p.XYZ(); + bndComps.insert( dot ); + } + } + } + firstValue[ iAx ] = *bndComps.begin(); + range[ iAx ] = *bndComps.rbegin() - *bndComps.begin(); } + + // compute component values + for ( iAx = 0; iAx < nbAxes; ++iAx ) + { + list< vtkFloatingPointType > values; + int nbVals = 0; + set< vtkFloatingPointType >& comp = comps[ iAx ]; + set< vtkFloatingPointType >::iterator val = comp.begin(); + vtkFloatingPointType bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ]; + vtkFloatingPointType tol = 0.1 * sqrt( minSize[ iAx ]) / rng; + for ( ; val != comp.end(); ++val ) { + vtkFloatingPointType value = ( *val - first ) / rng; + if ( value > bnd ) { + values.push_back( value ); + bnd = value + tol; + nbVals++; + } + } + // store values in gInfo + vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ iAx ]; + myComp.resize( nbVals ); + list< vtkFloatingPointType >::iterator v = values.begin(); + for ( int i = 0; v != values.end(); ++v ){ + myComp[ i++ ] = *v; + } + } } + else { + //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + TVectorID aIndexes = theMesh->GetStructure(); - // find a range of projections of bnd box corners on each axis - vtkFloatingPointType range[3], firstValue[3]; - double x[2],y[2],z[2]; - box.Get(x[0],y[0],z[0],x[1],y[1],z[1]); - for ( iAx = 0; iAx < nbAxes; ++iAx ) { - set< vtkFloatingPointType > bndComps; - const gp_Dir& dir = gInfo->myAxis[ iAx ]; - for ( int iX = 0; iX < 2; ++iX ) { - for ( int iY = 0; iY < 2; ++iY ) { - for ( int iZ = 0; iZ < 2; ++iZ ) { - gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] ); - vtkFloatingPointType dot = dir.XYZ() * p.XYZ(); - bndComps.insert( dot ); - } - } + VISU::PIDMapper anIDMapper = myInput->GetMeshOnEntity(theMeshName, + CELL_ENTITY); + VISU::TVTKOutput* aMesh = anIDMapper->GetVTKOutput(); + + gInfo = & myMeshName2GridInfoMap[ theMeshName ]; + switch(aIndexes.size()){ + case 3: + { + gp_Dir aDir(0.0,0.0,1.0); + gInfo->myAxis[ 2 ] = aDir; + } + case 2: + { + gp_Dir aDir(0.0,1.0,0.0); + gInfo->myAxis[ 1 ] = aDir; + } + case 1: + { + gp_Dir aDir(1.0,0.0,0.0); + gInfo->myAxis[ 0 ] = aDir; + } } - firstValue[ iAx ] = *bndComps.begin(); - range[ iAx ] = *bndComps.rbegin() - *bndComps.begin(); - } - - // compute component values - for ( iAx = 0; iAx < nbAxes; ++iAx ) - { - list< vtkFloatingPointType > values; - int nbVals = 0; - set< vtkFloatingPointType >& comp = comps[ iAx ]; - set< vtkFloatingPointType >::iterator val = comp.begin(); - vtkFloatingPointType bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ]; - vtkFloatingPointType tol = 0.1 * sqrt( minSize[ iAx ]) / rng; - for ( ; val != comp.end(); ++val ) { - vtkFloatingPointType value = ( *val - first ) / rng; - if ( value > bnd ) { - values.push_back( value ); - bnd = value + tol; - nbVals++; - } + + int nbPoints = aMesh->GetNumberOfPoints(); + vtkFloatingPointType* coords[ 2 ]; + if(nbPoints>1){ + coords[0] = aMesh->GetPoints()->GetPoint(0); + coords[1] = aMesh->GetPoints()->GetPoint(nbPoints-1); + } + + vector PointsCoords[3]; + TIdTypeVector aCoordIJK; + switch(aIndexes.size()){ + case 3: + { + vtkIdType nbZ = aIndexes[2]; + aCoordIJK.clear(); + aCoordIJK.resize(aIndexes.size(),1); + for(int i=0;iGetObjectIDByIndexes(aCoordIJK); + vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID); + vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID); + PointsCoords[2].push_back(aPCoord[2]); + } + } + case 2: + { + vtkIdType nbJ = aIndexes[1]; + aCoordIJK.clear(); + aCoordIJK.resize(aIndexes.size(),1); + for(int i=0;iGetObjectIDByIndexes(aCoordIJK); + vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID); + vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID); + PointsCoords[1].push_back(aPCoord[1]); + } + } + case 1: + { + vtkIdType nbI = aIndexes[0]; + aCoordIJK.clear(); + aCoordIJK.resize(aIndexes.size(),1); + for(int i=0;iGetObjectIDByIndexes(aCoordIJK); + vtkIdType aVTKID = anIDMapper->GetNodeVTKID(aObjID); + vtkFloatingPointType* aPCoord = aMesh->GetPoints()->GetPoint(aVTKID); + PointsCoords[0].push_back(aPCoord[0]); + } + } } - // store values in gInfo - vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ iAx ]; - myComp.resize( nbVals ); - list< vtkFloatingPointType >::iterator v = values.begin(); - for ( int i = 0; v != values.end(); ++v ) - myComp[ i++ ] = *v; + for(int i=0;i& myComp = gInfo->myComponets[ i ]; + int aSize = PointsCoords[i].size(); + if(aSize>0){ + vtkFloatingPointType aLen = PointsCoords[i][aSize-1] - PointsCoords[i][0]; + myComp.resize(aSize); + myComp[0] = 0; + for(int k=1;kGetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName); if(aField->myNbComp <= 1) @@ -84,6 +83,7 @@ ScalarMapOnDeformedShape_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), + TSuperClass(theResult,theAddToStudy), myScalarMapOnDeformedShapePL(NULL), myScalarIteration(1) { @@ -96,6 +96,7 @@ ScalarMapOnDeformedShape_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), + TSuperClass(theResult,theSObject), myScalarMapOnDeformedShapePL(NULL), myScalarIteration(1) { @@ -194,11 +195,27 @@ CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetScale(){ return myScalarMapOnDeformedShapePL->GetScale(); } +void +VISU::ScalarMapOnDeformedShape_i +::SetRange(CORBA::Double theMin, CORBA::Double theMax) +{ + if(theMin > theMax) + return; + vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; + myScalarMapOnDeformedShapePL->SetScalarRange(aScalarRange); + myIsFixedRange = true; +} + void VISU::ScalarMapOnDeformedShape_i::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange){ - vtkFloatingPointType aRange[2]; - aRange[0] = vtkFloatingPointType(theMinRange); - aRange[1] = vtkFloatingPointType(theMaxRange); - myScalarMapOnDeformedShapePL->SetScalarRange(aRange); + SetRange(theMinRange,theMaxRange); +} + +void +VISU::ScalarMapOnDeformedShape_i +::SetSourceRange() +{ + myScalarMapOnDeformedShapePL->SetSourceRange(); + myIsFixedRange = false; } CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMin(){ @@ -225,6 +242,16 @@ void VISU::ScalarMapOnDeformedShape_i::DoHook() TSuperClass::DoHook(); } +const char* +VISU::ScalarMapOnDeformedShape_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE"; + else + return "ICON_TREE_SCALAR_MAP_ON_DEFORMED_SHAPE_GROUPS"; +} + VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::CreateActor:"<<__LINE__<GetScalarMeshName()[0]; +} void VISU::ScalarMapOnDeformedShape_i::SetScalarFieldName(const char* theName){ myScalarFieldName = theName; } + std::string VISU::ScalarMapOnDeformedShape_i::GetScalarFieldName(){ return myScalarFieldName; } +char* VISU::ScalarMapOnDeformedShape_i::GetScalarCFieldName(){ + return &this->GetScalarFieldName()[0]; +} + void VISU::ScalarMapOnDeformedShape_i::SetScalarIteration(const int theValue){ myScalarIteration = theValue; } @@ -308,6 +343,10 @@ int VISU::ScalarMapOnDeformedShape_i::GetScalarIteration(){ return myScalarIteration; } +CORBA::Long VISU::ScalarMapOnDeformedShape_i::GetScalarLIteration(){ + return CORBA::Long(this->GetScalarIteration()); +} + void VISU::ScalarMapOnDeformedShape_i::SetScalarEntity(const VISU::TEntity theValue){ myScalarEntity = theValue; } @@ -330,3 +369,24 @@ VISU::ScalarMapOnDeformedShape_i { return myScalarField; } + +void +VISU::ScalarMapOnDeformedShape_i +::SetMapScale(double theMapScale) +{ + myScalarMapOnDeformedShapePL->SetMapScale(theMapScale); +} + +CORBA::Double +VISU::ScalarMapOnDeformedShape_i +::GetMin() +{ + return myScalarMapOnDeformedShapePL->GetScalarRange()[0]; +} + +CORBA::Double +VISU::ScalarMapOnDeformedShape_i +::GetMax() +{ + return myScalarMapOnDeformedShapePL->GetScalarRange()[1]; +} diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index f80fce72..f27a337e 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -27,23 +27,22 @@ #ifndef VISU_ScalarMapOnDeformedShape_i_HeaderFile #define VISU_ScalarMapOnDeformedShape_i_HeaderFile -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" class VISU_ScalarMapOnDeformedShapePL; namespace VISU{ //! Class of Scalar Map on Deformed Shape presentation. - class ScalarMapOnDeformedShape_i : public virtual POA_VISU::ScalarMapOnDeformedShape, - public virtual ScalarMap_i + class VISU_I_EXPORT ScalarMapOnDeformedShape_i : public virtual POA_VISU::ScalarMapOnDeformedShape, + public virtual PrsMerger_i { static int myNbPresent; - ScalarMapOnDeformedShape_i(); ScalarMapOnDeformedShape_i(const ScalarMapOnDeformedShape_i&); public: - typedef ScalarMap_i TSuperClass; + typedef PrsMerger_i TSuperClass; explicit ScalarMapOnDeformedShape_i(Result_i* theResult, @@ -64,6 +63,10 @@ namespace VISU{ virtual void SetScale(CORBA::Double theScale); virtual CORBA::Double GetScale(); + virtual + void + SetRange(CORBA::Double theMin, CORBA::Double theMax); + virtual CORBA::Boolean IsColored() { return myIsColored; } virtual void ShowColored(CORBA::Boolean theColored) { myIsColored = theColored; } @@ -71,6 +74,19 @@ namespace VISU{ virtual void SetColor(const SALOMEDS::Color& theColor) { myColor = theColor;} virtual void SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange); + + virtual + CORBA::Double + GetMin(); + + virtual + CORBA::Double + GetMax(); + + virtual + void + SetSourceRange(); + virtual CORBA::Double GetSourceRangeMin(); virtual CORBA::Double GetSourceRangeMax(); @@ -89,6 +105,10 @@ namespace VISU{ void DoHook(); + virtual + const char* + GetIconName(); + VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL; SALOMEDS::Color myColor; bool myIsColored; @@ -110,6 +130,11 @@ namespace VISU{ static Storable* Restore(SALOMEDS::SObject_ptr theSObject, const std::string& thePrefix, const Storable::TRestoringMap& theMap); + + virtual + void + SetMapScale(double theMapScale = 1.0); + static const std::string myComment; virtual const char* GetComment() const; @@ -131,10 +156,13 @@ namespace VISU{ virtual void SetScalarFieldName(const char* theName); virtual std::string GetScalarFieldName(); + virtual char* GetScalarCFieldName(); virtual void SetScalarIteration(const int theValue); virtual int GetScalarIteration(); + virtual CORBA::Long GetScalarLIteration(); virtual void SetScalarMeshName(const char* theName); virtual std::string GetScalarMeshName(); + virtual char* GetScalarCMeshName(); virtual void SetScalarEntity(const VISU::TEntity theValue); virtual VISU::TEntity GetScalarEntity(); virtual void SetScalarEEntity(const VISU::Entity theValue); diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index e56862cf..5e1f83c6 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -258,7 +258,7 @@ VISU::ScalarMap_i myField = anInput->GetField(myMeshName,myEntity,myFieldName); if(!myField) throw std::runtime_error("There is no Field with the parameters !!!"); - + VISU::PIDMapper anIDMapper = anInput->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration); @@ -266,7 +266,12 @@ VISU::ScalarMap_i throw std::runtime_error("There is no TimeStamp with the parameters !!!"); myScalarMapPL->SetIDMapper(anIDMapper); - myScalarMapPL->Init(); + // mkr : 23.11.2006 - PAL13908 - save animation range if range is fixed --> + if ( myIsFixedRange ) + myScalarMapPL->SetScalarMode(0); + else + myScalarMapPL->Init(); + // mkr : 23.11.2006 <-- myScalarMapPL->Build(); } @@ -339,7 +344,7 @@ VISU::ScalarMap_i if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar(); aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable()); - aScalarBar->SetTitle(myTitle.c_str()); + aScalarBar->SetTitle(GetScalarBarTitle().c_str()); // mkr : IPAL14030 aScalarBar->SetOrientation(myOrientation); aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport(); aScalarBar->GetPositionCoordinate()->SetValue(myPosition[0],myPosition[1]); diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index ef29f65f..a6652fa5 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -33,15 +33,14 @@ namespace VISU { //============================================================================ - class ScalarMap_i : public virtual POA_VISU::ScalarMap, + class VISU_I_EXPORT ScalarMap_i : public virtual POA_VISU::ScalarMap, public virtual ColoredPrs3d_i { static int myNbPresent; - ScalarMap_i(); ScalarMap_i(const ScalarMap_i&); public: - //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- typedef ColoredPrs3d_i TSuperClass; explicit diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 7aa8273b..ba959d3a 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -50,7 +50,7 @@ int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName const char* theFieldName, int theIteration, int isMemoryCheck) { try{ - if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) + if(!TSuperClass::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) return 0; VISU::PIDMapper anIDMapper = @@ -83,6 +83,7 @@ StreamLines_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), + PrsMerger_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), myStreamLinesPL(NULL), myAppendFilter(vtkAppendFilter::New()) @@ -97,6 +98,7 @@ StreamLines_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), + PrsMerger_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), myStreamLinesPL(NULL), myAppendFilter(vtkAppendFilter::New()) @@ -260,6 +262,15 @@ void VISU::StreamLines_i::DoHook(){ DeformedShape_i::DoHook(); } +const char* +VISU::StreamLines_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_STREAM_LINES"; + else + return "ICON_TREE_STREAM_LINES_GROUPS"; +} void VISU::StreamLines_i::Update() { SetSource(); diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 9c4af6fe..22f63efb 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -33,11 +33,10 @@ class VISU_StreamLinesPL; class vtkAppendFilter; namespace VISU{ - class StreamLines_i : public virtual POA_VISU::StreamLines, + class VISU_I_EXPORT StreamLines_i : public virtual POA_VISU::StreamLines, public virtual DeformedShape_i { static int myNbPresent; - StreamLines_i(); StreamLines_i(const StreamLines_i&); public: @@ -72,6 +71,9 @@ namespace VISU{ protected: virtual void DoHook(); + + virtual const char* GetIconName(); + virtual void SetSource(VISU::Prs3d_ptr thePrs3d); virtual void SetSource(VISU::Prs3d_i* thePrs3d); virtual void SetSource(); diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index cb642126..89f0576d 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -180,9 +180,9 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) else{ aComment.sprintf("myComment=%s;myType=%d;mySourceId=TableAttr",GetComment(),VISU::TTABLE); SALOMEDS::SObject_var aFatherSObject = SO->GetFather(); - if(aFatherSObject->FindAttribute(anAttr,"AttributeComment")){ - SALOMEDS::AttributeComment_var aCommentAttr = - SALOMEDS::AttributeComment::_narrow(anAttr); + if(aFatherSObject->FindAttribute(anAttr,"AttributeString")){ + SALOMEDS::AttributeString_var aCommentAttr = + SALOMEDS::AttributeString::_narrow(anAttr); CORBA::String_var aValue = aCommentAttr->Value(); Storable::TRestoringMap aMap; Storable::StrToMap(aValue.in(),aMap); @@ -212,7 +212,15 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) // mpv (PAL5357): reference attributes are unnecessary now //SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj ); //Builder->Addreference( refSO, SO ); - } + } + + // Set icon + SALOMEDS::AttributePixMap_var aPixmap; + + anAttr = Builder->FindOrCreateAttribute( mySObj, "AttributePixMap" ); + aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); + aPixmap->SetPixMap("ICON_TREE_TABLE"); + return this; } return NULL; @@ -385,6 +393,16 @@ VISU::Storable* VISU::Curve_i::Build(int theRestoring ) true ); // create SObject referenced to real table object mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str())); + + // Set icon + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->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; } @@ -897,6 +915,16 @@ VISU::Storable* VISU::Container_i::Build( int theRestoring ) aComment.latin1(), true ); mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str())); + + // Set icon + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->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; } @@ -1248,8 +1276,8 @@ SALOMEDS::SObject_var VISU::ImportTables(const char* theFileName, SALOMEDS::Stud SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); QFileInfo aFileInfo(theFileName); aName->SetValue(aFileInfo.fileName().latin1()); - anAttr = aStudyBuilder->FindOrCreateAttribute(aFileObject, "AttributeComment"); - SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(aFileObject, "AttributeString"); + SALOMEDS::AttributeString_var aComment = SALOMEDS::AttributeString::_narrow(anAttr); QString aString; aString.sprintf("myComment=ImportTables;myFileName=%s", aFileInfo.absFilePath().latin1()); diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh index ceb9eade..fa899f04 100644 --- a/src/VISU_I/VISU_Table_i.hh +++ b/src/VISU_I/VISU_Table_i.hh @@ -35,11 +35,10 @@ class SPlot2d_Curve; namespace VISU{ //============================================================================== - class Table_i : public virtual POA_VISU::Table, + class VISU_I_EXPORT Table_i : public virtual POA_VISU::Table, public virtual PrsObject_i { static int myNbPresent; - Table_i(); Table_i( const Table_i& ); public: Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject ); @@ -84,7 +83,7 @@ namespace VISU{ SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy); bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName); //============================================================================== - class Curve_i : public virtual POA_VISU::Curve, + class VISU_I_EXPORT Curve_i : public virtual POA_VISU::Curve, public virtual PrsObject_i { static int myNbPresent; @@ -161,7 +160,7 @@ namespace VISU{ }; //============================================================================== - class Container_i : public virtual POA_VISU::Container, + class VISU_I_EXPORT Container_i : public virtual POA_VISU::Container, public virtual PrsObject_i { static int myNbPresent; diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 5faacca8..da93d958 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -23,12 +23,18 @@ #include "VISU_TimeAnimation.h" +#ifdef WNT +#include +#include +#include +#endif + #include "VISUConfig.hh" #include "VISU_Result_i.hh" #include "VISU_Prs3d_i.hh" #include "VISU_Mesh_i.hh" -#include "VISU_ScalarMap_i.hh" +#include "VISU_PrsMerger_i.hh" #include "VISU_IsoSurfaces_i.hh" #include "VISU_DeformedShape_i.hh" #include "VISU_ScalarMapOnDeformedShape_i.hh" @@ -55,8 +61,9 @@ #include "SUIT_Session.h" #include "SUIT_Study.h" -#include "SALOMEDSClient_AttributeComment.hxx" +#include "SALOMEDSClient_AttributeString.hxx" #include "SALOMEDSClient_AttributeName.hxx" +#include "CASCatch.hxx" #include #include @@ -85,8 +92,8 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy, myStudy = theStudy; myIsActive = false; myFrame = 0; - mySpeed = 1; - myProportional = false; + mySpeed = VISU::GetResourceMgr()->integerValue("VISU", "speed", 1); + myProportional = VISU::GetResourceMgr()->booleanValue("VISU", "use_proportional_timing", false); myView = 0; if (!CORBA::is_nil(theView3D)) { @@ -96,12 +103,14 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy, connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) ); } + myAnimationMode = 0; myTimeMinVal = 0; myTimeMaxVal = 0; myTimeMin = 0; myTimeMax = 0; myLastError = ""; - myCycling = false; + myCycling = VISU::GetResourceMgr()->booleanValue("VISU", "cycled_animation", false); + myCleaningMemoryAtEachFrame = VISU::GetResourceMgr()->booleanValue("VISU", "clean_memory_at_each_frame", false); myAnimEntry = ""; @@ -121,7 +130,7 @@ VISU_TimeAnimation::~VISU_TimeAnimation() for (int i = 0; i < getNbFields(); i++) { clearData(myFieldsLst[i]); } - + clearFieldData(); /* Terminates the execution of the thread. * The thread may or may not be terminated immediately, * depending on the operating system's scheduling policies. @@ -144,39 +153,77 @@ VISU_TimeAnimation::~VISU_TimeAnimation() //------------------------------------------------------------------------ -void VISU_TimeAnimation::addField (_PTR(SObject) theField) +bool VISU_TimeAnimation::addField (_PTR(SObject) theField) { + if (!theField) return false; + FieldData aNewData; aNewData.myField = theField; aNewData.myNbFrames = 0; - aNewData.myPrsType = VISU::TSCALARMAP; + aNewData.myPrsType = VISU::TPRSMERGER; aNewData.myOffset[0] = aNewData.myOffset[1] = aNewData.myOffset[2] = 0; VISU::Storable::TRestoringMap aMap = getMapOfValue(aNewData.myField); + if(VISU::Storable::FindValue(aMap,"myComment") != QString("FIELD")) + return false; + aNewData.myNbTimes = VISU::Storable::FindValue(aMap,"myNbTimeStamps").toLong(); - myFieldsLst.append(aNewData); + if ( myAnimationMode == 0 ) { // parallel animation mode + if ( aNewData.myNbTimes < 2 ) + return false; + if ( !myFieldsLst.isEmpty() && myFieldsLst.first().myNbTimes != aNewData.myNbTimes ) + return false; + if ( myFieldsLst.isEmpty() ) + myFieldsAbsFrames.push_back(aNewData.myNbTimes); + } + else { // succcessive animation mode + if ( aNewData.myNbTimes < 1 ) + return false; + + long aNumCompCurr = VISU::Storable::FindValue(aMap, "myNumComponent").toLong(); + if ( !myFieldsLst.isEmpty() ) { + VISU::Storable::TRestoringMap aFMap = getMapOfValue(myFieldsLst.first().myField); + long aNumComp = VISU::Storable::FindValue(aFMap, "myNumComponent").toLong(); + if ( aNumCompCurr != aNumComp ) + return false; + } + + if ( !myFieldsLst.isEmpty() ) + myFieldsAbsFrames.push_back(myFieldsAbsFrames.back() + aNewData.myNbTimes); + else + myFieldsAbsFrames.push_back(aNewData.myNbTimes); + } + + myFieldsLst.append(aNewData); + //find Min/Max timestamps - if ((myTimeMin == 0) && (myTimeMax == 0)) { - _PTR(ChildIterator) anIter = myStudy->NewChildIterator(theField); - anIter->Next(); // First is reference on support + _PTR(ChildIterator) anIter = myStudy->NewChildIterator(theField); + anIter->Next(); // First is reference on support + if ( myFieldsLst.size() == 1 ) { // the first field myTimeMin = getTimeValue(anIter->Value()); - for(; anIter->More(); anIter->Next()) { + myTimeMax = getTimeValue(anIter->Value()); + } + for(; anIter->More(); anIter->Next()) { + if ( myTimeMin > getTimeValue(anIter->Value()) ) + myTimeMin = getTimeValue(anIter->Value()); + if ( myTimeMax < getTimeValue(anIter->Value()) ) myTimeMax = getTimeValue(anIter->Value()); - } } + + return true; } //------------------------------------------------------------------------ -void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField) +bool VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField) { SALOMEDS::SObject_var theFieldDup = SALOMEDS::SObject::_duplicate(theField); _PTR(SObject) aField = VISU::GetClientSObject(theFieldDup, myStudy); - addField(aField); + return addField(aField); } //------------------------------------------------------------------------ -void VISU_TimeAnimation::clearData(FieldData& theData) { +void VISU_TimeAnimation::_clearData(FieldData& theData) { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; @@ -202,6 +249,11 @@ void VISU_TimeAnimation::clearData(FieldData& theData) { myView->update(); } +//------------------------------------------------------------------------ +void VISU_TimeAnimation::clearData(FieldData& theData) { + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (this,&VISU_TimeAnimation::_clearData,theData)); +} namespace { @@ -288,7 +340,7 @@ namespace int aRangeType = VISU::GetResourceMgr()->integerValue("VISU" , "scalar_range_type", 0); if( aRangeType != 1 ){ for(long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) { - if (VISU::ScalarMap_i* aPrs = dynamic_cast(theData.myPrs[aFrameId])){ + if (VISU::PrsMerger_i* aPrs = dynamic_cast(theData.myPrs[aFrameId])){ aPrs->SetRange(aMin, aMax); aPrs->SetOffset(theData.myOffset); } @@ -301,7 +353,43 @@ namespace } } } - + +double getMinFieldsValue( QValueList& theFieldsLst ) +{ + // for succcessive animation mode only + double aRes; + for (int i = 0; i < theFieldsLst.count(); i++) { + if ( theFieldsLst[i].myPrs[0] ) { + aRes = theFieldsLst[i].myPrs[0]->GetMin(); + break; + } + } + + for (int i = 1; i < theFieldsLst.count() && theFieldsLst[i].myPrs[0]; i++) { + if ( aRes > theFieldsLst[i].myPrs[0]->GetMin() ) + aRes = theFieldsLst[i].myPrs[0]->GetMin(); + } + return aRes; +} + +double getMaxFieldsValue( QValueList& theFieldsLst ) +{ + // for succcessive animation mode only + double aRes; + for (int i = 0; i < theFieldsLst.count(); i++) { + if ( theFieldsLst[i].myPrs[0] ) { + aRes = theFieldsLst[i].myPrs[0]->GetMax(); + break; + } + } + + for (int i = 1; i < theFieldsLst.count() && theFieldsLst[i].myPrs[0]; i++) { + if ( aRes < theFieldsLst[i].myPrs[0]->GetMax() ) + aRes = theFieldsLst[i].myPrs[0]->GetMax(); + } + return aRes; +} + void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { FieldData& aData = myFieldsLst[theFieldNum]; @@ -318,8 +406,9 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { using namespace VISU; switch (aData.myPrsType) { - case VISU::TSCALARMAP: // ScalarMap - GeneratePresentations(myStudy, + case VISU::TSCALARMAP: + case VISU::TPRSMERGER: // ScalarMap + GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), @@ -402,11 +491,35 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { MESSAGE("Not implemented for this presentation type: " << aData.myPrsType); return; } + + if ( myAnimationMode == 1 ) { // succcessive animation mode + if ( isRangeDefined() ) { + if ( myFieldsAbsFrames.size() == getNbFields() ) + myFieldsAbsFrames.clear(); + if ( theFieldNum > 0 ) + myFieldsAbsFrames.push_back(myFieldsAbsFrames.back() + aData.myNbFrames); + else + myFieldsAbsFrames.push_back(aData.myNbFrames); + } + if ((theFieldNum == getNbFields() - 1) && aData.myPrsType != VISU::TGAUSSPOINTS){ + double aMin = getMinFieldsValue(myFieldsLst); + double aMax = getMaxFieldsValue(myFieldsLst); + for (int i = 0; i < getNbFields(); i++) + for(long aFrameId = 0; aFrameId < myFieldsLst[i].myNbFrames; aFrameId++) + if (aData.myPrsType == VISU::TISOSURFACE) { + if (VISU::IsoSurfaces_i* aPrs = dynamic_cast(myFieldsLst[i].myPrs[aFrameId])) + aPrs->SetSubRange(aMin, aMax); + } + else + if (VISU::ScalarMap_i* aPrs = dynamic_cast(myFieldsLst[i].myPrs[aFrameId])) + aPrs->SetRange(aMin, aMax); + } + } } //------------------------------------------------------------------------ -CORBA::Boolean VISU_TimeAnimation::generateFrames() { +CORBA::Boolean VISU_TimeAnimation::_generateFrames() { if (!myView) { MESSAGE("Viewer is not defined for animation"); return false; @@ -426,7 +539,8 @@ CORBA::Boolean VISU_TimeAnimation::generateFrames() { aData.myPrs[j]->SetOffset(aData.myOffset); aActor = aData.myPrs[j]->CreateActor(); myView->AddActor(aActor); - if(j == 0) + bool condition = ( myAnimationMode == 0 ) ? (j == 0) : (j == 0 && i == 0); + if(condition) aActor->VisibilityOn(); else aActor->VisibilityOff(); @@ -439,13 +553,21 @@ CORBA::Boolean VISU_TimeAnimation::generateFrames() { } myFrame = 0; myLastError += QString(" timestamp(s) cannot be created."); - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); myView->Repaint(); return aNoError; } //------------------------------------------------------------------------ -void VISU_TimeAnimation::clearView() { +CORBA::Boolean VISU_TimeAnimation::generateFrames() +{ + return ProcessEvent(new TMemFunEvent + (this,&VISU_TimeAnimation::_generateFrames)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_clearView() { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; @@ -466,12 +588,62 @@ void VISU_TimeAnimation::clearView() { } //------------------------------------------------------------------------ -void VISU_TimeAnimation::stopAnimation() { +void VISU_TimeAnimation::clearView() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_clearView)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_visibilityOff(int num_field, int num_frame) { + if ( num_field < 0 || num_frame < 0 ) return; + FieldData& aData = myFieldsLst[num_field]; + if ( aData.myActors.empty() ) return; + VISU_Actor* aActor = aData.myActors[num_frame]; + if (! myCleaningMemoryAtEachFrame) { + // + // Usual behaviour : VisibilityOff() + // Problem : It don't clean the memory so if there is + // a lot of frames, the memory grows dramatically + // + aActor->VisibilityOff(); + } else { + // + // myCleaningMemoryAtEachFrame behaviour: + // Delete the actor and re-creation it with VisibilityOff() + // since it takes memory only at VisibilityOn() + // + // Delete the actor + aActor->RemoveFromRender(myView->getRenderer()); + // Re-create the actor + aActor = aData.myPrs[num_frame]->CreateActor(); + myView->AddActor(aActor); + aActor->VisibilityOff(); + aData.myActors[num_frame] = aActor; + } +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::visibilityOff(int num_field, int num_frame) +{ + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (this,&VISU_TimeAnimation::_visibilityOff,num_field,num_frame)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_stopAnimation() { myIsActive = false; } //------------------------------------------------------------------------ -void VISU_TimeAnimation::startAnimation() { +void VISU_TimeAnimation::stopAnimation() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_stopAnimation)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_startAnimation() { if (!myIsActive) { myIsActive = true; QThread::start(); @@ -479,30 +651,72 @@ void VISU_TimeAnimation::startAnimation() { } //------------------------------------------------------------------------ -void VISU_TimeAnimation::nextFrame() { +void VISU_TimeAnimation::startAnimation() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_startAnimation)); +} + + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_nextFrame() { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; } stopAnimation(); - if (myFrame < (myFieldsLst[0].myNbFrames-1)) { + if (myFrame < getNbFrames() - 1 ) { //(myFieldsLst[0].myNbFrames-1)) { int i; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOff(); + std::pair aPair; + int aFieldId; + long aFrameId; + + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + visibilityOff(i, myFrame); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + visibilityOff(aFieldId, aFrameId); + } myFrame++; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOn(); - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + myFieldsLst[i].myActors[myFrame]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[aFieldId].myTiming[aFrameId])); + } myView->Repaint(); } } //------------------------------------------------------------------------ -void VISU_TimeAnimation::prevFrame() { +void VISU_TimeAnimation::nextFrame() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_nextFrame)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_prevFrame() { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; @@ -510,68 +724,163 @@ void VISU_TimeAnimation::prevFrame() { stopAnimation(); if (myFrame > 0) { int i; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOff(); + std::pair aPair; + int aFieldId; + long aFrameId; + + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + visibilityOff(i, myFrame); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + visibilityOff(aFieldId, aFrameId); + } myFrame--; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOn(); - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + myFieldsLst[i].myActors[myFrame]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[aFieldId].myTiming[aFrameId])); + } myView->Repaint(); } } //------------------------------------------------------------------------ -void VISU_TimeAnimation::firstFrame() { +void VISU_TimeAnimation::prevFrame() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_prevFrame)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_firstFrame() { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; } stopAnimation(); int i; - for (i = 0; i < getNbFields(); i++) - if(!myFieldsLst[i].myActors.empty()) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOff(); + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if(!myFieldsLst[i].myActors.empty()) + if (myFieldsLst[i].myActors[myFrame] != 0) + visibilityOff(i, myFrame); + } + else { //succcessive animation mode + std::pair aPair = getRelativeFrameNumber(myFrame); + int aFieldId = aPair.first; + long aFrameId = aPair.second; + if(!myFieldsLst[aFieldId].myActors.empty()) + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + visibilityOff(aFieldId, aFrameId); + } myFrame = 0; - for (i = 0; i < getNbFields(); i++) + + int imax; + if ( myAnimationMode == 0 ) // parallel animation mode + imax = getNbFields(); + else //succcessive animation mode + imax = 1; + + for (i = 0; i < imax; i++) if(!myFieldsLst[i].myActors.empty()) if (myFieldsLst[i].myActors[myFrame] != 0) myFieldsLst[i].myActors[myFrame]->VisibilityOn(); + if(!myFieldsLst[0].myTiming.empty()){ - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); myView->Repaint(); } } //------------------------------------------------------------------------ -void VISU_TimeAnimation::lastFrame() { +void VISU_TimeAnimation::firstFrame() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_firstFrame)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_lastFrame() { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; } stopAnimation(); int i; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOff(); + std::pair aPair; + int aFieldId; + long aFrameId; + + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + visibilityOff(i, myFrame); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + visibilityOff(aFieldId, aFrameId); + } - myFrame = myFieldsLst[0].myNbFrames-1; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOn(); + myFrame = getNbFrames() - 1; //myFieldsLst[0].myNbFrames-1; + + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + myFieldsLst[i].myActors[myFrame]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[aFieldId].myTiming[aFrameId])); + } - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); myView->Repaint(); } +//------------------------------------------------------------------------ +void VISU_TimeAnimation::lastFrame() +{ + ProcessVoidEvent(new TVoidMemFunEvent + (this,&VISU_TimeAnimation::_lastFrame)); +} + //------------------------------------------------------------------------ // For Batchmode using -void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) { +void VISU_TimeAnimation::_gotoFrame(CORBA::Long theFrame) { if (!myView) { MESSAGE("Viewer is not defined for animation"); return; @@ -579,25 +888,66 @@ void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) { if ((theFrame < 0) || (theFrame > (getNbFrames()-1))) return; stopAnimation(); - qApp->lock(); - qApp->syncX(); int i; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOff(); + std::pair aPair; + int aFieldId; + long aFrameId; + + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + visibilityOff(i, myFrame); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + visibilityOff(aFieldId, aFrameId); + } myFrame = theFrame; - for (i = 0; i < getNbFields(); i++) - if (myFieldsLst[i].myActors[myFrame] != 0) - myFieldsLst[i].myActors[myFrame]->VisibilityOn(); - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + if ( myAnimationMode == 0 ) { // parallel animation mode + for (i = 0; i < getNbFields(); i++) + if (myFieldsLst[i].myActors[myFrame] != 0) + myFieldsLst[i].myActors[myFrame]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); + } + else { //succcessive animation mode + aPair = getRelativeFrameNumber(myFrame); + aFieldId = aPair.first; + aFrameId = aPair.second; + if (myFieldsLst[aFieldId].myActors[aFrameId] != 0) + myFieldsLst[aFieldId].myActors[aFrameId]->VisibilityOn(); + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[aFieldId].myTiming[aFrameId])); + } + myView->Repaint(); - qApp->flushX(); - qApp->processEvents(3); - qApp->unlock(); } +//------------------------------------------------------------------------ +void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) +{ + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (this,&VISU_TimeAnimation::_gotoFrame,theFrame)); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_emitFrameChanged(long theNewFrame, double theTime) +{ + emit frameChanged(theNewFrame, theTime); +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::_emitStopped() +{ + emit stopped(); +} //------------------------------------------------------------------------ VISU::ColoredPrs3d_ptr VISU_TimeAnimation::getPresentation(CORBA::Long theField, CORBA::Long theFrame) { @@ -611,45 +961,92 @@ VISU::ColoredPrs3d_ptr VISU_TimeAnimation::getPresentation(CORBA::Long theField, //------------------------------------------------------------------------ CORBA::Long VISU_TimeAnimation::getNbFrames() { - return (getNbFields() > 0)? myFieldsLst[0].myNbFrames : 0; + if ( myAnimationMode == 0 ) // parallel animation mode + return (getNbFields() > 0)? myFieldsLst[0].myNbFrames : 0; + else //succcessive animation mode + return (getNbFields() > 0 && !myFieldsAbsFrames.empty()) ? myFieldsAbsFrames[myFieldsAbsFrames.size()-1] : 0; } +//------------------------------------------------------------------------ +long VISU_TimeAnimation::getAbsoluteFrameNumber(std::pair theFieldTimeStamp) +{ + long aRes = -1; + if ( getNbFields() > 0 ) { + int aFieldId = theFieldTimeStamp.first; + long aFrameNum = theFieldTimeStamp.second + 1; + if ( myAnimationMode == 0 ) { // parallel animation mode + if ( aFrameNum <= myFieldsAbsFrames[0] ) + aRes = aFrameNum; + } + else { //succcessive animation mode + if ( aFieldId == 0 && aFrameNum <= myFieldsAbsFrames[aFieldId] ) + aRes = aFrameNum; + else if ( aFieldId && aFrameNum <= myFieldsAbsFrames[aFieldId] - myFieldsAbsFrames[aFieldId-1] ) + aRes = myFieldsAbsFrames[aFieldId-1] + aFrameNum; + } + } + return aRes - 1; +} //------------------------------------------------------------------------ -void VISU_TimeAnimation::run() +std::pair VISU_TimeAnimation::getRelativeFrameNumber(long theFrame) { - if (!myView) { - MESSAGE("Viewer is not defined for animation"); - return; + std::pair aRes; + if ( getNbFields() > 0 && theFrame < getNbFrames() ) { + theFrame = theFrame + 1; + if ( myAnimationMode == 0 ) { // parallel animation mode + aRes.first = 0; + aRes.second = theFrame - 1; + } + else { //succcessive animation mode + for (int i = 0, iEnd = myFieldsAbsFrames.size(); i < iEnd; i++) + if ( myFieldsAbsFrames[i] >= theFrame ) { + aRes.first = i; + if ( i == 0 ) + aRes.second = theFrame - 1; + else + aRes.second = theFrame-myFieldsAbsFrames[i-1] - 1; + break; + } + } } + return aRes; +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::parallelAnimation( bool& theIsDumping, QValueList& theIndexList ) +{ double k = 1; - bool isDumping = !myDumpPath.isEmpty(); double aOneVal = 1; if (myFieldsLst[0].myNbFrames > 2) - aOneVal = myFieldsLst[0].myTiming[1] - myFieldsLst[0].myTiming[0]; - myFileIndex = 0; + aOneVal = ( myTimeMax - myTimeMin ) / getNbFrames(); int aNbFiles = 0; - QValueList anIndexList; - - qApp->lock(); + while (myIsActive) { - emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[0].myTiming[myFrame])); + if (myIsActive) { if(!(myFieldsLst[0].myField)) break; for (int i = 0; i < getNbFields(); i++) { FieldData& aData = myFieldsLst[i]; if (myFrame > 0) { if (aData.myActors[myFrame-1] != 0) - aData.myActors[myFrame-1]->VisibilityOff(); + visibilityOff(i, myFrame-1); } else { if (aData.myActors[aData.myNbFrames-1] != 0) - aData.myActors[aData.myNbFrames-1]->VisibilityOff(); + visibilityOff(i, aData.myNbFrames-1); } if (aData.myActors[myFrame] != 0) { - aData.myActors[myFrame]->VisibilityOn(); + ProcessVoidEvent(new TVoidMemFunEvent(aData.myActors[myFrame], + &VISU_Actor::VisibilityOn)); } } - myView->Repaint(false); + bool repainArg = false; + ProcessVoidEvent(new TVoidMemFun1ArgEvent(myView, + &SVTK_ViewWindow::Repaint, + repainArg)); + } k = 1; if (myProportional) { @@ -668,87 +1065,295 @@ void VISU_TimeAnimation::run() } } int delay = (int)(1000. * k / mySpeed); - isDumping = !myDumpPath.isEmpty(); - if (delay < 1 && isDumping) { + theIsDumping = !myDumpPath.isEmpty(); + if (delay < 1 && theIsDumping) { // We must unlock mutex for some time before grabbing to allow view updating delay = 1; } - qApp->unlock(); msleep(delay); - qApp->lock(); + if (!myIsActive) { + ProcessVoidEvent(new TVoidMemFunEvent(this,&VISU_TimeAnimation::_emitStopped)); + return; + } - if (isDumping) { + if (theIsDumping) { // We must unlock mutex for some time before grabbing to allow view updating - qApp->unlock(); msleep(delay); - qApp->lock(); + if (!myIsActive) { // this check was taken from WP_DEB branch + ProcessVoidEvent(new TVoidMemFunEvent(this,&VISU_TimeAnimation::_emitStopped)); + return; + } if(!(myFieldsLst[0].myField)) // break, if field was deleted. break; - if (myDumpFormat.compare("AVI") != 0) { - QString aFile(myDumpPath); - QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]); - int aPos = -1; - while ((aPos = aName.find(".")) > -1 ) - aName.replace(aPos, 1, "_"); - aFile += aName; - aFile += "."; - aFile += myDumpFormat.lower(); - myView->dumpViewToFormat(aFile,myDumpFormat); - } else { - QFileInfo aFileInfo(myDumpPath); - QString aDirPath = aFileInfo.dirPath(true); - QString aBaseName = aFileInfo.fileName(); + saveImages( 0, aOneVal, aNbFiles, theIndexList ); + } - switch (myFrame) { - case 0: - break; - case 1: - myFileIndex += 5; - break; - default: - if (myProportional) { - double p = (myFieldsLst[0].myTiming[myFrame] - - myFieldsLst[0].myTiming[myFrame-1]) / aOneVal; - myFileIndex += (long) (5*p); - } else { - myFileIndex += 5; + if (!myIsActive) break; + + myFrame++; + if (myFrame == myFieldsLst[0].myNbFrames) { + if (!myCycling) { + myIsActive = false; + myFrame--; + break; + } + else + myFrame = 0; + } + } + + // make AVI file if need + if (theIsDumping && myDumpFormat.compare("AVI") == 0) { + double aFPS = 17.3 * mySpeed; + + QFileInfo aFileInfo(myDumpPath); + QString aDirPath = aFileInfo.dirPath(true); + QString aBaseName = aFileInfo.fileName(); + + // add missing files + if (theIndexList.count() > 1) { + QString aFFile = aDirPath + QDir::separator() + aBaseName; + aFFile += QString("_%1.jpeg"); + int aStartIndex = theIndexList[0], anEndIndex; + for (int i = 1; i < theIndexList.count(); i++) { + anEndIndex = theIndexList[i]; + QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustify(8, '0')); + QStringList aCommands; + for (int j = aStartIndex+1; j < anEndIndex; j++) { + QString aFile = aFFile.arg(QString::number(j).rightJustify(8, '0')); + aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile)); + } + system(aCommands.join(" ; \\\n").latin1()); + aStartIndex = anEndIndex; + } + } + + // make AVI file + QString aPattern = aDirPath + QDir::separator() + aBaseName; + aPattern += "_\%08d.jpeg"; + + QString aCmd = myAVIMaker; + aCmd += " -I p"; + aCmd += " -v 0"; + aCmd += QString(" -f %1").arg(aFPS); + // aCmd += QString(" -n %1").arg(aNbFiles); + aCmd += QString(" -n %1").arg(myFileIndex+1); + aCmd += QString(" -j %1").arg(aPattern); + aCmd += " | yuv2lav"; + aCmd += QString(" -o %1").arg(myDumpPath); + system(aCmd.latin1()); + + // remove temporary jpeg files + aCmd = "( "; + aCmd += QString("cd %1").arg(aDirPath); + aCmd += "; ls"; + aCmd += QString(" | egrep '%1_[0-9]*.jpeg'").arg(aBaseName); + aCmd += " | xargs rm"; + aCmd += " )"; + system(aCmd.latin1()); + } +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::succcessiveAnimation( bool& theIsDumping, QValueList& theIndexList ) +{ + if ( myFrame >= getNbFrames() - 1 ) + { + myIsActive = false; + ProcessVoidEvent(new TVoidMemFunEvent(this,&VISU_TimeAnimation::_emitStopped)); + return; + } + + double k = 1; + double aOneVal = 1; + if (myFieldsLst[0].myNbFrames > 2) + aOneVal = ( myTimeMax - myTimeMin ) / getNbFrames(); + int aNbFiles = 0; + long aFrame = myFrame; + + while (myIsActive) { + + for (int aFieldId = 0; (aFieldId < getNbFields()) && (myFieldsLst[aFieldId].myField); aFieldId++) { + + FieldData& aData = myFieldsLst[aFieldId]; + if ( !aData.myPrs[0] ) continue; + while (aFrame < aData.myNbFrames) { + + ProcessVoidEvent(new TVoidMemFun2ArgEvent(this, &VISU_TimeAnimation::_emitFrameChanged, + myFrame, myFieldsLst[aFieldId].myTiming[aFrame])); + + if (myIsActive) { + if (aFrame > 0) { + if (aData.myActors[aFrame-1] != 0) + visibilityOff(aFieldId, aFrame-1); + } else if ( myFrame > 0) { + if (myFieldsLst[aFieldId-1].myActors[myFieldsLst[aFieldId-1].myNbFrames-1] != 0) + visibilityOff(aFieldId-1, myFieldsLst[aFieldId-1].myNbFrames-1); + } else if ( myCycling ) { + if (myFieldsLst[getNbFields()-1].myActors[myFieldsLst[getNbFields()-1].myNbFrames-1] != 0) + visibilityOff(getNbFields()-1, myFieldsLst[getNbFields()-1].myNbFrames-1); + } else { + if (aData.myActors[aData.myNbFrames-1] != 0) + visibilityOff(aFieldId, aData.myNbFrames-1); + } + if (aData.myActors[aFrame] != 0) { + ProcessVoidEvent(new TVoidMemFunEvent(aData.myActors[aFrame], + &VISU_Actor::VisibilityOn)); + } + + bool repainArg = false; + ProcessVoidEvent(new TVoidMemFun1ArgEvent(myView, + &SVTK_ViewWindow::Repaint, + repainArg)); + } + + k = 1; + if (myProportional) { + switch (aFrame) { + case 0: + break; + case 1: + if (myFieldsLst[0].myNbFrames > 2) + k = (myFieldsLst[0].myTiming[aFrame+1] - + myFieldsLst[0].myTiming[aFrame]) / aOneVal; + break; + default: + if (aFrame < (myFieldsLst[0].myNbFrames - 1)) + k = (myFieldsLst[0].myTiming[aFrame+1] - + myFieldsLst[0].myTiming[aFrame]) / aOneVal; } } + int delay = (int)(1000. * k / mySpeed); + theIsDumping = !myDumpPath.isEmpty(); + if (delay < 1 && theIsDumping) { + // We must unlock mutex for some time before grabbing to allow view updating + delay = 1; + } + msleep(delay); + if (!myIsActive) { + ProcessVoidEvent(new TVoidMemFunEvent(this,&VISU_TimeAnimation::_emitStopped)); + return; + } - QString aFile = aDirPath + QDir::separator() + aBaseName; - aFile += "_"; - aFile += QString("%1").arg(myFileIndex).rightJustify(8, '0'); - aFile += ".jpeg"; - - /* check image size is divisable 16 - myView->dumpViewToFormat(aFile,"JPEG"); - */ - SUIT_ViewWindow* aView = myView; - QImage img = aView->dumpView(); - if (!img.isNull()) { - int width = img.width(); width = (width/16)*16; - int height = img.height(); height = (height/16)*16; - QImage copy = img.copy(0, 0, width, height); - if (copy.save(aFile, "JPEG")) { - anIndexList.append(myFileIndex); - aNbFiles++; + if (theIsDumping) { + // We must unlock mutex for some time before grabbing to allow view updating + msleep(delay); + if (!myIsActive) { // this check was taken from WP_DEB branch + ProcessVoidEvent(new TVoidMemFunEvent(this,&VISU_TimeAnimation::_emitStopped)); + return; } + + if(!(myFieldsLst[aFieldId].myField)) // break, if field was deleted. + break; + + saveImages( aFieldId, aOneVal, aNbFiles, theIndexList ); } + + if (!myIsActive) break; + + aFrame++; + myFrame++; } + + aFrame = 0; } - if (!myIsActive) break; + if (!myCycling) { + myIsActive = false; + myFrame--; + break; + } else { + myFrame = 0; + aFrame = myFrame; + } + } - myFrame++; - if (myFrame == myFieldsLst[0].myNbFrames) { - if (!myCycling) { - myIsActive = false; - myFrame--; - break; - } else - myFrame = 0; +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::saveImages( int theFieldId, + double& theOneVal, int& theNbFiles, + QValueList& theIndexList ) +{ + if (myDumpFormat.compare("AVI") != 0) { + QString aFile(myDumpPath); + + QString aName; + if ( myAnimationMode == 0 ) // parallel animation mode + aName = QString("%1").arg(myFieldsLst[theFieldId].myTiming[myFrame]); + else // successive animation mode + aName = QString("%1").arg(myFieldsLst[theFieldId].myTiming[getRelativeFrameNumber(myFrame).second]); + + int aPos = -1; + while ((aPos = aName.find(".")) > -1 ) + aName.replace(aPos, 1, "_"); + aFile += aName; + aFile += "."; + aFile += myDumpFormat.lower(); + ProcessVoidEvent(new TVoidMemFunEvent + (myView,&SVTK_ViewWindow::RefreshDumpImage)); // IPAL13602 + ProcessEvent(new TMemFun2ArgEvent + (myView,&SVTK_ViewWindow::dumpViewToFormat,aFile,myDumpFormat)); + } else { + QFileInfo aFileInfo(myDumpPath); + QString aDirPath = aFileInfo.dirPath(true); + QString aBaseName = aFileInfo.fileName(); + + switch (myFrame) { + case 0: + break; + case 1: + myFileIndex += 5; + break; + default: + if (myProportional) { + double p = (myFieldsLst[0].myTiming[myFrame] - + myFieldsLst[0].myTiming[myFrame-1]) / theOneVal; + myFileIndex += (long) (5*p); + } else { + myFileIndex += 5; + } + } + + QString aFile = aDirPath + QDir::separator() + aBaseName; + aFile += "_"; + aFile += QString("%1").arg(myFileIndex).rightJustify(8, '0'); + aFile += ".jpeg"; + + /* check image size is divisable 16 + myView->dumpViewToFormat(aFile,"JPEG"); + */ + SUIT_ViewWindow* aView = myView; + ProcessVoidEvent(new TVoidMemFunEvent(myView,&SVTK_ViewWindow::RefreshDumpImage)); // IPAL13602 + QImage img = ProcessEvent(new TMemFunEvent(aView,&SUIT_ViewWindow::dumpView)); + if (!img.isNull()) { + int width = img.width(); width = (width/16)*16; + int height = img.height(); height = (height/16)*16; + QImage copy = img.copy(0, 0, width, height); + if (copy.save(aFile, "JPEG")) { + theIndexList.append(myFileIndex); + theNbFiles++; + } } } +} + +//------------------------------------------------------------------------ +void VISU_TimeAnimation::run() +{ + if (!myView) { + MESSAGE("Viewer is not defined for animation"); + return; + } + + bool isDumping = !myDumpPath.isEmpty(); + myFileIndex = 0; + QValueList anIndexList; + + if ( myAnimationMode == 0 ) // parallel animation mode + parallelAnimation( isDumping, anIndexList ); + else //succcessive animation mode + succcessiveAnimation( isDumping, anIndexList ); // make AVI file if need if (isDumping && myDumpFormat.compare("AVI") == 0) { @@ -801,8 +1406,7 @@ void VISU_TimeAnimation::run() system(aCmd.latin1()); } - emit stopped(); - qApp->unlock(); + ProcessVoidEvent(new TVoidMemFunEvent(this,&VISU_TimeAnimation::_emitStopped)); QThread::exit(); } @@ -823,8 +1427,8 @@ VISU::Storable::TRestoringMap VISU_TimeAnimation::getMapOfValue (_PTR(SObject) t VISU::Storable::TRestoringMap aMap; if (theSObject) { _PTR(GenericAttribute) anAttr; - if (theSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); + if (theSObject->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aComment (anAttr); std::string aString = aComment->Value(); QString strIn (aString.c_str()); VISU::Storable::StrToMap(strIn, aMap); @@ -895,7 +1499,8 @@ std::string GetPresentationComment (VISU::VISUType thePrsType) std::string aPrsCmt; switch (thePrsType) { case VISU::TSCALARMAP: - aPrsCmt = VISU::ScalarMap_i::myComment; + case VISU::TPRSMERGER: + aPrsCmt = VISU::PrsMerger_i::myComment; break; case VISU::TISOSURFACE: aPrsCmt = VISU::IsoSurfaces_i::myComment; @@ -943,8 +1548,8 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy() std::string aSComponentEntry = aSComponent->GetID(); QString aComment; - aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g", - VISU::TANIMATION,myTimeMinVal,myTimeMaxVal); + aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d", + VISU::TANIMATION,myTimeMinVal,myTimeMaxVal,myAnimationMode); string anEntry = VISU::CreateAttributes(myStudy,aSComponentEntry.c_str(),"","", GenerateName(),"",aComment,true); @@ -953,18 +1558,22 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy() for (int i = 0; i < getNbFields(); i++) { FieldData& aData = myFieldsLst[i]; - - _PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject); - aStudyBuilder->Addreference(newObj, aData.myField); - - if (aData.myPrs.empty()) { - generatePresentations(i); + if ( aData.myPrs.front() ) { + _PTR(SObject) newObj = aStudyBuilder->NewObject(aAnimSObject); + aStudyBuilder->Addreference(newObj, aData.myField); + + if (aData.myPrs.empty()) { + generatePresentations(i); + } + ostringstream strOut; + aData.myPrs[0]->ToStream(strOut); + string aPrsComment = strOut.str(); + string aPrsMyComment = aData.myPrs[0]->GetComment(); + if(aPrsMyComment == "PRSMERGER") + aPrsMyComment = "SCALARMAP"; + VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", + aPrsMyComment.c_str(),"",aPrsComment.c_str(),true); } - ostringstream strOut; - aData.myPrs[0]->ToStream(strOut); - string aPrsComment = strOut.str(); - VISU::CreateAttributes(myStudy, newObj->GetID().c_str(),"","", - aData.myPrs[0]->GetComment(),"",aPrsComment.c_str(),true); } aStudyBuilder->CommitCommand(); @@ -986,12 +1595,12 @@ void VISU_TimeAnimation::saveAnimation() std::string aSComponentEntry = aSComponent->GetID(); QString aComment; - aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g", - VISU::TANIMATION,myTimeMinVal,myTimeMaxVal); + aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g;myMode=%d", + VISU::TANIMATION,myTimeMinVal,myTimeMaxVal,myAnimationMode); _PTR(GenericAttribute) anAttr; - anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeComment"); - _PTR(AttributeComment) aCmnt (anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeString"); + _PTR(AttributeString) aCmnt (anAttr); aCmnt->SetValue(aComment.latin1()); _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject); @@ -1008,7 +1617,8 @@ void VISU_TimeAnimation::saveAnimation() aData.myPrs[0]->ToStream(strOut); string aPrsComment = strOut.str(); string aPrsNameTxt = aData.myPrs[0]->GetComment(); - + if(aPrsNameTxt == "PRSMERGER") + aPrsNameTxt = "SCALARMAP"; // Save in study _PTR(SObject) aRefObj = anIter->Value(); _PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj); @@ -1016,8 +1626,8 @@ void VISU_TimeAnimation::saveAnimation() if (anPrsIter->More()) { _PTR(SObject) aPrsObj = anPrsIter->Value(); - anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeComment"); - aCmnt = _PTR(AttributeComment)(anAttr); + anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeString"); + aCmnt = _PTR(AttributeString)(anAttr); aCmnt->SetValue(aPrsComment.c_str()); anAttr = aStudyBuilder->FindOrCreateAttribute(aPrsObj, "AttributeName"); @@ -1045,9 +1655,9 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) VISU::Storable::TRestoringMap aMap; _PTR(GenericAttribute) anAttr; - if (!aAnimSObject->FindAttribute(anAttr, "AttributeComment")) return; + if (!aAnimSObject->FindAttribute(anAttr, "AttributeString")) return; - _PTR(AttributeComment) aComment (anAttr); + _PTR(AttributeString) aComment (anAttr); string aComm = aComment->Value(); QString strIn (aComm.c_str()); VISU::Storable::StrToMap(strIn,aMap); @@ -1055,15 +1665,19 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) myTimeMinVal = VISU::Storable::FindValue(aMap,"myTimeMinVal",&isExist).toDouble(); myTimeMaxVal = VISU::Storable::FindValue(aMap,"myTimeMaxVal",&isExist).toDouble(); + myAnimationMode = VISU::Storable::FindValue(aMap,"myMode",&isExist).toInt(); _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject); for (anIter->Init(); anIter->More(); anIter->Next()) { _PTR(SObject) aRefObj = anIter->Value(); _PTR(SObject) aFieldObj; if (!aRefObj->ReferencedObject(aFieldObj) ) continue; + addField(aFieldObj); - FieldData& aData = getFieldData(getNbFields()-1); + if ( isRangeDefined() ) myFieldsAbsFrames.pop_back(); + FieldData& aData = getFieldData(getNbFields()-1); + // Get Presentation object _PTR(ChildIterator) anPrsIter = myStudy->NewChildIterator(aRefObj); anPrsIter->Init(); @@ -1074,8 +1688,9 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) string aStr = aName->Value(); QString strName (aStr.c_str()); - if (strName == VISU::ScalarMap_i::myComment.c_str()) - aData.myPrsType = VISU::TSCALARMAP; + if (strName == VISU::PrsMerger_i::myComment.c_str() || + strName == VISU::ScalarMap_i::myComment.c_str()) + aData.myPrsType = VISU::TPRSMERGER; else if (strName == VISU::IsoSurfaces_i::myComment.c_str()) aData.myPrsType = VISU::TISOSURFACE; else if (strName == VISU::CutPlanes_i::myComment.c_str()) @@ -1098,8 +1713,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) continue; generatePresentations(getNbFields()-1); - if (!aPrsObj->FindAttribute(anAttr, "AttributeComment")) continue; - _PTR(AttributeComment) aPrsComment (anAttr); + if (!aPrsObj->FindAttribute(anAttr, "AttributeString")) continue; + _PTR(AttributeString) aPrsComment (anAttr); string aPrsComm = aPrsComment->Value(); if (aPrsComm.length() > 0) { QString strPrsIn (aPrsComm.c_str()); @@ -1110,8 +1725,16 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) } aData.myPrs[0]->GetOffset(aData.myOffset); for (int i = 1; i < aData.myNbFrames; i++) { + bool anIsFixedRange = false; + if (aData.myPrsType != VISU::TGAUSSPOINTS) { + if (VISU::ScalarMap_i* aPrs = dynamic_cast(aData.myPrs[i])) + anIsFixedRange = aPrs->IsRangeFixed(); + } //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]); - aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005 + aData.myPrs[i]->SameAsParams(aData.myPrs[0], + aData.myPrs[i]->GetMeshName(),aData.myPrs[i]->GetFieldName(), + aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(), + anIsFixedRange);//jfa 03.08.2005 } } string aStr = aAnimSObject->GetID(); @@ -1123,6 +1746,51 @@ void VISU_TimeAnimation::onViewDeleted() myView = 0; } +void VISU_TimeAnimation::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) + throw (SALOME::SALOME_Exception) +{ + VISU::ColoredPrs3d_i* aPrs_i = dynamic_cast(GetServant(thePrs).in()); + + if ( !aPrs_i ) + throw SALOME_Exception(LOCALIZED("Error : invalid dynamic cast of the given presentation to VISU::ColoredPrs3d_i")); + + if ( myAnimationMode == 0 ) { // parallel animation mode + FieldData& aData = myFieldsLst[theFieldNum]; + + if ( aData.myPrs.empty() ) + throw SALOME_Exception(LOCALIZED("Error : presentations for the given field is not yet created!")); + + if ( aPrs_i->GetResult() != aData.myPrs[0]->GetResult() ) + throw SALOME_Exception(LOCALIZED("Error : the MED file is not the same!")); + + for (int i = 0; i < aData.myNbFrames; i++) { + bool anIsFixedRange = false; + if (aData.myPrsType != VISU::TGAUSSPOINTS) { + if (VISU::ScalarMap_i* aPrs = dynamic_cast(aData.myPrs[i])) + anIsFixedRange = aPrs->IsRangeFixed(); + } + aData.myPrs[i]->SameAsParams(aPrs_i, + aData.myPrs[i]->GetMeshName(),aData.myPrs[i]->GetFieldName(), + aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(), + anIsFixedRange); + } + } + else if ( myAnimationMode == 1 ) { // successive animation mode + for (int f = 0; f < getNbFields(); f++) { + FieldData& aData = myFieldsLst[f]; + + if ( aData.myPrs.empty() ) + throw SALOME_Exception(LOCALIZED("Error : presentations for the given field is not yet created!")); + + for (int i = 0; i < aData.myNbFrames; i++) { + aData.myPrs[i]->SameAsParams(aPrs_i, + aData.myPrs[i]->GetMeshName(),aData.myPrs[i]->GetFieldName(), + aData.myPrs[i]->GetEntity(), aData.myPrs[i]->GetIteration(), + true); + } + } + } +} //======================================================================== //======================================================================== @@ -1176,15 +1844,24 @@ VISU_TimeAnimation_i::~VISU_TimeAnimation_i() delete myAnim; } -void VISU_TimeAnimation_i::addField (SALOMEDS::SObject_ptr theField) +bool VISU_TimeAnimation_i::addField (SALOMEDS::SObject_ptr theField) { - myAnim->addField(theField); + return myAnim->addField(theField); +} + +void VISU_TimeAnimation_i::clearFields () +{ + for (int i = 0; i < myAnim->getNbFields(); i++) { + myAnim->clearData(myAnim->getFieldData(i)); + } + myAnim->clearFieldData(); } CORBA::Boolean VISU_TimeAnimation_i::generateFrames() { - return ProcessEvent(new TMemFunEvent - (myAnim,&VISU_TimeAnimation::generateFrames)); + //return ProcessEvent(new TMemFunEvent + // (myAnim,&VISU_TimeAnimation::generateFrames)); + return myAnim->generateFrames(); } void VISU_TimeAnimation_i::generatePresentations (CORBA::Long theFieldNum) @@ -1194,50 +1871,58 @@ void VISU_TimeAnimation_i::generatePresentations (CORBA::Long theFieldNum) void VISU_TimeAnimation_i::clearView() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::clearView)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::clearView)); + myAnim->clearView(); } void VISU_TimeAnimation_i::stopAnimation() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::stopAnimation)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::stopAnimation)); + myAnim->stopAnimation(); } void VISU_TimeAnimation_i::startAnimation() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::startAnimation)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::startAnimation)); + myAnim->startAnimation(); } void VISU_TimeAnimation_i::nextFrame() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::nextFrame)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::nextFrame)); + myAnim->nextFrame(); } void VISU_TimeAnimation_i::prevFrame() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::prevFrame)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::prevFrame)); + myAnim->prevFrame(); } void VISU_TimeAnimation_i::firstFrame() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::firstFrame)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::firstFrame)); + myAnim->firstFrame(); } void VISU_TimeAnimation_i::lastFrame() { - ProcessVoidEvent(new TVoidMemFunEvent - (myAnim,&VISU_TimeAnimation::lastFrame)); + //ProcessVoidEvent(new TVoidMemFunEvent + // (myAnim,&VISU_TimeAnimation::lastFrame)); + myAnim->lastFrame(); } void VISU_TimeAnimation_i::gotoFrame(CORBA::Long theFrame) { - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (myAnim,&VISU_TimeAnimation::gotoFrame,theFrame)); + //ProcessVoidEvent(new TVoidMemFun1ArgEvent + // (myAnim,&VISU_TimeAnimation::gotoFrame,theFrame)); + myAnim->gotoFrame(theFrame); } CORBA::Long VISU_TimeAnimation_i::getNbFields() @@ -1329,6 +2014,10 @@ CORBA::Boolean VISU_TimeAnimation_i::isCycling() return myAnim->isCycling(); } +CORBA::Boolean VISU_TimeAnimation_i::isCleaningMemoryAtEachFrame(){ + return myAnim->isCleaningMemoryAtEachFrame(); +} + CORBA::Double VISU_TimeAnimation_i::getMinTime() { return myAnim->getMinTime(); @@ -1349,6 +2038,10 @@ void VISU_TimeAnimation_i::setCycling (CORBA::Boolean theCycle) myAnim->setCycling(theCycle); } +void VISU_TimeAnimation_i::setCleaningMemoryAtEachFrame(CORBA::Boolean theCycle){ + myAnim->setCleaningMemoryAtEachFrame(theCycle); +} + SALOMEDS::SObject_ptr VISU_TimeAnimation_i::publishInStudy() { return myAnim->publishInStudy(); @@ -1368,3 +2061,19 @@ void VISU_TimeAnimation_i::saveAnimation() { myAnim->saveAnimation(); } + +void VISU_TimeAnimation_i::setAnimationMode(VISU::Animation::AnimationMode theMode) +{ + myAnim->setAnimationMode(theMode); +} + +VISU::Animation::AnimationMode VISU_TimeAnimation_i::getAnimationMode() +{ + return VISU::Animation::AnimationMode(myAnim->getAnimationMode()); +} + +void VISU_TimeAnimation_i::ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) + throw (SALOME::SALOME_Exception) +{ + myAnim->ApplyProperties(theFieldNum, thePrs); +} diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index d2da49a4..3c443a1e 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -54,9 +54,30 @@ struct FieldData }; -class VISU_TimeAnimation: public QObject, public QThread +class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread { Q_OBJECT; + + protected: + CORBA::Boolean _generateFrames(); + void _visibilityOff(int num_field, int num_frame); + void _clearView(); + void _clearData(FieldData& theData); + void _stopAnimation(); + void _startAnimation(); + void _nextFrame(); + void _prevFrame(); + void _firstFrame(); + void _lastFrame(); + void _gotoFrame(CORBA::Long theFrame); + + void _emitFrameChanged(long theNewFrame, double theTime); + void _emitStopped(); + + void parallelAnimation( bool& theIsDumping, QValueList& theIndexList ); + void succcessiveAnimation( bool& theIsDumping, QValueList& theIndexList ); + void saveImages( int theFieldId, double& theOneVal, int& theNbFiles, QValueList& theIndexList ); + public: //static VISU::Result_i* createPresent (SALOMEDS::SObject_var theField); //static VISU::Storable::TRestoringMap getMapOfValue (SALOMEDS::SObject_var theSObject); @@ -72,8 +93,8 @@ class VISU_TimeAnimation: public QObject, public QThread virtual VISU::VISUType GetType() { return VISU::TNONE;}; - void addField (_PTR(SObject) theField); - void addField (SALOMEDS::SObject_ptr theField); + bool addField (_PTR(SObject) theField); + bool addField (SALOMEDS::SObject_ptr theField); FieldData& getFieldData (int theNum) { return myFieldsLst[theNum]; } CORBA::Boolean generateFrames(); @@ -84,6 +105,7 @@ class VISU_TimeAnimation: public QObject, public QThread void clearData(FieldData& theData); void clearFieldData() { myFieldsLst.clear();}; + void visibilityOff(int num_field, int num_frame); void stopAnimation(); void startAnimation(); void nextFrame(); @@ -97,6 +119,9 @@ class VISU_TimeAnimation: public QObject, public QThread CORBA::Boolean isRunning() { return myIsActive; } CORBA::Long getCurrentFrame() { return myFrame; } + long getAbsoluteFrameNumber(std::pair theFieldTimeStamp); + std::pair getRelativeFrameNumber(long theFrame); + VISU::ColoredPrs3d_ptr getPresentation(CORBA::Long theField, CORBA::Long theFrame); void setPresentationType(CORBA::Long theFieldNum, VISU::VISUType theType) @@ -123,12 +148,14 @@ class VISU_TimeAnimation: public QObject, public QThread QString getLastErrorMsg() { return myLastError; } CORBA::Boolean isCycling() { return myCycling; } + CORBA::Boolean isCleaningMemoryAtEachFrame() { return myCleaningMemoryAtEachFrame; } CORBA::Double getMinTime() { return myTimeMin;} CORBA::Double getMaxTime() { return myTimeMax;} void setProportional(CORBA::Boolean theProp) { myProportional = theProp; } void setCycling(CORBA::Boolean theCycle) { myCycling = theCycle; } + void setCleaningMemoryAtEachFrame(CORBA::Boolean theCycle) { myCleaningMemoryAtEachFrame = theCycle; } SALOMEDS::SObject_ptr publishInStudy(); void restoreFromStudy(SALOMEDS::SObject_ptr theField); @@ -136,9 +163,15 @@ class VISU_TimeAnimation: public QObject, public QThread void saveAnimation(); bool isSavedInStudy() const { return !myAnimEntry.isEmpty(); } + void setAnimationMode(int theMode) { myAnimationMode = theMode; } + int getAnimationMode() { return myAnimationMode; } + + void ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) throw (SALOME::SALOME_Exception); + public slots: void setProportionalSlot(bool theProp) { myProportional = theProp; } void setCyclingSlot(bool theCycle) { myCycling = theCycle; } + void setCleaningMemoryAtEachFrameSlot(bool theCycle) { myCleaningMemoryAtEachFrame = theCycle; } signals: void frameChanged(long theNewFrame, double theTime); @@ -157,11 +190,14 @@ class VISU_TimeAnimation: public QObject, public QThread QValueList myFieldsLst; bool myIsActive; long myFrame; + std::vector myFieldsAbsFrames; int mySpeed; bool myProportional; bool myCycling; + bool myCleaningMemoryAtEachFrame; _PTR(Study) myStudy; + int myAnimationMode; double myTimeMinVal, myTimeMaxVal; //!< Range of time stams, set by user double myTimeMin , myTimeMax ; //!< Range of time stams, available for animation QString myDumpPath; @@ -176,7 +212,7 @@ class VISU_TimeAnimation: public QObject, public QThread }; -class VISU_TimeAnimation_i: public virtual POA_VISU::Animation, +class VISU_I_EXPORT VISU_TimeAnimation_i: public virtual POA_VISU::Animation, public virtual VISU::Base_i { VISU_TimeAnimation* myAnim; @@ -188,7 +224,8 @@ public: virtual VISU::VISUType GetType() { return VISU::TANIMATION; } //virtual VISU::VISUType GetType() { return VISU::TNONE; } - virtual void addField(SALOMEDS::SObject_ptr theField); + virtual bool addField(SALOMEDS::SObject_ptr theField); + virtual void clearFields(); virtual CORBA::Boolean generateFrames(); virtual void generatePresentations(CORBA::Long theFieldNum); @@ -228,17 +265,24 @@ public: virtual char* setDumpFormat(const char* theFormat); virtual CORBA::Boolean isCycling(); + virtual CORBA::Boolean isCleaningMemoryAtEachFrame(); virtual CORBA::Double getMinTime(); virtual CORBA::Double getMaxTime(); virtual void setProportional(CORBA::Boolean theProp); virtual void setCycling(CORBA::Boolean theCycle); + virtual void setCleaningMemoryAtEachFrame(CORBA::Boolean theCycle); virtual SALOMEDS::SObject_ptr publishInStudy(); virtual void restoreFromStudy(SALOMEDS::SObject_ptr theField); virtual CORBA::Boolean isSavedInStudy(); virtual void saveAnimation(); + + virtual void setAnimationMode(VISU::Animation::AnimationMode theMode); + virtual VISU::Animation::AnimationMode getAnimationMode(); + + virtual void ApplyProperties(CORBA::Long theFieldNum, VISU::ColoredPrs3d_ptr thePrs) throw (SALOME::SALOME_Exception); }; #endif //VISU_TIMEANIMATION_H diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index c8bd8a59..e4408f5e 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -82,6 +82,7 @@ Vectors_i(Result_i* theResult, Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), + PrsMerger_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), myVectorsPL(NULL) { @@ -95,6 +96,7 @@ Vectors_i(Result_i* theResult, Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), + PrsMerger_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), myVectorsPL(NULL) { @@ -178,6 +180,17 @@ void VISU::Vectors_i::DoHook(){ } +const char* +VISU::Vectors_i +::GetIconName() +{ + if (!GetNumberOfGeom()) + return "ICON_TREE_VECTORS"; + else + return "ICON_TREE_VECTORS_GROUPS"; +} + + VISU_PipeLine* VISU::Vectors_i::GetPipeLine(){ VISU_PipeLine* aPipeLine = VISU_VectorsPL::New(); aPipeLine->SetIDMapper(myPipeLine->GetIDMapper()); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 9177228d..6348721c 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -32,11 +32,10 @@ class VISU_VectorsPL; namespace VISU{ - class Vectors_i : public virtual POA_VISU::Vectors, + class VISU_I_EXPORT Vectors_i : public virtual POA_VISU::Vectors, public virtual DeformedShape_i { static int myNbPresent; - Vectors_i(); Vectors_i(const Vectors_i&); public: @@ -67,6 +66,9 @@ namespace VISU{ protected: virtual void DoHook(); + + virtual const char* GetIconName(); + virtual VISU_PipeLine* GetPipeLine(); VISU_VectorsPL *myVectorsPL; diff --git a/src/VISU_I/VISU_ViewManager_i.hh b/src/VISU_I/VISU_ViewManager_i.hh index 2fc22558..f026c2aa 100644 --- a/src/VISU_I/VISU_ViewManager_i.hh +++ b/src/VISU_I/VISU_ViewManager_i.hh @@ -46,7 +46,7 @@ namespace VISU { class Prs3d_i; class Curve_i; - class ViewManager_i : public virtual POA_VISU::ViewManager, + class VISU_I_EXPORT ViewManager_i : public virtual POA_VISU::ViewManager, public virtual Base_i { public: @@ -73,7 +73,7 @@ namespace VISU { VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs = NULL); void UpdatePlot2d (Plot2d_ViewFrame *theView, int theDisplaying, Curve_i* theCurve); - VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow); + VISU_I_EXPORT VISU_Actor* GetActor (VISU::Prs3d_i* thePrs, SVTK_ViewWindow* theViewWindow); void DeleteActors (VISU::Prs3d_i* thePrs); void DeleteActors (VISU::Curve_i* thePrs); diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index abb6ad9b..134d8f72 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -1610,8 +1610,8 @@ namespace VISU { _PTR(SObject) anObj = aList[i]; string anEntry = anObj->GetID(); if(MYDEBUG) MESSAGE("View3D_i::SaveViewParams - anEntry = " << anEntry); - if (anObj->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aCmnt (anAttr); + if (anObj->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aCmnt (anAttr); string aComm (aCmnt->Value()); if (MYDEBUG) MESSAGE("View3D_i::SaveViewPoint - aComm = " << aComm); if (aComm.compare(View3D_i::myComment) >= 0) { @@ -1671,8 +1671,8 @@ namespace VISU { _PTR(SObject) anObj = aList[i]; string anEntry = anObj->GetID(); if (MYDEBUG) MESSAGE("View3D_i::RestoreViewPoint - anEntry = " << anEntry); - if (anObj->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aCmnt (anAttr); + if (anObj->FindAttribute(anAttr, "AttributeString")) { + _PTR(AttributeString) aCmnt (anAttr); QString strIn(aCmnt->Value().c_str()); Storable::TRestoringMap aMap; Storable::StrToMap(strIn, aMap); @@ -2001,7 +2001,7 @@ namespace VISU { if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView"); SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) - ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,aVW,thePosition)); + ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetPointOfView,aVW,thePosition)); } void View3D_i::GetPointOfView (SUIT_ViewWindow* theViewWindow, @@ -2031,7 +2031,7 @@ namespace VISU { if(MYDEBUG) MESSAGE("View3D_i::SetViewUp"); SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) - ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,aVW,theViewUp)); + ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetViewUp,aVW,theViewUp)); } void View3D_i::GetViewUp (SUIT_ViewWindow* theViewWindow, @@ -2061,7 +2061,7 @@ namespace VISU { if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint"); SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) - ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,aVW,theCoord)); + ProcessVoidEvent(new TSet3DViewParamEvent(&View3D_i::SetFocalPoint,aVW,theCoord)); } @@ -2113,7 +2113,7 @@ namespace VISU { if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale"); SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) - ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,aVW,theScale)); + ProcessVoidEvent(new TSetViewParamEvent(&View3D_i::SetParallelScale,aVW,theScale)); } CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theViewWindow) @@ -2294,6 +2294,7 @@ namespace VISU { { VISU::VISUType aType = myPrs->GetType(); if (aType != VISU::TSCALARMAP && + aType != VISU::TPRSMERGER && aType != VISU::TDEFORMEDSHAPE && aType != VISU::TSCALARMAPONDEFORMEDSHAPE) { myResult = "Insideframe representation is not available for this type of presentations."; diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index 2000ab79..d57c2965 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -45,7 +45,7 @@ namespace VISU class Prs3d_i; class Curve_i; - class View_i : public virtual POA_VISU::View, + class VISU_I_EXPORT View_i : public virtual POA_VISU::View, public virtual Storable { public: @@ -124,7 +124,7 @@ namespace VISU //=========================================================================== - class XYPlot_i : public virtual POA_VISU::XYPlot, + class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot, public virtual View_i { public: @@ -172,10 +172,10 @@ namespace VISU virtual void Update(); virtual void FitAll(); - virtual void FitXRange(const CORBA::Double xMin,const CORBA::Double xMax); - virtual void FitYRange(const CORBA::Double yMin,const CORBA::Double yMax); - virtual void FitRange(const CORBA::Double xMin,const CORBA::Double xMax, - const CORBA::Double yMin,const CORBA::Double yMax); + virtual void FitXRange(CORBA::Double xMin, CORBA::Double xMax); + virtual void FitYRange(CORBA::Double yMin, CORBA::Double yMax); + virtual void FitRange(CORBA::Double xMin, CORBA::Double xMax, + CORBA::Double yMin, CORBA::Double yMax); virtual void GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax); virtual void Close(); @@ -187,7 +187,7 @@ namespace VISU //=========================================================================== - class TableView_i : public virtual POA_VISU::TableView, + class VISU_I_EXPORT TableView_i : public virtual POA_VISU::TableView, public virtual View_i { public: @@ -210,7 +210,7 @@ namespace VISU //=========================================================================== - class View3D_i : public virtual POA_VISU::View3D, + class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D, public virtual View_i { public: @@ -259,7 +259,7 @@ namespace VISU static void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]); virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord); - static void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]); + static void GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]); virtual VISU::View3D::XYZ_slice* GetFocalPoint(); static void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale); diff --git a/src/VISU_SWIG/Makefile.in b/src/VISU_SWIG/Makefile.in index 98950247..0d032d14 100644 --- a/src/VISU_SWIG/Makefile.in +++ b/src/VISU_SWIG/Makefile.in @@ -43,6 +43,7 @@ EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py bat 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 \ 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 EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py diff --git a/src/VISU_SWIG/VISU_Example_02.py b/src/VISU_SWIG/VISU_Example_02.py index a65f4e50..cfe0ab77 100644 --- a/src/VISU_SWIG/VISU_Example_02.py +++ b/src/VISU_SWIG/VISU_Example_02.py @@ -27,6 +27,7 @@ import visu_gui import SALOMEDS import VISU import os +import sys medFile = os.getenv("DATA_DIR") + "/MedFiles/fra.med" @@ -244,7 +245,12 @@ study_id = salome.myStudy._get_StudyId() print "OK" file_new = str+'/VISU_005_new.hdf' -command = "mv " + file + " " + file_new + +if not sys.platform == "win32": + command = "mv " + file + " " + file_new +else: + command = "move /Y " + file + " " + file_new + os.system(command) file = file_new @@ -375,5 +381,8 @@ if aRestoreRes != 1 : print "Error" else : print "OK" # Remove the study file -command = "rm -r " + file +if not sys.platform == "win32": + command = "rm -r " + file +else: + command = "del /F " + file os.system(command) diff --git a/src/VISU_SWIG/visu.py b/src/VISU_SWIG/visu.py index 15d5b7fe..7ed0b3ff 100644 --- a/src/VISU_SWIG/visu.py +++ b/src/VISU_SWIG/visu.py @@ -463,8 +463,8 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aFieldName = anAttr.Value() print " ", aFieldName - anAttr = aFieldSObj.FindAttribute("AttributeComment")[1] - anAttr = anAttr._narrow(SALOMEDS.AttributeComment); + anAttr = aFieldSObj.FindAttribute("AttributeString")[1] + anAttr = anAttr._narrow(SALOMEDS.AttributeString); aFieldComment = anAttr.Value() aMap = StrToMap(aFieldComment) @@ -479,8 +479,8 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aTimeStampName = anAttr.Value() print " ", aTimeStampName - anAttr = aTimeStampSObj.FindAttribute("AttributeComment")[1] - anAttr = anAttr._narrow(SALOMEDS.AttributeComment); + anAttr = aTimeStampSObj.FindAttribute("AttributeString")[1] + anAttr = anAttr._narrow(SALOMEDS.AttributeString); aTimeStampComment = anAttr.Value() aMap = StrToMap(aTimeStampComment) aMeshName = aMap["myMeshName"] @@ -641,6 +641,26 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aPrsObj.RemoveFromStudy() else : aVISUObjList.append(aPrsObj) + + if HasValue(thePrsTypeList,VISU.TGAUSSPOINTS) : + print " Creating GaussPointsOnField", + aPrsObj = theVisu.GaussPointsOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId) + if aPrsObj is None : print "Error" + else : + print ",OK" + theView.DisplayOnly(aPrsObj) + theView.FitAll() + aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TGAUSSPOINTS." + thePictureExt + aPictureName = re.sub("\s+","_", aPictureName) + theView.SavePicture(aPictureName) + if theIsAutoDelete : + aPrsObj.RemoveFromStudy() + pass + else : + aVISUObjList.append(aPrsObj) + pass + pass + pass return aVISUObjList @@ -951,7 +971,7 @@ def try_vectors_parameters(thePattern, theNum): return anObj -def dump_vetctors_parameters(theObject): +def dump_vectors_parameters(theObject): dump_deformedshape_parameters(theObject) @@ -984,6 +1004,96 @@ def dump_isosurfaces_parameters(theObject): dump_scalarmap_parameters(theObject) print "GetNbSurfaces() = "+ str(theObject.GetNbSurfaces()) +# ---------------------------- +# SCALAR MAP ON DEFORMED SHAPE +# ---------------------------- +def dump_scalarmapondeformedshape_parameters(theObject): + dump_scalarmap_parameters(theObject) + print "GetScale() =", theObject.GetScale() + print "GetScalarCMeshName ()=|",theObject.GetScalarCMeshName(),"|" + print "GetScalarCFieldName()=|",theObject.GetScalarCFieldName(),"|" + print "GetScalarEEntity() =",theObject.GetScalarEEntity() + print "GetScalarLIteration()=",theObject.GetScalarLIteration() + pass + +def try_scalarmapondeformedshape_parameters(thePattern): + + if thePattern is None : return None + import copy + import random + + anObj = try_scalarmap_parameters(thePattern) + + # --- SCALING --- + print + anObj.SetScale( anObj.GetScale()/random.random()*random.randint(1,10)) + + # --- Scalar Field --- + # not implemented yet. + + return anObj +# ---------------------- +# PLOT 3D +# ---------------------- +def dump_plot3d_parameters(theObject): + dump_scalarmap_parameters(theObject) + print "GetOrientationType()=",str(theObject.GetOrientationType()) + print "GetRotateX()=",theObject.GetRotateX() + print "GetRotateY()=",theObject.GetRotateY() + print "GetPlanePosition()=",theObject.GetPlanePosition() + print "IsPositionRelative()=",theObject.IsPositionRelative() + print "GetScaleFactor()=",theObject.GetScaleFactor() + print "GetIsContourPrs()=",theObject.GetIsContourPrs() + print "GetNbOfContours()=",theObject.GetNbOfContours() + pass + +def try_plot3d_parameters(thePattern): + if thePattern is None : return None + import random + + anObj = try_scalarmap_parameters(thePattern) + + ORIENT = [VISU.Plot3D.XY, VISU.Plot3D.YZ, VISU.Plot3D.ZX] + + theXAngle = random.random()*random.randint(-180,180) + theYAngle = random.random()*random.randint(-180,180) + + # ORIENTATION and ANGLES + anObj.SetOrientation(ORIENT[random.randint(0,2)],theXAngle,theYAngle) + + # Plane position (revative) + anObj.SetPlanePosition(random.random(),1) + + # SCALE FACTOR + anObj.SetScaleFactor(random.random()*random.randint(-10000,10000)) + + # CONTOUR PRS + anObj.SetContourPrs(random.randint(0,1)) + if anObj.GetIsContourPrs(): + anObj.SetNbOfContours(random.randint(1,999)) + pass + + pass + +# ---------------------- +# Gauss points +# ---------------------- +def dump_gausspoints_parameters(theObject): + + print "\tGetScalarMode() = " + str(anObj.GetScalarMode()) + print "\tGetMin() = " + str(anObj.GetMin()) + " GetMax() = " + str (anObj.GetMax()) + print "\tGetPosX() = ", str(anObj.GetPosX()) + " GetPosY() = ", str(anObj.GetPosY()) + print "\tGetWidth() = ", str ( anObj.GetWidth()) + " GetHeight() = " + str(anObj.GetHeight()) + print "\tGetNbColors() = " + str(anObj.GetNbColors()) + print "\tGetLabels() = " + str(anObj.GetLabels()) + print "\tGetTitle() = " + str(anObj.GetTitle()) + pass + +def try_plot3d_parameters(thePattern): + if thePattern is None : return None + import random + + pass # ---------------------- # TABLES AND CURVES diff --git a/src/VISU_SWIG/visu_apply_properties.py b/src/VISU_SWIG/visu_apply_properties.py new file mode 100644 index 00000000..cdf8b6f6 --- /dev/null +++ b/src/VISU_SWIG/visu_apply_properties.py @@ -0,0 +1,119 @@ +# VISU VISU_SWIG : binding of C++ implementation and Python +# +# 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_apply_properties.py +# Module : VISU + +import os +import time +import math +import VISU +import SALOMEDS +from visu_gui import * + +aDelay = 0 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "temperature" + +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); + +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(3)[1] +aSObj = aSObj.FindSubObject(1)[1] +print "addField 1 : ", anAnim.addField(aSObj) + +print "Generate presentations for ", anAnim.getNbFields(), " fields" +for i in range(0,anAnim.getNbFields()): + anAnim.setPresentationType(i,VISU.TPLOT3D) + anAnim.generatePresentations(i) + +print "Generate frames" +anAnim.generateFrames() + +print "Start Animation" +anAnim.setSpeed(22) +anAnim.startAnimation() +myView.FitAll() + +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break + +anAnim.publishInStudy() +anAnim.saveAnimation() + +for i in range(0,anAnim.getNbFields()): + aPrs = anAnim.getPresentation(i,0) + aPlot3D = aPrs._narrow(VISU.Plot3D) + + if aPlot3D: + aNbLabels = aPlot3D.GetLabels() + aPlot3D.SetLabels(aNbLabels+3) + + aWidth = aPlot3D.GetWidth() + aHeight = aPlot3D.GetHeight() + aPlot3D.SetSize(aWidth+0.07,aHeight+0.07) + + print "Apply properties for all time stamps of ", i, " field." + try: + anAnim.ApplyProperties(i,aPlot3D) + except SALOME.SALOME_Exception, inst: + msg = "SALOME.SALOME_Exception caught, see details:" + msg+="\n******* text:\t" + inst.details.text + msg+="\n******* type:\t" + str(inst.details.type) + msg+="\n******* where:\t" + inst.details.sourceFile + ":" + \ + str(inst.details.lineNumber) + print msg + raise RuntimeError, "There are some errors were occured... For more info see ERRORs above..." + +print "Generate frames" +anAnim.generateFrames() + +print "Start Animation" +anAnim.startAnimation() +myView.FitAll() + +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break + +anAnim.publishInStudy() +anAnim.saveAnimation() + +anAnim.clearFields() +print "The number of fields in animation after clearFields method is", anAnim.getNbFields() + diff --git a/src/VISU_SWIG/visu_apply_properties_successive.py b/src/VISU_SWIG/visu_apply_properties_successive.py new file mode 100644 index 00000000..b1f931a0 --- /dev/null +++ b/src/VISU_SWIG/visu_apply_properties_successive.py @@ -0,0 +1,135 @@ +# VISU VISU_SWIG : binding of C++ implementation and Python +# +# 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_apply_properties_consecutive.py +# Module : VISU + +import os +import time +import math +import VISU +import SALOMEDS +from visu_gui import * + +aDelay = 0 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "temperature" + +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); +anAnim.setAnimationMode(VISU.Animation.SUCCCESSIVE) + +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(3)[1] +aSObj = aSObj.FindSubObject(1)[1] +print "addField 1 : ", anAnim.addField(aSObj) + +medFile1 = "TimeStamps_import22.med" +myFieldName1 = "pression" + +medFile1 = os.getenv('DATA_DIR') + '/MedFiles/' + medFile1 +myResult1 = myVisu.ImportFile(medFile1) + +aSObj1 = myStudy.FindObjectIOR(myResult1.GetID()) +aSObj1 = aSObj1.FindSubObject(1)[1] +aSObj1 = aSObj1.FindSubObject(3)[1] +aSObj1 = aSObj1.FindSubObject(3)[1] +print "addField 2 : ", anAnim.addField(aSObj1) + +print "Generate presentations for ", anAnim.getNbFields(), " fields" +for i in range(0,anAnim.getNbFields()): + anAnim.setPresentationType(i,VISU.TPLOT3D) + anAnim.generatePresentations(i) + +print "Generate frames" +anAnim.generateFrames() + +print "Start Animation" +anAnim.setSpeed(22) +anAnim.startAnimation() +myView.FitAll() + +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break + +anAnim.publishInStudy() +anAnim.saveAnimation() + +if anAnim.getAnimationMode() == VISU.Animation.SUCCCESSIVE: + print "End of succcessive animation for 2 fields with presentation type VISU.Animation.SUCCCESSIVE" + +#for i in range(0,anAnim.getNbFields()): +aPrs = anAnim.getPresentation(0,0) +aPlot3D = aPrs._narrow(VISU.Plot3D) + +if aPlot3D: + aNbLabels = aPlot3D.GetLabels() + aPlot3D.SetLabels(aNbLabels+3) + + aWidth = aPlot3D.GetWidth() + aHeight = aPlot3D.GetHeight() + aPlot3D.SetSize(aWidth+0.07,aHeight+0.07) + + print "Apply properties for all time stamps of all fields." + try: + anAnim.ApplyProperties(0,aPlot3D) + except SALOME.SALOME_Exception, inst: + msg = "SALOME.SALOME_Exception caught, see details:" + msg+="\n******* text:\t" + inst.details.text + msg+="\n******* type:\t" + str(inst.details.type) + msg+="\n******* where:\t" + inst.details.sourceFile + ":" + \ + str(inst.details.lineNumber) + print msg + raise RuntimeError, "There are some errors were occured... For more info see ERRORs above..." + +print "Generate frames" +anAnim.generateFrames() + +print "Start Animation" +anAnim.startAnimation() +myView.FitAll() + +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break + +anAnim.publishInStudy() +anAnim.saveAnimation() + +anAnim.clearFields() +print "The number of fields in animation after clearFields method is", anAnim.getNbFields() + diff --git a/src/VISU_SWIG/visu_succcessive_animation.py b/src/VISU_SWIG/visu_succcessive_animation.py new file mode 100644 index 00000000..08509e01 --- /dev/null +++ b/src/VISU_SWIG/visu_succcessive_animation.py @@ -0,0 +1,95 @@ +# VISU VISU_SWIG : binding of C++ implementation and Python +# +# 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_view3d.py +# Module : VISU + +import os +import time +import math +import VISU +import SALOMEDS +from visu_gui import * + +aDelay = 0 + +myViewManager = myVisu.GetViewManager(); + +myView = myViewManager.Create3DView(); +myView.SetTitle("The viewer for Animation") +print "myViewManager.Create3DView()" +time.sleep(aDelay) + +medFile = "TimeStamps.med" +myFieldName = "temperature" + +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +myResult = myVisu.ImportFile(medFile) + +anAnim = myVisu.CreateAnimation(myView); +anAnim.setAnimationMode(VISU.Animation.SUCCCESSIVE); + +aSObj = myStudy.FindObjectIOR(myResult.GetID()) +aSObj = aSObj.FindSubObject(1)[1] +aSObj = aSObj.FindSubObject(3)[1] +aSObj = aSObj.FindSubObject(1)[1] +print "addField 1 : ", anAnim.addField(aSObj) + +medFile1 = "TimeStamps_import22.med" +myFieldName1 = "pression" + +medFile1 = os.getenv('DATA_DIR') + '/MedFiles/' + medFile1 +myResult1 = myVisu.ImportFile(medFile1) + +aSObj1 = myStudy.FindObjectIOR(myResult1.GetID()) +aSObj1 = aSObj1.FindSubObject(1)[1] +aSObj1 = aSObj1.FindSubObject(3)[1] +aSObj1 = aSObj1.FindSubObject(3)[1] +print "addField 2 : ", anAnim.addField(aSObj1) + +print "Generate presentations for ", anAnim.getNbFields(), " fields" +for i in range(0,anAnim.getNbFields()): + anAnim.setPresentationType(i,VISU.TPLOT3D) + anAnim.generatePresentations(i) + +print "Generate frames" +anAnim.generateFrames() + +print "Start Animation" +anAnim.setSpeed(22) +anAnim.startAnimation() +myView.FitAll() + +while 1: + time.sleep(1+aDelay) + if not anAnim.isRunning(): + anAnim.stopAnimation() + break + +anAnim.publishInStudy() +anAnim.saveAnimation() + +if anAnim.getAnimationMode() == VISU.Animation.SUCCCESSIVE: + print "End of succcessive animation for 2 fields with presentation type VISU.Animation.SUCCCESSIVE" + +anAnim.clearFields() +print "The number of fields in animation after clearFields method is", anAnim.getNbFields() + diff --git a/src/VVTK/VVTK.h b/src/VVTK/VVTK.h index 285a0b34..5954601c 100755 --- a/src/VVTK/VVTK.h +++ b/src/VVTK/VVTK.h @@ -18,7 +18,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifdef WNT -#ifdef SVTK_EXPORTS +#ifdef VISU_VVTK_EXPORTS #define VVTK_EXPORT __declspec(dllexport) #else #define VVTK_EXPORT __declspec(dllimport) diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 4aa149fd..63cf2bc0 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -34,6 +34,7 @@ #include "VISU_GaussPtsAct.h" #include "VISU_Event.h" +#include "SVTK_ViewWindow.h" #include "SVTK_RenderWindowInteractor.h" #include "VVTK_Renderer.h" #include "VVTK_PickingDlg.h" @@ -237,9 +238,6 @@ void VVTK_MainWindow::OnStopRecording() } //---------------------------------------------------------------------------- -int -convertAction( const int accelAction ); - void VVTK_MainWindow ::action( const int accelAction ) @@ -247,7 +245,7 @@ VVTK_MainWindow if ( accelAction == SUIT_Accel::ZoomFit ) onFitAll(); else { - int anEvent = convertAction( accelAction ); + int anEvent = SVTK::convertAction( accelAction ); InvokeEvent( anEvent, 0 ); } } diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index 3d0a5f4d..e59a57e9 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -394,9 +394,15 @@ void VVTK_PickingDlg::onClickHelp() if (app) app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VVTK/VVTK_PrimitiveBox.cxx b/src/VVTK/VVTK_PrimitiveBox.cxx index fc0aaa75..908d825b 100644 --- a/src/VVTK/VVTK_PrimitiveBox.cxx +++ b/src/VVTK/VVTK_PrimitiveBox.cxx @@ -43,7 +43,7 @@ #include #include -#include +#include using namespace std; diff --git a/src/VVTK/VVTK_PrimitiveBox.h b/src/VVTK/VVTK_PrimitiveBox.h index e5e8c6a3..722d17f2 100644 --- a/src/VVTK/VVTK_PrimitiveBox.h +++ b/src/VVTK/VVTK_PrimitiveBox.h @@ -28,6 +28,8 @@ #ifndef VVTK_PRIMITIVEBOX_H #define VVTK_PRIMITIVEBOX_H +#include "VVTK.h" + #include class QLabel; @@ -38,7 +40,7 @@ class QRadioButton; class QtxDblSpinBox; class QtxIntSpinBox; -class VVTK_PrimitiveBox : public QGroupBox +class VVTK_EXPORT VVTK_PrimitiveBox : public QGroupBox { Q_OBJECT diff --git a/src/VVTK/VVTK_Recorder.cxx b/src/VVTK/VVTK_Recorder.cxx index 873d4af5..f42b7252 100755 --- a/src/VVTK/VVTK_Recorder.cxx +++ b/src/VVTK/VVTK_Recorder.cxx @@ -44,7 +44,10 @@ #include #include +#ifndef WIN32 #include +#endif + #include #include @@ -351,7 +354,7 @@ VVTK_Recorder int aLastFrameIndex = myFrameIndexes.back(); if(aLastFrameIndex < 0){ myFrameIndexes.back() = abs(myFrameIndexes.back()); - double aPauseTime = fabs(aFrameIndex - myFrameIndex - 1) / myNbFPS; + double aPauseTime = fabs((double)(aFrameIndex - myFrameIndex - 1)) / myNbFPS; if(MYDEBUG) cout<<"VVTK_Recorder::DoRecord - aFrameIndex = "<resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 8517d78d..8b56aede 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -249,7 +249,7 @@ VVTK_Renderer1::VVTK_Renderer1(): vtkProperty* aPlaneProperty = aPlanesWidget->GetPlaneProperty(); aPlaneProperty->SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5); // - myWidgetCtrl->Delete(); + //myWidgetCtrl->Delete(); } VVTK_Renderer1 @@ -334,7 +334,7 @@ VISU_WidgetCtrl* VVTK_Renderer1 ::GetWidgetCtrl() { - return myWidgetCtrl.GetPointer(); + return myWidgetCtrl;//.GetPointer(); } //---------------------------------------------------------------------------- diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 6cf53326..45c7e949 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -125,7 +125,8 @@ class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer void AdjustWidgetCtrl(); - vtkSmartPointer myWidgetCtrl; + VISU_WidgetCtrl* myWidgetCtrl; + //vtkSmartPointer myWidgetCtrl; VISU_OutsideCursorSettings* myOutsideCursorSettings; vtkSmartPointer myTextActor; }; diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 0c20ac64..55b1fb7a 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -80,7 +80,12 @@ namespace VISU { QFileInfo aFileInfo(theImageFileName); QString aFormat = aFileInfo.extension(FALSE); - QString aVTIName = QString("/tmp/") + getenv("USER") + "-" + aFileInfo.baseName(TRUE) + ".vti"; +#ifdef WIN32 + QString aTmpDir = getenv( "TEMP" ); +#else + QString aTmpDir = QString( "/tmp/" ) + getenv("USER"); +#endif + QString aVTIName = aTmpDir + "-" + aFileInfo.baseName(TRUE) + ".vti"; QString aCommand = QString( "VISU_img2vti " ) + aFormat + " " + theImageFileName + " " + aVTIName; if(system( aCommand.latin1() ) == 0) @@ -94,7 +99,11 @@ namespace VISU RemoveFile(const QString& theFileName) { if( !theFileName.isNull() ){ +#ifndef WNT QString aCommand = QString( "rm -fr " ) + theFileName; +#else: + QString aCommand = QString( "del /F " ) + theFileName; +#endif system( aCommand.latin1() ); } } @@ -830,9 +839,15 @@ void VVTK_SegmentationCursorDlg::onClickHelp() if (app) app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName), QObject::tr("BUT_OK")); } } diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h index 082608ea..50d17609 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ b/src/VVTK/VVTK_SegmentationCursorDlg.h @@ -24,6 +24,8 @@ #ifndef VVTK_SEGMENTATIONCURSORDLG_H #define VVTK_SEGMENTATIONCURSORDLG_H +#include "VVTK.h" + #include #include @@ -59,7 +61,7 @@ namespace VISU { typedef vtkSmartPointer TTextureValue; - TTextureValue + VVTK_EXPORT TTextureValue GetTexture(const QString& theMainTexture, const QString& theAlphaTexture); } diff --git a/src/VVTK/VVTK_SizeBox.h b/src/VVTK/VVTK_SizeBox.h index 1979ef7b..06e3971c 100644 --- a/src/VVTK/VVTK_SizeBox.h +++ b/src/VVTK/VVTK_SizeBox.h @@ -28,6 +28,8 @@ #ifndef VVTK_SIZEBOX_H #define VVTK_SIZEBOX_H +#include "VVTK.h" + #include class QLabel; @@ -39,7 +41,7 @@ class QGroupBox; class QtxDblSpinBox; class QtxIntSpinBox; -class VVTK_SizeBox : public QVBox +class VVTK_EXPORT VVTK_SizeBox : public QVBox { Q_OBJECT -- 2.39.2