]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
This commit was generated by cvs2git to create branch 'BR-D5-38-2003_Base'. BR-D5-38-2003_D2005-27-10
authoradmin <salome-admin@opencascade.com>
Thu, 27 Oct 2005 14:00:09 +0000 (14:00 +0000)
committeradmin <salome-admin@opencascade.com>
Thu, 27 Oct 2005 14:00:09 +0000 (14:00 +0000)
Sprout from master 2005-10-27 11:59:06 UTC mzn <mzn@opencascade.com> 'Fix for bug PAL9160 ( No shading on visualizations ).'
Cherrypick from BR-D5-38-2003 2005-10-27 14:00:08 UTC apo <apo@opencascade.com> 'Adjust to HEAD modifications':
    adm_local/unix/make_commence.in
    doc/salome/tui/VISU/doxyfile
    idl/VISU_Gen.idl
    resources/Vertex_Program_ARB.txt
    resources/Visu_PlaneSegmentation.png
    resources/Visu_gauss_points.png
    resources/Visu_load_texture.png
    resources/Visu_vvtk_switch.png
    resources/sprite_alpha.bmp
    resources/sprite_texture.bmp
    src/CONVERTOR/Makefile.in
    src/CONVERTOR/VISUConvertor.cxx
    src/CONVERTOR/VISU_Convertor.cxx
    src/CONVERTOR/VISU_Convertor.hxx
    src/CONVERTOR/VISU_ConvertorDef.hxx
    src/CONVERTOR/VISU_Convertor_impl.cxx
    src/CONVERTOR/VISU_Convertor_impl.hxx
    src/CONVERTOR/VISU_IDMapper.cxx
    src/CONVERTOR/VISU_IDMapper.hxx
    src/CONVERTOR/VISU_MedConvertor.cxx
    src/CONVERTOR/VISU_MedConvertor.hxx
    src/CONVERTOR/VISU_MergeFilter.cxx
    src/CONVERTOR/VISU_MergeFilter.hxx
    src/ENGINE/VISU_Engine_i.cc
    src/ENGINE/VISU_Engine_i.hh
    src/Makefile.in
    src/OBJECT/Makefile.in
    src/OBJECT/VISU_Actor.cxx
    src/OBJECT/VISU_Actor.h
    src/OBJECT/VISU_ActorFactory.h
    src/OBJECT/VISU_Event.h
    src/OBJECT/VISU_GaussPtsAct.cxx
    src/OBJECT/VISU_GaussPtsAct.h
    src/OBJECT/VISU_GaussPtsActorFactory.h
    src/OBJECT/VISU_GaussPtsDeviceActor.cxx
    src/OBJECT/VISU_GaussPtsDeviceActor.h
    src/OBJECT/VISU_GaussPtsSettings.cxx
    src/OBJECT/VISU_GaussPtsSettings.h
    src/OBJECT/VISU_MeshAct.cxx
    src/OBJECT/VISU_ScalarMapAct.cxx
    src/PIPELINE/Makefile.in
    src/PIPELINE/SALOME_ExtractGeometry.cxx
    src/PIPELINE/SALOME_ExtractGeometry.h
    src/PIPELINE/VISUPipeLine.cxx
    src/PIPELINE/VISU_CutLinesPL.cxx
    src/PIPELINE/VISU_CutPlanesPL.cxx
    src/PIPELINE/VISU_DeformedShapePL.cxx
    src/PIPELINE/VISU_Extractor.cxx
    src/PIPELINE/VISU_GaussPointsPL.cxx
    src/PIPELINE/VISU_GaussPointsPL.hxx
    src/PIPELINE/VISU_ImplicitFunctionWidget.cxx
    src/PIPELINE/VISU_ImplicitFunctionWidget.h
    src/PIPELINE/VISU_IsoSurfacesPL.cxx
    src/PIPELINE/VISU_LookupTable.cxx
    src/PIPELINE/VISU_LookupTable.hxx
    src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
    src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx
    src/PIPELINE/VISU_PipeLine.cxx
    src/PIPELINE/VISU_PipeLine.hxx
    src/PIPELINE/VISU_Plot3DPL.cxx
    src/PIPELINE/VISU_ScalarBarCtrl.cxx
    src/PIPELINE/VISU_ScalarBarCtrl.hxx
    src/PIPELINE/VISU_ScalarMapPL.cxx
    src/PIPELINE/VISU_ScalarMapPL.hxx
    src/PIPELINE/VISU_StreamLinesPL.cxx
    src/PIPELINE/VISU_VectorsPL.cxx
    src/PIPELINE/VISU_img2vti.cxx
    src/VISUGUI/Makefile.in
    src/VISUGUI/VISUM_images.po
    src/VISUGUI/VISUM_msg_en.po
    src/VISUGUI/VisuGUI.cxx
    src/VISUGUI/VisuGUI.h
    src/VISUGUI/VisuGUI_Factory.cxx
    src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
    src/VISUGUI/VisuGUI_GaussPointsDlg.h
    src/VISUGUI/VisuGUI_Module.cxx
    src/VISUGUI/VisuGUI_Module.h
    src/VISUGUI/VisuGUI_PopupTools.cxx
    src/VISUGUI/VisuGUI_PopupTools.h
    src/VISUGUI/VisuGUI_Prs3dTools.h
    src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
    src/VISUGUI/VisuGUI_ScalarBarDlg.h
    src/VISUGUI/VisuGUI_Selection.cxx
    src/VISUGUI/VisuGUI_TimeAnimation.cxx
    src/VISUGUI/VisuGUI_Timer.cxx
    src/VISUGUI/VisuGUI_Timer.h
    src/VISUGUI/VisuGUI_Tools.cxx
    src/VISUGUI/VisuGUI_Tools.h
    src/VISUGUI/VisuGUI_ViewTools.cxx
    src/VISUGUI/VisuGUI_ViewTools.h
    src/VISU_I/Makefile.in
    src/VISU_I/VISUConfig.hh
    src/VISU_I/VISU_ColoredPrs3d_i.cc
    src/VISU_I/VISU_ColoredPrs3d_i.hh
    src/VISU_I/VISU_CorbaMedConvertor.cxx
    src/VISU_I/VISU_CorbaMedConvertor.hxx
    src/VISU_I/VISU_CutLines_i.cc
    src/VISU_I/VISU_CutLines_i.hh
    src/VISU_I/VISU_CutPlanes_i.cc
    src/VISU_I/VISU_CutPlanes_i.hh
    src/VISU_I/VISU_DeformedShape_i.cc
    src/VISU_I/VISU_DeformedShape_i.hh
    src/VISU_I/VISU_GaussPoints_i.cc
    src/VISU_I/VISU_GaussPoints_i.hh
    src/VISU_I/VISU_Gen_i.cc
    src/VISU_I/VISU_Gen_i.hh
    src/VISU_I/VISU_I.cxx
    src/VISU_I/VISU_IsoSurfaces_i.cc
    src/VISU_I/VISU_IsoSurfaces_i.hh
    src/VISU_I/VISU_Mesh_i.cc
    src/VISU_I/VISU_Plot3D_i.cc
    src/VISU_I/VISU_Plot3D_i.hh
    src/VISU_I/VISU_Prs3d_i.cc
    src/VISU_I/VISU_Prs3d_i.hh
    src/VISU_I/VISU_Result_i.cc
    src/VISU_I/VISU_ScalarMap_i.cc
    src/VISU_I/VISU_ScalarMap_i.hh
    src/VISU_I/VISU_StreamLines_i.cc
    src/VISU_I/VISU_StreamLines_i.hh
    src/VISU_I/VISU_TimeAnimation.cxx
    src/VISU_I/VISU_Vectors_i.cc
    src/VISU_I/VISU_Vectors_i.hh
    src/VISU_I/VISU_ViewManager_i.cc
    src/VISU_I/VISU_View_i.cc
    src/VISU_SWIG/Makefile.in
    src/VISU_SWIG/VISU_Gen_s.cc
    src/VVTK/Makefile.in
    src/VVTK/VVTK.h
    src/VVTK/VVTK_InteractorStyle.cxx
    src/VVTK/VVTK_InteractorStyle.h
    src/VVTK/VVTK_MainWindow.cxx
    src/VVTK/VVTK_MainWindow.h
    src/VVTK/VVTK_PickingDlg.cxx
    src/VVTK/VVTK_PickingDlg.h
    src/VVTK/VVTK_Renderer.cxx
    src/VVTK/VVTK_Renderer.h
    src/VVTK/VVTK_SegmentationCursorDlg.cxx
    src/VVTK/VVTK_SegmentationCursorDlg.h
    src/VVTK/VVTK_ViewManager.cxx
    src/VVTK/VVTK_ViewManager.h
    src/VVTK/VVTK_ViewModel.cxx
    src/VVTK/VVTK_ViewModel.h
    src/VVTK/VVTK_ViewWindow.cxx
    src/VVTK/VVTK_ViewWindow.h
Cherrypick from IMPORT 2003-10-14 08:11:44 UTC nri <nri@opencascade.com> 'sources v1.2c':
    resources/Visu_cutlines.png
    src/PIPELINE/VISU_CutLinesPL.hxx
    src/PIPELINE/VISU_MeshPL.hxx
    src/PIPELINE/VISU_PipeLineUtils.cxx
    src/PIPELINE/VISU_ScalarBarActor.hxx
    src/PIPELINE/VISU_UsedPointsFilter.hxx
    src/VISU_SWIG/VISU_Gen_s.hh
    src/VISU_SWIG/visu_gui.py
Delete:
    src/VISUGUI/VisuGUI_CubeAxesDlg.cxx
    src/VISUGUI/VisuGUI_CubeAxesDlg.h
    src/VISUGUI/VisuGUI_FontWg.cxx
    src/VISUGUI/VisuGUI_FontWg.h
    src/VISUGUI/VisuGUI_NonIsometricDlg.cxx
    src/VISUGUI/VisuGUI_NonIsometricDlg.h

150 files changed:
adm_local/unix/make_commence.in
doc/salome/tui/VISU/doxyfile
idl/VISU_Gen.idl
resources/Vertex_Program_ARB.txt [new file with mode: 0755]
resources/Visu_PlaneSegmentation.png [new file with mode: 0644]
resources/Visu_gauss_points.png [new file with mode: 0644]
resources/Visu_load_texture.png [new file with mode: 0755]
resources/Visu_vvtk_switch.png [new file with mode: 0644]
resources/sprite_alpha.bmp [new file with mode: 0644]
resources/sprite_texture.bmp [new file with mode: 0644]
src/CONVERTOR/Makefile.in
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_Convertor.cxx
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_ConvertorDef.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_IDMapper.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_IDMapper.hxx [new file with mode: 0644]
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/CONVERTOR/VISU_MergeFilter.cxx [new file with mode: 0644]
src/CONVERTOR/VISU_MergeFilter.hxx [new file with mode: 0644]
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/Makefile.in
src/OBJECT/Makefile.in
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_Actor.h
src/OBJECT/VISU_ActorFactory.h [new file with mode: 0644]
src/OBJECT/VISU_Event.h [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsAct.cxx [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsAct.h [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsActorFactory.h [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsDeviceActor.cxx [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsDeviceActor.h [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsSettings.cxx [new file with mode: 0644]
src/OBJECT/VISU_GaussPtsSettings.h [new file with mode: 0644]
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_ScalarMapAct.cxx
src/PIPELINE/Makefile.in
src/PIPELINE/SALOME_ExtractGeometry.cxx
src/PIPELINE/SALOME_ExtractGeometry.h
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_Extractor.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx [new file with mode: 0644]
src/PIPELINE/VISU_GaussPointsPL.hxx [new file with mode: 0644]
src/PIPELINE/VISU_ImplicitFunctionWidget.cxx [new file with mode: 0644]
src/PIPELINE/VISU_ImplicitFunctionWidget.h [new file with mode: 0644]
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_LookupTable.cxx
src/PIPELINE/VISU_LookupTable.hxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx [new file with mode: 0755]
src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx [new file with mode: 0755]
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_ScalarBarCtrl.cxx [new file with mode: 0644]
src/PIPELINE/VISU_ScalarBarCtrl.hxx [new file with mode: 0644]
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_ScalarMapPL.hxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_img2vti.cxx [new file with mode: 0644]
src/VISUGUI/Makefile.in
src/VISUGUI/VISUM_images.po [new file with mode: 0644]
src/VISUGUI/VISUM_msg_en.po [new file with mode: 0644]
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_CubeAxesDlg.cxx [deleted file]
src/VISUGUI/VisuGUI_CubeAxesDlg.h [deleted file]
src/VISUGUI/VisuGUI_Factory.cxx
src/VISUGUI/VisuGUI_FontWg.cxx [deleted file]
src/VISUGUI/VisuGUI_FontWg.h [deleted file]
src/VISUGUI/VisuGUI_GaussPointsDlg.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_GaussPointsDlg.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Module.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_Module.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_NonIsometricDlg.cxx [deleted file]
src/VISUGUI/VisuGUI_NonIsometricDlg.h [deleted file]
src/VISUGUI/VisuGUI_PopupTools.cxx
src/VISUGUI/VisuGUI_PopupTools.h
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISUGUI/VisuGUI_ScalarBarDlg.cxx
src/VISUGUI/VisuGUI_ScalarBarDlg.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_TimeAnimation.cxx
src/VISUGUI/VisuGUI_Timer.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_Timer.h [new file with mode: 0644]
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_Tools.h
src/VISUGUI/VisuGUI_ViewTools.cxx [new file with mode: 0644]
src/VISUGUI/VisuGUI_ViewTools.h [new file with mode: 0644]
src/VISU_I/Makefile.in
src/VISU_I/VISUConfig.hh
src/VISU_I/VISU_ColoredPrs3d_i.cc [new file with mode: 0644]
src/VISU_I/VISU_ColoredPrs3d_i.hh [new file with mode: 0644]
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.hxx
src/VISU_I/VISU_CutLines_i.cc
src/VISU_I/VISU_CutLines_i.hh
src/VISU_I/VISU_CutPlanes_i.cc
src/VISU_I/VISU_CutPlanes_i.hh
src/VISU_I/VISU_DeformedShape_i.cc
src/VISU_I/VISU_DeformedShape_i.hh
src/VISU_I/VISU_GaussPoints_i.cc [new file with mode: 0644]
src/VISU_I/VISU_GaussPoints_i.hh [new file with mode: 0644]
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_I.cxx [new file with mode: 0644]
src/VISU_I/VISU_IsoSurfaces_i.cc
src/VISU_I/VISU_IsoSurfaces_i.hh
src/VISU_I/VISU_Mesh_i.cc
src/VISU_I/VISU_Plot3D_i.cc
src/VISU_I/VISU_Plot3D_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_Prs3d_i.hh
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh
src/VISU_I/VISU_StreamLines_i.cc
src/VISU_I/VISU_StreamLines_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_Vectors_i.cc
src/VISU_I/VISU_Vectors_i.hh
src/VISU_I/VISU_ViewManager_i.cc
src/VISU_I/VISU_View_i.cc
src/VISU_SWIG/Makefile.in
src/VISU_SWIG/VISU_Gen_s.cc
src/VVTK/Makefile.in [new file with mode: 0755]
src/VVTK/VVTK.h [new file with mode: 0755]
src/VVTK/VVTK_InteractorStyle.cxx [new file with mode: 0644]
src/VVTK/VVTK_InteractorStyle.h [new file with mode: 0644]
src/VVTK/VVTK_MainWindow.cxx [new file with mode: 0644]
src/VVTK/VVTK_MainWindow.h [new file with mode: 0644]
src/VVTK/VVTK_PickingDlg.cxx [new file with mode: 0644]
src/VVTK/VVTK_PickingDlg.h [new file with mode: 0644]
src/VVTK/VVTK_Renderer.cxx [new file with mode: 0644]
src/VVTK/VVTK_Renderer.h [new file with mode: 0644]
src/VVTK/VVTK_SegmentationCursorDlg.cxx [new file with mode: 0644]
src/VVTK/VVTK_SegmentationCursorDlg.h [new file with mode: 0644]
src/VVTK/VVTK_ViewManager.cxx [new file with mode: 0644]
src/VVTK/VVTK_ViewManager.h [new file with mode: 0644]
src/VVTK/VVTK_ViewModel.cxx [new file with mode: 0644]
src/VVTK/VVTK_ViewModel.h [new file with mode: 0644]
src/VVTK/VVTK_ViewWindow.cxx [new file with mode: 0755]
src/VVTK/VVTK_ViewWindow.h [new file with mode: 0755]

index 549610f5fa86769c350b1e28148c5f5735ae104b..574db11c074eba24f9f9fcb8d039cf0bb4f3aee9 100644 (file)
@@ -37,6 +37,7 @@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
 # BOOST Library
 
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
 
 # JAVA
 
index 3ee35aeac5ac3d7e1407955243367dd79c02ee55..b4346ae412b2fe168c9fcd034d32689d2a388fcf 100755 (executable)
@@ -1,73 +1,89 @@
-# Doxyfile 1.3-rc1
+# Doxyfile 1.3.7
 
 #---------------------------------------------------------------------------
-# General configuration options
+# Project related configuration options
 #---------------------------------------------------------------------------
-PROJECT_NAME           = "SALOME - VISU - v.2.1.0"
+PROJECT_NAME           = "SALOME v.3.1.0a"
 PROJECT_NUMBER         = id#1.1
 OUTPUT_DIRECTORY       = ../
+CREATE_SUBDIRS         = NO
 OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = NO
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = NO
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 5
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = YES
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
 EXTRACT_ALL            = YES
 EXTRACT_PRIVATE        = YES
 EXTRACT_STATIC         = YES
 EXTRACT_LOCAL_CLASSES  = YES
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = YES
+HIDE_UNDOC_CLASSES     = YES
 HIDE_FRIEND_COMPOUNDS  = NO
 HIDE_IN_BODY_DOCS      = NO
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = NO
-ALWAYS_DETAILED_SEC    = YES
-INLINE_INHERITED_MEMB  = YES
-FULL_PATH_NAMES        = NO
-STRIP_FROM_PATH        = 
 INTERNAL_DOCS          = YES
 CASE_SENSE_NAMES       = YES
-SHORT_NAMES            = NO
 HIDE_SCOPE_NAMES       = NO
-VERBATIM_HEADERS       = YES
 SHOW_INCLUDE_FILES     = YES
-JAVADOC_AUTOBRIEF      = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP         = NO
-INHERIT_DOCS           = YES
 INLINE_INFO            = YES
 SORT_MEMBER_DOCS       = NO
-DISTRIBUTE_GROUP_DOC   = NO
-TAB_SIZE               = 5
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
 GENERATE_TODOLIST      = YES
 GENERATE_TESTLIST      = YES
 GENERATE_BUGLIST       = YES
 GENERATE_DEPRECATEDLIST= YES
-ALIASES                = 
 ENABLED_SECTIONS       = 
 MAX_INITIALIZER_LINES  = 25
-OPTIMIZE_OUTPUT_FOR_C  = YES
-OPTIMIZE_OUTPUT_JAVA   = YES
 SHOW_USED_FILES        = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
 QUIET                  = NO
 WARNINGS               = YES
 WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
 WARN_FORMAT            = "$file:$line: $text"
 WARN_LOGFILE           = log.txt
+
 #---------------------------------------------------------------------------
 # configuration options related to the input files
 #---------------------------------------------------------------------------
-INPUT                  = ../../../share/salome/idl/VISU_Gen.idl
-FILE_PATTERNS          = 
-RECURSIVE              = NO
+INPUT                  = ../../../share/salome/src \
+                        ../../../share/salome/idl
+FILE_PATTERNS          = *.idl *.h *.hh *.hxx *.c *.cc *.cxx *.ixx *.jxx
+RECURSIVE              = YES
 EXCLUDE                = 
 EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       = 
 EXAMPLE_PATH           = 
 EXAMPLE_PATTERNS       = 
-EXAMPLE_RECURSIVE      = NO
+EXAMPLE_RECURSIVE      = YES
 IMAGE_PATH             = sources/
 INPUT_FILTER           = 
 FILTER_SOURCE_FILES    = YES
+
 #---------------------------------------------------------------------------
 # configuration options related to source browsing
 #---------------------------------------------------------------------------
@@ -76,12 +92,15 @@ INLINE_SOURCES         = NO
 STRIP_CODE_COMMENTS    = YES
 REFERENCED_BY_RELATION = NO
 REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+
 #---------------------------------------------------------------------------
 # configuration options related to the alphabetical class index
 #---------------------------------------------------------------------------
 ALPHABETICAL_INDEX     = NO
 COLS_IN_ALPHA_INDEX    = 5
 IGNORE_PREFIX          = 
+
 #---------------------------------------------------------------------------
 # configuration options related to the HTML output
 #---------------------------------------------------------------------------
@@ -102,6 +121,7 @@ DISABLE_INDEX          = YES
 ENUM_VALUES_PER_LINE   = 4
 GENERATE_TREEVIEW      = YES
 TREEVIEW_WIDTH         = 250
+
 #---------------------------------------------------------------------------
 # configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
@@ -116,6 +136,8 @@ LATEX_HEADER           =
 PDF_HYPERLINKS         = NO
 USE_PDFLATEX           = NO
 LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the RTF output
 #---------------------------------------------------------------------------
@@ -125,6 +147,7 @@ COMPACT_RTF            = NO
 RTF_HYPERLINKS         = NO
 RTF_STYLESHEET_FILE    = 
 RTF_EXTENSIONS_FILE    = 
+
 #---------------------------------------------------------------------------
 # configuration options related to the man page output
 #---------------------------------------------------------------------------
@@ -132,16 +155,21 @@ GENERATE_MAN           = NO
 MAN_OUTPUT             = man
 MAN_EXTENSION          = .3
 MAN_LINKS              = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the XML output
 #---------------------------------------------------------------------------
 GENERATE_XML           = NO
+XML_OUTPUT             = xml
 XML_SCHEMA             = 
 XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+
 #---------------------------------------------------------------------------
 # configuration options for the AutoGen Definitions output
 #---------------------------------------------------------------------------
 GENERATE_AUTOGEN_DEF   = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the Perl module output
 #---------------------------------------------------------------------------
@@ -149,6 +177,7 @@ GENERATE_PERLMOD       = NO
 PERLMOD_LATEX          = NO
 PERLMOD_PRETTY         = YES
 PERLMOD_MAKEVAR_PREFIX = 
+
 #---------------------------------------------------------------------------
 # Configuration options related to the preprocessor   
 #---------------------------------------------------------------------------
@@ -161,14 +190,16 @@ INCLUDE_FILE_PATTERNS  =
 PREDEFINED             = 
 EXPAND_AS_DEFINED      = 
 SKIP_FUNCTION_MACROS   = NO
+
 #---------------------------------------------------------------------------
-# Configuration::addtions related to external references   
+# Configuration::additions related to external references   
 #---------------------------------------------------------------------------
 TAGFILES               = 
 GENERATE_TAGFILE       = 
 ALLEXTERNALS           = NO
 EXTERNAL_GROUPS        = YES
 PERL_PATH              = /usr/bin/perl
+
 #---------------------------------------------------------------------------
 # Configuration options related to the dot tool   
 #---------------------------------------------------------------------------
@@ -177,24 +208,22 @@ HIDE_UNDOC_RELATIONS   = NO
 HAVE_DOT               = YES
 CLASS_GRAPH            = YES
 COLLABORATION_GRAPH    = NO
+UML_LOOK               = NO
 TEMPLATE_RELATIONS     = YES
 INCLUDE_GRAPH          = YES
 INCLUDED_BY_GRAPH      = NO
+CALL_GRAPH             = NO
 GRAPHICAL_HIERARCHY    = YES
 DOT_IMAGE_FORMAT       = jpg
 DOT_PATH               = 
 DOTFILE_DIRS           = 
 MAX_DOT_GRAPH_WIDTH    = 1024
 MAX_DOT_GRAPH_HEIGHT   = 1200
+MAX_DOT_GRAPH_DEPTH    = 0
 GENERATE_LEGEND        = NO
 DOT_CLEANUP            = YES
+
 #---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine   
+# Configuration::additions related to the search engine   
 #---------------------------------------------------------------------------
 SEARCHENGINE           = NO
-CGI_NAME               = search.cgi
-CGI_URL                = 
-DOC_URL                = 
-DOC_ABSPATH            = 
-BIN_ABSPATH            = /usr/local/bin/
-EXT_DOC_PATHS          = 
index 0138653ae039479e0b89f63d4d1f2cfa0db25625..2b04645b5cc2ac0ed80d5513911172789e3fad00 100644 (file)
@@ -59,6 +59,7 @@ module VISU {
     TSCALARMAP, /*!< Scalarmap 3D presentation object */
     TISOSURFACE, /*!< Iso surface 3D presentation object */
     TDEFORMEDSHAPE, /*!< Deformed shape 3D presentation object */
+    TGAUSSPOINTS, /*!< Gauss Points 3D presentation object */
     TPLOT3D, /*!< Plot3D 3D presentation object */
     TCUTPLANES, /*!< Cut planes 3D presentation object */
     TCUTLINES, /*!< Cut lines 3D presentation object */
@@ -70,6 +71,7 @@ module VISU {
     TXYPLOT, /*!< 2D XY plot consisting of one or several curve lines */
     TTABLEVIEW, /*!< Table view is used for displaying data tables */
     TVIEW3D, /*!< 3D view is used for displaying 3D graphical presentations */
+    TGAUSSVIEW, /*!< 3D view is used for displaying Gauss Points graphical presentations */
     TENTITY, /*!< An element composing a mesh: node, edge, face or cell */
     TFAMILY, /*!< The whole mesh can be divided into one or several submeshes, called families, which are defined by the user. Each family in its turn is composed of entities of a definite type. */
     TGROUP, /*!< A group of families */
@@ -364,8 +366,9 @@ module VISU {
     PresentationType GetPresentationType();
   };
 
+
   //-------------------------------------------------------
-  /*! \brief Interface of the %Scalar Map
+  /*! \brief Basic Interface for the %Colored 3D Presentations
    *
    * This interface is responsable for coloring of 3D field presentations
    * according the scalar values applied to different cells.
@@ -373,7 +376,7 @@ module VISU {
    * bar is displayed along with each colored field presentation and serves for
    * consulting the correspondance between colors and data values.
    */
-  interface ScalarMap : Prs3d {
+  interface ColoredPrd3d : Prs3d {
     /*! Sets the method of coloring of the elements composing a 3D presentation.
      */
     void SetScalarMode(in long theScalarMode);
@@ -382,52 +385,6 @@ module VISU {
      */
     long GetScalarMode();
 
-    /*!
-     * Sets the type of scaling of the values reflected by the scalar bar.
-     * \param theScaling The value of this parameter is taken from the <VAR>Scaling</VAR> enumeration.
-     */
-    void SetScaling(in Scaling theScaling);
-
-    /*!
-     * Gets the type of scaling of the values reflected by this presentation.
-     */
-    Scaling GetScaling();
-
-    /*!
-     * Sets scalar range - min and max boundaries of the scalar bar.
-     * \param theMin  Min boundary of the scalar bar.
-     * \param theMax  Max boundary of the scalar bar.
-     */
-    void SetRange(in double theMin, in double theMax);
-
-    /*!
-     * Gets the min boundary of the scalar bar.
-     */
-    double GetMin();
-
-    /*!
-     * Gets the max boundary of the scalar bar.
-     */
-    double GetMax();
-
-    /*! %Orientation of the scalar bar. */
-    enum Orientation {
-      HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
-      VERTICAL    /*!< Vertical orientation of the scalar bar.*/
-    };
-
-    /*!
-     * Sets the type of orientation of the scalar bar.
-     * \param theOrientation This parameter defines the orientation of the scalar bar.
-     *                       It is taken from the <VAR>Orientaton</VAR> enumeration.
-     */
-    void SetBarOrientation(in Orientation theOrientation);
-
-    /*!
-     * Gets the type of orientation of the scalar bar.
-     */
-    Orientation GetBarOrientation();
-
     /*! \brief Position of the scalar bar.
      *
      * Sets the position of the scalar bar origin on the screen.
@@ -505,7 +462,73 @@ module VISU {
     string GetTitle();
   };
 
+
   //-------------------------------------------------------
+  /*! \brief Interface of the %Scalar Map
+   *
+   * This interface is responsable for coloring of 3D field presentations
+   * according the scalar values applied to different cells.
+   * As well it contains presentation parameters of the scalar bar. The scalar
+   * bar is displayed along with each colored field presentation and serves for
+   * consulting the correspondance between colors and data values.
+   */
+  interface ScalarMap : ColoredPrd3d {
+    /*!
+     * Sets the type of scaling of the values reflected by the scalar bar.
+     * \param theScaling The value of this parameter is taken from the <VAR>Scaling</VAR> enumeration.
+     */
+    void SetScaling(in Scaling theScaling);
+
+    /*!
+     * Gets the type of scaling of the values reflected by this presentation.
+     */
+    Scaling GetScaling();
+
+    /*!
+     * Sets scalar range - min and max boundaries of the scalar bar.
+     * \param theMin  Min boundary of the scalar bar.
+     * \param theMax  Max boundary of the scalar bar.
+     */
+    void SetRange(in double theMin, in double theMax);
+
+    /*!
+     * Gets the min boundary of the scalar bar.
+     */
+    double GetMin();
+
+    /*!
+     * Gets the max boundary of the scalar bar.
+     */
+    double GetMax();
+
+    /*! %Orientation of the scalar bar (to provide backward compatibility). */
+    enum Orientation {
+      HORIZONTAL, /*!< Horizontal orientation of the scalar bar.*/
+      VERTICAL    /*!< Vertical orientation of the scalar bar.*/
+    };
+
+    /*!
+     * Sets the type of orientation of the scalar bar (to provide backward compatibility).
+     * \param theOrientation This parameter defines the orientation of the scalar bar.
+     *                       It is taken from the <VAR>Orientaton</VAR> enumeration.
+     */
+    void SetBarOrientation(in Orientation theOrientation);
+
+    /*!
+     * Gets the type of orientation of the scalar bar (to provide backward compatibility).
+     */
+    Orientation GetBarOrientation();
+  };
+
+  //-------------------------------------------------------
+  /*! \brief Gauss Points presentation interface
+   *
+   * Presentation parameters of the Gauss Points presentation.
+   */
+  //-------------------------------------------------------
+  interface GaussPoints : ColoredPrd3d {
+  };
+
   /*! \brief Deformed shape presentation interface
    *
    * Presentation parameters of the deformed shape presentation.
@@ -1330,6 +1353,18 @@ module VISU {
                               in Entity theEntity, in string theFieldName,
                               in double theIteration);
 
+    /*!
+     * Creates a Gauss Points presentation.
+     * \param theResult    Data generated in other sources. (MED object or file)
+     * \param theMeshName  One of the meshes presented in MED file
+     * \param theEntity    Type of entity where the field is defined
+     * \param theFieldName Group of data attributed to the %MESH. The data can be scalar or vector.
+     * \param theIteration Number of iteration on the field
+     */
+    GaussPoints GaussPointsOnField(in Result theResult, in string theMeshName,
+                                  in Entity theEntity, in string theFieldName,
+                                  in double theIteration);
+
     /*!
      * Creates a deformed shape presentation.
      * \param theResult    Data generated in other sources. (MED object or file)
@@ -1852,22 +1887,6 @@ module VISU {
     /*! Shrinks and enlarges the 2D plot to fit the 2D viewer.
      */
     void FitAll();
-
-    /*! Set range of the 2D plot to X axis of the 2D viewer.
-     */
-    void FitXRange(in double xMin, in double xMax);
-
-    /*! Set range of the 2D plot to Y axis of the 2D viewer.
-     */
-    void FitYRange(in double yMin, in double yMax);
-
-    /*! Set range of the 2D plot to XY axis of the 2D viewer.
-     */
-    void FitRange(in double xMin, in double xMax,
-                 in double yMin, in double yMax);
-
-    void GetFitRanges(out double xMin,out double xMax,
-                     out double yMin,out double yMax);
   };
 
   //-------------------------------------------------------
diff --git a/resources/Vertex_Program_ARB.txt b/resources/Vertex_Program_ARB.txt
new file mode 100755 (executable)
index 0000000..104e9aa
--- /dev/null
@@ -0,0 +1,21 @@
+attribute float results;
+attribute float clamp;
+attribute float geomSize;
+attribute float minSize;
+attribute float maxSize;
+attribute float magnification;
+
+void main()
+{
+  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+  gl_FrontColor = gl_Color;
+
+  float size;
+  if( results == 1 )
+    size = minSize + ( maxSize - minSize ) * ( 1 - gl_Color.w / 241.0f );
+  else
+    size = geomSize;
+
+  gl_PointSize = min( magnification * size * gl_ProjectionMatrix[0].x, clamp );
+}
diff --git a/resources/Visu_PlaneSegmentation.png b/resources/Visu_PlaneSegmentation.png
new file mode 100644 (file)
index 0000000..eb538d0
Binary files /dev/null and b/resources/Visu_PlaneSegmentation.png differ
diff --git a/resources/Visu_gauss_points.png b/resources/Visu_gauss_points.png
new file mode 100644 (file)
index 0000000..3410cce
Binary files /dev/null and b/resources/Visu_gauss_points.png differ
diff --git a/resources/Visu_load_texture.png b/resources/Visu_load_texture.png
new file mode 100755 (executable)
index 0000000..d9953b6
Binary files /dev/null and b/resources/Visu_load_texture.png differ
diff --git a/resources/Visu_vvtk_switch.png b/resources/Visu_vvtk_switch.png
new file mode 100644 (file)
index 0000000..b0a9c80
Binary files /dev/null and b/resources/Visu_vvtk_switch.png differ
diff --git a/resources/sprite_alpha.bmp b/resources/sprite_alpha.bmp
new file mode 100644 (file)
index 0000000..30a0fde
Binary files /dev/null and b/resources/sprite_alpha.bmp differ
diff --git a/resources/sprite_texture.bmp b/resources/sprite_texture.bmp
new file mode 100644 (file)
index 0000000..8ace201
Binary files /dev/null and b/resources/sprite_texture.bmp differ
index 8805f3d64c07f82f0c55f3fc39dc476faf8a433a..590571588214873b0a07fc620fbf0c79ca176632 100644 (file)
@@ -32,12 +32,25 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-EXPORT_HEADERS = VISU_Convertor.hxx  VISU_Convertor_impl.hxx  VISU_ConvertorUtils.hxx  VISU_ExtractUnstructuredGrid.hxx
+EXPORT_HEADERS = \
+       VISU_IDMapper.hxx \
+       VISU_Convertor.hxx  \
+       VISU_ConvertorDef.hxx  \
+       VISU_Convertor_impl.hxx  \
+       VISU_ConvertorUtils.hxx  \
+       VISU_MergeFilter.hxx \
+       VISU_ExtractUnstructuredGrid.hxx
 
 # Libraries targets
 
 LIB = libVisuConvertor.la
-LIB_SRC = VISU_Convertor.cxx VISU_Convertor_impl.cxx VISU_ConvertorUtils.cxx VISU_ExtractUnstructuredGrid.cxx \
+LIB_SRC = \
+       VISU_IDMapper.cxx \
+       VISU_Convertor.cxx \
+       VISU_Convertor_impl.cxx \
+       VISU_ConvertorUtils.cxx \
+       VISU_ExtractUnstructuredGrid.cxx \
+       VISU_MergeFilter.cxx \
        VISU_MedConvertor.cxx
 
 # Executables targets
@@ -45,7 +58,16 @@ BIN = VISUConvertor
 BIN_SRC = 
 
 CPPFLAGS+= -ftemplate-depth-32 $(VTK_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \
-       -I${KERNEL_ROOT_DIR}/include/salome -I${MED_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
-LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) -L${MED_ROOT_DIR}/lib/salome -lMEDWrapper
-LDFLAGSFORBIN=$(LDFLAGS) $(HDF5_LIBS) -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase
+       -I${KERNEL_ROOT_DIR}/include/salome \
+       -I${MED_ROOT_DIR}/include/salome \
+       -I${GUI_ROOT_DIR}/include/salome \
+       $(BOOST_CPPFLAGS)
+
+LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) \
+       $(BOOST_LIBS) -lboost_thread-mt \
+       -L${MED_ROOT_DIR}/lib/salome -lMEDWrapper \
+       -L${GUI_ROOT_DIR}/lib/salome -lVTKViewer
+
+LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lmed_V2_1 -lVTKViewer -lsuit -lqtx
+
 @CONCLUDE@
index c81e39e099d4ad76498499be833e56ac746dd95f..f34d49355b2578111baeff49fd02a4508da9889a 100644 (file)
@@ -34,6 +34,9 @@
 #include <qfileinfo.h>
 #include <qstringlist.h>
 #include <memory>      
+#include "VISU_Convertor_impl.hxx"
+
+#include <vtkUnstructuredGrid.h>
 
 using namespace std;
 
@@ -43,8 +46,15 @@ static int MYDEBUG = 1;
 static int MYDEBUG = 0;
 #endif
 
-void parseFile(const char* theFileName) {
-  //try{
+//#define _DEXCEPT_
+
+typedef vtkUnstructuredGrid TOutput;
+
+void parseFile(const char* theFileName) 
+{
+#ifndef _DEXCEPT_
+  try{
+#endif
     MSG(MYDEBUG,"'"<<theFileName<<"'...");
     auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
     //aCon->GetSize();
@@ -52,10 +62,13 @@ void parseFile(const char* theFileName) {
     const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
+      //continue;
+
       const string& aMeshName = aMeshMapIter->first;
       const VISU::PMesh& aMesh = aMeshMapIter->second;
       const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+
       //Import fields
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
@@ -70,12 +83,36 @@ void parseFile(const char* theFileName) {
          VISU::TValField::const_iterator aValFieldIter = aValField.begin();
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
-           aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
-           //goto OK;
+
+           if(anEntity != VISU::NODE_ENTITY){
+             VISU::PGaussPtsIDMapper aGaussMesh = 
+               aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
+             VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput();
+             /*
+             int aNbCells = aDataSet->GetNumberOfCells();
+             for(int anCellId = 0; anCellId < aNbCells; anCellId++){
+               VISU::TGaussPointID anObjID = aGaussMesh->GetObjID(anCellId);
+               cout<<anObjID.first<<"; "<<anObjID.second<<endl;
+             }
+             */
+           }else{
+             VISU::PIDMapper anIDMapper = 
+               aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+             VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
+             /*
+             int aNbCells = aDataSet->GetNumberOfCells();
+             for(int anCellId = 0; anCellId < aNbCells; anCellId++){
+               int anObjID = anIDMapper->GetElemObjID(anCellId);
+               int aVTKID  = anIDMapper->GetElemVTKID(anObjID);
+               cout<<anObjID<<"; "<<aVTKID<<endl;
+             }
+             */
+           }
+           goto OK;
          }
        }
       }
-      //continue;
+
       //Importing groups
       const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
@@ -83,6 +120,28 @@ void parseFile(const char* theFileName) {
        const string& aGroupName = aGroupMapIter->first;
        aCon->GetMeshOnGroup(aMeshName,aGroupName);
       }
+
+      //continue;
+
+      //Import mesh on entity
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
+       VISU::PIDMapper anIDMapper = aCon->GetMeshOnEntity(aMeshName,anEntity);
+       VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
+       {
+         /*
+         int aNbCells, anCellId, anObjID, aVTKID;
+         aNbCells = aDataSet->GetNumberOfCells();
+         for(anCellId = 0; anCellId < aNbCells; anCellId++){
+           anObjID = anIDMapper->GetElemObjID(anCellId);
+           aVTKID  = anIDMapper->GetElemVTKID(anObjID);
+           cout<<anObjID<<"; "<<aVTKID<<endl;
+         }
+         */
+       }
+      }
+
       //Import families
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
@@ -93,48 +152,39 @@ void parseFile(const char* theFileName) {
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
-         aCon->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+         aCon->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName);
        }
       }
-      //Import mesh on entity
-      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       aCon->GetMeshOnEntity(aMeshName,anEntity);
-      }
     }
+  OK:
     MSG(MYDEBUG,"OK");
-//   }catch(std::exception& exc){
-//    MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
-//   }catch(...){
-//    MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
-//   } 
+#ifndef _DEXCEPT_
+  }catch(std::exception& exc){
+    MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
+  }catch(...){
+    MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
+  } 
+#endif
 }
 
 int main(int argc, char** argv){ 
-  //try{
-    if(argc > 1){
-      QFileInfo fi(argv[1]);
-      for(int i = 0; i < 1; i++){
-       if(fi.exists()){
-          if(fi.isDir()){
-           QDir aDir(fi.absFilePath());
-           QStringList aStringList = aDir.entryList("*.med",QDir::Files);
-           int jEnd = aStringList.count();
-           for(int j = 0; j < jEnd; j++){
-              parseFile(aDir.filePath(aStringList[j]).latin1());
-           }
-          }else{
-           parseFile(argv[1]);
+  if(argc > 1){
+    QFileInfo fi(argv[1]);
+    for(int i = 0; i < 1; i++){
+      if(fi.exists()){
+       if(fi.isDir()){
+         QDir aDir(fi.absFilePath());
+         QStringList aStringList = aDir.entryList("*.med",QDir::Files);
+         int jEnd = aStringList.count();
+         for(int j = 0; j < jEnd; j++){
+           parseFile(aDir.filePath(aStringList[j]).latin1());
          }
+       }else{
+         parseFile(argv[1]);
        }
       }
-      return 0;
     }
-  //}catch(std::exception& exc){
-  //  MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
-  //}catch(...){
-  //  MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl");
-  //} 
+    return 0;
+  }
   return 1;
 }
index c08d9a6122a46ecc94e955509b7745b49a0125cd..0a599cd16b24c98a9da882e7846ae4f2c3cc0ec0 100644 (file)
@@ -33,7 +33,10 @@ using namespace std;
 
 namespace VISU{
 
-  inline int GetNbOfPoints(int theVTKCellType){
+  inline
+  int
+  GetNbOfPoints(int theVTKCellType)
+  {
     switch(theVTKCellType){
     case VTK_VERTEX : return 1;
     case VTK_LINE : return 2;
@@ -46,67 +49,22 @@ namespace VISU{
     default: return -1;
     }
   }
-
-  pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
-  {
-    if(theFamilyName == "")
-      return make_pair(myNbCells,myCellsSize);
-    TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
-    if(aFamilyMapIter == myFamilyMap.end())
-      throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
-    const PFamily& aFamily = aFamilyMapIter->second; 
-    return make_pair(aFamily->myNbCells,aFamily->myCellsSize);
-  }
-  
-  const PField TMesh::GetField(const string& theFieldName) const {
-    TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = myMeshOnEntityMap.begin();
-    for(; aMeshOnEntityMapIter != myMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-      const TFieldMap& aFieldMap = aMeshOnEntityMapIter->second->myFieldMap;
-      TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-      for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
-       if(theFieldName == aFieldMapIter->first) 
-         return aFieldMapIter->second;
-    }
-    return PField();
-  }
-
-
-  PFamily FindFamily(VISU::PMesh theMesh, const string& theFamilyName)
-  {
-    PFamily aFamily;
-    const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
-    TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-    for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-      const PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
-      aFamily = GetFamily(aMeshOnEntity,theFamilyName);
-      if(aFamily)
-       break;
-    }
-    return aFamily;
-  }
-  
-
-  PFamily GetFamily(VISU::PMeshOnEntity theMeshOnEntity, const string& theFamilyName)
-  {
-    PFamily aFamily;
-    if(theFamilyName != ""){
-      TFamilyMap& aFamilyMap = theMeshOnEntity->myFamilyMap;
-      TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
-      if(aFamilyMapIter != aFamilyMap.end())
-       aFamily = aFamilyMapIter->second;
-    }
-    return aFamily;
-  }
 }
 
 
-const VISU::TMeshMap& VISU_Convertor::GetMeshMap() { 
+const VISU::TMeshMap& 
+VISU_Convertor
+::GetMeshMap() 
+{ 
   if(!myIsDone) { myIsDone = true;  Build();}
   return myMeshMap;
 }
 
 
-string VISU_Convertor::GenerateName(const VISU::TTime& aTime){
+string
+VISU_Convertor
+::GenerateName(const VISU::TTime& aTime)
+{
   static QString aName;
   const string aUnits = aTime.second, tmp(aUnits.size(),' ');
   if(aUnits == "" || aUnits == tmp)
@@ -117,7 +75,11 @@ string VISU_Convertor::GenerateName(const VISU::TTime& aTime){
   return aName.latin1();
 }
 
-string VISU_Convertor::GenerateName(const string& theName, unsigned int theTimeId) {
+string
+VISU_Convertor
+::GenerateName(const string& theName, 
+              unsigned int theTimeId) 
+{
   static QString aName;
   aName = QString(theName.c_str()).simplifyWhiteSpace();
   int iEnd = strlen(aName);
index bebb26f096e3f5f67ab41d21ed26f03d0741a983..d9145a7c94702e55f35a01483f494f2bc7a44792 100644 (file)
 #ifndef VISU_Convertor_HeaderFile
 #define VISU_Convertor_HeaderFile
 
-#include <stdio.h>
+#include "VISU_IDMapper.hxx"
+#include "VISU_ConvertorDef.hxx"
+
+#include "MED_Vector.hxx"
 
-#include <list>
 #include <map>
 #include <set>
 #include <utility>
-#include <vector>
 #include <string>
 #include <stdexcept>
 
-#include <boost/shared_ptr.hpp>
+namespace VISU
+{
+  using MED::TVector;
 
-class vtkUnstructuredGrid;
+  //---------------------------------------------------------------
+  typedef std::string TName;
 
-namespace VISU{
+  typedef TVector<TName> TNames;
 
-  template<class T> class shared_ptr: public boost::shared_ptr<T>
+  //---------------------------------------------------------------
+  struct TIntId: virtual TBaseStructure
   {
-  public:
-    shared_ptr() {}
-
-    template<class Y>
-    explicit shared_ptr(Y * p)
-    {
-      reset(p);
-    }
-
-    template<class Y>
-    shared_ptr(shared_ptr<Y> const & r):
-      boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
+    vtkIdType myId;
+
+    TIntId(): myId(0)
     {}
+  };
+
 
-    template<class Y>
-    shared_ptr & operator=(shared_ptr<Y> const & r)
-    {
-      shared_ptr<T>(r).swap(*this);
-      return *this;
-    }
-
-    template<class Y> shared_ptr& operator()(Y * p) // Y must be complete
-    {
-      if(T* pt = dynamic_cast<T*>(p))
-       boost::shared_ptr<T>::reset(pt);
-      else
-       boost::throw_exception(std::bad_cast());
-      return *this;
-    }
+  //---------------------------------------------------------------
+  typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
+  typedef std::map<TName,PGroup> TGroupMap;
 
+  struct TMesh: virtual TBaseStructure
+  {
+    TMeshOnEntityMap myMeshOnEntityMap;
+    TGroupMap myGroupMap;
+    TName myName;
+    int myDim;
+
+    TMesh(): myDim(0)
+    {}
   };
+  typedef std::map<std::string,PMesh> TMeshMap;
 
 
-  enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
+  //---------------------------------------------------------------
+  struct TSubProfile: virtual TBaseStructure
+  {};
 
-  typedef std::pair<std::string,TEntity> TFamilyAndEntity;
-  typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
-  typedef std::set<std::string> TBindGroups;
 
-  typedef std::pair<double,std::string> TTime;
+  //---------------------------------------------------------------
+  struct TProfile: virtual TIDMapper
+  {};
 
-  struct TMesh;
-  typedef shared_ptr<TMesh> PMesh;
-  typedef std::map<std::string,PMesh> TMeshMap;
 
-  struct TMeshOnEntity;
-  typedef shared_ptr<TMeshOnEntity> PMeshOnEntity;
-  typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
+  //---------------------------------------------------------------
+  bool
+  operator<(const PSubProfile& theLeft, const PSubProfile& theRight);
 
-  struct TFamily;
-  typedef shared_ptr<TFamily> PFamily;
-  typedef std::map<std::string,PFamily> TFamilyMap;
+  typedef std::set<PSubProfile> TProfileKey;
+  typedef std::map<TProfileKey,PProfile> TProfileMap;
 
-  struct TGroup;
-  typedef shared_ptr<TGroup> PGroup;
-  typedef std::map<std::string,PGroup> TGroupMap;
 
-  struct TField;
-  typedef shared_ptr<TField> PField;
-  typedef std::map<std::string,PField> TFieldMap;
+  //---------------------------------------------------------------
+  struct TGauss: virtual TBaseStructure
+  {};
 
-  struct TValForTime;
-  typedef shared_ptr<TValForTime> PValForTime;
-  typedef std::map<int,PValForTime> TValField;
 
-  struct TBaseStructure{
-    virtual ~TBaseStructure(){}
+  //---------------------------------------------------------------
+  struct TGaussSubMesh: virtual TBaseStructure
+  {
+    PSubProfile mySubProfile;
   };
 
-  typedef std::vector<std::string> TNames;
+  
+  //---------------------------------------------------------------
+  struct TGaussMesh: virtual TGaussPtsIDMapper
+  {};
 
-  struct TMesh: TBaseStructure{
-    int myDim, myNbPoints;
-    std::string myName;
 
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
+  //---------------------------------------------------------------
+  bool
+  operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight);
 
-    TMesh() : myDim(0), myNbPoints(0) {}
-    const PField GetField(const std::string& theFieldName) const;
-  };
+  typedef std::set<PGaussSubMesh> TGaussKey;
+  typedef std::map<TGaussKey,PGaussMesh> TGaussMeshMap;
+
+
+  //---------------------------------------------------------------
+
+  typedef std::map<TName,PFamily> TFamilyMap;
+  typedef std::map<TName,PField> TFieldMap;
+
+  struct TMeshOnEntity: virtual TNamedIDMapper
+  {
+    TGaussMeshMap myGaussMeshMap;
+    TProfileMap myProfileMap;
 
-  struct TMeshOnEntity: TBaseStructure{
-    std::string myMeshName;
-    TEntity myEntity;
-    int myNbCells, myCellsSize;
     TFamilyMap myFamilyMap;
     TFieldMap myFieldMap;
-    TMeshOnEntity() : myNbCells(0), myCellsSize(0) {}
 
-    std::pair<int,int> 
-    GetCellsDims(const std::string& theFamilyName = "") const;
+    TName myMeshName;
+    TEntity myEntity;
   };
 
-  struct TFamily: TBaseStructure{
-    int myId;
-    std::string myName;
+
+  //---------------------------------------------------------------
+  struct TFamily: virtual TIntId,
+                 virtual TIDMapper
+  {
     TEntity myEntity;
-    TBindGroups myGroups;
-    int myNbCells, myCellsSize;
-    TFamily() : myNbCells(0), myCellsSize(0) {}
+    TName myName;
   };
 
-  struct TGroup: TBaseStructure{
-    std::string myName;
-    std::string myMeshName;
-    int myNbCells, myCellsSize;
-    TFamilyAndEntitySet myFamilyAndEntitySet;
-    TGroup() : myNbCells(0), myCellsSize(0) {}
+
+  //---------------------------------------------------------------
+  typedef std::set<PFamily> TFamilySet;
+
+  struct TGroup: virtual TIDMapper
+  {
+    TFamilySet myFamilySet;
   };
 
-  struct TField: TBaseStructure{
-    int myId;
+
+  //---------------------------------------------------------------
+  typedef std::map<vtkIdType,PValForTime> TValField;
+  typedef std::pair<float,float> TMinMax;
+
+  struct TField: virtual TIntId
+  {
     TEntity myEntity;
-    bool myIsTrimmed;
-    std::string myName;
-    std::string myMeshName;
-    int myNbComp, myDataSize;
+    TName myName;
+    TName myMeshName;
     TValField myValField;
     TNames myCompNames;
     TNames myUnitNames;
-    TField() : myNbComp(0), myDataSize(0), myIsTrimmed(0) {}
+    vtkIdType myNbComp;
+
+    virtual
+    TMinMax 
+    GetMinMax(vtkIdType theCompID) = 0;
+    
+    TField(): myNbComp(0)
+    {}
   };
  
-  struct TValForTime: TBaseStructure{
-    int myId;
+
+  //---------------------------------------------------------------
+  typedef std::pair<double,std::string> TTime;
+
+  struct TValForTime: virtual TIntId
+  {
     TEntity myEntity;
-    std::string myMeshName;
-    std::string myFieldName;
-    int myNbComp;
+    TName myMeshName;
+    TName myFieldName;
     TTime myTime;
 
-    TValForTime() : myNbComp(0) {}
+    PProfile myProfile;
+    PGaussMesh myGaussMesh;
   };
 
-  PFamily FindFamily(VISU::PMesh theMesh, 
-                    const std::string& theFamilyName);
-
-  PFamily GetFamily(VISU::PMeshOnEntity theMeshOnEntity, 
-                   const std::string& theFamilyName);
-
-  void WriteToFile(vtkUnstructuredGrid* theDataSet, 
-                  const std::string& theFileName);
 
+  //---------------------------------------------------------------
+  void 
+  WriteToFile(vtkUnstructuredGrid* theDataSet, 
+             const std::string& theFileName);
 };
 
-class VISU_Convertor{
+
+//---------------------------------------------------------------
+class VISU_Convertor
+{
 protected:
   std::string myName;
   VISU::TMeshMap myMeshMap;
   int myIsDone;
+
 public:
-  virtual ~VISU_Convertor(){};
-  virtual const std::string& GetName() { return myName;}
-  virtual int IsDone() const { return myIsDone;}
-  typedef vtkUnstructuredGrid TOutput;
-
-  virtual VISU_Convertor* Build() = 0;
-  virtual const VISU::TMeshMap& GetMeshMap() ;
-  virtual float GetSize() = 0;
-
-  virtual TOutput* GetMeshOnEntity(const std::string& theMeshName, 
-                                  const VISU::TEntity& theEntity,
-                                  const std::string& theFamilyName = "") = 0;
-    
-  virtual float GetMeshOnEntitySize(const std::string& theMeshName, 
-                                   const VISU::TEntity& theEntity,
-                                   const std::string& theFamilyName = "") = 0;
+  virtual 
+  ~VISU_Convertor()
+  {};
   
-  virtual TOutput* GetMeshOnGroup(const std::string& theMeshName, 
-                                 const std::string& theGroupName) = 0;
+  virtual
+  const std::string& 
+  GetName(){ return myName;}
+
+  virtual
+  int
+  IsDone() const { return myIsDone; }
+
+  typedef VISU::TVTKOutput TOutput;
+
+  virtual
+  VISU_Convertor* 
+  Build() = 0;
 
-  virtual float GetMeshOnGroupSize(const std::string& theMeshName, 
-                                  const std::string& theGroupName) = 0;
+  virtual
+  const VISU::TMeshMap& 
+  GetMeshMap();
 
-  virtual TOutput* GetTimeStampOnMesh(const std::string& theMeshName, 
-                                     const VISU::TEntity& theEntity,
-                                     const std::string& theFieldName,
-                                     int theStampsNum) = 0;
+  virtual
+  float
+  GetSize() = 0;
+
+  virtual
+  VISU::PNamedIDMapper 
+  GetMeshOnEntity(const std::string& theMeshName, 
+                 const VISU::TEntity& theEntity) = 0;
+  
+  virtual
+  float
+  GetMeshOnEntitySize(const std::string& theMeshName, 
+                     const VISU::TEntity& theEntity) = 0;
+  
+  virtual 
+  VISU::PIDMapper 
+  GetFamilyOnEntity(const std::string& theMeshName, 
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName) = 0;
+  virtual 
+  float 
+  GetFamilyOnEntitySize(const std::string& theMeshName, 
+                       const VISU::TEntity& theEntity,
+                       const std::string& theFamilyName) = 0;
+  virtual
+  VISU::PIDMapper
+  GetMeshOnGroup(const std::string& theMeshName, 
+                const std::string& theGroupName) = 0;
+  
+  virtual
+  float
+  GetMeshOnGroupSize(const std::string& theMeshName, 
+                    const std::string& theGroupName) = 0;
+  
+  virtual
+  VISU::PIDMapper 
+  GetTimeStampOnMesh(const std::string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const std::string& theFieldName,
+                    int theStampsNum) = 0;
+
+  virtual
+  VISU::PGaussPtsIDMapper 
+  GetTimeStampOnGaussPts(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theStampsNum) = 0;
    
-  virtual float GetTimeStampSize(const std::string& theMeshName, 
-                                const VISU::TEntity& theEntity,
-                                const std::string& theFieldName,
-                                int theStampsNum) = 0;
+  virtual 
+  float
+  GetTimeStampSize(const std::string& theMeshName, 
+                  const VISU::TEntity& theEntity,
+                  const std::string& theFieldName,
+                  int theStampsNum) = 0;
     
-  virtual float GetFieldOnMeshSize(const std::string& theMeshName, 
-                                  const VISU::TEntity& theEntity,
-                                  const std::string& theFieldName) = 0;
-  virtual const VISU::PField GetField(const std::string& theMeshName, 
-                                     VISU::TEntity theEntity, 
-                                     const std::string& theFieldName) = 0;
-
-  virtual const VISU::PValForTime GetTimeStamp(const std::string& theMeshName, 
-                                              const VISU::TEntity& theEntity,
-                                              const std::string& theFieldName,
-                                              int theStampsNum) = 0;
+  virtual 
+  float
+  GetFieldOnMeshSize(const std::string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const std::string& theFieldName) = 0;
+  
+  virtual
+  const VISU::PField 
+  GetField(const std::string& theMeshName, 
+          VISU::TEntity theEntity, 
+          const std::string& theFieldName) = 0;
+  
+  virtual
+  const VISU::PValForTime 
+  GetTimeStamp(const std::string& theMeshName, 
+              const VISU::TEntity& theEntity,
+              const std::string& theFieldName,
+              int theStampsNum) = 0;
     
-  static std::string GenerateName(const VISU::TTime& aTime);
-  static std::string GenerateName(const std::string& theName, unsigned int theTimeId);
+  static 
+  std::string 
+  GenerateName(const VISU::TTime& aTime);
+
+  static 
+  std::string 
+  GenerateName(const std::string& theName, unsigned int theTimeId);
 };
 
-extern "C"{
-  VISU_Convertor* CreateConvertor(const std::string& theFileName) ;
+extern "C"
+{
+  VISU_Convertor* 
+  CreateConvertor(const std::string& theFileName);
 };
 
+
 #endif
diff --git a/src/CONVERTOR/VISU_ConvertorDef.hxx b/src/CONVERTOR/VISU_ConvertorDef.hxx
new file mode 100644 (file)
index 0000000..4744e65
--- /dev/null
@@ -0,0 +1,73 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File   : 
+//  Author : 
+//  Module : 
+
+#ifndef VISU_ConvertorDef_HeaderFile
+#define VISU_ConvertorDef_HeaderFile
+
+#include "MED_SharedPtr.hxx"
+
+namespace VISU
+{
+  using MED::SharedPtr;
+
+  //---------------------------------------------------------------
+  enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
+
+  struct TMesh;
+  typedef SharedPtr<TMesh> PMesh;
+
+  struct TGaussSubMesh;
+  typedef SharedPtr<TGaussSubMesh> PGaussSubMesh;
+
+  struct TGaussMesh;
+  typedef SharedPtr<TGaussMesh> PGaussMesh;
+
+  struct TSubProfile;
+  typedef SharedPtr<TSubProfile> PSubProfile;
+
+  struct TProfile;
+  typedef SharedPtr<TProfile> PProfile;
+
+  struct TMeshOnEntity;
+  typedef SharedPtr<TMeshOnEntity> PMeshOnEntity;
+
+  struct TFamily;
+  typedef SharedPtr<TFamily> PFamily;
+
+  struct TGroup;
+  typedef SharedPtr<TGroup> PGroup;
+
+  struct TField;
+  typedef SharedPtr<TField> PField;
+
+  struct TGauss;
+  typedef SharedPtr<TGauss> PGauss;
+
+  struct TValForTime;
+  typedef SharedPtr<TValForTime> PValForTime;
+}
+
+#endif
index 477abba744880d951e2d1174ebac2ef829c7f9a3..ad2a643c6e61fc80c6be989faaf62ed39477cca7 100644 (file)
 
 #include "VISU_Convertor_impl.hxx"
 #include "VISU_ConvertorUtils.hxx"
+#include "VTKViewer_AppendFilter.h"
+#include "VISU_MergeFilter.hxx"
+
+#include <vtkPoints.h>
+#include <vtkUnstructuredGrid.h>
 
 #include <vtkIdList.h>
 #include <vtkCellType.h>
@@ -37,7 +42,6 @@
 #include <vtkCellData.h>
 #include <vtkCellLinks.h>
 
-#include <vtkMergeDataObjectFilter.h>
 
 #include <qstring.h>
 #include <qfileinfo.h>
@@ -55,36 +59,937 @@ static int MYVTKDEBUG = 0;
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
+//#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
 static int MYDEBUGWITHFILES = 0;
 #endif
 
+namespace VISU
+{
+  //---------------------------------------------------------------
+  TIsVTKDone::TIsVTKDone(): 
+    myIsVTKDone(false),
+    myIsDone(false)
+  {}
+
+
+  //---------------------------------------------------------------
+  TSizeCounter::TSizeCounter():
+    myNbCells(0),
+    myCellsSize(0)
+  {}
+
+
+  //---------------------------------------------------------------
+  TSource::TSource()
+  {}
+
+  const TVTKSource& 
+  TSource
+  ::GetSource() const
+  {
+    if(!mySource.GetPointer()){
+      mySource = vtkUnstructuredGrid::New();
+      mySource->Delete();
+    }
+    return mySource;
+  }
+
+  TVTKOutput* 
+  TSource
+  ::GetVTKOutput()
+  {
+    return GetSource().GetPointer();
+  }
+
+
+  //---------------------------------------------------------------
+  TAppendFilter::TAppendFilter()
+  {}
 
-namespace{
+  const TVTKAppendFilter& 
+  TAppendFilter
+  ::GetFilter() const
+  {
+    if(!myFilter.GetPointer()){
+      myFilter = VTKViewer_AppendFilter::New();
+      myFilter->Delete();
+      myFilter->SetDoMappingFlag(true);
+    }
+    return myFilter;
+  }
+
+  TVTKOutput* 
+  TAppendFilter
+  ::GetVTKOutput()
+  {
+    GetFilter()->Update();
+    return GetFilter()->GetOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  TMergeFilter::TMergeFilter()
+  {}
+
+  const TVTKMergeFilter& 
+  TMergeFilter
+  ::GetFilter() const
+  {
+    if(!myFilter.GetPointer()){
+      myFilter = VISU_MergeFilter::New();
+      myFilter->Delete();
+    }
+    return myFilter;
+  }
+
+  TVTKOutput* 
+  TMergeFilter
+  ::GetVTKOutput()
+  {
+    GetFilter()->Update();
+    return GetFilter()->GetUnstructuredGridOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  TPointCoords
+  ::TPointCoords():
+    myPoints(vtkPoints::New())
+  {
+    myPoints->Delete();
+  }
+
+  void
+  TPointCoords
+  ::Init(vtkIdType theNbPoints,
+        vtkIdType theDim)
+  {
+    myDim = theDim;
+    myNbPoints = theNbPoints;
+    myCoord.resize(theNbPoints*theDim);
+    myPoints->SetNumberOfPoints(theNbPoints);
+  }
+
+  TCCoordSlice 
+  TPointCoords
+  ::GetCoordSlice(vtkIdType theNodeId) const
+  {
+    return TCCoordSlice(myCoord,std::slice(theNodeId*myDim,myDim,1));
+  }
+  
+  TCoordSlice 
+  TPointCoords
+  ::GetCoordSlice(vtkIdType theNodeId)
+  {
+    return TCoordSlice(myCoord,std::slice(theNodeId*myDim,myDim,1));
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  TNamedPointCoords
+  ::Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const TVectorID& theVectorID)
+  {
+    TPointCoords::Init(theNbPoints,theDim);
+    myPointsDim.resize(theDim);
+    myVectorID = theVectorID;
+
+    for(vtkIdType anID = 0, anEnd = theVectorID.size(); anID < anEnd; anID++)
+      myObj2VTKID[theVectorID[anID]] = anID;
+  }
+
+  std::string&
+  TNamedPointCoords
+  ::GetName(vtkIdType theDim)
+  {
+    return myPointsDim[theDim];
+  }
+
+  const std::string&
+  TNamedPointCoords
+  ::GetName(vtkIdType theDim) const
+  {
+    return myPointsDim[theDim];
+  }
+
+  vtkIdType
+  TNamedPointCoords
+  ::GetObjID(vtkIdType theID) const
+  {
+    if(myVectorID.empty())
+      return theID;
+    else
+      return myVectorID[theID];
+  }
+
+
+  vtkIdType
+  TNamedPointCoords
+  ::GetVTKID(vtkIdType theID) const
+  {
+    if(myObj2VTKID.empty())
+      return theID;
+    else{
+      TObj2VTKID::const_iterator anIter = myObj2VTKID.find(theID);
+      if(anIter != myObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  std::string 
+  TNamedPointCoords
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return "";
+  }
+
+  //---------------------------------------------------------------
+  TMeshImpl::TMeshImpl():
+    myPoints(vtkPoints::New()),
+    myNbPoints(0) 
+  {
+    myPoints->Delete();
+  }
+
+
+  //---------------------------------------------------------------
+  TSubProfileImpl::TSubProfileImpl():
+    myStatus(eNone),
+    myGeom(eNONE)
+  {}
+
+
+  vtkIdType
+  TSubProfileImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const PSubProfile& theLeft, const PSubProfile& theRight)
+  {
+    PSubProfileImpl aLeft(theLeft), aRight(theRight);
+
+    if(aLeft->myGeom != aRight->myGeom)
+      return aLeft->myGeom < aRight->myGeom;
+
+    if(aLeft->myStatus != aRight->myStatus)
+      return aLeft->myStatus < aRight->myStatus;
+
+    return aLeft->myName < aRight->myName;
+  }
+
+
+  //---------------------------------------------------------------
+  TProfileImpl::TProfileImpl():
+    myIsAll(true),
+    myMeshOnEntity(NULL)
+  {}
+
+  vtkIdType
+  TProfileImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+  
+  vtkIdType
+  TProfileImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  float*  
+  TProfileImpl
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    if(myMeshOnEntity)
+      return myMeshOnEntity->GetNodeCoord(theObjID);
+
+    vtkIdType aVtkID = GetNodeVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetPoint(aVtkID);
+  }
+
+  vtkIdType
+  TProfileImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    if(myMeshOnEntity)
+      return myMeshOnEntity->GetElemObjID(theID);
+
+    vtkIdType anInputID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType aID = anAppendFilter->GetCellInputID(theID,anInputID);
+    PSubProfileImpl aSubProfileImpl = mySubProfileArr[anInputID];
+    return aSubProfileImpl->GetElemObjID(aID);
+  }
+
+  vtkIdType
+  TProfileImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myMeshOnEntity)
+      return myMeshOnEntity->GetElemVTKID(theID);
+
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkCell* 
+  TProfileImpl
+  ::GetElemCell(vtkIdType theObjID)
+  {
+    if(myMeshOnEntity)
+      return myMeshOnEntity->GetElemCell(theObjID);
+
+    vtkIdType aVtkID = GetElemVTKID(theObjID);
+    return GetFilter()->GetOutput()->GetCell(aVtkID);
+  }
+  
+  TVTKOutput* 
+  TProfileImpl
+  ::GetVTKOutput()
+  {
+    return mySource.GetVTKOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  TVTKOutput* 
+  TIDMapperFilter
+  ::GetVTKOutput()
+  {
+    if(!myFilter.GetPointer()){
+      const TVTKAppendFilter& anAppendFilter = myIDMapper.GetFilter();
+      TVTKOutput* aGeometry = anAppendFilter->GetOutput();
+      
+      const TVTKSource& aSource = mySource.GetSource();
+      TDataSet* aDataSet = aSource.GetPointer();
+      aDataSet->ShallowCopy(aGeometry);
+      
+      const TVTKMergeFilter& aFilter = GetFilter();
+      aFilter->SetGeometry(aGeometry);
+      aFilter->SetScalars(aDataSet);
+      aFilter->SetVectors(aDataSet);
+      aFilter->AddField("VISU_FIELD",aDataSet);
+    }
+    return myFilter->GetUnstructuredGridOutput();
+  }
+
+  vtkIdType
+  TIDMapperFilter
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myIDMapper.GetNodeObjID(theID);
+  }
+  
+  vtkIdType
+  TIDMapperFilter
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myIDMapper.GetNodeVTKID(theID);
+  }
+
+  float*  
+  TIDMapperFilter
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    return myIDMapper.GetNodeCoord(theObjID);
+  }
+
+  vtkIdType
+  TIDMapperFilter
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myIDMapper.GetElemObjID(theID);
+  }
+
+  vtkIdType
+  TIDMapperFilter
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    return myIDMapper.GetElemVTKID(theID);
+  }
+
+  vtkCell* 
+  TIDMapperFilter
+  ::GetElemCell(vtkIdType theObjID)
+  {
+    return myIDMapper.GetElemCell(theObjID);
+  }
+  
+
+  //---------------------------------------------------------------
+  TGaussSubMeshImpl::TGaussSubMeshImpl():
+    myStatus(eNone)
+  {}
+  
+  TGaussPointID
+  TGaussSubMeshImpl
+  ::GetObjID(vtkIdType theID) const
+  {
+    TCellID aCellID = theID / myGauss->myNbPoints;
+    TLocalPntID aLocalPntID = theID % myGauss->myNbPoints;
+    
+    return TGaussPointID(aCellID,aLocalPntID);
+  }
+
+  //---------------------------------------------------------------
+  bool
+  operator<(const PGaussSubMesh& theLeft, const PGaussSubMesh& theRight)
+  {
+    PGaussSubMeshImpl aLeft(theLeft), aRight(theRight);
+    const PGaussImpl& aGaussLeft = aLeft->myGauss;
+    const PGaussImpl& aGaussRight = aRight->myGauss;
+
+    if(aGaussLeft->myGeom != aGaussRight->myGeom)
+      return aGaussLeft->myGeom < aGaussRight->myGeom;
+
+    if(aGaussLeft->myName != aGaussRight->myName)
+      return aGaussLeft->myName < aGaussRight->myName;
+
+    return theLeft->mySubProfile < theRight->mySubProfile;
+  }
+
+
+  //---------------------------------------------------------------
+  TGaussMeshImpl
+  ::TGaussMeshImpl():
+    myParent(NULL)
+  {}
+
+  TGaussPointID 
+  TGaussMeshImpl
+  ::GetObjID(vtkIdType theID) const
+  {
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType anInputDataSetID;
+    vtkIdType anInputID = anAppendFilter->GetCellInputID(theID,anInputDataSetID);
+    const TGaussSubMeshImpl& aSubMeshImpl = myGaussSubMeshArr[anInputDataSetID];
+    return aSubMeshImpl.GetObjID(anInputID);
+  }
+  
+  TVTKOutput* 
+  TGaussMeshImpl
+  ::GetVTKOutput()
+  {
+    return mySource.GetVTKOutput();
+  }
+
+  TNamedIDMapper* 
+  TGaussMeshImpl::
+  GetParent()
+  {
+    return myParent;
+  }
+
+
+  //---------------------------------------------------------------
+  TGaussPointID 
+  TGaussPtsIDFilter
+  ::GetObjID(vtkIdType theID) const
+  {
+    return myGaussPtsIDMapper->GetObjID(theID);
+  }
+  
+  TNamedIDMapper* 
+  TGaussPtsIDFilter::
+  GetParent()
+  {
+    return myGaussPtsIDMapper->GetParent();
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TSubMeshImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myStartID + theID;
+  }
+
+  std::string 
+  TSubMeshImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    return "";
+  }
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TMeshOnEntityImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    vtkIdType anInputID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType aID = anAppendFilter->GetCellInputID(theID,anInputID);
+    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputID];
+    return aSubMesh->GetElemObjID(aID);
+  }
+
+  std::string 
+  TMeshOnEntityImpl
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return myNamedPointCoords->GetNodeName(theObjID);
+  }
+
+  std::string 
+  TMeshOnEntityImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    vtkIdType aVTKId = GetElemVTKID(theObjID);
+    vtkIdType anInputID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType aSubID = anAppendFilter->GetCellInputID(aVTKId,anInputID);
+    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputID];
+    return aSubMesh->GetElemName(aSubID);
+  }
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TFamilyImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TFamilyImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return myMeshID[theID];
+  }
+
+  vtkIdType 
+  TFamilyImpl
+  ::GetNodeObjID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
 
+  vtkIdType
+  TFamilyImpl
+  ::GetNodeVTKID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  TVTKOutput* 
+  TFamilyImpl
+  ::GetVTKOutput()
+  {
+    return TSource::GetVTKOutput();
+  }
+
+
+  //---------------------------------------------------------------
+  TNbASizeCells 
+  TGroupImpl
+  ::GetNbASizeCells() const
+  {
+    vtkIdType aNbCells = 0, aCellsSize = 0;
+    TFamilySet::const_iterator anIter = myFamilySet.begin();
+    for(; anIter != myFamilySet.end(); anIter++){
+      PFamilyImpl aFamily = *anIter; 
+      aNbCells += aFamily->myNbCells;
+      aCellsSize += aFamily->myCellsSize;
+    }
+    return make_pair(aNbCells,aCellsSize);
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    if(myElemObj2VTKID.empty())
+      return theID;
+    else{
+      TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID);
+      if(anIter != myElemObj2VTKID.end())
+       return anIter->second;
+    }
+    return -1;
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    vtkIdType anInputID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType anID = anAppendFilter->GetCellInputID(theID,anInputID);
+    const PFamilyImpl& aFamily = myFamilyArr[anInputID];
+    return aFamily->GetElemObjID(anID);
+  }
+
+  vtkIdType 
+  TGroupImpl
+  ::GetNodeObjID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetObjID(theID);
+  }
+
+  vtkIdType
+  TGroupImpl
+  ::GetNodeVTKID(vtkIdType theID) const 
+  {
+    return myNamedPointCoords->GetVTKID(theID);
+  }
+
+  
+  //---------------------------------------------------------------
+  TFieldImpl
+  ::TFieldImpl(): 
+    myDataSize(0)
+  {}
+
+  void 
+  TFieldImpl
+  ::InitArrays(vtkIdType theNbComp)
+  {
+    myNbComp = theNbComp;
+    myCompNames.resize(theNbComp);
+    myUnitNames.resize(theNbComp);
+    myMinMaxArr.resize(theNbComp + 1);
+    for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){
+      TMinMax& aMinMax = myMinMaxArr[iComp];
+      aMinMax.first = VTK_LARGE_FLOAT;
+      aMinMax.second = -VTK_LARGE_FLOAT;
+    }
+  }
+
+  TMinMax 
+  TFieldImpl
+  ::GetMinMax(vtkIdType theCompID)
+  {
+    return myMinMaxArr[theCompID];
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  TMeshValue
+  ::Init(vtkIdType theNbElem,
+        vtkIdType theNbGauss,
+        vtkIdType theNbComp)
+  {
+    myNbElem = theNbElem;
+    myNbGauss = theNbGauss;
+    myNbComp = theNbComp;
+    
+    myStep = theNbComp*theNbGauss;
+    
+    myValue.resize(theNbElem*myStep);
+  }
+
+  TCValueSliceArr 
+  TMeshValue
+  ::GetGaussValueSliceArr(vtkIdType theElemId) const
+  {
+    TCValueSliceArr aValueSliceArr(myNbGauss);
+    vtkIdType anId = theElemId*myStep;
+    for(vtkIdType aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+      aValueSliceArr[aGaussId] =
+       TCValueSlice(myValue,std::slice(anId,myNbComp,1));
+      anId += myNbComp;
+    }
+    return aValueSliceArr;
+  }
+
+  TValueSliceArr 
+  TMeshValue
+  ::GetGaussValueSliceArr(vtkIdType theElemId)
+  {
+    TValueSliceArr aValueSliceArr(myNbGauss);
+    vtkIdType anId = theElemId*myStep;
+    for(vtkIdType aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+      aValueSliceArr[aGaussId] =
+       TValueSlice(myValue,std::slice(anId,myNbComp,1));
+      anId += myNbComp;
+    }
+    return aValueSliceArr;
+  }
+
+  TCValueSliceArr 
+  TMeshValue
+  ::GetCompValueSliceArr(vtkIdType theElemId) const
+  {
+    TCValueSliceArr aValueSliceArr(myNbComp);
+    vtkIdType anId = theElemId*myStep;
+    for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){
+      aValueSliceArr[aCompId] =
+       TCValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp));
+      anId += 1;
+    }
+    return aValueSliceArr;
+  }
+
+  TValueSliceArr 
+  TMeshValue
+  ::GetCompValueSliceArr(vtkIdType theElemId)
+  {
+    TValueSliceArr aValueSliceArr(myNbComp);
+    vtkIdType anId = theElemId*myStep;
+    for(vtkIdType aCompId = 0; aCompId < myNbComp; aCompId++){
+      aValueSliceArr[aCompId] =
+       TValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp));
+      anId += 1;
+    }
+    return aValueSliceArr;
+  }
+
+
+  //---------------------------------------------------------------
+  TValForTimeImpl
+  ::TValForTimeImpl():
+    myGaussPtsIDFilter(new TGaussPtsIDFilter()),
+    myIDMapperFilter(new TIDMapperFilter()),
+    myNbGauss(1)
+  {}
+
+  const TMeshValue& 
+  TValForTimeImpl
+  ::GetMeshValue(EGeometry theGeom) const
+  {
+    TGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom);
+    if(anIter == myGeom2Value.end())
+      EXCEPTION(runtime_error,"TValForTimeImpl::GetMeshValue - myGeom2Value.find(theGeom) fails");
+    return anIter->second;
+  }
+  
+  TMeshValue& 
+  TValForTimeImpl
+  ::GetMeshValue(EGeometry theGeom)
+  {
+    return myGeom2Value[theGeom];
+  }
+
+  int
+  TValForTimeImpl
+  ::GetNbGauss(EGeometry theGeom) const
+  {
+    if(PGaussMeshImpl aGaussMesh = myGaussMesh){
+      const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+      TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.find(theGeom);
+      if(anIter != aGeom2GaussSubMesh.end()){
+       PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+       PGaussImpl aGauss = aGaussSubMesh->myGauss;
+       return aGauss->myNbPoints;
+      }
+    }
+    return myNbGauss;
+  }
+  
+
+  //---------------------------------------------------------------
+  vtkIdType
+  VISUGeom2NbNodes(EGeometry theGeom)
+  { 
+    switch(theGeom){
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return 2;
+    case VISU::eTRIA6: 
+      return 3;
+    case VISU::eQUAD8: 
+      return 4;
+    case VISU::eTETRA10: 
+      return 4;
+    case VISU::eHEXA20: 
+      return 8;
+    case VISU::ePENTA15: 
+      return 6;
+    case VISU::ePYRA13: 
+      return 5;
+#endif
+    case VISU::ePOLYGONE: 
+    case VISU::ePOLYEDRE: 
+      return -1;
+    default:
+      return theGeom % 100;
+    }
+  }
+
+  vtkIdType
+  VISUGeom2VTK(EGeometry theGeom)
+  { 
+    switch(theGeom){
+    case VISU::ePOINT1: 
+      return VTK_VERTEX;
+    case VISU::eSEG2: 
+      return VTK_LINE;
+    case VISU::eTRIA3: 
+      return VTK_TRIANGLE;
+    case VISU::eQUAD4: 
+      return VTK_QUAD;
+    case VISU::eTETRA4: 
+      return VTK_TETRA;
+    case VISU::eHEXA8: 
+      return VTK_HEXAHEDRON;
+    case VISU::ePENTA6: 
+      return VTK_WEDGE;
+    case VISU::ePYRA5: 
+      return VTK_PYRAMID;
+
+    case VISU::ePOLYGONE: 
+      return VTK_POLYGON;
+    case VISU::ePOLYEDRE: 
+      return VTK_CONVEX_POINT_SET;
+
+#ifndef VISU_ENABLE_QUADRATIC
+    case VISU::eSEG3: 
+      return VTK_LINE;
+    case VISU::eTRIA6: 
+      return VTK_TRIANGLE;
+    case VISU::eQUAD8: 
+      return VTK_QUAD;
+    case VISU::eTETRA10: 
+      return VTK_TETRA;
+    case VISU::eHEXA20: 
+      return VTK_HEXAHEDRON;
+    case VISU::ePENTA15: 
+      return VTK_WEDGE;
+    case VISU::ePYRA13: 
+      return VTK_PYRAMID;
+
+#else
+
+    case VISU::eSEG3: 
+#if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_EDGE;
+#else
+      return VTK_POLY_LINE;
+#endif
+
+    case VISU::eTRIA6: 
+#if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_TRIANGLE;
+#else
+      return VTK_POLYGON;
+#endif
+
+    case VISU::eQUAD8: 
+#if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_QUAD;
+#else
+      return VTK_POLYGON;
+#endif
+
+    case VISU::eTETRA10: 
+#if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_QUAD;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::eHEXA20: 
+#if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_HEXAHEDRON;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::ePENTA15: 
+#if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_WEDGE;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+    case VISU::ePYRA13: 
+#if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)
+      return VTK_QUADRATIC_PYRAMID;
+#else
+      return VTK_CONVEX_POINT_SET;
+#endif
+
+#endif //VISU_ENABLE_QUADRATIC
+
+    default:
+      return -1;
+    }
+  }
+}
+
+
+namespace
+{
+  //---------------------------------------------------------------
   template<class T> 
-  std::string dtos(const std::string& fmt, T val){
+  std::string 
+  dtos(const std::string& fmt, T val)
+  {
     static QString aString;
     aString.sprintf(fmt.c_str(),val);
     return aString.latin1();
   }
 
+
+  //---------------------------------------------------------------
   enum ECoordName{eX, eY, eZ, eNone};
-  typedef VISU::TCoord (*TGetCoord)(const VISU::TMeshImpl::TPointsCoord&, int);
+  typedef VISU::TCoord (*TGetCoord)(const VISU::TCCoordSlice& theCoordSlice);
   
-  template<ECoordName TheCoordId>
+  template<ECoordName TCoordId>
   VISU::TCoord 
-  GetCoord(const VISU::TMeshImpl::TPointsCoord& thePointsCoord, 
-          int theStartPos)
+  GetCoord(const VISU::TCCoordSlice& theCoordSlice)
   {
-    return thePointsCoord[theStartPos+TheCoordId];
+    return theCoordSlice[TCoordId];
   }
   
   template<>
   VISU::TCoord 
-  GetCoord<eNone>(const VISU::TMeshImpl::TPointsCoord& thePointsCoord, 
-                 int theStartPos)
+  GetCoord<eNone>(const VISU::TCCoordSlice& theCoordSlice)
   {
     return 0.0;
   }
@@ -136,86 +1041,100 @@ namespace{
 
   
   class TCoordHelper{
-    const VISU::TMeshImpl::TPointsCoord& myPointsCoord;
     TGetCoord* myGetCoord;
   public:
-    TCoordHelper(const VISU::TMeshImpl::TPointsCoord& thePointsCoord,
-                TGetCoord* theGetCoord):
-      myPointsCoord(thePointsCoord),
+    TCoordHelper(TGetCoord* theGetCoord):
       myGetCoord(theGetCoord)
     {}
-    virtual ~TCoordHelper(){}
+
+    virtual
+    ~TCoordHelper()
+    {}
+
     VISU::TCoord 
-    GetCoord(int theStartPos, int theCoodId)
+    GetCoord(VISU::TCCoordSlice& theCoordSlice, 
+            int theCoordId)
     {
-      return (*myGetCoord[theCoodId])(myPointsCoord,theStartPos);
+      return (*myGetCoord[theCoordId])(theCoordSlice);
     }
   };
   typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
   
-  void GetPoints(VISU::TVTKSource& theStorage, VISU::PMeshImpl theMesh) 
+
+  //---------------------------------------------------------------
+  vtkPoints*
+  GetPoints(const PMeshImpl& theMesh) 
   {
-    vtkPoints* aPoints = theMesh->myPoints.GetPointer();
-    if(!aPoints){
-      aPoints = vtkPoints::New();
+    TVTKPoints& aPoints = theMesh->myPoints;
+    const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+
+    if(!theMesh->myIsVTKDone){
       TCoordHelperPtr aCoordHelperPtr;
-      const VISU::TMeshImpl::TPointsCoord& anArray = theMesh->myPointsCoord;
       {
        int aMeshDimension = theMesh->myDim;
        bool anIsDimPresent[3] = {false, false, false};
        for(int iDim = 0; iDim < aMeshDimension; iDim++){
-         string aDimName = theMesh->myPointsDim[iDim];
-         if(aDimName == "x" || aDimName == "X")
+         const std::string& aName = aCoords.GetName(iDim);
+         if(aName == "x" || aName == "X")
            anIsDimPresent[eX] = true;
-         else if(aDimName == "y" || aDimName == "Y")
+         else if(aName == "y" || aName == "Y")
            anIsDimPresent[eY] = true;
-         else if(aDimName == "z" || aDimName == "Z")
+         else if(aName == "z" || aName == "Z")
            anIsDimPresent[eZ] = true;
        }
 
        switch(aMeshDimension){
        case 3:
-         aCoordHelperPtr.reset(new TCoordHelper(anArray,aXYZGetCoord));
+         aCoordHelperPtr.reset(new TCoordHelper(aXYZGetCoord));
          break;
        case 2:
          if(anIsDimPresent[eY] && anIsDimPresent[eZ])
-           aCoordHelperPtr.reset(new TCoordHelper(anArray,aYZGetCoord));
+           aCoordHelperPtr.reset(new TCoordHelper(aYZGetCoord));
          else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
-           aCoordHelperPtr.reset(new TCoordHelper(anArray,aXZGetCoord));
+           aCoordHelperPtr.reset(new TCoordHelper(aXZGetCoord));
          else
-           aCoordHelperPtr.reset(new TCoordHelper(anArray,aXYGetCoord));
+           aCoordHelperPtr.reset(new TCoordHelper(aXYGetCoord));
          break;
        case 1:
          if(anIsDimPresent[eY])
-           aCoordHelperPtr.reset(new TCoordHelper(anArray,aYGetCoord));
+           aCoordHelperPtr.reset(new TCoordHelper(aYGetCoord));
          else if(anIsDimPresent[eZ])
-           aCoordHelperPtr.reset(new TCoordHelper(anArray,aZGetCoord));
+           aCoordHelperPtr.reset(new TCoordHelper(aZGetCoord));
          else
-           aCoordHelperPtr.reset(new TCoordHelper(anArray,aXGetCoord));
+           aCoordHelperPtr.reset(new TCoordHelper(aXGetCoord));
          break;
        }
       }
 
-      if(MYVTKDEBUG) aPoints->DebugOn();
-      vtkIdType iEnd = theMesh->myPointsCoord.size();
-      vtkIdType aNbPoints = iEnd / theMesh->myDim;
+      vtkIdType aNbPoints = aCoords.GetNbPoints();
       aPoints->SetNumberOfPoints(aNbPoints);
-      MSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh->myDim);
-      for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh->myDim, j++) 
-       aPoints->SetPoint(j,
-                         aCoordHelperPtr->GetCoord(i,eX),
-                         aCoordHelperPtr->GetCoord(i,eY),
-                         aCoordHelperPtr->GetCoord(i,eZ));
-      theMesh->myPoints = aPoints;
-      aPoints->Delete();
+      
+      INITMSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<
+             "; aDim = "<<theMesh->myDim<<
+             endl);
+
+      for(vtkIdType aNodeId = 0; aNodeId < aNbPoints; aNodeId++){ 
+       TCCoordSlice aCoordSlice = aCoords.GetCoordSlice(aNodeId);
+       aPoints->SetPoint(aNodeId,
+                         aCoordHelperPtr->GetCoord(aCoordSlice,eX),
+                         aCoordHelperPtr->GetCoord(aCoordSlice,eY),
+                         aCoordHelperPtr->GetCoord(aCoordSlice,eZ));
+      }
+      
+      theMesh->myIsVTKDone = true;
+
+      if(MYVTKDEBUG) aPoints->DebugOn();
     }
-    theStorage->SetPoints(aPoints);
+
+    return aPoints.GetPointer();
   }
   
   
-  inline void PrintCells(int& theStartId,
-                        vtkCellArray* theConnectivity, 
-                        const VISU::TMeshOnEntityImpl::TConnect& theVector)
+  //---------------------------------------------------------------
+  void
+  PrintCells(int& theStartId,
+            vtkCellArray* theConnectivity, 
+            const VISU::TConnect& theVector)
   {
     vtkIdList *anIdList = vtkIdList::New();
     int kEnd = theVector.size();
@@ -226,47 +1145,34 @@ namespace{
     anIdList->Delete();
   }
 
-  void GetCellsOnEntity(VISU::TVTKSource& theStorage,
-                       const VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                       const string& theFamilyName) 
+
+  //---------------------------------------------------------------
+  void
+  GetCellsOnSubMesh(const TVTKSource& theSource,
+                   const PMeshOnEntityImpl& theMeshOnEntity, 
+                   const PSubMeshImpl& theSubMesh,
+                   const vtkIdType theGeom) 
   {
-    //Check on existing family
-    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
-    //Main part of code
-    pair<int,int> aCellsDim = theMeshOnEntity->GetCellsDims(theFamilyName);
-    int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
+    const VISU::TCell2Connect& anArray = theSubMesh->myCell2Connect;
+    vtkIdType aCellsSize = theSubMesh->myCellsSize;
+    vtkIdType aNbCells = theSubMesh->myNbCells;
+    INITMSG(MYDEBUG,"GetCellsOnSubMesh "<<
+           "- theGeom = "<<theGeom<<
+           "; aNbCells = "<<aNbCells<<
+           endl);
+
+
     vtkCellArray* aConnectivity = vtkCellArray::New();
     aConnectivity->Allocate(aCellsSize,0);
     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
-    MSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<bool(aFamily));
-    const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = theMeshOnEntity->myCellsConn;
-    VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
-    for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-      const VISU::TMeshOnEntityImpl::TConnForCellType& anArray = aCellsConnIter->second;
-      int aVtkType = aCellsConnIter->first;
-      MSG(MYDEBUG,"GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
-      if(!aFamily)
-       for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
-         PrintCells(i,aConnectivity,anArray[k]);
-         aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
-       }
-      else{
-       const VISU::TFamilyImpl::TSubMesh& aSubMesh = aFamily->mySubMesh;
-       if(aSubMesh.empty()) 
-         EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
-       VISU::TFamilyImpl::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
-       if(aSubMeshIter == aSubMesh.end()) continue;
-       const VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-       MSG(MYDEBUG,"GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
-       VISU::TFamilyImpl::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
-       for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
-         PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
-         aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
-       }
-      }
+
+    for(vtkIdType anID = 0; anID < aNbCells; anID++){
+      PrintCells(anID,aConnectivity,anArray[anID]);
+      aCellTypesArray->SetValue(anID,(unsigned char)theGeom);
     }
+
     vtkIdType *pts = 0, npts = 0;
     vtkIntArray* aCellLocationsArray = vtkIntArray::New();
     aCellLocationsArray->SetNumberOfComponents(1);
@@ -274,164 +1180,353 @@ namespace{
     aConnectivity->InitTraversal();
     for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
       aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
-    theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+    theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+
     if(MYVTKDEBUG) aConnectivity->DebugOn();
+
     aCellLocationsArray->Delete();
     aCellTypesArray->Delete();
     aConnectivity->Delete();
   } 
   
   
-  void GetCellsOnGroup(VISU::TVTKSource& theStorage,
-                      VISU::PMeshImpl theMesh,
-                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) 
+  //---------------------------------------------------------------
+  void
+  GetCellsOnFamily(const TVTKSource& theSource,
+                  const PMeshOnEntityImpl& theMeshOnEntity, 
+                  const PFamilyImpl& theFamily) 
+  {
+    INITMSG(MYDEBUG,"GetCellsOnFamily"<<endl);
+
+    vtkIdType aNbCells = theFamily->myNbCells;
+    vtkIdType aCellsSize = theFamily->myCellsSize;
+
+    vtkCellArray* aConnectivity = vtkCellArray::New();
+    aConnectivity->Allocate(aCellsSize,0);
+    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+    aCellTypesArray->SetNumberOfComponents(1);
+    aCellTypesArray->SetNumberOfTuples(aNbCells);
+
+    TSubMeshID& aMeshID = theFamily->myMeshID;
+    aMeshID.resize(aNbCells);
+
+    VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID;
+
+    const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+    VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
+    for(vtkIdType i = 0, j = 0; anIter != aGeom2SubMesh.end(); anIter++){
+      VISU::EGeometry aEGeom = anIter->first;
+      vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
+
+      const VISU::TSubMeshImpl& aSubMesh = anIter->second;
+      const VISU::TCell2Connect& anArray = aSubMesh.myCell2Connect;
+
+      const VISU::TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+      if(aGeom2SubMeshID.empty()) 
+       EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
+
+      VISU::TGeom2SubMeshID::const_iterator aGeom2SubMeshIDIter = aGeom2SubMeshID.find(aEGeom);
+      if(aGeom2SubMeshIDIter == aGeom2SubMeshID.end()) 
+       continue;
+
+      const VISU::TSubMeshID& aSubMeshID = aGeom2SubMeshIDIter->second;
+
+      INITMSG(MYDEBUG,
+             " - aEGeom = "<<aEGeom<<
+             "; aVGeom = "<<aVGeom<<
+             "; aSubMeshID.size() = "<<aSubMeshID.size()<<
+             endl);
+
+      VISU::TSubMeshID::const_iterator aSubMeshIDIter = aSubMeshID.begin();
+      for(; aSubMeshIDIter != aSubMeshID.end(); aSubMeshIDIter++, i++){
+       vtkIdType anID = *aSubMeshIDIter;
+       PrintCells(i,aConnectivity,anArray[anID]);
+       aCellTypesArray->SetValue(j++,(unsigned char)aVGeom);
+
+       anElemObj2VTKID[anID] = i;
+       aMeshID[i] = anID;
+      }
+    }
+    vtkIdType *pts = 0, npts = 0;
+    vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+    aCellLocationsArray->SetNumberOfComponents(1);
+    aCellLocationsArray->SetNumberOfTuples(aNbCells);
+    aConnectivity->InitTraversal();
+    for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
+      aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+    theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+
+    if(MYVTKDEBUG) aConnectivity->DebugOn();
+
+    aCellLocationsArray->Delete();
+    aCellTypesArray->Delete();
+    aConnectivity->Delete();
+  }
+  
+  
+  //---------------------------------------------------------------
+  std::string
+  GenerateFieldName(const PFieldImpl& theField,
+                   const PValForTimeImpl& theValForTime)
+  {
+    const VISU::TTime& aTime = theValForTime->myTime;
+    string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + 
+      VISU_Convertor::GenerateName(aTime);
+    return aFieldName;
+  }
+
+
+  //---------------------------------------------------------------
+  void 
+  GetTimeStampOnProfile(const TVTKSource& theSource,
+                       const PFieldImpl& theField, 
+                       const PValForTimeImpl& theValForTime)
   {
-    //Calculate dimentions of the group
-    int aNbCells = 0, aCellsSize = 0;
-    VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-    for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-      const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-      const string& aFamilyName = aFamilyAndEntity.first;
-      const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-      const VISU::PMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
-      pair<int,int> aCellsDim = aMeshOnEntity->GetCellsDims(aFamilyName);
-      aNbCells += aCellsDim.first;
-      aCellsSize += aCellsDim.second;
+    int aNbTuples = theField->myDataSize/theField->myNbComp;
+    std::string aFieldName = GenerateFieldName(theField,theValForTime);
+    
+    vtkDataSetAttributes* aDataSetAttributes;
+    switch(theField->myEntity){
+    case VISU::NODE_ENTITY : 
+      aDataSetAttributes = theSource->GetPointData();
+      break;
+    default: 
+      aDataSetAttributes = theSource->GetCellData();
     }
+
+    int aNbComp = theField->myNbComp;
+    vtkFloatArray *aFloatArray = vtkFloatArray::New();
+
+    switch(aNbComp) {
+    case 1:
+      aFloatArray->SetNumberOfComponents(1);
+      aDataSetAttributes->SetScalars(aFloatArray);
+      break;
+    default:
+      aFloatArray->SetNumberOfComponents(3);
+      aDataSetAttributes->SetVectors(aFloatArray);
+    }
+    aFloatArray->SetNumberOfTuples(aNbTuples);
+    aFloatArray->SetName(aFieldName.c_str());
+
+    vtkFloatArray *aDataArray = vtkFloatArray::New();
+    aDataArray->SetNumberOfComponents(aNbComp);
+    aDataArray->SetNumberOfTuples(aNbTuples);
+    aDataArray->SetName("VISU_FIELD");
+    aDataSetAttributes->AddArray(aDataArray);
+
+    int aNbComp2 = aNbComp;
+    if(aNbComp == 4)
+      aNbComp2 = 2;
+    else if(aNbComp > 4)
+      aNbComp2 = 3;
+
+    INITMSG(MYDEBUG,"GetTimeStampOnProfile "<<
+           "- aNbTuples = "<<aNbTuples<<
+           "; aNbComp = "<<aNbComp<<
+           "; aNbComp2 = "<<aNbComp2<<
+           endl);
+    
+    int aSize = max(3,aNbComp);
+    TVector<float> aDataValues(aSize,0.0);
+
+    TGeom2Value& aGeom2Value = theValForTime->myGeom2Value;
+    TGeom2Value::const_iterator anIter = aGeom2Value.begin();
+    for(int aTupleId = 0; anIter != aGeom2Value.end(); anIter++){
+      EGeometry aEGeom = anIter->first;
+      const TMeshValue& aMeshValue = anIter->second;
+      
+      int aNbElem = aMeshValue.myNbElem;
+      int aNbGauss = aMeshValue.myNbGauss;
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbGauss = "<<aNbGauss<<
+             endl);
+
+      for(int iElem = 0; iElem < aNbElem; iElem++, aTupleId++){
+       TCValueSliceArr aValueSliceArr = aMeshValue.GetCompValueSliceArr(iElem);
+       for(int iComp = 0; iComp < aNbComp; iComp++){
+         const TCValueSlice& aValueSlice = aValueSliceArr[iComp];
+         aDataValues[iComp] = 0.0;
+         for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+           aDataValues[iComp] += aValueSlice[iGauss];
+         }
+         aDataValues[iComp] /= aNbGauss;
+       }
+       aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
+       aDataArray->SetTuple(aTupleId,&aDataValues[0]);
+      }
+    }
+    aFloatArray->Delete();
+    aDataArray->Delete();
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  GetCells(const TVTKSource& theSource,
+          const PSubProfileImpl& theSubProfile,
+          const PProfileImpl& theProfile,
+          const PMeshOnEntityImpl& theMeshOnEntity)
+  {
+    vtkIdType aNbCells = theSubProfile->myNbCells;
+    vtkIdType aCellsSize = theSubProfile->myCellsSize;
+    VISU::EGeometry aEGeom = theSubProfile->myGeom;
+    vtkIdType aNbNodes = VISUGeom2NbNodes(aEGeom);
+    vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
+
+    INITMSG(MYDEBUG,"GetCells - aVGeom = "<<aVGeom<<endl);
+
+    const TSubMeshID& aSubMeshID = theSubProfile->mySubMeshID;
+
+    const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+    VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.find(aEGeom);
+    if(anIter == aGeom2SubMesh.end())
+      EXCEPTION(runtime_error,"GetCells >> There is no elements for the GEOM("<<aEGeom<<")");
+    
+    const VISU::TSubMeshImpl& aSubMesh = anIter->second;
+    const TCell2Connect& aCell2Connect = aSubMesh.myCell2Connect;
+    
     vtkCellArray* aConnectivity = vtkCellArray::New();
     aConnectivity->Allocate(aCellsSize,0);
     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
-    aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-    for(int i = 0, j = 0; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-      const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-      const string& aFamilyName = aFamilyAndEntity.first;
-      const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-      PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
-      PFamilyImpl aFamily = GetFamily(aMeshOnEntity,aFamilyName);
-      const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = aMeshOnEntity->myCellsConn;
-      VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
-      for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-       const VISU::TMeshOnEntityImpl::TConnForCellType& anArray = aCellsConnIter->second;
-       int aVtkType = aCellsConnIter->first;
-       MSG(MYDEBUG,"GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
-       const VISU::TFamilyImpl::TSubMesh& aSubMesh = aFamily->mySubMesh;
-       if(aSubMesh.empty()) 
-         EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
-       VISU::TFamilyImpl::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
-       if(aSubMeshIter == aSubMesh.end()) continue;
-       const VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-       MSG(MYDEBUG,"GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
-       VISU::TFamilyImpl::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
-       for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
-         PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
-         aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
-       }
+    
+    if(theSubProfile->myStatus == eAddAll){
+      VISU::TCell2Connect::const_iterator anIter = aCell2Connect.begin();
+      for(vtkIdType anId = 0, aConnId = 0; anIter != aCell2Connect.end(); anIter++){
+       const TConnect& anArray = aCell2Connect[anId];
+       PrintCells(aConnId,aConnectivity,anArray);
+       aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
+       aConnId += aNbNodes;
+       anId++;
+      }
+    }else{
+      VISU::TSubMeshID::const_iterator anIter = aSubMeshID.begin();
+      for(vtkIdType anId = 0, aConnId = 0; anIter != aSubMeshID.end(); anIter++){
+       vtkIdType aSubId = *anIter;
+       const TConnect& anArray = aCell2Connect[aSubId];
+       PrintCells(aConnId,aConnectivity,anArray);
+       aCellTypesArray->SetValue(anId,(unsigned char)aVGeom);
+       aConnId += aNbNodes;
+       anId++;
       }
     }
+    
     vtkIdType *pts = 0, npts = 0;
     vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+    
     aCellLocationsArray->SetNumberOfComponents(1);
     aCellLocationsArray->SetNumberOfTuples(aNbCells);
     aConnectivity->InitTraversal();
-    for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
+    for(int i=0; aConnectivity->GetNextCell(npts,pts); i++)
       aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
-    theStorage->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+    theSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+    
     aCellLocationsArray->Delete();
     aCellTypesArray->Delete();
     aConnectivity->Delete();
-  } 
+  }
+  
+  
+  //---------------------------------------------------------------
+  void
+  GetMeshOnSubProfile(const PMeshImpl& theMesh,
+                     const PMeshOnEntityImpl& theMeshOnEntity,
+                     const PProfileImpl& theProfile,
+                     const PSubProfileImpl& theSubProfile)
+  {
+    INITMSG(MYDEBUG,"GetMeshOnSubProfile - aEGeom = "<<theSubProfile->myGeom<<endl);
+    
+    const TVTKSource& aSource = theSubProfile->GetSource();
+    if(theSubProfile->myIsVTKDone)
+      return;
+    
+    aSource->SetPoints(GetPoints(theMesh));
+    INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
+    GetCells(aSource,theSubProfile,theProfile,theMeshOnEntity);
+    BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
+    
+    theSubProfile->myIsVTKDone = true;
+  }
   
   
-  void InitProfile(VISU::TVTKExtractFilter& theFilter,
-                  PMeshOnEntityImpl theMeshOnEntity, 
-                  PValForTimeImpl theValForTime)
-  {
-    const VISU::TValForTimeImpl::TValForCells& aValForCells = theValForTime->myValForCells;
-    const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = theMeshOnEntity->myCellsConn;
-    VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
-    for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-      const vtkIdType& aCellType = aCellsConnIter->first;
-      if(aValForCells.find(aCellType) == aValForCells.end())
-       theFilter->RemoveCellsWithType(aCellType);
-    }
-  }
-
-
-  void GetValsOnTimeStamp(vtkFloatArray *theFloatArray, 
-                         const vtkIdType& theNumberOfTuples,
-                         const std::string& theFieldName,
-                         VISU::PFieldImpl theField,
-                         VISU::PValForTimeImpl theValForTime)
-  {
-    //theFloatArray->DebugOn();
-    theFloatArray->SetNumberOfTuples(theNumberOfTuples);
-    theFloatArray->SetName(theFieldName.c_str());
-    MSG(MYDEBUG,"GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
-    const VISU::TValForTimeImpl::TValForCells& aValForCells = theValForTime->myValForCells;
-    VISU::TValForTimeImpl::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
-    for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
-      const VISU::TValForTimeImpl::TValForCellsWithType& anArray = aValForCellsIter->second;
-      int iEnd = anArray.size()/theField->myNbComp;
-      int aVtkType = aValForCellsIter->first;
-      MSG(MYDEBUG,"GetValsOnTimeStamp -  iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
-      switch(theField->myNbComp) {
-      case 1:
-       for (int i = 0; i < iEnd; i++) 
-         theFloatArray->SetTuple1(k++,anArray[i]);
-       break;
-      case 2:
-       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*2)
-         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
-       break;
-      case 3:
-       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*3)
-         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
-       break;
-      case 4:
-       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*4)
-         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],0.0);
-       break;
-      case 6:
-       for (int i = 0, ji = 0; i < iEnd; ++i, ji = i*6)
-         theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+1],anArray[ji+2]);
-       break;
-      default:
-       EXCEPTION(runtime_error,"GetValsOnTimeStamp - There is no an algorithm for representation of the field !!!");
+  //---------------------------------------------------------------
+  void
+  GetMeshOnProfile(const PMeshImpl& theMesh,
+                  const PMeshOnEntityImpl& theMeshOnEntity,
+                  const PProfileImpl& theProfile)
+  {
+    if(theProfile->myIsVTKDone)
+      return;
+    
+    const TVTKAppendFilter& anAppendFilter = theProfile->GetFilter();
+    anAppendFilter->SetPoints(GetPoints(theMesh));
+
+    if(theProfile->myIsAll){
+      TVTKOutput* aDataSet = theMeshOnEntity->GetVTKOutput();
+      anAppendFilter->AddInput(aDataSet);
+      theProfile->myMeshOnEntity = theMeshOnEntity.get();
+    }else{
+      const TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile;
+
+      TID2ID& anElemObj2VTKID = theProfile->myElemObj2VTKID;
+
+      TSubProfileArr& aSubProfileArr = theProfile->mySubProfileArr;
+      aSubProfileArr.resize(aGeom2SubProfile.size());
+
+      TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+      for(vtkIdType anInputID = 0, aCellID = 0; anIter != aGeom2SubProfile.end(); anIter++){
+       PSubProfileImpl aSubProfile = anIter->second;
+       if(aSubProfile->myStatus == eRemoveAll)
+         continue;
+       
+       GetMeshOnSubProfile(theMesh,
+                           theMeshOnEntity,
+                           theProfile,
+                           aSubProfile);
+       
+       const TVTKSource& aSource = aSubProfile->GetSource();
+       anAppendFilter->AddInput(aSource.GetPointer());
+
+       vtkIdType aNbCells = aSource->GetNumberOfCells();
+       for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){
+         anElemObj2VTKID[aSubProfile->GetElemObjID(aCell)] = aCellID;
+       }
+
+       aSubProfileArr[anInputID++] = aSubProfile;
       }
     }
+    anAppendFilter->Update(); // Fix on VTK
+    theProfile->myNamedPointCoords = theMesh->myNamedPointCoords;
+    
+    theProfile->myIsVTKDone = true;
   }
-
-  string GenerateFieldName(const VISU::PFieldImpl theField,
-                          const VISU::PValForTimeImpl theValForTime)
+  
+  
+  //---------------------------------------------------------------
+  void 
+  GetTimeStampOnGaussMesh(const TVTKSource& theSource,
+                         const PFieldImpl& theField, 
+                         const PValForTimeImpl& theValForTime)
   {
-    const VISU::TTime& aTime = theValForTime->myTime;
-    string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + 
-      VISU_Convertor::GenerateName(aTime);
-    return aFieldName;
-  }
+    int aNbTuples = theSource->GetNumberOfPoints();
+    std::string aFieldName = GenerateFieldName(theField,theValForTime);
 
-  void GetTimeStamp(VISU::TVTKSource& theStorage,
-                   const VISU::PFieldImpl theField, 
-                   const VISU::PValForTimeImpl theValForTime)
-  {
-    int aNumberOfTuples = theField->myDataSize/theField->myNbComp;
-    string aFieldName = GenerateFieldName(theField,theValForTime);
-    MSG(MYDEBUG,"GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
-       "; aNumberOfTuples = "<<aNumberOfTuples);
-    
     vtkDataSetAttributes* aDataSetAttributes;
     switch(theField->myEntity){
     case VISU::NODE_ENTITY : 
-      aDataSetAttributes = theStorage->GetPointData();
+      aDataSetAttributes = theSource->GetPointData();
       break;
     default: 
-      aDataSetAttributes = theStorage->GetCellData();
+      aDataSetAttributes = theSource->GetCellData();
     }
 
+    int aNbComp = theField->myNbComp;
     vtkFloatArray *aFloatArray = vtkFloatArray::New();
-    switch(theField->myNbComp) {
+    switch(aNbComp){
     case 1:
       aFloatArray->SetNumberOfComponents(1);
       aDataSetAttributes->SetScalars(aFloatArray);
@@ -440,255 +1535,625 @@ namespace{
       aFloatArray->SetNumberOfComponents(3);
       aDataSetAttributes->SetVectors(aFloatArray);
     }
-
-    GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
+    aFloatArray->SetNumberOfTuples(aNbTuples);
+    aFloatArray->SetName(aFieldName.c_str());
+
+    vtkFloatArray *aDataArray = vtkFloatArray::New();
+    aDataArray->SetNumberOfComponents(aNbComp);
+    aDataArray->SetNumberOfTuples(aNbTuples);
+    aDataArray->SetName("VISU_FIELD");
+    aDataSetAttributes->AddArray(aDataArray);
+
+    int aNbComp2 = aNbComp;
+    if(aNbComp == 4)
+      aNbComp2 = 2;
+    else if(aNbComp > 4)
+      aNbComp2 = 3;
+
+    INITMSG(MYDEBUG,"GetTimeStampOnGaussMesh "<<
+           "- aNbTuples = "<<aNbTuples<<
+           "; aNbComp = "<<aNbComp<<
+           "; aNbComp2 = "<<aNbComp2<<
+           endl);
+    
+    int aSize = max(3,aNbComp);
+    TVector<float> aDataValues(aSize,0.0);
+
+    const TGeom2Value& aGeom2Value = theValForTime->myGeom2Value;
+
+    PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh;
+    const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+    TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+    for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){
+      EGeometry aEGeom = anIter->first;
+
+      PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+      if(!aGaussSubMesh->myIsDone)
+       continue;
+      
+      TGeom2Value::const_iterator anIter2 = aGeom2Value.find(aEGeom);
+      if(anIter2 == aGeom2Value.end()){
+       EXCEPTION(runtime_error,
+                 "GetTimeStampOnGaussMesh >> Can't find values for corresponding Gauss Points SubMesh");
+      }
+      const TMeshValue& aMeshValue = anIter2->second;
+      int aNbGauss = aMeshValue.myNbGauss;
+      int aNbElem = aMeshValue.myNbElem;
+      
+      if(aNbGauss < 1)
+       continue;
+
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbGauss = "<<aNbGauss<<
+             endl);
+
+      int aNbComp2 = aNbComp;
+      if(aNbComp == 4)
+       aNbComp2 = 2;
+      else if(aNbComp > 4)
+       aNbComp2 = 3;
+
+      for(int iElem = 0; iElem < aNbElem; iElem++){
+       TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+       for(int iGauss = 0; iGauss < aNbGauss; iGauss++, aTupleId++){
+         const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+         for(int iComp = 0; iComp < aNbComp; iComp++){
+           aDataValues[iComp] = aValueSlice[iComp];
+         }
+         aFloatArray->SetTuple(aTupleId,&aDataValues[0]);
+         aDataArray->SetTuple(aTupleId,&aDataValues[0]);
+       }
+      }
+    }
+    aFloatArray->Delete();
+    aDataArray->Delete();
   }
 
-  void GetTimeStamp(VISU::TVTKAttribyteFilter& theAttribyteFilter,
-                   VISU::TVTKMergetFilter& theMergeFilter,
-                   VISU::TVTKExtractFilter& theExtractFilter,
-                   const VISU::PFieldImpl theField, 
-                   const VISU::PValForTimeImpl theValForTime)
-  {
-    int aNumberOfTuples = theField->myDataSize/theField->myNbComp;
-    string aFieldName = GenerateFieldName(theField,theValForTime);
-    MSG(MYDEBUG,"GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
-       "; aNumberOfTuples = "<<aNumberOfTuples);
-
-    vtkDataObject* aDataObject = vtkDataObject::New();
-    theMergeFilter->SetDataObject(aDataObject);
-    aDataObject->Delete();
-
-    theMergeFilter->SetInput(theExtractFilter->GetOutput());
-    theAttribyteFilter->SetInput(theMergeFilter->GetOutput());
 
-    switch(theField->myEntity){
-    case VISU::NODE_ENTITY : 
-      theMergeFilter->SetOutputFieldToPointDataField();
-      theAttribyteFilter->SetInputFieldToPointDataField();
-      theAttribyteFilter->SetOutputAttributeDataToPointData();
-      break;
-    default: 
-      theMergeFilter->SetOutputFieldToCellDataField();
-      theAttribyteFilter->SetInputFieldToCellDataField();
-      theAttribyteFilter->SetOutputAttributeDataToCellData();
+  //---------------------------------------------------------------
+  void
+  GetSource(const TVTKSource& theSource,
+           const PGaussSubMeshImpl& theGaussSubMesh,
+           const PMeshOnEntityImpl& theMeshOnEntity)
+  {
+    const TPointCoords& aCoords = theGaussSubMesh->myPointCoords;
+    vtkIdType aNbPoints = aCoords.GetNbPoints();
+    vtkIdType aDim = aCoords.GetDim();
+    
+    vtkIdType aNbCells = theGaussSubMesh->myNbCells;
+    vtkIdType aCellsSize = theGaussSubMesh->myCellsSize;
+    
+    vtkCellArray* aConnectivity = vtkCellArray::New();
+    aConnectivity->Allocate(aCellsSize,0);
+    vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+    aCellTypesArray->SetNumberOfComponents(1);
+    aCellTypesArray->SetNumberOfTuples(aNbCells);
+    
+    const TVTKPoints& aPoints = aCoords.GetPoints();
+    vtkIdList *anIdList = vtkIdList::New();
+    anIdList->SetNumberOfIds(1);
+    for(vtkIdType aPointId = 0; aPointId < aNbPoints; aPointId++){
+      TCCoordSlice aSlice = aCoords.GetCoordSlice(aPointId);
+      
+      float aCoords[3] = {0.0, 0.0, 0.0};
+      for(vtkIdType aDimId = 0; aDimId < aDim; aDimId++)
+       aCoords[aDimId] = aSlice[aDimId];
+      
+      aPoints->SetPoint(aPointId,aCoords);
+      
+      anIdList->SetId(0,aPointId);
+      aConnectivity->InsertNextCell(anIdList);
+      aCellTypesArray->SetValue(aPointId,(unsigned char)VTK_VERTEX);
     }
+    anIdList->Delete();
+    
+    vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+    aCellLocationsArray->SetNumberOfComponents(1);
+    aCellLocationsArray->SetNumberOfTuples(aNbCells);
+    
+    vtkIdType *pts = 0, npts = 0;
+    aConnectivity->InitTraversal();
+    for(int i = 0; aConnectivity->GetNextCell(npts,pts); i++)
+      aCellLocationsArray->SetValue(i,aConnectivity->GetTraversalLocation(npts));
+    
+    const TVTKSource& aSource = theGaussSubMesh->GetSource();
+    aSource->SetCells(aCellTypesArray,aCellLocationsArray,aConnectivity);
+    aSource->SetPoints(aPoints.GetPointer());
+    
+    aCellLocationsArray->Delete();
+    aCellTypesArray->Delete();
+    aConnectivity->Delete();
+  }
+  
+  
+  //---------------------------------------------------------------
+  void
+  GetGaussSubMesh(const PMeshImpl& theMesh,
+                 const PMeshOnEntityImpl& theMeshOnEntity,
+                 const PGaussMeshImpl& theGaussMesh,
+                 const PGaussSubMeshImpl& theGaussSubMesh)
+  {
+    PGaussImpl aGauss = theGaussSubMesh->myGauss;
+    INITMSG(MYDEBUG,"GetGaussSubMesh - aVGeom = "<<aGauss->myGeom<<endl);
+    
+    if(!theGaussSubMesh->myIsDone)
+      return;
+    
+    if(theGaussSubMesh->myIsVTKDone)
+      return;
+    
+    const TVTKSource& aSource = theGaussSubMesh->GetSource();
+    GetSource(aSource,theGaussSubMesh,theMeshOnEntity);
+    INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
+    BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
+    
+    theGaussSubMesh->myIsVTKDone = true;
+  }
+  
 
-    vtkFloatArray *aFloatArray = vtkFloatArray::New();
-    switch(theField->myNbComp) {
-    case 1:
-      aFloatArray->SetNumberOfComponents(1);
-      theAttribyteFilter->SetScalarComponent(0,aFieldName.c_str(),0);
-      break;
-    default:
-      aFloatArray->SetNumberOfComponents(3);
-      theAttribyteFilter->SetVectorComponent(0,aFieldName.c_str(),0);
-      theAttribyteFilter->SetVectorComponent(1,aFieldName.c_str(),1);
-      theAttribyteFilter->SetVectorComponent(2,aFieldName.c_str(),2);
+  //---------------------------------------------------------------
+  void
+  BuildGaussMesh(const PMeshImpl& theMesh,
+                const PMeshOnEntityImpl& theMeshOnEntity,
+                const PGaussMeshImpl& theGaussMesh)
+  {
+    if(theGaussMesh->myIsVTKDone)
+      return;
+
+    INITMSG(MYDEBUG,"BuildGaussMesh"<<endl);
+    const TVTKAppendFilter& anAppendFilter = theGaussMesh->GetFilter();
+    const TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
+    TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+    for(; anIter != aGeom2GaussSubMesh.end(); anIter++){
+      PGaussSubMeshImpl aGaussSubMesh = anIter->second;
+      if(aGaussSubMesh->myStatus == eRemoveAll)
+       continue;
+      
+      GetGaussSubMesh(theMesh,
+                     theMeshOnEntity,
+                     theGaussMesh,
+                     aGaussSubMesh);
+      
+      const TVTKSource& aSource = aGaussSubMesh->GetSource();
+      
+      anAppendFilter->AddInput(aSource.GetPointer());
     }
+    anAppendFilter->Update(); // Fix on VTK
 
-    vtkFieldData* aFieldData = aDataObject->GetFieldData();
-    aFieldData->AddArray(aFloatArray);
-    aFloatArray->Delete();
+    theMeshOnEntity->GetVTKOutput()->Update();
+    theGaussMesh->myParent = theMeshOnEntity.get();
+
+    vtkDataSet* aSource = anAppendFilter->GetOutput();
+    INITMSGA(MYDEBUG,0,"aNbPoints - "<<aSource->GetNumberOfPoints()<<endl);
+    BEGMSG(MYDEBUG,"aNbCells - "<<aSource->GetNumberOfCells()<<endl);
+    
+    theGaussMesh->myIsVTKDone = true;
+  }
 
-    GetValsOnTimeStamp(aFloatArray,aNumberOfTuples,aFieldName,theField,theValForTime);
+
+  //---------------------------------------------------------------
+  void
+  PrintMemorySize(vtkUnstructuredGrid* theDataSet)
+  {
+    theDataSet->Update();
+    BEGMSG(1,"GetPoints() = "<<float(theDataSet->GetPoints()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCells() = "<<float(theDataSet->GetCells()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCellTypesArray() = "<<float(theDataSet->GetCellTypesArray()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCellLocationsArray() = "<<float(theDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000)<<endl);
+    theDataSet->BuildLinks();
+    BEGMSG(1,"GetCellLinks() = "<<float(theDataSet->GetCellLinks()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetPointData() = "<<float(theDataSet->GetPointData()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetCellData() = "<<float(theDataSet->GetCellData()->GetActualMemorySize()*1000)<<endl);
+    BEGMSG(1,"GetActualMemorySize() = "<<float(theDataSet->GetActualMemorySize()*1000)<<endl);
   }
 }
 
-VISU_Convertor_impl::VISU_Convertor_impl() {
+
+//---------------------------------------------------------------
+VISU_Convertor_impl
+::VISU_Convertor_impl() 
+{
   myIsDone = false;
 }
 
-VISU_Convertor_impl::~VISU_Convertor_impl() {}
 
-VISU_Convertor::TOutput* 
-VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName, 
-                                    const VISU::TEntity& theEntity,
-                                    const string& theFamilyName)
+//---------------------------------------------------------------
+VISU_Convertor_impl
+::~VISU_Convertor_impl() 
+{}
+
+
+//---------------------------------------------------------------
+VISU::PNamedIDMapper 
+VISU_Convertor_impl
+::GetMeshOnEntity(const string& theMeshName, 
+                 const VISU::TEntity& theEntity)
 {
-  MSG(MYDEBUG,"GetMeshOnEntity - theMeshName = '"<<theMeshName<<
-      "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+  INITMSG(MYDEBUG,"GetMeshOnEntity"<<
+         "; theMeshName = '"<<theMeshName<<"'"<<
+         "; theEntity = "<<theEntity<<
+         endl);
+
   //Cheching possibility do the query
   TFindMeshOnEntity aFindMeshOnEntity = 
-    FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
-  VISU::TVTKSource* pSource;
+    FindMeshOnEntity(theMeshName,theEntity);
+  
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
-  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
-  if(aFamily)
-    pSource = &(aFamily->myStorage);
-  else
-    pSource = &(aMeshOnEntity->myStorage);
-  VISU::TVTKSource& aSource = *pSource;
+  
+  //Main part of code
+#ifndef _DEXCEPT_
+  try{
+#endif
+    if(!aMeshOnEntity->myIsVTKDone){
+      const TVTKAppendFilter& anAppendFilter = aMeshOnEntity->GetFilter();
+      if(MYVTKDEBUG) anAppendFilter->DebugOn();
+
+      LoadMeshOnEntity(aMesh,aMeshOnEntity);
+      anAppendFilter->SetPoints(GetPoints(aMesh));
+      
+      const TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+      TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
+
+      TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
+      TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
+      aSubMeshArr.resize(aGeom2SubMesh.size());
+
+      for(vtkIdType anID = 0, aCellID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){
+       EGeometry aEGeom = anIter->first;
+       vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
+       PSubMeshImpl aSubMesh = anIter->second;
+       const TVTKSource& aSource = aSubMesh->GetSource();
+       aSource->SetPoints(GetPoints(aMesh));
+       GetCellsOnSubMesh(aSource,aMeshOnEntity,aSubMesh,aVGeom);
+       anAppendFilter->AddInput(aSource.GetPointer());
+
+       aSubMesh->myStartID = aCellID;
+       vtkIdType aNbCells = aSource->GetNumberOfCells();
+       for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){
+         anElemObj2VTKID[aSubMesh->GetElemObjID(aCell)] = aCellID;
+       }
+       aSubMeshArr[anID] = aSubMesh;
+      }
+      aMeshOnEntity->myNamedPointCoords = aMesh->myNamedPointCoords;
+
+      aMeshOnEntity->myIsVTKDone = true;
+
+      if(MYDEBUGWITHFILES){
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       aFileName += aMeshName + dtos("-%d-",int(theEntity)) + "-Conv.vtk";
+       VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
+      }
+
+      if(MYVTKDEBUG){
+       GetMeshOnEntitySize(theMeshName,theEntity);
+       PrintMemorySize(anAppendFilter->GetOutput());
+      }
+    }
+
+#ifndef _DEXCEPT_
+  }catch(...){
+    throw;
+  }
+#endif
+
+  return aMeshOnEntity;
+}
+
+
+//---------------------------------------------------------------
+VISU::PIDMapper 
+VISU_Convertor_impl
+::GetFamilyOnEntity(const std::string& theMeshName, 
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName)
+{
+  INITMSG(MYDEBUG,"GetFamilyOnEntity"<<
+         "; theMeshName = '"<<theMeshName<<"'"<<
+         "; theEntity = "<<theEntity<<
+         "; theFamilyName = '"<<theFamilyName<<"'"<<
+         endl);
+
+  //Cheching possibility do the query
+  TFindFamilyOnEntity aFindFamilyOnEntity = 
+    FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
+
+  PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);;
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+
   //Main part of code
+#ifndef _DEXCEPT_
   try{
-    if(aSource.GetPointer() == NULL){
-      aSource = TOutput::New();
-      aSource->Delete();
+#endif
+    if(!aFamily->myIsVTKDone){
+      const TVTKSource& aSource = aFamily->GetSource();
       if(MYVTKDEBUG) aSource->DebugOn();
-      LoadMeshOnEntity(aMeshOnEntity,theFamilyName);
-      GetPoints(aSource,aMesh);
-      GetCellsOnEntity(aSource,aMeshOnEntity,theFamilyName);
+
+      GetMeshOnEntity(theMeshName,theEntity);
+
+      LoadFamilyOnEntity(aMesh,aMeshOnEntity,aFamily);
+      aSource->SetPoints(GetPoints(aMesh));
+      GetCellsOnFamily(aSource,aMeshOnEntity,aFamily);
+
+      aFamily->myNamedPointCoords = aMesh->myNamedPointCoords;
+
+      aFamily->myIsVTKDone = true;
+
       if(MYDEBUGWITHFILES){
-       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
-       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFamilyName = QString(theFamilyName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + dtos("-%d-",int(theEntity)) + aFamilyName + "-Conv.vtk";
        VISU::WriteToFile(aSource.GetPointer(),aFileName);
       }
+
+      if(MYVTKDEBUG){
+       GetFamilyOnEntitySize(theMeshName,theEntity,theFamilyName);
+       PrintMemorySize(aSource.GetPointer());
+      }
     }
-    if(MYVTKDEBUG){
-      GetMeshOnEntitySize(theMeshName,theEntity,theFamilyName);
-      vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
-      aDataSet->Update();
-      MSG(MYVTKDEBUG,"GetMeshOnEntity - GetPoints() = "<<float(aDataSet->GetPoints()->GetActualMemorySize()*1000));
-      MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCells() = "<<float(aDataSet->GetCells()->GetActualMemorySize()*1000));
-      MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellTypesArray() = "<<float(aDataSet->GetCellTypesArray()->GetActualMemorySize()*1000));
-      MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLocationsArray() = "<<float(aDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000));
-      aDataSet->BuildLinks();
-      MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
-      MSG(MYVTKDEBUG,"GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
-    }
+
+#ifndef _DEXCEPT_
   }catch(...){
-    aSource = vtkSmartPointerBase();
     throw;
   }
-  return aSource.GetPointer();
+#endif
+
+  return aFamily;
 }
 
-VISU_Convertor::TOutput* 
-VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName, 
-                                   const string& theGroupName)
+
+//---------------------------------------------------------------
+VISU::PIDMapper 
+VISU_Convertor_impl
+::GetMeshOnGroup(const string& theMeshName, 
+                const string& theGroupName)
 {
-  MSG(MYDEBUG,"GetMeshOnGroup - theMeshName = '"<<theMeshName<<
-      "'; theGroupName = '"<<theGroupName<<"'");
+  INITMSG(MYDEBUG,"GetMeshOnGroup\n");
+  INITMSGA(MYDEBUG,0,
+          "- theMeshName = '"<<theMeshName<<
+          "'; theGroupName = '"<<theGroupName<<"'"<<
+          endl);
+
   //Cheching possibility do the query
   TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
   PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
-  const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
-  VISU::TVTKSource& aSource = aGroup->myStorage;
+
   //Main part of code
+#ifndef _DEXCEPT_
   try{
-    if(aSource.GetPointer() == NULL){
-      aSource = TOutput::New();
-      aSource->Delete();
-      LoadMeshOnGroup(aMesh,aFamilyAndEntitySet);
-      GetPoints(aSource,aMesh);
-      GetCellsOnGroup(aSource,aMesh,aFamilyAndEntitySet);
+#endif
+    if(!aGroup->myIsVTKDone){
+      const TVTKAppendFilter& anAppendFilter = aGroup->GetFilter();
+      const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
+
+      LoadMeshOnGroup(aMesh,aFamilySet);
+      anAppendFilter->SetPoints(GetPoints(aMesh));
+
+      TFamilySet::const_iterator anIter = aFamilySet.begin();
+
+      TID2ID& anElemObj2VTKID = aGroup->myElemObj2VTKID;
+      TFamilyArr& aFamilyArr = aGroup->myFamilyArr;
+      aFamilyArr.resize(aFamilySet.size());
+
+      for(vtkIdType anID = 0; anIter != aFamilySet.end(); anIter++){
+       PFamilyImpl aFamily = *anIter;
+       const std::string& aFamilyName = aFamily->myName;
+       const VISU::TEntity& anEntity = aFamily->myEntity;
+
+       VISU::PIDMapper anIDMapper = GetFamilyOnEntity(theMeshName,anEntity,aFamilyName);
+       VISU::TVTKOutput* anOutput = anIDMapper->GetVTKOutput();
+       anAppendFilter->AddInput(anOutput);
+
+       vtkIdType aNbCells = anOutput->GetNumberOfCells();
+       for(vtkIdType aCellID = 0; aCellID < aNbCells; aCellID++){
+         anElemObj2VTKID[aFamily->GetElemObjID(aCellID)] = aCellID;
+       }
+       aFamilyArr[anID] = aFamily;
+      }
+      aGroup->myNamedPointCoords = aMesh->myNamedPointCoords;
+
+      aGroup->myIsVTKDone = true;
+
       if(MYDEBUGWITHFILES){
-       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
-       string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
-       string aFileName = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       std::string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aGroupName = QString(theGroupName.c_str()).simplifyWhiteSpace().latin1();
+       std::string aFileName = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        aFileName += aMeshName + "-" + aGroupName + "-Conv.vtk";
-       VISU::WriteToFile(aSource.GetPointer(),aFileName);
+       VISU::WriteToFile(anAppendFilter->GetOutput(),aFileName);
       }
     }
+#ifndef _DEXCEPT_
   }catch(...){
-    aSource = vtkSmartPointerBase();
     throw;
   }
-  return aSource.GetPointer();
+#endif
+
+  return aGroup;
 }
 
-VISU_Convertor::TOutput* 
-VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName, 
-                                       const VISU::TEntity& theEntity,
-                                       const string& theFieldName,
-                                       int theStampsNum)
+
+//---------------------------------------------------------------
+VISU::PIDMapper 
+VISU_Convertor_impl
+::GetTimeStampOnMesh(const string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const string& theFieldName,
+                    int theStampsNum)
 {
-  MSG(MYDEBUG,"GetTimeStampOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
-  MSG(MYDEBUG,"GetTimeStampOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
+  INITMSG(MYDEBUG,"GetTimeStampOnMesh"<<
+         "; theMeshName = '"<<theMeshName<<"'"<<
+         "; theEntity = "<<theEntity<<
+         "; theFieldName = '"<<theFieldName<<"'"<<
+         "; theStampsNum = "<<theStampsNum<<
+         endl);
 
   //Cheching possibility do the query
-  TFindTimeStamp aFindTimeStamp = 
-    FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
+  TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theStampsNum);
+
   PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
   PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
   PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
   PFieldImpl aField = boost::get<3>(aFindTimeStamp);
 
-  VISU::TVTKAttribyteFilter& anAttribyteFilter = aValForTime->myAttribyteFilter;
-  VISU::TVTKSource& aSource = aValForTime->myStorage;
-  TOutput* anOutput = NULL;
   //Main part of code
+  PIDMapperFilter anIDMapperFilter = aValForTime->myIDMapperFilter;
+#ifndef _DEXCEPT_
   try{
-    if(aSource.GetPointer())
-      return aSource.GetPointer();
-    else if(anAttribyteFilter.GetPointer())
-      return anAttribyteFilter->GetUnstructuredGridOutput();
-    else{
-      LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
-
-      VISU::TVTKExtractFilter& anExtractFilter = aField->myExtractFilter;
-      if(anExtractFilter.GetPointer() == NULL){
-       anExtractFilter = VISU_ExtractUnstructuredGrid::New();
-       anExtractFilter->Delete();
-       //anExtractFilter->DebugOn();
-       try{
-         LoadMeshOnEntity(aVTKMeshOnEntity);
-       }catch(std::exception& exc){
-         aVTKMeshOnEntity = aMeshOnEntity;
-         MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
-       }catch(...){
-         aVTKMeshOnEntity = aMeshOnEntity;
-         MSG(MYDEBUG,"Unknown exception was occured!");
-       }
-       GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
-       
-       anExtractFilter->SetInput(aVTKMeshOnEntity->myStorage.GetPointer());
-       ::InitProfile(anExtractFilter,aMeshOnEntity,aValForTime);
-      }      
-      if(!anExtractFilter->IsRemoving()){
-       aSource = TOutput::New();
-       aSource->Delete();
-       aSource->ShallowCopy(aVTKMeshOnEntity->myStorage.GetPointer());
-       ::GetTimeStamp(aSource,aField,aValForTime);
-       anOutput = aSource.GetPointer();
-      }else{
-       anAttribyteFilter = vtkFieldDataToAttributeDataFilter::New();
-       anAttribyteFilter->Delete();
-       //anAttribyteFilter->DebugOn();
-       
-       VISU::TVTKMergetFilter& aMergeFilter = aValForTime->myMergeFilter;
-       aMergeFilter = vtkMergeDataObjectFilter::New();
-       aMergeFilter->Delete();
-       //aMergeFilter->DebugOn();
-
-       ::GetTimeStamp(anAttribyteFilter,aMergeFilter,anExtractFilter,
-                      aField,aValForTime);
-       anOutput = anAttribyteFilter->GetUnstructuredGridOutput();
+#endif
+    if(!anIDMapperFilter->myIsVTKDone){
+      LoadValForTimeOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
+
+      try{
+       LoadMeshOnEntity(aMesh,aVTKMeshOnEntity);
+      }catch(std::exception& exc){
+       aVTKMeshOnEntity = aMeshOnEntity;
+       MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
+      }catch(...){
+       aVTKMeshOnEntity = aMeshOnEntity;
+       MSG(MYDEBUG,"Unknown exception was occured!");
+      }
+
+      GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);     
+
+      PProfileImpl aProfile = aValForTime->myProfile;
+      TSource& aProfileSource = aProfile->mySource;
+      if(!aProfileSource.myIsVTKDone){
+       GetMeshOnProfile(aMesh,aVTKMeshOnEntity,aProfile);
+       aProfileSource.myIsVTKDone = true;
+      }
+
+      anIDMapperFilter->myIDMapper = aProfile;
+      TVTKOutput* anOutput = anIDMapperFilter->GetVTKOutput();
+      const TVTKSource& aSource = anIDMapperFilter->mySource.GetSource();
+      GetTimeStampOnProfile(aSource,aField,aValForTime);
+
+      anIDMapperFilter->myIsVTKDone = true;
+
+      if(MYDEBUGWITHFILES){
+       string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
+       string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
+       string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
+       string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
+         aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
+       VISU::WriteToFile(anOutput,aFileName);
+      }
+      if(MYVTKDEBUG){
+       GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
+       anOutput->Update();
+       if(theEntity == VISU::NODE_ENTITY)
+         BEGMSG(MYVTKDEBUG,"GetPointData() = "<<float(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
+       else
+         BEGMSG(MYVTKDEBUG,"GetCellData() = "<<float(anOutput->GetCellData()->GetActualMemorySize()*1000)<<endl);
+       BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(anOutput->GetActualMemorySize()*1000)<<endl);
+      }
+    }
+#ifndef _DEXCEPT_
+  }catch(std::exception& exc){
+    throw;
+  }catch(...){
+    throw;
+  }
+#endif
+
+  return anIDMapperFilter;
+}
+
+
+//---------------------------------------------------------------
+VISU::PGaussPtsIDMapper 
+VISU_Convertor_impl
+::GetTimeStampOnGaussPts(const string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const string& theFieldName,
+                        int theStampsNum)
+{
+  INITMSG(MYDEBUG,"GetTimeStampOnGaussPts"<<
+         "; theMeshName = '"<<theMeshName<<"'"<<
+         "; theEntity = "<<theEntity<<
+         "; theFieldName = '"<<theFieldName<<"'"<<
+         "; theStampsNum = "<<theStampsNum<<
+         endl);
+
+  //Cheching possibility do the query
+  TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName,
+                                               theEntity,
+                                               theFieldName,
+                                               theStampsNum);
+  
+  PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
+  PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity;
+  PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+
+  //Main part of code
+  PGaussPtsIDFilter aGaussPtsIDFilter = aValForTime->myGaussPtsIDFilter;
+#ifndef _DEXCEPT_
+  try{
+#endif
+    if(!aGaussPtsIDFilter->myIsVTKDone){
+      LoadValForTimeOnGaussPts(aMesh,aMeshOnEntity,aField,aValForTime);
+      
+      GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
+      
+      PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh;
+      TSource& aGaussPtsSource = aGaussMesh->mySource;
+      if(!aGaussPtsSource.myIsVTKDone){
+       BuildGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh);
+       aGaussPtsSource.myIsVTKDone = true;
       }
+      
+      aGaussPtsIDFilter->myIDMapper = aGaussMesh;
+      aGaussPtsIDFilter->myGaussPtsIDMapper = aGaussMesh;
+      TVTKOutput* anOutput = aGaussPtsIDFilter->GetVTKOutput();
+      const TVTKSource& aSource = aGaussPtsIDFilter->mySource.GetSource();
+      GetTimeStampOnGaussMesh(aSource,aField,aValForTime);
+
+      aGaussPtsIDFilter->myIsVTKDone = true;
+
       if(MYDEBUGWITHFILES){
        string aMeshName = QString(theMeshName.c_str()).simplifyWhiteSpace().latin1();
        string aFieldName = QString(theFieldName.c_str()).simplifyWhiteSpace().latin1();
-       string aPrefix = string("/users/")+getenv("USER")+"/"+getenv("USER")+"-";
+       string aPrefix = string(getenv("HOME"))+"/"+getenv("USER")+"-";
        string aFileName = aPrefix + aMeshName + dtos("-%d-",int(theEntity)) + 
          aFieldName + dtos("-%d",theStampsNum) + "-Conv.vtk";
        VISU::WriteToFile(anOutput,aFileName);
       }
       if(MYVTKDEBUG){
        GetTimeStampSize(theMeshName,theEntity,theFieldName,theStampsNum);
-       vtkUnstructuredGrid *aDataSet = anAttribyteFilter->GetUnstructuredGridOutput();
-       aDataSet->Update();
+       anOutput->Update();
        if(theEntity == VISU::NODE_ENTITY)
-         MSG(MYVTKDEBUG,"GetTimeStampOnMesh - GetData() = "<<float(aDataSet->GetPointData()->GetActualMemorySize()*1000));
+         BEGMSG(MYVTKDEBUG,"GetPointData() = "<<float(anOutput->GetPointData()->GetActualMemorySize()*1000)<<endl);
        else
-         MSG(MYVTKDEBUG,"GetMeshOnEntity - GetData() = "<<float(aDataSet->GetCellData()->GetActualMemorySize()*1000));
-       MSG(MYVTKDEBUG,"GetTimeStampOnMesh - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
+         BEGMSG(MYVTKDEBUG,"GetCellData() = "<<float(anOutput->GetCellData()->GetActualMemorySize()*1000)<<endl);
+       BEGMSG(MYVTKDEBUG,"GetActualMemorySize() = "<<float(anOutput->GetActualMemorySize()*1000)<<endl);
       }
     }
+#ifndef _DEXCEPT_
+  }catch(std::exception& exc){
+    throw;
   }catch(...){
-    aSource = vtkSmartPointerBase();
-    anAttribyteFilter = vtkSmartPointerBase();
     throw;
   }
-  return anOutput;
+#endif
+
+  return aGaussPtsIDFilter;
 }
 
+//---------------------------------------------------------------
 VISU::PMeshImpl 
-VISU_Convertor_impl::FindMesh(const string& theMeshName)
+VISU_Convertor_impl
+::FindMesh(const string& theMeshName)
 {
   GetMeshMap();
   TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
@@ -700,10 +2165,11 @@ VISU_Convertor_impl::FindMesh(const string& theMeshName)
 }
 
 
+//---------------------------------------------------------------
 VISU_Convertor_impl::TFindMeshOnEntity
-VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName,
-                                     const VISU::TEntity& theEntity,
-                                     const string& theFamilyName)
+VISU_Convertor_impl
+::FindMeshOnEntity(const string& theMeshName,
+                  const VISU::TEntity& theEntity)
 {
   PMeshImpl aMesh = FindMesh(theMeshName);
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
@@ -712,14 +2178,46 @@ VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName,
     EXCEPTION(runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
 
   PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
-
+  
   return TFindMeshOnEntity(aMesh,
-                          aMeshOnEntityMap[theEntity],
-                          GetFamily(aMeshOnEntity,theFamilyName));
+                          aMeshOnEntity);
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor_impl::TFindFamilyOnEntity
+VISU_Convertor_impl
+::FindFamilyOnEntity(const string& theMeshName,
+                    const VISU::TEntity& theEntity,
+                    const string& theFamilyName)
+{
+  if(theFamilyName != ""){
+    PMeshImpl aMesh = FindMesh(theMeshName);
+    VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+    VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
+    if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
+      EXCEPTION(runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
+
+    PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+    TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+    TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
+    if(aFamilyMapIter != aFamilyMap.end()){
+      const PFamily& aFamily = aFamilyMapIter->second;
+      return TFindFamilyOnEntity(aMesh,
+                                aMeshOnEntity,
+                                aFamily);
+    }
+  }
+  return TFindFamilyOnEntity();
 }
 
 
-float VISU_Convertor_impl::GetSize() {
+//---------------------------------------------------------------
+float
+VISU_Convertor_impl
+::GetSize() 
+{
   float aResult = 0.0;
   const VISU::TMeshMap& aMeshMap = GetMeshMap();
   VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
@@ -757,7 +2255,7 @@ float VISU_Convertor_impl::GetSize() {
       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
        const string& aFamilyName = aFamilyMapIter->first;
-       aResult += GetMeshOnEntitySize(aMeshName,anEntity,aFamilyName);
+       aResult += GetFamilyOnEntitySize(aMeshName,anEntity,aFamilyName);
       }
       //Import mesh on entity
       aResult += GetMeshOnEntitySize(aMeshName,anEntity);
@@ -768,27 +2266,65 @@ float VISU_Convertor_impl::GetSize() {
 }
 
 
-float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName, 
-                                              const VISU::TEntity& theEntity,
-                                              const std::string& theFamilyName)
+//---------------------------------------------------------------
+float
+VISU_Convertor_impl
+::GetMeshOnEntitySize(const std::string& theMeshName, 
+                     const VISU::TEntity& theEntity)
 {
   TFindMeshOnEntity aFindMeshOnEntity = 
-    FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
+    FindMeshOnEntity(theMeshName,theEntity);
+
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
-  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
   vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  vtkIdType aNbCells, aCellsSize;
+  vtkIdType aNbCells = aMeshOnEntity->myNbCells;
+  vtkIdType aCellsSize = aMeshOnEntity->myCellsSize;
+
+  vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+  vtkIdType aTypesSize = aNbCells*sizeof(char);
+  vtkIdType aLocationsSize = aNbCells*sizeof(int);
+  float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+  vtkIdType aLinksSize = aMesh->myNbPoints * 
+    (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
+  aLinksSize = 0;
+  vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
 
-  if(!aFamily){
-    aNbCells = aMeshOnEntity->myNbCells;
-    aCellsSize = aMeshOnEntity->myCellsSize;
-  }else{
-    aNbCells = aFamily->myNbCells;
-    aCellsSize = aFamily->myCellsSize;
+  MSG(MYDEBUG,"GetMeshOnEntitySize "<<
+      "- aResult = "<<float(aResult)<<
+      "; theMeshName = '"<<theMeshName<<"'"<<
+      "; theEntity = "<<theEntity);
+  if(MYDEBUG){
+    INITMSG(MYVTKDEBUG,"- aPointsSize = "<<float(aPointsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aConnectivitySize = "<<float(aConnectivitySize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aTypesSize = "<<float(aTypesSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLocationsSize = "<<float(aLocationsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<float(aLinksSize)<<"\n");
   }
 
+  aResult = vtkIdType(aResult*ERR_SIZE_CALC);
+  return aResult;
+}
+
+
+//---------------------------------------------------------------
+float
+VISU_Convertor_impl
+::GetFamilyOnEntitySize(const std::string& theMeshName, 
+                       const VISU::TEntity& theEntity,
+                       const std::string& theFamilyName)
+{
+  TFindFamilyOnEntity aFindFamilyOnEntity = 
+    FindFamilyOnEntity(theMeshName,theEntity,theFamilyName);
+  PMeshImpl aMesh = boost::get<0>(aFindFamilyOnEntity);
+  PFamilyImpl aFamily = boost::get<2>(aFindFamilyOnEntity);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindFamilyOnEntity);
+
+  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
+  vtkIdType aNbCells = aFamily->myNbCells;
+  vtkIdType aCellsSize = aFamily->myCellsSize;
+
   vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
   vtkIdType aTypesSize = aNbCells*sizeof(char);
   vtkIdType aLocationsSize = aNbCells*sizeof(int);
@@ -797,24 +2333,30 @@ float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName,
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
   vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
+
+  MSG(MYDEBUG,"GetFamilyOnEntitySize "<<
+      "- aResult = "<<float(aResult)<<
+      "; theMeshName = '"<<theMeshName<<"'"<<
+      "; theEntity = "<<theEntity<<
+      "; theFamilyName = '"<<theFamilyName<<"'");
   if(MYDEBUG){
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aPointsSize = "<<float(aPointsSize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aConnectivitySize = "<<float(aConnectivitySize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aTypesSize = "<<float(aTypesSize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aLocationsSize = "<<float(aLocationsSize));
-    MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aLinksSize = "<<float(aLinksSize));
+    INITMSG(MYVTKDEBUG,"- aPointsSize = "<<float(aPointsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aConnectivitySize = "<<float(aConnectivitySize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aTypesSize = "<<float(aTypesSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLocationsSize = "<<float(aLocationsSize)<<"\n");
+    BEGMSG(MYVTKDEBUG,"- aLinksSize = "<<float(aLinksSize)<<"\n");
   }
-  MSG(MYDEBUG,"GetMeshOnEntitySize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
-      "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
 
   aResult = vtkIdType(aResult*ERR_SIZE_CALC);
   return aResult;
 }
 
 
+//---------------------------------------------------------------
 VISU_Convertor_impl::TFindMeshOnGroup
-VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName, 
-                                    const std::string& theGroupName)
+VISU_Convertor_impl
+::FindMeshOnGroup(const std::string& theMeshName, 
+                 const std::string& theGroupName)
 {
   PMeshImpl aMesh = FindMesh(theMeshName);
   VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
@@ -827,15 +2369,19 @@ VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName,
 }
 
 
-float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName, 
-                                             const std::string& theGroupName)
+float
+VISU_Convertor_impl
+::GetMeshOnGroupSize(const std::string& theMeshName, 
+                    const std::string& theGroupName)
 {
   TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
   PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
 
   vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
-  vtkIdType aNbCells = aGroup->myNbCells, aCellsSize = aGroup->myCellsSize;
+  TNbASizeCells aNbASizeCells = aGroup->GetNbASizeCells();
+  vtkIdType aNbCells = aNbASizeCells.first;
+  vtkIdType aCellsSize = aNbASizeCells.second;
   vtkIdType aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
   vtkIdType aLocationsSize = aNbCells*sizeof(int);
   float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
@@ -856,14 +2402,17 @@ float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName,
   return aResult;
 }
 
+
 VISU_Convertor_impl::TFindField
-VISU_Convertor_impl::FindField(const string& theMeshName, 
-                              const VISU::TEntity& theEntity, 
-                              const string& theFieldName)
+VISU_Convertor_impl
+::FindField(const string& theMeshName, 
+           const VISU::TEntity& theEntity, 
+           const string& theFieldName)
 {
-  TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,theEntity,"");
+  TFindMeshOnEntity aFindMeshOnEntity = 
+    FindMeshOnEntity(theMeshName,theEntity);
+
   PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
-  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
   PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
 
   VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
@@ -892,13 +2441,15 @@ VISU_Convertor_impl::FindField(const string& theMeshName,
 }
 
 
-float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName, 
-                                             const VISU::TEntity& theEntity,
-                                             const std::string& theFieldName)
+float
+VISU_Convertor_impl
+::GetFieldOnMeshSize(const std::string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const std::string& theFieldName)
 {
   TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
   PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
-  PField aField = boost::get<3>(aFindField);
+  PFieldImpl aField = boost::get<3>(aFindField);
 
   float aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
   float aFieldOnMeshSize = float(aField->myDataSize*sizeof(float)*aField->myValField.size()*ERR_SIZE_CALC);
@@ -913,10 +2464,11 @@ float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName,
 
 
 VISU_Convertor_impl::TFindTimeStamp
-VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName, 
-                                  const VISU::TEntity& theEntity, 
-                                  const std::string& theFieldName, 
-                                  int theStampsNum)
+VISU_Convertor_impl
+::FindTimeStamp(const std::string& theMeshName, 
+               const VISU::TEntity& theEntity, 
+               const std::string& theFieldName, 
+               int theStampsNum)
 {
   TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
   PField aField = boost::get<3>(aFindField);
@@ -939,15 +2491,17 @@ VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName,
 }
 
 
-float VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName, 
-                                           const VISU::TEntity& theEntity,
-                                           const std::string& theFieldName,
-                                           int theStampsNum)
+float
+VISU_Convertor_impl
+::GetTimeStampSize(const std::string& theMeshName, 
+                  const VISU::TEntity& theEntity,
+                  const std::string& theFieldName,
+                  int theStampsNum)
 {
   TFindTimeStamp aFindTimeStamp = 
     FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
   PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
-  PField aField = boost::get<3>(aFindTimeStamp);
+  PFieldImpl aField = boost::get<3>(aFindTimeStamp);
   
   float aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
   float aTimeStampSize = float(aField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
@@ -963,9 +2517,10 @@ float VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName,
 
 
 const VISU::PField
-VISU_Convertor_impl::GetField(const string& theMeshName, 
-                             VISU::TEntity theEntity, 
-                             const string& theFieldName) 
+VISU_Convertor_impl
+::GetField(const string& theMeshName, 
+          VISU::TEntity theEntity, 
+          const string& theFieldName) 
 {
   TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
   PField aField = boost::get<3>(aFindField);
@@ -974,10 +2529,11 @@ VISU_Convertor_impl::GetField(const string& theMeshName,
 
 
 const VISU::PValForTime 
-VISU_Convertor_impl::GetTimeStamp(const std::string& theMeshName, 
-                                 const VISU::TEntity& theEntity,
-                                 const std::string& theFieldName,
-                                 int theStampsNum)
+VISU_Convertor_impl
+::GetTimeStamp(const std::string& theMeshName, 
+              const VISU::TEntity& theEntity,
+              const std::string& theFieldName,
+              int theStampsNum)
 {
   TFindTimeStamp aFindTimeStamp = 
     FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
index 46284cba0cab26d047f6b2bc59202fec10e5121e..08771a4c3489b2579bbc17079e1bc981a47c2082 100644 (file)
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
 //
+//  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_Convertor_impl.hxx
-//  Author : Alexey PETROV
-//  Module : VISU
+//
+//  File   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
 
 #ifndef VISU_Convertor_impl_HeaderFile
 #define VISU_Convertor_impl_HeaderFile
 
+#include <vtkSmartPointer.h>
+
+#include <boost/tuple/tuple.hpp>
+
+class vtkCell;
+class vtkPoints;
+class vtkUnstructuredGrid;
+class VTKViewer_AppendFilter;
+class VISU_MergeFilter;
+
 #include "VISU_Convertor.hxx"
+#include "MED_SliceArray.hxx"
 
-#include <vtkSystemIncludes.h>
+#ifndef VISU_ENABLE_QUADRATIC
+//#define VISU_ENABLE_QUADRATIC
+//#define VISU_USE_VTK_QUADRATIC
+#endif
 
-#include <vtkPoints.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkMergeDataObjectFilter.h>
-#include <vtkFieldDataToAttributeDataFilter.h>
-#include "VISU_ExtractUnstructuredGrid.hxx"
+namespace VISU
+{
+  enum EGeometry {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
+                 eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
+                 ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310, 
+                 ePYRA13=313, ePENTA15=315, eHEXA20=320, 
+                 ePOLYGONE=400, ePOLYEDRE=500, eNONE=-1};
 
-#include <qstring.h>
-#include <qfileinfo.h>
+  vtkIdType
+  VISUGeom2NbNodes(EGeometry theGeom);
 
-#include <vtkSmartPointer.h>
+  vtkIdType
+  VISUGeom2VTK(EGeometry theGeom);
 
-#include <boost/tuple/tuple.hpp>
+  //---------------------------------------------------------------
+  using MED::TCSlice;
+  using MED::TSlice;
 
-namespace VISU{
+  typedef vtkUnstructuredGrid TDataSet;
 
+  typedef vtkSmartPointer<TDataSet> TVTKSource;
   typedef vtkSmartPointer<vtkPoints> TVTKPoints;
-  typedef vtkSmartPointer<vtkUnstructuredGrid> TVTKSource;
-  typedef vtkSmartPointer<vtkMergeDataObjectFilter> TVTKMergetFilter;
-  typedef vtkSmartPointer<VISU_ExtractUnstructuredGrid> TVTKExtractFilter;
-  typedef vtkSmartPointer<vtkFieldDataToAttributeDataFilter> TVTKAttribyteFilter;
+  typedef vtkSmartPointer<VISU_MergeFilter> TVTKMergeFilter;
+
+  typedef vtkSmartPointer<VTKViewer_AppendFilter> TVTKAppendFilter;
 
   typedef float TCoord;
 
-  struct TMeshImpl: TMesh{
+  //---------------------------------------------------------------
+  struct TIsVTKDone: virtual TBaseStructure
+  {
+    TIsVTKDone();
+    bool myIsDone;
+    bool myIsVTKDone;
+  };
+
+  
+  //---------------------------------------------------------------
+  struct TSizeCounter: virtual TIsVTKDone
+  {
+    TSizeCounter();
+    vtkIdType myNbCells;
+    vtkIdType myCellsSize;
+  };
+
+
+  //---------------------------------------------------------------
+  class TSource: public virtual TSizeCounter
+  {
+  protected:
+    mutable TVTKSource mySource;
+  public:
+    TSource();
+
+    const TVTKSource& 
+    GetSource() const;
+
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  class TAppendFilter: public virtual TIsVTKDone,
+                      public virtual TIDMapper
+  {
+  protected:
+    mutable TVTKAppendFilter myFilter;
+  public:
+    TAppendFilter();
+
+    const TVTKAppendFilter& 
+    GetFilter() const;
+
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  class TMergeFilter: public virtual TIsVTKDone,
+                     public virtual TIDMapper
+  {
+  protected:
+    mutable TVTKMergeFilter myFilter;
+  public:
+    TMergeFilter();
+
+    const TVTKMergeFilter& 
+    GetFilter() const;
+
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+  };
+
+
+  //---------------------------------------------------------------
+  typedef TVector<TCoord> TCoordArray;
+  typedef TSlice<TCoordArray> TCoordSlice;
+  typedef TCSlice<TCoordArray> TCCoordSlice;
+
+  class TPointCoords: public virtual TBaseStructure
+  {
+  protected:
+    vtkIdType myDim;
+    vtkIdType myNbPoints;
+
+    TCoordArray myCoord;
     TVTKPoints myPoints;
 
-    typedef std::vector<TCoord> TPointsCoord;
-    TPointsCoord myPointsCoord;
+  public:
+    TPointCoords();
+
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim);
 
-    typedef std::vector<std::string> TPointsDim;
+    TCCoordSlice
+    GetCoordSlice(vtkIdType theNodeId) const;
+
+    TCoordSlice 
+    GetCoordSlice(vtkIdType theNodeId);
+
+    vtkIdType
+    GetNbPoints() const { return myNbPoints; }
+
+    vtkIdType
+    GetDim() const { return myDim; }
+
+    vtkIdType
+    size() const { return GetNbPoints(); }
+
+    const TVTKPoints&
+    GetPoints() const { return myPoints;}
+  };
+  typedef SharedPtr<TPointCoords> PPointCoords;
+
+
+  //---------------------------------------------------------------
+  typedef TVector<vtkIdType> TVectorID;
+  typedef std::map<vtkIdType,vtkIdType> TObj2VTKID;
+
+  class TNamedPointCoords: public virtual TPointCoords
+  {
+  protected:
+    typedef TVector<std::string> TPointsDim;
     TPointsDim myPointsDim;
+    TVectorID myVectorID;
+    TObj2VTKID myObj2VTKID;
+
+  public:
+
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const TVectorID& theVectorID = TVectorID());
+    
+    std::string&
+    GetName(vtkIdType theDim);
+    
+    const std::string&
+    GetName(vtkIdType theDim) const;
+
+    virtual
+    vtkIdType
+    GetObjID(vtkIdType theID) const;
+
+    virtual
+    vtkIdType
+    GetVTKID(vtkIdType theID) const;
+
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
   };
-  typedef shared_ptr<TMeshImpl> PMeshImpl;
+  typedef SharedPtr<TNamedPointCoords> PNamedPointCoords;
+
+
+  //---------------------------------------------------------------
+  struct TMeshImpl: virtual TMesh, 
+                   virtual TIsVTKDone
+  {
+    PNamedPointCoords myNamedPointCoords;
+
+    TVTKPoints myPoints;
+    vtkIdType myNbPoints;
+
+    TMeshImpl();
+  };
+  typedef SharedPtr<TMeshImpl> PMeshImpl;
+
+
+  //---------------------------------------------------------------
+  typedef TVector<vtkIdType> TSubMeshID;
+  typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
+
+  struct TSubProfileImpl: virtual TSubProfile, 
+                         virtual TSource
+  {
+    TSubProfileImpl();
+
+    EGeometry myGeom;
+    std::string myName;
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(int theVtkI) const;
+
+    ESubMeshStatus myStatus;
+    TSubMeshID mySubMeshID;
+  };
+  typedef SharedPtr<TSubProfileImpl> PSubProfileImpl;
+
+
+  //---------------------------------------------------------------
+  struct TMeshOnEntityImpl;
+
+  typedef std::map<vtkIdType,vtkIdType> TID2ID;
+  typedef TVector<PSubProfileImpl> TSubProfileArr;
+  typedef std::map<EGeometry,PSubProfileImpl> TGeom2SubProfile;
+
+  struct TProfileImpl: virtual TProfile, 
+                      virtual TAppendFilter
+  {
+    TProfileImpl();
+    bool myIsAll;
+   
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    virtual 
+    float*  
+    GetNodeCoord(vtkIdType theObjID);
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    virtual
+    vtkCell* 
+    GetElemCell(vtkIdType theObjID);
+    
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+
+    TID2ID myElemObj2VTKID;
+    TSubProfileArr mySubProfileArr;
+    PNamedPointCoords myNamedPointCoords;
+    TMeshOnEntityImpl* myMeshOnEntity;
+
+    TSource mySource;
+    TGeom2SubProfile myGeom2SubProfile;
+  };
+  typedef SharedPtr<TProfileImpl> PProfileImpl;
+
+
+  //---------------------------------------------------------------
+  struct TIDMapperFilter: virtual TMergeFilter
+  {
+    TAppendFilter myIDMapper;
+    TSource mySource;
+
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    virtual 
+    float*  
+    GetNodeCoord(vtkIdType theObjID);
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    virtual
+    vtkCell* 
+    GetElemCell(vtkIdType theObjID);
+    
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+  };
+  typedef SharedPtr<TIDMapperFilter> PIDMapperFilter;
+
+
+  //---------------------------------------------------------------
+  struct TGaussImpl: virtual TGauss
+  {
+    EGeometry myGeom;
+    std::string myName;
+    vtkIdType myNbPoints;
+  };
+  typedef SharedPtr<TGaussImpl> PGaussImpl;
+
+
+  //---------------------------------------------------------------
+  struct TGaussSubMeshImpl: virtual TGaussSubMesh, 
+                           virtual TSource
+  {
+    TGaussSubMeshImpl();
+
+    virtual
+    TGaussPointID
+    GetObjID(vtkIdType theID) const;
+    
+    PGaussImpl myGauss;
+    ESubMeshStatus myStatus;
+    TPointCoords myPointCoords;
+  };
+  typedef SharedPtr<TGaussSubMeshImpl> PGaussSubMeshImpl;
+
+
+  //---------------------------------------------------------------
+  typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
+  typedef std::map<EGeometry,PGaussSubMeshImpl> TGeom2GaussSubMesh;
+
+  struct TGaussMeshImpl: virtual TGaussMesh, 
+                        virtual TAppendFilter
+  {
+    TGaussMeshImpl();
+
+    virtual
+    TGaussPointID
+    GetObjID(vtkIdType theID) const;
+
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+
+    virtual 
+    TNamedIDMapper*
+    GetParent();
+
+    TSource mySource;
+    TNamedIDMapper* myParent;
+    TGaussSubMeshArr myGaussSubMeshArr;
+    TGeom2GaussSubMesh myGeom2GaussSubMesh;
+  };
+  typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
+
+
+  struct TGaussPtsIDFilter: virtual TIDMapperFilter,
+                           virtual TGaussPtsIDMapper
+  { 
+    PGaussPtsIDMapper myGaussPtsIDMapper;
+
+    virtual 
+    TGaussPointID 
+    GetObjID(vtkIdType theID) const;
+
+    virtual 
+    TNamedIDMapper*
+    GetParent();
+  };
+  typedef SharedPtr<TGaussPtsIDFilter> PGaussPtsIDFilter;
+
+
+  //---------------------------------------------------------------
+  typedef TVector<vtkIdType> TConnect;
+  typedef TVector<TConnect> TCell2Connect;
+
+  struct TSubMeshImpl: virtual TSource
+  {
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
+
+    vtkIdType myStartID;
+    TCell2Connect myCell2Connect;
+  };
+  typedef SharedPtr<TSubMeshImpl> PSubMeshImpl;
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry,PSubMeshImpl> TGeom2SubMesh;
+  typedef TVector<PSubMeshImpl> TSubMeshArr;
+
+  struct TMeshOnEntityImpl: virtual TMeshOnEntity, 
+                           virtual TAppendFilter, 
+                           virtual TSizeCounter
+  {
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
 
-  struct TMeshOnEntityImpl: TMeshOnEntity{
-    TVTKSource myStorage;
-    typedef std::vector<vtkIdType> TConnect;
-    typedef std::vector<TConnect> TConnForCellType;
-    typedef std::map<vtkIdType,TConnForCellType> TCellsConn;
-    TCellsConn myCellsConn;
+    TID2ID myElemObj2VTKID;
+    TSubMeshArr mySubMeshArr;
+    PNamedPointCoords myNamedPointCoords;
+
+    TGeom2SubMesh myGeom2SubMesh;
   };
-  typedef shared_ptr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+  typedef SharedPtr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+
+
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry,TSubMeshID> TGeom2SubMeshID;
+
+  struct TFamilyImpl: virtual TFamily, 
+                     virtual TSource
+  {
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const ;
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const ;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
 
-  struct TFamilyImpl: TFamily{
-    TVTKSource myStorage;
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
 
-    typedef std::set<vtkIdType> TSubMeshOnCellType;
-    typedef std::map<vtkIdType,TSubMeshOnCellType> TSubMesh;
-    TSubMesh mySubMesh;
+    virtual
+    TVTKOutput* 
+    GetVTKOutput();
+
+    PNamedPointCoords myNamedPointCoords;
+    TID2ID myElemObj2VTKID;
+    TSubMeshID myMeshID;
+
+    TGeom2SubMeshID myGeom2SubMeshID;
   };
-  typedef shared_ptr<TFamilyImpl> PFamilyImpl;
+  typedef SharedPtr<TFamilyImpl> PFamilyImpl;
+
+
+  //---------------------------------------------------------------
+  typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
+  typedef TVector<PFamilyImpl> TFamilyArr;
+
+  struct TGroupImpl: virtual TGroup, 
+                    virtual TAppendFilter
+  {
+    TNbASizeCells 
+    GetNbASizeCells() const;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
 
-  struct TGroupImpl: TGroup{
-    TVTKSource myStorage;
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    TID2ID myElemObj2VTKID;
+    TFamilyArr myFamilyArr;
+    PNamedPointCoords myNamedPointCoords;
   };
-  typedef shared_ptr<TGroupImpl> PGroupImpl;
+  typedef SharedPtr<TGroupImpl> PGroupImpl;
+
+
+  //---------------------------------------------------------------
+  typedef TVector<TMinMax> TMinMaxArr;
+
+  struct TFieldImpl: virtual TField
+  {
+    vtkIdType myDataSize;
 
-  struct TFieldImpl: TField{
-    TVTKExtractFilter myExtractFilter;
-    ~TFieldImpl()
-    { 
-      if(myExtractFilter.GetPointer())
-       myExtractFilter->UnRegisterAllOutputs();
-    }
+    TMinMaxArr myMinMaxArr;
+
+    virtual
+    TMinMax 
+    GetMinMax(vtkIdType theCompID);
+
+    void 
+    InitArrays(vtkIdType theNbComp);
+
+    TFieldImpl();
   };
-  typedef shared_ptr<TFieldImpl> PFieldImpl;
+  typedef SharedPtr<TFieldImpl> PFieldImpl;
+
+
+  //---------------------------------------------------------------
+  typedef TVector<float> TValue;
+  typedef TSlice<TValue> TValueSlice;
+  typedef TCSlice<TValue> TCValueSlice;
 
-  struct TValForTimeImpl: TValForTime{
-    TVTKAttribyteFilter myAttribyteFilter;
-    TVTKMergetFilter myMergeFilter;
-    TVTKSource myStorage;
+  typedef TVector<TCValueSlice> TCValueSliceArr;
+  typedef TVector<TValueSlice> TValueSliceArr;
 
-    typedef std::vector<float> TValForCellsWithType;
-    typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
-    TValForCells myValForCells;
+  struct TMeshValue
+  {
+    TValue myValue;
 
-    ~TValForTimeImpl()
-    { 
-      if(myMergeFilter.GetPointer())
-       myMergeFilter->UnRegisterAllOutputs();
-      if(myAttribyteFilter.GetPointer())
-       myAttribyteFilter->UnRegisterAllOutputs();
-    }
+    vtkIdType myNbElem;
+    vtkIdType myNbComp;
+    vtkIdType myNbGauss;
+    vtkIdType myStep;
+
+    void
+    Init(vtkIdType theNbElem,
+        vtkIdType theNbGauss,
+        vtkIdType theNbComp);
+
+    TCValueSliceArr
+    GetGaussValueSliceArr(vtkIdType theElemId) const;
+
+    TValueSliceArr 
+    GetGaussValueSliceArr(vtkIdType theElemId);
+
+    TCValueSliceArr
+    GetCompValueSliceArr(vtkIdType theElemId) const;
+
+    TValueSliceArr 
+    GetCompValueSliceArr(vtkIdType theElemId);
   };
-  typedef shared_ptr<TValForTimeImpl> PValForTimeImpl;
+  
 
+  //---------------------------------------------------------------
+  typedef std::map<EGeometry,TMeshValue> TGeom2Value;
+
+  struct TValForTimeImpl: virtual TValForTime
+  {
+    PGaussPtsIDFilter myGaussPtsIDFilter;
+    PIDMapperFilter myIDMapperFilter;
+    TGeom2Value myGeom2Value;
+    vtkIdType myNbGauss;
+   
+    TValForTimeImpl();
+
+    const TMeshValue& 
+    GetMeshValue(EGeometry theGeom) const;
+
+    TMeshValue& 
+    GetMeshValue(EGeometry theGeom);
+
+    virtual
+    int
+    GetNbGauss(EGeometry theGeom) const;
+  };
+  typedef SharedPtr<TValForTimeImpl> PValForTimeImpl;
 }
 
-class VISU_Convertor_impl: public VISU_Convertor{
+
+class VISU_Convertor_impl: public VISU_Convertor
+{
 public:
-  virtual float GetSize() ;
+  VISU_Convertor_impl();
+
+  virtual
+  ~VISU_Convertor_impl();
+
+  virtual
+  VISU_Convertor* 
+  Build() 
+  { 
+    return this;
+  }
+
+  virtual 
+  float
+  GetSize();
+
+  virtual 
+  VISU::PNamedIDMapper 
+  GetMeshOnEntity(const std::string& theMeshName, 
+                 const VISU::TEntity& theEntity);
 
   virtual 
   float 
   GetMeshOnEntitySize(const std::string& theMeshName, 
-                     const VISU::TEntity& theEntity,
-                     const std::string& theFamilyName = "");
+                      const VISU::TEntity& theEntity);
+
+  virtual 
+  VISU::PIDMapper 
+  GetFamilyOnEntity(const std::string& theMeshName, 
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName);
 
+  virtual 
+  float 
+  GetFamilyOnEntitySize(const std::string& theMeshName, 
+                       const VISU::TEntity& theEntity,
+                       const std::string& theFamilyName);
+
+  virtual 
+  VISU::PIDMapper 
+  GetMeshOnGroup(const std::string& theMeshName, 
+                const std::string& theGroupName);
+  
   virtual 
   float 
   GetMeshOnGroupSize(const std::string& theMeshName, 
                     const std::string& theGroupName);
 
+  virtual
+  VISU::PIDMapper 
+  GetTimeStampOnMesh(const std::string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const std::string& theFieldName,
+                    int theStampsNum);
+
   virtual 
   float 
   GetTimeStampSize(const std::string& theMeshName, 
@@ -123,6 +701,13 @@ public:
                   const std::string& theFieldName,
                   int theStampsNum);
 
+  virtual
+  VISU::PGaussPtsIDMapper 
+  GetTimeStampOnGaussPts(const std::string& theMeshName, 
+                        const VISU::TEntity& theEntity,
+                        const std::string& theFieldName,
+                        int theStampsNum);
+  
   virtual 
   float 
   GetFieldOnMeshSize(const std::string& theMeshName, 
@@ -142,40 +727,20 @@ public:
               const std::string& theFieldName,
               int theStampsNum);
 
-public:
-  VISU_Convertor_impl();
-
-  virtual ~VISU_Convertor_impl();
-
-  virtual VISU_Convertor* Build()  { return this;};
-
-  virtual 
-  TOutput* 
-  GetMeshOnEntity(const std::string& theMeshName, 
-                 const VISU::TEntity& theEntity,
-                 const std::string& theFamilyName = "");
-
-  virtual 
-  TOutput* 
-  GetMeshOnGroup(const std::string& theMeshName, 
-                const std::string& theGroupName);
-  
-  virtual
-  TOutput* 
-  GetTimeStampOnMesh(const std::string& theMeshName, 
-                    const VISU::TEntity& theEntity,
-                    const std::string& theFieldName,
-                    int theStampsNum);
-
 protected:
   VISU::PMeshImpl 
   FindMesh(const std::string& theMeshName);
 
-  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindMeshOnEntity;
+  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl> TFindMeshOnEntity;
   TFindMeshOnEntity
   FindMeshOnEntity(const std::string& theMeshName,
-                  const VISU::TEntity& theEntity,
-                  const std::string& theFamilyName);
+                  const VISU::TEntity& theEntity);
+
+  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindFamilyOnEntity;
+  TFindFamilyOnEntity
+  FindFamilyOnEntity(const std::string& theMeshName,
+                   const VISU::TEntity& theEntity,
+                   const std::string& theFamilyName);
 
   typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
   TFindMeshOnGroup
@@ -203,16 +768,35 @@ protected:
                int theStampsNum);
   
 protected:
-  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                              const std::string& theFamilyName = "") = 0;
+  virtual
+  int
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity) = 0;
 
-  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) = 0;
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily) = 0;
 
-  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
-                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                             VISU::PFieldImpl theField, 
-                             VISU::PValForTimeImpl theValForTime) = 0;
+  virtual 
+  int
+  LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilySet& theFamilySet) = 0;
+
+  virtual 
+  int
+  LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime) = 0;
+
+  virtual 
+  int
+  LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
+                          VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                          VISU::PFieldImpl theField, 
+                          VISU::PValForTimeImpl theValForTime) = 0;
 };
 
 #endif
diff --git a/src/CONVERTOR/VISU_IDMapper.cxx b/src/CONVERTOR/VISU_IDMapper.cxx
new file mode 100644 (file)
index 0000000..c1f07b5
--- /dev/null
@@ -0,0 +1,77 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File:
+//  Author:
+//  Module : VISU
+
+#include "VISU_IDMapper.hxx"
+
+#include <vtkUnstructuredGrid.h>
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  float*  
+  TIDMapper
+  ::GetNodeCoord(vtkIdType theObjID)
+  {
+    vtkIdType aVTKID = GetNodeVTKID(theObjID);
+    return GetVTKOutput()->GetPoint(aVTKID);
+  }
+
+  vtkIdType
+  TIDMapper
+  ::GetNodeVTKID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  vtkIdType
+  TIDMapper
+  ::GetNodeObjID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  vtkCell* 
+  TIDMapper
+  ::GetElemCell(int theObjID)
+  {
+    vtkIdType aVtkID = GetElemVTKID(theObjID);
+    return GetVTKOutput()->GetCell(aVtkID);
+  }
+
+  vtkIdType
+  TIDMapper
+  ::GetElemVTKID(vtkIdType theID) const
+  {
+    return theID;
+  }
+
+  vtkIdType
+  TIDMapper
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    return theID;
+  }  
+}
diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx
new file mode 100644 (file)
index 0000000..8bfdd23
--- /dev/null
@@ -0,0 +1,120 @@
+//  VISU CONVERTOR :
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File   : VISU_Convertor.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_IDMapper_HeaderFile
+#define VISU_IDMapper_HeaderFile
+
+#include "MED_SharedPtr.hxx"
+
+#include <vtkSystemIncludes.h>
+#include <string>
+
+class vtkUnstructuredGrid;
+class vtkCell;
+
+namespace VISU
+{
+  using MED::SharedPtr;
+
+  //---------------------------------------------------------------
+  struct TBaseStructure
+  {
+    virtual ~TBaseStructure()
+    {}
+  };
+  typedef SharedPtr<TBaseStructure> PBaseStructure;
+
+  //---------------------------------------------------------------
+  typedef vtkUnstructuredGrid TVTKOutput;
+
+  struct TIDMapper: virtual TBaseStructure
+  {
+    virtual 
+    vtkIdType 
+    GetNodeObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetNodeVTKID(vtkIdType theID) const;
+
+    virtual
+    float* 
+    GetNodeCoord(vtkIdType theObjID);
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
+
+    virtual 
+    vtkIdType 
+    GetElemVTKID(vtkIdType theID) const;
+
+    virtual
+    vtkCell* 
+    GetElemCell(vtkIdType theObjID);
+
+    virtual
+    TVTKOutput*
+    GetVTKOutput() = 0;
+  };
+  typedef SharedPtr<TIDMapper> PIDMapper;
+  
+
+  //---------------------------------------------------------------
+  struct TNamedIDMapper: virtual TIDMapper
+  {
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const = 0;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const = 0;
+  };
+  typedef SharedPtr<TNamedIDMapper> PNamedIDMapper;
+  
+
+  //---------------------------------------------------------------
+  typedef vtkIdType TCellID;
+  typedef vtkIdType TLocalPntID;
+  typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
+
+  struct TGaussPtsIDMapper: virtual TIDMapper
+  {
+    virtual 
+    TGaussPointID 
+    GetObjID(vtkIdType theID) const = 0;
+
+    virtual 
+    TNamedIDMapper*
+    GetParent() = 0;
+  };
+  typedef SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
+
+  //---------------------------------------------------------------
+}
+
+#endif
index bc9e31d189302e56234b5228f9af575c97186180..4ab71595a40871b4480d725ca88a4e83c2104bbf 100644 (file)
 
 #include "MED_Factory.hxx"
 #include "MED_Algorithm.hxx"
+#include "MED_GaussUtils.hxx"
 #include "MED_Utilities.hxx"
 
-#include <vtkCellType.h>
+#include <boost/thread/thread.hpp>
+#include <boost/bind.hpp>
 
-#define _EDF_NODE_IDS_
+#include <vtkCellType.h>
 
 using namespace std;
-using namespace MED;
 using namespace VISU;
 
+using MED::TInt;
+using MED::TFloat;
+using MED::EBooleen;
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+static int MYMEMORYDEBUG = 0;
+static int MYTHREADDEBUG = 0;
+static int MY_FAMILY_DEBUG = 0;
+static int MY_GROUP_DEBUG = 0;
+//#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
+static int MYMEMORYDEBUG = 0;
+static int MYTHREADDEBUG = 0;
+static int MY_FAMILY_DEBUG = 0;
+static int MY_GROUP_DEBUG = 0;
 #endif
 
+#define _LOAD_FAMILIES_
+#define _EDF_NODE_IDS_
 
-namespace{
-
-  using namespace MED;
-  using namespace VISU;
-  
-  int MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
+namespace
+{
+  //---------------------------------------------------------------
+  vtkIdType
+  MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
   { 
     return theMEDGeomType % 100;
   }
 
-  int MEDGeomToVTK(MED::EGeometrieElement theMEDGeomType)
-  { 
-    switch(theMEDGeomType){
-    case ePOINT1: return VTK_VERTEX;
-    case eSEG2: return VTK_LINE;
-    case eSEG3: return VTK_LINE;
-    case eTRIA3: return VTK_TRIANGLE;
-    case eTRIA6: return VTK_TRIANGLE;
-    case eQUAD4: return VTK_QUAD;
-    case eQUAD8: return VTK_QUAD;
-    case eTETRA4: return VTK_TETRA;
-    case eTETRA10: return VTK_TETRA;
-    case eHEXA8: return VTK_HEXAHEDRON;
-    case eHEXA20: return VTK_HEXAHEDRON;
-    case ePENTA6: return VTK_WEDGE;
-    case ePENTA15: return VTK_WEDGE;
-    case ePYRA5: return VTK_PYRAMID;
-    case ePYRA13: return VTK_PYRAMID;
-    case ePOLYGONE: return VTK_POLYGON;
-    case ePOLYEDRE: return VTK_CONVEX_POINT_SET;
-    }
-    return -1;
-  }
-
-  int VTKGeom2NbNodes(int theVTKGeomType)
+
+  //---------------------------------------------------------------
+  VISU::EGeometry
+  MEDGeom2VISU(MED::EGeometrieElement theGeom)
   { 
-    switch(theVTKGeomType){
-    case VTK_VERTEX: return 1;
-    case VTK_LINE: return 2;
-    case VTK_TRIANGLE: return 3;
-    case VTK_QUAD: return 4;
-    case VTK_TETRA: return 4;
-    case VTK_HEXAHEDRON: return 8;
-    case VTK_WEDGE: return 6;
-    case VTK_PYRAMID: return 5;
+    switch(theGeom){
+    case MED::ePOINT1: return VISU::ePOINT1;
+    case MED::eSEG2: return VISU::eSEG2;
+    case MED::eTRIA3: return VISU::eTRIA3;
+    case MED::eQUAD4: return VISU::eQUAD4;
+    case MED::eTETRA4: return VISU::eTETRA4;
+    case MED::eHEXA8: return VISU::eHEXA8;
+    case MED::ePENTA6: return VISU::ePENTA6;
+    case MED::ePYRA5: return VISU::ePYRA5;
+
+    case MED::eSEG3: return VISU::eSEG3;
+    case MED::eTRIA6: return VISU::eTRIA6;
+    case MED::eQUAD8: return VISU::eQUAD8;
+    case MED::eTETRA10: return VISU::eTETRA10;
+    case MED::eHEXA20: return VISU::eHEXA20;
+    case MED::ePENTA15: return VISU::ePENTA15;
+    case MED::ePYRA13: return VISU::ePYRA13;
+
+    case MED::ePOLYGONE: return VISU::ePOLYGONE;
+    case MED::ePOLYEDRE: return VISU::ePOLYEDRE;
     }
-    return -1;
+    return VISU::eNONE;
   }
 
-  MED::EGeometrieElement VTKGeomToMED(int theVTKGeomType)
+
+  //---------------------------------------------------------------
+  MED::EGeometrieElement 
+  VISUGeom2MED(int theGeom)
   { 
-    switch(theVTKGeomType){
-    case VTK_VERTEX: return ePOINT1;
-    case VTK_LINE: return eSEG2;
-    case VTK_TRIANGLE: return eTRIA3;
-    case VTK_QUAD: return eQUAD4;
-    case VTK_TETRA: return eTETRA4;
-    case VTK_HEXAHEDRON: return eHEXA8;
-    case VTK_WEDGE: return ePENTA6;
-    case VTK_PYRAMID: return ePYRA5;
-    case VTK_POLYGON: return ePOLYGONE;
-    case VTK_CONVEX_POINT_SET: return ePOLYEDRE;
-    }
-    return EGeometrieElement(-1);
-  }
-
-  TEntity MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
+    switch(theGeom){
+    case VISU::ePOINT1: return MED::ePOINT1;
+    case VISU::eSEG2: return MED::eSEG2;
+    case VISU::eTRIA3: return MED::eTRIA3;
+    case VISU::eQUAD4: return MED::eQUAD4;
+    case VISU::eTETRA4: return MED::eTETRA4;
+    case VISU::eHEXA8: return MED::eHEXA8;
+    case VISU::ePENTA6: return MED::ePENTA6;
+    case VISU::ePYRA5: return MED::ePYRA5;
+
+    case VISU::eSEG3: return MED::eSEG3;
+    case VISU::eTRIA6: return MED::eTRIA6;
+    case VISU::eQUAD8: return MED::eQUAD8;
+    case VISU::eTETRA10: return MED::eTETRA10;
+    case VISU::eHEXA20: return MED::eHEXA20;
+    case VISU::ePENTA15: return MED::ePENTA15;
+    case VISU::ePYRA13: return MED::ePYRA13;
+
+    case VISU::ePOLYGONE: return MED::ePOLYGONE;
+    case VISU::ePOLYEDRE: return MED::ePOLYEDRE;
+    }
+    return MED::EGeometrieElement(-1);
+  }
+
+
+  //---------------------------------------------------------------
+  VISU::TEntity
+  MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
   {
     switch(theMEDEntity){
-    case eNOEUD: return NODE_ENTITY;
-    case eARETE: return EDGE_ENTITY;
-    case eFACE: return FACE_ENTITY;
-    case eMAILLE: return CELL_ENTITY;
+    case MED::eNOEUD: return NODE_ENTITY;
+    case MED::eARETE: return EDGE_ENTITY;
+    case MED::eFACE: return FACE_ENTITY;
+    case MED::eMAILLE: return CELL_ENTITY;
     }
-    return TEntity(-1);
+    return VISU::TEntity(-1);
   }
 
-  MED::EEntiteMaillage VTKEntityToMED(TEntity theVTKEntity)
+
+  //---------------------------------------------------------------
+  MED::EEntiteMaillage 
+  VTKEntityToMED(TEntity theVTKEntity)
   {
     switch(theVTKEntity){
-    case NODE_ENTITY: return eNOEUD;
-    case EDGE_ENTITY: return eARETE;
-    case FACE_ENTITY: return eFACE;
-    case CELL_ENTITY: return eMAILLE;
+    case NODE_ENTITY: return MED::eNOEUD;
+    case EDGE_ENTITY: return MED::eARETE;
+    case FACE_ENTITY: return MED::eFACE;
+    case CELL_ENTITY: return MED::eMAILLE;
     }
     return MED::EEntiteMaillage(-1);
   }
 
-}
-
-extern "C"
-VISU_Convertor* CreateConvertor(const string& theFileName)
-{
-  return new VISU_MedConvertor(theFileName);
-}
-
-VISU_MedConvertor::VISU_MedConvertor(const string& theFileName)  {
-  myFileInfo.setFile(QString(theFileName.c_str()));
-  myName = myFileInfo.baseName().latin1();
-}
 
-VISU_Convertor* VISU_MedConvertor::Build()  {
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  TInt aNbMeshes = aMed->GetNbMeshes();
-  TMeshMap& aMeshMap = myMeshMap;
+  //---------------------------------------------------------------
+  PMEDSubProfile
+  CrSubProfile(const MED::PWrapper& theMEDWrapper,
+              const MED::PMeshInfo& theMeshInfo,
+              MED::EEntiteMaillage theMEntity,
+              MED::EGeometrieElement theMGeom,
+              const MED::TGeom2Size& theGeom2Size,
+              const MED::TGeom2Profile& theGeom2Profile)
+  {
+    VISU::EGeometry aEGeom = MEDGeom2VISU(theMGeom);
+    vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
+
+    PMEDSubProfile aSubProfile(new TMEDSubProfile());
+    aSubProfile->myGeom = aEGeom;
+    aSubProfile->myMGeom = theMGeom;
+    aSubProfile->myStatus = eAddAll;
+
+    MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(theMGeom);
+    if(aTimeStampIter == theGeom2Size.end())
+      aSubProfile->myStatus = eRemoveAll;
+    else{
+      MED::TGeom2Profile::const_iterator aProfileIter = theGeom2Profile.find(theMGeom);
+      if(aProfileIter != theGeom2Profile.end()){
+       MED::PProfileInfo aProfileInfo = aProfileIter->second;
+
+       aSubProfile->myName = aProfileInfo->GetName();
+       aSubProfile->myStatus = eAddPart;
+
+       const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+       TInt aNbElem = anElemNum.size();
+       aSubProfile->myNbCells = aNbElem;
+       switch(theMGeom){
+       case MED::ePOLYGONE: {
+         MED::PPolygoneInfo aPolygoneInfo = 
+           theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
+         for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+           TInt aNbConn = aPolygoneInfo->GetNbConn(anElemNum[anElemId]);
+           aSubProfile->myCellsSize += aNbConn;
+         }
+         break;
+       }
+       case MED::ePOLYEDRE: {
+         MED::PPolyedreInfo aPolyedreInfo = 
+           theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
+         for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+           MED::TCConnSliceArr aConnSliceArr = 
+             aPolyedreInfo->GetConnSliceArr(anElemNum[anElemId]);
+           TInt aNbFaces = aConnSliceArr.size();
+           TInt aCellSize = 0;
+           for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+             MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+             TInt aNbConn = aConnSlice.size();
+             aCellSize += aNbConn;
+           }
+           aSubProfile->myCellsSize += aCellSize;
+         }
+         break;
+       }
+       default: {
+         aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
+       }}
+      }else{
+       TInt aNbElem = aTimeStampIter->second;
+       aSubProfile->myNbCells = aNbElem;
+       switch(theMGeom){
+       case MED::ePOLYGONE: {
+         MED::PPolygoneInfo aPolygoneInfo = 
+           theMEDWrapper->GetPPolygoneInfo(theMeshInfo,theMEntity,theMGeom);
+         for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+           TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
+           aSubProfile->myCellsSize += aNbConn;
+         }
+         break;
+       }
+       case MED::ePOLYEDRE: {
+         MED::PPolyedreInfo aPolyedreInfo = 
+           theMEDWrapper->GetPPolyedreInfo(theMeshInfo,theMEntity,theMGeom);
+         for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+           MED::TCConnSliceArr aConnSliceArr = 
+             aPolyedreInfo->GetConnSliceArr(anElemId);
+           TInt aNbFaces = aConnSliceArr.size();
+           TInt aCellSize = 0;
+           for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+             MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+             TInt aNbConn = aConnSlice.size();
+             aCellSize += aNbConn;
+           }
+           aSubProfile->myCellsSize += aCellSize;
+         }
+         break;
+       }
+       default: {
+         aSubProfile->myCellsSize = aSubProfile->myNbCells*aVNbNodes;
+       }}
+      }
+    }
+    INITMSG(MYDEBUG,
+           "- aMGeom = "<<theMGeom<<
+           "; aEGeom = "<<aEGeom<<
+           "; aName = '"<<aSubProfile->myName<<"'"<<
+           "; aStatus = "<<aSubProfile->myStatus<<
+           "; aNbCells = "<<aSubProfile->myNbCells<<
+           "; aCellsSize = "<<aSubProfile->myCellsSize<<
+           endl);
+    
+    return aSubProfile;
+  }
 
-  MSG(MYDEBUG,"VISU_MedConvertor::Build()");
-  INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
 
-  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++)
-    try{
-    PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+  //---------------------------------------------------------------
+  TProfileKey
+  GetProfileKey(const MED::PWrapper& theMEDWrapper,
+               const MED::PMeshInfo& theMeshInfo,
+               const MED::TTimeStampVal& theTimeStampVal,
+               const VISU::TMEDMeshOnEntity& theMeshOnEntity,
+               MED::EEntiteMaillage theMEntity,
+               const MED::TGeom2Size& theGeom2Size)
+  {
+    INITMSG(MYDEBUG,"GetProfileKey"<<endl);
+    
+    TProfileKey aProfileKey;
+    const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+
+    const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
+    MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+    for(; anIter != aGeom2Size.end(); anIter++){
+      MED::EGeometrieElement aMGeom = anIter->first;
+      PSubProfile aSubProfile = CrSubProfile(theMEDWrapper,
+                                            theMeshInfo,
+                                            theMEntity,
+                                            aMGeom,
+                                            theGeom2Size,
+                                            aGeom2Profile);
+      aProfileKey.insert(aSubProfile);
+    }
+    
+    return aProfileKey;
+  }
+  
 
-    PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+  //---------------------------------------------------------------
+  void
+  InitProfile(const MED::PWrapper& theMEDWrapper,
+             const MED::PMeshInfo& theMeshInfo,
+             MED::TTimeStampVal& theTimeStampVal,
+             VISU::TMEDMeshOnEntity& theMeshOnEntity,
+             MED::EEntiteMaillage theMEntity,
+             const MED::TGeom2Size& theGeom2Size,
+             VISU::TMEDValForTime& theValForTime)
+  {
+    INITMSG(MYDEBUG,"InitProfile"<<endl);
     
-    MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+    TProfileMap& aProfileMap = theMeshOnEntity.myProfileMap;
     
-    TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
+    TProfileKey aProfileKey = GetProfileKey(theMEDWrapper,
+                                           theMeshInfo,
+                                           theTimeStampVal,
+                                           theMeshOnEntity,
+                                           theMEntity,
+                                           theGeom2Size);
+    
+    TProfileMap::const_iterator anIter = aProfileMap.find(aProfileKey);
+    if(anIter != aProfileMap.end()){
+      theValForTime.myProfile = anIter->second;
+      INITMSG(MYDEBUG,"aProfileMap.find(aProfileKey)"<<endl);
+    }else{
+      PMEDProfile aProfile(new TMEDProfile());
+      TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+      
+      TProfileKey::const_iterator anIter = aProfileKey.begin();
+      for(; anIter != aProfileKey.end(); anIter++){
+       PMEDSubProfile aSubProfile(*anIter);
+
+       if(aProfile->myIsAll && aSubProfile->myStatus != eAddAll)
+         aProfile->myIsAll = false;
+
+       VISU::EGeometry aEGeom = aSubProfile->myGeom;
+       aGeom2SubProfile[aEGeom] = aSubProfile;
+      }
 
-    TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+      aProfileMap[aProfileKey] = aProfile;
+      theValForTime.myProfile = aProfile;
+    }
+  }
 
-    TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
 
-    TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+  //---------------------------------------------------------------
+  TGaussKey
+  GetGaussKey(const MED::TTimeStampVal& theTimeStampVal,
+             const VISU::TMEDMeshOnEntity& theMeshOnEntity,
+             const MED::TGeom2Size& theGeom2Size,
+             VISU::TMEDValForTime& theValForTime)
+  {
+    INITMSG(MYDEBUG,"GetGaussKey"<<endl);
 
-    // creating TMesh structure and TMeshOnEntityMap
-    typedef map<TInt,TInt> TFamilyCounterMap;
-    TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
+    TGaussKey aGaussKey;
+    PMEDProfile aProfile = theValForTime.myProfile;
+    TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-    TInt aDim = aMeshInfo->GetDim();
-    const string& aMeshName = aMeshInfo->GetName();
-    
-    PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
-    aMesh->myDim = aDim;
-    aMesh->myName = aMeshName;
-    aMesh->myNbPoints = aNodeInfo->GetNbElem();
-    aMesh->myMeshInfo = aMeshInfo;
-    aMesh->myEntityInfo = aEntityInfo;
-
-    INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
-           "'; myNbPoints = "<<aMesh->myNbPoints<<
-           "; aDim = "<<aDim<<"\n");
+    const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+    const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+    const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
+
+    const MED::TGeom2Size& aGeom2Size = theMeshOnEntity.myGeom2Size;
+    MED::TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+    for(; anIter != aGeom2Size.end(); anIter++){
+      MED::EGeometrieElement aMGeom = anIter->first;
+      VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+
+      TGeom2SubProfile::iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+      if(anIter2 == aGeom2SubProfile.end()){
+       INITMSG(MYDEBUG,"anIter2 == aGeom2SubProfile.end!!"<<endl);
+       continue;
+      }
+      PMEDSubProfile aSubProfile = anIter2->second;
+
+      MED::TGeom2Size::const_iterator aTimeStampIter = theGeom2Size.find(aMGeom);
+      if(aTimeStampIter != theGeom2Size.end()){
+       TInt aNbCells = aTimeStampIter->second;
+
+       PMEDGaussSubMesh aGaussSubMesh(new TMEDGaussSubMesh());
+       aGaussSubMesh->mySubProfile = aSubProfile;
+       aGaussSubMesh->myStatus = aSubProfile->myStatus;
+         
+       PMEDGauss aGauss(new TMEDGauss());
+       aGaussSubMesh->myGauss = aGauss;
+       aGauss->myGeom = aEGeom;
+
+       TInt aNbGauss = 1;
+       std::string aName;
+
+       MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+       if(aGaussIter != aGeom2Gauss.end()){
+         MED::PGaussInfo aGaussInfo = aGaussIter->second;
+         aGauss->myGaussInfo = aGaussInfo;
+         aName = aGauss->myName = aGaussInfo->GetName();
+         aNbGauss = aGauss->myNbPoints = aGaussInfo->GetNbGauss();
+       }
+       
+       aGauss->myNbPoints = aNbGauss;
+       aGaussSubMesh->myNbCells = aNbCells*aNbGauss;
+       aGaussSubMesh->myCellsSize = aGaussSubMesh->myNbCells*2;
+
+       aGaussKey.insert(aGaussSubMesh);
+
+       INITMSGA(MYDEBUG,0,
+                "- aEGeom = "<<aEGeom<<
+                "; aName = '"<<aName<<"'"<<
+                "; aNbGauss = "<<aNbGauss<<
+                "; aStatus = "<<aGaussSubMesh->myStatus<<
+                "; aNbCells = "<<aGaussSubMesh->myNbCells<<
+                "; aCellsSize = "<<aGaussSubMesh->myCellsSize<<
+                endl);
+      }
+    }
+
+    return aGaussKey;
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  InitGaussMesh(MED::TTimeStampVal& theTimeStampVal,
+               VISU::TMEDMeshOnEntity& theMeshOnEntity,
+               const MED::TGeom2Size& theGeom2Size,
+               VISU::TMEDValForTime& theValForTime)
+  {
+    INITMSG(MYDEBUG,"InitGaussMesh"<<endl);
+
+    if(theMeshOnEntity.myEntity == NODE_ENTITY)
+      return;
+
+    TGaussMeshMap& aGaussMeshMap = theMeshOnEntity.myGaussMeshMap;
     
-    BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+    TGaussKey aGaussKey = GetGaussKey(theTimeStampVal,
+                                     theMeshOnEntity,
+                                     theGeom2Size,
+                                     theValForTime);
+
+    TGaussMeshMap::const_iterator anIter = aGaussMeshMap.find(aGaussKey);
+    if(anIter != aGaussMeshMap.end()){
+      theValForTime.myGaussMesh = anIter->second;
+      INITMSG(MYDEBUG,"aGaussMeshMap.find(aGaussKey)"<<endl);
+    }else{
+      PMEDGaussMesh aGaussMesh(new TMEDGaussMesh());
+      TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+      {
+       TGaussKey::const_iterator anIter = aGaussKey.begin();
+       for(; anIter != aGaussKey.end(); anIter++){
+         PMEDGaussSubMesh aGaussSubMesh(*anIter);
+         PMEDGauss aGauss = aGaussSubMesh->myGauss;
+         VISU::EGeometry aEGeom = aGauss->myGeom;
+         aGeom2GaussSubMesh[aEGeom] = aGaussSubMesh;
+       }
+      }
+      {
+       TGaussSubMeshArr& aGaussSubMeshArr = aGaussMesh->myGaussSubMeshArr;
+       aGaussSubMeshArr.resize(aGeom2GaussSubMesh.size());
+       TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
+       for(TInt anID = 0; anIter != aGeom2GaussSubMesh.end(); anIter++, anID++){
+         const PGaussSubMeshImpl& aGaussSubMesh = anIter->second;
+         aGaussSubMeshArr[anID] = aGaussSubMesh;
+       }
+      }
+      aGaussMeshMap[aGaussKey] = aGaussMesh;
+      theValForTime.myGaussMesh = aGaussMesh;
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  InitGaussProfile(const MED::PWrapper& theMEDWrapper,
+                  const MED::PMeshInfo& theMeshInfo,
+                  MED::TTimeStampVal& theTimeStampVal,
+                  VISU::TMEDMeshOnEntity& theMeshOnEntity,
+                  MED::EEntiteMaillage theMEntity,
+                  const MED::TGeom2Size& theGeom2Size,
+                  VISU::TMEDValForTime& theValForTime)
+  {
+    INITMSG(MYDEBUG,"InitGaussProfile"<<endl);
+
+    // The order of the function calls is important
+    InitProfile(theMEDWrapper,
+               theMeshInfo,
+               theTimeStampVal,
+               theMeshOnEntity,
+               theMEntity,
+               theGeom2Size,
+               theValForTime);
+
+    InitGaussMesh(theTimeStampVal,
+                 theMeshOnEntity,
+                 theGeom2Size,
+                 theValForTime);
+  }
+
 
-    TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-    MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
-    for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
-      const EEntiteMaillage& aMEntity = anEntityIter->first;
-      const MED::TGeom& aTGeom = anEntityIter->second;
+  //---------------------------------------------------------------
+  typedef std::map<TInt,TInt> TFamilyCounterMap;
 
+  void
+  BuildMeshOnEntityMap(PMEDMesh theMesh,
+                      TFamilyCounterMap& theFamilyID2CellsSize,
+                      const MED::TEntityInfo& theEntityInfo,
+                      const MED::PNodeInfo& theNodeInfo,
+                      const MED::PWrapper& theMEDWrapper)
+  {
+    INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<<endl);
+    MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+    const std::string& aMeshName = theMesh->myName;
+    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    MED::TEntityInfo::const_iterator anEntityIter = theEntityInfo.begin();
+    for(; anEntityIter != theEntityInfo.end(); anEntityIter++){
+      const MED::EEntiteMaillage& aMEntity = anEntityIter->first;
+      const MED::TGeom2Size& aGeom2Size = anEntityIter->second;
+      
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
       PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
       aMeshOnEntity->myEntity = aVEntity;
       aMeshOnEntity->myMeshName = aMeshName;
-      aMeshOnEntity->myGeom = aTGeom;
-
-      INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-
-      if(aMEntity == eNOEUD){
-       aMeshOnEntity->myNbCells = aMesh->myNbPoints;
-       aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
+      aMeshOnEntity->myGeom2Size = aGeom2Size;
+      
+      INITMSG(MYDEBUG,
+             "- aMEntity = "<<aMEntity<<
+             "; aVEntity = "<<aVEntity<<
+             endl);
+      
+      if(aMEntity == MED::eNOEUD){
+       aMeshOnEntity->myNbCells = theMesh->myNbPoints;
+       aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
        
-       for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
-         TInt aFamId = aNodeInfo->GetFamNum(iElem);
-         if(aFamId != 0){
-           aFamilyNbCellsCounterMap[aFamId] += 1;
-           aFamilyCellsSizeCounterMap[aFamId] += 2;
-         }
+       for(TInt iElem = 0; iElem < theMesh->myNbPoints; iElem++){
+         TInt aFamId = theNodeInfo->GetFamNum(iElem);
+         if(aFamId != 0)
+           theFamilyID2CellsSize[aFamId] += 2;
        }
-
-       INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
-               "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
-
+       
+       INITMSG(MYDEBUG,
+               "- myNbCells = "<<aMeshOnEntity->myNbCells<<
+               "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
+               endl);;
+       
       }else{
-       MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
+       MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
        aMeshOnEntity->myNbCells = 0;
        aMeshOnEntity->myCellsSize = 0;
-       for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
-         const EGeometrieElement& aGeom = anTGeomIter->first;
-
-         switch(aGeom){
-         case ePOLYGONE:
-           {
-             PPolygoneInfo aPolygoneInfo = aMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
-             TInt aNbElem = aPolygoneInfo->GetNbElem();
-             TElemNum aConn  = aPolygoneInfo->GetConnectivite();
-             TElemNum aIndex = aPolygoneInfo->GetIndex();
-             TInt aNbIndex = aIndex.size();
-             TInt aNbConn  = aConn.size();
-
-             aMeshOnEntity->myNbCells += aNbElem;
-             
-             for (int ii = 0; ii<aNbElem ; ii++){
-               int aNbConnii = aPolygoneInfo->GetNbConn(ii);
-               aMeshOnEntity->myCellsSize += aNbConnii;
-             }
-             INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
-                     "; myNbPolygones = "<<aNbElem<<
-                     "; nbConn= "<<aNbConn<<"\n");
-             
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               TInt aFamId = aPolygoneInfo->GetFamNum(iElem);
-               if(aFamId != 0){
-                 aFamilyNbCellsCounterMap[aFamId] += 1;
-                 ADDMSG(MYDEBUG,"aFamId="<<aFamId<<" ");
-                 aFamilyCellsSizeCounterMap[aFamId] += aPolygoneInfo->GetNbConn(iElem) + 1;
-               }
-             }
-             ADDMSG(MYDEBUG,endl);
-             break;
-           }
-         case ePOLYEDRE:
-           {
-             PPolyedreInfo aPolyedreInfo = aMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
-             TInt aNbElem = aPolyedreInfo->GetNbElem();
-             TElemNum aConn  = aPolyedreInfo->GetConnectivite();
-             TElemNum aIndex = aPolyedreInfo->GetIndex();
-             TInt aNbIndex = aIndex.size();
-             TInt aNbConn  = aConn.size();
-
-             aMeshOnEntity->myNbCells += aNbElem;
-             
-             for (int ii = 0; ii<aNbElem ; ii++){
-               int aNbConnii = aPolyedreInfo->GetNbConn(ii);
-               aMeshOnEntity->myCellsSize += aNbConnii;
-             }
-             INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
-                     "; myNbPolyedres = "<<aNbElem<<
-                     "; nbConn= "<<aNbConn<<"\n");
-             
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               TInt aFamId = aPolyedreInfo->GetFamNum(iElem);
-               std::string aName = aPolyedreInfo->GetElemName(iElem);
-               if(aFamId != 0){
-                 aFamilyNbCellsCounterMap[aFamId] += 1;
-                 ADDMSG(MYDEBUG,"(aFamId="<<aFamId<<";Name='"<<aName<<"') ");
-                 aFamilyCellsSizeCounterMap[aFamId] += aPolyedreInfo->GetNbConn(iElem) + 1;
-               }
-             }
-             ADDMSG(MYDEBUG,endl);
-             break;
+       for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+         const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+         
+         switch(aMGeom){
+         case MED::ePOLYGONE: {
+           MED::PPolygoneInfo aPolygoneInfo = theMEDWrapper->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+           TInt aNbElem = aPolygoneInfo->GetNbElem();
+           
+           INITMSG(MYDEBUG,
+                   "- aMGeom = "<<aMGeom<<
+                   "; aNbElem = "<<aNbElem<<
+                   endl);
+           
+           aMeshOnEntity->myNbCells += aNbElem;      
+           for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+             TInt aNbConn = aPolygoneInfo->GetNbConn(anElemId);
+             aMeshOnEntity->myCellsSize += aNbConn;
+             TInt aFamId = aPolygoneInfo->GetFamNum(anElemId);
+             if(aFamId != 0)
+               theFamilyID2CellsSize[aFamId] += aNbConn + 1;
            }
-         default:
-           {
-             int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
-             PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
-             TInt aNbElem = aCellInfo->GetNbElem();
-             aMeshOnEntity->myNbCells += aNbElem;
-             aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
-             INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
-                     "; myNbCells = "<<aMeshOnEntity->myNbCells<<
-                     "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");
-             
-             for(TInt iElem = 0; iElem < aNbElem; iElem++){
-               TInt aFamId = aCellInfo->GetFamNum(iElem);
-               if(aFamId != 0){
-                 aFamilyNbCellsCounterMap[aFamId] += 1;
-                 ADDMSG(MYDEBUG,"aFamId = "<<aFamId<<" ");
-                 aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
-               }
+           break;
+         }
+         case MED::ePOLYEDRE: {
+           MED::PPolyedreInfo aPolyedreInfo = theMEDWrapper->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+           TInt aNbElem = aPolyedreInfo->GetNbElem();
+           
+           INITMSG(MYDEBUG,
+                   "- aMGeom = "<<aMGeom<<
+                   "; aNbElem = "<<aNbElem<<
+                   endl);
+           
+           aMeshOnEntity->myNbCells += aNbElem;
+           for(TInt anElemId = 0; anElemId < aNbElem ; anElemId++){
+             MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(anElemId);
+             TInt aNbFaces = aConnSliceArr.size();
+             TInt aCellSize = 0;
+             for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+               MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+               TInt aNbConn = aConnSlice.size();
+               aCellSize += aNbConn;
              }
-             ADDMSG(MYDEBUG,endl);
+             aMeshOnEntity->myCellsSize += aCellSize;
+             TInt aFamId = aPolyedreInfo->GetFamNum(anElemId);
+             if(aFamId != 0)
+               theFamilyID2CellsSize[aFamId] += aCellSize + 1;
            }
-         } // end switch(...)
+           break;
+         }
+         default: {
+           VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+           vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
+           MED::PCellInfo aCellInfo = theMEDWrapper->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+           TInt aNbElem = aCellInfo->GetNbElem();
+           aMeshOnEntity->myNbCells += aNbElem;
+           aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
+           
+           INITMSG(MYDEBUG,
+                   "- aMGeom = "<<aMGeom<<
+                   "; aNbElem = "<<aNbElem<<
+                   "; myNbCells = "<<aMeshOnEntity->myNbCells<<
+                   "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<
+                   endl);
+           
+           for(TInt iElem = 0; iElem < aNbElem; iElem++){
+             TInt aFamId = aCellInfo->GetFamNum(iElem);
+             if(aFamId != 0)
+               theFamilyID2CellsSize[aFamId] += aVNbNodes + 1;
+           }
+         }} // end switch(...)
        }
       }
     }
-    
-    TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
-    BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
-    for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
-      const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
-      const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
+  }
 
-      TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
-      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-      
-      if(aFamilyGroup.empty())
-       continue;
 
-      INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
-      TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
-      for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
-       const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
-       if (aFamilyInfo->GetId() == 0) 
-         continue;
+  //---------------------------------------------------------------
+  struct TFieldMinMax
+  {
+    VISU::PMEDField myField;
+    MED::PFieldInfo myFieldInfo;
+    TInt myNbTimeStamps;
+    MED::EEntiteMaillage myMEntity;
+    MED::TGeom2Size myGeom2Size;
+    MED::TMKey2Profile myMKey2Profile;
+    MED::TKey2Gauss myKey2Gauss;
+    MED::PWrapper myMEDWrapper;
+
+    TFieldMinMax(const VISU::PMEDField& theField,
+                const MED::PFieldInfo& theFieldInfo,
+                TInt theNbTimeStamps,
+                MED::EEntiteMaillage theMEntity,
+                const MED::TGeom2Size& theGeom2Size,
+                const MED::TMKey2Profile& theMKey2Profile,
+                const MED::TKey2Gauss& theKey2Gauss,
+                const MED::PWrapper& theMEDWrapper):
+      myField(theField),
+      myFieldInfo(theFieldInfo),
+      myNbTimeStamps(theNbTimeStamps),
+      myMEntity(theMEntity),
+      myGeom2Size(theGeom2Size),
+      myMKey2Profile(theMKey2Profile),
+      myKey2Gauss(theKey2Gauss),
+      myMEDWrapper(theMEDWrapper)
+    {
+      INITMSG(MYMEMORYDEBUG,"TFieldMinMax() - "<<this<<endl);
+    }
 
-       const std::string& aFamilyName = aFamilyInfo->GetName();
-       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+    ~TFieldMinMax()
+    {
+      INITMSG(MYMEMORYDEBUG,"~TFieldMinMax() - "<<this<<endl);
+    }
+
+    void
+    Calculate()
+    {
+      INITMSG(MYTHREADDEBUG,"TFieldMinMax::Calculate() - "<<this<<
+             "; aFieldName = '"<<myField->myName<<"'"<<
+             "; myNbTimeStamps = "<<myNbTimeStamps<<
+             endl);
+      
+      TInt aNbComp = myField->myNbComp;
+      int aNbComp2 = aNbComp;
+      if(aNbComp == 2 || aNbComp == 4)
+       aNbComp2 = 2;
+      else if(aNbComp > 4)
+       aNbComp2 = 3;
+
+      TValField& aValField = myField->myValField;
+      TMinMaxArr& aMinMaxArr = myField->myMinMaxArr;
+      for(TInt iTimeStamp = 1; iTimeStamp <= myNbTimeStamps; iTimeStamp++){
+       INITMSG(MYTHREADDEBUG,"- "<<this<<"; iTimeStamp = "<<iTimeStamp<<endl);
        
-       aFamily->myId = aFamilyInfo->GetId();
-       aFamily->myName = aFamilyInfo->GetName();
-       aFamily->myEntity = aVEntity;
-       aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
-       aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
+       MED::PTimeStampInfo aTimeStampInfo = myMEDWrapper->GetPTimeStampInfo(myFieldInfo,
+                                                                            myMEntity,
+                                                                            myGeom2Size,
+                                                                            iTimeStamp);
+       MED::PTimeStampVal aTimeStampVal = myMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
+                                                                         myMKey2Profile,
+                                                                         myKey2Gauss);
+       PMEDValForTime aValForTime = aValField[iTimeStamp];
        
-       INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
-               "'; myId = "<<aFamily->myId<<"; "<<
-               "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
-               "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
-               "; myEntity = "<<aFamily->myEntity<<
-               "; myNbCells = "<<aFamily->myNbCells<<
-               "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
+       const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
+       
+       PMEDProfile aProfile = aValForTime->myProfile;
+       TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+       TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+       for(; anIter != aGeom2SubProfile.end(); anIter++){
+         VISU::EGeometry aEGeom = anIter->first;
+         PMEDSubProfile aSubProfile(anIter->second);
+         
+         TInt aNbElem = aSubProfile->myNbCells;
+         TInt aNbGauss = aValForTime->GetNbGauss(aEGeom);
+         
+         if(aSubProfile->myStatus != eRemoveAll){
+           INITMSG(MYTHREADDEBUG,
+                   "- "<<this<< 
+                   "; aEGeom = "<<aEGeom<<
+                   "; aNbElem = "<<aNbElem<<
+                   "; aNbGauss = "<<aNbGauss<<
+                   endl);
+           
+           MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+           const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
+
+           // To calculate min/max per components
+           for(TInt iElem = 0; iElem < aNbElem; iElem++){
+             MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetCompValueSliceArr(iElem);
+             for(TInt iComp = 0; iComp < aNbComp; iComp++){
+               const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iComp];
+               TMinMax& aMinMax = aMinMaxArr[iComp+1];
+               float& aMin = aMinMax.first;
+               float& aMax = aMinMax.second;
+               for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+                 const float& aVal = aMValueSlice[iGauss];
+                 aMin = min(aMin,aVal);
+                 aMax = max(aMax,aVal);
+               }
+             }
+           }
 
-       VISU::TBindGroups& aBindGroups = aFamily->myGroups;
-       const TInt aNbGroup = aFamilyInfo->GetNbGroup();
-       for(TInt i = 0; i < aNbGroup; i++){
-         const string& aGroupName = aFamilyInfo->GetGroupName(i);
-         aBindGroups.insert(aGroupName);
-         INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+           // To calculate min/max per vector modulus
+           TMinMax& aMinMax = aMinMaxArr[0];
+           float& aMin = aMinMax.first;
+           float& aMax = aMinMax.second;
+           for(TInt iElem = 0; iElem < aNbElem; iElem++){
+             MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+             for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+               const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+               float aValue = 0.0;
+               for(TInt iComp = 0; iComp < aNbComp2; iComp++){
+                 float aVal = aMValueSlice[iComp];
+                 aValue += aVal*aVal;
+               }
+               aValue = sqrt(aValue);
+               aMin = min(aMin,aValue);
+               aMax = max(aMax,aValue);
+             }
+           }
+         }
        }
       }
+      for(TInt iComp = 0; iComp <= aNbComp; iComp++){
+       VISU::TMinMax aMinMax = myField->GetMinMax(iComp);
+       INITMSG(MYTHREADDEBUG,"- "<<this<<"; "<<iComp<<": "<<aMinMax.first<<"; "<<aMinMax.second<<endl);
+      }
     }
-    
-    BEGMSG(MYDEBUG,"VISU::TGroup:\n");
+  };
+  typedef SharedPtr<TFieldMinMax> PFieldMinMax;
 
-    VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
-    TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
-    for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
-      const string& aGroupName = aGroupInfoIter->first;
-      const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
-      PMEDGroup aGroup(new TMEDGroup());
-      aGroup->myName = aGroupName;
-      aGroup->myMeshName = aMesh->myName;
 
-      INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
+  //---------------------------------------------------------------
+  void
+  GetFieldMinMax(PFieldMinMax theFieldMinMax)
+  {
+    theFieldMinMax->Calculate();
+  }
 
-      TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
-      for(; aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
-       const PFamilyInfo& aFamilyInfo = *aFamilyIter;
-       const string& aFamilyName = aFamilyInfo->GetName();
 
-       TEntity aVEntity = TEntity(-1);
-       PFamily aFamily;
+  //---------------------------------------------------------------
+  struct TCalculateMinMax
+  {
+    VISU::PMEDMesh myMesh;
+    MED::TEntityInfo myEntityInfo;
+    MED::TMKey2Profile myMKey2Profile;
+    MED::TKey2Gauss myKey2Gauss;
+    MED::PWrapper myMEDWrapper;
+
+    TCalculateMinMax(const VISU::PMEDMesh& theMesh,
+                    const MED::TEntityInfo& theEntityInfo,
+                    const MED::TMKey2Profile& theMKey2Profile,
+                    const MED::TKey2Gauss& theKey2Gauss,
+                    const MED::PWrapper& theMEDWrapper):
+      myMesh(theMesh),
+      myEntityInfo(theEntityInfo),
+      myMKey2Profile(theMKey2Profile),
+      myKey2Gauss(theKey2Gauss),
+      myMEDWrapper(theMEDWrapper)
+    {
+      INITMSG(MYMEMORYDEBUG,"TCalculateMinMax() - "<<this<<endl);
+    }
 
-       // Find aVisuEntity
-       const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-       TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
-       for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
-         const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
-         const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
-         TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-         for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
-           const string& aName = aFamilyMapIter->first;
-           aFamily = aFamilyMapIter->second;
-           if(aName == aFamilyName){
-             aVEntity = aFamily->myEntity;
-             goto exit_lable;
-           }
-         }
-       }
-      exit_lable:
-       if(aFamily && aVEntity >= 0){
-         aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
-         INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; '"<<aFamily->myName<<"'; aVEntity = "<<aVEntity<<"\n");
-         
-         aGroup->myNbCells += aFamily->myNbCells;
-         aGroup->myCellsSize += aFamily->myCellsSize;
-       }
-      }
-      if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
-       BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
-              "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
-       aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
+    ~TCalculateMinMax()
+    {
+      INITMSG(MYMEMORYDEBUG,"~TCalculateMinMax() - "<<this<<endl);
+    }
+
+    void
+    Calculate()
+    {
+      TInt aNbFields = myMEDWrapper->GetNbFields(); 
+      MED::PMeshInfo aMeshInfo = myMesh->myMeshInfo;
+      const std::string& aMeshName = myMesh->myName;
+      INITMSG(MYDEBUG,"MinMaxCalculation: aNbFields = "<<aNbFields<<"\n");
+      for(TInt iField = 1; iField <= aNbFields; iField++){
+       MED::PFieldInfo aFieldInfo = myMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
+       TInt aNbComp = aFieldInfo->GetNbComp();
+       std::string aFieldName = aFieldInfo->GetName();
+       
+       MED::TGeom2Size aGeom2Size;
+       MED::EEntiteMaillage aMEntity;
+       TInt aNbTimeStamps = myMEDWrapper->GetNbTimeStamps(aFieldInfo,
+                                                           myEntityInfo,
+                                                           aMEntity,
+                                                           aGeom2Size);
+       if(aNbTimeStamps < 1)
+         continue;
+       
+       TEntity aVEntity = MEDEntityToVTK(aMEntity);
+       PMEDMeshOnEntity aMeshOnEntity = myMesh->myMeshOnEntityMap[aVEntity];
+       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+       PMEDField aField = aFieldMap[aFieldName];
+       
+       PFieldMinMax aFieldMinMax(new TFieldMinMax(aField,
+                                                  aFieldInfo,
+                                                  aNbTimeStamps,
+                                                  aMEntity,
+                                                  aGeom2Size,
+                                                  myMKey2Profile,
+                                                  myKey2Gauss,
+                                                  myMEDWrapper));
+       
+       boost::thread aThread(boost::bind(&GetFieldMinMax,aFieldMinMax));
       }
     }
-    
-    TInt aNbFields = aMed->GetNbFields(); 
-    BEGMSG(MYDEBUG,"VISU::TField: NbFields="<<aNbFields<<"\n");
+  };
+  typedef SharedPtr<TCalculateMinMax> PCalculateMinMax;
+
+
+  //---------------------------------------------------------------
+  void
+  CalculateMinMax(PCalculateMinMax theCalculateMinMax)
+  {
+    theCalculateMinMax->Calculate();
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  BuildFieldMap(PMEDMesh theMesh,
+               const MED::TEntityInfo& theEntityInfo,
+               const MED::TMKey2Profile& theMKey2Profile,
+               const MED::TKey2Gauss& theKey2Gauss,
+               MED::PWrapper theMEDWrapper)
+  {
+    TInt aNbFields = theMEDWrapper->GetNbFields(); 
+    MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+    const std::string& aMeshName = theMesh->myName;
+    INITMSG(MYDEBUG,"BuildFieldMap: aNbFields = "<<aNbFields<<"\n");
     for(TInt iField = 1; iField <= aNbFields; iField++){
-      PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+      MED::PFieldInfo aFieldInfo = theMEDWrapper->GetPFieldInfo(aMeshInfo,iField);
       TInt aNbComp = aFieldInfo->GetNbComp();
-      const string& aFieldName = aFieldInfo->GetName();
-
-      MED::TGeom aTGeom;
-      EEntiteMaillage aMEntity;
-      TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
-      if (aNbTimeStamps<1)
-       continue;
+      std::string aFieldName = aFieldInfo->GetName();
+      
+      MED::TGeom2Size aGeom2Size;
+      MED::EEntiteMaillage aMEntity;
+      TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo,
+                                                         theEntityInfo,
+                                                         aMEntity,
+                                                         aGeom2Size);
+      if(aNbTimeStamps < 1)
+       continue;
+      
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
       PMEDField aField = aFieldMap[aFieldName](new TMEDField());
       aField->myId = iField;
-      aField->myNbComp = aNbComp;
+      aField->InitArrays(aNbComp);
       aField->myEntity = aVEntity;
       aField->myName = aFieldName;
       aField->myMeshName = aMeshName;
       aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
-      aField->myCompNames.resize(aNbComp);
-      aField->myUnitNames.resize(aNbComp);
-
-      INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
-             "'; myId = "<<aField->myId<<
+      
+      INITMSG(MYDEBUG,"myName = '"<<aField->myName<<"'"<<
+             "; myId = "<<aField->myId<<
              "; myEntity = "<<aField->myEntity<<
              "; myDataSize = "<<aField->myDataSize<<
              "; myNbComp = "<<aField->myNbComp<<"\n");
-
+      
       for(TInt iComp = 0; iComp < aNbComp; iComp++){
        aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
        aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
       }
-
+      
       for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
-       PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
-                                                           aMEntity,
-                                                           aTGeom,
-                                                           iTimeStamp);
-       TFloat aDt = aTimeStamp->GetDt();
-       const string& anUnitDt = aTimeStamp->GetUnitDt();
-       PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
+       MED::PTimeStampInfo aTimeStampInfo = theMEDWrapper->GetPTimeStampInfo(aFieldInfo,
+                                                                             aMEntity,
+                                                                             aGeom2Size,
+                                                                             iTimeStamp);
+       TFloat aDt = aTimeStampInfo->GetDt();
+       std::string anUnitDt = aTimeStampInfo->GetUnitDt();
+       MED::PTimeStampVal aTimeStampVal = theMEDWrapper->GetPTimeStampVal(aTimeStampInfo,
+                                                                          theMKey2Profile,
+                                                                          theKey2Gauss);
        TValField& aValField = aField->myValField;
        PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
        aValForTime->myId = iTimeStamp;
        aValForTime->myFieldName = aField->myName;
        aValForTime->myEntity = aField->myEntity;
        aValForTime->myMeshName = aField->myMeshName;
-       aValForTime->myNbComp = aField->myNbComp;
+       aValForTime->myNbGauss = aTimeStampInfo->GetNbGauss();
        aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
-       INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
+       INITMSG(MYDEBUG,"aDt = '"<<aDt<<", "<<anUnitDt<<"'\n");
+       
+       InitGaussProfile(theMEDWrapper,
+                        aMeshInfo,
+                        aTimeStampVal,
+                        aMeshOnEntity,
+                        aMEntity,
+                        aGeom2Size,
+                        aValForTime);
       }
     }
-  } catch (std::runtime_error& exc){
-    MSG(MYDEBUG,"Follow exception wqs occured in:\n"<<exc.what());
-  } catch(...){
-    EXCEPTION(runtime_error,"Unknown exception !!!");
   }
 
-  return this; 
-}
 
-int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                                       const string& theFamilyName)
-{
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  const string& aMeshName = theMeshOnEntity->myMeshName;
-  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
-  PMeshImpl aMesh = myMeshMap[aMeshName];
-  int isPointsUpdated;
-  if(anEntity == VISU::NODE_ENTITY) 
-    isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName);
-  else
-    isPointsUpdated = LoadPoints(aMed,aMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,aMesh,theMeshOnEntity,theFamilyName);
+  //---------------------------------------------------------------
+  void
+  BuildFamilyMap(PMEDMesh theMesh,
+                const TFamilyCounterMap& theFamilyID2CellsSize,
+                const MED::TEntityInfo& theEntityInfo,
+                const MED::TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
+                const MED::TFamilyInfoSet& theFamilyInfoSet,
+                MED::PWrapper theMEDWrapper)
+  {
+    INITMSG(MYDEBUG,"BuildFamilyMap\n");
+    MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo;
+    MED::TEntity2FamilySet aEntity2FamilySet = MED::GetEntity2FamilySet(theMEDWrapper,theEntity2TGeom2ElemInfo,theFamilyInfoSet);
+    MED::TEntity2FamilySet::const_iterator aEntity2FamilySetIter = aEntity2FamilySet.begin();
+    for(; aEntity2FamilySetIter != aEntity2FamilySet.end(); aEntity2FamilySetIter++){
+      const MED::EEntiteMaillage& aMEntity = aEntity2FamilySetIter->first;
+      const MED::TFamilyTSizeSet& aFamilyTSizeSet = aEntity2FamilySetIter->second;
+      
+      TEntity aVEntity = MEDEntityToVTK(aMEntity);
+      PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+      TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+       
+      if(aFamilyTSizeSet.empty())
+       continue;
+       
+      INITMSG(MY_FAMILY_DEBUG,
+             "- aMEntity = "<<aMEntity<<
+             "; aVEntity = "<<aVEntity<<
+             endl);
+
+      MED::TFamilyTSizeSet::const_iterator aFamilyTSizeSetIter = aFamilyTSizeSet.begin();
+      for(; aFamilyTSizeSetIter != aFamilyTSizeSet.end(); aFamilyTSizeSetIter++){
+       const MED::TFamilyTSize& aFamilyTSize = *aFamilyTSizeSetIter;
+       const MED::PFamilyInfo& aFamilyInfo = boost::get<0>(aFamilyTSize);
+       TInt aSize = boost::get<1>(aFamilyTSize);
+       TInt anId = aFamilyInfo->GetId();
+       if(anId == 0) 
+         continue;
+       
+       std::string aFamilyName = aFamilyInfo->GetName();
 
-  return (isPointsUpdated || isCellsOnEntityUpdated);
-}
+       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
+       aFamily->myId = anId;
+       aFamily->myEntity = aVEntity;
+       aFamily->myName = aFamilyName;
+       aFamily->myNbCells = aSize;
 
-int VISU_MedConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
-                                      const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
-{
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
-  VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-  for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-    const string& aFamilyName = aFamilyAndEntitySetIter->first;
-    const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
-    const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
-    if(anEntity == VISU::NODE_ENTITY){
-      isPointsUpdated += LoadPoints(aMed,theMesh,aFamilyName);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,aMeshOnEntity);
-    }else{
-      isPointsUpdated += LoadPoints(aMed,theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,aMeshOnEntity,aFamilyName);
+       aFamily->myCellsSize = 0;
+       TFamilyCounterMap::const_iterator anIter = theFamilyID2CellsSize.find(anId);
+       if(anIter != theFamilyID2CellsSize.end())
+         aFamily->myCellsSize = anIter->second;
+       
+       INITMSG(MY_FAMILY_DEBUG,
+               "- aFamilyName = '"<<aFamilyName<<"'"<<
+               "; myId = "<<aFamily->myId<<"; "<<
+               "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
+               "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+               "; aVEntity = "<<aVEntity<<
+               "; myNbCells = "<<aFamily->myNbCells<<
+               "; myCellsSize = "<<aFamily->myCellsSize<<
+               endl);
+#ifdef _DEBUG_ 
+       const TInt aNbGroup = aFamilyInfo->GetNbGroup();
+       for(TInt i = 0; i < aNbGroup; i++){
+         std::string aGroupName = aFamilyInfo->GetGroupName(i);
+         INITMSG(MY_FAMILY_DEBUG,"- aGroupName = '"<<aGroupName<<"'\n");
+       }
+#endif
+
+      }
     }
   }
 
-  return (isPointsUpdated || isCellsOnEntityUpdated);
-}
-
-int VISU_MedConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
-                                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                                      VISU::PFieldImpl theField, 
-                                      VISU::PValForTimeImpl theValForTime)
-{
-  PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  int isPointsUpdated = LoadPoints(aMed,theMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
-  int isFieldUpdated = LoadField(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
-  
-  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
-}
-
 
-int 
-VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
-                             VISU::PMEDMesh theMesh, 
-                             const string& theFamilyName) 
-{
-  try{
-    //Check on existing family
-    VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
-    aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
-    aMeshOnEntity->myMeshName = theMesh->myName;
-    PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
-    //Check on loading already done
-    bool isPointsLoaded = !theMesh->myPointsCoord.empty();
-    if(isPointsLoaded) 
-      if(!aFamily) 
-       return 0;
-      else if(!aFamily->mySubMesh.empty()) 
-       return 0;
+  //---------------------------------------------------------------
+  void
+  BuildGroupMap(PMEDMesh theMesh,
+               const MED::TFamilyInfoSet& theFamilyInfoSet)
+  {
+    INITMSG(MYDEBUG,"BuildGroupMap:\n");
+    TGroupMap& aGroupMap = theMesh->myGroupMap;
+    MED::TGroupInfo aGroupInfo = MED::GetGroupInfo(theFamilyInfoSet);
+    MED::TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
+    for(; aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
+      const std::string& aGroupName = aGroupInfoIter->first;
+      INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<<aGroupName<<"'\n");
 
-    INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
+      PMEDGroup aGroup(new TMEDGroup());
+      TFamilySet& aFamilySet = aGroup->myFamilySet;
 
-    //Main part of code
-    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
-    TInt aNbElem = aNodeInfo->GetNbElem();
+      const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second;
+      MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin();
+      for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){
+       const MED::PFamilyInfo& aFamilyInfo = *aFamilyIter;
+       std::string aFamilyName = aFamilyInfo->GetName();
+       
+       TEntity aVEntity = TEntity(-1);
+       PMEDFamily aFamily;
+       
+       // Find aVisuEntity
+       const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+       TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+       for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
+         const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+         const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+         TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+         for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+           const std::string& aName = aFamilyMapIter->first;
+           aFamily = aFamilyMapIter->second;
+           if(aName == aFamilyName){
+             aVEntity = aFamily->myEntity;
+             goto exit_lable;
+           }
+         }
+       } 
+      exit_lable:
+       if(aFamily && aVEntity >= 0){
+         aFamilySet.insert(aFamily);
+         INITMSG(MY_GROUP_DEBUG,
+                 "- aFamilyName = '"<<aFamilyName<<"'"<<
+                 "; aVEntity = "<<aVEntity<<
+                 "\n");
+       }
+      }
+      if(!aFamilySet.empty())
+       aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  TMEDNamedPointCoords
+  ::Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const MED::PNodeInfo& theNodeInfo)
+  {
+    if(theNodeInfo->IsElemNum())
+      TNamedPointCoords::Init(theNbPoints,theDim,theNodeInfo->myElemNum);
+    else
+      TNamedPointCoords::Init(theNbPoints,theDim);
+    if(theNodeInfo->IsElemNames())
+      myNodeInfo = theNodeInfo;
+  }
 
-    if(!isPointsLoaded){
-      VISU::TMeshImpl::TPointsDim&  aPointsDim = theMesh->myPointsDim;
-      aPointsDim.resize(theMesh->myDim);
-      for(int iDim = 0; iDim < theMesh->myDim; iDim++)
-       aPointsDim[iDim] = aNodeInfo->GetCoordName(iDim);
+  std::string 
+  TMEDNamedPointCoords
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    if(myNodeInfo)
+      return myNodeInfo->GetElemName(theObjID);
+    return TNamedPointCoords::GetNodeName(theObjID);
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  TMEDSubProfile
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    if(myIsElemNum)
+      return myElemNum[theID];
+    else
+      return theID;
+  }
+  
+
+  //---------------------------------------------------------------
+  TGaussPointID
+  TMEDGaussSubMesh
+  ::GetObjID(vtkIdType theID) const
+  {
+    TInt aNbPoints = myGauss->myNbPoints;
+    TCellID aCellID = theID / aNbPoints;
+    if(myIsElemNum)
+      aCellID = myElemNum[aCellID];
+
+    TLocalPntID aLocalPntID = theID % aNbPoints;
+
+    return TGaussPointID(aCellID,aLocalPntID);
+  }
+  
+
+  //---------------------------------------------------------------
+  void
+  TMEDSubMesh
+  ::Init(const MED::PElemInfo& theElemInfo)
+  {
+    myIsElemNum = theElemInfo->IsElemNum();
+    myElemNum = theElemInfo->myElemNum;
+    if(theElemInfo->IsElemNames())
+      myElemInfo = theElemInfo;
+  }
+
+  vtkIdType
+  TMEDSubMesh
+  ::GetElemObjID(vtkIdType theID) const
+  {
+    if(myIsElemNum)
+      return myElemNum[theID];
+    else
+      return TSubMeshImpl::GetElemObjID(theID);
+  }
+
+  std::string 
+  TMEDSubMesh
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    if(myElemInfo)
+      return myElemInfo->GetElemName(theObjID);
+    return TSubMeshImpl::GetElemName(theObjID);
+  }
+}
+
+
+//---------------------------------------------------------------
+extern "C"
+VISU_Convertor* 
+CreateConvertor(const string& theFileName)
+{
+  return new VISU_MedConvertor(theFileName);
+}
+
+VISU_MedConvertor
+::VISU_MedConvertor(const string& theFileName)
+{
+  myFileInfo.setFile(QString(theFileName.c_str()));
+  myName = myFileInfo.baseName().latin1();
+}
+
+
+//---------------------------------------------------------------
+VISU_Convertor* 
+VISU_MedConvertor
+::Build()
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+  MED::TKey2Gauss aKey2Gauss = MED::GetKey2Gauss(aMed);
+  MED::TMKey2Profile aMKey2Profile = MED::GetMKey2Profile(aMed);
+
+  TInt aNbMeshes = aMed->GetNbMeshes();
+  TMeshMap& aMeshMap = myMeshMap;
+
+  MSG(MYDEBUG,"VISU_MedConvertor::Build()");
+  INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
+
+  for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+#ifndef _DEXCEPT_
+    try{
+#endif
+      MED::PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
       
-      VISU::TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
-      aPointsCoord.resize(aNbElem*theMesh->myDim);
-      for (int iElem = 0; iElem < aNbElem; iElem++) 
-       for(int iDim = 0, iElem2Dim = iElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iElem2Dim++)
-         aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
+      MED::PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
       
-      VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
-      aConnForCellType.resize(aNbElem);
-      for (int iElem = 0; iElem < aNbElem; iElem++)
-       aConnForCellType[iElem] = VISU::TMeshOnEntityImpl::TConnect(1,iElem);
+      MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+      
+      MED::TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo = 
+       MED::GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,aEntityInfo);
+      
+      // creating TMesh structure and TMeshOnEntityMap     
+      TInt aDim = aMeshInfo->GetDim();
+      std::string aMeshName = aMeshInfo->GetName();
+      
+      PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+      aMesh->myDim = aDim;
+      aMesh->myName = aMeshName;
+      aMesh->myNbPoints = aNodeInfo->GetNbElem();
+      aMesh->myMeshInfo = aMeshInfo;
+      aMesh->myEntityInfo = aEntityInfo;
+      aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
+
+      INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+             "'; myNbPoints = "<<aMesh->myNbPoints<<
+             "; aDim = "<<aDim<<"\n");
+      
+#ifndef _DEXCEPT_
+      try{
+#endif
+       BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+       TFamilyCounterMap aFamilyID2CellsSize;
+       
+       BuildMeshOnEntityMap(aMesh,
+                            aFamilyID2CellsSize,
+                            aEntityInfo,
+                            aNodeInfo,
+                            aMed);
+       
+       BuildFieldMap(aMesh,
+                     aEntityInfo,
+                     aMKey2Profile,
+                     aKey2Gauss,
+                     aMed);
+
+#ifdef _LOAD_FAMILIES_
+       MED::TFamilyInfoSet aFamilyInfoSet = MED::GetFamilyInfoSet(aMed,aMeshInfo);
+       
+       BuildFamilyMap(aMesh,
+                      aFamilyID2CellsSize,
+                      aEntityInfo,
+                      anEntity2TGeom2ElemInfo,
+                      aFamilyInfoSet,
+                      aMed);
+       
+       BuildGroupMap(aMesh,
+                     aFamilyInfoSet);
+#endif
+
+       PCalculateMinMax aCalculateMinMax(new TCalculateMinMax(aMesh,
+                                                              aEntityInfo,
+                                                              aMKey2Profile,
+                                                              aKey2Gauss,
+                                                              aMed));
+       
+       boost::thread aThread(boost::bind(&CalculateMinMax,aCalculateMinMax));
+#ifndef _DEXCEPT_
+      }catch(std::exception& exc){
+       MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+      }catch(...){
+       EXCEPTION(runtime_error,"Unknown exception !!!");
+      }
+#endif
+
+#ifndef _DEXCEPT_
+    }catch(std::exception& exc){
+      MSG(MYDEBUG,"Follow exception was occured in:\n"<<exc.what());
+    }catch(...){
+      EXCEPTION(runtime_error,"Unknown exception !!!");
     }
-    if(aFamily && aNbElem > 0){
-      VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
-      for (int iElem = 0; iElem < aNbElem; iElem++) 
-       if(aNodeInfo->GetFamNum(iElem) == aFamily->myId)
-         aSubMeshOnCellType.insert(iElem);
+#endif
+  } 
+
+  return this; 
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_MedConvertor
+::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity)
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  const TEntity& anEntity = theMeshOnEntity->myEntity;
+
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  if(anEntity == NODE_ENTITY){
+    isPointsUpdated += LoadPoints(aMed,theMesh);
+  }else{
+    isPointsUpdated += LoadPoints(aMed,theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_MedConvertor
+::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily)
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  const TEntity& anEntity = theMeshOnEntity->myEntity;
+
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  if(anEntity == NODE_ENTITY){
+    isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,theFamily);
+  }else{
+    isPointsUpdated += LoadPoints(aMed,theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,theMeshOnEntity,theFamily);
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_MedConvertor
+::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilySet& theFamilySet)
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
+  for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
+    PMEDFamily aFamily = *aFamilyIter;
+    const TEntity& anEntity = aFamily->myEntity;
+    const PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+    if(anEntity == NODE_ENTITY){
+      isPointsUpdated += LoadPointsOnFamily(aMed,theMesh,aFamily);
+    }else{
+      isPointsUpdated += LoadPoints(aMed,theMesh);
+      isCellsOnEntityUpdated += LoadCellsOnFamily(aMed,theMesh,aMeshOnEntity,aFamily);
     }
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_MedConvertor
+::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime)
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+  const TEntity& anEntity = theMeshOnEntity->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);
+  
+  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
+}
+
+
+//---------------------------------------------------------------
+int
+VISU_MedConvertor
+::LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
+                          VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                          VISU::PFieldImpl theField, 
+                          VISU::PValForTimeImpl theValForTime)
+{
+  MED::PWrapper aMed = MED::CrWrapper(myFileInfo.absFilePath().latin1());
+
+  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  if(anEntity != NODE_ENTITY)
+    isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
+  int isFieldUpdated = LoadValForTimeOnGaussPts(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
+  
+  return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadPoints(const MED::PWrapper& theMed,
+            VISU::PMEDMesh theMesh) 
+{
+  try{
+    //Check on existing family
+    PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+    aMeshOnEntity->myMeshName = theMesh->myName;
+    aMeshOnEntity->myEntity = NODE_ENTITY;
+
+    INITMSG(MYDEBUG,"LoadPoints - theMesh->myIsDone = "<<theMesh->myIsDone<<"'\n");
+
+    //Check on loading already done
+    if(theMesh->myIsDone)
+      return 0;
+
+    //Main part of code
+    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+    TInt aNbElem = aNodeInfo->GetNbElem();
+    TInt aDim = theMesh->myDim;
+
+    PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+    TMEDNamedPointCoords& aCoords = aNamedPointCoords;
+    aCoords.Init(aNbElem,aDim,aNodeInfo);
+    
+    for(int iDim = 0; iDim < aDim; iDim++)
+      aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
+    
+    for(int iElem = 0; iElem < aNbElem; iElem++){
+      TCoordSlice aVCoordSlice = aCoords.GetCoordSlice(iElem);
+      MED::TCCoordSlice aMCoordSlice = aNodeInfo->GetCoordSlice(iElem);
+      for(int iDim = 0; iDim < aDim; iDim++)
+       aVCoordSlice[iDim] = aMCoordSlice[iDim];
+    }
+    
+    TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+    PMEDSubMesh aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TMEDSubMesh());
+
+    aSubMesh->Init(aNodeInfo); 
+    aSubMesh->myNbCells = theMesh->myNbPoints;
+    aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
+
+    TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+    aCell2Connect.resize(aNbElem);
+    for (int iElem = 0; iElem < aNbElem; iElem++)
+      aCell2Connect[iElem] = VISU::TConnect(1,iElem);
+    
+    theMesh->myIsDone = true;
+    
     return 1;
-  }catch(std::runtime_error& exc){
-    theMesh->myPointsCoord.clear();
+
+  }catch(std::exception& exc){
     throw;
   }catch(...){
-    theMesh->myPointsCoord.clear();
     EXCEPTION(runtime_error,"Unknown exception !!!");
   }
+
   return 0;
 }
 
 
+//---------------------------------------------------------------
 int 
-VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed, 
-                                    VISU::PMEDMesh theMesh,
-                                    VISU::PMEDMeshOnEntity theMeshOnEntity,
-                                    const string& theFamilyName)
+VISU_MedConvertor
+::LoadPointsOnFamily(const MED::PWrapper& theMed,
+                    const VISU::PMEDMesh theMesh, 
+                    const VISU::PMEDFamily theFamily) 
 {
   try{
-    //Check on existing family
-    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
-    //Check on loading already done
-    bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
-    if(isCellsLoaded)
-      if(!aFamily) 
-       return 0;
-      else if(!aFamily->mySubMesh.empty()) 
-       return 0;
+    if(theFamily->myIsDone) 
+      return 0;
 
-    INITMSG(MYDEBUG,"LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'\n");
-    BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily)<<endl);
+    //Main part of code
+    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
+    TInt aNbElem = aNodeInfo->GetNbElem();
+
+    if(aNbElem > 0){
+      TInt anId = theFamily->myId;
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+      for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+       if(aNodeInfo->GetFamNum(iElem) == anId)
+         aSubMeshID.push_back(iElem);
+    }
 
-    const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
-    const EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+    theFamily->myIsDone = true;
 
-    const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
-    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
+    return 1;
+
+  }catch(std::exception& exc){
+    throw;
+  }catch(...){
+    EXCEPTION(runtime_error,"Unknown exception !!!");
+  }
+
+  return 0;
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadCellsOnEntity(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity)
+{
+#ifndef _DEXCEPT_
+  try{
+#endif
+    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+
+    INITMSG(MYDEBUG,"LoadCellsOnEntity - aVEntity = "<<aVEntity<<"\n");
+
+    if(theMeshOnEntity->myIsDone)
+      return 0;
+
+    const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
     TInt aNbPoints = aNodeInfo->GetNbElem();
 
     std::map<TInt,TInt> aNodeIdMap;
 #ifdef _EDF_NODE_IDS_
-    EBooleen anIsNodeNum = eFAUX;
+    EBooleen anIsNodeNum = MED::eFAUX;
 #else
     EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
     if(anIsNodeNum){
@@ -633,235 +1504,672 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
     }
 #endif
 
-    const MED::TGeom& aTGeom = theMeshOnEntity->myGeom;
-    MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
-    TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
-
-    for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
-      const EGeometrieElement& aGeom = anTGeomIter->first;
-      int aVTKGeomType = MEDGeomToVTK(aGeom);
-      ADDMSG(MYDEBUG,"LoadCellsOnEntity aGeom="<<aGeom<<"\n");
-      switch(aGeom){
-      case ePOLYGONE:
-       {
-         PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aGeom);
-         TInt aNbElem = aPolygoneInfo->GetNbElem();
+    const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
+    MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+    TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+
+    for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+      const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+      VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+      INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+      switch(aMGeom){
+      case MED::ePOLYGONE: {
+       MED::PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+       TInt aNbElem = aPolygoneInfo->GetNbElem();
+       if(aNbElem > 0){
+         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
          
-         if(!isCellsLoaded){
-           VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolygoneType = aCellsConn[aVTKGeomType];
-           aConnForPolygoneType.resize(aNbElem);
-           
-           int aMNbNodes = aPolygoneInfo->GetConnDim();
-           
-           vector<TInt> aConnect(aMNbNodes);
-           vector<TInt> aIndex = aPolygoneInfo->GetIndex();
-
-           for (int iElem = 0; iElem < aNbElem; iElem++) {
-             VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolygoneType[iElem];
-             int aNbConn = aPolygoneInfo->GetNbConn(iElem);
-
-             anArray.resize(aNbConn);
-             
-             aConnect = aPolygoneInfo->GetConnectivite();
-             
-             for (int i=0;i<aNbConn;i++){
-               anArray[i] = aConnect[aIndex[iElem]-1+i]-1;
-             }
-           }
-         }
-         if(aFamily){
-           VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
-           for(int iElem = 0; iElem < aNbElem; iElem++) 
-             if(aPolygoneInfo->GetFamNum(iElem) == aFamily->myId)
-               aSubMeshOnCellType.insert(iElem);
+         aSubMesh->Init(aPolygoneInfo); 
+         aSubMesh->myNbCells = aNbElem;      
+
+         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         aCell2Connect.resize(aNbElem);
+         
+         for(TInt iElem = 0; iElem < aNbElem; iElem++) {
+           MED::TCConnSlice aConnSlice = aPolygoneInfo->GetConnSlice(iElem);
+           TInt aNbConn = aPolygoneInfo->GetNbConn(iElem);
+           aSubMesh->myCellsSize += aNbConn;
+           TConnect& anArray = aCell2Connect[iElem];
+           anArray.resize(aNbConn);
+           for(TInt iConn = 0; iConn < aNbConn; iConn++)
+             anArray[iConn] = aConnSlice[iConn] - 1;
          }
-         break;
        }
-      case ePOLYEDRE:
-       {
-         PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aGeom);
-         TInt aNbElem = aPolyedreInfo->GetNbElem();
-
-         int aMNbNodes = aPolyedreInfo->GetNbConn();
-         vector<TInt> aConnect(aMNbNodes);
-         aConnect = aPolyedreInfo->GetConnectivite();
+       break;
+      }
+      case MED::ePOLYEDRE: {
+       MED::PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+       TInt aNbElem = aPolyedreInfo->GetNbElem();
+       
+       if(aNbElem > 0){
+         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
          
-         if(!isCellsLoaded){
-           VISU::TMeshOnEntityImpl::TConnForCellType& aConnForPolyedreType = aCellsConn[aVTKGeomType];
-           aConnForPolyedreType.resize(aNbElem);
-           
-           vector<TInt> aFacesIndex = aPolyedreInfo->GetFacesIndex();
-           vector<TInt> aIndex = aPolyedreInfo->GetIndex();
-
-           for (int iElem = 0; iElem < aNbElem; iElem++) {
-             set<TInt> aArrayNew;
-             VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForPolyedreType[iElem];
-             
-             int aInd1 = aIndex[iElem]-1;  
-             int aInd2 = aIndex[iElem+1]-2;
-             
-             for (int i=aInd1;i<=aInd2;i++){
-               for (int j=aFacesIndex[i]-1;j<aFacesIndex[i+1]-1;j++){
-                 aArrayNew.insert(aConnect[j]);
-               }
-             }
-
-             int aNbConnNew = aArrayNew.size();
-             anArray.resize(aNbConnNew);
-             set<TInt>::iterator aIter = aArrayNew.begin();
-             for (int i=0; aIter!=aArrayNew.end();aIter++, i++)
-               anArray[i] = (*aIter)-1;
+         aSubMesh->Init(aPolyedreInfo); 
+         aSubMesh->myNbCells = aNbElem;      
 
+         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         aCell2Connect.resize(aNbElem);
+         
+         for(TInt iElem = 0; iElem < aNbElem; iElem++){
+           MED::TCConnSliceArr aConnSliceArr = aPolyedreInfo->GetConnSliceArr(iElem);
+           TConnect& anArray = aCell2Connect[iElem];
+           typedef std::set<TInt> TConnectSet;
+           TConnectSet aConnectSet;
+           TInt aNbFaces = aConnSliceArr.size();
+           for(TInt iFace = 0; iFace < aNbFaces; iFace++){
+             MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
+             TInt aNbConn = aConnSlice.size();
+             aSubMesh->myCellsSize += aNbConn;
+             for(TInt iConn = 0; iConn < aNbConn; iConn++){
+               aConnectSet.insert(aConnSlice[iConn]);
+             }
+           }
+         
+           int aNbConn = aConnectSet.size();
+           anArray.resize(aNbConn);
+           TConnectSet::iterator anIter = aConnectSet.begin();
+           for(int i = 0; anIter != aConnectSet.end(); anIter++, i++){
+             TInt anId = *anIter;
+             anArray[i] = anId - 1;
            }
          }
-         if(aFamily){
-           VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
-           for(int iElem = 0; iElem < aNbElem; iElem++) 
-             if(aPolyedreInfo->GetFamNum(iElem) == aFamily->myId)
-               aSubMeshOnCellType.insert(iElem);
-         }
-         break;
        }
-      default:
-       {
-         int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
-         
-         PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
-         TInt aNbElem = aCellInfo->GetNbElem();
+
+       break;
+      }
+      default: {
+       vtkIdType aVNbNodes = VISUGeom2NbNodes(aEGeom);
+       
+       MED::PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+       TInt aNbElem = aCellInfo->GetNbElem();
+       
+       if(aNbElem > 0){
+         PMEDSubMesh aSubMesh = aGeom2SubMesh[aEGeom](new TMEDSubMesh());
          
-         if(!isCellsLoaded){
-           VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
-           aConnForCellType.resize(aNbElem);
+         aSubMesh->Init(aCellInfo); 
+         aSubMesh->myNbCells = aNbElem;      
+         aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
+
+         TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+         aCell2Connect.resize(aNbElem);
+       
+         TInt aMNbNodes = MEDGeom2NbNodes(aMGeom);
+         TVector<TInt> aConnect(aMNbNodes);
+       
+         for(TInt iElem = 0; iElem < aNbElem; iElem++) {
+           MED::TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
+           TConnect& anArray = aCell2Connect[iElem];
+           anArray.resize(aVNbNodes);
            
-           int aMNbNodes = MEDGeom2NbNodes(aGeom);
-           vector<TInt> aConnect(aMNbNodes);
-         
-           for (int iElem = 0; iElem < aNbElem; iElem++) {
-             VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
-             anArray.resize(aVNbNodes);
-             
-             if(anIsNodeNum){
-               for(int i = 0; i < aMNbNodes; i++){
-                 aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
-               }
-             }else{
-               for(int i = 0; i < aMNbNodes; i++){
-                 aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
-               }
+           if(anIsNodeNum){
+             for(TInt iConn = 0; iConn < aMNbNodes; iConn++){
+               aConnect[iConn] = aNodeIdMap[aConnSlice[iConn] - 1];
              }
-             
-             switch(aGeom){
-             case eTETRA4:
-             case eTETRA10:
-               anArray[0] = aConnect[0];
-               anArray[1] = aConnect[1];
-               anArray[2] = aConnect[3];  
-               anArray[3] = aConnect[2];  
-               break;
-             case ePYRA5:
-             case ePYRA13:
-               anArray[0] = aConnect[0];
-               anArray[1] = aConnect[3];  
-               anArray[2] = aConnect[2];
-               anArray[3] = aConnect[1];  
-               anArray[4] = aConnect[4];
-               break;
-             default:
-               for(int iNode = 0; iNode < aVNbNodes; iNode++) 
-                 anArray[iNode] = aConnect[iNode];
+           }else{
+             for(int iConn = 0; iConn < aMNbNodes; iConn++){
+               aConnect[iConn] = aConnSlice[iConn] - 1;
              }
+           }
+           
+           switch(aMGeom){
+#if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+           case MED::eSEG3:
+             anArray[0] = aConnect[0];
+             anArray[2] = aConnect[1];  
+
+             anArray[1] = aConnect[2];
+             break;
+#endif
+#if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+           case MED::eTRIA6:
+             anArray[0] = aConnect[0];
+             anArray[2] = aConnect[1];  
+             anArray[4] = aConnect[2];  
+
+             anArray[1] = aConnect[3];
+             anArray[3] = aConnect[4];  
+             anArray[5] = aConnect[5];  
+             break;
+#endif
+#if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+           case MED::eQUAD8:
+             anArray[0] = aConnect[0];
+             anArray[2] = aConnect[1];  
+             anArray[4] = aConnect[2];  
+             anArray[6] = aConnect[3];  
+
+             anArray[1] = aConnect[4];
+             anArray[3] = aConnect[5];  
+             anArray[5] = aConnect[6];  
+             anArray[7] = aConnect[7];  
+             break;
+#endif
+#if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+           case MED::eTETRA10:
+#endif
+           case MED::eTETRA4:
+             anArray[0] = aConnect[0];
+             anArray[1] = aConnect[1];
+             anArray[2] = aConnect[3];  
+             anArray[3] = aConnect[2];  
+             break;
+#if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+           case MED::ePYRA13:
+#endif
+           case MED::ePYRA5:
+             anArray[0] = aConnect[0];
+             anArray[1] = aConnect[3];  
+             anArray[2] = aConnect[2];
+             anArray[3] = aConnect[1];  
+             anArray[4] = aConnect[4];
+             break;
+           default:
              for(int iNode = 0; iNode < aVNbNodes; iNode++) 
-               if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
-                 EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
-                           "<= anArray["<<iElem<<"]"<<
-                           "["<<iNode<<"]"<<
-                           "("<<anArray[iNode]<<") < 0");
+               anArray[iNode] = aConnect[iNode];
            }
+           for(int iNode = 0; iNode < aVNbNodes; iNode++) 
+             if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+               EXCEPTION(runtime_error,"LoadCellsOnEntity - "<<
+                         " aNbPoints("<<aNbPoints<<") "<<
+                         "<= anArray["<<iElem<<"]"<<
+                         "["<<iNode<<"]"<<
+                         "("<<anArray[iNode]<<") < 0");
          }
-         //Filling aFamily SubMesh
-         if(aFamily){
-           VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
-           for(int iElem = 0; iElem < aNbElem; iElem++) 
-             if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
-               aSubMeshOnCellType.insert(iElem);
+       }
+      }}
+    }
+
+    theMeshOnEntity->myIsDone = true;
+
+    return 1;
+
+#ifndef _DEXCEPT_
+  }catch(std::exception& exc){
+    throw;
+  }catch(...){
+    EXCEPTION(runtime_error,"Unknown exception !!!");
+  }
+#endif
+
+  return 0;
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadCellsOnFamily(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity,
+                   const VISU::PMEDFamily theFamily)
+{
+#ifndef _DEXCEPT_
+  try{
+#endif
+    const TEntity& aVEntity = theMeshOnEntity->myEntity;
+    const MED::EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+
+    INITMSG(MYDEBUG,"LoadCellsOnFamily - aVEntity = "<<aVEntity<<"\n");
+
+    if(theFamily->myIsDone)
+      return 0;
+
+    TInt anId = theFamily->myId;
+
+    const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    TGeom2SubMeshID& aGeom2SubMeshID = theFamily->myGeom2SubMeshID;
+
+    const MED::TGeom2Size& aGeom2Size = theMeshOnEntity->myGeom2Size;
+    MED::TGeom2Size::const_iterator aGeom2SizeIter = aGeom2Size.begin();
+    for(; aGeom2SizeIter != aGeom2Size.end(); aGeom2SizeIter++){
+      const MED::EGeometrieElement& aMGeom = aGeom2SizeIter->first;
+      MED::PElemInfo anElemInfo;
+      switch(aMGeom){
+      case MED::ePOLYGONE: {
+       anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+       break;
+      }
+      case MED::ePOLYEDRE: {
+       anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+       break;
+      }
+      default: {
+       anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+       break;
+      }}
+      if(anElemInfo){
+       if(TInt aNbElem = anElemInfo->GetNbElem()){
+         TSubMeshID aSubMeshID;
+         for(TInt iElem = 0; iElem < aNbElem; iElem++) 
+           if(anElemInfo->GetFamNum(iElem) == anId)
+             aSubMeshID.push_back(iElem);
+         if(!aSubMeshID.empty()){
+           VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+           INITMSG(MYDEBUG,"aMGeom = "<<aMGeom<<"\n");
+           aGeom2SubMeshID.insert(TGeom2SubMeshID::value_type(aEGeom,aSubMeshID));
          }
        }
       }
     }
+
+    theFamily->myIsDone = true;
+
     return 1;
-  }catch(std::runtime_error& exc){
-    theMeshOnEntity->myCellsConn.clear();
+
+#ifndef _DEXCEPT_
+  }catch(std::exception& exc){
     throw;
   }catch(...){
-    theMeshOnEntity->myCellsConn.clear();
     EXCEPTION(runtime_error,"Unknown exception !!!");
   }
+#endif
+
   return 0;
 }
 
 
+//---------------------------------------------------------------
+void
+LoadProfile(const MED::PWrapper& theMed,
+           VISU::PMEDMesh theMesh,
+           MED::TTimeStampVal& theTimeStampVal,
+           VISU::TMEDValForTime& theValForTime,
+           VISU::TMEDMeshOnEntity& theMeshOnEntity)
+{
+  INITMSG(MYDEBUG,"LoadProfile"<<endl);
+
+  PMEDProfile aProfile = theValForTime.myProfile;
+  if(aProfile->myIsDone)
+    return;
+
+  const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+  const MED::TGeom2Profile& aGeom2Profile = theTimeStampVal.GetGeom2Profile();
+  MED::TGeom2Profile::const_iterator anIter = aGeom2Profile.begin();
+  for(; anIter != aGeom2Profile.end(); anIter++){
+    MED::PProfileInfo aProfileInfo = anIter->second;
+    MED::EGeometrieElement aMGeom = anIter->first;
+    VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+
+    TGeom2SubProfile::const_iterator anIter2 = aGeom2SubProfile.find(aEGeom);
+    if(anIter2 != aGeom2SubProfile.end()){
+      PMEDSubProfile aSubProfile = anIter2->second;
+
+      MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+      if(!anElemNum.empty()){
+       TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+       TInt aSize = anElemNum.size();
+       aSubMeshID.resize(aSize);
+       for(TInt anId = 0; anId < aSize; anId++)
+         aSubMeshID[anId] = anElemNum[anId] - 1;
+      }
+
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aNbCells = "<<aSubProfile->mySubMeshID.size()<<
+             endl);
+    }
+  }
+  {
+    const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    
+    TEntity aVEntity = theMeshOnEntity.myEntity;
+    MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
+    
+    const TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
+    TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+    for(; anIter != aGeom2SubProfile.end(); anIter++){
+      const PMEDSubProfile& aSubProfile = anIter->second;
+      MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+      MED::PElemInfo anElemInfo;
+      if(aMEntity == MED::eNOEUD)
+       anElemInfo = theMed->GetPNodeInfo(aMeshInfo);
+      else{
+       switch(aMGeom){
+       case MED::ePOLYGONE: {
+         anElemInfo = theMed->GetPPolygoneInfo(aMeshInfo,aMEntity,aMGeom);
+         break;
+       }
+       case MED::ePOLYEDRE: {
+         anElemInfo = theMed->GetPPolyedreInfo(aMeshInfo,aMEntity,aMGeom);
+         break;
+       }
+       default: {
+         anElemInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aMGeom);
+         break;
+       }}
+      }
+      aSubProfile->myIsElemNum = anElemInfo->IsElemNum();
+      aSubProfile->myElemNum = anElemInfo->myElemNum;
+    }
+  }
+
+  aProfile->myIsDone = true;
+}
+
+
+//---------------------------------------------------------------
+void
+LoadGaussMesh(const MED::PWrapper& theMed,
+             VISU::PMEDMesh theMesh,
+             MED::TTimeStampVal& theTimeStampVal,
+             VISU::TMEDValForTime& theValForTime,
+             VISU::TMEDMeshOnEntity& theMeshOnEntity)
+{
+  INITMSG(MYDEBUG,"LoadGaussMesh"<<endl);
+
+  PMEDGaussMesh aGaussMesh = theValForTime.myGaussMesh;
+  if(!aGaussMesh || aGaussMesh->myIsDone)
+    return;
+
+  const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+  MED::PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
+
+  TEntity aVEntity = theMeshOnEntity.myEntity;
+  MED::EEntiteMaillage aMEntity = VTKEntityToMED(aVEntity);
+
+  const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh;
+  const MED::TTimeStampInfo& aTimeStampInfo = theTimeStampVal.GetTimeStampInfo();
+  const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.GetGeom2Gauss();
+
+  TGeom2GaussSubMesh::const_iterator aSubMeshIter = aGeom2GaussSubMesh.begin();
+  for(; aSubMeshIter != aGeom2GaussSubMesh.end(); aSubMeshIter++){
+    PMEDGaussSubMesh aGaussSubMesh = aSubMeshIter->second;
+    VISU::EGeometry aEGeom = aSubMeshIter->first;
+    
+    if(aGaussSubMesh->myIsDone)
+      continue;
+
+    PMEDSubProfile aSubProfile = aGaussSubMesh->mySubProfile;
+    const TSubMeshID& aSubMeshID = aSubProfile->mySubMeshID;
+    MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+
+    MED::PPolygoneInfo aPolygoneInfo;
+    MED::PPolyedreInfo aPolyedreInfo;
+    MED::PCellInfo aCellInfo;
+    MED::PElemInfo anElemInfo;
+
+    switch(aMGeom){
+    case MED::ePOLYGONE: 
+      aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,
+                                              aMEntity,
+                                              aMGeom);
+      anElemInfo = aPolygoneInfo;
+      break;
+    case MED::ePOLYEDRE: 
+      aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,
+                                              aMEntity,
+                                              aMGeom);
+      anElemInfo = aPolyedreInfo;
+      break;
+    default:
+      aCellInfo = theMed->GetPCellInfo(aMeshInfo,
+                                      aMEntity, 
+                                      aMGeom);
+      anElemInfo = aCellInfo;
+    }
+    aGaussSubMesh->myIsElemNum = anElemInfo->IsElemNum();
+    aGaussSubMesh->myElemNum = anElemInfo->myElemNum;
+
+    std::string aName;
+    MED::TGaussCoord aGaussCoord;
+    bool anIsGaussCoord3D = false;
+
+    MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aMGeom);
+    if(aGaussIter != aGeom2Gauss.end()){
+      PMEDGauss aGauss = aGaussSubMesh->myGauss;
+      MED::PGaussInfo aGaussInfo = aGauss->myGaussInfo;
+      if(aGaussInfo){
+       aName = aGaussInfo->GetName();
+       if(!aSubMeshID.empty()){
+         const std::string& aProfileName = aSubProfile->myName;
+         MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
+                                                              aProfileName);
+         if(aProfileInfo){
+           const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+           anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
+                                                   aCellInfo,
+                                                   aNodeInfo,
+                                                   aGaussCoord,
+                                                   anElemNum);
+         }
+       }else
+         anIsGaussCoord3D = MED::GetGaussCoord3D(aGaussInfo,
+                                                 aCellInfo,
+                                                 aNodeInfo,
+                                                 aGaussCoord);
+      }
+    }else{
+      if(!aSubMeshID.empty()){
+       const std::string& aProfileName = aSubProfile->myName;
+       MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed,
+                                                            aProfileName);
+       if(aProfileInfo){
+         const MED::TElemNum& anElemNum = aProfileInfo->myElemNum;
+         switch(aMGeom){
+         case MED::ePOLYGONE: 
+           anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
+                                                 aNodeInfo,
+                                                 aGaussCoord,
+                                                 anElemNum);
+           break;
+         case MED::ePOLYEDRE: 
+           anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
+                                                 aNodeInfo,
+                                                 aGaussCoord,
+                                                 anElemNum);
+           break;
+         default:
+           anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
+                                                 aNodeInfo,
+                                                 aGaussCoord,
+                                                 anElemNum);
+         }
+       }
+      }else
+       switch(aMGeom){
+       case MED::ePOLYGONE: 
+         anIsGaussCoord3D = MED::GetBaryCenter(aPolygoneInfo,
+                                               aNodeInfo,
+                                               aGaussCoord);
+         break;
+       case MED::ePOLYEDRE: 
+         anIsGaussCoord3D = MED::GetBaryCenter(aPolyedreInfo,
+                                               aNodeInfo,
+                                               aGaussCoord);
+         break;
+       default:
+         anIsGaussCoord3D = MED::GetBaryCenter(aCellInfo,
+                                               aNodeInfo,
+                                               aGaussCoord);
+       }
+    }
+    
+    if(anIsGaussCoord3D){
+      TPointCoords& aCoords = aGaussSubMesh->myPointCoords;
+      TInt aNbGauss = aGaussCoord.GetNbGauss();
+      TInt aNbElem = aGaussCoord.GetNbElem();
+      TInt aDim = aGaussCoord.GetDim();
+      vtkIdType aNbCells = aNbElem*aNbGauss;
+      aCoords.Init(aNbCells,aDim);
+      for(TInt anElemId = 0, aNodeId = 0; anElemId < aNbElem; anElemId++){
+       MED::TCoordSliceArr aCoordSliceArr = aGaussCoord.GetCoordSliceArr(anElemId);
+       for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++, aNodeId++){
+         MED::TCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
+         TCoordSlice aSlice = aCoords.GetCoordSlice(aNodeId);
+         for(TInt aDimId = 0; aDimId < aDim; aDimId++)
+           aSlice[aDimId] = aCoordSlice[aDimId];
+       }
+      }
+      
+      aGaussSubMesh->myIsDone = true;;
+      
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aName = '"<<aName<<"'"<<
+             "; aStatus = "<<aGaussSubMesh->myStatus<<
+             "; aNbCells = "<<aNbCells<<
+             endl);
+    }
+  }
+  
+  aGaussMesh->myIsDone = true;
+}
+
+
+//---------------------------------------------------------------
 int 
-VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
-                            VISU::PMEDMesh theMesh,
-                            VISU::PMEDMeshOnEntity theMeshOnEntity,
-                            VISU::PMEDField theField, 
-                            VISU::PMEDValForTime theValForTime)
+LoadValForTime(const MED::PWrapper& theMed,
+              VISU::PMEDMesh theMesh,
+              VISU::PMEDMeshOnEntity theMeshOnEntity,
+              VISU::PMEDField theField, 
+              VISU::PMEDValForTime theValForTime,
+              bool theIsGauss,
+              bool& theIsDone)
 {
+  INITMSG(MYDEBUG,"LoadValForTime - theIsGauss = "<<theIsGauss<<endl);
+
   //Check on loading already done
-  if(!theValForTime->myValForCells.empty()) return 0;
+  if(theIsDone) 
+    return 0;
 
   //Main part of code
   const std::string& aMeshName = theMeshOnEntity->myMeshName;
-  const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
-  PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField->myId);
-
-  MED::TGeom aTGeom;
-  EEntiteMaillage aMEntity;
-  theMed->GetNbTimeStamps(aFieldInfo,theMesh->myEntityInfo,aMEntity,aTGeom);
+  const MED::PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+  MED::PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,
+                                                    theField->myId);
+
+  MED::TGeom2Size aGeom2Size;
+  MED::EEntiteMaillage aMEntity;
+  theMed->GetNbTimeStamps(aFieldInfo,
+                         theMesh->myEntityInfo,
+                         aMEntity,
+                         aGeom2Size);
+
+  MED::PTimeStampInfo aTimeStampInfo = 
+    theMed->GetPTimeStampInfo(aFieldInfo,
+                             aMEntity,
+                             aGeom2Size,
+                             theValForTime->myId);
+
+  MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
+  MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
+
+  MED::PTimeStampVal aTimeStampVal = 
+    theMed->GetPTimeStampVal(aTimeStampInfo,
+                            aMKey2Profile,
+                            aKey2Gauss);
+
+  LoadProfile(theMed,
+             theMesh,
+             aTimeStampVal,
+             theValForTime,
+             theMeshOnEntity);
+  
+  if(theIsGauss)
+    LoadGaussMesh(theMed,
+                 theMesh,
+                 aTimeStampVal,
+                 theValForTime,
+                 theMeshOnEntity);
+  
+  PMEDProfile aProfile = theValForTime->myProfile;
+  TGeom2SubProfile& aGeom2SubProfile = aProfile->myGeom2SubProfile;
 
-  PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
-                                                           aMEntity,
-                                                           aTGeom,
-                                                           theValForTime->myId);
-  TInt aNbGauss = aTimeStampInfo->GetNbGauss();
+  const MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->GetGeom2Gauss();
   TInt aNbComp = theField->myNbComp;
 
-  PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
-  bool anIsTrimmed = theField->myIsTrimmed;
-  INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
-         "'; aFieldName = '"<<aFieldInfo->GetName()<<
-         "'; aMEntity = "<<aMEntity<<
-         "; anId = "<<theValForTime->myId<<endl);
-  BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
-        "; aNbGauss = "<<aNbGauss<<endl);
-
-  const MED::TGeom& anEntityTGeom = theMeshOnEntity->myGeom;
-  MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
-  for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
-    const EGeometrieElement& aGeom = aTGeomIter->first;
-    const TInt& aNbElem = aTGeomIter->second;
-
-    INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
-
-    if(aTGeom.find(aGeom) == aTGeom.end()){
-      if(!theField->myIsTrimmed){
-       theField->myDataSize -= aNbElem*theField->myNbComp;
-       anIsTrimmed = true;
-      }
-    }else{
-      int aVTKGeomType = MEDGeomToVTK(aGeom);
-      VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
-      anArray.resize(aNbComp*aNbElem);
-      for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
-       for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
-         for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
-           anArray[anId] += aTimeStampVal->GetVal(aGeom,iElem,iComp,iGauss);
+  INITMSGA(MYDEBUG,0,
+          "- aMeshName = '"<<aMeshName<<"'"<<
+          "; aFieldName = '"<<aFieldInfo->GetName()<<"'"<<
+          "; aMEntity = "<<aMEntity<<
+          "; aNbComp = "<<aNbComp<<
+          endl);
+
+  theField->myDataSize = 0;
+
+  const MED::TTimeStampVal& aTimeStampValRef = aTimeStampVal;
+  TGeom2SubProfile::const_iterator anIter = aGeom2SubProfile.begin();
+  for(; anIter != aGeom2SubProfile.end(); anIter++){
+    VISU::EGeometry aEGeom = anIter->first;
+    PMEDSubProfile aSubProfile(anIter->second);
+
+    TInt aNbElem = aSubProfile->myNbCells;
+    theField->myDataSize += aNbElem*aNbComp;
+
+    TInt aNbGauss = theValForTime->GetNbGauss(aEGeom);
+
+    if(aSubProfile->myStatus != eRemoveAll){
+      INITMSG(MYDEBUG,
+             "- aEGeom = "<<aEGeom<<
+             "; aNbElem = "<<aNbElem<<
+             "; aNbGauss = "<<aNbGauss<<
+             endl);
+      
+      TMeshValue& aVMeshValue = theValForTime->GetMeshValue(aEGeom);
+      aVMeshValue.Init(aNbElem,aNbGauss,aNbComp);
+
+      MED::EGeometrieElement aMGeom = aSubProfile->myMGeom;
+      const MED::TMeshValue& aMMeshValue = aTimeStampValRef.GetMeshValue(aMGeom);
+      for(TInt iElem = 0; iElem < aNbElem; iElem++){
+       TValueSliceArr aVValueSliceArr = aVMeshValue.GetGaussValueSliceArr(iElem);
+       MED::TCValueSliceArr aMValueSliceArr = aMMeshValue.GetGaussValueSliceArr(iElem);
+       ADDMSG(MYVALUEDEBUG,"{");
+       for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+         TValueSlice& aVValueSlice = aVValueSliceArr[iGauss];
+         const MED::TCValueSlice& aMValueSlice = aMValueSliceArr[iGauss];
+         for(TInt iComp = 0; iComp < aNbComp; iComp++){
+           aVValueSlice[iComp] = aMValueSlice[iComp];
+           ADDMSG(MYVALUEDEBUG,aVValueSlice[iComp]<<" ");
          }
-         anArray[anId] /= aNbGauss;
+         ADDMSG(MYVALUEDEBUG,"| ");
        }
+       ADDMSG(MYVALUEDEBUG,"} ");
       }
+      ADDMSG(MYDEBUG,"\n");
     }
   }
-  theField->myIsTrimmed = anIsTrimmed;
+
+  theIsDone = true;
+
   return 1; 
 }
+
+
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadValForTimeOnMesh(const MED::PWrapper& theMed,
+                      VISU::PMEDMesh theMesh,
+                      VISU::PMEDMeshOnEntity theMeshOnEntity,
+                      VISU::PMEDField theField, 
+                      VISU::PMEDValForTime theValForTime)
+{
+  PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
+  return LoadValForTime(theMed,
+                       theMesh,
+                       theMeshOnEntity,
+                       theField,
+                       theValForTime,
+                       false,
+                       anIDMapperFilter->myIsVTKDone);
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MedConvertor
+::LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
+                          VISU::PMEDMesh theMesh,
+                          VISU::PMEDMeshOnEntity theMeshOnEntity,
+                          VISU::PMEDField theField, 
+                          VISU::PMEDValForTime theValForTime)
+{
+  PGaussPtsIDFilter aGaussPtsIDFilter = theValForTime->myGaussPtsIDFilter;
+  return LoadValForTime(theMed,
+                       theMesh,
+                       theMeshOnEntity,
+                       theField,
+                       theValForTime,
+                       true,
+                       aGaussPtsIDFilter->myIsVTKDone);
+}
index c93ac3412872831635a548142ec02d8cc3569446..61bb67e18d16864bdf013c57c0e499354245f8df 100644 (file)
 #include "VISU_Convertor_impl.hxx"
 
 #include "MED_Common.hxx"
+#include "MED_Structures.hxx"
+
+#include <boost/thread/mutex.hpp>
+#include <qfileinfo.h>
+
+namespace VISU
+{
+  typedef TVector<TName> TNames;
+
+  //---------------------------------------------------------------
+  class TMEDNamedPointCoords: public virtual TNamedPointCoords
+  {
+    MED::PNodeInfo myNodeInfo;
+    TNames myPointNames;
+  public:
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const MED::PNodeInfo& theNodeInfo);
+
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
+  };
+  typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
 
-namespace VISU{
 
-  struct TMEDMesh: TMeshImpl{
+  //---------------------------------------------------------------
+  struct TMEDMesh: virtual TMeshImpl
+  {
     MED::PMeshInfo myMeshInfo;
     MED::TEntityInfo myEntityInfo;
   };
-  typedef shared_ptr<TMEDMesh> PMEDMesh;
+  typedef SharedPtr<TMEDMesh> PMEDMesh;
+
+
+  //---------------------------------------------------------------
+  struct TMEDSubProfile: virtual TSubProfileImpl
+  {
+    MED::EGeometrieElement myMGeom;
+
+    TMEDSubProfile():
+      myIsElemNum(MED::eFAUX)
+    {}
+
+    MED::EBooleen myIsElemNum;
+    MED::TElemNum myElemNum;
 
-  struct TMEDMeshOnEntity: TMeshOnEntityImpl{
-    MED::TGeom myGeom;
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
   };
-  typedef shared_ptr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+  typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
 
-  struct TMEDFamily: TFamilyImpl{
+
+  //---------------------------------------------------------------
+  struct TMEDProfile: virtual TProfileImpl
+  {};
+  typedef SharedPtr<TMEDProfile> PMEDProfile;
+
+
+  //---------------------------------------------------------------
+  struct TMEDGauss: virtual TGaussImpl
+  {
+    MED::PGaussInfo myGaussInfo;
   };
-  typedef shared_ptr<TMEDFamily> PMEDFamily;
-  
-  struct TMEDGroup: TGroupImpl{
+  typedef SharedPtr<TMEDGauss> PMEDGauss;
+
+
+  //---------------------------------------------------------------
+  struct TMEDGaussSubMesh: virtual TGaussSubMeshImpl
+  {
+    TMEDGaussSubMesh():
+      myIsElemNum(MED::eFAUX)
+    {}
+
+    MED::EBooleen myIsElemNum;
+    MED::TElemNum myElemNum;
+
+    virtual
+    TGaussPointID
+    GetObjID(vtkIdType theID) const;
   };
-  typedef shared_ptr<TMEDGroup> PMEDGroup;
+  typedef SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
+
+
+  //---------------------------------------------------------------
+  struct TMEDGaussMesh: virtual TGaussMeshImpl
+  {};
+  typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
+
+
+  //---------------------------------------------------------------
+  struct TMEDSubMesh: virtual TSubMeshImpl
+  {
+    TMEDSubMesh():
+      myIsElemNum(MED::eFAUX)
+    {}
+
+    MED::EBooleen myIsElemNum;
+    MED::TElemNum myElemNum;
+    MED::PElemInfo myElemInfo;
+
+    void
+    Init(const MED::PElemInfo& theElemInfo);
+
+    virtual 
+    vtkIdType 
+    GetElemObjID(vtkIdType theID) const;
 
-  struct TMEDField: TFieldImpl{
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
   };
-  typedef shared_ptr<TMEDField> PMEDField;
+  typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
 
-  struct TMEDValForTime: TValForTimeImpl{
+
+  //---------------------------------------------------------------
+  struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
+  {
+    MED::TGeom2Size myGeom2Size;
   };
-  typedef shared_ptr<TMEDValForTime> PMEDValForTime;
+  typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+
+
+  //---------------------------------------------------------------
+  struct TMEDFamily: virtual TFamilyImpl
+  {};
+  typedef SharedPtr<TMEDFamily> PMEDFamily;
+  
+
+  //---------------------------------------------------------------
+  struct TMEDGroup: virtual TGroupImpl
+  {};
+  typedef SharedPtr<TMEDGroup> PMEDGroup;
+
+
+  //---------------------------------------------------------------
+  struct TMEDField: virtual TFieldImpl
+  {};
+  typedef SharedPtr<TMEDField> PMEDField;
+
+
+  //---------------------------------------------------------------
+  struct TMEDValForTime: virtual TValForTimeImpl
+  {};
+  typedef SharedPtr<TMEDValForTime> PMEDValForTime;
 
 }
 
-class VISU_MedConvertor: public VISU_Convertor_impl{
+class VISU_MedConvertor: public VISU_Convertor_impl
+{  
   VISU_MedConvertor();
   VISU_MedConvertor(const VISU_MedConvertor&);
+  
 public:
-  VISU_MedConvertor(const std::string& theFileName) ;
-  virtual VISU_Convertor* Build() ;
-protected:
-  QFileInfo myFileInfo;
+  VISU_MedConvertor(const std::string& theFileName);
 
-  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                              const std::string& theFamilyName = "");
+  virtual
+  VISU_Convertor* 
+  Build();
 
-  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
+protected:
+  QFileInfo myFileInfo;
 
-  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
-                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                             VISU::PFieldImpl theField, 
-                             VISU::PValForTimeImpl theValForTime);
+  virtual
+  int
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity);
+  
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily);
+
+  virtual
+  int
+  LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilySet& theFamilySet);
+  
+  virtual
+  int
+  LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime);
+  
+  virtual 
+  int
+  LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
+                          VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                          VISU::PFieldImpl theField, 
+                          VISU::PValForTimeImpl theValForTime);
+
+  int
+  LoadPoints(const MED::PWrapper& theMed,
+            const VISU::PMEDMesh theMesh);
+  
+  int
+  LoadPointsOnFamily(const MED::PWrapper& theMed,
+                    const VISU::PMEDMesh theMesh, 
+                    const VISU::PMEDFamily theFamily);
+  
+  int
+  LoadCellsOnEntity(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity);
   
-  int LoadPoints(const MED::PWrapper& theMed,
-                VISU::PMEDMesh theMesh, 
-                const std::string& theFamilyName = "");
-
-  int LoadCellsOnEntity(const MED::PWrapper& theMed,
-                       VISU::PMEDMesh theMesh,
-                       VISU::PMEDMeshOnEntity theMeshOnEntity,
-                       const std::string& theFamilyName = "");
+  int
+  LoadCellsOnFamily(const MED::PWrapper& theMed,
+                   const VISU::PMEDMesh theMesh,
+                   const VISU::PMEDMeshOnEntity theMeshOnEntity,
+                   const VISU::PMEDFamily theFamily);
   
-  int LoadField(const MED::PWrapper& theMed,
-               VISU::PMEDMesh theMesh,
-               VISU::PMEDMeshOnEntity theMeshOnEntity,
-               VISU::PMEDField theField, 
-               VISU::PMEDValForTime theValForTime);
+  int
+  LoadValForTimeOnMesh(const MED::PWrapper& theMed,
+                      VISU::PMEDMesh theMesh,
+                      VISU::PMEDMeshOnEntity theMeshOnEntity,
+                      VISU::PMEDField theField, 
+                      VISU::PMEDValForTime theValForTime);
   
+  int
+  LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
+                          VISU::PMEDMesh theMesh,
+                          VISU::PMEDMeshOnEntity theMeshOnEntity,
+                          VISU::PMEDField theField, 
+                          VISU::PMEDValForTime theValForTime);
 };
 
 #endif
diff --git a/src/CONVERTOR/VISU_MergeFilter.cxx b/src/CONVERTOR/VISU_MergeFilter.cxx
new file mode 100644 (file)
index 0000000..aa48a46
--- /dev/null
@@ -0,0 +1,418 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "VISU_MergeFilter.hxx"
+
+#include <vtkCellData.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkRectilinearGrid.h>
+#include <vtkStructuredGrid.h>
+#include <vtkStructuredPoints.h>
+#include <vtkUnstructuredGrid.h>
+
+namespace VISU
+{
+
+  class TFieldNode
+  {
+  public:
+    TFieldNode(const char* name, vtkDataSet* ptr=0)
+    {
+      int length = static_cast<int>(strlen(name));
+      if (length > 0) {
+       this->Name = new char[length+1];
+       strcpy(this->Name, name);
+      } else {
+        this->Name = 0;
+      }
+      this->Ptr = ptr;
+      this->Next = 0;
+    }
+    ~TFieldNode()
+    {
+      delete[] this->Name;
+    }
+
+    const char* GetName()
+    {
+      return Name;
+    }
+    vtkDataSet* Ptr;
+    TFieldNode* Next;
+  private:
+    TFieldNode(const TFieldNode&) {}
+    void operator=(const TFieldNode&) {}
+    char* Name;
+  };
+
+  class TFieldList
+  {
+  public:
+    TFieldList()
+    {
+      this->First = 0;
+      this->Last = 0;
+    }
+    ~TFieldList()
+    {
+      TFieldNode* node = this->First;
+      TFieldNode* next;
+      while(node){
+        next = node->Next;
+        delete node;
+        node = next;
+      }
+    }
+
+
+    void Add(const char* name, vtkDataSet* ptr)
+    {
+      TFieldNode* newNode = new TFieldNode(name, ptr);
+      if (!this->First) {
+       this->First = newNode;
+       this->Last = newNode;
+      } else {
+        this->Last->Next = newNode;
+        this->Last = newNode;
+      }
+    }
+
+    friend class TFieldListIterator;
+    
+  private:
+    TFieldNode* First;
+    TFieldNode* Last;
+  };
+  
+  class TFieldListIterator
+  {
+  public:
+    TFieldListIterator(TFieldList* list)
+    {
+      this->List = list;
+      this->Position = 0;
+    }
+    void Begin()
+    {
+      this->Position = this->List->First;
+    }
+    void Next()
+    {
+      if (this->Position) {
+       this->Position = this->Position->Next;
+      }
+    }
+    int End()
+    {
+      return this->Position ? 0 : 1;
+    }
+    TFieldNode* Get()
+    {
+      return this->Position;
+    }
+    
+  private:
+    TFieldNode* Position;
+    TFieldList* List;
+  };
+  
+}
+
+//------------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_MergeFilter);
+
+//------------------------------------------------------------------------------
+
+// Create object with no input or output.
+VISU_MergeFilter::VISU_MergeFilter()
+{
+  this->FieldList = new VISU::TFieldList;
+}
+
+VISU_MergeFilter::~VISU_MergeFilter()
+{
+  delete this->FieldList;
+}
+
+void VISU_MergeFilter::SetScalars(vtkDataSet *input)
+{
+  this->vtkProcessObject::SetNthInput(1, input);
+}
+vtkDataSet *VISU_MergeFilter::GetScalars()
+{
+  if (this->NumberOfInputs < 2)
+    {
+    return NULL;
+    }
+  return (vtkDataSet *)(this->Inputs[1]);
+}
+
+void VISU_MergeFilter::SetVectors(vtkDataSet *input)
+{
+  this->vtkProcessObject::SetNthInput(2, input);
+}
+vtkDataSet *VISU_MergeFilter::GetVectors()
+{
+  if (this->NumberOfInputs < 3)
+    {
+    return NULL;
+    }
+  return (vtkDataSet *)(this->Inputs[2]);
+}
+
+void VISU_MergeFilter::SetNormals(vtkDataSet *input)
+{
+  this->vtkProcessObject::SetNthInput(3, input);
+}
+vtkDataSet *VISU_MergeFilter::GetNormals()
+{
+  if (this->NumberOfInputs < 4)
+    {
+    return NULL;
+    }
+  return (vtkDataSet *)(this->Inputs[3]);
+}
+
+void VISU_MergeFilter::SetTCoords(vtkDataSet *input)
+{
+  this->vtkProcessObject::SetNthInput(4, input);
+}
+vtkDataSet *VISU_MergeFilter::GetTCoords()
+{
+  if (this->NumberOfInputs < 5)
+    {
+    return NULL;
+    }
+  return (vtkDataSet *)(this->Inputs[4]);
+}
+
+void VISU_MergeFilter::SetTensors(vtkDataSet *input)
+{
+  this->vtkProcessObject::SetNthInput(5, input);
+}
+vtkDataSet *VISU_MergeFilter::GetTensors()
+{
+  if (this->NumberOfInputs < 6)
+    {
+    return NULL;
+    }
+  return (vtkDataSet *)(this->Inputs[5]);
+}
+
+void VISU_MergeFilter::AddField(const char* name, vtkDataSet* input)
+{
+  this->FieldList->Add(name, input);
+}
+
+void VISU_MergeFilter::Execute()
+{
+  vtkIdType numPts, numScalars=0, numVectors=0, numNormals=0, numTCoords=0;
+  vtkIdType numTensors=0;
+  vtkIdType numCells, numCellScalars=0, numCellVectors=0, numCellNormals=0;
+  vtkIdType numCellTCoords=0, numCellTensors=0;
+  vtkPointData *pd;
+  vtkDataArray *scalars = NULL;
+  vtkDataArray *vectors = NULL;
+  vtkDataArray *normals = NULL;
+  vtkDataArray *tcoords = NULL;
+  vtkDataArray *tensors = NULL;
+  vtkCellData *cd;
+  vtkDataArray *cellScalars = NULL;
+  vtkDataArray *cellVectors = NULL;
+  vtkDataArray *cellNormals = NULL;
+  vtkDataArray *cellTCoords = NULL;
+  vtkDataArray *cellTensors = NULL;
+  vtkDataSet *output = this->GetOutput();
+  vtkPointData *outputPD = output->GetPointData();
+  vtkCellData *outputCD = output->GetCellData();
+  
+  vtkDebugMacro(<<"Merging data!");
+
+  // geometry needs to be copied
+  output->CopyStructure(this->GetInput());
+  if ( (numPts = this->GetInput()->GetNumberOfPoints()) < 1 )
+    {
+    vtkWarningMacro(<<"Nothing to merge!");
+    }
+  numCells = this->GetInput()->GetNumberOfCells();
+  
+  if ( this->GetScalars() ) 
+    {
+    pd = this->GetScalars()->GetPointData();
+    scalars = pd->GetScalars();
+    if ( scalars != NULL )
+      {
+      numScalars = scalars->GetNumberOfTuples();
+      }
+    cd = this->GetScalars()->GetCellData();
+    cellScalars = cd->GetScalars();
+    if ( cellScalars != NULL )
+      {
+      numCellScalars = cellScalars->GetNumberOfTuples();
+      }
+    }
+
+  if ( this->GetVectors() ) 
+    {
+    pd = this->GetVectors()->GetPointData();
+    vectors = pd->GetVectors();
+    if ( vectors != NULL )
+      {
+      numVectors= vectors->GetNumberOfTuples();
+      }
+    cd = this->GetVectors()->GetCellData();
+    cellVectors = cd->GetVectors();
+    if ( cellVectors != NULL )
+      {
+      numCellVectors = cellVectors->GetNumberOfTuples();
+      }
+    }
+
+  if ( this->GetNormals() ) 
+    {
+    pd = this->GetNormals()->GetPointData();
+    normals = pd->GetNormals();
+    if ( normals != NULL )
+      {
+      numNormals= normals->GetNumberOfTuples();
+      }
+    cd = this->GetNormals()->GetCellData();
+    cellNormals = cd->GetNormals();
+    if ( cellNormals != NULL )
+      {
+      numCellNormals = cellNormals->GetNumberOfTuples();
+      }
+    }
+
+  if ( this->GetTCoords() ) 
+    {
+    pd = this->GetTCoords()->GetPointData();
+    tcoords = pd->GetTCoords();
+    if ( tcoords != NULL )
+      {
+      numTCoords= tcoords->GetNumberOfTuples();
+      }
+    cd = this->GetTCoords()->GetCellData();
+    cellTCoords = cd->GetTCoords();
+    if ( cellTCoords != NULL )
+      {
+      numCellTCoords = cellTCoords->GetNumberOfTuples();
+      }
+    }
+
+  if ( this->GetTensors() ) 
+    {
+    pd = this->GetTensors()->GetPointData();
+    tensors = pd->GetTensors();
+    if ( tensors != NULL )
+      {
+      numTensors = tensors->GetNumberOfTuples();
+      }
+    cd = this->GetTensors()->GetCellData();
+    cellTensors = cd->GetTensors();
+    if ( cellTensors != NULL )
+      {
+      numCellTensors = cellTensors->GetNumberOfTuples();
+      }
+    }
+
+  // merge data only if it is consistent
+  if ( numPts == numScalars )
+    {
+    outputPD->SetScalars(scalars);
+    }
+  if ( numCells == numCellScalars )
+    {
+    outputCD->SetScalars(cellScalars);
+    }
+
+  if ( numPts == numVectors )
+    {
+    outputPD->SetVectors(vectors);
+    }
+  if ( numCells == numCellVectors )
+    {
+    outputCD->SetVectors(cellVectors);
+    }
+    
+  if ( numPts == numNormals )
+    {
+    outputPD->SetNormals(normals);
+    }
+  if ( numCells == numCellNormals )
+    {
+    outputCD->SetNormals(cellNormals);
+    }
+
+  if ( numPts == numTCoords )
+    {
+    outputPD->SetTCoords(tcoords);
+    }
+  if ( numCells == numCellTCoords )
+    {
+    outputCD->SetTCoords(cellTCoords);
+    }
+
+  if ( numPts == numTensors )
+    {
+    outputPD->SetTensors(tensors);
+    }
+  if ( numCells == numCellTensors )
+    {
+    outputCD->SetTensors(cellTensors);
+    }
+
+  VISU::TFieldListIterator it(this->FieldList);
+  vtkDataArray* da;
+  const char* name;
+  vtkIdType num;
+  for(it.Begin(); !it.End() ; it.Next())
+    {
+    pd = it.Get()->Ptr->GetPointData();
+    cd = it.Get()->Ptr->GetCellData();
+    name = it.Get()->GetName();
+    if ( (da=pd->GetArray(name)) )
+      {
+      num = da->GetNumberOfTuples();
+      if (num == numPts)
+        {
+        outputPD->AddArray(da);
+        }
+      }
+    if ( (da=cd->GetArray(name)) )
+      {
+      num = da->GetNumberOfTuples();
+      if (num == numCells) // To fix a VTK bug
+        {
+        outputCD->AddArray(da);
+        }
+      }
+    }
+}
diff --git a/src/CONVERTOR/VISU_MergeFilter.hxx b/src/CONVERTOR/VISU_MergeFilter.hxx
new file mode 100644 (file)
index 0000000..1d15cd3
--- /dev/null
@@ -0,0 +1,99 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef VISU_MergeFilter_H
+#define VISU_MergeFilter_H
+
+#include <vtkDataSetToDataSetFilter.h>
+
+namespace VISU
+{
+  class TFieldList;
+}
+
+// Following class was redefined in order to fix VTK bug 
+//  (see code for more details)
+
+class VISU_MergeFilter : public vtkDataSetToDataSetFilter
+{
+public:
+  static VISU_MergeFilter *New();
+  vtkTypeMacro(VISU_MergeFilter,vtkDataSetToDataSetFilter);
+
+  // Description:
+  // Specify object from which to extract geometry information.
+  void SetGeometry(vtkDataSet *input) {this->SetInput(input);};
+  vtkDataSet *GetGeometry() {return this->GetInput();};
+
+  // Description:
+  // Specify object from which to extract scalar information.
+  void SetScalars(vtkDataSet *);
+  vtkDataSet *GetScalars();
+
+  // Description:
+  // Set / get the object from which to extract vector information.
+  void SetVectors(vtkDataSet *);
+  vtkDataSet *GetVectors();
+
+  // Description:
+  // Set / get the object from which to extract normal information.
+  void SetNormals(vtkDataSet *);
+  vtkDataSet *GetNormals();
+  
+  // Description:
+  // Set / get the object from which to extract texture coordinates
+  // information.
+  void SetTCoords(vtkDataSet *);
+  vtkDataSet *GetTCoords();
+
+  // Description:
+  // Set / get the object from which to extract tensor data.
+  void SetTensors(vtkDataSet *);
+  vtkDataSet *GetTensors();
+
+  // Description:
+  // Set the object from which to extract a field and the name
+  // of the field
+  void AddField(const char* name, vtkDataSet* input);
+
+protected:
+  VISU_MergeFilter();
+  ~VISU_MergeFilter();
+
+  // Usual data generation method
+  void Execute();
+
+  VISU::TFieldList* FieldList;
+private:
+  VISU_MergeFilter(const VISU_MergeFilter&);  // Not implemented.
+  void operator=(const VISU_MergeFilter&);  // Not implemented.
+};
+
+#endif
+
+
index 63ccfd1faaa9cfcef1dcd13faf263a8672c10875..77413b197499196af361282f86a8e30f19ed158d 100644 (file)
@@ -212,6 +212,16 @@ namespace VISU{
   }
 
 
+  GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult, 
+                                                const char* theMeshName, 
+                                                VISU::Entity theEntity, 
+                                                const char* theFieldName, 
+                                                CORBA::Double theIteration)
+  {
+    return myVisuGen->GaussPointsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
+  }
+
+
   DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, 
                                                     const char* theMeshName, 
                                                     VISU::Entity theEntity, 
index 841c01986c484440d46c13d99826d8758c946dd7..fbcc3b48566d514c4d1fcc1a530d787c9081e39e 100644 (file)
@@ -69,6 +69,8 @@ namespace VISU{
 
     virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                           const char* theFieldName, CORBA::Double theIteration);
+    virtual GaussPoints_ptr GaussPointsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+                                              const char* theFieldName, CORBA::Double theIteration);
     virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
                                                   const char* theFieldName, CORBA::Double theIteration);
     virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
index b8b86f6e6d07e1a5b72515e8df411d4e235db269..7e207ca1a222ef1782939377e7a21fa0e7191d1f 100644 (file)
@@ -32,6 +32,6 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-SUBDIRS = CONVERTOR PIPELINE OBJECT ENGINE GUITOOLS VISU_I VISUGUI VISU_SWIG
+SUBDIRS = CONVERTOR PIPELINE OBJECT VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG ENGINE
 
 @MODULE@
index 6c2ba23cc3c08eefa0a2ac8e4e059a85804483f3..e73a5816cf1bcf9f0e85d22e54c3cc8d5167f36e 100644 (file)
@@ -32,12 +32,28 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 
 @COMMENCE@
 
-EXPORT_HEADERS = VISU_Actor.h VISU_MeshAct.h VISU_ScalarMapAct.h VISU_VectorsAct.h
+EXPORT_HEADERS = \
+       VISU_ActorFactory.h \
+       VISU_GaussPtsSettings.h \
+       VISU_GaussPtsActorFactory.h \
+       VISU_Event.h \
+       VISU_Actor.h \
+       VISU_MeshAct.h \
+       VISU_ScalarMapAct.h \
+       VISU_GaussPtsAct.h \
+       VISU_VectorsAct.h
 
 # Libraries targets
 
 LIB = libVisuObject.la
-LIB_SRC = VISU_Actor.cxx VISU_MeshAct.cxx VISU_ScalarMapAct.cxx VISU_VectorsAct.cxx
+LIB_SRC = \
+       VISU_Actor.cxx \
+       VISU_MeshAct.cxx \
+       VISU_ScalarMapAct.cxx \
+       VISU_GaussPtsDeviceActor.cxx \
+       VISU_GaussPtsSettings.cxx \
+       VISU_GaussPtsAct.cxx \
+       VISU_VectorsAct.cxx
 
 LIB_CLIENT_IDL = 
 
@@ -45,9 +61,24 @@ LIB_CLIENT_IDL =
 BIN = 
 BIN_SRC        =
 
-CPPFLAGS+= $(OCC_INCLUDES) $(VTK_INCLUDES) $(QT_INCLUDES) \
-       -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
-LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lVisuPipeLine \
-       -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
+CPPFLAGS+= \
+       $(OCC_INCLUDES) \
+       $(VTK_INCLUDES) \
+       $(BOOST_CPPFLAGS) \
+       -I${MED_ROOT_DIR}/include/salome \
+       -I${GUI_ROOT_DIR}/include/salome \
+       -I${KERNEL_ROOT_DIR}/include/salome
+
+LDFLAGS+= \
+       $(VTK_LIBS)  \
+       $(BOOST_LIBS) \
+       -L${GUI_ROOT_DIR}/lib/salome \
+       -L${KERNEL_ROOT_DIR}/lib/salome 
+
+LIBS+=  \
+       -lboost_signals-mt \
+       -lSalomeObject \
+       -lVisuPipeLine \
+       -lSVTK
 
 @CONCLUDE@
index e38b8cd3a139f4aec69ef7ec76bac64a61138d5a..c576c022445dd9e526d683276156256a442754bc 100644 (file)
@@ -21,8 +21,8 @@
 //
 //
 //
-//  File   : VISU_Actor.cxx
-//  Author : Laurent CORNABE with help of Nicolas REJNERI
+//  File   : 
+//  Author : 
 //  Module : VISU
 //  $Header$
 
 #include "VTKViewer_PassThroughFilter.h"
  
 #include <stdexcept>
+#include <sstream>
 
 // VTK Includes
 #include <vtkProperty.h>
-
+#include <vtkSmartPointer.h>
+#include <vtkTextMapper.h>
+#include <vtkTextActor.h>
+#include <vtkProperty2D.h>
+#include <vtkRenderer.h>
+#include <vtkCellPicker.h>
+#include <vtkCell.h>
+#include <vtkPointPicker.h>
+#include <vtkPoints.h>
+#include <vtkInteractorStyle.h>
 #include <vtkDataSet.h>
 #include <vtkPolyData.h>
 #include <vtkUnstructuredGrid.h>
@@ -48,6 +58,8 @@
 #include <vtkGeometryFilter.h>
 #include <vtkObjectFactory.h>
 
+#include <boost/bind.hpp>
+
 #include "utilities.h"
 
 using namespace std;
@@ -60,103 +72,212 @@ static int MYDEBUG = 1;
 static int MYDEBUG = 0;
 #endif
 
-//=======================================================================
+//#define ENABLE_ANNOTATION
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_Actor);
 
-VISU_Actor::VISU_Actor(){
-  SetDebug(MYVTKDEBUG);
-  myParent = this;
-  myPipeLine = NULL;
-  myPrs3d = NULL;
+//----------------------------------------------------------------------------
+VISU_Actor
+::VISU_Actor():
+  myIsVTKMapping(false),
+  myPrs3d(NULL),
+  myActorFactory(NULL),
+  myMapper(vtkDataSetMapper::New()),
+  myIsShrunk(false),
+  myIsShrinkable(false),
+  myShrinkFilter(VTKViewer_ShrinkFilter::New()),
+  myAnnotationMapper(vtkTextMapper::New()),
+  myAnnotationActor(vtkTextActor::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_Actor::VISU_Actor - this = "<<this);
+
+  myMapper->Delete();
+  myShrinkFilter->Delete();
 
   myStoreMapping = true;
 
-  myIsShrunk = false;
-  myIsShrinkable = false;
-  myShrinkFilter = VTKViewer_ShrinkFilter::New();
   myShrinkFilter->SetStoreMapping(true);
-  SetShrinkFactor();
-  
-  myMapper = vtkDataSetMapper::New();
+  SetShrinkFactor();  
+
+  myAnnotationMapper->Delete();
+  myAnnotationActor->SetMapper(myAnnotationMapper.GetPointer());
 
-  myIO = NULL;
-  myName = "";
+  myAnnotationActor->Delete();
+  myAnnotationActor->SetVisibility(0);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::ShallowCopy(vtkProp *prop)
+{
+  VISU_Actor *anActor = VISU_Actor::SafeDownCast(prop);
+  if(anActor != NULL){
+    setName(anActor->getName());
+    if(anActor->hasIO()) setIO(anActor->getIO());
+  }
+  Superclass::ShallowCopy(prop);
 }
 
-VISU_Actor::~VISU_Actor(){
-  SALOME_Actor::SetProperty(NULL);
+void
+VISU_Actor
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  myPipeLine->ShallowCopy(thePipeLine);
 
-  myMapper->RemoveAllInputs();
-  myMapper->Delete();
+  vtkDataSet* aDatsSet = myMapper->GetInput();
+  GetMapper()->ShallowCopy(thePipeLine->GetMapper());
 
-  if(myPipeLine) 
-    myPipeLine->UnRegister(this);
+  // To restore mapper input from pipeline
+  myMapper->SetInput(aDatsSet);
+}
 
-  myShrinkFilter->UnRegisterAllOutputs();
-  myShrinkFilter->Delete();
+//----------------------------------------------------------------------------
+VISU_Actor
+::~VISU_Actor()
+{
+  if(MYDEBUG) MESSAGE("~VISU_Actor() - this = "<<this);
+  Superclass::SetProperty(NULL);
+  SetDebug(MYVTKDEBUG);
 }
 
-void VISU_Actor::setIO(const Handle(SALOME_InteractiveObject)& theIO){
-  SALOME_Actor::setIO(theIO); 
+//----------------------------------------------------------------------------
+void 
+VISU_Actor
+::setIO(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  Superclass::setIO(theIO); 
   myName = theIO->getName(); 
 }
 
-void VISU_Actor::SetPrs3d(VISU::Prs3d_i* thePrs3d){ 
+//----------------------------------------------------------------------------
+void 
+VISU_Actor
+::SetPrs3d(VISU::Prs3d_i* thePrs3d)
+{ 
   myPrs3d = thePrs3d;
 }
 
-void VISU_Actor::SetPipeLine(VISU_PipeLine* thePipeLine) {
-  if (myPipeLine != thePipeLine){
-    if (myPipeLine != NULL) myPipeLine->UnRegister(this);
-    myPipeLine = thePipeLine;
-    if (myPipeLine != NULL) myPipeLine->Register(this);
-    this->Modified();
-    vtkMapper *aMapper = myPipeLine->GetMapper();
-    vtkDataSet *aDataSet = aMapper->GetInput();
-
-    //This code has been moved into VISU::Prs3d_i::UpdateActor() for bug 9808
-    //if(!aDataSet)
-    //  throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data !!!");
-    //aDataSet->Update();
-    //static float eps = VTK_LARGE_FLOAT * 0.1 ;
-    //if(aDataSet->GetLength() > eps)
-    //  throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large !!!");
-    //if(!aDataSet->GetNumberOfCells())
-    //  throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
-
-    //Bug SAL4221:  Mesh with less than 10 cells : shrink mode disable
-    //SetShrinkable(aDataSet->GetNumberOfCells() > 10);
-    SetShrinkable(thePipeLine->IsShrinkable());
-    //Now, we use vtkShrinkPolyData (not vtkShrinkFilter), 
-    //and the class there is no such limitation.
-
-    myMapper->SetInput(aDataSet);
-    SetMapper(myMapper);
-  }
+VISU::Prs3d_i* 
+VISU_Actor
+::GetPrs3d()
+{ 
+  return myPrs3d;
 }
 
-void VISU_Actor::SetParent(VISU_Actor* theParent){ 
-  myParent = theParent;
+//----------------------------------------------------------------------------
+VISU::TActorFactory* 
+VISU_Actor
+::GetFactory()
+{ 
+  return myActorFactory;
 }
 
-void VISU_Actor::SetRepresentation(int theMode) { 
-  SALOME_Actor::SetRepresentation(theMode);
-  if(myRepresentation == VTK_POINTS)
-    UnShrink();
+void
+VISU_Actor
+::SetFactory(VISU::TActorFactory* theActorFactory)
+{ 
+  using namespace VISU;
+
+  if(myActorFactory == theActorFactory)
+    return;
+  
+  if(theActorFactory)
+    myDestroySignal.connect(boost::bind(&TActorFactory::RemoveActor,
+                                       theActorFactory,
+                                       _1));
+
+  myActorFactory = theActorFactory;
 }
 
-void VISU_Actor::SetOpacity(float theValue){
-  GetProperty()->SetOpacity(theValue);
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::Update()
+{
+  myActorFactory->UpdateActor(this);
+  Superclass::Update();
 }
 
-float VISU_Actor::GetOpacity(){ 
-  return GetProperty()->GetOpacity();
+void
+VISU_Actor
+::RemoveFromRender()
+{
+  RemoveFromRender(GetRenderer());
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  myMapper->SetInput(theDataSet);
+  SetMapper(myMapper.GetPointer());
+}
+
+void
+VISU_Actor
+::SetPipeLine(VISU_PipeLine* thePipeLine) 
+{
+  myPipeLine = thePipeLine;
+  if(thePipeLine){
+    if(vtkMapper *aMapper = myPipeLine->GetMapper()){
+      if(vtkDataSet *aDataSet = aMapper->GetInput()){
+       if(!aDataSet)
+         throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no input data !!!");
+
+       aDataSet->Update();
+
+       static float EPS = VTK_LARGE_FLOAT * 0.1 ;
+       if(aDataSet->GetLength() > EPS)
+         throw std::runtime_error("VISU_Actor::SetPipeLine >> Diagonal of the actor is too large !!!");
+
+       if(!aDataSet->GetNumberOfCells())
+         throw std::runtime_error("VISU_Actor::SetPipeLine >> There is no visible elements");
+
+       SetShrinkable(thePipeLine->IsShrinkable());
+
+       SetMapperInput(aDataSet);
+      }
+    }
+  }
+  this->Modified();
 }
 
+VISU_PipeLine* 
+VISU_Actor
+::GetPipeLine() 
+{ 
+  return myPipeLine.GetPointer();
+}
+
+VISU_PipeLine* 
+VISU_Actor
+::GetCurrentPL() 
+{ 
+  return GetPipeLine();
+}
 
-void VISU_Actor::SetShrink(){
-  if(!myIsShrinkable) return;
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetRepresentation(int theMode) 
+{ 
+  Superclass::SetRepresentation(theMode);
+  if(myRepresentation == VTK_POINTS)
+    UnShrink();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetShrink()
+{
+  if(!myIsShrinkable) 
+    return;
   if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
     myShrinkFilter->SetInput(aDataSet);
     myPassFilter[1]->SetInput(myShrinkFilter->GetOutput());
@@ -164,8 +285,12 @@ void VISU_Actor::SetShrink(){
   }
 }
 
-void VISU_Actor::UnShrink(){
-  if(!myIsShrunk) return;
+void
+VISU_Actor
+::UnShrink()
+{
+  if(!myIsShrunk) 
+    return;
   if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
     myPassFilter[1]->SetInput(aDataSet);
     myPassFilter[1]->Modified();
@@ -174,54 +299,298 @@ void VISU_Actor::UnShrink(){
   }
 }
 
-void VISU_Actor::SetShrinkable(bool theIsShrinkable){
+bool
+VISU_Actor
+::IsShrunk()
+{
+  return myIsShrunk;
+}
+
+void
+VISU_Actor
+::SetShrinkable(bool theIsShrinkable)
+{
   myIsShrinkable = theIsShrinkable;
 }
 
-void VISU_Actor::SetShrinkFactor(float theValue){
+bool
+VISU_Actor
+::IsShrunkable() 
+{ 
+  return myIsShrinkable;
+}
+
+void
+VISU_Actor
+::SetShrinkFactor(float theValue)
+{
   myShrinkFilter->SetShrinkFactor(theValue);
   Modified();
 }
 
-float VISU_Actor::GetShrinkFactor(){
+float
+VISU_Actor
+::GetShrinkFactor()
+{
   return myShrinkFilter->GetShrinkFactor();
 }
 
 
 //----------------------------------------------------------------------------
-void VISU_Actor::SetVisibility(int theMode){
-  SALOME_Actor::SetVisibility(theMode);
+void
+VISU_Actor
+::SetOpacity(float theValue)
+{
+  GetProperty()->SetOpacity(theValue);
 }
 
-int VISU_Actor::GetVisibility(){
-  return SALOME_Actor::GetVisibility();
+float
+VISU_Actor
+::GetOpacity()
+{ 
+  return GetProperty()->GetOpacity();
 }
 
-void VISU_Actor::SetLineWidth(float theLineWidth){
+void
+VISU_Actor
+::SetLineWidth(float theLineWidth)
+{
   GetProperty()->SetLineWidth(theLineWidth);
 }
 
-float VISU_Actor::GetLineWidth(){
+float
+VISU_Actor
+::GetLineWidth()
+{
   return GetProperty()->GetLineWidth();
 }
 
+//==================================================================
+// function: AddToRender
+// purpose :
+//==================================================================
+void
+VISU_Actor
+::AddToRender(vtkRenderer* theRenderer)
+{
+  Superclass::AddToRender(theRenderer);
+  theRenderer->AddActor(myAnnotationActor.GetPointer());
+}
+
+//==================================================================
+// function: RemoveFromRender
+// purpose :
+//==================================================================
+void
+VISU_Actor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  theRenderer->RemoveActor(myAnnotationActor.GetPointer());
+  Superclass::RemoveFromRender(theRenderer); 
+  myDestroySignal(this);
+}
+
 //----------------------------------------------------------------------------
-void VISU_Actor::ShallowCopy(vtkProp *prop){
-  VISU_Actor *anActor = VISU_Actor::SafeDownCast(prop);
-  if(anActor != NULL){
-    setName(anActor->getName());
-    if(anActor->hasIO()) setIO(anActor->getIO());
-  }
-  SALOME_Actor::ShallowCopy(prop);
+void 
+VISU_Actor
+::SetVTKMapping(bool theIsVTKMapping)
+{
+  myIsVTKMapping = theIsVTKMapping;
+}
+
+bool 
+VISU_Actor
+::IsVTKMapping() const
+{
+  return myIsVTKMapping;
 }
 
 //----------------------------------------------------------------------------
-int VISU_Actor::GetNodeObjId(int theVtkID){
-  if ( myIsShrunk ) 
-    return myShrinkFilter->GetNodeObjId(theVtkID);
-  return theVtkID;
+vtkDataSet* 
+VISU_Actor
+::GetInput()
+{
+  if(myIsVTKMapping)
+    return Superclass::GetInput();
+
+  return GetCurrentPL()->GetInput();
 }
 
-int VISU_Actor::GetElemObjId(int theVtkID){
-  return myGeomFilter->GetElemObjId(theVtkID);
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_Actor
+::GetNodeObjId(vtkIdType theID)
+{
+  if(myIsVTKMapping)
+    return Superclass::GetNodeObjId(theID);
+
+  vtkIdType anID = myGeomFilter->GetNodeObjId(theID);
+
+  if(myIsShrunk)
+   anID = myShrinkFilter->GetNodeObjId(anID);
+
+  return GetCurrentPL()->GetNodeObjID(anID);
+}
+
+vtkIdType
+VISU_Actor
+::GetNodeVTKID(vtkIdType theID)
+{
+  if(myIsVTKMapping)
+    return theID;
+
+  return GetCurrentPL()->GetNodeVTKID(theID);
+}
+
+float*
+VISU_Actor
+::GetNodeCoord(int theObjID)
+{
+  if(myIsVTKMapping)
+    return Superclass::GetNodeCoord(theObjID);
+
+  return GetCurrentPL()->GetNodeCoord(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+vtkIdType
+VISU_Actor
+::GetElemObjId(vtkIdType theID)
+{
+  if(myIsVTKMapping)
+    return Superclass::GetElemObjId(theID);
+
+  vtkIdType anID = myGeomFilter->GetElemObjId(theID);
+
+  if(myIsShrunk)
+   anID = myShrinkFilter->GetElemObjId(anID);
+
+  return GetCurrentPL()->GetElemObjID(anID);
+}
+
+vtkIdType
+VISU_Actor
+::GetElemVTKID(vtkIdType theID)
+{
+  if(myIsVTKMapping)
+    return theID;
+
+  return GetCurrentPL()->GetElemVTKID(theID);
+}
+
+vtkCell* 
+VISU_Actor
+::GetElemCell(vtkIdType theObjID)
+{
+  if(myIsVTKMapping)
+    return Superclass::GetElemCell(theObjID);
+
+  return GetCurrentPL()->GetElemCell(theObjID);
+}
+
+
+//----------------------------------------------------------------------------
+bool
+VISU_Actor
+::PreHighlight(vtkInteractorStyle* theInteractorStyle, 
+              SVTK_SelectionEvent* theSelectionEvent,
+              bool theIsHighlight)
+{
+  bool aRet = Superclass::PreHighlight(theInteractorStyle,
+                                      theSelectionEvent,
+                                      theIsHighlight);
+#ifndef ENABLE_ANNOTATION
+  return aRet;
+#endif   
+  //
+  myAnnotationActor->SetVisibility(0);
+  if(theIsHighlight){
+    switch(mySelectionMode){
+    case CellSelection:{ 
+      vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer();
+      myCellPicker->Pick(theSelectionEvent->myX, 
+                        theSelectionEvent->myY, 
+                        0.0, 
+                        aRenderer);
+
+      if(myCellPicker->GetActor() != this)
+       return false;
+      
+      vtkIdType aVTKId = myCellPicker->GetCellId();
+      if(aVTKId >= 0  && mySelector->IsValid(this,aVTKId,true) && hasIO()){
+       vtkIdType anObjId = GetElemObjId(aVTKId);
+       if(vtkCell* aCell = GetElemCell(anObjId)){
+         vtkPoints* aPts = aCell->GetPoints();
+         if(int aNbPts = aCell->GetNumberOfPoints()){
+           float aCoord[3] = {0.0, 0.0, 0.0};
+           for(int i = 0; i < aNbPts; i++){
+             float *aPntCoord = aPts->GetPoint(i); 
+             aCoord[0] += aPntCoord[0];
+             aCoord[1] += aPntCoord[1];
+             aCoord[2] += aPntCoord[2];
+           }
+           // Display coordinates
+           float aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
+           aRenderer->SetWorldPoint(aWorldCoord);
+           aRenderer->WorldToDisplay();
+           float aSelectionPoint[3];
+           aRenderer->GetDisplayPoint(aSelectionPoint);
+           myAnnotationActor->SetPosition(aSelectionPoint);
+           //
+           // To prepare the annotation text
+           std::ostringstream aStr;
+           aStr<<"Cell ID: "<< anObjId;
+           std::string aString = aStr.str();
+           myAnnotationMapper->SetInput(aString.c_str());
+           
+           myAnnotationActor->SetVisibility(1);
+           return true;
+         }
+       }
+      }
+      break;
+    }
+    case NodeSelection:{ 
+      vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer();
+      myPointPicker->Pick(theSelectionEvent->myX, 
+                         theSelectionEvent->myY, 
+                         0.0, 
+                         aRenderer);
+      
+      if(myPointPicker->GetActor() != this)
+       return false;
+
+      vtkIdType aVtkId = myPointPicker->GetPointId();
+      if(aVtkId >= 0  && mySelector->IsValid(this,aVtkId,true) && hasIO()){
+       vtkIdType anObjId = GetNodeObjId( aVtkId );
+       if(float* aCoord = GetNodeCoord(anObjId)){
+         // Display coordinates
+         float aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
+         aRenderer->SetWorldPoint(aWorldCoord);
+         aRenderer->WorldToDisplay();
+         float aSelectionPoint[3];
+         aRenderer->GetDisplayPoint(aSelectionPoint);
+         myAnnotationActor->SetPosition(aSelectionPoint);
+         //
+         // To prepare the annotation text
+         std::ostringstream aStr;
+         aStr<<"Node ID: "<< anObjId;
+         std::string aString = aStr.str();
+         myAnnotationMapper->SetInput(aString.c_str());
+         
+         myAnnotationActor->SetVisibility(1);
+         return true;
+       }
+      }
+      break;
+    }
+    case EdgeOfCellSelection:
+      break;
+    default:
+      break;
+    }
+  }
+
+  return aRet;
 }
index 01cf5c67baa6aae216c1a3ccd49320731dfede90..6078198e93e39f381b2189ebecb9a39d77e9af51 100644 (file)
@@ -21,8 +21,8 @@
 //
 //
 //
-//  File   : VISU_Actor.h
-//  Author : Laurent CORNABE with the help of Nicolas REJNERI
+//  File   : 
+//  Author : 
 //  Module : VISU
 //  $Header$
 
 #define VISU_ACTOR_H
 
 #include "SALOME_Actor.h"
+#include "VISU_ActorFactory.h"
 
 #include <string>
+#include <vtkSmartPointer.h>
+#include <boost/signals/signal1.hpp>
+#include <boost/signals/trackable.hpp>
 
 class vtkProp;
 class vtkProperty;
 class vtkDataSetMapper;
-
+class vtkTextMapper;
+class vtkTextActor;
+class vtkInteractorStyle;
 class VTKViewer_ShrinkFilter;
 class VISU_PipeLine;
 
-namespace VISU { 
-  class Prs3d_i;
-}
-
 #ifdef _WIN_32
 #define VTKOCC_EXPORT __declspec (dllexport)
 #else
 #define VTKOCC_EXPORT VTK_EXPORT
 #endif
 
-class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor {
+namespace VISU 
+{
+  class Prs3d_i;
+}
+
+//----------------------------------------------------------------------------
+class VTKOCC_EXPORT VISU_Actor : 
+  public SALOME_Actor,
+  public boost::bsignals::trackable
+{
  public:
   vtkTypeMacro(VISU_Actor,SALOME_Actor);
-  void ShallowCopy(vtkProp *prop);
-  static VISU_Actor* New();
-  virtual ~VISU_Actor();
-
-  virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
-
-  VISU::Prs3d_i* GetPrs3d(){ return myPrs3d;}
-  virtual void SetPrs3d(VISU::Prs3d_i* thePrs3d);
-
-  virtual VISU_PipeLine* GetPipeLine() { return myPipeLine;}
-  virtual void SetPipeLine(VISU_PipeLine* thePipeLine) ;
-
-  VISU_Actor* GetParent(){ return myParent;}
-  virtual void SetParent(VISU_Actor* theParent);
 
-  virtual void SetOpacity(float theValue);
-  virtual float GetOpacity();
-
-  virtual void SetRepresentation(int theMode);
-
-  virtual bool IsShrunkable() { return myIsShrinkable;}
-  virtual bool IsShrunk() { return myIsShrunk;}
-  virtual void SetShrink();
-  virtual void UnShrink(); 
-
-  virtual void SetShrinkable(bool theIsShrinkable);
-  virtual void SetShrinkFactor(float theFactor = 0.8); 
-  virtual float GetShrinkFactor();
-
-  virtual void SetVisibility(int theMode);
-  virtual int GetVisibility();
-
-  virtual void SetLineWidth(float theLineWidth);
-  virtual float GetLineWidth();
+  static 
+  VISU_Actor* 
+  New();
+
+  void
+  ShallowCopy(vtkProp *prop);
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  setIO(const Handle(SALOME_InteractiveObject)& theIO);
+
+  //----------------------------------------------------------------------------
+  VISU::Prs3d_i* 
+  GetPrs3d();
+
+  virtual
+  void
+  SetPrs3d(VISU::Prs3d_i* thePrs3d);
+
+  //----------------------------------------------------------------------------
+  VISU::TActorFactory* 
+  GetFactory();
+
+  virtual
+  void
+  SetFactory(VISU::TActorFactory* theActorFactory);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  Update();
+
+  virtual
+  void
+  RemoveFromRender();
+
+  //----------------------------------------------------------------------------
+  virtual
+  VISU_PipeLine* 
+  GetPipeLine();
+
+  virtual 
+  void
+  SetPipeLine(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetRepresentation(int theMode);
+
+  //----------------------------------------------------------------------------
+  virtual
+  bool
+  IsShrunkable();
+
+  virtual
+  bool
+  IsShrunk();
+
+  virtual
+  void
+  SetShrink();
+
+  virtual
+  void
+  UnShrink(); 
+
+  virtual
+  void
+  SetShrinkable(bool theIsShrinkable);
+
+  virtual
+  void
+  SetShrinkFactor(float theFactor = 0.8); 
+
+  virtual
+  float
+  GetShrinkFactor();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetOpacity(float theValue);
+
+  virtual
+  float
+  GetOpacity();
+
+  virtual
+  void
+  SetLineWidth(float theLineWidth);
+
+  virtual
+  float
+  GetLineWidth();
  
-  virtual int GetNodeObjId(int theVtkID);
-  virtual int GetElemObjId(int theVtkID);
-
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  AddToRender( vtkRenderer* ); 
+
+  virtual
+  void
+  RemoveFromRender( vtkRenderer* );
+
+  //----------------------------------------------------------------------------
+  virtual
+  bool
+  PreHighlight(vtkInteractorStyle* theInteractorStyle, 
+              SVTK_SelectionEvent* theSelectionEvent,
+              bool theIsHighlight);
+
+  virtual
+  void 
+  SetVTKMapping(bool theIsVTKMapping); 
+
+  virtual
+  bool 
+  IsVTKMapping() const;
+
+  virtual
+  vtkDataSet* 
+  GetInput(); 
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkIdType
+  GetNodeObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  float* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell* 
+  GetElemCell(vtkIdType theObjID);
+
+  //----------------------------------------------------------------------------
  protected:
   VISU_Actor();
+
+  virtual
+  ~VISU_Actor();
  
-  VISU_Actor* myParent;
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  virtual
+  VISU_PipeLine* 
+  GetCurrentPL();
+
+  //----------------------------------------------------------------------------
+  bool myIsVTKMapping;
   VISU::Prs3d_i* myPrs3d;
-  VISU_PipeLine* myPipeLine;
-  vtkDataSetMapper* myMapper;
+  vtkSmartPointer<VISU_PipeLine> myPipeLine;
+  vtkSmartPointer<vtkDataSetMapper> myMapper;
 
-  VTKViewer_ShrinkFilter* myShrinkFilter;
+  VISU::TActorFactory* myActorFactory;
+  boost::signal1<void,VISU_Actor*> myDestroySignal;
+
+  vtkSmartPointer<VTKViewer_ShrinkFilter> myShrinkFilter;
   bool myIsShrinkable;
   bool myIsShrunk;
+
+  vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
+  vtkSmartPointer<vtkTextActor>  myAnnotationActor;
 };
 
 #endif //VISU_ACTOR_H
diff --git a/src/OBJECT/VISU_ActorFactory.h b/src/OBJECT/VISU_ActorFactory.h
new file mode 100644 (file)
index 0000000..d594f5b
--- /dev/null
@@ -0,0 +1,55 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : VISU
+//  $Header$
+
+#ifndef VISU_ACTOR_FACTORY_H
+#define VISU_ACTOR_FACTORY_H
+
+#include <boost/signals/trackable.hpp>
+
+class VISU_Actor;
+
+//----------------------------------------------------------------------------
+namespace VISU 
+{ 
+  struct TActorFactory: public virtual boost::bsignals::trackable
+  {
+    virtual 
+    ~TActorFactory()
+    {}
+
+    virtual 
+    void
+    UpdateActor(VISU_Actor* theActor) = 0;
+
+    virtual 
+    void
+    RemoveActor(VISU_Actor* theActor) = 0;
+  };
+}
+
+#endif //VISU_ACTOR_FACTORY_H
diff --git a/src/OBJECT/VISU_Event.h b/src/OBJECT/VISU_Event.h
new file mode 100644 (file)
index 0000000..e9850df
--- /dev/null
@@ -0,0 +1,44 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef VISU_Event_h
+#define VISU_Event_h
+
+#include "SVTK_Event.h"
+
+namespace VISU
+{
+  enum Event 
+  {
+    SetSMDecreaseMagnificationEvent = SVTK::LastEvent + 100, 
+    SetSMIncreaseMagnificationEvent,
+    LastEvent
+  };
+}
+  
+#endif
diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx
new file mode 100644 (file)
index 0000000..b17b622
--- /dev/null
@@ -0,0 +1,1131 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VISU_MeshAct.hxx
+//  Author : Laurent CORNABE with the help of Nicolas REJNERI
+//  Module : VISU
+//  $Header$
+
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_GaussPtsSettings.h"
+#include "VISU_GaussPtsDeviceActor.h"
+#include "VISU_ImplicitFunctionWidget.h"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include "VISU_ScalarBarCtrl.hxx"
+#include "VISU_ScalarBarActor.hxx"
+
+#include "VISU_Event.h" 
+#include "SVTK_Actor.h"
+
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkPointPicker.h>
+#include <vtkScalarBarWidget.h>
+#include <vtkScalarBarActor.h>
+#include <vtkTextMapper.h>
+#include <vtkTextProperty.h>
+
+#include <vtkCellData.h>
+#include <vtkDataArray.h>
+
+#include <vtkSphereSource.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+#include <vtkActor.h>
+
+#include <vtkObjectFactory.h>
+#include <vtkCallbackCommand.h>
+#include <vtkInteractorStyle.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkOutlineSource.h>
+
+#include <sstream>
+#include <boost/bind.hpp>
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkDataSetMapper.h>
+#include <vtkRenderWindow.h>
+#include <vtkCellArray.h>
+#include <vtkCell.h>
+#include <vtkMath.h>
+
+#include <vtkViewport.h>
+
+#include "utilities.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+static int MYDEBUG1 = 0;
+static int MYDEBUG2 = 0;
+#else
+static int MYDEBUG = 0;
+static int MYDEBUG1 = 0;
+static int MYDEBUG2 = 0;
+#endif
+
+
+//============================================================================
+vtkStandardNewMacro(VISU_GaussPtsAct);
+
+//----------------------------------------------------------------------------
+VISU_GaussPtsAct
+::VISU_GaussPtsAct():
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myPriority(0.0),
+  myDeviceActor(VISU_GaussPtsDeviceActor::New()),
+  myWidget(NULL),
+  myGaussPointsPL(NULL),
+  myLastObjPointID(-1),
+  myTextActor(VISU_FramedTextActor::New()),
+  myCursorPyramid(VISU_CursorPyramid::New()),
+  myCursorPyramidSelected(VISU_CursorPyramid::New()),
+  myCellSource(vtkUnstructuredGrid::New()),
+  myCellActor(vtkActor::New()),
+  myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
+  myBarVisibility(true),
+  myPickingSettings(NULL),
+  myCurrentPL(NULL)
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
+  
+
+  myEventCallbackCommand->Delete();
+  myDeviceActor->Delete();
+  myTextActor->Delete();
+
+  myCursorPyramid->Delete();
+  myCursorPyramidSelected->Delete();
+
+  myCellSource->Delete();
+  myCellActor->Delete();
+
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VISU_GaussPtsAct::ProcessEvents);
+
+  myDeviceActor->SetProperty(GetProperty());
+  myDeviceActor->SetVisibility(true);
+  myDeviceActor->SetPickable(false);
+
+  myTextActor->SetVisibility(false);
+  myTextActor->SetPickable(false);
+  //
+  myCellSource->Allocate();
+  vtkDataSetMapper* aCellMapper = vtkDataSetMapper::New();
+  aCellMapper->SetInput(myCellSource.GetPointer());
+  myCellActor->SetMapper(aCellMapper);
+  myCellActor->SetVisibility(0);
+  myCellActor->SetPickable(0);
+  myCellActor->GetProperty()->SetAmbient(1.0);
+  myCellActor->GetProperty()->SetDiffuse(0.0);
+  myCellActor->GetProperty()->SetRepresentationToWireframe(); 
+
+  myScalarBarCtrl->Delete();
+  myScalarBarCtrl->SetMode(0);
+  myScalarBarCtrl->SetRangeGlobal(0.,10.);
+  myScalarBarCtrl->SetOrientationToHorizontal();
+  myScalarBarCtrl->GetScalarBarActor(0)->SetTitle("GLB"); 
+  myScalarBarCtrl->GetScalarBarActor(1)->SetTitle("LOC"); 
+}
+
+VISU_GaussPtsAct
+::~VISU_GaussPtsAct()
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
+  SetImplicitFunctionWidget(NULL);
+  SetInteractor(NULL);
+  SetPickingSettings(NULL);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::SetPipeLine(VISU_PipeLine* thePipeLine) 
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetPipeLine - this = "<<this);
+
+  myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+
+  Superclass::SetPipeLine(thePipeLine);
+}
+
+VISU_GaussPointsPL*
+VISU_GaussPtsAct
+::GetGaussPointsPL()
+{
+  return myGaussPointsPL.GetPointer();
+}
+
+void
+VISU_GaussPtsAct
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::ShallowCopyPL - this = "<<this);
+
+  Superclass::ShallowCopyPL(thePipeLine);
+
+  VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+  myDeviceActor->ShallowCopyPL(aPipeLine);
+}
+
+
+//----------------------------------------------------------------------------
+vtkMapper* 
+VISU_GaussPtsAct
+::GetMapper()
+{
+  return GetCurrentPL()->GetMapper();
+}
+
+float* 
+VISU_GaussPtsAct
+::GetBounds()
+{
+  return myDeviceActor->GetBounds();
+}
+
+vtkDataSet* 
+VISU_GaussPtsAct
+::GetInput()
+{
+  return GetMapper()->GetInput();
+}
+
+VISU_PipeLine* 
+VISU_GaussPtsAct
+::GetCurrentPL() 
+{ 
+  return myCurrentPL;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::AddToRender(vtkRenderer* theRenderer)
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::AddToRender - this = "<<this);
+
+  Superclass::AddToRender(theRenderer);
+
+  myDeviceActor->AddToRender(theRenderer);
+
+  theRenderer->AddActor(myTextActor.GetPointer());
+  theRenderer->AddActor(myCellActor.GetPointer());
+
+  myCursorPyramid->AddToRender(theRenderer);
+  myCursorPyramidSelected->AddToRender(theRenderer);
+  myScalarBarCtrl->AddToRender(theRenderer);
+}
+
+void 
+VISU_GaussPtsAct
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::RemoveFromRender - this = "<<this);
+
+  Superclass::RemoveFromRender(theRenderer);
+
+  myDeviceActor->RemoveFromRender(theRenderer);
+  
+  theRenderer->RemoveActor(myTextActor.GetPointer());
+  theRenderer->RemoveActor(myCellActor.GetPointer());
+  
+  myCursorPyramid->RemoveFromRender(theRenderer);
+  myCursorPyramidSelected->RemoveFromRender(theRenderer);
+  myScalarBarCtrl->RemoveFromRender(theRenderer);
+}
+
+void 
+VISU_GaussPtsAct
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  Superclass::SetTransform(theTransform);
+
+  myDeviceActor->SetTransform(theTransform);
+}
+
+int
+VISU_GaussPtsAct
+::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+  return 1;
+}
+
+int
+VISU_GaussPtsAct
+::RenderTranslucentGeometry(vtkViewport *viewport)
+{
+  return 1;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
+{
+  if(myWidget == theWidget)
+    return;
+
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetImplicitFunctionWidget - this = "<<this<<"; theWidget = "<<theWidget);
+
+  if(myWidget)
+    myWidget->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+  if(theWidget){
+    theWidget->AddObserver(vtkCommand::EnableEvent, 
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
+    theWidget->AddObserver(vtkCommand::DisableEvent, 
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
+    theWidget->AddObserver(vtkCommand::EndInteractionEvent, 
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
+  }
+
+  myWidget = theWidget;
+}
+
+bool
+VISU_GaussPtsAct
+::ChangeMagnification()
+{
+  return myChangeMagnification;
+}
+
+//----------------------------------------------------------------------------
+namespace
+{
+  VISU_GaussPointsPL*
+  CreatePipeLine(VISU_GaussPointsPL* thePipeLine)
+  {
+    VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
+    aPipeLine->ShallowCopy(thePipeLine);
+    aPipeLine->Update();
+    return aPipeLine;
+  }
+}
+
+void
+VISU_GaussPtsAct
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<<this);
+
+  myDeviceActor->SetPipeLine(GetGaussPointsPL());
+  myCurrentPL = myDeviceActor->GetPipeLine();
+}
+
+void
+VISU_GaussPtsAct
+::SetFactory(VISU::TActorFactory* theActorFactory)
+{ 
+  using namespace VISU;
+  myGaussPtsActorFactory = dynamic_cast<TGaussPtsActorFactory*>(theActorFactory);
+  myUpdatePrs3dSignal.connect(boost::bind(&TGaussPtsActorFactory::UpdateFromActor,
+                                         myGaussPtsActorFactory,
+                                         _1));
+  Superclass::SetFactory(theActorFactory);
+}
+
+VISU::TGaussPtsActorFactory*
+VISU_GaussPtsAct
+::GetGaussPtsFactory()
+{
+  return myGaussPtsActorFactory;
+}
+
+void
+VISU_GaussPtsAct
+::SetVisibility(int theMode)
+{
+  Superclass::SetVisibility(theMode);
+  myScalarBarCtrl->SetVisibility(theMode);
+  Highlight(isHighlighted());
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::SetBarVisibility(bool theMode)
+{
+  myBarVisibility = theMode;
+  myScalarBarCtrl->SetCtrlVisibility((int)theMode); 
+}
+
+bool
+VISU_GaussPtsAct
+::GetBarVisibility()
+{ 
+  return myBarVisibility;
+}
+
+VISU_ScalarBarCtrl* 
+VISU_GaussPtsAct
+::GetScalarBarCtrl()
+{
+  return myScalarBarCtrl.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::SetInteractor(vtkRenderWindowInteractor* theInteractor)
+{
+  if(theInteractor == myInteractor)
+    return;
+
+  if(myInteractor)
+    myInteractor->RemoveObserver(myEventCallbackCommand.GetPointer());
+  
+  if(theInteractor){
+    theInteractor->AddObserver(vtkCommand::CharEvent, 
+                              myEventCallbackCommand.GetPointer(), 
+                              myPriority);
+    theInteractor->AddObserver(VISU::SetSMDecreaseMagnificationEvent, 
+                              myEventCallbackCommand.GetPointer(), 
+                              myPriority);
+    theInteractor->AddObserver(VISU::SetSMIncreaseMagnificationEvent, 
+                              myEventCallbackCommand.GetPointer(), 
+                              myPriority);
+  }
+  Superclass::SetInteractor(theInteractor);
+
+  Modified();
+}
+//-------------------------------------------------------------------------
+void 
+VISU_GaussPtsAct
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
+    if(VISU_GaussPtsAct* self = dynamic_cast<VISU_GaussPtsAct*>(anObject)) 
+      self->OnInteractorEvent(theEvent);
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::OnInteractorEvent(unsigned long theEvent)
+{
+  switch(theEvent){
+  case vtkCommand::CharEvent: {
+    switch(myInteractor->GetKeyCode()) {
+    case 'M' :
+    case 'm' :
+      myChangeMagnification = myInteractor->GetShiftKey();
+      break;
+    default:
+      return;
+    }
+    myUpdatePrs3dSignal(this);
+    break;
+  }
+  case VISU::SetSMDecreaseMagnificationEvent: 
+  case VISU::SetSMIncreaseMagnificationEvent: 
+    myChangeMagnification = theEvent == VISU::SetSMIncreaseMagnificationEvent;
+    myUpdatePrs3dSignal(this);
+    break;
+  case VISU::UpdatePickingSettingsEvent:
+    UpdatePickingSettings();
+    break;
+  case vtkCommand::EndInteractionEvent:
+  case vtkCommand::EnableEvent:
+  case vtkCommand::DisableEvent: 
+    myCurrentPL->GetMapper()->Update();
+    Highlight(isHighlighted());
+    break;
+  default:
+    break;
+  }
+}
+
+//----------------------------------------------------------------------------
+bool VISU_GaussPtsAct::IsInfinitive()
+{
+  if(vtkMapper* aMapper = myDeviceActor->GetMapper()){
+    if(vtkDataSet* aDataSet= aMapper->GetInput()){
+      aDataSet->Update();
+      myIsInfinite = aDataSet->GetNumberOfCells() < 2;
+    }
+  }
+  return myIsInfinite;
+}
+
+//----------------------------------------------------------------------------
+bool VISU_GaussPtsAct::PreHighlight(vtkInteractorStyle* theInteractorStyle, 
+                                   SVTK_SelectionEvent* theSelectionEvent,
+                                   bool theIsHighlight)
+{
+  myPreHighlightActor->SetVisibility(false);
+  myCursorPyramid->SetVisibility(false);  
+
+  if (!myBarVisibility) {
+    return false;
+  }
+
+  if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight)
+    return Superclass::PreHighlight(theInteractorStyle,
+                                   theSelectionEvent,
+                                   theIsHighlight);
+
+
+  bool anIsSelectionModeChanged = (theSelectionEvent->mySelectionMode != mySelectionMode);
+  if(!anIsSelectionModeChanged && mySelectionMode == ActorSelection)
+    return false;
+
+  mySelectionMode = theSelectionEvent->mySelectionMode;
+
+  bool anIsChanged = false;
+  if(theIsHighlight){
+    switch(mySelectionMode){
+    case NodeSelection: 
+    case CellSelection:
+    {
+      myPointPicker->Pick(theSelectionEvent->myX, 
+                         theSelectionEvent->myY, 
+                         0.0, 
+                         theInteractorStyle->GetCurrentRenderer());
+
+      if(myPointPicker->GetActor() != this)
+       return false;
+      
+      vtkIdType aVtkId = myPointPicker->GetPointId();
+      
+      if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
+       vtkIdType anObjId = GetNodeObjId( aVtkId );
+       if(myLastObjPointID != anObjId){
+         float* aNodeCoord = GetNodeCoord(anObjId);
+         vtkDataSet* aDataSet = GetInput();
+         vtkCellData* aCellData = aDataSet->GetCellData();
+         if(vtkDataArray *aScalarArray = aCellData->GetScalars()){
+           float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
+           float aPyramidHeight = myPickingSettings->GetPyramidHeight();
+           aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+           myCursorPyramid->Init(aPyramidHeight,
+                                 aRadius,
+                                 aNodeCoord,
+                                 myPreHighlightActor->GetProperty()->GetColor()); 
+         }
+         myLastObjPointID = anObjId;
+       }
+       myCursorPyramid->SetVisibility(true);
+       myIsPreselected = theIsHighlight;
+       anIsChanged = true;
+      }
+    }
+    break;
+    }
+  }
+
+  return anIsChanged;
+}
+
+
+//----------------------------------------------------------------------------
+bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle, 
+                                SVTK_SelectionEvent* theSelectionEvent,
+                                bool theIsHighlight)
+{ 
+  if (!myBarVisibility) {
+    return false;
+  }
+  //
+  Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
+  //
+  if(aSelectionMode == ActorSelection){
+    return Superclass::Highlight(theInteractorStyle,
+                                theSelectionEvent,
+                                theIsHighlight);
+  }
+  //
+  if(!theSelectionEvent->myIsRectangle){
+
+    vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
+    myPointPicker->Pick(theSelectionEvent->myX, 
+                       theSelectionEvent->myY,
+                       0.0, 
+                       aRenderer);
+
+    if(myPointPicker->GetActor() != this) {
+      mySelector->ClearIObjects();
+      return true;
+    }
+
+    vtkIdType aVtkId = myPointPicker->GetPointId();
+    if( aVtkId >= 0  && mySelector->IsValid( this, aVtkId, true ) && hasIO()) {
+      vtkIdType anObjId = GetNodeObjId( aVtkId );
+      if(anObjId >= 0){
+       // Update the Selector
+       if(mySelector->IsSelected(myIO))
+         mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
+       else{
+         if(!theSelectionEvent->myIsShift){
+           mySelector->ClearIObjects();
+         }
+         mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
+         mySelector->AddIObject(this);
+       }
+       //
+       float* aNodeCoord = GetNodeCoord(anObjId);
+       //
+       // FlyTo
+       vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
+       float aDollyWas = anInteractor->GetDolly();
+       int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+       
+       anInteractor->SetDolly(0.);
+       anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
+       anInteractor->FlyTo(aRenderer,aNodeCoord);
+       aRenderer->ResetCameraClippingRange();
+       anInteractor->SetDolly(aDollyWas);
+       anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+       
+       mySelectionMode = aSelectionMode;
+
+       return true;
+       //
+      }// if( anObjId >= 0 ) {
+    }//if( aVtkId >= 0  && mySelector->IsValid( this, aVtkId, true ) && hasIO()) 
+  }//if(!theSelectionEvent->myIsRectangle){
+  
+  return false;
+}
+
+//==================================================================
+// function : Highlight
+// purpose  :
+//==================================================================
+void
+VISU_GaussPtsAct
+::Highlight(bool theIsHighlight)
+{
+  myOutlineActor->SetVisibility(false);
+  myTextActor->SetVisibility(0);
+  myCursorPyramidSelected->SetVisibility(0);
+  myCursorPyramid->SetVisibility(0);
+  myCellActor->SetVisibility(0);
+  GetScalarBarCtrl()->SetIsMarked(false);
+  GetScalarBarCtrl()->Update();
+
+  bool anIsVisible = GetVisibility();
+
+  if(mySelector->SelectionMode() == ActorSelection)
+    Superclass::highlight(theIsHighlight);
+
+  TColStd_IndexedMapOfInteger aMapIndex;
+  mySelector->GetIndex( getIO(), aMapIndex );
+  if(aMapIndex.Extent() != 1 || !myBarVisibility) {
+    return;
+  }
+  //
+  std::ostringstream aStr;
+  int anObjId = aMapIndex(1);
+  aStr<<"Global ID: "<<anObjId;
+  //
+  vtkIdType aVtkId = GetNodeVTKID(anObjId);
+  if(aVtkId >= 0){
+    float *aNodeCoord, aVal, aRadius;
+    //
+    aNodeCoord = GetNodeCoord(anObjId);
+    float aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
+    //
+    vtkDataSet* aDataSet = GetInput();
+    vtkCellData* aCellData = aDataSet->GetCellData();
+    //
+    vtkDataArray* aScalarArray = aCellData->GetScalars();
+    vtkDataArray *aVectorArray = aCellData->GetVectors();
+    // 
+    if(aScalarArray){
+      aVal = aScalarArray->GetTuple1(aVtkId);
+      aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
+      //
+      GetScalarBarCtrl()->SetIsMarked(true);
+      GetScalarBarCtrl()->SetMarkValue(aVal);
+      GetScalarBarCtrl()->Update();
+      //
+      float aPyramidHeight = myPickingSettings->GetPyramidHeight();
+      aPyramidHeight=aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
+      myCursorPyramidSelected->Init(aPyramidHeight,
+                                   aRadius,
+                                   aNodeCoord,
+                                   myHighlightActor->GetProperty()->GetColor());
+      myCursorPyramidSelected->SetVisibility(anIsVisible && theIsHighlight);
+      //
+      const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = 
+       myGaussPointsPL->GetGaussPtsIDMapper();
+      VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
+      
+      VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId);
+      VISU::TCellID aCellID = aGaussPointID.first;
+      VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
+      aStr<<"\nParentCellID: "<<aCellID;
+      std::string aParentName = aParent->GetElemName(aCellID);
+      if(aParentName != "") {
+       aStr<<"\nParentCellName: '"<<aParentName<<"'";
+      }
+      aStr<<"\nLocalPntID: "<<aLocalPntID;
+      aStr<<"\nScalar: "<<aVal;
+    }
+    if(aVectorArray) {
+      float* pVec = aVectorArray->GetTuple3(aVtkId);
+      aStr<<"\nVector: {"<<pVec[0]<<"; "<<pVec[1]<<"; "<<pVec[2]<<"}";
+    }
+    //
+    // myTextActor
+    std::string aString=aStr.str();
+    myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
+    myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+    myTextActor->SetWorldPoint(aWorldCoord);
+    myTextActor->SetText(aString.c_str());
+    myTextActor->SetVisibility(anIsVisible && theIsHighlight);
+    //
+    // myCellActor
+    if(myPickingSettings->GetDisplayParentMesh()){
+      const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper = 
+       myGaussPointsPL->GetGaussPtsIDMapper();
+      VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
+      
+      myCellSource->Reset();
+      myCellSource->Modified(); // a VTK bug
+      myCellSource->SetPoints(aParent->GetVTKOutput()->GetPoints());
+      
+      VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
+      vtkIdType aCellID = aGaussPointID.first;
+      vtkCell* aCell = aParent->GetElemCell(aCellID);
+      myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+      myCellActor->GetProperty()->SetRepresentationToWireframe(); // VTK bug
+      myCellActor->SetVisibility(anIsVisible && theIsHighlight);
+    }
+  }
+}
+
+
+//----------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
+{
+  if(myPickingSettings == thePickingSettings)
+    return;
+
+  if(myPickingSettings)
+    myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+  myPickingSettings = thePickingSettings;
+
+  if(thePickingSettings)
+    thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent, 
+                                   myEventCallbackCommand.GetPointer(), 
+                                   myPriority);
+}
+
+void
+VISU_GaussPtsAct
+::UpdatePickingSettings()
+{
+  // Update picking parameters using myPickingSettings object
+  myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
+  myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+  float aHeight=
+    myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
+  myCursorPyramid->SetHeight(aHeight);
+  myCursorPyramidSelected->SetHeight(aHeight);
+  //
+  Highlight(isHighlighted());
+
+  Update();
+}
+
+//==============================================================================
+vtkStandardNewMacro(VISU_GaussPtsAct1);
+
+
+//----------------------------------------------------------------------------
+VISU_GaussPtsAct1
+::VISU_GaussPtsAct1():
+  myInsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
+  myOutsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
+  myOutsideCursorSettings(NULL)
+{
+  if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::VISU_GaussPtsAct1 - this = "<<this);
+
+  myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
+
+  myInsideDeviceActor->SetProperty(GetProperty());
+  myInsideDeviceActor->SetVisibility(false);
+  myInsideDeviceActor->SetPickable(false);
+  myInsideDeviceActor->Delete();
+
+  myOutsideDeviceActor->SetVisibility(false);
+  myOutsideDeviceActor->SetPickable(false);
+  myOutsideDeviceActor->Delete();
+}
+
+VISU_GaussPtsAct1
+::~VISU_GaussPtsAct1()
+{
+  if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::~VISU_GaussPtsAct1 - this = "<<this);
+
+  SetOutsideCursorSettings(NULL);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::ShallowCopyPL - this = "<<this);
+
+  Superclass::ShallowCopyPL(thePipeLine);
+
+  VISU_GaussPointsPL* aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
+
+  myInsideDeviceActor->ShallowCopyPL(aPipeLine);
+
+  // Restore implicit function
+  if(myWidget){
+    vtkImplicitFunction* aFunction = myWidget->ImplicitFunction();
+    myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::AddToRender(vtkRenderer* theRenderer)
+{
+  Superclass::AddToRender(theRenderer);
+
+  myInsideDeviceActor->AddToRender(theRenderer);
+  myOutsideDeviceActor->AddToRender(theRenderer);
+}
+
+void 
+VISU_GaussPtsAct1
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  Superclass::RemoveFromRender(theRenderer);
+
+  myInsideDeviceActor->RemoveFromRender(theRenderer);
+  myOutsideDeviceActor->RemoveFromRender(theRenderer);
+}
+
+void 
+VISU_GaussPtsAct1
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  Superclass::SetTransform(theTransform);
+
+  myInsideDeviceActor->SetTransform(theTransform);
+  myOutsideDeviceActor->SetTransform(theTransform);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
+{
+  if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetImplicitFunctionWidget - this = "<<this);
+
+  if(myWidget == theWidget)
+    return;
+
+  if(myWidget){
+    myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);
+    myInsideDeviceActor->SetVisibility(false);
+
+    myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);  
+    myOutsideDeviceActor->SetVisibility(false);
+
+    myCurrentPL = myDeviceActor->GetPipeLine();
+  }
+
+  if(theWidget){
+    myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
+    myInsideDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled());
+
+    myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());  
+    myOutsideDeviceActor->SetVisibility(GetVisibility() && theWidget->IsEnabled());
+
+    myCurrentPL = myInsideDeviceActor->GetPipeLine();
+  }
+
+  Superclass::SetImplicitFunctionWidget(theWidget);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetMapperInput - this = "<<this);
+
+  Superclass::SetMapperInput(theDataSet);
+
+  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+    myInsideDeviceActor->SetPipeLine(aPipeLine);
+  }
+
+  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+    myOutsideDeviceActor->SetPipeLine(aPipeLine);
+
+    myOutsideDeviceActor->GetMapper()->ScalarVisibilityOff();
+
+    myOutsideDeviceActor->GetPipeLine()->SetExtractInside(true);
+  }
+}
+
+
+//----------------------------------------------------------------
+void 
+VISU_GaussPtsAct1
+::Connect(VISU_GaussPtsAct2* theActor)
+{
+  mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct2::SetVisibility,theActor,_1));
+}
+
+void
+VISU_GaussPtsAct1
+::SetVisibility(int theMode)
+{
+  if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetVisibility - this = "<<this);
+
+  Superclass::SetVisibility(theMode);
+
+  myDeviceActor->SetVisibility(GetVisibility() && !myWidget->IsEnabled());
+
+  myInsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+  myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+
+  mySetVisibilitySignal(GetVisibility());
+}
+
+//----------------------------------------------------------------
+void
+VISU_GaussPtsAct1
+::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings)
+{
+  if(myOutsideCursorSettings == theOutsideCursorSettings)
+    return;
+
+  if(myOutsideCursorSettings)
+    myOutsideCursorSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+  myOutsideCursorSettings = theOutsideCursorSettings;
+
+  if(theOutsideCursorSettings)
+    theOutsideCursorSettings->AddObserver(VISU::UpdateOutsideSettingsEvent, 
+                                         myEventCallbackCommand.GetPointer(), 
+                                         myPriority);
+}
+
+void
+VISU_GaussPtsAct1
+::UpdateOutsideCursorSettings()
+{
+  VISU_GaussPointsPL* aPipeline = myOutsideDeviceActor->GetPipeLine();
+
+  aPipeline->SetClamp( myOutsideCursorSettings->GetClamp() );
+  aPipeline->SetImageData( myOutsideCursorSettings->GetTexture() );
+  aPipeline->SetAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() );
+  aPipeline->SetSize( myOutsideCursorSettings->GetSize() );
+
+  myOutsideDeviceActor->GetPSMapper()->SetPointSpriteResults(false);
+  myOutsideDeviceActor->GetProperty()->SetColor(myOutsideCursorSettings->GetColor());
+
+  Update();
+}
+
+
+//----------------------------------------------------------------
+void 
+VISU_GaussPtsAct1
+::ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData)
+{
+  if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
+    if(VISU_GaussPtsAct1* self = dynamic_cast<VISU_GaussPtsAct1*>(anObject))
+      if(theEvent == VISU::UpdateOutsideSettingsEvent)
+       self->UpdateOutsideCursorSettings();
+
+  Superclass::ProcessEvents(theObject,theEvent,theClientData,theCallData);
+}
+
+void
+VISU_GaussPtsAct1
+::OnInteractorEvent(unsigned long theEvent)
+{
+  switch(theEvent){
+  case vtkCommand::EnableEvent: 
+  case vtkCommand::DisableEvent:
+    myDeviceActor->SetVisibility(GetVisibility() && !myWidget->IsEnabled());
+    myInsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+    myOutsideDeviceActor->SetVisibility(GetVisibility() && myWidget->IsEnabled());
+    break;
+  default:
+    break;
+  }
+
+  
+  switch(theEvent){
+  case vtkCommand::EnableEvent: 
+    myCurrentPL = myInsideDeviceActor->GetPipeLine();
+    break;
+  case vtkCommand::DisableEvent:
+    myCurrentPL = myDeviceActor->GetPipeLine();
+    break;
+  default:
+    break;
+  }
+  
+  Superclass::OnInteractorEvent(theEvent);
+}
+
+
+//==============================================================================
+vtkStandardNewMacro(VISU_GaussPtsAct2);
+
+
+//----------------------------------------------------------------------------
+VISU_GaussPtsAct2
+::VISU_GaussPtsAct2()
+{
+  if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::VISU_GaussPtsAct2 - this = "<<this);
+  myDeviceActor->SetVisibility(false);
+}
+
+VISU_GaussPtsAct2
+::~VISU_GaussPtsAct2()
+{
+  if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::~VISU_GaussPtsAct2 - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::ShallowCopyPL(VISU_PipeLine* thePipeLine)
+{
+  if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::ShallowCopyPL - this = "<<this);
+
+  Superclass::ShallowCopyPL(thePipeLine);
+  // Restore implicit function
+  if(myWidget){
+    vtkImplicitFunction* aFunction = myWidget->ImplicitFunction();
+    myDeviceActor->GetPipeLine()->SetImplicitFunction(aFunction);
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::SetMapperInput(vtkDataSet* theDataSet) 
+{
+  if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetMapperInput - this = "<<this);
+
+  Superclass::SetMapperInput(theDataSet);
+
+  if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
+    myDeviceActor->SetPipeLine(aPipeLine);
+    myCurrentPL = aPipeLine;
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
+{
+  if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetImplicitFunctionWidget - this = "<<this);
+
+  if(myWidget == theWidget)
+    return;
+
+  if(myWidget){
+    theWidget->RemoveObserver(myEventCallbackCommand.GetPointer());
+    myDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);
+    myDeviceActor->SetVisibility(false);
+  }
+
+  if(theWidget){
+    myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
+    myDeviceActor->SetVisibility(Superclass::GetVisibility() && theWidget->IsEnabled());
+  }
+
+  Superclass::SetImplicitFunctionWidget(theWidget);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2
+::SetVisibility(int theMode)
+{
+  if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetVisibility - this = "<<this);
+
+  Superclass::SetVisibility(theMode);
+
+  myDeviceActor->SetVisibility(Superclass::GetVisibility() && myWidget->IsEnabled());
+}
+
+int
+VISU_GaussPtsAct2
+::GetVisibility()
+{
+  return Superclass::GetVisibility() && myWidget->IsEnabled();
+}
+
+void
+VISU_GaussPtsAct2
+::OnInteractorEvent(unsigned long theEvent)
+{
+  switch(theEvent){
+  case vtkCommand::EnableEvent: 
+  case vtkCommand::DisableEvent:
+    myDeviceActor->SetVisibility(Superclass::GetVisibility() && myWidget->IsEnabled());
+    if (theEvent==vtkCommand::EnableEvent){
+      Update();
+    }
+    break;
+  case vtkCommand::EndInteractionEvent:
+    Update();
+    break;
+  default:
+    break;
+  }
+  Superclass::OnInteractorEvent(theEvent);
+}
diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h
new file mode 100644 (file)
index 0000000..05accb6
--- /dev/null
@@ -0,0 +1,371 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VISU_ScalarMapAct.h
+//  Author : Laurent CORNABE with help of Nicolas REJNERI
+//  Module : VISU
+//  $Header$
+
+#ifndef VISU_GaussPtsAct_HeaderFile
+#define VISU_GaussPtsAct_HeaderFile
+
+#include "VISU_Actor.h"
+#include "VISU_GaussPtsActorFactory.h"
+
+#include <vtkCommand.h>
+#include <vtkSmartPointer.h>
+
+class VISU_GaussPointsPL;
+class VISU_ImplicitFunctionWidget;
+class VISU_OpenGLPointSpriteMapper;
+
+class vtkTextMapper;
+class vtkTextActor;
+
+class vtkSphereSource;
+class vtkPolyDataMapper;
+class vtkActor;
+class vtkImageData;
+class vtkInteractorStyle;
+
+class VISU_GaussPtsDeviceActor;
+class VISU_CursorPyramid;
+class VISU_FramedTextActor;
+
+class vtkUnstructuredGrid;
+class vtkDataSetMapper;
+
+class vtkInteractorObserver;
+class vtkCallbackCommand;
+
+class VISU_ScalarBarCtrl;
+class VISU_PickingSettings;
+class VISU_OutsideCursorSettings;
+
+
+//============================================================================
+class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsAct,VISU_Actor);
+  typedef vtkSmartPointer<VISU_GaussPtsDeviceActor> PDeviceActor;
+
+  static
+  VISU_GaussPtsAct* 
+  New();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetPipeLine(VISU_PipeLine* thePipeLine) ;
+  
+  VISU_GaussPointsPL*
+  GetGaussPointsPL();
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  vtkMapper* 
+  GetMapper();
+
+  virtual
+  float* 
+  GetBounds();
+
+  virtual
+  vtkDataSet* 
+  GetInput(); 
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetFactory(VISU::TActorFactory* theActorFactory);
+  
+  VISU::TGaussPtsActorFactory*
+  GetGaussPtsFactory();    
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  AddToRender(vtkRenderer* theRenderer); 
+
+  virtual
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+  virtual
+  void
+  SetInteractor(vtkRenderWindowInteractor* theInteractor);
+
+  virtual
+  void
+  SetTransform(VTKViewer_Transform* theTransform);
+
+  virtual
+  int
+  RenderOpaqueGeometry(vtkViewport *viewport);
+
+  virtual
+  int
+  RenderTranslucentGeometry(vtkViewport *viewport);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetVisibility(int theMode);
+
+  VISU_ScalarBarCtrl* 
+  GetScalarBarCtrl();
+
+  void
+  SetBarVisibility(bool theMode);
+
+  bool
+  GetBarVisibility();
+
+  virtual
+  void
+  SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
+
+  bool
+  ChangeMagnification();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  Highlight(bool theIsHighlight);
+  virtual
+  bool
+  PreHighlight(vtkInteractorStyle* theInteractorStyle, 
+              SVTK_SelectionEvent* theSelectionEvent,
+              bool theIsHighlight);
+  virtual
+  bool
+  Highlight(vtkInteractorStyle* theInteractorStyle, 
+           SVTK_SelectionEvent* theSelectionEvent,
+           bool theIsHighlight);
+
+  //----------------------------------------------------------------------------
+  void
+  SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+
+  void
+  UpdatePickingSettings();
+
+  virtual
+  bool
+  IsInfinitive();
+
+ protected:
+  //----------------------------------------------------------------------------
+  VISU_GaussPtsAct();
+
+  virtual 
+  ~VISU_GaussPtsAct();
+
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  virtual
+  VISU_PipeLine* 
+  GetCurrentPL();
+
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+  virtual
+  void
+  OnInteractorEvent(unsigned long theEvent);
+
+  float myPriority;
+  bool myChangeMagnification;
+  VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
+  boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
+
+  //----------------------------------------------------------------------------
+  PDeviceActor myDeviceActor;
+
+  VISU_ImplicitFunctionWidget* myWidget;
+
+  VISU_GaussPointsPL* myCurrentPL;
+  vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
+
+  vtkIdType myLastObjPointID;
+
+  vtkSmartPointer<VISU_FramedTextActor> myTextActor;
+
+  vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
+  vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
+  
+  vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
+  vtkSmartPointer<vtkActor> myCellActor;
+
+  bool myBarVisibility;
+  vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
+
+  VISU_PickingSettings* myPickingSettings;
+};
+
+
+//============================================================================
+class VISU_GaussPtsAct2;
+
+class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
+
+  static
+  VISU_GaussPtsAct1* 
+  New();
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetVisibility(int theMode);
+
+  virtual 
+  void
+  Connect(VISU_GaussPtsAct2* theActor);
+
+  //----------------------------------------------------------------------------
+  void
+  SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
+
+  void
+  UpdateOutsideCursorSettings();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  AddToRender(vtkRenderer* theRenderer); 
+
+  virtual
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+  virtual
+  void
+  SetTransform(VTKViewer_Transform* theTransform);
+
+  virtual
+  void
+  SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
+
+ protected:
+  //----------------------------------------------------------------------------
+  VISU_GaussPtsAct1();
+
+  virtual 
+  ~VISU_GaussPtsAct1();
+
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  //----------------------------------------------------------------------------
+  // Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+
+  // To process VTK event method
+  virtual 
+  void
+  OnInteractorEvent(unsigned long theEvent);
+
+  boost::signal1<void,int> mySetVisibilitySignal;
+  VISU_OutsideCursorSettings* myOutsideCursorSettings;
+
+  //----------------------------------------------------------------------------
+  PDeviceActor myInsideDeviceActor;
+  PDeviceActor myOutsideDeviceActor;
+};
+
+
+//============================================================================
+class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
+
+  static
+  VISU_GaussPtsAct2* 
+  New();
+
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  virtual
+  void
+  ShallowCopyPL(VISU_PipeLine* thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  SetVisibility(int theMode);
+
+  virtual
+  int
+  GetVisibility();
+
+  virtual
+  void
+  SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
+
+ protected:
+  //----------------------------------------------------------------------------
+  VISU_GaussPtsAct2();
+
+  virtual 
+  ~VISU_GaussPtsAct2();
+
+  //----------------------------------------------------------------------------
+  // To process VTK event method
+  virtual 
+  void
+  OnInteractorEvent(unsigned long theEvent);
+};
+
+
+#endif
diff --git a/src/OBJECT/VISU_GaussPtsActorFactory.h b/src/OBJECT/VISU_GaussPtsActorFactory.h
new file mode 100644 (file)
index 0000000..9557c60
--- /dev/null
@@ -0,0 +1,54 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VISU_ScalarMapAct.h
+//  Author : Laurent CORNABE with help of Nicolas REJNERI
+//  Module : VISU
+//  $Header$
+
+#ifndef VISU_GAUSSPTS_ACTOR_FACTORY_H
+#define VISU_GAUSSPTS_ACTOR_FACTORY_H
+
+#include "VISU_ActorFactory.h"
+
+class VISU_GaussPtsAct;
+class VISU_GaussPtsAct1;
+class VISU_GaussPtsAct2;
+
+//----------------------------------------------------------------------------
+namespace VISU 
+{ 
+  struct TGaussPtsActorFactory: virtual TActorFactory
+  {
+    virtual 
+    VISU_GaussPtsAct2* 
+    CloneActor(VISU_GaussPtsAct1* theActor) = 0;
+
+    virtual 
+    void
+    UpdateFromActor(VISU_GaussPtsAct* theActor) = 0;
+  };
+}
+
+
+#endif
diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx
new file mode 100644 (file)
index 0000000..86eb25d
--- /dev/null
@@ -0,0 +1,562 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  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   :
+//  Author : 
+//  Module :
+//  $Header$
+
+
+#include "VISU_GaussPtsDeviceActor.h"
+
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include "VTKViewer_Transform.h"
+#include "VTKViewer_TransformFilter.h"
+#include "VTKViewer_PassThroughFilter.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkPolyData.h>
+#include <vtkRenderer.h>
+#include <vtkTextProperty.h>
+#include "utilities.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+using namespace std;
+
+
+//----------------------------------------------------------------
+vtkStandardNewMacro(VISU_GaussPtsDeviceActor);
+
+
+VISU_GaussPtsDeviceActor
+::VISU_GaussPtsDeviceActor():
+  myGeomFilter(VTKViewer_GeometryFilter::New()),
+  myTransformFilter(VTKViewer_TransformFilter::New())
+{
+  if(MYDEBUG) MESSAGE("VISU_GaussPtsDeviceActor - "<<this);
+
+  myGeomFilter->Delete();
+  myTransformFilter->Delete();
+
+  for(int i = 0; i < 3; i++){
+    PPassThroughFilter aFilter(VTKViewer_PassThroughFilter::New());
+    myPassFilter.push_back(aFilter);
+    aFilter->Delete();
+  }
+}
+
+
+VISU_GaussPtsDeviceActor
+::~VISU_GaussPtsDeviceActor()
+{
+  if(MYDEBUG) MESSAGE("~VISU_GaussPtsDeviceActor - "<<this);
+}
+
+
+//----------------------------------------------------------------
+void
+VISU_GaussPtsDeviceActor
+::AddToRender(vtkRenderer* theRenderer)
+{
+  theRenderer->AddActor(this);
+}
+
+void 
+VISU_GaussPtsDeviceActor
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  theRenderer->RemoveActor(this);
+}
+
+void
+VISU_GaussPtsDeviceActor
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  myTransformFilter->SetTransform(theTransform);
+}
+
+VISU_OpenGLPointSpriteMapper*
+VISU_GaussPtsDeviceActor
+::GetPSMapper()
+{
+  return myMapper.GetPointer();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsDeviceActor
+::SetPipeLine(VISU_GaussPointsPL* thePipeLine) 
+{
+  myPipeLine = thePipeLine;
+  myMapper = thePipeLine->GetPSMapper();
+  vtkPolyData* aDataSet = myMapper->GetInput();
+
+  int anId = 0;
+  myPassFilter[ anId ]->SetInput( aDataSet ); 
+  myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() );
+  
+  anId++;
+  myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+  
+  anId++;
+  myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() );
+  
+  myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
+  
+  Superclass::SetMapper( myMapper.GetPointer() );
+}
+
+VISU_GaussPointsPL* 
+VISU_GaussPtsDeviceActor
+::GetPipeLine() 
+{ 
+  return myPipeLine.GetPointer();
+}
+
+void
+VISU_GaussPtsDeviceActor
+::ShallowCopyPL(VISU_GaussPointsPL* thePipeLine)
+{
+  myPipeLine->ShallowCopy(thePipeLine);
+}
+
+
+//============================================================================
+#include <vtkActor.h>
+#include <vtkProperty.h>
+#include <vtkConeSource.h>
+#include <vtkPolyDataMapper.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_CursorPyramid);
+
+
+//----------------------------------------------------------------------------
+void
+VISU_CursorPyramid
+::AddToRender(vtkRenderer* theRenderer)
+{ 
+  for(int i = 0; i < myNbCones; ++i)
+    theRenderer->AddActor(myActors[i].GetPointer());
+}
+
+void
+VISU_CursorPyramid
+::RemoveFromRender(vtkRenderer* theRenderer)
+{ 
+  for(int i = 0; i < myNbCones; ++i)
+    theRenderer->RemoveActor(myActors[i].GetPointer());
+}
+
+void
+VISU_CursorPyramid
+::SetVisibility(int theVisibility)
+{
+  for(int i = 0; i < myNbCones; ++i)
+    myActors[i]->SetVisibility(theVisibility);
+}
+//----------------------------------------------------------------------------
+void VISU_CursorPyramid::SetHeight(float theHeight)
+{
+  Init(theHeight, myRadius, myPos, myColor);
+}
+//----------------------------------------------------------------------------
+void
+VISU_CursorPyramid
+::Init(float theHeight,
+       float theRadius,
+       float thePos[3],
+       float theColor[3])
+{
+  int i;
+  myHeight=theHeight;
+  myRadius=theRadius;
+  for (i=0; i<3; ++i){
+    myPos[i]=thePos[i];
+    myColor[i]=theColor[i];
+  }
+  for(i = 0; i < myNbCones; ++i){
+    mySources[i]->SetHeight(theHeight);
+    // Set the angle of the cone. As a side effect, the angle plus height sets 
+    // the base radius of the cone.
+    mySources[i]->SetAngle(20.0);
+    
+    myActors[i]->SetPosition(thePos[0],thePos[1],thePos[2]);
+    myActors[i]->GetProperty()->SetColor(theColor);
+  }
+  
+  float aD = -0.5*theHeight - theRadius;
+  
+  // X
+  mySources[0]->SetCenter(aD, 0.,0.);
+  mySources[1]->SetCenter(aD, 0.,0.);
+  
+  // Y
+  mySources[2]->SetDirection(0., 1., 0.);
+  mySources[2]->SetCenter(0, aD, 0.);
+  
+  mySources[3]->SetDirection(0., 1., 0.); 
+  mySources[3]->SetCenter(0., aD, 0.);
+  
+  // Z
+  mySources[4]->SetDirection(0., 0., 1.); 
+  mySources[4]->SetCenter(0, 0., aD);
+  
+  mySources[5]->SetDirection(0., 0., 1.); 
+  mySources[5]->SetCenter(0., 0., aD);
+}
+
+//----------------------------------------------------------------------------
+VISU_CursorPyramid
+::VISU_CursorPyramid():
+  myNbCones(6)
+{
+  int i;
+  for(i = 0; i < myNbCones; i++){
+    vtkConeSource* aConeSource = vtkConeSource::New();
+    aConeSource->SetResolution(4);
+    
+    vtkPolyDataMapper* aPolyDataMapper = vtkPolyDataMapper::New();
+    aPolyDataMapper->SetInput(aConeSource->GetOutput());
+    aConeSource->Delete();
+    
+    vtkActor* anActor = vtkActor::New();
+    anActor->SetMapper(aPolyDataMapper);
+    anActor->SetVisibility(0);
+    anActor->SetPickable(0);
+    aPolyDataMapper->Delete();
+    
+    mySources[i] = aConeSource;
+    myMappers[i] = aPolyDataMapper;
+    myActors[i] = anActor; 
+    anActor->Delete();
+  }
+  
+  myActors[1]->SetOrientation(0.  ,180.,0.);
+  myActors[3]->SetOrientation(0.  , 0. ,180.);
+  myActors[5]->SetOrientation(180., 0. ,0.);
+  //
+  myHeight=10.;
+  myRadius=5.;
+  for(i = 0; i < 3; ++i){ 
+    myPos[i]=0.;
+    myColor[i]=1.;
+  }
+}
+
+#include <vtkViewport.h>
+#include <vtkWindow.h>
+#include <vtkProp.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper2D.h>
+#include <vtkActor2D.h>
+#include <vtkTimeStamp.h>
+#include <vtkTextProperty.h>
+#include <vtkTextActor.h>
+#include <vtkTextMapper.h>
+#include <vtkPoints.h>
+#include <vtkCellArray.h>
+#include <vtkProperty2D.h>
+//==================================================================
+vtkCxxRevisionMacro(VISU_FramedTextActor, "$Revision$");
+vtkStandardNewMacro(VISU_FramedTextActor);
+
+//==================================================================
+// function : VISU_FramedTextActor
+// purpose  :
+//==================================================================
+VISU_FramedTextActor::VISU_FramedTextActor()
+{
+  PositionCoordinate->SetCoordinateSystemToNormalizedViewport();
+
+  myTransparency=0.;
+  myBar = vtkPolyData::New();
+  myBarMapper = vtkPolyDataMapper2D::New();
+  myBarMapper->SetInput(myBar);
+  myBarActor = vtkActor2D::New();
+  myBarActor->SetMapper(myBarMapper);
+  myBarActor->GetProperty()->SetOpacity(1.-myTransparency);  
+  myBarActor->GetProperty()->SetColor(.5, .5, .5); 
+  //
+  myTextProperty = vtkTextProperty::New();
+  myTextProperty->SetFontSize(12);
+  myTextProperty->SetBold(0);
+  myTextProperty->SetItalic(0);
+  myTextProperty->SetShadow(1);
+  myTextProperty->SetFontFamilyToArial();
+  //
+  myTextMapper=vtkTextMapper::New();
+  myTextMapper->SetInput("some text");
+  myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
+  myTextActor=vtkActor2D::New();
+  myTextActor->SetMapper(myTextMapper);
+  //
+  myBarActor->SetVisibility(1);
+  myTextActor->SetVisibility(1);
+  myBarActor->SetPickable(0);
+  myTextActor->SetPickable(0);
+  //----------------------------------------------------------
+  myModePosition=0;// 0 -centered below the point
+                   // 1 -top left corner of the 3D view window
+  //
+  for(int i=0; i<4; i++) {
+    myWorldPoint[i] = 0.;
+  }
+  myDistance=10.;
+  //
+}
+//==================================================================
+// function : ~
+// purpose  :
+//==================================================================
+VISU_FramedTextActor::~VISU_FramedTextActor()
+{
+  myTextActor->Delete();
+  myTextMapper->Delete();
+  myTextProperty->Delete();
+  myBarActor->Delete();
+  myBarMapper->Delete();
+  myBar->Delete();
+}
+//==================================================================
+// function : SetVisibility
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetVisibility (int theVisibility)
+{
+  myBarActor->SetVisibility(theVisibility);
+  myTextActor->SetVisibility(theVisibility);
+}
+//==================================================================
+// function : GetVisibility
+// purpose  :
+//==================================================================
+int VISU_FramedTextActor::GetVisibility() 
+{
+  return myBarActor->GetVisibility();
+}
+//==================================================================
+// function : SetPickable
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetPickable (int thePickability) 
+{
+  myBarActor->SetPickable(thePickability);
+  myTextActor->SetPickable(thePickability);
+}
+//==================================================================
+// function : GetPickable
+// purpose  :
+//==================================================================
+int VISU_FramedTextActor::GetPickable()
+{
+  return myBarActor->GetPickable();
+}
+//==================================================================
+// function : SetTransparency
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetTransparency(const float theTransparency)
+{
+  if (theTransparency>=0.  && theTransparency<=1.){
+    myTransparency=theTransparency;
+    myBarActor->GetProperty()->SetOpacity(1.-myTransparency);  
+    Modified();
+  }
+}
+//==================================================================
+// function : GetTransparency
+// purpose  :
+//==================================================================
+float VISU_FramedTextActor::GetTransparency()const
+{
+  return myTransparency;
+}
+//==================================================================
+// function : SetText
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetText(const char* theText)
+{
+  myTextMapper->SetInput(theText); 
+  Modified();
+}
+//==================================================================
+// function : GetText
+// purpose  :
+//==================================================================
+char* VISU_FramedTextActor::GetText()
+{
+  return myTextMapper->GetInput();
+}
+//==================================================================
+// function : SetModePosition
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetModePosition(const int theMode)
+{
+  myModePosition=theMode;
+  Modified();
+}
+//==================================================================
+// function : GetModePosition
+// purpose  :
+//==================================================================
+int VISU_FramedTextActor::GetModePosition()const
+{
+  return myModePosition;
+}
+//==================================================================
+// function : SetWorldPoint
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetWorldPoint(const float theWorldPoint[4])
+{
+  for(int i = 0; i<4; ++i) {
+    myWorldPoint[i] = theWorldPoint[i];
+  } 
+  Modified();
+}
+//==================================================================
+// function : GetWorldPoint
+// purpose  :
+//==================================================================
+const float* VISU_FramedTextActor::GetWorldPoint()const 
+{
+  return myWorldPoint;
+}
+//==================================================================
+// function : SetDistance
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::SetDistance(const float theDistance)
+{
+  myDistance=theDistance;
+}
+//==================================================================
+// function : GetDistance
+// purpose  :
+//==================================================================
+float VISU_FramedTextActor::GetDistance()const
+{
+  return myDistance;
+}
+//==================================================================
+// function : ReleaseGraphicsResources
+// purpose  :
+//==================================================================
+void VISU_FramedTextActor::ReleaseGraphicsResources(vtkWindow *win)
+{
+  myTextActor->ReleaseGraphicsResources(win);
+  myBarActor->ReleaseGraphicsResources(win);
+}
+//==================================================================
+// function : RenderOverlay
+// purpose  :
+//==================================================================
+int VISU_FramedTextActor::RenderOverlay(vtkViewport *viewport)
+{
+  int renderedSomething = 0;
+  myBarActor->RenderOverlay(viewport);
+  renderedSomething +=myTextActor->RenderOverlay(viewport);
+  return renderedSomething;
+}
+//==================================================================
+// function : RenderOpaqueGeometry
+// purpose  :
+//==================================================================
+int VISU_FramedTextActor::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+  int renderedSomething=0;
+  int size[2];
+  int aTextSize[2], barWidth, barHeight; 
+  float x[3]={0.,0.,0.}; 
+  // 
+  int numPts=4;
+  vtkPoints *pts = vtkPoints::New();
+  pts->SetNumberOfPoints(numPts);
+  vtkCellArray *polys = vtkCellArray::New();
+  polys->Allocate(polys->EstimateSize(1,4));
+  //
+  myBar->Initialize();
+  myBar->SetPoints(pts);
+  myBar->SetPolys(polys);
+  pts->Delete(); polys->Delete(); 
+  //
+  myTextMapper->GetSize(viewport, aTextSize);
+  //
+  barWidth =aTextSize[0];
+  barHeight=aTextSize[1];
+  //
+  if (myModePosition==0) {
+    
+    float aSelectionPoint[3], u, v;
+    //
+    viewport->SetWorldPoint(myWorldPoint);
+    viewport->WorldToDisplay();
+    viewport->GetDisplayPoint(aSelectionPoint);
+    u=aSelectionPoint[0];
+    v=aSelectionPoint[1]-myDistance;
+    viewport->ViewportToNormalizedViewport(u, v);
+    //
+    PositionCoordinate->SetValue(u, v);
+    //
+    myTextProperty->SetJustificationToCentered ();
+    myTextProperty->SetVerticalJustificationToTop();
+    //
+    x[0]=-barWidth/2.  ; x[1]=0.         ;  pts->SetPoint(0,x);
+    x[0]=-barWidth/2.  ; x[1]=-barHeight ;  pts->SetPoint(1,x);
+    x[0]= barWidth/2   ; x[1]=0.         ;  pts->SetPoint(2,x);
+    x[0]= barWidth/2   ; x[1]=-barHeight ;  pts->SetPoint(3,x);
+  }
+  else {//if (myModePosition==1) {
+    PositionCoordinate->SetValue(0., 1.);
+    myTextProperty->SetJustificationToLeft();
+    myTextProperty->SetVerticalJustificationToTop();  
+    //
+    x[0]=0.          ; x[1]=0.         ;  pts->SetPoint(0,x);
+    x[0]=0.          ; x[1]=-barHeight ;  pts->SetPoint(1,x);
+    x[0]= barWidth   ; x[1]=0.         ;  pts->SetPoint(2,x);
+    x[0]= barWidth   ; x[1]=-barHeight ;  pts->SetPoint(3,x);
+  }
+  //
+  myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
+  myBarActor ->GetPositionCoordinate()->SetReferenceCoordinate(PositionCoordinate);
+  myTextActor->GetPositionCoordinate()->SetReferenceCoordinate(PositionCoordinate);
+  //
+  vtkIdType ptIds[4]={0,1,3,2};
+  polys->InsertNextCell(4,ptIds);
+  //
+  myBuildTime.Modified();
+  //
+  return renderedSomething;
+}
diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.h b/src/OBJECT/VISU_GaussPtsDeviceActor.h
new file mode 100644 (file)
index 0000000..4f4d5e3
--- /dev/null
@@ -0,0 +1,215 @@
+//  SMESH OBJECT : interactive object for SMESH visualization
+//
+//  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   : 
+//  Author : 
+//  Module : 
+//  $Header$
+
+#ifndef VISU_GAUSS_PTS_DEVICE_ACTOR_H
+#define VISU_GAUSS_PTS_DEVICE_ACTOR_H
+
+#include "VTKViewer_GeometryFilter.h"
+
+#include <vtkLODActor.h>
+#include <vtkSmartPointer.h>
+
+class VTKViewer_Transform;
+class VTKViewer_TransformFilter;
+class VTKViewer_PassThroughFilter;
+
+class VISU_OpenGLPointSpriteMapper;
+class VISU_GaussPointsPL;
+
+
+//============================================================================
+class VISU_GaussPtsDeviceActor: public vtkLODActor
+{
+ public:
+  vtkTypeMacro(VISU_GaussPtsDeviceActor,vtkLODActor);
+
+  static 
+  VISU_GaussPtsDeviceActor* 
+  New();
+
+  //----------------------------------------------------------------------------
+  void
+  AddToRender(vtkRenderer* theRenderer); 
+
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+  void
+  SetTransform(VTKViewer_Transform* theTransform); 
+
+  //----------------------------------------------------------------------------
+  VISU_GaussPointsPL* 
+  GetPipeLine();
+
+  void
+  SetPipeLine(VISU_GaussPointsPL* thePipeLine) ;
+
+  void
+  ShallowCopyPL(VISU_GaussPointsPL* thePipeLine);
+
+  VISU_OpenGLPointSpriteMapper*
+  GetPSMapper();
+
+ protected:
+  //----------------------------------------------------------------------------
+  vtkSmartPointer<VISU_GaussPointsPL> myPipeLine;
+  vtkSmartPointer<VISU_OpenGLPointSpriteMapper> myMapper;
+  vtkSmartPointer<VTKViewer_GeometryFilter> myGeomFilter;
+  vtkSmartPointer<VTKViewer_TransformFilter> myTransformFilter;
+
+  typedef vtkSmartPointer<VTKViewer_PassThroughFilter> PPassThroughFilter;
+  std::vector<PPassThroughFilter> myPassFilter;
+
+  VISU_GaussPtsDeviceActor();
+  ~VISU_GaussPtsDeviceActor();
+
+  VISU_GaussPtsDeviceActor(const VISU_GaussPtsDeviceActor&); // Not implemented
+  void operator=(const VISU_GaussPtsDeviceActor&); // Not implemented
+
+};
+
+
+//============================================================================
+class vtkActor;
+class vtkConeSource;
+class vtkPolyDataMapper;
+
+#include <vtkObject.h>
+
+class VISU_CursorPyramid : public vtkObject 
+{
+public:
+  vtkTypeMacro(VISU_CursorPyramid, vtkObject);
+
+  static
+  VISU_CursorPyramid* 
+  New();
+
+  void
+  AddToRender(vtkRenderer* theRenderer);
+
+  void
+  RemoveFromRender(vtkRenderer* theRenderer);
+
+  void
+  SetVisibility(int theVisibility);
+
+  void
+  Init(float theHeight,
+       float theRadius,
+       float thePos[3],
+       float theColor[3]);
+
+  void SetHeight(float theHeight);
+
+protected:
+  VISU_CursorPyramid();
+
+  int myNbCones;
+  vtkSmartPointer<vtkConeSource> mySources[6];
+  vtkSmartPointer<vtkPolyDataMapper> myMappers[6];
+  vtkSmartPointer<vtkActor> myActors[6];
+  //
+  float myHeight;
+  float myRadius;
+  float myPos[3];
+  float myColor[3];
+};
+//==================================================================
+// class VISU_FramedTextActor
+//
+#include <vtkActor2D.h>
+//
+class vtkViewport;
+class vtkProp;
+class vtkWindow;
+class vtkPolyData;
+class vtkPolyDataMapper2D;
+class vtkActor2D;
+class vtkTimeStamp;
+class vtkTextProperty;
+class vtkTextMapper;
+
+class VISU_FramedTextActor : public vtkActor2D
+{
+public:
+  // vtks
+  vtkTypeRevisionMacro(VISU_FramedTextActor,vtkActor2D);
+  static VISU_FramedTextActor *New();
+  //
+  virtual int  RenderOpaqueGeometry(vtkViewport* viewport);
+  virtual int  RenderTranslucentGeometry(vtkViewport*) { return 0; };
+  virtual int  RenderOverlay(vtkViewport* viewport);
+  virtual void ReleaseGraphicsResources(vtkWindow *);
+  virtual void SetVisibility (int );
+  virtual int  GetVisibility() ;
+  virtual void SetPickable (int ) ;
+  virtual int GetPickable();
+  //
+  // selectors
+  void SetText(const char* theText);
+  char* GetText();
+  //
+  void SetModePosition(const int theMode);
+  int  GetModePosition()const;
+  //
+  void SetWorldPoint(const float theWorldPoint[4]);
+  const float* GetWorldPoint()const;
+  //
+  void  SetDistance(const float theDistance);
+  float GetDistance()const;
+  //
+  void  SetTransparency(const float theTransparency);
+  float GetTransparency()const;
+  //
+protected:
+  VISU_FramedTextActor();
+  ~VISU_FramedTextActor();
+
+protected:
+  vtkPolyData         *myBar;
+  vtkPolyDataMapper2D *myBarMapper;
+  vtkActor2D          *myBarActor;
+  //
+  vtkTextProperty *myTextProperty;
+  vtkTextMapper   *myTextMapper;
+  vtkActor2D      *myTextActor;
+  //
+  vtkTimeStamp  myBuildTime;
+  //
+  int   myModePosition;
+  float myWorldPoint[4];
+  float myDistance;
+  float myTransparency;
+  
+private:
+ VISU_FramedTextActor(const VISU_FramedTextActor&);  // Not implemented.
+  void operator=(const VISU_FramedTextActor&);  // Not implemented.
+};
+
+#endif //VISU_GAUSS_PTS_DEVICE_ACTOR_H
diff --git a/src/OBJECT/VISU_GaussPtsSettings.cxx b/src/OBJECT/VISU_GaussPtsSettings.cxx
new file mode 100644 (file)
index 0000000..f60ae62
--- /dev/null
@@ -0,0 +1,72 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : VISU
+//  $Header$
+
+#include "VISU_GaussPtsSettings.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkImageData.h>
+
+//----------------------------------------------------------------
+vtkStandardNewMacro( VISU_OutsideCursorSettings );
+vtkStandardNewMacro( VISU_PickingSettings );
+
+//----------------------------------------------------------------
+VISU_OutsideCursorSettings::VISU_OutsideCursorSettings()
+{
+  this->Initial                = true;
+
+  this->Clamp                  = -1;
+  this->Texture                = NULL;
+  this->AlphaThreshold         = -1;
+  this->Size                   = -1;
+  this->Color[0]               = -1;
+  this->Color[1]               = -1;
+  this->Color[1]               = -1;
+}
+
+VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings()
+{
+  this->SetTexture( NULL );
+}
+
+//----------------------------------------------------------------
+VISU_PickingSettings::VISU_PickingSettings()
+{
+  this->Initial                = true;
+
+  this->PyramidHeight          = -1;
+  this->InfoWindowTransparency = -1;
+  this->InfoWindowPosition     = -1;
+  this->ZoomFactor             = -1;
+  this->StepNumber             = -1;
+  this->DisplayParentMesh      = false;
+}
+
+VISU_PickingSettings::~VISU_PickingSettings()
+{
+}
diff --git a/src/OBJECT/VISU_GaussPtsSettings.h b/src/OBJECT/VISU_GaussPtsSettings.h
new file mode 100644 (file)
index 0000000..e7618d7
--- /dev/null
@@ -0,0 +1,135 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : 
+//  Author : 
+//  Module : VISU
+//  $Header$
+
+#ifndef VISU_GaussPtsSettings_HeaderFile
+#define VISU_GaussPtsSettings_HeaderFile
+
+#include <vtkObject.h>
+#include <vtkCommand.h>
+
+class vtkImageData;
+
+
+//============================================================================
+namespace VISU
+{
+  const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 100; 
+  const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 200; 
+}
+
+class VISU_OutsideCursorSettings : public vtkObject
+{
+ public:
+  vtkTypeMacro( VISU_OutsideCursorSettings, vtkObject );
+
+  VISU_OutsideCursorSettings();
+  virtual ~VISU_OutsideCursorSettings();
+
+  static
+  VISU_OutsideCursorSettings*
+  New();
+
+  vtkSetMacro( Initial, bool );
+  vtkGetMacro( Initial, bool );
+
+  vtkSetMacro( Clamp, float );
+  vtkGetMacro( Clamp, float );
+
+  vtkSetMacro( Texture, vtkImageData* );
+  vtkGetMacro( Texture, vtkImageData* );
+
+  vtkSetMacro( AlphaThreshold, float );
+  vtkGetMacro( AlphaThreshold, float );
+
+  vtkSetMacro( Size, float );
+  vtkGetMacro( Size, float );
+
+  vtkSetVector3Macro( Color, float );
+  vtkGetVector3Macro( Color, float );
+
+private:
+  bool                Initial;
+
+  float               Clamp;
+  vtkImageData*       Texture;
+  float               AlphaThreshold;
+  float               Size;
+  float               Color[3];
+};
+
+
+//============================================================================
+class VISU_PickingSettings : public vtkObject
+{
+ public:
+  enum { BelowPoint = 0, TopLeftCorner };
+
+ public:
+  vtkTypeMacro( VISU_PickingSettings, vtkObject );
+
+  VISU_PickingSettings();
+  virtual ~VISU_PickingSettings();
+
+  static
+  VISU_PickingSettings*
+  New();
+
+  vtkSetMacro( Initial, bool );
+  vtkGetMacro( Initial, bool );
+
+  vtkSetMacro( PyramidHeight, float );
+  vtkGetMacro( PyramidHeight, float );
+
+  vtkSetMacro( InfoWindowTransparency, float );
+  vtkGetMacro( InfoWindowTransparency, float );
+
+  vtkSetMacro( InfoWindowPosition, int );
+  vtkGetMacro( InfoWindowPosition, int );
+
+  vtkSetMacro( ZoomFactor, float );
+  vtkGetMacro( ZoomFactor, float );
+
+  vtkSetMacro( StepNumber, int );
+  vtkGetMacro( StepNumber, int );
+
+  vtkSetMacro( DisplayParentMesh, bool );
+  vtkGetMacro( DisplayParentMesh, bool );
+
+private:
+  bool                Initial;
+
+  float               PyramidHeight;
+  float               InfoWindowTransparency;
+  int                 InfoWindowPosition;
+  float               ZoomFactor;
+  int                 StepNumber;
+  bool                DisplayParentMesh;
+};
+
+
+#endif
index 68f7446a6c7e2000cd61fb7644f9004c74f5ae94..b078270e071994ef6c048524073d4ae418920eae 100644 (file)
@@ -47,14 +47,12 @@ VISU_MeshAct::VISU_MeshAct(){
   m = vtkMatrix4x4::New();
 
   mySurfaceActor = VISU_Actor::New();
-  mySurfaceActor->SetParent(this);
   mySurfaceActor->GetProperty()->FrontfaceCullingOff();
   mySurfaceActor->GetProperty()->BackfaceCullingOff();
   mySurfaceActor->SetUserMatrix(m);
   mySurfaceActor->SetRepresentation(2); //SURFACE
 
   myEdgeActor = VISU_Actor::New();
-  myEdgeActor->SetParent(this);
   myEdgeActor->PickableOff();
   myEdgeActor->GetProperty()->FrontfaceCullingOff();
   myEdgeActor->GetProperty()->BackfaceCullingOff();
@@ -62,7 +60,6 @@ VISU_MeshAct::VISU_MeshAct(){
   myEdgeActor->SetRepresentation(1); //WIREFRAME
 
   myNodeActor = VISU_Actor::New();
-  myNodeActor->SetParent(this);
   myNodeActor->PickableOff();
   myNodeActor->GetProperty()->SetPointSize(SALOME_POINT_SIZE);
   myNodeActor->GetProperty()->FrontfaceCullingOff();
@@ -98,12 +95,12 @@ void VISU_MeshAct::SetPrs3d(VISU::Prs3d_i* thePrs3d){
 
 void VISU_MeshAct::AddToRender(vtkRenderer* theRenderer){
   VISU_Actor::AddToRender(theRenderer);
-  theRenderer->AddActor(myEdgeActor);
+  //theRenderer->AddActor(myEdgeActor);
 }
 
 void VISU_MeshAct::RemoveFromRender(vtkRenderer* theRenderer){
   VISU_Actor::RemoveFromRender(theRenderer);
-  theRenderer->RemoveActor(myEdgeActor);
+  //theRenderer->RemoveActor(myEdgeActor);
 }
 
 void VISU_MeshAct::SetPipeLine(VISU_PipeLine* thePipeLine) {
@@ -316,17 +313,20 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
     myNodeActor->GetProperty()->Render(this, ren);
     break;
   case 1: //WIREFRAME
-    //PAL5268: myEdgeActor->GetProperty()->Render(this, ren);
+    //PAL5268: 
+    myEdgeActor->GetProperty()->Render(this, ren);
     break;
   case 2: //SURFACE
     mySurfaceActor->GetProperty()->Render(this, ren);
     break;
   case 3: //INSIDEFRAME
-    //PAL5268: myEdgeActor->GetProperty()->Render(this, ren);
+    //PAL5268: 
+    myEdgeActor->GetProperty()->Render(this, ren);
     break;
   case 4: //SURFACEFRAME
-    //PAL5268: myEdgeActor->GetProperty()->Render(this, ren);
+    //PAL5268: 
     mySurfaceActor->GetProperty()->Render(this, ren);
+    myEdgeActor->GetProperty()->Render(this, ren);
     break;
   }
 
@@ -350,9 +350,9 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
     matrix = myEdgeActor->GetUserMatrix();
     break;
   case 4: //SURFACEFRAME
-    matrix = myEdgeActor->GetUserMatrix();
-    this->GetMatrix(matrix);
     matrix = mySurfaceActor->GetUserMatrix();
+    this->GetMatrix(matrix);
+    matrix = myEdgeActor->GetUserMatrix();
     break;
   }
   this->GetMatrix(matrix);
@@ -362,17 +362,20 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
     myNodeActor->Render(ren,bestMapper);
     break;
   case 1: //WIREFRAME
-    //PAL5268: myEdgeActor->Render(ren,bestMapper);
+    //PAL5268: 
+    myEdgeActor->Render(ren,bestMapper);
     break;
   case 2: //SURFACE
     mySurfaceActor->Render(ren,bestMapper);
     break;
   case 3: //INSIDEFRAME
-    //PAL5268: myEdgeActor->Render(ren,bestMapper);
+    //PAL5268: 
+    myEdgeActor->Render(ren,bestMapper);
     break;
   case 4: //SURFACEFRAME
-    //PAL5268: myEdgeActor->Render(ren,bestMapper);
+    //PAL5268: 
     mySurfaceActor->Render(ren,bestMapper);
+    myEdgeActor->Render(ren,bestMapper);
     break;
   }
 
@@ -383,7 +386,8 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
 void VISU_MeshAct::Modified()
 {
   myNodeActor->Modified();
-  //PAL5268: myEdgeActor->Modified();
+  //PAL5268: 
+  myEdgeActor->Modified();
   mySurfaceActor->Modified();
   this->vtkActor::Modified();
 }
index c34a8e7fe24ba42d738cdae0c902cf23123c6f69..527f726f27cb8752d84718de6ffa788ee220f2e6 100644 (file)
@@ -35,7 +35,9 @@
 
 vtkStandardNewMacro(VISU_ScalarMapAct);
 
-VISU_ScalarMapAct::VISU_ScalarMapAct(){
+VISU_ScalarMapAct
+::VISU_ScalarMapAct()
+{
   myScalarBar = VISU_ScalarBarActor::New();
 
   vtkProperty* aProperty = GetProperty();
@@ -49,32 +51,49 @@ VISU_ScalarMapAct::VISU_ScalarMapAct(){
   myProperty->DeepCopy(aProperty);
 }
 
-VISU_ScalarMapAct::~VISU_ScalarMapAct(){
+VISU_ScalarMapAct
+::~VISU_ScalarMapAct()
+{
   myScalarBar->Delete();
 }
 
-void VISU_ScalarMapAct::AddToRender(vtkRenderer* theRenderer){
-  SALOME_Actor::AddToRender(theRenderer);
+void
+VISU_ScalarMapAct
+::AddToRender(vtkRenderer* theRenderer)
+{
+  VISU_Actor::AddToRender(theRenderer);
   if(myScalarBar)
     theRenderer->AddActor2D(myScalarBar);
 }
 
-void VISU_ScalarMapAct::RemoveFromRender(vtkRenderer* theRenderer){
-  SALOME_Actor::RemoveFromRender(theRenderer);
+void
+VISU_ScalarMapAct
+::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  VISU_Actor::RemoveFromRender(theRenderer);
   if(myScalarBar)
     theRenderer->RemoveActor(myScalarBar);
 }
 
-void VISU_ScalarMapAct::SetVisibility(int theMode){
-  SALOME_Actor::SetVisibility(theMode);
+void
+VISU_ScalarMapAct
+::SetVisibility(int theMode)
+{
+  VISU_Actor::SetVisibility(theMode);
   if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility && theMode);
 }
 
-int VISU_ScalarMapAct::GetVisibility(){
-  return SALOME_Actor::GetVisibility();
+int 
+VISU_ScalarMapAct
+::GetVisibility()
+{
+  return VISU_Actor::GetVisibility();
 }
 
-void VISU_ScalarMapAct::SetBarVisibility(bool theMode){
+void
+VISU_ScalarMapAct
+::SetBarVisibility(bool theMode)
+{
   myBarVisibility = theMode;
   if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility);
 }
index 5b46996d82a616cc018f8ef6eafcfb2703133c70..72311f9d15f5b029835e513fcf5cc029fb11200f 100644 (file)
@@ -32,44 +32,72 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-EXPORT_HEADERS = VISU_PipeLine.hxx VISU_PipeLineUtils.hxx \
-       VISU_MeshPL.hxx VISU_ScalarMapPL.hxx \
-       VISU_CutPlanesPL.hxx VISU_CutLinesPL.hxx \
-       VISU_IsoSurfacesPL.hxx VISU_DeformedShapePL.hxx \
-       VISU_VectorsPL.hxx VISU_StreamLinesPL.hxx \
-       VISU_LookupTable.hxx VISU_ScalarBarActor.hxx \
-       VISU_Extractor.hxx VISU_FieldTransform.hxx \
-       VISU_UsedPointsFilter.hxx VISU_Plot3DPL.hxx
+EXPORT_HEADERS = \
+       VISU_PipeLine.hxx \
+       VISU_PipeLineUtils.hxx \
+       VISU_MeshPL.hxx \
+       VISU_ScalarMapPL.hxx \
+       VISU_CutPlanesPL.hxx \
+       VISU_CutLinesPL.hxx \
+       VISU_IsoSurfacesPL.hxx \
+       VISU_DeformedShapePL.hxx \
+       VISU_VectorsPL.hxx \
+       VISU_StreamLinesPL.hxx \
+       VISU_LookupTable.hxx \
+       VISU_ScalarBarActor.hxx \
+       VISU_Extractor.hxx \
+       VISU_FieldTransform.hxx \
+       VISU_UsedPointsFilter.hxx \
+       VISU_GaussPointsPL.hxx \
+       VISU_Plot3DPL.hxx \
+       VISU_OpenGLPointSpriteMapper.hxx \
+       VISU_ImplicitFunctionWidget.h \
+       VISU_ScalarBarCtrl.hxx
 
 # Libraries targets
 
 LIB = libVisuPipeLine.la
-LIB_SRC = VISU_PipeLine.cxx VISU_PipeLineUtils.cxx \
-       VISU_MeshPL.cxx VISU_ScalarMapPL.cxx \
-       VISU_CutPlanesPL.cxx VISU_CutLinesPL.cxx \
-       VISU_IsoSurfacesPL.cxx VISU_DeformedShapePL.cxx \
-       VISU_VectorsPL.cxx VISU_StreamLinesPL.cxx \
-       VISU_LookupTable.cxx VISU_ScalarBarActor.cxx \
-       VISU_Extractor.cxx VISU_FieldTransform.cxx \
-       VISU_UsedPointsFilter.cxx VISU_Plot3DPL.cxx \
-       SALOME_ExtractGeometry.cxx
+LIB_SRC = \
+       VISU_PipeLine.cxx \
+       VISU_PipeLineUtils.cxx \
+       VISU_MeshPL.cxx \
+       VISU_ScalarMapPL.cxx \
+       VISU_CutPlanesPL.cxx \
+       VISU_CutLinesPL.cxx \
+       VISU_IsoSurfacesPL.cxx \
+       VISU_DeformedShapePL.cxx \
+       VISU_VectorsPL.cxx \
+       VISU_StreamLinesPL.cxx \
+       VISU_LookupTable.cxx \
+       VISU_ScalarBarActor.cxx \
+       VISU_Extractor.cxx \
+       VISU_FieldTransform.cxx \
+       VISU_UsedPointsFilter.cxx \
+       VISU_GaussPointsPL.cxx \
+       VISU_Plot3DPL.cxx \
+       SALOME_ExtractGeometry.cxx \
+       VISU_OpenGLPointSpriteMapper.cxx \
+       VISU_ImplicitFunctionWidget.cxx \
+       VISU_ScalarBarCtrl.cxx
 
 # Executables targets
 
-BIN = VISUPipeLine
+BIN = VISUPipeLine VISU_img2vti
 BIN_SRC        =
 
-CPPFLAGS+= $(VTK_INCLUDES) \
+CPPFLAGS+= \
+       $(VTK_INCLUDES) \
        -I${KERNEL_ROOT_DIR}/include/salome \
        -I${GUI_ROOT_DIR}/include/salome \
        -I${MED_ROOT_DIR}/include/salome \
        $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
 
-LDFLAGS+= $(VTK_LIBS) -lVTKViewer -lVisuConvertor \
+LDFLAGS+= \
+       $(VTK_LIBS) -lVTKViewer -lVisuConvertor \
        -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace \
        -L${GUI_ROOT_DIR}/lib/salome \
        -L${MED_ROOT_DIR}/lib/salome
 
-LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lsuit -lqtx -lSALOMEBasics
+LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lmed_V2_1 -lsuit -lqtx -lSALOMEBasics
 
 @CONCLUDE@
index 13655093f9dec9d295721a61059706aff983f355..5a1762e8d138179e767270bd068f784bcb806c91 100755 (executable)
@@ -41,80 +41,158 @@ using namespace std;
 #endif
 
 
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(SALOME_ExtractGeometry);
 
 
-SALOME_ExtractGeometry::SALOME_ExtractGeometry()
+//----------------------------------------------------------------------------
+SALOME_ExtractGeometry
+::SALOME_ExtractGeometry():
+  myStoreMapping(false),
+  myIsDoneShallowCopy(false)
 {}
 
-SALOME_ExtractGeometry::~SALOME_ExtractGeometry()
+SALOME_ExtractGeometry
+::~SALOME_ExtractGeometry()
 {}
 
-vtkIdType SALOME_ExtractGeometry::GetElemObjId(int theVtkID)
+
+//----------------------------------------------------------------------------
+unsigned long int 
+SALOME_ExtractGeometry
+::GetMTime()
 {
-  if (myElemVTK2ObjIds.empty())
-    return theVtkID;
+  unsigned long int aTime = vtkExtractGeometry::GetMTime();
+  return aTime;
+}
 
-  if (theVtkID < 0 || myElemVTK2ObjIds.size() <= theVtkID)
-    return -1;
 
-#if defined __GNUC_2__
-  return myElemVTK2ObjIds[theVtkID];
-#else
-  return myElemVTK2ObjIds.at(theVtkID);
-#endif
+//----------------------------------------------------------------------------
+vtkImplicitBoolean* 
+SALOME_ExtractGeometry
+::GetImplicitBoolean() 
+{
+  return myImplicitBoolean.GetPointer();
 }
 
 
-vtkIdType SALOME_ExtractGeometry::GetNodeObjId(int theVtkID)
+void
+SALOME_ExtractGeometry
+::SetImplicitFunction(vtkImplicitFunction* theImplicitFunction)  
 {
-  if (myNodeVTK2ObjIds.empty())
-    return theVtkID;
+  myImplicitBoolean = dynamic_cast<vtkImplicitBoolean*>(theImplicitFunction);
+  vtkExtractGeometry::SetImplicitFunction(theImplicitFunction);
+}
 
-  if (theVtkID < 0 || myNodeVTK2ObjIds.size() <= theVtkID)
-    return -1;
 
-#if defined __GNUC_2__
-  return myNodeVTK2ObjIds[theVtkID];
-#else
-  return myNodeVTK2ObjIds.at(theVtkID);
-#endif
+//----------------------------------------------------------------------------
+void 
+SALOME_ExtractGeometry
+::SetStoreMapping(bool theStoreMapping)
+{
+  myStoreMapping = theStoreMapping;
+  Modified();
+}
+
+bool 
+SALOME_ExtractGeometry
+::GetStoreMapping() const
+{
+  return myStoreMapping;
 }
 
 
-void SALOME_ExtractGeometry::SetImplicitBoolean(vtkImplicitBoolean* theImplicitBoolean)
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractGeometry
+::GetElemVTKId(vtkIdType theID)
+{
+  if(!myStoreMapping||myIsDoneShallowCopy){
+    return theID;
+  }
+  vtkIdType iEnd = myElemVTK2ObjIds.size();
+  for(vtkIdType i = 0; i < iEnd; i++)
+    if(myElemVTK2ObjIds[i] == theID)
+      return i;
+
+  return -1;
+}
+
+vtkIdType
+SALOME_ExtractGeometry
+::GetNodeVTKId(vtkIdType theID)
 {
-  myImplicitBoolean = theImplicitBoolean;
-  SetImplicitFunction(theImplicitBoolean);
+  if (!myStoreMapping||myIsDoneShallowCopy){
+    return theID;
+  }
+  vtkIdType iEnd = myNodeVTK2ObjIds.size();
+  for(vtkIdType i = 0; i < iEnd; i++)
+    if(myNodeVTK2ObjIds[i] == theID)
+      return i;
+
+  return -1;
 }
 
 
-void SALOME_ExtractGeometry::SetStoreMapping(bool theStoreMapping)
+//----------------------------------------------------------------------------
+vtkIdType
+SALOME_ExtractGeometry
+::GetElemObjId(int theVtkID)
 {
-  myStoreMapping = theStoreMapping;
-  Modified();
+  if (!myStoreMapping||myIsDoneShallowCopy){
+    return theVtkID;
+  }
+  //
+  if (theVtkID<myElemVTK2ObjIds.size()){
+    return myElemVTK2ObjIds[theVtkID];
+  }
+  return -1;
+}
+
+
+vtkIdType
+SALOME_ExtractGeometry
+::GetNodeObjId(int theVtkID)
+{
+  if (!myStoreMapping||myIsDoneShallowCopy){
+    return theVtkID;
+  }
+  //
+  if (theVtkID<myNodeVTK2ObjIds.size()){
+    return myNodeVTK2ObjIds[theVtkID];
+  }
+  return -1;
 }
 
 
-void SALOME_ExtractGeometry::Execute()
+//----------------------------------------------------------------------------
+void
+SALOME_ExtractGeometry
+::Execute()
 {
-  if(myImplicitBoolean.GetPointer()){
+  myElemVTK2ObjIds.clear();
+  myNodeVTK2ObjIds.clear();
+  //
+  myIsDoneShallowCopy = !this->ImplicitFunction;
+
+  if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
     if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
-      if(aFunction->GetNumberOfItems() == 0){
-        myElemVTK2ObjIds.clear();
-        myNodeVTK2ObjIds.clear();
-
-       vtkDebugMacro(<< "Extracting geometry - ShallowCopy");
-       GetOutput()->ShallowCopy(GetInput());
-        Modified();
-       return;
-      }
+      myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
     }
   }
+
+  if(myIsDoneShallowCopy){
+    GetOutput()->ShallowCopy(GetInput());
+    Modified();
+    return;
+  }
+
   Execute2();
 }
 
-void SALOME_ExtractGeometry::Execute2()
+void
+SALOME_ExtractGeometry
+::Execute2()
 {
   vtkIdType ptId, numPts, numCells, i, cellId, newCellId, newId, *pointMap;
   vtkIdList *cellPts;
@@ -134,8 +212,6 @@ void SALOME_ExtractGeometry::Execute2()
   numCells = input->GetNumberOfCells();
   numPts = input->GetNumberOfPoints();
 
-  vtkDebugMacro(<< "Extracting geometry");
-
   if ( ! this->ImplicitFunction )
     {
     vtkErrorMacro(<<"No implicit function specified");
@@ -171,9 +247,7 @@ void SALOME_ExtractGeometry::Execute2()
   vtkFloatArray *newScalars = NULL;
 
   if(myStoreMapping){
-    myElemVTK2ObjIds.clear();
     myElemVTK2ObjIds.reserve(numCells);
-    myNodeVTK2ObjIds.clear();
     myNodeVTK2ObjIds.reserve(numPts);
   }
 
@@ -186,7 +260,8 @@ void SALOME_ExtractGeometry::Execute2()
         {
         newId = newPts->InsertNextPoint(x);
         pointMap[ptId] = newId;
-       myNodeVTK2ObjIds.push_back(ptId);
+       if(myStoreMapping)
+         myNodeVTK2ObjIds.push_back(ptId);
         outputPD->CopyData(pd,ptId,newId);
         }
       }
@@ -209,7 +284,8 @@ void SALOME_ExtractGeometry::Execute2()
           {
           newId = newPts->InsertNextPoint(x);
           pointMap[ptId] = newId;
-         myNodeVTK2ObjIds.push_back(ptId);
+         if(myStoreMapping)
+           myNodeVTK2ObjIds.push_back(ptId);
           outputPD->CopyData(pd,ptId,newId);
           }
         }
@@ -262,7 +338,8 @@ void SALOME_ExtractGeometry::Execute2()
             x = input->GetPoint(ptId);
             newId = newPts->InsertNextPoint(x);
             pointMap[ptId] = newId;
-           myNodeVTK2ObjIds.push_back(ptId);
+           if(myStoreMapping)
+             myNodeVTK2ObjIds.push_back(ptId);
             outputPD->CopyData(pd,ptId,newId);
             }
           newCellPts->InsertId(i,pointMap[ptId]);
@@ -273,7 +350,8 @@ void SALOME_ExtractGeometry::Execute2()
     if ( npts >= numCellPts || (this->ExtractBoundaryCells && npts > 0) )
       {
       newCellId = output->InsertNextCell(cell->GetCellType(),newCellPts);
-      myElemVTK2ObjIds.push_back(cellId);
+      if(myStoreMapping)
+       myElemVTK2ObjIds.push_back(cellId);
       outputCD->CopyData(cd,cellId,newCellId);
       }
     }//for all cells
index 74c1ec301661b05c926adc3808dbdaa218a40285..b225434f8bdd7772557c6953ba9264300e0ffabc 100755 (executable)
 
 #include <vtkExtractGeometry.h>
 #include <vtkSmartPointer.h>
-#include <vtkImplicitBoolean.h>
 
 #include <vector>
 
-//class vtkImplicitBoolean;
+class vtkImplicitBoolean;
 
 class SALOME_ExtractGeometry : public vtkExtractGeometry
 {
@@ -35,18 +34,37 @@ public:
 
   static SALOME_ExtractGeometry *New();
 
-  void SetImplicitBoolean(vtkImplicitBoolean* theImplicitBoolean);
-  vtkImplicitBoolean* GetImplicitBoolean() const {
-    return myImplicitBoolean.GetPointer();
-  }
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction* theImplicitFunction); 
 
-  void SetStoreMapping(bool theStoreMapping);
-  bool GetStoreMapping() const {
-    return myStoreMapping;
-  }
+  virtual
+  unsigned long int
+  GetMTime();
 
-  virtual vtkIdType GetNodeObjId(int theID);
-  virtual vtkIdType GetElemObjId(int theID);
+  vtkImplicitBoolean* 
+  GetImplicitBoolean();
+
+  bool 
+  GetStoreMapping() const;
+  void
+  SetStoreMapping(bool theStoreMapping);
+
+  virtual 
+  vtkIdType 
+  GetNodeObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemObjId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKId(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKId(vtkIdType theID);
 
 protected:
   SALOME_ExtractGeometry();
@@ -57,6 +75,7 @@ protected:
 
 private:
   bool myStoreMapping;
+  bool myIsDoneShallowCopy;
   typedef std::vector<vtkIdType> TVectorId;
   TVectorId myElemVTK2ObjIds;
   TVectorId myNodeVTK2ObjIds;
index e1f35eaa90576e292df6f0bad41bec2601821920..59f5f91a4a49c5aa6bd356d35ba281cdab07afc4 100644 (file)
 #include "VISU_DeformedShapePL.hxx"
 #include "VISU_VectorsPL.hxx"
 #include "VISU_StreamLinesPL.hxx"
+#include "VISU_GaussPointsPL.hxx"
 #include "VISU_Plot3DPL.hxx"
 
-typedef VISU_Plot3DPL TPresent;
+typedef VISU_GaussPointsPL TPresent;
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -74,7 +75,10 @@ int main(int argc, char** argv){
       if(isOnlyMesh){
        const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
        aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
-       vtkUnstructuredGrid* aDataSet = aConvertor->GetMeshOnEntity(aMeshName,anEntity);
+
+       VISU::PIDMapper anIDMapper = 
+         aConvertor->GetMeshOnEntity(aMeshName,anEntity);
+       VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
 
        VISU_MeshPL* aPresent = VISU_MeshPL::New();
        aPresent->SetInput(aDataSet);
@@ -100,23 +104,51 @@ int main(int argc, char** argv){
        VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
        for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
          const VISU::PField aField = aFieldMapIter->second;
-         if(aField->myNbComp == 1) continue;
+         /*
+         if(aField->myNbComp == 1) 
+           continue;
+         */
          const string& aFieldName = aFieldMapIter->first;
          const VISU::TValField& aValField = aField->myValField;
          VISU::TValField::const_iterator aValFieldIter = aValField.begin();
          if(aValFieldIter == aValField.end()) return 0;
          int aTimeStamp = aValFieldIter->first;
-         vtkUnstructuredGrid* aDataSet = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+
+         VISU::PIDMapper anIDMapper;
+         if(anEntity != VISU::NODE_ENTITY){
+           anIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
+         }else{
+           continue;
+           anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+         }
+         VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
 
          TPresent* aPresent = TPresent::New();
          aPresent->SetInput(aDataSet);
          aPresent->Build();
          aPresent->Init();
          aPresent->SetSourceRange();
+         vtkDataSet* anOutput = aPresent->GetMapper()->GetInput();
+         //for(int i = 0, iEnd = anOutput->GetNumberOfCells(); i < iEnd; i++){
+         //  cout<<aPresent->GetPointSize(i)<<endl;
+         //}
          //aPresent->SetNumberOfContours(50);
          //aPresent->SetNbParts(1);
          //aPresent->SetOrientation(VISU_CutPlanesPL::XY,0.0,0.0);
          //aPresent->SetScaling(VTK_SCALE_LOG10);
+
+         char aMainTexture[80];
+         strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+         strcat( aMainTexture, "/share/salome/resources/sprite_texture.vti" );
+         //cout << aMainTexture << endl;
+
+         char anAlphaTexture[80];
+         strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+         strcat( anAlphaTexture, "/share/salome/resources/sprite_alpha.vti" );
+         //cout << anAlphaTexture << endl;
+
+         aPresent->SetImageData( VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ) );
+
          aPresent->Update();
 
          vtkActor* anActor = vtkActor::New();
index 2207f492480b66c83c80f619d8ebe9681c8043ae..7f53c95166b1f3dc2ef28bf7d0beda7274d84e3f 100644 (file)
@@ -37,7 +37,6 @@ vtkStandardNewMacro(VISU_CutLinesPL);
 VISU_CutLinesPL::VISU_CutLinesPL(){}
 
 void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
   if(VISU_CutLinesPL *aPipeLine = dynamic_cast<VISU_CutLinesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(1),
                   aPipeLine->GetRotateX(1),aPipeLine->GetRotateY(1),1);
@@ -45,6 +44,7 @@ void VISU_CutLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
     SetDefault();
     if (!aPipeLine->IsDefault()) SetPosition(aPipeLine->GetPosition());
   }
+  VISU_CutPlanesPL::ShallowCopy(thePipeLine);
 }
 
 void VISU_CutLinesPL::Init(){
index 32fb5612307055610971a80f8f5cab0e5662f0d8..63dd3e5a42966a4dee8b3c794f1fe08e2b8a42a2 100644 (file)
@@ -49,7 +49,6 @@ VISU_CutPlanesPL::~VISU_CutPlanesPL(){
 }
 
 void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_CutPlanesPL *aPipeLine = dynamic_cast<VISU_CutPlanesPL*>(thePipeLine)){
     SetOrientation(aPipeLine->GetPlaneOrientation(),
                   aPipeLine->GetRotateX(),aPipeLine->GetRotateY());
@@ -58,6 +57,7 @@ void VISU_CutPlanesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
     for (int i = 0, iend = GetNbParts(); i < iend; i++)
       if(!aPipeLine->IsPartDefault(i))         SetPartPosition(i, aPipeLine->GetPartPosition(i));
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 void VISU_CutPlanesPL::Init(){
index c276548df7820aa02e608f686d19ac9fd9e3f663..12847fa973e28c4411a097c109b3063e8a80e3b0 100644 (file)
@@ -47,10 +47,10 @@ VISU_DeformedShapePL::~VISU_DeformedShapePL(){
 }
 
 void VISU_DeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
     SetScale(aPipeLine->GetScale());
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 float VISU_DeformedShapePL::GetScaleFactor(vtkDataSet* theDataSet){
@@ -74,13 +74,12 @@ float VISU_DeformedShapePL::GetScaleFactor(vtkDataSet* theDataSet){
 
 
 void VISU_DeformedShapePL::SetScale(float theScale) {
-  if(myScaleFactor == theScale) return;
+  myWarpVector->SetScaleFactor(theScale);
   myScaleFactor = theScale;
-  myWarpVector->SetScaleFactor(myScaleFactor);
   Modified();
 }
 float VISU_DeformedShapePL::GetScale() {
-  return myWarpVector->GetScaleFactor();
+  return myScaleFactor;
 }
 
 void VISU_DeformedShapePL::Init(){
index f4bcfabba829819598bda4b8e59a597e6731cfd6..6b182da22977a6e9fe77db9a7599890de02cfb20 100644 (file)
@@ -33,6 +33,7 @@
 #include <vtkFloatArray.h>
 #include <vtkPointData.h>
 #include <vtkCellData.h>
+#include <vector>
 
 using namespace std;
 
@@ -40,7 +41,7 @@ using namespace std;
 vtkStandardNewMacro(VISU_Extractor);
 
 VISU_Extractor::VISU_Extractor(){
-  myScalarMode = 0;
+  myScalarMode = 1;
 }
 
 VISU_Extractor::~VISU_Extractor(){
@@ -53,33 +54,42 @@ void VISU_Extractor::SetScalarMode(int theScalarMode){
   }
 }
 
-
 template<typename TypeData> void
-execute(int theNbComp, int theScalarMode, TypeData* theInputData, TypeData* theOutputData){
-  vtkDataArray *inVectors = theInputData->GetVectors();
-  if ( !inVectors || theNbComp < 1 )
+execute(int theNbElems, 
+       int theScalarMode, 
+       TypeData* theInputData, 
+       TypeData* theOutputData)
+{
+  if(theNbElems < 1 )
     return;
-  vtkFloatArray *newScalars = vtkFloatArray::New();
-  ostringstream aName;
-  aName<<inVectors->GetName();  aName<<", ";  aName<<theScalarMode;
-  newScalars->SetName(aName.str().c_str());
-  newScalars->SetNumberOfComponents(1);
-  newScalars->SetNumberOfTuples(theNbComp);
-  for (int ptId = 0; ptId < theNbComp; ptId++) {
-    float v[3], s;
-    inVectors->GetTuple(ptId,v);
-    if ( theScalarMode < 1 || theScalarMode > 3)
-      s = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
-    else
-      s = v[theScalarMode - 1];
-    newScalars->SetTuple1(ptId, s);
+  vtkDataArray* aVectors = theInputData->GetVectors();
+  vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD");
+  if(vtkFloatArray *aFloatArray = dynamic_cast<vtkFloatArray*>(aFieldArray)){
+    int aNbComp = aFloatArray->GetNumberOfComponents();
+    std::vector<float> anArray(aNbComp < 3? 3: aNbComp);
+    //
+    vtkFloatArray *aScalars = vtkFloatArray::New();
+    aScalars->SetNumberOfTuples(theNbElems);
+    aScalars->SetNumberOfComponents(1);
+    //
+    if(!theScalarMode){
+      for(int anId = 0; anId < theNbElems; anId++){
+       aFloatArray->GetTuple(anId,&anArray[0]);
+       float aVector[3] = {anArray[0], anArray[1], anArray[2]};
+       float aScalar = sqrt(aVector[0]*aVector[0] + aVector[1]*aVector[1] + aVector[2]*aVector[2]);
+       aScalars->SetTuple1(anId,aScalar);
+      }
+    }else{
+      for(int anId = 0; anId < theNbElems; anId++){
+       aFloatArray->GetTuple(anId,&anArray[0]);
+       aScalars->SetTuple1(anId,anArray[theScalarMode - 1]);
+      }
+    }
+    theOutputData->SetScalars(aScalars);
+    aScalars->Delete();
   }
-  theOutputData->SetScalars(newScalars);
-  //theOutputData->SetActiveScalars(newScalars->GetName());
-  newScalars->Delete();
 }
 
-
 void VISU_Extractor::Execute(){
   vtkDataSet *input = this->GetInput(), *output = this->GetOutput();
   output->CopyStructure(input);
@@ -87,19 +97,19 @@ void VISU_Extractor::Execute(){
   output->GetCellData()->CopyAllOff();
   if(input->GetPointData()->GetNumberOfArrays()){
     output->GetPointData()->CopyVectorsOn();
-    int nbComp = input->GetNumberOfPoints();
+    int aNbElems = input->GetNumberOfPoints();
     vtkPointData *inData = input->GetPointData(), *outData = output->GetPointData();
     if(inData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      execute(nbComp,myScalarMode,inData,outData);
+      execute(aNbElems,myScalarMode,inData,outData);
     else
       output->GetPointData()->CopyScalarsOn();
     outData->PassData(inData);
   }else{
     output->GetCellData()->CopyVectorsOn();
-    int nbComp = input->GetNumberOfCells();
+    int aNbElems = input->GetNumberOfCells();
     vtkCellData *inData = input->GetCellData(), *outData = output->GetCellData();
     if(inData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      execute(nbComp,myScalarMode,inData,outData);
+      execute(aNbElems,myScalarMode,inData,outData);
     else
       output->GetCellData()->CopyScalarsOn();
     outData->PassData(inData);
diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx
new file mode 100644 (file)
index 0000000..caf8853
--- /dev/null
@@ -0,0 +1,407 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File:    VISU_GaussPoints.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_PipeLineUtils.hxx"
+#include "SALOME_ExtractGeometry.h"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include <vtkPointSource.h>
+#include <vtkElevationFilter.h>
+#include <vtkImageGaussianSource.h>
+#include <vtkXMLImageDataReader.h>
+#include <vtkGeometryFilter.h>
+#include <vtkImageData.h>
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VISU_GaussPointsPL);
+
+//----------------------------------------------------------------------------
+VISU_GaussPointsPL
+::VISU_GaussPointsPL():
+  myClamp(200.0),
+  mySize(10),
+  myMinSize(3),
+  myMaxSize(33),
+  myMagnification(100),
+  myMagnificationIncrement(2),
+  myAlphaThreshold(0.1)
+{
+  myExtractGeometry->SetExtractInside(0);
+
+  myPSMapper = VISU_OpenGLPointSpriteMapper::New();
+
+  myGeomFilter = vtkGeometryFilter::New();
+}
+
+void
+VISU_GaussPointsPL
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
+  if(VISU_GaussPointsPL *aPipeLine = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine)){
+    SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
+    
+    vtkPolyData* aDatsSet = myPSMapper->GetInput();
+    myPSMapper->ShallowCopy(aPipeLine->GetPSMapper());
+    // To restore mapper input from pipeline
+    myPSMapper->SetInput(aDatsSet);
+
+    SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
+    SetClamp(aPipeLine->GetClamp());
+    SetSize(aPipeLine->GetSize());
+    SetMinSize(aPipeLine->GetMinSize());
+    SetMaxSize(aPipeLine->GetMaxSize());
+    SetMagnification(aPipeLine->GetMagnification());
+    SetMagnificationIncrement(aPipeLine->GetMagnificationIncrement());
+    SetAlphaThreshold(aPipeLine->GetAlphaThreshold());
+  }
+  Superclass::ShallowCopy(thePipeLine);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PipeLine::TMapper* 
+VISU_GaussPointsPL
+::GetMapper()
+{
+  return GetPSMapper();
+}
+
+VISU_OpenGLPointSpriteMapper* 
+VISU_GaussPointsPL
+::GetPSMapper()
+{
+  if(GetInput()){
+    if(!myPSMapper->GetInput()){
+      GetInput2()->Update();
+      Build();
+      Init();
+    }
+    myPSMapper->Update();
+  }
+  return myPSMapper;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::Build()
+{
+  myExtractor->SetInput( GetInput2() );
+  myFieldTransform->SetInput( myExtractor->GetOutput() );
+
+  //myPSMapper->SetQuadraticPointDistanceAttenuation( 1.0, 20.0, 0.0 );
+  //myPSMapper->SetImmediateModeRendering( 1 );
+  myPSMapper->SetColorModeToMapScalars();
+  myPSMapper->ScalarVisibilityOn();
+
+  myGeomFilter->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+  myPSMapper->SetInput( myGeomFilter->GetOutput() );
+
+  SetSourceRange();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::Update()
+{
+  GetSourceRange(mySourceScalarRange);
+  myDeltaScalarRange = mySourceScalarRange[1] - mySourceScalarRange[0];
+
+  vtkMapper* aMapper = GetMapper();
+  vtkDataSet* aDataSet = aMapper->GetInput();
+  myAverageCellSize = VISU_DeformedShapePL::GetScaleFactor(aDataSet);
+
+  vtkCellData* aCellData = aDataSet->GetCellData();
+  myScalarArray = aCellData->GetScalars();
+
+  myPSMapper->SetLookupTable( myMapperTable );
+  myPSMapper->SetScalarRange( mySourceScalarRange );
+
+  VISU_ScalarMapPL::Update();
+}
+
+//----------------------------------------------------------------------------
+VISU_GaussPointsPL
+::~VISU_GaussPointsPL()
+{
+  if (this->myPSMapper)
+  {
+    this->myPSMapper->Delete();
+    this->myPSMapper = NULL;
+  }
+  if (this->myGeomFilter)
+  {
+    this->myGeomFilter->Delete();
+    this->myGeomFilter = NULL;
+  }
+}
+
+//----------------------------------------------------------------------------
+VISU::TGaussPointID 
+VISU_GaussPointsPL
+::GetObjID(vtkIdType theID) const
+{
+  return myGaussPtsIDMapper->GetObjID(theID);
+}
+
+void
+VISU_GaussPointsPL
+::SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper)
+{
+  myGaussPtsIDMapper = theGaussPtsIDMapper;
+  SetIDMapper(myGaussPtsIDMapper);
+}
+
+const VISU::PGaussPtsIDMapper&  
+VISU_GaussPointsPL
+::GetGaussPtsIDMapper() const
+{
+  return myGaussPtsIDMapper;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetBicolor(bool theBicolor)
+{
+  myMapperTable->SetBicolor( theBicolor );
+  myBarTable->SetBicolor( theBicolor );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU_GaussPointsPL
+::GetBicolor()
+{
+  return myMapperTable->GetBicolor();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetIsColored(bool theIsColored)
+{
+  myPSMapper->SetPointSpriteResults( theIsColored );
+}
+
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetMaximumSupportedSize()
+{
+  return myPSMapper->GetMaximumSupportedSize();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetClamp(float theClamp)
+{
+  myClamp = theClamp;
+  myPSMapper->SetPointSpriteClamp( theClamp );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetSize(float theSize)
+{
+  mySize = theSize;
+  myPSMapper->SetPointSpriteSize( 1000.0 * myAverageCellSize * mySize / 100.0 );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetMinSize(float theMinSize)
+{
+  myMinSize = theMinSize;
+  myPSMapper->SetPointSpriteMinSize( 1000.0 * myAverageCellSize * myMinSize / 100.0 );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetMaxSize(float theMaxSize)
+{
+  myMaxSize = theMaxSize;
+  myPSMapper->SetPointSpriteMaxSize( 1000.0 * myAverageCellSize * myMaxSize / 100.0 );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetMagnification(float theMagnification)
+{
+  myMagnification = theMagnification;
+  myPSMapper->SetPointSpriteMagnification( theMagnification / 100.0 );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetMagnificationIncrement(float theIncrement)
+{
+  myMagnificationIncrement = theIncrement;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetAlphaThreshold(float theAlphaThreshold)
+{
+  myAlphaThreshold = theAlphaThreshold;
+  myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::ChangeMagnification( bool up )
+{
+  float anIncrement = up ? myMagnificationIncrement : 1.0 / myMagnificationIncrement;
+  SetMagnification( GetMagnification() * anIncrement );
+}
+
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray)
+{
+  float aMaxSize = myAverageCellSize*myMaxSize/100.0;
+  float aMinSize = myAverageCellSize*myMinSize/100.0;
+  float aDelta = aMaxSize - aMinSize;
+  float aVal = theScalarArray->GetTuple1(theID);
+
+  return aMinSize + aDelta*(aVal - mySourceScalarRange[0])/myDeltaScalarRange;
+}
+
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetMaxPointSize()
+{
+  return myAverageCellSize*myMaxSize/100.0;
+}
+
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetPointSize(vtkIdType theID)
+{
+  vtkMapper* aMapper = GetMapper();
+  vtkDataSet* aDataSet = aMapper->GetInput();
+  vtkCellData* aCellData = aDataSet->GetCellData();
+  vtkDataArray* aScalarArray = aCellData->GetScalars();
+  return GetPointSize(theID,aScalarArray);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetImageData(vtkImageData* theImageData)
+{
+  myPSMapper->SetImageData( theImageData );
+}
+
+//----------------------------------------------------------------------------
+vtkImageData*
+VISU_GaussPointsPL
+::MakeTexture( const char* theMainTexture, 
+              const char* theAlphaTexture )
+{
+  if( !theMainTexture || !theAlphaTexture )
+    return 0;
+
+  vtkXMLImageDataReader* aMainReader = vtkXMLImageDataReader::New();
+  vtkXMLImageDataReader* anAlphaReader = vtkXMLImageDataReader::New();
+
+  aMainReader->SetFileName( theMainTexture );
+  anAlphaReader->SetFileName( theAlphaTexture );
+
+  aMainReader->Update();
+  anAlphaReader->Update();
+
+  vtkImageData* aMainImageData = aMainReader->GetOutput();
+  vtkImageData* anAlphaImageData = anAlphaReader->GetOutput();
+
+  int* aMainImageSize = aMainImageData->GetDimensions();
+  int* anAlphaImageSize = anAlphaImageData->GetDimensions();
+  if(aMainImageSize[0] != anAlphaImageSize[0] || aMainImageSize[1] != anAlphaImageSize[1])
+    return NULL;
+
+  int aNbCompositeComponents = 4;
+  vtkImageData* aCompositeImageData = vtkImageData::New();
+  aCompositeImageData->SetDimensions(aMainImageSize);
+  aCompositeImageData->SetScalarTypeToUnsignedChar();        
+  aCompositeImageData->SetNumberOfScalarComponents(aNbCompositeComponents);
+  aCompositeImageData->AllocateScalars();
+
+  unsigned char* aMainDataPtr = (unsigned char*)aMainImageData->GetScalarPointer();
+  unsigned char* anAlphaDataPtr = (unsigned char*)anAlphaImageData->GetScalarPointer();
+  unsigned char *aCompositeDataPtr = (unsigned char * )aCompositeImageData->GetScalarPointer();
+
+  int aNbMainComponents = aMainImageData->GetNumberOfScalarComponents();
+  int aNbAlphaComponents = anAlphaImageData->GetNumberOfScalarComponents();
+  int aCompositeSize = aMainImageSize[0] * aMainImageSize[1] * aNbCompositeComponents;
+  
+  int aMainId = 0, anAlphaId = 0, aCompositeId = 0;
+  for(; aCompositeId < aCompositeSize;)
+  {
+    aCompositeDataPtr[aCompositeId] = aMainDataPtr[aMainId];
+    aCompositeDataPtr[aCompositeId + 1] = aMainDataPtr[aMainId + 1];
+    aCompositeDataPtr[aCompositeId + 2] = aMainDataPtr[aMainId + 2];
+    aCompositeDataPtr[aCompositeId + 3] = anAlphaDataPtr[anAlphaId];
+
+    aMainId += aNbMainComponents;
+    anAlphaId += aNbAlphaComponents;
+    aCompositeId += aNbCompositeComponents;
+  }
+  aMainReader->Delete();
+  anAlphaReader->Delete();
+  aCompositeImageData->Update();
+
+  return aCompositeImageData;
+}
diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx
new file mode 100644 (file)
index 0000000..dd8f4ea
--- /dev/null
@@ -0,0 +1,175 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+// File:    VISU_GaussPointsPL.hxx
+// Author:  
+// Module : VISU
+
+#ifndef VISU_GaussPointsPL_HeaderFile
+#define VISU_GaussPointsPL_HeaderFile
+
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_Convertor.hxx"
+
+class VISU_OpenGLPointSpriteMapper;
+
+class vtkGeometryFilter;
+class vtkDataArray;
+class vtkImageData;
+
+class VISU_GaussPointsPL : public VISU_ScalarMapPL
+{
+protected:
+  VISU_GaussPointsPL();
+
+  virtual
+  ~VISU_GaussPointsPL();
+
+public:
+  vtkTypeMacro(VISU_GaussPointsPL,VISU_ScalarMapPL);
+
+  static 
+  VISU_GaussPointsPL* New();
+  
+  virtual
+  void
+  ShallowCopy(VISU_PipeLine *thePipeLine);
+
+  virtual
+  TMapper* 
+  GetMapper();
+
+  VISU_OpenGLPointSpriteMapper*
+  GetPSMapper();
+
+  virtual
+  void
+  Build();
+
+  virtual
+  void
+  Update();
+
+  virtual 
+  VISU::TGaussPointID 
+  GetObjID(vtkIdType theID) const;
+
+  void 
+  SetGaussPtsIDMapper(const VISU::PGaussPtsIDMapper& theGaussPtsIDMapper);
+
+  const VISU::PGaussPtsIDMapper&  
+  GetGaussPtsIDMapper() const;
+
+  void
+  SetBicolor(bool theBicolor);
+
+  bool
+  GetBicolor();
+
+  void SetIsColored(bool theIsColored);
+
+  float 
+  GetMaximumSupportedSize();
+
+  void
+  SetClamp(float theClamp);
+
+  float
+  GetClamp() { return myClamp; }
+
+  void
+  SetSize(float theSize);
+
+  float 
+  GetSize() { return mySize; }
+
+  void
+  SetMinSize(float theMinSize);
+
+  float 
+  GetMinSize() { return myMinSize; }
+
+  void
+  SetMaxSize(float theMaxSize);
+
+  float 
+  GetMaxSize() { return myMaxSize; }
+
+  void
+  SetMagnification(float theMagnification);
+
+  float
+  GetMagnification() { return myMagnification; }
+
+  void
+  SetMagnificationIncrement(float theIncrement);
+
+  float
+  GetMagnificationIncrement() { return myMagnificationIncrement; }
+
+  void
+  SetAlphaThreshold(float theAlphaThreshold);
+
+  float
+  GetAlphaThreshold() { return myAlphaThreshold; }
+
+  void
+  ChangeMagnification( bool up );
+
+  float
+  GetMaxPointSize();
+
+  float
+  GetPointSize(vtkIdType theID);
+
+  float
+  GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
+
+  void
+  SetImageData(vtkImageData* theImageData);
+
+  static
+  vtkImageData*
+  MakeTexture( const char* theMainTexture,
+              const char* theAlphaTexture );
+
+protected:
+  VISU_OpenGLPointSpriteMapper* myPSMapper;
+  vtkGeometryFilter* myGeomFilter;
+  VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+
+  vtkDataArray *myScalarArray;
+  float mySourceScalarRange[2];
+  float myDeltaScalarRange;
+  float myAverageCellSize;
+
+  float myClamp;
+  float mySize;
+  float myMinSize;
+  float myMaxSize;
+  float myMagnification;
+  float myMagnificationIncrement;
+  float myAlphaThreshold;
+};
+  
+#endif
diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx
new file mode 100644 (file)
index 0000000..844371c
--- /dev/null
@@ -0,0 +1,1721 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : VVTK_ImplicitFunctionWidget.cxx
+//  Author : Peter KURNEV
+//  Module : SALOME
+//  $Header$
+
+#include "VISU_ImplicitFunctionWidget.h"
+
+#include <vtkActor.h>
+#include <vtkAssemblyNode.h>
+#include <vtkAssemblyPath.h>
+#include <vtkCallbackCommand.h>
+#include <vtkCamera.h>
+#include <vtkCellPicker.h>
+#include <vtkConeSource.h>
+#include <vtkCutter.h>
+#include <vtkFeatureEdges.h>
+#include <vtkImageData.h>
+#include <vtkLineSource.h>
+#include <vtkMath.h>
+#include <vtkObjectFactory.h>
+#include <vtkOutlineFilter.h>
+#include <vtkPlane.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkProperty.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkRenderer.h>
+#include <vtkSphereSource.h>
+#include <vtkTransform.h>
+#include <vtkTubeFilter.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunctionCollection.h>
+////
+#include <vtkFollower.h>
+#include <vtkObjectFactory.h>
+#include <vtkDataSet.h>
+#include <vtkRenderWindow.h>
+////
+//==================================================================
+// class   : VISU_UnScaledActor
+// purpose :
+//==================================================================
+class VISU_UnScaledActor: public vtkFollower
+{
+  
+public:
+  
+  vtkTypeMacro(VISU_UnScaledActor,vtkFollower);
+  static VISU_UnScaledActor *New();
+  
+  
+  void SetCenter(float *);
+  virtual void SetSize(int theSize);
+  virtual void Render(vtkRenderer *theRenderer);
+  virtual float *GetBounds();
+
+protected:
+  VISU_UnScaledActor();
+  ~VISU_UnScaledActor(){}
+
+  float myCenter[3];
+  int mySize;
+};
+
+////
+
+vtkStandardNewMacro(VISU_UnScaledActor);
+
+//====================================================================
+// function: VISU_UnScaledActor
+// purpose:
+//====================================================================
+VISU_UnScaledActor::VISU_UnScaledActor() 
+{
+  for (int i=0; i<3; ++i){
+    myCenter[i]=0.;
+  }
+  mySize=24;
+}
+//====================================================================
+// function: SetCenter
+// purpose:
+//====================================================================
+void VISU_UnScaledActor::SetCenter(float *pC)
+{
+  for (int i=0; i<3; ++i){
+    myCenter[i]=pC[i];
+  }
+}
+//====================================================================
+// function:GetBounds
+// purpose:
+//====================================================================
+float* VISU_UnScaledActor::GetBounds()
+{
+  Superclass::GetBounds();
+  //
+  for (int i=0; i<3; ++i){
+    Bounds[2*i]=myCenter[i];
+    Bounds[2*i+1]=myCenter[i];
+  }
+  return Bounds;
+}
+//====================================================================
+// function:Render
+// purpose:
+//====================================================================
+void VISU_UnScaledActor::Render(vtkRenderer *theRenderer)
+{
+  if(theRenderer){
+    float P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}};
+    theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]);
+    theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]);
+    float aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+
+                            (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+
+                            (P[1][2]-P[0][2])*(P[1][2]-P[0][2]));
+    int* aSize = theRenderer->GetRenderWindow()->GetSize();
+    float aWinDiag = sqrt(float(aSize[0]*aSize[0]+aSize[1]*aSize[1]));
+    vtkDataSet* aDataSet = GetMapper()->GetInput();
+    float aLength = aDataSet->GetLength();
+    float aPrecision = 1.e-3;
+    float anOldScale = GetScale()[0];
+    float aScale = 
+      mySize*aWorldDiag/aWinDiag/aLength*sqrt(float(aSize[0])/float(aSize[1]));
+
+    SetOrigin(myCenter);  
+    //
+    if(fabs(aScale - anOldScale)/aScale > aPrecision){
+      SetScale(aScale);
+    }
+  }
+  vtkFollower::Render(theRenderer);
+  
+}
+//====================================================================
+// function:SetSize
+// purpose:
+//====================================================================
+void VISU_UnScaledActor::SetSize(int theSize)
+{
+  mySize = theSize;
+}
+////
+static float DistanceToPlane(const float x[3], 
+                            const float n[3], 
+                            const float p0[3]);
+
+static void GetBndPoints(vtkDataSet *pDataSet, 
+                         float aPnts[24]);
+
+static
+  bool IsValidPlane2Position(vtkPlane *pPx,
+                             vtkDataSet *pDataSet,
+                             float aTol=0.003);
+
+vtkCxxRevisionMacro(VISU_ImplicitFunctionWidget, "$Revision$");
+vtkStandardNewMacro(VISU_ImplicitFunctionWidget);
+
+//==================================================================
+// function: VISU_ImplicitFunctionWidget
+// purpose :
+//==================================================================
+VISU_ImplicitFunctionWidget::VISU_ImplicitFunctionWidget() 
+: 
+  vtkPolyDataSourceWidget()
+{
+  State = VISU_ImplicitFunctionWidget::Start;
+  EventCallbackCommand->SetCallback(VISU_ImplicitFunctionWidget::ProcessEvents);
+  
+  NormalToXAxis = 0;
+  NormalToYAxis = 0;
+  NormalToZAxis = 0;
+
+  HandleMoveEvent = true;
+  HandleLeftButtonEvent = true;
+  HandleMiddleButtonEvent = false;
+  HandleRightButtonEvent = false;
+
+  // Build the representation of the widget
+  // 
+  myPlane1 = vtkPlane::New();
+  myPlane1->SetNormal(0,0,1);
+  myPlane1->SetOrigin(0,0,0);
+  //
+  myDistance = 10.;
+  myPlane2 = vtkPlane::New();
+  myPlane2->SetNormal(0.,0.,-1.);
+  myPlane2->SetOrigin(0,0,myDistance);
+  //
+  myImplicitFunction = vtkImplicitBoolean::New();
+  myImplicitFunction->SetOperationType(VTK_UNION);  
+  //
+  myBox = vtkImageData::New();
+  myBox->SetDimensions(2,2,2);
+  myOutline = vtkOutlineFilter::New();
+  myOutline->SetInput(myBox);
+  myOutlineMapper = vtkPolyDataMapper::New();
+  myOutlineMapper->SetInput(myOutline->GetOutput());
+  myOutlineActor = vtkActor::New();
+  this->myOutlineActor->SetMapper(this->myOutlineMapper);
+  this->myOutlineActor->PickableOff();
+  this->OutlineTranslation = 0;
+  
+  this->myCutter1 = vtkCutter::New();
+  this->myCutter1->SetInput(myBox);
+  this->myCutter1->SetCutFunction(myPlane1);
+  this->myCutMapper1 = vtkPolyDataMapper::New();
+  this->myCutMapper1->SetInput(this->myCutter1->GetOutput());
+  this->myCutActor1 = vtkActor::New();
+  this->myCutActor1->SetMapper(this->myCutMapper1);
+  this->myDrawPlane = 1;
+
+  this->myEdges1 = vtkFeatureEdges::New();
+  myEdges1->SetColoring(0); 
+  this->myEdges1->SetInput(this->myCutter1->GetOutput());
+  this->myEdgesMapper1 = vtkPolyDataMapper::New();
+  this->myEdgesMapper1->SetInput(this->myEdges1->GetOutput());
+  this->myEdgesActor1 = vtkActor::New();
+  this->myEdgesActor1->SetMapper(this->myEdgesMapper1);
+  myEdgesActor1->GetProperty()->SetLineWidth(4.); 
+  myEdgesActor1->GetProperty()->SetColor(0., .5, .7); 
+
+  this->myCutter2 = vtkCutter::New();
+  this->myCutter2->SetInput(myBox);
+  this->myCutter2->SetCutFunction(this->myPlane2);
+  this->myCutMapper2 = vtkPolyDataMapper::New();
+  this->myCutMapper2->SetInput(this->myCutter2->GetOutput());
+  this->myCutActor2 = vtkActor::New();
+  this->myCutActor2->SetMapper(this->myCutMapper2);
+
+  myEdges2 = vtkFeatureEdges::New();
+  myEdges2->SetColoring(0); 
+  myEdges2->SetInput(myCutter2->GetOutput());
+  myEdgesMapper2 = vtkPolyDataMapper::New();
+  myEdgesMapper2->SetInput(myEdges2->GetOutput());
+  myEdgesActor2 = vtkActor::New();
+  myEdgesActor2->SetMapper(myEdgesMapper2);
+  myEdgesActor2->GetProperty()->SetLineWidth(4.); 
+  myEdgesActor2->GetProperty()->SetColor(.7, .0, .0); 
+
+  // Create the + plane normal
+  this->LineSource = vtkLineSource::New();
+  this->LineSource->SetResolution(1);
+  this->LineMapper = vtkPolyDataMapper::New();
+  this->LineMapper->SetInput(this->LineSource->GetOutput());
+  this->LineActor = vtkActor::New();
+  this->LineActor->SetMapper(this->LineMapper);
+
+  this->ConeSource = vtkConeSource::New();
+  this->ConeSource->SetResolution(12);
+  this->ConeSource->SetAngle(20.);
+  this->ConeMapper = vtkPolyDataMapper::New();
+  this->ConeMapper->SetInput(this->ConeSource->GetOutput());
+  this->ConeActor = VISU_UnScaledActor::New();
+  this->ConeActor->SetMapper(this->ConeMapper);
+  ConeActor->SetSize(36);
+  ConeActor->SetCenter(ConeSource->GetCenter());
+
+  // Create the - plane normal
+  this->LineSource2 = vtkLineSource::New();
+  this->LineSource2->SetResolution(1);
+  this->LineMapper2 = vtkPolyDataMapper::New();
+  this->LineMapper2->SetInput(this->LineSource2->GetOutput());
+  this->LineActor2 = vtkActor::New();
+  this->LineActor2->SetMapper(this->LineMapper2);
+
+  this->ConeSource2 = vtkConeSource::New();
+  this->ConeSource2->SetResolution(12);
+  this->ConeSource2->SetAngle(20.);
+  this->ConeMapper2 = vtkPolyDataMapper::New();
+  this->ConeMapper2->SetInput(this->ConeSource2->GetOutput());
+  this->ConeActor2 = VISU_UnScaledActor::New();
+  this->ConeActor2->SetMapper(this->ConeMapper2);
+  ConeActor2->SetSize(36);
+  ConeActor2->SetCenter(ConeSource2->GetCenter());
+
+  // Create the origin handle
+  this->Sphere = vtkSphereSource::New();
+  this->Sphere->SetThetaResolution(16);
+  this->Sphere->SetPhiResolution(8);
+  this->SphereMapper = vtkPolyDataMapper::New();
+  this->SphereMapper->SetInput(this->Sphere->GetOutput());
+  this->SphereActor = VISU_UnScaledActor::New();
+  this->SphereActor->SetMapper(this->SphereMapper);
+  SphereActor->SetSize(36);
+  SphereActor->SetCenter(Sphere->GetCenter());
+
+  this->Transform = vtkTransform::New();
+
+  // Define the point coordinates
+  float bounds[6];
+  bounds[0] = -0.5;
+  bounds[1] = 0.5;
+  bounds[2] = -0.5;
+  bounds[3] = 0.5;
+  bounds[4] = -0.5;
+  bounds[5] = 0.5;
+
+  // Initial creation of the widget, serves to initialize it
+  this->PlaceWidget(bounds);
+
+  //Manage the picking stuff
+  this->Picker = vtkCellPicker::New();
+  this->Picker->SetTolerance(0.005);
+  this->Picker->AddPickList(this->myCutActor1);
+  this->Picker->AddPickList(this->myCutActor2);
+  this->Picker->AddPickList(this->LineActor);
+  this->Picker->AddPickList(this->ConeActor);
+  this->Picker->AddPickList(this->LineActor2);
+  this->Picker->AddPickList(this->ConeActor2);
+  this->Picker->AddPickList(this->SphereActor);
+  this->Picker->AddPickList(this->myOutlineActor);
+  this->Picker->PickFromListOn();
+  
+  // Set up the initial properties
+  this->CreateDefaultProperties();
+  
+}
+//==================================================================
+// function: ~
+// purpose :
+//==================================================================
+VISU_ImplicitFunctionWidget::~VISU_ImplicitFunctionWidget()
+{  
+  myPlane1->Delete();
+
+  this->myPlane2->Delete();
+  this->myImplicitFunction->Delete();
+
+  myBox->Delete();
+  this->myOutline->Delete();
+  this->myOutlineMapper->Delete();
+  this->myOutlineActor->Delete();
+  
+  this->myCutter1->Delete();
+  this->myCutMapper1->Delete();
+  this->myCutActor1->Delete();
+
+  this->myEdges1->Delete();
+  this->myEdgesMapper1->Delete();
+  this->myEdgesActor1->Delete();
+  
+  myCutter2->Delete();
+  myCutMapper2->Delete();
+  myCutActor2->Delete();
+
+  myEdges2->Delete();
+  myEdgesMapper2->Delete();
+  myEdgesActor2->Delete();
+  
+  this->LineSource->Delete();
+  this->LineMapper->Delete();
+  this->LineActor->Delete();
+
+  this->ConeSource->Delete();
+  this->ConeMapper->Delete();
+  this->ConeActor->Delete();
+
+  this->LineSource2->Delete();
+  this->LineMapper2->Delete();
+  this->LineActor2->Delete();
+
+  this->ConeSource2->Delete();
+  this->ConeMapper2->Delete();
+  this->ConeActor2->Delete();
+
+  this->Sphere->Delete();
+  this->SphereMapper->Delete();
+  this->SphereActor->Delete();
+
+  this->Transform->Delete();
+
+  this->Picker->Delete();
+
+  this->NormalProperty->Delete();
+  this->SelectedNormalProperty->Delete();
+  this->PlaneProperty->Delete();
+  this->SelectedPlaneProperty->Delete();
+  this->OutlineProperty->Delete();
+  this->SelectedOutlineProperty->Delete();
+  this->EdgesProperty->Delete();
+}
+//==================================================================
+// function: ImplicitFunction
+// purpose :
+//==================================================================
+vtkImplicitFunction* VISU_ImplicitFunctionWidget::ImplicitFunction()
+{
+  return this->myImplicitFunction;
+}
+//==================================================================
+// function: SetDistance
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetDistance(const float theDistance)
+{
+  if( theDistance <= 0.0 || theDistance == myDistance )
+    return;
+
+  myDistance=theDistance;
+  //
+  float *origin, *normal, oNew[3], aN2[3]; 
+  origin = myPlane1->GetOrigin();
+  normal = myPlane1->GetNormal();
+  vtkMath::Normalize(normal);
+  oNew[0] = origin[0] + myDistance*normal[0];
+  oNew[1] = origin[1] + myDistance*normal[1];
+  oNew[2] = origin[2] + myDistance*normal[2];
+  myPlane2->SetOrigin(oNew);
+  aN2[0] = -normal[0];
+  aN2[1] = -normal[1];
+  aN2[2] = -normal[2];
+  myPlane2->SetNormal(aN2);
+}
+//==================================================================
+// function: Distance
+// purpose :
+//==================================================================
+float VISU_ImplicitFunctionWidget::Distance()const
+{
+  return myDistance;
+}
+//==================================================================
+// function: SetEnabled
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetEnabled(int enabling)
+{
+  if ( ! this->Interactor )    {
+    vtkErrorMacro(<<"The interactor must be set prior to enabling/disabling widget");
+    return;
+  }
+
+  if ( enabling ) {//------------------------------------------------------------
+    vtkDebugMacro(<<"Enabling plane widget");
+    
+    if ( this->Enabled ){ //already enabled, just return
+      return;
+    }
+    
+    if ( ! this->CurrentRenderer ){
+      this->CurrentRenderer = this->Interactor->FindPokedRenderer(
+        this->Interactor->GetLastEventPosition()[0],
+        this->Interactor->GetLastEventPosition()[1]);
+      if (this->CurrentRenderer == NULL)        {
+        return;
+      }
+    }
+    //
+    vtkCamera *pCamera=CurrentRenderer->GetActiveCamera();
+    pCamera->SetParallelProjection(1);
+    //
+    this->myImplicitFunction->AddFunction(myPlane1);
+    this->myImplicitFunction->AddFunction(this->myPlane2);
+
+    this->Enabled = 1;
+
+    // listen for the following events
+    vtkRenderWindowInteractor *i = this->Interactor;
+    if( this->HandleMoveEvent )    {
+      i->AddObserver(vtkCommand::MouseMoveEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+    }
+    if( this->HandleLeftButtonEvent )    {
+      i->AddObserver(vtkCommand::LeftButtonPressEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+      i->AddObserver(vtkCommand::LeftButtonReleaseEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+    }
+    if( this->HandleMiddleButtonEvent )    {
+      i->AddObserver(vtkCommand::MiddleButtonPressEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+      i->AddObserver(vtkCommand::MiddleButtonReleaseEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+    }
+    if( this->HandleRightButtonEvent )    {
+      i->AddObserver(vtkCommand::RightButtonPressEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+      i->AddObserver(vtkCommand::RightButtonReleaseEvent, 
+                    this->EventCallbackCommand, 
+                    this->Priority);
+    }
+    // add the outline
+    this->CurrentRenderer->AddActor(this->myOutlineActor);
+    this->myOutlineActor->SetProperty(this->OutlineProperty);
+
+    // add the edges
+    this->CurrentRenderer->AddActor(this->myEdgesActor1);
+    this->CurrentRenderer->AddActor(myEdgesActor2);
+
+    this->myOutlineActor->SetProperty(this->EdgesProperty);
+
+    // add the normal vector
+    this->CurrentRenderer->AddActor(this->LineActor);
+    this->LineActor->SetProperty(this->NormalProperty);
+    this->CurrentRenderer->AddActor(this->ConeActor);
+    this->ConeActor->SetProperty(this->NormalProperty);
+
+    this->CurrentRenderer->AddActor(this->LineActor2);
+    this->LineActor2->SetProperty(this->NormalProperty);
+    this->CurrentRenderer->AddActor(this->ConeActor2);
+    this->ConeActor2->SetProperty(this->NormalProperty);
+    
+    // add the origin handle
+    this->CurrentRenderer->AddActor(this->SphereActor);
+    this->SphereActor->SetProperty(this->NormalProperty);
+
+    // add the plane (if desired)
+    if ( this->myDrawPlane )      {
+      this->CurrentRenderer->AddActor(this->myCutActor1);
+      this->CurrentRenderer->AddActor(this->myCutActor2);
+    }
+    this->myCutActor1->SetProperty(this->PlaneProperty);
+    myCutActor2->SetProperty(this->PlaneProperty);
+    
+    this->UpdateRepresentation();
+    this->SizeHandles();
+    this->InvokeEvent(vtkCommand::EnableEvent,NULL);
+  }
+  
+  else {//disabling----------------------------------------------------------
+    vtkDebugMacro(<<"Disabling plane widget");
+
+    if ( ! this->Enabled ) {//already disabled, just return
+      return;
+    }
+    
+    if(vtkImplicitFunctionCollection* aFunction = this->myImplicitFunction->GetFunction()){
+      aFunction->RemoveAllItems();
+      this->myImplicitFunction->Modified(); // VTK bug
+    }
+
+    this->Enabled = 0;
+
+    // don't listen for events any more
+    this->Interactor->RemoveObserver(this->EventCallbackCommand);
+
+    // turn off the various actors
+    this->CurrentRenderer->RemoveActor(this->myOutlineActor);
+    this->CurrentRenderer->RemoveActor(this->myEdgesActor1);
+    this->CurrentRenderer->RemoveActor(myEdgesActor2);
+    this->CurrentRenderer->RemoveActor(this->LineActor);
+    this->CurrentRenderer->RemoveActor(this->ConeActor);
+    this->CurrentRenderer->RemoveActor(this->LineActor2);
+    this->CurrentRenderer->RemoveActor(this->ConeActor2);
+    this->CurrentRenderer->RemoveActor(this->SphereActor);
+    this->CurrentRenderer->RemoveActor(this->myCutActor1);
+    this->CurrentRenderer->RemoveActor(myCutActor2);
+
+    this->InvokeEvent(vtkCommand::DisableEvent,NULL);
+    this->CurrentRenderer = NULL;
+  }
+  
+  this->Interactor->Render();
+}
+//==================================================================
+// function: IsEnabled
+// purpose :
+//==================================================================
+int VISU_ImplicitFunctionWidget::IsEnabled()
+{
+  return this->Enabled;
+}
+//==================================================================
+// function: ProcessEvents
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::ProcessEvents(vtkObject* vtkNotUsed(object), 
+                                               unsigned long event,
+                                               void* clientdata, 
+                                               void* vtkNotUsed(calldata))
+{
+  VISU_ImplicitFunctionWidget* self = 
+    reinterpret_cast<VISU_ImplicitFunctionWidget *>( clientdata );
+
+  //okay, let's do the right thing
+  switch(event)
+    {
+    case vtkCommand::LeftButtonPressEvent:
+      self->OnLeftButtonDown();
+      break;
+    case vtkCommand::LeftButtonReleaseEvent:
+      self->OnLeftButtonUp();
+      break;
+    case vtkCommand::MiddleButtonPressEvent:
+      self->OnMiddleButtonDown();
+      break;
+    case vtkCommand::MiddleButtonReleaseEvent:
+      self->OnMiddleButtonUp();
+      break;
+    case vtkCommand::RightButtonPressEvent:
+      self->OnRightButtonDown();
+      break;
+    case vtkCommand::RightButtonReleaseEvent:
+      self->OnRightButtonUp();
+      break;
+    case vtkCommand::MouseMoveEvent:
+      self->OnMouseMove();
+      break;
+    default:
+      break;
+    }
+}
+//==================================================================
+// function: HighlightNormal
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::HighlightNormal(int highlight)
+{
+  if ( highlight ) {
+    this->LineActor->SetProperty(this->SelectedNormalProperty);
+    this->ConeActor->SetProperty(this->SelectedNormalProperty);
+    this->LineActor2->SetProperty(this->SelectedNormalProperty);
+    this->ConeActor2->SetProperty(this->SelectedNormalProperty);
+    this->SphereActor->SetProperty(this->SelectedNormalProperty);
+    }
+  else
+    {
+    this->LineActor->SetProperty(this->NormalProperty);
+    this->ConeActor->SetProperty(this->NormalProperty);
+    this->LineActor2->SetProperty(this->NormalProperty);
+    this->ConeActor2->SetProperty(this->NormalProperty);
+    this->SphereActor->SetProperty(this->NormalProperty);
+    }
+}
+//==================================================================
+// function: HighlightPlane
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::HighlightPlane(int highlight)
+{
+  if ( highlight )    {
+    this->myCutActor1->SetProperty(this->SelectedPlaneProperty);
+    myCutActor2->SetProperty(this->SelectedPlaneProperty);
+  }
+  else    {
+    this->myCutActor1->SetProperty(this->PlaneProperty);
+    myCutActor2->SetProperty(this->PlaneProperty);
+  }
+}
+//==================================================================
+// function: HighlightOutline
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::HighlightOutline(int highlight)
+{
+  if (highlight)    {
+    this->myOutlineActor->SetProperty(this->SelectedOutlineProperty);
+  }
+  else    {
+    this->myOutlineActor->SetProperty(this->OutlineProperty);
+  }
+}
+//==================================================================
+// function: OnLeftButtonDown
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnLeftButtonDown()
+{
+  // We're only here if we are enabled
+  int X = this->Interactor->GetEventPosition()[0];
+  int Y = this->Interactor->GetEventPosition()[1];
+  //
+  // Okay, we can process this. See if we've picked anything.
+  // Make sure it's in the activated renderer
+  vtkRenderer *ren = this->Interactor->FindPokedRenderer(X,Y);
+  if ( ren != this->CurrentRenderer )    {
+    this->State = VISU_ImplicitFunctionWidget::Outside;
+    return;
+  }
+  
+  vtkAssemblyPath *path;
+  this->Picker->Pick(X,Y,0.0,this->CurrentRenderer);
+  path = this->Picker->GetPath();
+
+  if ( path == NULL ) {//not picking this widget
+    this->HighlightPlane(0);
+    this->HighlightNormal(0);
+    this->HighlightOutline(0);
+    this->State = VISU_ImplicitFunctionWidget::Outside;
+    return;
+  }
+
+  vtkProp *prop = path->GetFirstNode()->GetProp();
+  this->ValidPick = 1;
+  this->Picker->GetPickPosition(this->LastPickPosition);
+  //
+  if ( prop == this->ConeActor || prop == this->LineActor ||
+       prop == this->ConeActor2 || prop == this->LineActor2 )  {
+    this->HighlightPlane(1);
+    this->HighlightNormal(1);
+    this->State = VISU_ImplicitFunctionWidget::Rotating;
+  }
+  else if ( prop == this->myCutActor1)    {
+    this->HighlightPlane(1);
+    this->State = VISU_ImplicitFunctionWidget::Pushing;
+  }
+  else if ( prop == this->SphereActor )    {
+    this->HighlightNormal(1);
+    this->State = VISU_ImplicitFunctionWidget::MovingOrigin;
+  }
+  else if (prop == myCutActor2)    {
+    this->HighlightPlane(1);
+    this->State = VISU_ImplicitFunctionWidget::ChangeDistance;
+  }
+  else    {
+    if ( this->OutlineTranslation )      {
+      this->HighlightOutline(1);
+      this->State = VISU_ImplicitFunctionWidget::MovingOutline;
+    }
+  }
+  
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->StartInteraction();
+  this->InvokeEvent(vtkCommand::StartInteractionEvent,NULL);
+  this->Interactor->Render();
+}
+//==================================================================
+// function: OnLeftButtonUp
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnLeftButtonUp()
+{
+  if ( this->State == VISU_ImplicitFunctionWidget::Outside )    {
+    return;
+  }
+
+  this->State = VISU_ImplicitFunctionWidget::Start;
+  this->HighlightPlane(0);
+  this->HighlightOutline(0);
+  this->HighlightNormal(0);
+  this->SizeHandles();
+  
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->EndInteraction();
+  this->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
+  this->Interactor->Render();
+}
+//==================================================================
+// function: OnMiddleButtonDown
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnMiddleButtonDown()
+{
+  int X = this->Interactor->GetEventPosition()[0];
+  int Y = this->Interactor->GetEventPosition()[1];
+
+  // Okay, we can process this. See if we've picked anything.
+  // Make sure it's in the activated renderer
+  vtkRenderer *ren = this->Interactor->FindPokedRenderer(X,Y);
+  if ( ren != this->CurrentRenderer )    {
+    this->State = VISU_ImplicitFunctionWidget::Outside;
+    return;
+  }
+  
+  // Okay, we can process this.
+  vtkAssemblyPath *path;
+  this->Picker->Pick(X,Y,0.0,this->CurrentRenderer);
+  path = this->Picker->GetPath();
+  
+  if ( path == NULL ) {//nothing picked
+    this->State = VISU_ImplicitFunctionWidget::Outside;
+    return;
+  }
+
+  this->ValidPick = 1;
+  this->Picker->GetPickPosition(this->LastPickPosition);
+  this->State = VISU_ImplicitFunctionWidget::MovingPlane;
+  this->HighlightNormal(1);
+  this->HighlightPlane(1);
+  
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->StartInteraction();
+  this->InvokeEvent(vtkCommand::StartInteractionEvent,NULL);
+  this->Interactor->Render();
+}
+//==================================================================
+// function: OnMiddleButtonUp
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnMiddleButtonUp()
+{
+  if ( this->State == VISU_ImplicitFunctionWidget::Outside )    {
+    return;
+  }
+
+  this->State = VISU_ImplicitFunctionWidget::Start;
+  this->HighlightPlane(0);
+  this->HighlightOutline(0);
+  this->HighlightNormal(0);
+  this->SizeHandles();
+  
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->EndInteraction();
+  this->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
+  this->Interactor->Render();
+}
+//==================================================================
+// function: OnRightButtonDown
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnRightButtonDown()
+{
+  this->State = VISU_ImplicitFunctionWidget::Scaling;
+
+  int X = this->Interactor->GetEventPosition()[0];
+  int Y = this->Interactor->GetEventPosition()[1];
+
+  // Okay, we can process this. See if we've picked anything.
+  // Make sure it's in the activated renderer
+  vtkRenderer *ren = this->Interactor->FindPokedRenderer(X,Y);
+  if ( ren != this->CurrentRenderer )    {
+    this->State = VISU_ImplicitFunctionWidget::Outside;
+    return;
+  }
+  
+  // Okay, we can process this. Try to pick handles first;
+  // if no handles picked, then pick the bounding box.
+  vtkAssemblyPath *path;
+  this->Picker->Pick(X,Y,0.0,this->CurrentRenderer);
+  path = this->Picker->GetPath();
+  if ( path == NULL ){ //nothing picked
+    this->State = VISU_ImplicitFunctionWidget::Outside;
+    return;
+  }
+  
+  this->ValidPick = 1;
+  this->Picker->GetPickPosition(this->LastPickPosition);
+  this->HighlightPlane(1);
+  this->HighlightOutline(1);
+  this->HighlightNormal(1);
+  
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->StartInteraction();
+  this->InvokeEvent(vtkCommand::StartInteractionEvent,NULL);
+  this->Interactor->Render();
+}
+//==================================================================
+// function: OnRightButtonUp
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnRightButtonUp()
+{
+  if ( this->State == VISU_ImplicitFunctionWidget::Outside )    {
+    return;
+  }
+  
+  this->State = VISU_ImplicitFunctionWidget::Start;
+  this->HighlightPlane(0);
+  this->HighlightOutline(0);
+  this->HighlightNormal(0);
+  this->SizeHandles();
+  
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->EndInteraction();
+  this->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
+  this->Interactor->Render();
+}
+//==================================================================
+// function: OnMouseMove
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::OnMouseMove()
+{
+  this->SizeHandles();
+
+  // See whether we're active
+  if ( this->State == VISU_ImplicitFunctionWidget::Outside || 
+       this->State == VISU_ImplicitFunctionWidget::Start )    {
+    return;
+  }
+  
+  int X = this->Interactor->GetEventPosition()[0];
+  int Y = this->Interactor->GetEventPosition()[1];
+
+  // Do different things depending on state
+  // Calculations everybody does
+  double focalPoint[4], pickPoint[4], prevPickPoint[4];
+  double z, vpn[3];
+
+  vtkCamera *camera = this->CurrentRenderer->GetActiveCamera();
+  if ( !camera ) {
+    return;
+  }
+
+  // Compute the two points defining the motion vector
+  this->ComputeWorldToDisplay(this->LastPickPosition[0], this->LastPickPosition[1],
+                              this->LastPickPosition[2], focalPoint);
+  z = focalPoint[2];
+  this->ComputeDisplayToWorld(double(this->Interactor->GetLastEventPosition()[0]),
+                              double(this->Interactor->GetLastEventPosition()[1]),
+                              z, prevPickPoint);
+  this->ComputeDisplayToWorld(double(X), double(Y), z, pickPoint);
+
+  // Process the motion
+  if ( this->State == VISU_ImplicitFunctionWidget::MovingPlane )    {
+    //this->TranslatePlane(prevPickPoint, pickPoint);
+    //printf(" TranslatePlane\n");
+  }
+  else if ( this->State == VISU_ImplicitFunctionWidget::MovingOutline )    {
+    //this->TranslateOutline(prevPickPoint, pickPoint);
+    //printf(" TranslateOutline\n");
+  }
+  else if ( this->State == VISU_ImplicitFunctionWidget::MovingOrigin )    {
+    this->TranslateOrigin(prevPickPoint, pickPoint);
+    //printf(" TranslateOrigin\n");
+  }
+  else if ( this->State == VISU_ImplicitFunctionWidget::Pushing )    {
+    this->Push(prevPickPoint, pickPoint);
+   // printf(" Push\n");
+  }
+  else if ( this->State == VISU_ImplicitFunctionWidget::Scaling )    {
+    //this->Scale(prevPickPoint, pickPoint, X, Y);
+    //printf(" Scale\n");
+  }
+  else if ( this->State == VISU_ImplicitFunctionWidget::Rotating )    {
+    camera->GetViewPlaneNormal(vpn);
+    this->Rotate(X, Y, prevPickPoint, pickPoint, vpn);
+    //printf(" Rotate\n");
+  }
+  else if ( this->State == VISU_ImplicitFunctionWidget::ChangeDistance )    {
+    this->PushDistance(prevPickPoint, pickPoint);
+    //printf(" PushDistance\n");
+  }
+  // Interact, if desired
+  this->EventCallbackCommand->SetAbortFlag(1);
+  this->InvokeEvent(vtkCommand::InteractionEvent,NULL);
+  
+  this->Interactor->Render();
+}
+//==================================================================
+// function: Push
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::Push(double *p1, double *p2)
+{
+  //Get the motion vector
+  int i;
+  float v[3];
+  //
+  for (i=0; i<3; ++i){  
+    v[i] = p2[i] - p1[i];
+  }
+  //
+  float aOr1[3], aNr1[3], aNr2[3], aD, z1;
+  //
+  myPlane1->GetOrigin(aOr1);
+  myPlane1->GetNormal(aNr1);
+  myPlane2->GetNormal(aNr2);
+  //
+  aD=vtkMath::Dot(v, aNr2);
+  z1 = aOr1[2]+aD*aNr2[2];
+  if( z1 <= myBox->GetOrigin()[2] ){
+    return;
+  }
+  //  
+  aD=vtkMath::Dot(v, aNr1);
+  for (i=0; i < 3; ++i) {
+    aOr1[i]=aOr1[i]+aD*aNr1[i];
+  }
+  SetOriginInternal(aOr1);
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: TranslateOrigin
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::TranslateOrigin(double *p1, double *p2)
+{
+  //Get the motion vector
+  int i;
+  double v[3];
+  //
+  for (i=0; i<3; ++i){  
+    v[i] = p2[i] - p1[i];
+  }
+  //
+  //Add to the current point, project back down onto plane
+  float *o = myPlane1->GetOrigin();
+  float *n = myPlane1->GetNormal();
+  float newOrigin[3];
+  //
+  for (i=0; i<3; ++i){
+    newOrigin[i]=o[i] + v[i];
+  }
+  vtkPlane::ProjectPoint(newOrigin, o, n, newOrigin);
+  SetOriginInternal(newOrigin); 
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: SetOriginInternal
+// purpose : Set the origin of the plane.(for Internal calls)
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetOriginInternal(float x[3]) 
+{
+  float *bounds = this->myOutline->GetOutput()->GetBounds();
+  int i, j;
+  for (i=0; i<3; ++i)    {
+    j=2*i;
+    if ( x[i] < bounds[j] ) {
+      x[i] = bounds[j];
+    }
+    else if ( x[i] > bounds[j+1] ) {
+      x[i] = bounds[j+1];
+    }
+  }
+  //
+  bool bFlag;
+  float aOr2[3], aNr2[3], aNr1[3];
+  vtkPlane *pPx;
+  //
+  myPlane1->GetNormal(aNr1);
+  myPlane2->GetNormal(aNr2);
+  for (i=0; i<3; ++i)    {
+    aOr2[i]=x[i]+myDistance*aNr1[i];
+  }
+  pPx=vtkPlane::New();
+  pPx->SetOrigin(aOr2);
+  pPx->SetNormal(aNr2);
+  bFlag=IsValidPlane2Position(pPx, myBox);
+  if (bFlag){
+    myPlane1->SetOrigin(x);
+    myPlane2->SetOrigin(aOr2);
+  }
+  pPx->Delete();
+}
+//==================================================================
+// function: Rotate
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::Rotate(int X, int Y, 
+                                         double *p1, double *p2, 
+                                         double *vpn)
+{
+  double v[3];    //vector of motion
+  double axis[3]; //axis of rotation
+  double theta;   //rotation angle
+  int i;
+
+  // mouse motion vector in world space
+  for (i=0; i<3; ++i){ 
+    v[i] = p2[i] - p1[i];
+  }
+  //
+  float *origin = myPlane1->GetOrigin();
+  float *normal = myPlane1->GetNormal();
+
+  // Create axis of rotation and angle of rotation
+  vtkMath::Cross(vpn,v,axis);
+  if ( vtkMath::Normalize(axis) == 0.0 )    {
+    return;
+  }
+
+  int *size = this->CurrentRenderer->GetSize();
+  double l2 = (X-this->Interactor->GetLastEventPosition()[0])*
+    (X-this->Interactor->GetLastEventPosition()[0]) + 
+    (Y-this->Interactor->GetLastEventPosition()[1])*
+    (Y-this->Interactor->GetLastEventPosition()[1]);
+  theta = 360.0 * sqrt(l2/((double)size[0]*size[0]+size[1]*size[1]));
+
+  //Manipulate the transform to reflect the rotation
+  this->Transform->Identity();
+  this->Transform->Translate(origin[0],origin[1],origin[2]);
+  this->Transform->RotateWXYZ(theta,axis);
+  this->Transform->Translate(-origin[0],-origin[1],-origin[2]);
+
+  //Set the new normal
+  float nNew[3], aN2[3], oNew[3];
+  this->Transform->TransformNormal(normal,nNew);
+  //
+  for (i=0; i<3; ++i){  
+    aN2[i] = -nNew[i];
+  }
+  vtkMath::Normalize(nNew);
+  for (i=0; i<3; ++i){  
+    oNew[i] = origin[i] + myDistance*nNew[i];
+  }
+  //
+  vtkPlane *pPx=vtkPlane::New();
+  pPx->SetNormal(aN2); 
+  pPx->SetOrigin(oNew);
+  //
+  bool bFlag=IsValidPlane2Position(pPx, myBox);
+  if (bFlag) {
+    myPlane1->SetNormal(nNew);
+    this->myPlane2->SetNormal(aN2); 
+    this->myPlane2->SetOrigin(oNew);
+  } 
+  pPx->Delete();
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: PushDistance
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::PushDistance(double *p1, double *p2)
+{
+  int i;
+  float v[3],  *anOrigin1, *aN1, *anOrigin2, *aN2, aD;
+  //Get the motion vector
+  for (i=0; i<3; ++i){ 
+    v[i] = p2[i] - p1[i];
+  }
+  //
+  anOrigin1 = myPlane1->GetOrigin();
+  aN1 = myPlane1->GetNormal();
+  anOrigin2 = myPlane2->GetOrigin();
+  aN2 = myPlane2->GetNormal();
+
+  vtkMath::Normalize(aN1);
+
+  float origin[3];
+  double distance = vtkMath::Dot( v, aN2 );
+  for(i=0; i<3; ++i) {
+    origin[i] = anOrigin2[i] + distance * aN2[i];
+  }
+  float d = DistanceToPlane(origin, aN1, anOrigin1);
+  if( d <= 0.0 )
+    return;
+  //
+  bool bFlag;
+  float aOr2[3], aNr2[3];
+  vtkPlane *pPx;
+  //
+  myPlane2->GetOrigin(aOr2);
+  myPlane2->GetNormal(aNr2);
+  pPx=vtkPlane::New();
+  pPx->SetNormal(aNr2);
+  aD=vtkMath::Dot(v, aNr2);
+  for (i=0; i < 3; ++i) {
+    aOr2[i]=aOr2[i]+aD*aNr2[i];
+  }
+  pPx->SetOrigin(aOr2);
+  bFlag=IsValidPlane2Position(pPx, myBox);
+  if(bFlag) {
+    myPlane2->SetOrigin(aOr2);
+    myPlane2->Modified();
+    aD=DistanceToPlane(aOr2, aN1, anOrigin1);
+    //
+    myDistance=aD;
+  }
+  pPx->Delete();
+  this->UpdateRepresentation();
+}
+
+//==================================================================
+// function: TranslatePlane
+// purpose : Loop through all points and translate them
+//==================================================================
+void VISU_ImplicitFunctionWidget::TranslatePlane(double *p1, double *p2)
+{
+  //Get the motion vector
+  double v[3];
+  v[0] = p2[0] - p1[0];
+  v[1] = p2[1] - p1[1];
+  v[2] = p2[2] - p1[2];
+  
+  //Translate the plane
+  float oNew[3];
+  float *origin = myPlane1->GetOrigin();
+  oNew[0] = origin[0] + v[0];
+  oNew[1] = origin[1] + v[1];
+  oNew[2] = origin[2] + v[2];
+  myPlane1->SetOrigin(oNew);
+  
+  origin = this->myPlane2->GetOrigin();
+  oNew[0] = origin[0] + v[0];
+  oNew[1] = origin[1] + v[1];
+  oNew[2] = origin[2] + v[2];
+  this->myPlane2->SetOrigin(oNew);
+
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: TranslateOutline
+// purpose :Loop through all points and translate them
+//==================================================================
+void VISU_ImplicitFunctionWidget::TranslateOutline(double *p1, double *p2)
+{
+  //Get the motion vector
+  double v[3];
+  v[0] = p2[0] - p1[0];
+  v[1] = p2[1] - p1[1];
+  v[2] = p2[2] - p1[2];
+  
+  //Translate the bounding box
+  float *origin = myBox->GetOrigin();
+  float oNew[3];
+  oNew[0] = origin[0] + v[0];
+  oNew[1] = origin[1] + v[1];
+  oNew[2] = origin[2] + v[2];
+  myBox->SetOrigin(oNew);
+
+  //Translate the plane
+  origin = myPlane1->GetOrigin();
+  oNew[0] = origin[0] + v[0];
+  oNew[1] = origin[1] + v[1];
+  oNew[2] = origin[2] + v[2];
+  myPlane1->SetOrigin(oNew);
+
+  origin = this->myPlane2->GetOrigin();
+  oNew[0] = origin[0] + v[0];
+  oNew[1] = origin[1] + v[1];
+  oNew[2] = origin[2] + v[2];
+  this->myPlane2->SetOrigin(oNew);
+
+  this->UpdateRepresentation();
+}
+
+//==================================================================
+// function: Scale
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::Scale(double *p1, double *p2, 
+                                       int vtkNotUsed(X), int Y)
+{
+  //Get the motion vector
+  double v[3];
+  v[0] = p2[0] - p1[0];
+  v[1] = p2[1] - p1[1];
+  v[2] = p2[2] - p1[2];
+
+  //int res = this->PlaneSource->GetXResolution();
+  float *o = myPlane1->GetOrigin();
+
+  // Compute the scale factor
+  float sf = vtkMath::Norm(v) / this->myOutline->GetOutput()->GetLength();
+  if ( Y > this->Interactor->GetLastEventPosition()[1] )    {
+    sf = 1.0 + sf;
+  }
+  else    {
+    sf = 1.0 - sf;
+  }
+  
+  this->Transform->Identity();
+  this->Transform->Translate(o[0],o[1],o[2]);
+  this->Transform->Scale(sf,sf,sf);
+  this->Transform->Translate(-o[0],-o[1],-o[2]);
+
+  float *origin = myBox->GetOrigin();
+  float *spacing = myBox->GetSpacing();
+  float oNew[3], p[3], pNew[3];
+  p[0] = origin[0] + spacing[0];
+  p[1] = origin[1] + spacing[1];
+  p[2] = origin[2] + spacing[2];
+
+  this->Transform->TransformPoint(origin,oNew);
+  this->Transform->TransformPoint(p,pNew);
+
+  myBox->SetOrigin(oNew);
+  myBox->SetSpacing( (pNew[0]-oNew[0]), (pNew[1]-oNew[1]), (pNew[2]-oNew[2]) );
+
+  this->UpdateRepresentation();
+}
+
+
+
+//==================================================================
+// function: CreateDefaultProperties
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::CreateDefaultProperties()
+{
+  // Normal properties
+  this->NormalProperty = vtkProperty::New();
+  this->NormalProperty->SetColor(1,1,1);
+  this->NormalProperty->SetLineWidth(2);
+
+  this->SelectedNormalProperty = vtkProperty::New();
+  this->SelectedNormalProperty->SetColor(1,0,0);
+  this->NormalProperty->SetLineWidth(2);
+
+  // Plane properties
+  this->PlaneProperty = vtkProperty::New();
+  this->PlaneProperty->SetAmbient(1.0);
+  this->PlaneProperty->SetAmbientColor(1.0,1.0,1.0);
+
+  this->SelectedPlaneProperty = vtkProperty::New();
+  this->SelectedPlaneProperty->SetAmbient(1.0);
+  this->SelectedPlaneProperty->SetAmbientColor(0.0,1.0,0.0);
+  this->SelectedPlaneProperty->SetOpacity(0.25);
+
+  // Outline properties
+  this->OutlineProperty = vtkProperty::New();
+  this->OutlineProperty->SetAmbient(1.0);
+  this->OutlineProperty->SetAmbientColor(1.0,1.0,1.0);
+
+  this->SelectedOutlineProperty = vtkProperty::New();
+  this->SelectedOutlineProperty->SetAmbient(1.0);
+  this->SelectedOutlineProperty->SetAmbientColor(0.0,1.0,0.0);
+
+  // Edge property
+  this->EdgesProperty = vtkProperty::New();
+  this->EdgesProperty->SetAmbient(1.0);
+  this->EdgesProperty->SetAmbientColor(1.0,1.0,1.0);
+}
+//==================================================================
+// function: InitialPlaceWidget
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::InitialPlaceWidget(float bds[6])
+{
+  float bounds[6], origin[3];
+
+  PlaceWidget(bds);
+  //
+  this->AdjustBounds(bds, bounds, origin);
+  this->SetOrigin((bounds[1]+bounds[0])/2.0,
+                 (bounds[3]+bounds[2])/2.0,
+                 (bounds[5]+bounds[4])/2.0);
+
+  static float DIST_COEFF = 0.1;
+  SetDistance(this->InitialLength*DIST_COEFF);
+  //
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: PlaceWidget
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::PlaceWidget(float bds[6])
+{
+  int i;
+  float bounds[6], origin[3];
+
+  this->AdjustBounds(bds, bounds, origin);
+
+  // Set up the bounding box
+  myBox->SetOrigin(bounds[0],bounds[2],bounds[4]);
+  myBox->SetSpacing((bounds[1]-bounds[0]),(bounds[3]-bounds[2]),
+                        (bounds[5]-bounds[4]));
+  this->myOutline->Update();
+
+  if (this->Input || this->Prop3D)    {
+    this->LineSource->SetPoint1(myPlane1->GetOrigin());
+    if ( this->NormalToYAxis )      {
+      myPlane1->SetNormal(0,1,0);
+      myPlane2->SetNormal(0,-1,0);
+      this->LineSource->SetPoint2(0,1,0);
+    }
+    else if ( this->NormalToZAxis )      {
+      myPlane1->SetNormal(0,0,1);
+      myPlane2->SetNormal(0,0,-1);
+      this->LineSource->SetPoint2(0,0,1);
+    }
+    else{ //default or x-normal
+      myPlane1->SetNormal(1,0,0);
+      myPlane2->SetNormal(-1,0,0);
+      this->LineSource->SetPoint2(1,0,0);
+    }
+  }
+  
+  for (i=0; i<6; i++)    {
+    this->InitialBounds[i] = bounds[i];
+  }
+
+  this->InitialLength = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) +
+                             (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) +
+                             (bounds[5]-bounds[4])*(bounds[5]-bounds[4]));
+
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: SetOrigin
+// purpose :Set the origin of the plane.(for external calls)
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetOrigin(float x, float y, float z) 
+{
+  float origin[3];
+  origin[0] = x;
+  origin[1] = y;
+  origin[2] = z;
+  this->SetOrigin(origin);
+}
+//==================================================================
+// function: SetOrigin 
+// purpose : Set the origin of the plane.(for external calls)
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetOrigin(float x[3])
+{
+  float *bounds = this->myOutline->GetOutput()->GetBounds();
+  for (int i=0; i<3; i++)    {
+    if ( x[i] < bounds[2*i] )      {
+      x[i] = bounds[2*i];
+    }
+    else if ( x[i] > bounds[2*i+1] )      {
+      x[i] = bounds[2*i+1];
+    }
+  }
+  myPlane1->SetOrigin(x);
+  float *origin, *normal, oNew[3];
+  origin = myPlane1->GetOrigin();
+  normal = myPlane1->GetNormal();
+  vtkMath::Normalize(normal);
+  oNew[0] = origin[0] + myDistance*normal[0];
+  oNew[1] = origin[1] + myDistance*normal[1];
+  oNew[2] = origin[2] + myDistance*normal[2];
+  this->myPlane2->SetOrigin(oNew);
+  this->UpdateRepresentation();
+}
+//==================================================================
+// function: GetOrigin
+// purpose :Get the origin of the plane.
+//==================================================================
+float* VISU_ImplicitFunctionWidget::GetOrigin() 
+{
+  return myPlane1->GetOrigin();
+}
+
+void VISU_ImplicitFunctionWidget::GetOrigin(float xyz[3]) 
+{
+  myPlane1->GetOrigin(xyz);
+}
+//==================================================================
+// function: SetNormal
+// purpose :Set the normal to the plane.
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetNormal(float x, float y, float z) 
+{
+  float n[3];
+  n[0] = x;
+  n[1] = y;
+  n[2] = z;
+  vtkMath::Normalize(n);
+  myPlane1->SetNormal(n);
+  n[0] =- x;
+  n[1] =- y;
+  n[2] =- z;
+  this->myPlane2->SetNormal(n);
+
+  this->UpdateRepresentation();
+}
+
+//==================================================================
+// function: SetNormal
+// purpose :Set the normal to the plane.
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetNormal(float n[3]) 
+{
+  this->SetNormal(n[0], n[1], n[2]);
+}
+//==================================================================
+// function: GetNormal
+// purpose :Get the normal to the plane.
+//==================================================================
+float* VISU_ImplicitFunctionWidget::GetNormal() 
+{
+  return myPlane1->GetNormal();
+}
+//==================================================================
+// function: GetNormal
+// purpose :Get the normal to the plane.
+//==================================================================
+void VISU_ImplicitFunctionWidget::GetNormal(float xyz[3]) 
+{
+  myPlane1->GetNormal(xyz);
+}
+//==================================================================
+// function: SetDrawPlane
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetDrawPlane(int drawPlane)
+{
+  if ( drawPlane == this->myDrawPlane )    {
+    return;
+  }
+  
+  this->Modified();
+  this->myDrawPlane = drawPlane;
+  if ( this->Enabled ) {
+    if ( drawPlane ) {
+      this->CurrentRenderer->AddActor(this->myCutActor1);
+      this->CurrentRenderer->AddActor(myCutActor2);
+    }
+    else {
+      this->CurrentRenderer->RemoveActor(this->myCutActor1);
+      this->CurrentRenderer->RemoveActor(myCutActor2);
+    }
+    this->Interactor->Render();
+  }
+}
+//==================================================================
+// function: SetNormalToXAxis
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetNormalToXAxis (int var)
+{
+  if (this->NormalToXAxis != var)    {
+    this->NormalToXAxis = var;
+    this->Modified();
+  }
+  if (var)    {
+    this->NormalToYAxisOff();
+    this->NormalToZAxisOff();
+  }
+}
+//==================================================================
+// function: SetNormalToYAxis
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetNormalToYAxis (int var)
+{
+  if (this->NormalToYAxis != var)    {
+    this->NormalToYAxis = var;
+    this->Modified();
+  }
+  if (var)    {
+    this->NormalToXAxisOff();
+    this->NormalToZAxisOff();
+  }
+}
+//==================================================================
+// function: SetNormalToZAxis
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SetNormalToZAxis (int var)
+{
+  if (this->NormalToZAxis != var)    {
+    this->NormalToZAxis = var;
+    this->Modified();
+  }
+  if (var)    {
+    this->NormalToXAxisOff();
+    this->NormalToYAxisOff();
+  }
+}
+//==================================================================
+// function: GetPolyData
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::GetPolyData(vtkPolyData *pd)
+{ 
+  pd->ShallowCopy(this->myCutter1->GetOutput()); 
+}
+//==================================================================
+// function: GetPolyDataSource
+// purpose :
+//==================================================================
+vtkPolyDataSource *VISU_ImplicitFunctionWidget::GetPolyDataSource()
+{
+  return this->myCutter1;
+}
+//==================================================================
+// function:GetPlane
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::GetPlane(vtkPlane *plane)
+{
+  if ( plane == NULL )    {
+    return;
+  }
+  
+  plane->SetNormal(myPlane1->GetNormal());
+  plane->SetOrigin(myPlane1->GetOrigin());
+}
+//==================================================================
+// function:UpdatePlacement
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::UpdatePlacement(void)
+{
+  this->myOutline->Update();
+  this->myCutter1->Update();
+  this->myEdges1->Update();
+}
+//==================================================================
+// function:UpdateRepresentation
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::UpdateRepresentation()
+{
+  if ( ! this->CurrentRenderer )    {
+    return;
+  }
+
+  float *origin = myPlane1->GetOrigin();
+  float *normal = myPlane1->GetNormal();
+  float p2[3];
+
+  // Setup the plane normal
+  float d = this->myOutline->GetOutput()->GetLength();
+
+  p2[0] = origin[0] + 0.30 * d * normal[0];
+  p2[1] = origin[1] + 0.30 * d * normal[1];
+  p2[2] = origin[2] + 0.30 * d * normal[2];
+
+  this->LineSource->SetPoint1(origin);
+  this->LineSource->SetPoint2(p2);
+  this->ConeSource->SetCenter(p2);
+  this->ConeSource->SetDirection(normal);
+  ConeActor->SetCenter(p2);
+
+  p2[0] = origin[0] - 0.30 * d * normal[0];
+  p2[1] = origin[1] - 0.30 * d * normal[1];
+  p2[2] = origin[2] - 0.30 * d * normal[2];
+
+  this->LineSource2->SetPoint1(origin);
+  this->LineSource2->SetPoint2(p2);
+  this->ConeSource2->SetCenter(p2);
+  this->ConeSource2->SetDirection(normal);
+  ConeActor2->SetCenter(p2);
+
+  // Set up the position handle
+  this->Sphere->SetCenter(origin);
+  SphereActor->SetCenter(origin);
+
+  this->myEdgesMapper1->SetInput(this->myEdges1->GetOutput());
+}
+//==================================================================
+// function:SizeHandles
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::SizeHandles()
+{
+  //  float radius = 
+  this->vtk3DWidget::SizeHandles(1.35);
+}
+//==================================================================
+// function:PrintSelf
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os,indent);
+}
+//==================================================================
+// function: IsValidPlane2Position
+// purpose :
+//==================================================================
+bool IsValidPlane2Position(vtkPlane *pPx,
+                           vtkDataSet *pDataSet,
+                           float aTol)
+{
+  bool bRet;
+  int i, iFound;
+  float aD, aDmax, aPnts[24], aDiagonal;
+  float aTol1, aOr[3], aN[3];
+  //
+  bRet=false;
+  aDiagonal=pDataSet->GetLength();
+  aTol1=aDiagonal*aTol;
+  //
+  GetBndPoints(pDataSet, aPnts);
+  //
+  pPx->GetOrigin(aOr);
+  pPx->GetNormal(aN);
+  vtkMath::Normalize(aN);
+  //
+  iFound=0;
+  aDmax=0.;
+  for (i=0; i<24; i+=3){
+    aD=-DistanceToPlane(aPnts+i, aN, aOr);
+    if (aD>aDmax){
+           aDmax=aD;
+           iFound=1;
+    }
+  }
+  if (iFound && aDmax>aTol1) {
+    bRet=!bRet;
+  }
+  return bRet;
+}
+//==================================================================
+// function: GetBndPoints
+// purpose :
+//==================================================================
+void GetBndPoints(vtkDataSet *pDataSet, 
+                  float aPnts[24])
+{
+  int aIndx[24]={
+    0,2,4,1,2,4,1,3,4,0,3,4,
+    0,2,5,1,2,5,1,3,5,0,3,5
+  };
+  int i;
+  float *pBounds=pDataSet->GetBounds();
+  //
+  for (i=0; i<24; ++i){
+    aPnts[i]=pBounds[aIndx[i]];
+  }
+}
+//==================================================================
+// function: DistanceToPlane
+// purpose :
+//==================================================================
+float DistanceToPlane(const float x[3], 
+                     const float n[3], 
+                     const float p0[3])
+{
+  return ((float) (n[0]*(x[0]-p0[0]) + 
+                  n[1]*(x[1]-p0[1]) +  
+                  n[2]*(x[2]-p0[2])));
+}
diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.h b/src/PIPELINE/VISU_ImplicitFunctionWidget.h
new file mode 100644 (file)
index 0000000..4930989
--- /dev/null
@@ -0,0 +1,313 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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_ImplicitFunctionWidget.h
+//  Author : Peter KURNEV
+//  Module : SALOME
+//  $Header$
+
+#ifndef __VISU_ImplicitFunctionWidget_h
+#define __VISU_ImplicitFunctionWidget_h
+
+#include <vtkPolyDataSourceWidget.h>
+
+class vtkActor;
+class vtkPolyDataMapper;
+class vtkCellPicker;
+class vtkConeSource;
+class vtkLineSource;
+class vtkSphereSource;
+class vtkPlane;
+class vtkCutter;
+class vtkProperty;
+class vtkImageData;
+class vtkOutlineFilter;
+class vtkFeatureEdges;
+class vtkPolyData;
+class vtkTransform;
+class vtkImplicitBoolean;
+class vtkImplicitFunction;
+class VISU_UnScaledActor;
+class vtkDataSet;
+
+class  VISU_ImplicitFunctionWidget : public vtkPolyDataSourceWidget
+{
+public:
+  // Description:
+  // Instantiate the object.
+  static VISU_ImplicitFunctionWidget *New();
+
+  vtkTypeRevisionMacro(VISU_ImplicitFunctionWidget,vtkPolyDataSourceWidget);
+  void PrintSelf(ostream& os, vtkIndent indent);
+
+  void SetDistance (const float theDistance);
+  float Distance()const;
+
+  vtkGetMacro(InitialLength,float);
+  vtkImplicitFunction* ImplicitFunction();
+
+  // Description:
+  // Methods that satisfy the superclass' API.
+  virtual void SetEnabled(int);
+  virtual void PlaceWidget(float bounds[6]);
+  int IsEnabled();
+
+  // Description:
+  // Get the origin of the plane.
+  void SetOrigin(float x, float y, float z);
+  void SetOrigin(float x[3]);
+  float* GetOrigin();
+  void GetOrigin(float xyz[3]);
+
+  // Description:
+  // Get the normal to the plane.
+  void SetNormal(float x, float y, float z);
+  void SetNormal(float x[3]);
+  float* GetNormal();
+  void GetNormal(float xyz[3]);
+  
+  // Description:
+  // Force the plane widget to be aligned with one of the x-y-z axes.
+  // If one axis is set on, the other two will be set off.
+  // Remember that when the state changes, a ModifiedEvent is invoked.
+  // This can be used to snap the plane to the axes if it is orginally
+  // not aligned.
+  void SetNormalToXAxis(int);
+  vtkGetMacro(NormalToXAxis,int);
+  vtkBooleanMacro(NormalToXAxis,int);
+  void SetNormalToYAxis(int);
+  vtkGetMacro(NormalToYAxis,int);
+  vtkBooleanMacro(NormalToYAxis,int);
+  void SetNormalToZAxis(int);
+  vtkGetMacro(NormalToZAxis,int);
+  vtkBooleanMacro(NormalToZAxis,int);
+
+  // Description:
+  // Turn on/off tubing of the wire outline of the plane. The tube thickens
+  // the line by wrapping with a vtkTubeFilter.
+  //vtkSetMacro(Tubing,int);
+  //vtkGetMacro(Tubing,int);
+  //vtkBooleanMacro(Tubing,int);
+
+  // Description:
+  // Enable/disable the drawing of the plane. In some cases the plane
+  // interferes with the object that it is operating on (i.e., the
+  // plane interferes with the cut surface it produces producing
+  // z-buffer artifacts.)
+  void SetDrawPlane(int plane);
+  int GetDrawPlane(){
+    return myDrawPlane;
+  }
+
+  // Description:
+  // Turn on/off the ability to translate the bounding box by grabbing it
+  // with the left mouse button.
+  vtkSetMacro(OutlineTranslation,int);
+  vtkGetMacro(OutlineTranslation,int);
+  vtkBooleanMacro(OutlineTranslation,int);
+
+  // Description:
+  // Grab the polydata that defines the plane. The polydata contains a single
+  // polygon that is clipped by the bounding box.
+  void GetPolyData(vtkPolyData *pd);
+
+  // Description:
+  // Satisfies superclass API.  This returns a pointer to the underlying
+  // PolyData (which represents the plane).
+  vtkPolyDataSource* GetPolyDataSource();
+   
+  // Description:
+  // Get the implicit function for the plane. The user must provide the
+  // instance of the class vtkPlane. Note that vtkPlane is a subclass of
+  // vtkImplicitFunction, meaning that it can be used by a variety of filters
+  // to perform clipping, cutting, and selection of data.
+  void GetPlane(vtkPlane *plane);
+
+  // Description:
+  // Satisfies the superclass API.  This will change the state of the widget
+  // to match changes that have been made to the underlying PolyDataSource
+  void UpdatePlacement(void);
+
+  // Description:
+  // Get the properties on the normal (line and cone).
+  vtkGetObjectMacro(NormalProperty,vtkProperty);
+  vtkGetObjectMacro(SelectedNormalProperty,vtkProperty);
+  
+  // Description:
+  // Get the plane properties. The properties of the plane when selected 
+  // and unselected can be manipulated.
+  vtkGetObjectMacro(PlaneProperty,vtkProperty);
+  vtkGetObjectMacro(SelectedPlaneProperty,vtkProperty);
+
+  // Description:
+  // Get the property of the outline.
+  vtkGetObjectMacro(OutlineProperty,vtkProperty);
+  vtkGetObjectMacro(SelectedOutlineProperty,vtkProperty);
+
+  // Description:
+  // Get the property of the intersection edges. (This property also
+  // applies to the edges when tubed.)
+  vtkGetObjectMacro(EdgesProperty,vtkProperty);
+
+  void InitialPlaceWidget(float bds[6]);
+
+protected:
+  VISU_ImplicitFunctionWidget();
+  ~VISU_ImplicitFunctionWidget();
+
+//BTX - manage the state of the widget
+  int State;
+  enum WidgetState
+  {
+    Start=0,
+    MovingPlane,
+    MovingOutline,
+    MovingOrigin,
+    Scaling,
+    Pushing,
+    Rotating,
+    Outside,
+    ChangeDistance
+  };
+//ETX
+    
+  //handles the events
+  static void ProcessEvents(vtkObject* object, unsigned long event,
+                            void* clientdata, void* calldata);
+
+  // ProcessEvents() dispatches to these methods.
+  void OnLeftButtonDown();
+  void OnLeftButtonUp();
+  void OnMiddleButtonDown();
+  void OnMiddleButtonUp();
+  void OnRightButtonDown();
+  void OnRightButtonUp();
+  void OnMouseMove();
+  //
+  // Methods to manipulate the plane
+  void ConstrainOrigin(float x[3]);
+  void Rotate(int X, int Y, double *p1, double *p2, double *vpn);
+  void TranslatePlane(double *p1, double *p2);
+  void TranslateOutline(double *p1, double *p2);
+  void TranslateOrigin(double *p1, double *p2);
+  void Push(double *p1, double *p2);
+  void Scale(double *p1, double *p2, int X, int Y);
+  void PushDistance(double *p1, double *p2);
+
+  void CreateDefaultProperties();
+  
+  void GeneratePlane();
+  virtual void SizeHandles();
+  void HighlightPlane(int highlight);
+  void HighlightNormal(int highlight);
+  void HighlightOutline(int highlight);
+  void UpdateRepresentation();
+  void SetOriginInternal(float x[3]);
+
+  // Controlling ivars
+  int NormalToXAxis;
+  int NormalToYAxis;
+  int NormalToZAxis;
+  
+
+  // Flags to handle mouse events
+  bool HandleMoveEvent;
+  bool HandleLeftButtonEvent;
+  bool HandleMiddleButtonEvent;
+  bool HandleRightButtonEvent;
+  // The actual plane which is being manipulated
+  vtkPlane *myPlane1;
+  vtkPlane *myPlane2;
+  
+  float myDistance; 
+  vtkImplicitBoolean *myImplicitFunction;
+
+  // The bounding box is represented by a single voxel image data
+  vtkImageData      *myBox;
+  vtkOutlineFilter  *myOutline;
+  vtkPolyDataMapper *myOutlineMapper;
+  vtkActor          *myOutlineActor;
+  
+  int OutlineTranslation; //whether the outline can be moved
+  
+  // The cut plane is produced with a vtkCutter
+  vtkCutter         *myCutter1;
+  vtkPolyDataMapper *myCutMapper1;
+  vtkActor          *myCutActor1;
+
+  vtkCutter         *myCutter2;
+  vtkPolyDataMapper *myCutMapper2;
+  vtkActor          *myCutActor2;
+  
+  vtkFeatureEdges   *myEdges2;
+  vtkPolyDataMapper *myEdgesMapper2;
+  vtkActor          *myEdgesActor2;
+
+  int               myDrawPlane;
+
+  vtkFeatureEdges   *myEdges1;
+  vtkPolyDataMapper *myEdgesMapper1;
+  vtkActor          *myEdgesActor1;
+
+  // The + normal cone
+  vtkConeSource      *ConeSource;
+  vtkPolyDataMapper  *ConeMapper;
+  VISU_UnScaledActor *ConeActor;
+  // The + normal line
+  vtkLineSource     *LineSource;
+  vtkPolyDataMapper *LineMapper;
+  vtkActor          *LineActor;
+  // The - normal cone
+  vtkConeSource      *ConeSource2;
+  vtkPolyDataMapper  *ConeMapper2;
+  VISU_UnScaledActor *ConeActor2;
+  // The - normal line
+  vtkLineSource     *LineSource2;
+  vtkPolyDataMapper *LineMapper2;
+  vtkActor          *LineActor2;
+  // The origin positioning handle
+  vtkSphereSource    *Sphere;
+  vtkPolyDataMapper  *SphereMapper;
+  VISU_UnScaledActor *SphereActor;
+
+  // Do the picking
+  vtkCellPicker *Picker;
+  
+  // Transform the normal (used for rotation)
+  vtkTransform *Transform;
+  // Properties used to control the appearance of selected objects and
+  // the manipulator in general.
+  vtkProperty *NormalProperty;
+  vtkProperty *SelectedNormalProperty;
+  vtkProperty *PlaneProperty;
+  vtkProperty *SelectedPlaneProperty;
+  vtkProperty *OutlineProperty;
+  vtkProperty *SelectedOutlineProperty;
+  vtkProperty *EdgesProperty;
+  
+private:
+  VISU_ImplicitFunctionWidget(const VISU_ImplicitFunctionWidget&);  //Not implemented
+  void operator=(const VISU_ImplicitFunctionWidget&);  //Not implemented
+};
+
+#endif
index 7462ff51024f04e81bda3dc35be7ae4dbf4a932d..8e14bca9949723895838d7cf74c9a5f2d357fafe 100644 (file)
@@ -48,12 +48,12 @@ VISU_IsoSurfacesPL::~VISU_IsoSurfacesPL(){
 }
 
 void VISU_IsoSurfacesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_IsoSurfacesPL *aPipeLine = dynamic_cast<VISU_IsoSurfacesPL*>(thePipeLine)){
     SetNbParts(aPipeLine->GetNbParts());
     float aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
     SetRange(aRange);
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 int VISU_IsoSurfacesPL::GetNbParts() {
@@ -97,14 +97,13 @@ void VISU_IsoSurfacesPL::Init(){
 }
 
 VISU_ScalarMapPL::THook* VISU_IsoSurfacesPL::DoHook(){
+  VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
   return myContourFilter->GetOutput();
 }
 
 
-void VISU_IsoSurfacesPL::Update(){
-  VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
-  SetMapScale();
-
+void VISU_IsoSurfacesPL::Update()
+{
   VISU_ScalarMapPL::Update();
 }
 
index 06f21c5a526bc4d7d1f9ee72681297388d3f11b2..e942e910634352fa7daddc3a8ef5c88c12d62817 100644 (file)
@@ -40,7 +40,7 @@ VISU_LookupTable *VISU_LookupTable::New() {
 }
 
 VISU_LookupTable::VISU_LookupTable(int sze, int ext)
-  : vtkLookupTable(sze, ext), myScale(1.0) {}
+  : vtkLookupTable(sze, ext), myScale(1.0), myBicolor(false) {}
 
 int VISU_LookupTable::ComputeLogRange(float inRange[2], float outRange[2]){
   if(inRange[0] >= inRange[1])
@@ -65,9 +65,13 @@ unsigned char* VISU_LookupTable::MapValue(float v) {
     float aLowBound = log10(this->TableRange[0]);
     v = pow(10.0f,aLowBound + (v - aLowBound)*myScale);
     return vtkLookupTable::MapValue(v);
-  }else{
+  } else if (!myBicolor) {
     v = this->TableRange[0] + (v - this->TableRange[0])*myScale;
     return vtkLookupTable::MapValue(v);
+  } else {
+    unsigned char* table = this->Table->GetPointer(0);
+    int index = v > 0 ? 4*static_cast<int>(this->GetNumberOfColors()-1) : 0;
+    return &table[index];
   }
 }
 
@@ -113,29 +117,35 @@ inline float VISU_ApplyLogScale(float v, float range[2],
 inline unsigned char *VISU_LinearLookup(float v,   
                                        unsigned char *table,
                                        float maxIndex,
-                                       float shift, float scale)
+                                       float shift, float scale,
+                                       bool bicolor)
 {
-  float findx = (v + shift)*scale;
-  if (findx < 0)
-    {
-    findx = 0;
-    }
-  if (findx > maxIndex)
-    {
-    findx = maxIndex;
-    }
-  return &table[4*static_cast<int>(findx)];
-  /* round
-  return &table[4*(int)(findx + 0.5f)];
-  */
+  if( !bicolor )
+  {
+    float findx = (v + shift)*scale;
+    if (findx < 0)
+      findx = 0;
+    if (findx > maxIndex)
+      findx = maxIndex;
+
+    return &table[4*static_cast<int>(findx)];
+    // round
+    //return &table[4*(int)(findx + 0.5f)];
+  }
+  else
+  {
+    int index = v > 0 ? 4*static_cast<int>(maxIndex) : 0;
+    return &table[index];
+  }
 }
 
 // accelerate the mapping by copying the data in 32-bit chunks instead
 // of 8-bit chunks
 template<class T>
 void VISU_LookupTableMapData(vtkLookupTable *self, T *input, 
-                           unsigned char *output, int length, 
-                           int inIncr, int outFormat, float theMapScale)
+                            unsigned char *output, int length, 
+                            int inIncr, int outFormat,
+                            float theMapScale, bool bicolor)
 {
   int i = length;
   float *range = self->GetTableRange();
@@ -169,7 +179,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -182,7 +192,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -194,7 +204,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           *output++ = cptr[3];
@@ -206,7 +216,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           input += inIncr;
@@ -233,7 +243,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -245,7 +255,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -256,7 +266,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           *output++ = cptr[3];
@@ -267,7 +277,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           input += inIncr;
@@ -300,7 +310,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -313,7 +323,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -325,7 +335,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           *output++ = static_cast<unsigned char>(alpha*cptr[3]);
@@ -337,7 +347,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         while (--i >= 0) 
           {
           val = VISU_ApplyLogScale(*input, range, logRange);
-          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale); 
+          cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           input += inIncr;
@@ -364,7 +374,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -376,7 +386,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale, bicolor); 
           *output++ = *cptr++;
           *output++ = *cptr++;
           *output++ = *cptr++;
@@ -387,7 +397,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           *output++ = static_cast<unsigned char>(cptr[3]*alpha);
@@ -398,7 +408,7 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
         {
         while (--i >= 0) 
           {
-          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale); 
+          cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale, bicolor); 
           *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 + 
                                                  cptr[2]*0.11 + 0.5);
           input += inIncr;
@@ -414,7 +424,8 @@ void VISU_LookupTableMapData(vtkLookupTable *self, T *input,
 template<class T>
 void VISU_LookupTableMapMag(vtkLookupTable *self, T *input, 
                            unsigned char *output, int length, 
-                           int inIncr, int outFormat, float theMapScale)
+                           int inIncr, int outFormat,
+                           float theMapScale, bool bicolor)
 {
   double tmp, sum;
   double *mag;
@@ -433,7 +444,7 @@ void VISU_LookupTableMapMag(vtkLookupTable *self, T *input,
     mag[i] = sqrt(sum);
     }
 
-  VISU_LookupTableMapData(self, mag, output, length, 1, outFormat, theMapScale);
+  VISU_LookupTableMapData(self, mag, output, length, 1, outFormat, theMapScale, bicolor);
 
   delete [] mag;
 }
@@ -455,43 +466,43 @@ void VISU_LookupTable::MapScalarsThroughTable2(void *input,
         break;
       case VTK_CHAR:
         VISU_LookupTableMapMag(this,static_cast<char *>(input),output,
-                              numberOfValues,inputIncrement,outputFormat,myScale);
+                              numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return; 
       case VTK_UNSIGNED_CHAR:
         VISU_LookupTableMapMag(this,static_cast<unsigned char *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_SHORT:
         VISU_LookupTableMapMag(this,static_cast<short *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_UNSIGNED_SHORT:
         VISU_LookupTableMapMag(this,static_cast<unsigned short *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_INT:
         VISU_LookupTableMapMag(this,static_cast<int *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_UNSIGNED_INT:
         VISU_LookupTableMapMag(this,static_cast<unsigned int *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_LONG:
         VISU_LookupTableMapMag(this,static_cast<long *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_UNSIGNED_LONG:
         VISU_LookupTableMapMag(this,static_cast<unsigned long *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_FLOAT:
         VISU_LookupTableMapMag(this,static_cast<float *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       case VTK_DOUBLE:
         VISU_LookupTableMapMag(this,static_cast<double *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
         return;
       default:
         vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType");
@@ -515,7 +526,7 @@ void VISU_LookupTable::MapScalarsThroughTable2(void *input,
       VISU_LookupTableMapData(this,
                              static_cast<unsigned char*>(newInput->GetPointer(0)),
                              output,numberOfValues,
-                             inputIncrement,outputFormat,myScale);
+                             inputIncrement,outputFormat,myScale,myBicolor);
       newInput->Delete();
       bitArray->Delete();
       }
@@ -523,52 +534,52 @@ void VISU_LookupTable::MapScalarsThroughTable2(void *input,
       
     case VTK_CHAR:
       VISU_LookupTableMapData(this,static_cast<char *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_UNSIGNED_CHAR:
       VISU_LookupTableMapData(this,static_cast<unsigned char *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_SHORT:
       VISU_LookupTableMapData(this,static_cast<short *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_UNSIGNED_SHORT:
       VISU_LookupTableMapData(this,static_cast<unsigned short *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_INT:
       VISU_LookupTableMapData(this,static_cast<int *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_UNSIGNED_INT:
       VISU_LookupTableMapData(this,static_cast<unsigned int *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_LONG:
       VISU_LookupTableMapData(this,static_cast<long *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_UNSIGNED_LONG:
       VISU_LookupTableMapData(this,static_cast<unsigned long *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_FLOAT:
       VISU_LookupTableMapData(this,static_cast<float *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     case VTK_DOUBLE:
       VISU_LookupTableMapData(this,static_cast<double *>(input),output,
-                             numberOfValues,inputIncrement,outputFormat,myScale);
+                             numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
       break;
       
     default:
index 769ba89221eae383278a52b2b1085f527c5ac109..cf3f6339d908602f5a176c7332a15b99a5d4795b 100644 (file)
@@ -23,6 +23,9 @@ class VISU_LookupTable: public vtkLookupTable {
    float GetMapScale() { return myScale; }
    void SetMapScale(float theScale = 1.0) { myScale = theScale; Modified(); }
 
+   float GetBicolor() { return myBicolor; }
+   void SetBicolor( bool theBicolor ) { myBicolor = theBicolor; Modified(); }
+
    static int ComputeLogRange(float inRange[2], float outRange[2]);
    unsigned char *MapValue(float v);
 
@@ -31,5 +34,7 @@ class VISU_LookupTable: public vtkLookupTable {
    ~VISU_LookupTable() {};
    
    float myScale;
+
+   bool myBicolor;
 };
 #endif // VISU_LookupTable_H
diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
new file mode 100755 (executable)
index 0000000..0709a85
--- /dev/null
@@ -0,0 +1,1000 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File:    VISU_OpenGLPointSpriteMapper.cxx
+// Author:  
+// Module : VISU
+
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
+#include <vtkCamera.h>
+#include <vtkCellArray.h>
+#include <vtkCellData.h>
+#include <vtkCommand.h>
+#include <vtkDataArray.h>
+#include <vtkFloatArray.h>
+#include <vtkImageData.h>
+#include <vtkMatrix4x4.h>
+#include <vtkObjectFactory.h>
+#include <vtkOpenGLRenderer.h>
+#include <vtkOpenGLRenderWindow.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkPolygon.h>
+#include <vtkProperty.h>
+#include <vtkTimerLog.h>
+#include <vtkTriangle.h>
+
+#include <GL/glext.h>
+//#include <GL/glx.h>
+
+#include <dlfcn.h>
+
+#include <stdio.h>
+#include <cmath>
+#include <string>
+#include <vector>
+
+#ifndef VTK_IMPLEMENT_MESA_CXX
+vtkCxxRevisionMacro(VISU_OpenGLPointSpriteMapper, "Revision$");
+vtkStandardNewMacro(VISU_OpenGLPointSpriteMapper);
+#endif
+
+// some definitions for what the polydata has in it
+#define VTK_PDPSM_COLORS             0x0001
+#define VTK_PDPSM_CELL_COLORS        0x0002
+#define VTK_PDPSM_POINT_TYPE_FLOAT   0x0004
+#define VTK_PDPSM_POINT_TYPE_DOUBLE  0x0008
+#define VTK_PDPSM_NORMAL_TYPE_FLOAT  0x0010
+#define VTK_PDPSM_NORMAL_TYPE_DOUBLE 0x0020
+#define VTK_PDPSM_OPAQUE_COLORS      0x0040
+#define VTK_PDPSM_ALPHA_ARRAY        0x0080
+
+#ifndef GL_ARB_point_sprite
+#define GL_POINT_SPRITE_ARB          0x8861
+#define GL_COORD_REPLACE_ARB         0x8862
+#endif
+/*
+#ifdef GL_ARB_shader_objects
+PFNGLGENPROGRAMSARBPROC              glGenProgramsARB           = NULL;
+PFNGLDELETEPROGRAMSARBPROC           glDeleteProgramsARB        = NULL;
+PFNGLBINDPROGRAMARBPROC              glBindProgramARB           = NULL;
+PFNGLPROGRAMSTRINGARBPROC            glProgramStringARB         = NULL;
+PFNGLPROGRAMENVPARAMETER4FARBPROC    glProgramEnvParameter4fARB = NULL;
+
+PFNGLSHADERSOURCEARBPROC             glShaderSourceARB            = NULL;
+PFNGLCREATESHADEROBJECTARBPROC       glCreateShaderObjectARB      = NULL;
+PFNGLCOMPILESHADERARBPROC            glCompileShaderARB           = NULL;
+PFNGLCREATEPROGRAMOBJECTARBPROC      glCreateProgramObjectARB     = NULL;
+PFNGLATTACHOBJECTARBPROC             glAttachObjectARB            = NULL;
+PFNGLLINKPROGRAMARBPROC              glLinkProgramARB             = NULL;
+PFNGLUSEPROGRAMOBJECTARBPROC         glUseProgramObjectARB        = NULL;
+PFNGLGETOBJECTPARAMETERIVARBPROC     glGetObjectParameterivARB    = NULL;
+PFNGLGETINFOLOGARBPROC               glGetInfoLogARB              = NULL;
+PFNGLGETATTRIBLOCATIONARBPROC        glGetAttribLocationARB       = NULL;
+PFNGLENABLEVERTEXATTRIBARRAYARBPROC  glEnableVertexAttribArrayARB = NULL;
+PFNGLVERTEXATTRIB1FARBPROC           glVertexAttrib1fARB          = NULL;
+#endif
+*/
+
+#ifdef GL_ARB_shader_objects
+//GLhandleARB VISU_OpenGLPointSpriteMapper::VertexProgram = 0;
+#endif
+
+
+struct TVertex
+{
+  GLfloat r, g, b, hue;
+  GLfloat vx, vy, vz;
+  //GLfloat hue;
+};
+
+//-----------------------------------------------------------------------------
+// Construct empty object.
+VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper()
+{
+  this->ListId                   = 0;
+  this->TotalCells               = 0;
+  this->ExtensionsInitialized    = 0;
+  this->ExtensionsOK             = 0;
+  this->AlphaChannelArray        = NULL;
+  this->SizeChannelArray         = NULL;
+  this->DefaultPointSize         = 1.0;
+  this->QuadraticPointDistanceAttenuation[0] = 1.0;
+  this->QuadraticPointDistanceAttenuation[1] = 0.0;
+  this->QuadraticPointDistanceAttenuation[2] = 0.0;
+
+  this->RenderMode               = VISU_OpenGLPointSpriteMapper::Accumulate;
+
+#ifdef GL_ARB_shader_objects
+  this->OpenGLLibrary            = 0;
+#endif
+
+  this->UsePointSprites          = true;
+  this->UseTextures              = true;
+  this->UseShader                = true;
+
+  this->PointSpriteResults       = true;
+
+  this->PointSpriteClamp         = 100.0;
+  this->PointSpriteSize          =   0.0;
+  this->PointSpriteMinSize       =  15.0;
+  this->PointSpriteMaxSize       =  50.0;
+  this->PointSpriteMagnification =   1.0;
+
+  this->PointSpriteAlphaThreshold = 0.1;
+  this->PointSpriteTexture       = 0;
+
+  this->UseOpenGLMapper          = false;
+}
+//-----------------------------------------------------------------------------
+VISU_OpenGLPointSpriteMapper::~VISU_OpenGLPointSpriteMapper()
+{
+  glDeleteTextures( 1, &PointSpriteTexture );
+
+  if (this->LastWindow)
+    {
+    this->ReleaseGraphicsResources(this->LastWindow);
+    }
+  if (this->AlphaChannelArray)
+    {
+    delete [] this->AlphaChannelArray;
+    this->AlphaChannelArray = NULL;
+    }
+  if (this->SizeChannelArray)
+    {
+    delete [] this->SizeChannelArray;
+    this->SizeChannelArray = NULL;
+    }
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
+{
+  VISU_OpenGLPointSpriteMapper* m = VISU_OpenGLPointSpriteMapper::SafeDownCast(mapper);
+  if( m != NULL )
+  {
+    this->SetPointSpriteResults( m->GetPointSpriteResults() );
+
+    this->SetPointSpriteClamp( m->GetPointSpriteClamp() );
+    this->SetPointSpriteSize( m->GetPointSpriteSize() );
+    this->SetPointSpriteMinSize( m->GetPointSpriteMinSize() );
+    this->SetPointSpriteMaxSize( m->GetPointSpriteMaxSize() );
+    this->SetPointSpriteMagnification( m->GetPointSpriteMagnification() );
+
+    this->SetImageData( m->GetImageData() );
+    this->SetPointSpriteAlphaThreshold( m->GetPointSpriteAlphaThreshold() );
+  }
+  MAPPER_SUPERCLASS::ShallowCopy(mapper);
+
+}
+//-----------------------------------------------------------------------------
+char* readFromFile( std::string fileName )
+{
+  FILE* file = fopen( fileName.c_str(), "r" );
+
+  char* content = NULL;
+  int count = 0;
+
+  if( file != NULL )
+  {
+    fseek( file, 0, SEEK_END );
+    count = ftell( file );
+    rewind( file );
+
+    if( count > 0 )
+    {
+      content = ( char* )malloc( sizeof( char ) * ( count + 1 ) );
+      count = fread( content, sizeof( char ), count, file );
+      content[ count ] = '\0';
+    }
+    fclose( file );
+  }
+
+  return content;
+}
+//-----------------------------------------------------------------------------
+#ifdef GL_ARB_shader_objects
+void VISU_OpenGLPointSpriteMapper::PrintInfoLog( GLhandleARB obj )
+{
+  PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB =
+    (PFNGLGETOBJECTPARAMETERIVARBPROC)dlsym( this->OpenGLLibrary, "glGetObjectParameterivARB" );
+  PFNGLGETINFOLOGARBPROC glGetInfoLogARB =
+    (PFNGLGETINFOLOGARBPROC)dlsym( this->OpenGLLibrary, "glGetInfoLogARB" );
+
+  int infologLength = 0;
+  int charsWritten  = 0;
+  char* infoLog;
+
+  glGetObjectParameterivARB( obj, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength );
+
+  if( infologLength > 0 )
+  {
+    infoLog = ( char* )malloc( infologLength );
+    glGetInfoLogARB( obj, infologLength, &charsWritten, infoLog );
+    printf( "%s\n", infoLog );
+    free( infoLog );
+  }
+}
+#endif
+//-----------------------------------------------------------------------------
+#ifdef GL_ARB_shader_objects
+GLhandleARB VISU_OpenGLPointSpriteMapper::InitShader()
+{
+  //cout << "Initializing vertex program" << endl;
+
+  std::string fileName = std::string( getenv( "VISU_ROOT_DIR") ) +
+                         "/share/salome/resources/Vertex_Program_ARB.txt";
+
+  //std::string fileName = std::string( "/dn06/salome/ouv/SALOME/VISU_SRC/resources/Vertex_Program_ARB.txt");
+  char* shader = readFromFile( fileName );
+
+  PFNGLSHADERSOURCEARBPROC glShaderSourceARB =
+    (PFNGLSHADERSOURCEARBPROC)dlsym( this->OpenGLLibrary, "glShaderSourceARB" );
+  PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB =
+    (PFNGLCREATESHADEROBJECTARBPROC)dlsym( this->OpenGLLibrary, "glCreateShaderObjectARB" );
+  PFNGLCOMPILESHADERARBPROC glCompileShaderARB =
+    (PFNGLCOMPILESHADERARBPROC)dlsym( this->OpenGLLibrary, "glCompileShaderARB" );
+  PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB =
+    (PFNGLCREATEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glCreateProgramObjectARB" );
+  PFNGLATTACHOBJECTARBPROC glAttachObjectARB =
+    (PFNGLATTACHOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glAttachObjectARB" );
+  PFNGLLINKPROGRAMARBPROC glLinkProgramARB =
+    (PFNGLLINKPROGRAMARBPROC)dlsym( this->OpenGLLibrary, "glLinkProgramARB" );
+
+  GLhandleARB VertexShader = glCreateShaderObjectARB( GL_VERTEX_SHADER_ARB );
+  glShaderSourceARB( VertexShader, 1, (const GLcharARB**)&shader, NULL );
+  glCompileShaderARB( VertexShader );
+  //this->PrintInfoLog( VertexShader );
+
+  GLhandleARB VertexProgram = glCreateProgramObjectARB();
+  glAttachObjectARB( VertexProgram, VertexShader );
+
+  glLinkProgramARB( VertexProgram );
+  //this->PrintInfoLog( VertexProgram );
+  /*
+  cout << "Shader from " << fileName << endl;
+  for( int i = 0; i < strlen( shader ); i++ )
+    cout << shader[i];
+  cout << endl;
+
+  if( glGetError() == GL_NO_ERROR )
+    cout << "Loading vertex program... ok" << endl << endl;
+  else
+    cout << "Loading vertex program... failed" << endl << endl;
+  */
+  free( shader );
+
+  glMatrixMode( GL_MODELVIEW );
+  glLoadIdentity();
+  glTranslatef( 0.0f, 0.0f, -4.0f );
+  glRotatef( 0.0f, 1.0f, 0.0f, 0.0f );
+  glRotatef( 0.0f, 0.0f, 1.0f, 0.0f );
+
+  return VertexProgram;
+}
+#endif
+//-----------------------------------------------------------------------------
+#ifdef GL_ARB_shader_objects
+void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, float value )
+{
+  PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB =
+    (PFNGLGETATTRIBLOCATIONARBPROC)dlsym( this->OpenGLLibrary, "glGetAttribLocationARB" );
+  PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB =
+    (PFNGLVERTEXATTRIB1FARBPROC)dlsym( this->OpenGLLibrary, "glVertexAttrib1fARB" );
+
+  //cout << VISU_OpenGLPointSpriteMapper::VertexProgram << " ";
+  //cout << glGetAttribLocationARB( VISU_OpenGLPointSpriteMapper::VertexProgram, variable ) << " ";
+  //cout << variable << " " << value << endl;
+
+  //glVertexAttrib1fARB( glGetAttribLocationARB( VISU_OpenGLPointSpriteMapper::VertexProgram, variable ), value );
+  glVertexAttrib1fARB( glGetAttribLocationARB( myVertexProgram, variable ), value );
+}
+#endif
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteResults( bool theResults )
+{
+  float aResults = theResults ? 1.0 : 0.0;
+
+  //cout << "SetPointSpriteResults " << this << " " << aResults << endl;
+
+  this->PointSpriteResults = theResults;
+  //#ifdef GL_ARB_shader_objects
+  //this->SetShaderVariable( "results", theMagnification );
+  //#endif
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp )
+{
+  this->PointSpriteClamp = theClamp;
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize )
+{
+  this->PointSpriteSize = theSize;
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize )
+{
+  this->PointSpriteMinSize = theMinSize;
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize )
+{
+  this->PointSpriteMaxSize = theMaxSize;
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnification )
+{
+  this->PointSpriteMagnification = theMagnification;
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaThreshold )
+{
+  this->PointSpriteAlphaThreshold = theAlphaThreshold;
+  this->Modified();
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::InitExtensions()
+{
+  char* ext = (char*)glGetString( GL_EXTENSIONS );
+  //cout << "OpenGL extensions : " << ext << endl;
+
+  if( strstr( ext, "GL_ARB_point_sprite" ) == NULL ||
+      strstr( ext, "GL_ARB_shader_objects" ) == NULL ||
+      strstr( ext, "GL_ARB_vertex_buffer_object" ) == NULL )
+  {
+    vtkWarningMacro(<<"Initializing ARB extensions failed");
+
+    this->UseOpenGLMapper = true;
+
+    return;
+  }
+
+  /*
+#ifdef GL_ARB_shader_objects
+  void* libHandle = dlopen( "libGL.so", RTLD_LAZY );
+
+  glGenProgramsARB           = (PFNGLGENPROGRAMSARBPROC)dlsym( libHandle, "glGenProgramsARB" );
+  glDeleteProgramsARB        = (PFNGLDELETEPROGRAMSARBPROC)dlsym( libHandle, "glDeleteProgramsARB" );
+  glBindProgramARB           = (PFNGLBINDPROGRAMARBPROC)dlsym( libHandle, "glBindProgramARB" );
+  glProgramStringARB         = (PFNGLPROGRAMSTRINGARBPROC)dlsym( libHandle, "glProgramStringARB" );
+  glProgramEnvParameter4fARB = (PFNGLPROGRAMENVPARAMETER4FARBPROC)dlsym( libHandle, "glProgramEnvParameter4fARB" );
+
+  glShaderSourceARB          = (PFNGLSHADERSOURCEARBPROC)dlsym( libHandle, "glShaderSourceARB" );
+  glCreateShaderObjectARB    = (PFNGLCREATESHADEROBJECTARBPROC)dlsym( libHandle, "glCreateShaderObjectARB" );
+  glCompileShaderARB         = (PFNGLCOMPILESHADERARBPROC)dlsym( libHandle, "glCompileShaderARB" );
+  glCreateProgramObjectARB   = (PFNGLCREATEPROGRAMOBJECTARBPROC)dlsym( libHandle, "glCreateProgramObjectARB" );
+  glAttachObjectARB          = (PFNGLATTACHOBJECTARBPROC)dlsym( libHandle, "glAttachObjectARB" );
+  glLinkProgramARB           = (PFNGLLINKPROGRAMARBPROC)dlsym( libHandle, "glLinkProgramARB" );
+  glUseProgramObjectARB      = (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( libHandle, "glUseProgramObjectARB" );
+  glGetObjectParameterivARB  = (PFNGLGETOBJECTPARAMETERIVARBPROC)dlsym( libHandle, "glGetObjectParameterivARB" );
+  glGetInfoLogARB            = (PFNGLGETINFOLOGARBPROC)dlsym( libHandle, "glGetInfoLogARB" );
+  glGetAttribLocationARB     = (PFNGLGETATTRIBLOCATIONARBPROC)dlsym( libHandle, "glGetAttribLocationARB" );
+  glEnableVertexAttribArrayARB = (PFNGLENABLEVERTEXATTRIBARRAYARBPROC)dlsym( libHandle, "glEnableVertexAttribArrayARB" );
+  glVertexAttrib1fARB        = (PFNGLVERTEXATTRIB1FARBPROC)dlsym( libHandle, "glVertexAttrib1fARB" );
+#endif
+  */
+
+#ifdef GL_ARB_shader_objects
+  if( this->UseShader )
+  {
+    //if( !VISU_OpenGLPointSpriteMapper::VertexProgram )
+    {
+      this->OpenGLLibrary = dlopen( "libGL.so", RTLD_LAZY );
+      //VISU_OpenGLPointSpriteMapper::VertexProgram = this->InitShader();
+      myVertexProgram = this->InitShader();
+    }
+
+    //PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB =
+    //  (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" );
+    //glUseProgramObjectARB( VISU_OpenGLPointSpriteMapper::VertexProgram );
+    /*
+    this->SetShaderVariable( "results",       this->PointSpriteResults );
+    this->SetShaderVariable( "clamp",         this->PointSpriteClamp );
+    this->SetShaderVariable( "geomSize",      this->PointSpriteSize );
+    this->SetShaderVariable( "minSize",       this->PointSpriteMinSize );
+    this->SetShaderVariable( "maxSize",       this->PointSpriteMaxSize );
+    this->SetShaderVariable( "magnification", this->PointSpriteMagnification );
+    */
+  }
+#endif
+
+  this->ExtensionsOK = 1;
+  this->ExtensionsInitialized = 1;
+}
+//-----------------------------------------------------------------------------
+//
+// Receives from Actor -> maps data to primitives
+//
+void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
+{
+  if( !this->ExtensionsInitialized && !this->UseOpenGLMapper )
+  {
+    this->InitExtensions();
+    //act->GetProperty()->SetPointSize( 10.0f );
+  }
+
+  if( this->UseOpenGLMapper )
+  {
+    //cout << "Using OpenGLMapper" << endl;
+    MAPPER_SUPERCLASS::RenderPiece( ren, act );
+    return;
+  }
+
+  vtkIdType numPts;
+  vtkPolyData *input= this->GetInput();
+
+  //
+  // make sure that we've been properly initialized
+  //
+  if (ren->GetRenderWindow()->CheckAbortStatus())
+    return;
+
+  if ( input == NULL )
+  {
+    vtkErrorMacro(<< "No input!");
+    return;
+  }
+  else
+  {
+    this->InvokeEvent(vtkCommand::StartEvent,NULL);
+    input->Update();
+    this->InvokeEvent(vtkCommand::EndEvent,NULL);
+
+    numPts = input->GetNumberOfPoints();
+  }
+
+  if (numPts == 0)
+  {
+    vtkDebugMacro(<< "No points!");
+    return;
+  }
+
+  if ( this->LookupTable == NULL )
+    this->CreateDefaultLookupTable();
+
+  // make sure our window is current
+  ren->GetRenderWindow()->MakeCurrent();
+
+  // For vertex coloring, this sets this->Colors as side effect.
+  // Color arrays are cached. If nothing has changed,
+  // then the scalars do not have to be regenerted.
+  this->ActorOpacity = act->GetProperty()->GetOpacity();
+  this->MapScalars(this->ActorOpacity);
+
+  // Initializing the texture for Point Sprites
+  if( this->UseTextures )
+    this->InitTextures();
+
+  //
+  // if something has changed regenerate colors and display lists
+  // if required
+  //
+  int noAbort=1;
+  if ( this->GetMTime() > this->BuildTime ||
+       input->GetMTime() > this->BuildTime ||
+       act->GetProperty()->GetMTime() > this->BuildTime ||
+       ren->GetRenderWindow() != this->LastWindow)
+  {
+    if (!this->ImmediateModeRendering &&
+        !this->GetGlobalImmediateModeRendering())
+    {
+      this->ReleaseGraphicsResources(ren->GetRenderWindow());
+      this->LastWindow = ren->GetRenderWindow();
+
+      // get a unique display list id
+      this->ListId = glGenLists(1);
+      glNewList(this->ListId,GL_COMPILE);
+
+      noAbort = this->Draw(ren,act);
+      glEndList();
+
+      // Time the actual drawing
+      this->Timer->StartTimer();
+      glCallList(this->ListId);
+      this->Timer->StopTimer();
+    }
+    else
+    {
+      this->ReleaseGraphicsResources(ren->GetRenderWindow());
+      this->LastWindow = ren->GetRenderWindow();
+    }
+    if (noAbort)
+      this->BuildTime.Modified();
+  }
+  // if nothing changed but we are using display lists, draw it
+  else
+  {
+    if (!this->ImmediateModeRendering &&
+        !this->GetGlobalImmediateModeRendering())
+    {
+      // Time the actual drawing
+      this->Timer->StartTimer();
+      glCallList(this->ListId);
+      this->Timer->StopTimer();
+    }
+  }
+
+  // if we are in immediate mode rendering we always
+  // want to draw the primitives here
+  if (this->ImmediateModeRendering ||
+      this->GetGlobalImmediateModeRendering())
+  {
+    // Time the actual drawing
+    this->Timer->StartTimer();
+    this->Draw(ren,act);
+    this->Timer->StopTimer();
+  }
+
+  this->TimeToDraw = (float)this->Timer->GetElapsedTime();
+
+  // If the timer is not accurate enough, set it to a small
+  // time so that it is not zero
+  if ( this->TimeToDraw == 0.0 )
+    this->TimeToDraw = 0.0001;
+}
+//-----------------------------------------------------------------------------
+float VISU_OpenGLPointSpriteMapper::GetMaximumSupportedSize()
+{
+  float maximumSupportedSize = 300.0;
+  //glGetFloatv( GL_POINT_SIZE_MAX_ARB, &maximumSupportedSize );
+
+  return maximumSupportedSize;
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::InitPointSprites( vtkRenderer* theRenderer, vtkActor* theActor )
+{
+  glEnable( GL_POINT_SPRITE_ARB );
+  glEnable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
+
+  switch (this->RenderMode)
+  {
+    case VISU_OpenGLPointSpriteMapper::Accumulate:
+    {
+      glDisable(GL_DEPTH_TEST);
+
+      glEnable( GL_BLEND );
+      glBlendFunc( GL_SRC_ALPHA, GL_ONE );
+
+      //cout << this << " THRESHOLD " << this->PointSpriteAlphaThreshold << endl;
+      glEnable( GL_ALPHA_TEST );
+      glAlphaFunc( GL_GREATER, this->PointSpriteAlphaThreshold );
+      break;
+    }
+
+    case VISU_OpenGLPointSpriteMapper::Occlude:
+    {
+      glDepthFunc( GL_LEQUAL );
+      glEnable( GL_DEPTH_TEST );
+
+      glDisable( GL_BLEND );
+      break;
+    }
+
+    default:
+    {
+      break;
+    }
+  }
+  // Disable Lighting/Shading.
+  glDisable( GL_LIGHTING );
+
+  // Disable material properties
+  glDisable( GL_COLOR_MATERIAL );
+  /*
+  // Set Quadratic Attenuation parameters
+  PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB =
+    (PFNGLPOINTPARAMETERFVARBPROC)dlsym( this->OpenGLLibrary, "glPointParameterfvARB" );
+
+  float size = this->DefaultPointSize;
+  vtkCamera* cam =  theRenderer->GetActiveCamera();
+  size *= theActor->GetMatrix()->Determinant();
+  float vp[4];
+  theRenderer->GetViewport(vp);
+  float w, h;
+  w = vp[2] - vp[0];
+  h = vp[3] - vp[1];
+  theRenderer->NormalizedDisplayToDisplay(w, h);
+  size *= h/2;
+  float quadratic[] = {0, 0, 0};
+  if(cam->GetParallelProjection())
+    quadratic[0] = cam->GetParallelScale()*cam->GetParallelScale()/(size*size); 
+  else
+  {
+    size *= 7.4*tan(cam->GetViewAngle()*3.14159/180.);
+    quadratic[2] = 1.0/(size*size);
+  }
+  glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );
+  */
+  /*
+  // Set Quadratic Attenuation parameters
+  glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, this->QuadraticPointDistanceAttenuation );
+
+  // Set Point Fade Threshold size
+  // The alpha of a point is calculated to allow the fading of points
+  // instead of shrinking them past a defined threshold size. The threshold
+  // is defined by GL_POINT_FADE_THRESHOLD_SIZE_ARB and is not clamped to
+  // the minimum and maximum point sizes.
+  glPointParameterfARB( GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0f );
+  glPointParameterfARB( GL_POINT_SIZE_MIN_ARB, 1.0f );
+  glPointParameterfARB( GL_POINT_SIZE_MAX_ARB, CurrentPointSize );
+
+  // Specify point sprite texture coordinate replacement mode for each texture unit
+  glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
+  */
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::CleanupPointSprites()
+{
+  // Set GL params back to normal to stop other vtkMappers diusplaying wrongly
+  glDisable( GL_ALPHA_TEST );
+
+  glEnable( GL_BLEND );
+
+  glEnable( GL_DEPTH_TEST );
+  glEnable( GL_LIGHTING );
+  glEnable( GL_COLOR_MATERIAL );
+  /*
+  // Reset Quadratic Attenuation parameters
+  PFNGLPOINTPARAMETERFVARBPROC glPointParameterfvARB =
+    (PFNGLPOINTPARAMETERFVARBPROC)dlsym( this->OpenGLLibrary, "glPointParameterfvARB" );
+
+  float quadratic[] = {1, 0, 0};
+  glPointParameterfvARB( GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic );
+  */
+  glDisable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
+  glDisable( GL_POINT_SPRITE_ARB );
+}
+
+
+//-----------------------------------------------------------------------------
+void
+VISU_OpenGLPointSpriteMapper
+::SetImageData( vtkImageData* theImageData )
+{
+  //cout << "VISU_OpenGLPointSpriteMapper::SetImageData " << theImageData << endl;
+  this->ImageData = theImageData;
+}
+
+vtkImageData*
+VISU_OpenGLPointSpriteMapper
+::GetImageData()
+{
+  return this->ImageData.GetPointer();
+}
+
+
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::InitTextures()
+{
+  //cout << "VISU_OpenGLPointSpriteMapper::InitTextures " << this->GetImageData() << endl;
+  if( !this->GetImageData() )
+    return;
+
+  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
+  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
+  glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
+
+  int* aSize = GetImageData()->GetDimensions();
+  unsigned char* dataPtr = (unsigned char*)GetImageData()->GetScalarPointer();
+  glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, aSize[0], aSize[1], 0,
+               GL_RGBA, GL_UNSIGNED_BYTE, dataPtr );
+
+  //glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+  glEnable( GL_TEXTURE_2D );
+  glTexEnvf( GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE );
+  glBindTexture( GL_TEXTURE_2D, this->PointSpriteTexture );
+}
+
+//-----------------------------------------------------------------------------
+int ComputeHue( int r, int g, int b )
+{
+  int h = 0;
+
+  int max = r;
+  int whatmax = 0;
+  if( g > max ) {
+    max = g;
+    whatmax = 1;
+  }
+  if( b > max ) {
+    max = b;
+    whatmax = 2;
+  }
+
+  int min = r;
+  if ( g < min ) min = g;
+  if ( b < min ) min = b;
+  int delta = max-min;
+
+  if( delta == 0 )
+    h = 0;
+  else if( whatmax == 0 ) {
+    if ( g >= b )
+      h = (120*(g-b)+delta)/(2*delta);
+    else
+      h = (120*(g-b+delta)+delta)/(2*delta) + 300;
+  }
+  else if( whatmax == 1 ) {
+    if ( b > r )
+      h = 120 + (120*(b-r)+delta)/(2*delta);
+    else
+      h = 60 + (120*(b-r+delta)+delta)/(2*delta);
+  }
+  else {
+    if ( r > g )
+      h = 240 + (120*(r-g)+delta)/(2*delta);
+    else
+      h = 180 + (120*(r-g+delta)+delta)/(2*delta);
+  }
+
+  //cout << h << endl;
+  return h + 1;
+}
+
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
+                                             vtkPoints *p,
+                                             vtkUnsignedCharArray *colors,
+                                             vtkFloatArray *alpha,
+                                             vtkIdType &cellNum,
+                                             int &noAbort,
+                                             vtkCellArray *cells,
+                                             vtkRenderer *ren,
+                                             vtkActor* act)
+{
+  //cout << "VISU_OpenGLPointSpriteMapper::DrawPoints" << endl;
+
+  if( this->UsePointSprites )
+    this->InitPointSprites( ren, act );
+  /*
+  cout << "XSIZE : " << ren->GetRenderWindow()->GetSize()[0] << endl;
+  cout << "YSIZE : " << ren->GetRenderWindow()->GetSize()[1] << endl;
+
+  float p1[3], p2[3];
+
+  ren->SetViewPoint( 0.0, 0.0, 0.0 );
+  ren->ViewToDisplay();
+  ren->GetDisplayPoint( p1 );
+
+  ren->SetViewPoint( 1.0, 1.0, 1.0 );
+  ren->ViewToDisplay();
+  ren->GetDisplayPoint( p2 );
+
+  cout << p1[0] << " " << p1[1] << " " << p1[2] << endl;
+  cout << p2[0] << " " << p2[1] << " " << p2[2] << endl;
+
+  float d = pow( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ), 0.5 );
+  cout << "ZOOM  : " << d / pow( 2, 0.5 ) << endl;
+  */
+
+  glPointSize( this->DefaultPointSize );
+
+#ifdef GL_ARB_vertex_buffer_object
+  PFNGLGENBUFFERSARBPROC    glGenBuffersARB    = (PFNGLGENBUFFERSARBPROC)dlsym( this->OpenGLLibrary, "glGenBuffersARB" );
+  PFNGLBINDBUFFERARBPROC    glBindBufferARB    = (PFNGLBINDBUFFERARBPROC)dlsym( this->OpenGLLibrary, "glBindBufferARB" );
+  PFNGLBUFFERDATAARBPROC    glBufferDataARB    = (PFNGLBUFFERDATAARBPROC)dlsym( this->OpenGLLibrary, "glBufferDataARB" );
+  PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC)dlsym( this->OpenGLLibrary, "glDeleteBuffersARB" );
+
+#ifdef GL_ARB_shader_objects
+  PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB =
+    (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" );
+
+  glUseProgramObjectARB( myVertexProgram );
+
+  this->SetShaderVariable( "results",       this->PointSpriteResults );
+  this->SetShaderVariable( "clamp",         this->PointSpriteClamp );
+  this->SetShaderVariable( "geomSize",      this->PointSpriteSize );
+  this->SetShaderVariable( "minSize",       this->PointSpriteMinSize );
+  this->SetShaderVariable( "maxSize",       this->PointSpriteMaxSize );
+  this->SetShaderVariable( "magnification", this->PointSpriteMagnification );
+#endif
+
+  TVertex* aVertex = new TVertex[ this->TotalCells ];
+
+  float* aPropertyColor      = act->GetProperty()->GetColor();
+  float  aPropertyColorRed   = aPropertyColor[0];
+  float  aPropertyColorGreen = aPropertyColor[1];
+  float  aPropertyColorBlue  = aPropertyColor[2];
+
+  vtkIdType *pts = 0;
+  vtkIdType npts = 0;
+  unsigned long i = 0;
+  for( cells->InitTraversal(); cells->GetNextCell( npts, pts ); i++ )
+  {
+    aVertex[i].vx = p->GetPoint( pts[0] )[0];
+    aVertex[i].vy = p->GetPoint( pts[0] )[1];
+    aVertex[i].vz = p->GetPoint( pts[0] )[2];
+
+    float red, green, blue;
+    if( colors && this->PointSpriteResults )
+    {
+      unsigned char *col = colors->GetPointer(pts[0]<< 2);
+      red   = ( ( int )col[0] ) / 255.0;
+      green = ( ( int )col[1] ) / 255.0;
+      blue  = ( ( int )col[2] ) / 255.0;
+    }
+    else
+    {
+      red   = aPropertyColorRed;
+      green = aPropertyColorGreen;
+      blue  = aPropertyColorBlue;
+    }
+
+    aVertex[i].r = red;
+    aVertex[i].g = green;
+    aVertex[i].b = blue;
+
+    aVertex[i].hue = ComputeHue( ( int )( red * 255 ), ( int )( green * 255 ), ( int )( blue * 255 ) );
+  }
+
+  GLuint aBufferObjectID = 0;
+  glGenBuffersARB( 1, &aBufferObjectID );
+  glBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+
+  int nArrayObjectSize = sizeof( TVertex ) * this->TotalCells;
+  glBufferDataARB( GL_ARRAY_BUFFER_ARB, nArrayObjectSize, aVertex, GL_STATIC_DRAW_ARB );
+
+  delete [] aVertex;
+
+  glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
+  glBindBufferARB( GL_ARRAY_BUFFER_ARB, aBufferObjectID );
+
+  glColorPointer( 4, GL_FLOAT, sizeof(TVertex), (void*)0 );
+  glVertexPointer( 3, GL_FLOAT, sizeof(TVertex), (void*)(4*sizeof(GLfloat)) );
+
+  glEnableClientState(GL_VERTEX_ARRAY);
+  glEnableClientState(GL_COLOR_ARRAY);
+
+  glDrawArrays(GL_POINTS,0,this->TotalCells);
+
+  glDisableClientState(GL_COLOR_ARRAY);
+  glDisableClientState(GL_VERTEX_ARRAY);
+
+  glDeleteBuffersARB( 1, &aBufferObjectID );
+
+#ifdef GL_ARB_shader_objects
+  glUseProgramObjectARB( 0 );
+#endif
+
+#endif
+
+  if( this->UsePointSprites )
+    this->CleanupPointSprites();
+}
+
+//-----------------------------------------------------------------------------
+// Draw method for OpenGL.
+int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act)
+{
+  if( this->UseOpenGLMapper )
+    return MAPPER_SUPERCLASS::Draw( aren, act );
+
+  vtkOpenGLRenderer    *ren    = (vtkOpenGLRenderer *)aren;
+  vtkUnsignedCharArray *colors = NULL;
+  vtkFloatArray        *alpha  = NULL;
+  vtkPolyData          *input  = this->GetInput();
+  vtkPoints            *points;
+  int tDim;
+  int noAbort = 1;
+  int cellScalars = 0;
+  vtkIdType cellNum = 0;
+  float  tran;
+
+  // get the transparency
+  tran = act->GetProperty()->GetOpacity();
+
+  // if the primitives are invisable then get out of here
+  if (tran <= 0.0)
+  {
+    return noAbort;
+  }
+
+  // and draw the display list
+  points = input->GetPoints();
+
+  // are they cell or point scalars
+  if ( this->Colors )
+  {
+    colors = this->Colors;
+    if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
+          this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||
+          !input->GetPointData()->GetScalars() )
+         && this->ScalarMode != VTK_SCALAR_MODE_USE_POINT_FIELD_DATA)
+    {
+      cellScalars = 1;
+    }
+  }
+
+  unsigned long idx = 0;
+  if (colors)
+  {
+    idx |= VTK_PDPSM_COLORS;
+    if (colors->GetName())
+    {
+      // In the future, I will look at the number of components.
+      // All paths will have to handle 3 component colors.
+      idx |= VTK_PDPSM_OPAQUE_COLORS;
+    }
+  }
+  if (cellScalars)
+  {
+    idx |= VTK_PDPSM_CELL_COLORS;
+  }
+
+  // store the types in the index
+  if (points->GetDataType() == VTK_FLOAT)
+  {
+    idx |= VTK_PDPSM_POINT_TYPE_FLOAT;
+  }
+  else if (points->GetDataType() == VTK_DOUBLE)
+  {
+    idx |= VTK_PDPSM_POINT_TYPE_DOUBLE;
+  }
+
+  if (this->AlphaChannelArray && (alpha = vtkFloatArray::SafeDownCast(input->GetPointData()->GetArray(this->AlphaChannelArray)))
+  )
+  {
+    idx |= VTK_PDPSM_ALPHA_ARRAY;
+  }
+
+  // we need to know the total number of cells so that we can report progress
+  this->TotalCells = input->GetVerts()->GetNumberOfCells();
+
+  this->DrawPoints(idx, points, colors, alpha, cellNum, noAbort, input->GetVerts(), ren, act);
+
+  this->UpdateProgress(1.0);
+  return noAbort;
+}
+//-----------------------------------------------------------------------------
+// Release the graphics resources used by this mapper.  In this case, release
+// the display list if any.
+void VISU_OpenGLPointSpriteMapper::ReleaseGraphicsResources(vtkWindow *win)
+{
+  this->Superclass::ReleaseGraphicsResources(win);
+
+  if (this->ListId && win)
+    {
+    win->MakeCurrent();
+    glDeleteLists(this->ListId,1);
+    this->ListId = 0;
+    }
+  this->LastWindow = NULL;
+}
+//-----------------------------------------------------------------------------
+void VISU_OpenGLPointSpriteMapper::PrintSelf(ostream& os, vtkIndent indent)
+{
+  this->Superclass::PrintSelf(os,indent);
+}
+//-----------------------------------------------------------------------------
+
+
+
+
diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx
new file mode 100755 (executable)
index 0000000..5d62462
--- /dev/null
@@ -0,0 +1,247 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+// File:    VISU_OpenGLPointSpriteMapper.hxx
+// Author:  
+// Module : VISU
+
+#ifndef VISU_OpenGLPointSpriteMapper_HeaderFile
+#define VISU_OpenGLPointSpriteMapper_HeaderFile
+
+#if defined(_MSC_VER)
+# pragma warning ( disable : 4275 )
+#endif
+
+#include <GL/gl.h>
+
+#include <vtkSmartPointer.h>
+#include <vtkConfigure.h>
+
+class vtkCellArray;
+class vtkPoints;
+class vtkProperty;
+class vtkRenderWindow;
+class vtkOpenGLRenderer;
+class vtkOpenGLTexture;
+class vtkBMPReader;
+class vtkImageData;
+class vtkFloatArray;
+class vtkXMLImageDataReader;
+
+#ifndef VTK_IMPLEMENT_MESA_CXX
+#include <vtkOpenGLPolyDataMapper.h>
+#define MAPPER_SUPERCLASS vtkOpenGLPolyDataMapper
+#else
+#include <vtkMesaPolyDataMapper.h>
+#define MAPPER_SUPERCLASS vtkMesaPolyDataMapper
+#endif
+
+class VISU_OpenGLPointSpriteMapper : public MAPPER_SUPERCLASS
+{
+public:
+//BTX
+  enum RenderModes {
+    Accumulate=0,
+    Occlude
+  };
+//ETX
+  static VISU_OpenGLPointSpriteMapper *New();
+  vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
+  virtual void PrintSelf(ostream& os, vtkIndent indent);
+
+  void ShallowCopy(vtkAbstractMapper*);
+
+  // Description:
+  // Specify the name of a scalar array which will be used to control
+  // the alpha value of each point. The values should be between 0,1
+  vtkSetStringMacro(AlphaChannelArray);
+  vtkGetStringMacro(AlphaChannelArray);
+
+  // Description:
+  // Specify the name of a scalar array which will be used to control
+  // the size of each point.
+  // NOT YET IMPLEMENTED
+  vtkSetStringMacro(SizeChannelArray);
+  vtkGetStringMacro(SizeChannelArray);
+
+  // Description:
+  // Set the initial point size to be used. This value forms the
+  // base upon which the distance attenuation acts.
+  // Usually the pointsize is set to the maximum supported by the graphics
+  // card for sprite display, then the quadratic factors are adjusted to
+  // bring the size down.
+  // Set the default size to -1 if you wish the value returned by
+  // glGetFloatv( GL_POINT_SIZE_MAX_ARB, &MaximimSupportedSize );
+  // to be used as the initial default point size.
+  vtkSetMacro(DefaultPointSize, float);
+  vtkGetMacro(DefaultPointSize, float);
+
+  // Description:
+  // Set the 3 values (a,b,c) of the parametric function which controls the
+  // reduction in point size with increasing distance (d).
+  // e.g. (1,0,0) will give all points the same size regardless of distance.
+  // @verbatim
+  //     point fading = _____1_______
+  //                   (a + bd + cd^2)
+  // @endverbatim
+  vtkSetVector3Macro(QuadraticPointDistanceAttenuation, float);
+  vtkGetVector3Macro(QuadraticPointDistanceAttenuation, float);
+
+  // Description:
+  // Set/Get the RenderMode for this mapper. Currently 2 modes are supported
+  // Accumulate : Uses glBlendFunc(GL_SRC_ALPHA, GL_ONE), and no depth testing
+  // so that points are accumulated. Suitable for Galaxy plots.
+  // Occlude : No blending. Particles are solid spheres and depth testing is
+  // used as usual. Suitable for most particle simulations without the need
+  // for opacity.
+  vtkSetMacro(RenderMode, int);
+  vtkGetMacro(RenderMode, int);
+  void SetRenderModeToAccumulate() { this->SetRenderMode(Accumulate); }
+  void SetRenderModeToOcclude() { this->SetRenderMode(Occlude); }
+
+  // Description:
+  // Implement superclass render method.
+  virtual void RenderPiece(vtkRenderer *ren, vtkActor *a);
+
+  // Description:
+  // Release any graphics resources that are being consumed by this mapper.
+  // The parameter window could be used to determine which graphic
+  // resources to release.
+  void ReleaseGraphicsResources(vtkWindow *);
+
+  // Description:
+  // Draw method for OpenGL.
+  virtual int Draw(vtkRenderer *ren, vtkActor *a);
+
+  // Description:
+  // Return the maximum point size supported by the graphics hardware.
+  float GetMaximumSupportedSize();
+
+  // Set/Get usage of Point Sprites
+  vtkSetMacro(UsePointSprites, bool);
+  vtkGetMacro(UsePointSprites, bool);
+
+  // Set/Get usage of textures for Point Sprites
+  // (only if usage of Point Sprites is turned on)
+  vtkSetMacro(UseTextures, bool);
+  vtkGetMacro(UseTextures, bool);
+
+  // Set/Get usage of vertex shader
+  // (only if usage of Point Sprites is turned on)
+  vtkSetMacro(UseShader, bool);
+  vtkGetMacro(UseShader, bool);
+
+  // Description:
+  // Point Sprite drawing mode
+  // (Results - multicolor, Geometry - fixed color)
+  vtkGetMacro(PointSpriteResults, bool);
+  void SetPointSpriteResults( bool );
+
+  // Description:
+  // Point Sprite size parameters
+  vtkGetMacro(PointSpriteClamp, float);
+  vtkGetMacro(PointSpriteSize, float);
+  vtkGetMacro(PointSpriteMinSize, float);
+  vtkGetMacro(PointSpriteMaxSize, float);
+  vtkGetMacro(PointSpriteMagnification, float);
+
+  void SetPointSpriteClamp( float );
+  void SetPointSpriteSize( float );
+  void SetPointSpriteMinSize( float );
+  void SetPointSpriteMaxSize( float );
+  void SetPointSpriteMagnification( float );
+
+  vtkGetMacro(PointSpriteAlphaThreshold, float);
+  void SetPointSpriteAlphaThreshold( float );
+
+  void SetImageData(vtkImageData* theImageData);
+  vtkImageData* GetImageData();
+
+protected:
+  VISU_OpenGLPointSpriteMapper();
+  ~VISU_OpenGLPointSpriteMapper();
+
+  void              DrawPoints(int idx,
+                              vtkPoints *p,
+                              vtkUnsignedCharArray *c,
+                              vtkFloatArray *alpha,
+                              vtkIdType &cellNum,
+                              int &noAbort,
+                              vtkCellArray *ca,
+                              vtkRenderer *ren,
+                              vtkActor *act);
+
+  // Initializing OpenGL extensions
+  void              InitExtensions();
+
+  // Activate/deactivate Point Sprites
+  void              InitPointSprites( vtkRenderer*, vtkActor* );
+  void              CleanupPointSprites();
+
+  // Initializing textures for Point Sprites
+  void              InitTextures();
+
+  bool              UsePointSprites;
+  bool              UseTextures;
+  bool              UseShader;
+
+
+  vtkIdType         TotalCells;
+
+  int               ListId;
+  int               ExtensionsInitialized;
+  int               ExtensionsOK;
+  char             *AlphaChannelArray;
+  double            ActorOpacity; 
+  char             *SizeChannelArray;
+  float             DefaultPointSize;
+  float             QuadraticPointDistanceAttenuation[3];
+  int               RenderMode;
+
+#ifdef GL_ARB_shader_objects
+  GLhandleARB       InitShader();
+  void              PrintInfoLog( GLhandleARB );
+  void              SetShaderVariable( const char* variable, float value );
+
+  static GLhandleARB VertexProgram;
+  void*             OpenGLLibrary;
+  GLhandleARB       myVertexProgram;
+#endif
+
+  bool              PointSpriteResults;
+
+  float             PointSpriteClamp;
+  float             PointSpriteSize;
+  float             PointSpriteMinSize;
+  float             PointSpriteMaxSize;
+  float             PointSpriteMagnification;
+
+  GLuint            PointSpriteTexture;
+  float             PointSpriteAlphaThreshold;
+
+  vtkSmartPointer<vtkImageData> ImageData;
+
+  bool              UseOpenGLMapper;
+};
+
+#endif
index d670a681c9628bf6bfccf38c7e55871f2591c04e..fa92ebdaafee559cbea366cf320d5240e834a3cf 100644 (file)
@@ -40,6 +40,7 @@
 #include <vtkPlane.h>
 #include <vtkExtractGeometry.h>
 #include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
 #include <vtkImplicitFunctionCollection.h>
 #include <vtkMath.h>
 
@@ -51,70 +52,111 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
-VISU_PipeLine::VISU_PipeLine()
+VISU_PipeLine
+::VISU_PipeLine():
+  myMapper(vtkDataSetMapper::New()),
+  myExtractGeometry(SALOME_ExtractGeometry::New())
 {
-  if(MYDEBUG) MESSAGE("VISU_PipeLine - "<<this);
+  if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<<this);
+  SetDebug(MYVTKDEBUG);
+
+  myMapper->Delete();
+
   // Clipping planes
-  myExtractGeometry = SALOME_ExtractGeometry::New();
-  //myExtractGeometry->SetReleaseDataFlag(true);
   myExtractGeometry->Delete();
-  //myExtractGeometry->DebugOn();
+  myExtractGeometry->SetStoreMapping(true);
 
   vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
-  myExtractGeometry->SetImplicitBoolean(anImplicitBoolean);
+  myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
   anImplicitBoolean->SetOperationTypeToIntersection();
   anImplicitBoolean->Delete();
 
-  // Mapper
-  myMapper = TMapper::New();
-  myInput = NULL;
-
   myIsShrinkable = false;
 
-  SetDebug(MYVTKDEBUG);
 }
 
-VISU_PipeLine::~VISU_PipeLine()
+VISU_PipeLine
+::~VISU_PipeLine()
 {
-  if(MYDEBUG) MESSAGE("~VISU_PipeLine - "<<this);
-  myMapper->Delete();
+  if(MYDEBUG) MESSAGE("VISU_PipeLine::~VISU_PipeLine - "<<this);
 }
 
-void VISU_PipeLine::ShallowCopy(VISU_PipeLine *thePipeLine){
-  SetInput(thePipeLine->GetInput());
-  myMapper->ShallowCopy(thePipeLine->GetMapper());
-  myExtractGeometry->SetImplicitBoolean(thePipeLine->myExtractGeometry->GetImplicitBoolean());
+// Turn debugging output on.
+void
+VISU_PipeLine
+::DebugOn()
+{
+  myExtractGeometry->DebugOn();
+  Superclass::DebugOn();
+}
+
+// Turn debugging output off.
+void
+VISU_PipeLine
+::DebugOff()
+{
+  myExtractGeometry->DebugOff();
+  Superclass::DebugOff();
+}
+
+void 
+VISU_PipeLine
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
+  SetIDMapper(thePipeLine->GetIDMapper());
+
+  SetImplicitFunction(thePipeLine->GetImplicitFunction());
+
+  vtkDataSet* aDatsSet = myMapper->GetInput();
+  GetMapper()->ShallowCopy(thePipeLine->GetMapper());
+
+  // To restore mapper input from pipeline
+  myMapper->SetInput(aDatsSet);
+
   Build();
 }
 
-void VISU_PipeLine::SameAs(VISU_PipeLine *thePipeLine){
+void
+VISU_PipeLine
+::SameAs(VISU_PipeLine *thePipeLine)
+{
   ShallowCopy(thePipeLine);
-  myExtractGeometry->SetImplicitBoolean(vtkImplicitBoolean::New());
-  myExtractGeometry->GetImplicitBoolean()->Delete();
+  SetImplicitFunction(vtkImplicitBoolean::New());
+  GetImplicitFunction()->Delete();
 }
 
-TInput* VISU_PipeLine::GetInput() const
+TInput* 
+VISU_PipeLine
+::GetInput() const
 {
-  return myInput;
+  return myInput.GetPointer();
 }
 
-TInput* VISU_PipeLine::GetInput2() const
+TInput* 
+VISU_PipeLine
+::GetInput2() const
 {
   vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
   aDataSet->Update();
   return aDataSet;
 }
 
-void VISU_PipeLine::SetInput(TInput* theInput)
+void
+VISU_PipeLine
+::SetInput(TInput* theInput)
 {
+  if(theInput)
+    theInput->Update();
+
   myExtractGeometry->SetInput(theInput);
-  if((myInput = theInput))
-    myInput->Update();
+  myInput = theInput;
 
   Modified();
 }
 
-VISU_PipeLine::TMapper* VISU_PipeLine::GetMapper()
+VISU_PipeLine::TMapper* 
+VISU_PipeLine
+::GetMapper()
 {
   if(GetInput()){
     if(!myMapper->GetInput()){
@@ -123,15 +165,19 @@ VISU_PipeLine::TMapper* VISU_PipeLine::GetMapper()
     }
     myMapper->Update();
   }
-  return myMapper;
+  return myMapper.GetPointer();
 }
 
-void VISU_PipeLine::Update()
+void 
+VISU_PipeLine
+::Update()
 {
   myMapper->Update();
 }
 
-int VISU_PipeLine::CheckAvailableMemory(const float& theSize)
+int
+VISU_PipeLine
+::CheckAvailableMemory(const float& theSize)
 {
   try{
     if(theSize > ULONG_MAX) return 0;
@@ -152,7 +198,10 @@ int VISU_PipeLine::CheckAvailableMemory(const float& theSize)
   return 0;
 }
 
-float VISU_PipeLine::GetAvailableMemory(float theSize, float theMinSize)
+float
+VISU_PipeLine
+::GetAvailableMemory(float theSize, 
+                    float theMinSize)
 {
   while(!CheckAvailableMemory(theSize))
     if(theSize > theMinSize)
@@ -163,8 +212,9 @@ float VISU_PipeLine::GetAvailableMemory(float theSize, float theMinSize)
 }
 
 //------------------------ Clipping planes -----------------------------------
-
-bool VISU_PipeLine::AddClippingPlane(vtkPlane* thePlane)
+bool 
+VISU_PipeLine
+::AddClippingPlane(vtkPlane* thePlane)
 {
   if (thePlane) {
     if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
@@ -182,7 +232,9 @@ bool VISU_PipeLine::AddClippingPlane(vtkPlane* thePlane)
   return true;
 }
 
-vtkPlane* VISU_PipeLine::GetClippingPlane(vtkIdType theID) const
+vtkPlane* 
+VISU_PipeLine
+::GetClippingPlane(vtkIdType theID) const
 {
   vtkPlane* aPlane = NULL;
   if(theID >= 0 && theID < GetNumberOfClippingPlanes()){
@@ -198,7 +250,9 @@ vtkPlane* VISU_PipeLine::GetClippingPlane(vtkIdType theID) const
   return aPlane;
 }
 
-void VISU_PipeLine::RemoveAllClippingPlanes()
+void
+VISU_PipeLine
+::RemoveAllClippingPlanes()
 {
   if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
     vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
@@ -207,7 +261,9 @@ void VISU_PipeLine::RemoveAllClippingPlanes()
   }
 }
 
-vtkIdType VISU_PipeLine::GetNumberOfClippingPlanes() const
+vtkIdType
+VISU_PipeLine
+::GetNumberOfClippingPlanes() const
 {
   if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
     vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
@@ -216,9 +272,13 @@ vtkIdType VISU_PipeLine::GetNumberOfClippingPlanes() const
   return 0;
 }
 
-static void ComputeBoundsParam (vtkDataSet* theDataSet,
-                                float theDirection[3], float theMinPnt[3],
-                                float& theMaxBoundPrj, float& theMinBoundPrj)
+static
+void
+ComputeBoundsParam (vtkDataSet* theDataSet,
+                   float theDirection[3], 
+                   float theMinPnt[3],
+                   float& theMaxBoundPrj, 
+                   float& theMinBoundPrj)
 {
   float aBounds[6];
   theDataSet->GetBounds(aBounds);
@@ -260,8 +320,12 @@ static void ComputeBoundsParam (vtkDataSet* theDataSet,
   theMinPnt[2] = aMinPnt[2];
 }
 
-static void DistanceToPosition (vtkDataSet* theDataSet,
-                                float theDirection[3], float theDist, float thePos[3])
+static
+void
+DistanceToPosition(vtkDataSet* theDataSet,
+                  float theDirection[3], 
+                  float theDist, 
+                  float thePos[3])
 {
   float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
   ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
@@ -271,8 +335,12 @@ static void DistanceToPosition (vtkDataSet* theDataSet,
   thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
 }
 
-static void PositionToDistance (vtkDataSet* theDataSet,
-                                float theDirection[3], float thePos[3], float& theDist)
+static
+void
+PositionToDistance (vtkDataSet* theDataSet,
+                   float theDirection[3], 
+                   float thePos[3], 
+                   float& theDist)
 {
   float aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
   ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
@@ -280,7 +348,11 @@ static void PositionToDistance (vtkDataSet* theDataSet,
   theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
 }
 
-void VISU_PipeLine::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane)
+void
+VISU_PipeLine
+::SetPlaneParam(float theDir[3], 
+               float theDist, 
+               vtkPlane* thePlane)
 {
   thePlane->SetNormal(theDir);
   float anOrigin[3];
@@ -288,7 +360,11 @@ void VISU_PipeLine::SetPlaneParam (float theDir[3], float theDist, vtkPlane* the
   thePlane->SetOrigin(anOrigin);
 }
 
-void VISU_PipeLine::GetPlaneParam (float theDir[3], float& theDist, vtkPlane* thePlane)
+void
+VISU_PipeLine
+::GetPlaneParam(float theDir[3], 
+               float& theDist, 
+               vtkPlane* thePlane)
 {
   thePlane->GetNormal(theDir);
 
@@ -301,7 +377,9 @@ void VISU_PipeLine::GetPlaneParam (float theDir[3], float& theDist, vtkPlane* th
 //function : IsPlanarInput
 //purpose  :
 //=======================================================================
-bool VISU_PipeLine::IsPlanarInput() const
+bool
+VISU_PipeLine
+::IsPlanarInput() const
 {
   float aBounds[6];
   GetInput()->GetBounds( aBounds ); // xmin,xmax, ymin,ymax, zmin,zmax
@@ -312,3 +390,89 @@ bool VISU_PipeLine::IsPlanarInput() const
 
   return false;
 }
+
+//=======================================================================
+vtkIdType 
+VISU_PipeLine
+::GetNodeObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractGeometry->GetNodeObjId(theID);
+  return myIDMapper->GetNodeObjID(anID);
+}
+
+vtkIdType 
+VISU_PipeLine
+::GetNodeVTKID(vtkIdType theID)
+{
+  vtkIdType anID = myIDMapper->GetNodeVTKID(theID);
+  return myExtractGeometry->GetNodeVTKId(anID);
+}
+
+float* 
+VISU_PipeLine
+::GetNodeCoord(int theObjID)
+{
+  return myIDMapper->GetNodeCoord(theObjID);
+}
+
+//=======================================================================
+vtkIdType 
+VISU_PipeLine
+::GetElemObjID(vtkIdType theID)
+{
+  vtkIdType anID = myExtractGeometry->GetElemObjId(theID);
+  return myIDMapper->GetElemObjID(anID);
+}
+
+vtkIdType
+VISU_PipeLine
+::GetElemVTKID(vtkIdType theID)
+{
+  vtkIdType anID = myIDMapper->GetElemVTKID(theID);
+  return myExtractGeometry->GetElemVTKId(anID);
+}
+
+vtkCell* 
+VISU_PipeLine
+::GetElemCell(vtkIdType  theObjID)
+{
+  return myIDMapper->GetElemCell(theObjID);
+}
+
+//=======================================================================
+void
+VISU_PipeLine
+::SetIDMapper(const VISU::PIDMapper& theIDMapper)
+{
+  myIDMapper = theIDMapper;
+  SetInput(myIDMapper->GetVTKOutput());
+}
+
+const VISU::PIDMapper&  
+VISU_PipeLine
+::GetIDMapper() const
+{
+  return myIDMapper;
+}
+
+//=======================================================================
+void
+VISU_PipeLine
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+  myExtractGeometry->SetImplicitFunction(theFunction);
+} 
+
+vtkImplicitFunction * 
+VISU_PipeLine
+::GetImplicitFunction()
+{
+  return myExtractGeometry->GetImplicitFunction();
+}
+
+void
+VISU_PipeLine
+::SetExtractInside(int theFlag)
+{
+  myExtractGeometry->SetExtractInside(theFlag);
+} 
index 4dd6db6ea26d3770e796b46295a50c63775051a8..09945f791354763ceb3d6236b45e306cf0374f69 100644 (file)
 #ifndef VISU_PipeLine_HeaderFile
 #define VISU_PipeLine_HeaderFile
 
+#include <vector>
 #include <vtkObject.h>
 #include <vtkSmartPointer.h>
 
-#include <vector>
+#include "VISU_IDMapper.hxx"
+
+class vtkCell;
+class vtkImplicitFunction;
 
 template <class T>
 class TVTKSmartPtr: public vtkSmartPointer<T>
 {
 public:
-  TVTKSmartPtr() {}
-  TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r) {
+  TVTKSmartPtr()
+  {}
+
+  TVTKSmartPtr(T* r, bool theIsOwner = false): vtkSmartPointer<T>(r) 
+  {
     if(r && theIsOwner)
       r->Delete();
   }
-  TVTKSmartPtr& operator()(T* r, bool theIsOwner = false){
+
+  TVTKSmartPtr& operator()(T* r, bool theIsOwner = false)
+  {
     vtkSmartPointer<T>::operator=(r);
     if(r && theIsOwner)
       r->Delete();
     return *this;
   }
-  TVTKSmartPtr& operator=(T* r){
+
+  TVTKSmartPtr& operator=(T* r)
+  {
     vtkSmartPointer<T>::operator=(r);
     return *this;
   }
-  operator T* () const {
+
+  operator T* () const 
+  {
     return vtkSmartPointer<T>::GetPointer();
   }
 };
 
+class vtkMapper;
 class vtkDataSetMapper;
 class vtkUnstructuredGrid;
 class vtkExtractGeometry;
@@ -64,54 +78,147 @@ class vtkPlane;
 
 class SALOME_ExtractGeometry;
 
-typedef vtkUnstructuredGrid TInput;
+typedef VISU::TVTKOutput TInput;
 
 class VISU_PipeLine : public vtkObject{
 public:
   vtkTypeMacro(VISU_PipeLine,vtkObject);
-  virtual ~VISU_PipeLine();
+  virtual
+  ~VISU_PipeLine();
+
+  virtual
+  void
+  DebugOn();
 
-  virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
-  virtual void SameAs(VISU_PipeLine *thePipeLine);
+  virtual
+  void
+  DebugOff();
+
+  virtual
+  void
+  ShallowCopy(VISU_PipeLine *thePipeLine);
+
+  virtual
+  void
+  SameAs(VISU_PipeLine *thePipeLine);
 
 public:
-  virtual void SetInput(TInput* theInput);
-  virtual TInput* GetInput() const;
+  virtual
+  void
+  SetInput(TInput* theInput);
+
+  virtual
+  TInput* 
+  GetInput() const;
+
+  bool
+  IsPlanarInput() const;
 
-  bool IsPlanarInput() const;
+  typedef vtkMapper TMapper;
 
-  typedef vtkDataSetMapper TMapper;
-  virtual TMapper* GetMapper();
+  virtual 
+  TMapper* 
+  GetMapper();
 
-  virtual void Init() = 0;
-  virtual void Update();
+  virtual
+  void
+  Init() = 0;
 
-  static int CheckAvailableMemory(const float& theSize);
-  static float GetAvailableMemory(float theSize = 16*1024*1024.0,
-                                 float theMinSize = 1024*1024.0);
+  virtual
+  void
+  Update();
+
+  static
+  int
+  CheckAvailableMemory(const float& theSize);
+  
+  static
+  float
+  GetAvailableMemory(float theSize = 16*1024*1024.0,
+                    float theMinSize = 1024*1024.0);
 
   // Clipping planes
-  void RemoveAllClippingPlanes();
-  vtkIdType GetNumberOfClippingPlanes() const;
-  bool AddClippingPlane(vtkPlane* thePlane);
-  vtkPlane* GetClippingPlane(vtkIdType theID) const;
+  void 
+  RemoveAllClippingPlanes();
+
+  vtkIdType
+  GetNumberOfClippingPlanes() const;
+
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
 
-  void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
-  void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
+  vtkPlane* 
+  GetClippingPlane(vtkIdType theID) const;
 
-  bool IsShrinkable() { return myIsShrinkable; }
+  void
+  SetPlaneParam(float theDir[3], 
+               float theDist, 
+               vtkPlane* thePlane);
+
+  void
+  GetPlaneParam(float theDir[3], 
+               float& theDist, 
+               vtkPlane* thePlane);
+
+  bool 
+  IsShrinkable() { return myIsShrinkable; }
+
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  float* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
+  void 
+  SetIDMapper(const VISU::PIDMapper& theIDMapper);
+
+  const VISU::PIDMapper&  
+  GetIDMapper()const;
+
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+  vtkImplicitFunction* 
+  GetImplicitFunction();
+
+  void
+  SetExtractInside(int);
 
 protected:
   VISU_PipeLine();
   VISU_PipeLine(const VISU_PipeLine&);
 
-  virtual TInput* GetInput2() const;
-  virtual void Build() = 0;
+  virtual 
+  TInput* 
+  GetInput2() const;
+
+  virtual
+  void
+  Build() = 0;
 
   bool myIsShrinkable;
 
-  TInput  *myInput;
-  TMapper *myMapper;
+  TVTKSmartPtr<TInput> myInput;
+  VISU::PIDMapper myIDMapper;
+  TVTKSmartPtr<vtkDataSetMapper> myMapper;
 
   // Clipping planes
   TVTKSmartPtr<SALOME_ExtractGeometry> myExtractGeometry;
index a7e8287e0931b2bc34d1a9430c91c1e0fb21e6f1..164d9a7ac6fb06377105d9c7d98417f243364dd4 100644 (file)
@@ -68,7 +68,6 @@ void
 VISU_Plot3DPL::
 ShallowCopy(VISU_PipeLine *thePipeLine)
 {
-  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
   if(VISU_Plot3DPL *aPipeLine = dynamic_cast<VISU_Plot3DPL*>(thePipeLine)){
     SetOrientation (aPipeLine->GetPlaneOrientation(),
                     aPipeLine->GetRotateX(), aPipeLine->GetRotateY());
@@ -78,6 +77,7 @@ ShallowCopy(VISU_PipeLine *thePipeLine)
     SetContourPrs( aPipeLine->GetIsContourPrs() );
     SetNumberOfContours( aPipeLine->GetNumberOfContours() );
   }
+  VISU_ScalarMapPL::ShallowCopy(thePipeLine);
 }
 
 VISU_CutPlanesPL::PlaneOrientation
diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx
new file mode 100644 (file)
index 0000000..4554d1f
--- /dev/null
@@ -0,0 +1,636 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+// File:    VISU_ScalarBarCtrl.cxx
+// Author:  Peter KURNEV
+// Module : VISU
+
+#include "VISU_ScalarBarCtrl.hxx"
+#include <vtkObjectFactory.h>
+#include <vtkActor2D.h> 
+#include <vtkCoordinate.h>
+#include <vtkRenderer.h>
+#include <vtkScalarsToColors.h>
+#include <vtkLookupTable.h>
+#include <vtkTextProperty.h>
+#include <vtkScalarBarActor.h>
+#include <vtkIdType.h>
+#include <string.h>
+//
+static 
+  void MarkValueByColor(vtkLookupTable* theTable,
+                       float theValue,
+                       unsigned char* theColor);
+//
+vtkStandardNewMacro(VISU_ScalarBarCtrl);
+//==================================================================
+// function : Ctor
+// purpose  :
+//==================================================================
+VISU_ScalarBarCtrl::VISU_ScalarBarCtrl()
+{
+  myDistance=0.02;
+  myL=0.8;
+  myB=0.15;
+  myPosition[0]=0.15;
+  myPosition[1]=0.01;
+  myBicolor=false;
+  myMaximumNumberOfColors=256;
+  myMarked=false;
+  myMarkedValue=99.;
+  //
+  int i;
+  //
+  for (i=0; i<2; ++i){
+    float aX;
+    
+    aX=(float)i;
+    myRangeLocal[i]=aX;
+    myRangeGlobal[i]=aX;
+  }
+  //
+  //myMode=0; //0-simple ; 1-global; 2-local 
+  SetMode(0);
+  //
+  myScalarBarNumberMax=2;
+  for (i=0; i<myScalarBarNumberMax; ++i){
+    myXLT[i]=vtkLookupTable::New();
+    myXLT[i]->SetHueRange(0.667,0.0);
+    myXLT[i]->SetNumberOfColors((vtkIdType)myMaximumNumberOfColors);
+    //
+    mySBA[i]=vtkScalarBarActor::New();
+    mySBA[i]->SetMaximumNumberOfColors(myMaximumNumberOfColors);       
+  } 
+  //
+  SetOrientation(1);//VERTICAL
+  //
+  for (i=0; i<4; ++i){
+    myBlack[i]=0;
+    myGrey[i]=192;
+  }
+  //
+  myCtrlVisibility=1;
+  SetVisibility(1);
+}
+//==================================================================
+// function : ~
+// purpose  :
+//==================================================================
+VISU_ScalarBarCtrl::~VISU_ScalarBarCtrl()
+{
+}
+//==================================================================
+// function : SetMode
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetMode(const int theMode)
+{
+  myMode=theMode;
+  //myScalarBarNumber=myScalarBarNumberMax;
+  //if(!myMode){
+  //  myScalarBarNumber=1;
+  //}
+}
+//==================================================================
+// function : GetMode
+// purpose  :
+//==================================================================
+int  VISU_ScalarBarCtrl::GetMode()const
+{
+  return myMode;
+}
+//==================================================================
+// function : SetVisibility
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetVisibility(const int theFlag)
+{
+  int iVisibility=(myCtrlVisibility && theFlag);
+  for (int i=0; i<2; ++i){
+    mySBA[i]->SetVisibility(iVisibility);
+  }
+}
+//==================================================================
+// function : GetVisibility
+// purpose  :
+//==================================================================
+int VISU_ScalarBarCtrl::GetVisibility()const
+{
+  return mySBA[0]->GetVisibility();
+}
+//==================================================================
+// function : SetCtrlVisibility
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetCtrlVisibility(const int theFlag)
+{
+  myCtrlVisibility=theFlag;
+  SetVisibility(1);
+}
+//==================================================================
+// function : GetCtrlVisibility
+// purpose  :
+//==================================================================
+int VISU_ScalarBarCtrl::GetCtrlVisibility()const
+{
+  return myCtrlVisibility;
+}
+//==================================================================
+// function : SetRangeLocal
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetRangeLocal(const float *theX)
+{
+  SetRangeLocal(theX[0], theX[1]);
+}
+//==================================================================
+// function : SetRangeLocal
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetRangeLocal(const float theX1,
+                                      const float theX2)
+{
+  myRangeLocal[0]=theX1;
+  myRangeLocal[1]=theX2;
+}
+//==================================================================
+// function : GetRangeLocal
+// purpose  :
+//==================================================================
+const float* VISU_ScalarBarCtrl::GetRangeLocal()const
+{
+  return myRangeLocal;
+}
+//==================================================================
+// function : SetRangeGlobal
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetRangeGlobal(const float *theX)
+{
+  SetRangeGlobal(theX[0], theX[1]);
+}
+//==================================================================
+// function : SetRangeGlobal
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetRangeGlobal(const float theX1,
+                                       const float theX2)
+{
+  myRangeGlobal[0]=theX1;
+  myRangeGlobal[1]=theX2;
+}
+//==================================================================
+// function : GetRangeGlobal
+// purpose  :
+//==================================================================
+const float* VISU_ScalarBarCtrl::GetRangeGlobal()const
+{
+  return myRangeGlobal;
+}
+//==================================================================
+// function : SetOrientation
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetOrientation(const int theOrientation) 
+{
+  for (int i=0; i<myScalarBarNumberMax; ++i){
+    mySBA[i]->SetOrientation(theOrientation);
+  }
+}
+//==================================================================
+// function : GetOrientation
+// purpose  :
+//==================================================================
+int VISU_ScalarBarCtrl::GetOrientation()const 
+{
+  return mySBA[0]->GetOrientation();
+}
+//==================================================================
+// function : GetScalarBarActor
+// purpose  :
+//==================================================================
+vtkScalarBarActor* VISU_ScalarBarCtrl::GetScalarBarActor(const int theIndex) 
+{
+  if (theIndex>-1 && theIndex<myScalarBarNumberMax){
+    return mySBA[theIndex];
+  }
+  return NULL;
+}
+//==================================================================
+// function : GetLookupTable
+// purpose  :
+//==================================================================
+vtkLookupTable* VISU_ScalarBarCtrl::GetLookupTable(const int theIndex) 
+{
+  if (theIndex>-1 && theIndex<myScalarBarNumberMax){
+    return myXLT[theIndex];
+  }
+  return NULL;
+}
+
+//==================================================================
+// function : AddToRender
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::AddToRender(vtkRenderer* theRenderer)
+{
+  int i;
+  //
+  Update();
+  for (i=0; i<myScalarBarNumberMax; ++i){
+    theRenderer->AddActor2D(mySBA[i]);
+  }
+}
+//==================================================================
+// function : RemoveFromRender
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::RemoveFromRender(vtkRenderer* theRenderer)
+{
+  for (int i=0; i<myScalarBarNumberMax; ++i){
+    theRenderer->RemoveActor2D(mySBA[i]);
+  }
+}
+//==================================================================
+// function : SetWidth
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetWidth(const float theWidth)
+{
+  myL=theWidth;
+}
+//==================================================================
+// function : GetWidth
+// purpose  :
+//==================================================================
+float VISU_ScalarBarCtrl::GetWidth()const
+{
+  return myL;
+}
+//==================================================================
+// function : SetHeight
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetHeight(const float theHeight)
+{
+  myB=theHeight;
+}
+//==================================================================
+// function : GetHeight
+// purpose  :
+//==================================================================
+float VISU_ScalarBarCtrl::GetHeight()const
+{
+  return myB;
+}
+//==================================================================
+// function : SetPosition
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetPosition(const float* thePosition)
+{
+  myPosition[0]=thePosition[0];
+  myPosition[1]=thePosition[1];
+}
+//==================================================================
+// function : GetPosition
+// purpose  :
+//==================================================================
+const float* VISU_ScalarBarCtrl::GetPosition()const
+{
+  return myPosition;
+}
+//==================================================================
+// function : SetSpacing
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetSpacing(const float theSpacing)
+{
+  myDistance=theSpacing;
+}
+//==================================================================
+// function : GetSpacing
+// purpose  :
+//==================================================================
+float VISU_ScalarBarCtrl::GetSpacing()const
+{
+  return myDistance;
+}
+//==================================================================
+// function : SetBicolor
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetBicolor(const bool theBicolor)
+{
+  myBicolor=theBicolor;
+}
+//==================================================================
+// function : GetBicolor
+// purpose  :
+//==================================================================
+bool VISU_ScalarBarCtrl::GetBicolor()const
+{
+  return myBicolor;
+}
+//==================================================================
+// function : SetMaximumNumberOfColors
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetMaximumNumberOfColors(const int theNumber)
+{
+  myMaximumNumberOfColors=theNumber;
+}
+//==================================================================
+// function : GetMaximumNumberOfColors
+// purpose  :
+//==================================================================
+int VISU_ScalarBarCtrl::GetMaximumNumberOfColors()const
+{
+  return myMaximumNumberOfColors;
+}
+//==================================================================
+// function : SetMarkValue
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetMarkValue(const float theValue) 
+{
+  myMarkedValue=theValue;
+}
+//==================================================================
+// function : GetMarkValue
+// purpose  :
+//==================================================================
+float VISU_ScalarBarCtrl::GetMarkValue()const
+{
+  return myMarkedValue;
+}
+//==================================================================
+// function : SetIsMarked
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::SetIsMarked(const bool theFlag) 
+{
+  myMarked=theFlag;
+}
+//==================================================================
+// function : GetIsMarked
+// purpose  :
+//==================================================================
+bool VISU_ScalarBarCtrl::GetIsMarked()const
+{
+  return myMarked;
+}
+//==================================================================
+// function : Update
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::Update()
+{
+  if (!myCtrlVisibility) {
+    SetVisibility(0);
+    return;
+  }
+  //
+  PrepareTables();
+  //
+  if (myBicolor) {
+    UpdateForBicolor();
+  }
+  else {
+    UpdateForColor();
+  }
+  //
+  UpdateMarkValue();
+}
+//==================================================================
+// function : UpdateMarkValue
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::UpdateMarkValue()
+{
+  if (myMarked){
+    if (myMode==0 || myMode==1) {
+      MarkValueByColor(myXLT[0], myMarkedValue, myBlack);
+    }
+    else {
+      MarkValueByColor(myXLT[1], myMarkedValue, myBlack);
+    }
+  }
+}
+//==================================================================
+// function : PrepareTables
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::PrepareTables()
+{
+  int i, aOrientation;
+  //
+  // Apply Orientation
+  aOrientation=GetOrientation();
+  //
+  for (i=0; i<myScalarBarNumberMax; ++i){
+    vtkCoordinate * pCoordinate=mySBA[i]->GetPositionCoordinate();
+    pCoordinate->SetCoordinateSystemToNormalizedViewport();
+    //
+    if (aOrientation) {// VERTICAL
+      pCoordinate->SetValue(myPosition[0]+i*(myL+myDistance), myPosition[1]);
+      mySBA[i]->SetWidth(myL);
+      mySBA[i]->SetHeight(myB);
+    }
+    else { 
+      pCoordinate->SetValue(myPosition[0], myPosition[1]+i*(myB+myDistance));
+      mySBA[i]->SetWidth(myL);
+      mySBA[i]->SetHeight(myB);
+    }
+  }
+  //
+  // Initialize Lookup Tables and Scalar Bars 
+  for (i=0; i<myScalarBarNumberMax; ++i){
+    myXLT[i]->SetNumberOfColors((vtkIdType)myMaximumNumberOfColors);
+    myXLT[i]->SetRange(myRangeGlobal[0], myRangeGlobal[1]);
+    myXLT[i]->Modified();
+    myXLT[i]->Build();
+    //
+    mySBA[i]->SetMaximumNumberOfColors(myMaximumNumberOfColors); 
+    mySBA[i]->SetLookupTable(myXLT[i]);
+    mySBA[i]->Modified();
+  } 
+}
+//==================================================================
+// function : UpdateForColor
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::UpdateForColor()
+{
+  if (myMode==0){ 
+    myXLT[0]->SetRange(myRangeLocal[0], myRangeLocal[1]);
+    myXLT[0]->Modified();
+    myXLT[0]->Build();
+    //
+    mySBA[1]->VisibilityOff();
+    return ; 
+  }
+  //
+  size_t aN4=4*sizeof(unsigned char);
+  unsigned char *pTL, *pTG;
+  vtkIdType j, aNbColors;
+  //
+  aNbColors=myXLT[0]->GetNumberOfColors();
+  //
+  if (myMode==1){ 
+    for (j=0; j<aNbColors; ++j){
+      pTL=myXLT[1]->GetPointer(j);
+      myGrey[3]=pTL[3];
+      memcpy(pTL, myGrey, aN4);
+    }
+  }
+  else if (myMode==2){
+    for (j=0; j<aNbColors; ++j){
+      pTG=myXLT[0]->GetPointer(j);
+      myGrey[3]=pTG[3];
+      memcpy(pTG, myGrey, aN4);
+    }
+    //
+    MarkValueByColor(myXLT[0], myRangeLocal[0], myBlack);
+    MarkValueByColor(myXLT[0], myRangeLocal[1], myBlack);
+  }
+  myXLT[1]->SetRange(myRangeLocal[0], myRangeLocal[1]);
+}
+
+//==================================================================
+// function : UpdateForBicolor
+// purpose  :
+//==================================================================
+void VISU_ScalarBarCtrl::UpdateForBicolor()
+{
+  size_t aN4=4*sizeof(unsigned char);
+  unsigned char *pTi, *pTRed, *pTBlue, *pTL, *pTG; 
+  int i;
+  float aXi, aX0, dX, *pRange;
+  vtkIdType aIndex, aNbColors;
+  //
+  aNbColors=myXLT[0]->GetNumberOfColors();
+  pTBlue=myXLT[0]->GetPointer(0);
+  pTRed =myXLT[0]->GetPointer(aNbColors-1);
+  //
+  if (myMode==0) {
+    myXLT[0]->SetRange(myRangeLocal[0], myRangeLocal[1]);
+    myXLT[0]->Modified();
+    myXLT[0]->Build();
+    //
+    mySBA[0]->SetLookupTable(myXLT[0]);
+    mySBA[0]->Modified();
+    //
+    pRange=myRangeLocal;
+    dX=(pRange[1]-pRange[0])/aNbColors;
+    aX0=pRange[0]+0.5*dX;
+    for (i=0; i<aNbColors; ++i){
+      aXi=aX0+i*dX;
+      aIndex=myXLT[0]->GetIndex(aXi);
+      pTi=myXLT[0]->GetPointer(aIndex);
+      if (aXi > 0.) {
+       memcpy(pTi, pTRed, aN4); 
+      }
+      else {
+       memcpy(pTi, pTBlue, aN4); 
+      }
+    }
+    mySBA[1]->VisibilityOff();
+    return;
+  }
+  //
+  // mode: 1,2 
+  myXLT[1]->SetRange(myRangeLocal[0], myRangeLocal[1]);
+  myXLT[1]->Modified();
+  myXLT[1]->Build();
+  //
+  mySBA[1]->SetLookupTable(myXLT[1]);
+  mySBA[1]->Modified();
+  //
+  if (myMode==1){
+    pRange=myRangeGlobal;
+    dX=(pRange[1]-pRange[0])/aNbColors;
+    aX0=pRange[0]+0.5*dX;
+    for (i=0; i<aNbColors; ++i){
+      aXi=aX0+i*dX;
+      aIndex=myXLT[0]->GetIndex(aXi);
+      pTi=myXLT[0]->GetPointer(aIndex);
+      if (aXi > 0.) {
+       memcpy(pTi, pTRed, aN4); 
+      }
+      else {
+       memcpy(pTi, pTBlue, aN4); 
+      }
+    }
+    //
+    for (i=0; i<aNbColors; ++i){
+      pTL=myXLT[1]->GetPointer(i);
+      myGrey[3]=pTL[3];
+      memcpy(pTL, myGrey, aN4);
+    }
+  }
+  //
+  else if (myMode==2){
+    pRange=myRangeLocal;
+    dX=(pRange[1]-pRange[0])/aNbColors;
+    aX0=pRange[0]+0.5*dX;
+    for (i=0; i<aNbColors; ++i){
+      aXi=aX0+i*dX;
+      aIndex=myXLT[1]->GetIndex(aXi);
+      pTi=myXLT[1]->GetPointer(aIndex);
+      if (aXi > 0.) {
+       memcpy(pTi, pTRed, aN4); 
+      }
+      else {
+       memcpy(pTi, pTBlue, aN4); 
+      }
+    }
+    //
+    for (i=0; i<aNbColors; ++i){ 
+      pTG=myXLT[0]->GetPointer(i);
+      myGrey[3]=pTG[3];
+      memcpy(pTG, myGrey, aN4);
+    }
+    //
+    MarkValueByColor(myXLT[0], myRangeLocal[0], myBlack);
+    MarkValueByColor(myXLT[0], myRangeLocal[1], myBlack);
+  }
+}
+//==================================================================
+// function : MarkValueByColor
+// purpose  :
+//==================================================================
+void MarkValueByColor(vtkLookupTable* theTable,
+                     float theValue,
+                     unsigned char* theColor)
+{ 
+  size_t aN4=4*sizeof(unsigned char);
+  unsigned char *pT, aC3;
+  vtkIdType aIndex;
+  //
+  aC3=theColor[3];
+  aIndex=theTable->GetIndex(theValue);
+  pT=theTable->GetPointer(aIndex);
+  theColor[3]=pT[3];
+  memcpy(pT, theColor, aN4); 
+  theColor[3]=aC3;
+}
diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx
new file mode 100644 (file)
index 0000000..f55ae05
--- /dev/null
@@ -0,0 +1,144 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+// File:    VISU_ScalarBarCtrl.hxx
+// Author:  Peter KURNEV
+// Module : VISU
+
+#ifndef VISU_ScalarBarCtrl_HeaderFile
+#define VISU_ScalarBarCtrl_HeaderFile
+
+#include <vtkScalarBarActor.h>
+#include <vtkLookupTable.h>
+
+class vtkRenderer;
+class VISU_ScalarBarCtrl :  public vtkObject {
+
+public:
+  vtkTypeMacro(VISU_ScalarBarCtrl, vtkObject);
+  static VISU_ScalarBarCtrl* New();
+  //
+  // Mode
+  void SetMode(const int theNumber);
+  int  GetMode()const;
+  //
+  // Ranges
+  void SetRangeGlobal(const float theX1,
+                     const float theX2);
+  
+  void SetRangeGlobal(const float *theX);
+  
+  const float* GetRangeGlobal()const;
+
+  void SetRangeLocal(const float theX1,
+                    const float theX2);
+
+  void SetRangeLocal(const float *theX);
+  
+  const float* GetRangeLocal()const;
+  //
+  // Selectors
+  vtkScalarBarActor* GetScalarBarActor(const int theIndex);
+  vtkLookupTable* GetLookupTable(const int theIndex);
+  //
+  // Renderer
+  void AddToRender(vtkRenderer* theRenderer); 
+  void RemoveFromRender(vtkRenderer* theRenderer);
+  //
+  // Visibility
+  void SetVisibility(const int theFlag);
+  int  GetVisibility()const;
+  //
+  // Visibility
+  void SetCtrlVisibility(const int theFlag);
+  int GetCtrlVisibility()const;
+  //
+  // Build
+  void Update();
+  //
+  // Position
+  void  SetWidth(const float theWidth);
+  float GetWidth()const;
+  void  SetHeight(const float theHeight);
+  float GetHeight()const;
+  void  SetPosition(const float* thePosition);
+  const float* GetPosition()const;
+  //
+  // Spacing
+  void  SetSpacing(const float theSpacing);
+  float GetSpacing()const;
+  //
+  // Rainbow/bicolor
+  bool  GetBicolor() const;
+  void  SetBicolor(const bool theBicolor);
+  //
+  //Orientation
+  void SetOrientationToHorizontal() {
+    SetOrientation(0);
+  }
+  void SetOrientationToVertical() {
+     SetOrientation(1);
+  }
+  void SetOrientation(const int theOrientation);
+  int GetOrientation()const;
+  //
+  // Maximum Number Of Colors
+  void SetMaximumNumberOfColors(const int theNumber);
+  int GetMaximumNumberOfColors ()const;
+  //
+  // Misc
+  void  SetMarkValue (const float theValue);
+  float GetMarkValue  ()const;
+  void  SetIsMarked(const bool theFlag);
+  bool  GetIsMarked()const;
+  //
+protected:
+  VISU_ScalarBarCtrl();
+  virtual ~VISU_ScalarBarCtrl();
+  
+  void UpdateForBicolor();
+  void UpdateForColor();
+  void UpdateMarkValue();
+  void PrepareTables();
+  
+  
+protected:
+  int   myMode;
+  //int   myScalarBarNumber;
+  int   myScalarBarNumberMax;
+  float myDistance, myL, myB, myPosition[2];
+  float myRangeLocal[2];
+  float myRangeGlobal[2];
+  bool  myBicolor;
+  int   myCtrlVisibility;
+  int   myMaximumNumberOfColors;
+  unsigned char myBlack[4];
+  unsigned char myGrey[4];
+  //
+  bool  myMarked;
+  float myMarkedValue;
+  //
+  vtkScalarBarActor *mySBA[2];
+  vtkLookupTable *myXLT[2]; 
+};
+
+#endif
index 473d2de86da3c19e270dfda8a840c7417f71825e..42daa1bc099206e9907686221daf4bd630d63eff 100644 (file)
 
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_PipeLineUtils.hxx"
+#include "SALOME_ExtractGeometry.h"
 
-vtkStandardNewMacro(VISU_ScalarMapPL);
 
+//============================================================================
+vtkStandardNewMacro(VISU_ScalarMapPL);
 
-VISU_ScalarMapPL::VISU_ScalarMapPL(){
-  myFieldTransform = VISU_FieldTransform::New();
-  //myFieldTransform->DebugOn();
 
+//----------------------------------------------------------------------------
+VISU_ScalarMapPL
+::VISU_ScalarMapPL()
+{
   myMapperTable = VISU_LookupTable::New();
   myMapperTable->SetScale(VTK_SCALE_LINEAR);
   myMapperTable->SetHueRange(0.667,0.0);
@@ -45,46 +48,90 @@ VISU_ScalarMapPL::VISU_ScalarMapPL(){
   myBarTable->SetHueRange(0.667,0.0);
 
   myExtractor = VISU_Extractor::New();
-  //myExtractor->DebugOn();
+  myExtractor->SetInput(myExtractGeometry->GetOutput());
+
+  myFieldTransform = VISU_FieldTransform::New();
+  myFieldTransform->SetInput(myExtractor->GetOutput());
+
   myIsShrinkable = true;
 }
 
 
-VISU_ScalarMapPL::~VISU_ScalarMapPL(){
-  myFieldTransform->UnRegisterAllOutputs();
+VISU_ScalarMapPL
+::~VISU_ScalarMapPL()
+{
   myFieldTransform->Delete();
-  myMapperTable->Delete();;
+  myMapperTable->Delete();
   myBarTable->Delete();
-  myExtractor->UnRegisterAllOutputs();
   myExtractor->Delete();
 }
 
 
-void VISU_ScalarMapPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_PipeLine::ShallowCopy(thePipeLine);
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::ShallowCopy(VISU_PipeLine *thePipeLine)
+{
   if(VISU_ScalarMapPL *aPipeLine = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine)){
     SetScalarRange(aPipeLine->GetScalarRange());
     SetScalarMode(aPipeLine->GetScalarMode());
     SetNbColors(aPipeLine->GetNbColors());
     SetScaling(aPipeLine->GetScaling());
-    //Update();
+    SetMapScale(aPipeLine->GetMapScale());
   }
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 
-int VISU_ScalarMapPL::GetScalarMode(){
+//----------------------------------------------------------------------------
+int
+VISU_ScalarMapPL
+::GetScalarMode()
+{
   return myExtractor->GetScalarMode();
 }
-void VISU_ScalarMapPL::SetScalarMode(int theScalarMode){
+
+void
+VISU_ScalarMapPL
+::SetScalarMode(int theScalarMode)
+{
+  vtkDataSet *input = GetInput();
+  if (input){
+    if(input->GetPointData()->GetNumberOfArrays()){
+      vtkPointData *inData = input->GetPointData();
+      if(!inData->GetAttribute(vtkDataSetAttributes::VECTORS)) {
+       if (theScalarMode==0){
+         return;
+       }
+      }
+    }
+    else {
+      vtkCellData *inData = input->GetCellData();
+      if(!inData->GetAttribute(vtkDataSetAttributes::VECTORS)){
+       if (theScalarMode==0){
+         return;
+       }
+      }
+    }
+  }
+  //
   myExtractor->SetScalarMode(theScalarMode);
   Modified();
 }
 
 
-int VISU_ScalarMapPL::GetScaling() {
+//----------------------------------------------------------------------------
+int
+VISU_ScalarMapPL
+::GetScaling() 
+{
   return myBarTable->GetScale();
 }
-void VISU_ScalarMapPL::SetScaling(int theScaling) {
+
+void
+VISU_ScalarMapPL
+::SetScaling(int theScaling) 
+{
   myBarTable->SetScale(theScaling);
   if(theScaling == VTK_SCALE_LOG10)
     myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
@@ -94,60 +141,95 @@ void VISU_ScalarMapPL::SetScaling(int theScaling) {
 }
 
 
-float* VISU_ScalarMapPL::GetScalarRange() {
+//----------------------------------------------------------------------------
+float* 
+VISU_ScalarMapPL
+::GetScalarRange() 
+{
   return myFieldTransform->GetScalarRange();
 }
-void VISU_ScalarMapPL::SetScalarRange(float theRange[2]){
+
+void
+VISU_ScalarMapPL
+::SetScalarRange(float theRange[2])
+{
   myFieldTransform->SetScalarRange(theRange);
   myBarTable->SetRange(theRange);
   Modified();
 }
-void VISU_ScalarMapPL::SetScalarMin(float theValue){
+
+void
+VISU_ScalarMapPL
+::SetScalarMin(float theValue)
+{
   float aScalarRange[2] = {theValue, GetScalarRange()[1]};
   SetScalarRange(aScalarRange);
 }
-void VISU_ScalarMapPL::SetScalarMax(float theValue){
+
+void
+VISU_ScalarMapPL
+::SetScalarMax(float theValue)
+{
   float aScalarRange[2] = {GetScalarRange()[0], theValue};
   SetScalarRange(aScalarRange);
 }
 
 
-void VISU_ScalarMapPL::SetNbColors(int theNbColors) {
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::SetNbColors(int theNbColors) 
+{
   myMapperTable->SetNumberOfColors(theNbColors);
   myBarTable->SetNumberOfColors(theNbColors);
   Modified();
 }
-int VISU_ScalarMapPL::GetNbColors() {
+
+int
+VISU_ScalarMapPL
+::GetNbColors() 
+{
   return myMapperTable->GetNumberOfColors();
 }
 
 
-VISU_ScalarMapPL::THook* VISU_ScalarMapPL::DoHook(){
+//----------------------------------------------------------------------------
+VISU_ScalarMapPL::THook* 
+VISU_ScalarMapPL
+::DoHook()
+{
   myMapper->SetColorModeToMapScalars();
   myMapper->ScalarVisibilityOn();
   return myFieldTransform->GetUnstructuredGridOutput();
 }
 
 
-void VISU_ScalarMapPL::Init(){
-  //SetSourceRange();
+void
+VISU_ScalarMapPL
+::Init()
+{
+  SetScalarMode(0);
+  SetSourceRange();
 }
 
-
-void VISU_ScalarMapPL::Build() {
-  myExtractor->SetInput(GetInput2());
-  myFieldTransform->SetInput(myExtractor->GetOutput());
+void
+VISU_ScalarMapPL
+::Build() 
+{
   myMapper->SetInput(DoHook());
+  Update();
 }
 
 
-void VISU_ScalarMapPL::Update() {
+void
+VISU_ScalarMapPL
+::Update() 
+{ 
   float *aRange = myFieldTransform->GetScalarRange();
   float aScalarRange[2] = {aRange[0], aRange[1]};
   if(myBarTable->GetScale() == VTK_SCALE_LOG10)
     VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
   myMapperTable->SetRange(aScalarRange);
-  myMapperTable->SetMapScale(1.0);
 
   myMapperTable->Build();
   myBarTable->Build();
@@ -159,21 +241,51 @@ void VISU_ScalarMapPL::Update() {
 }
 
 
-void VISU_ScalarMapPL::SetMapScale(float theMapScale){
+//----------------------------------------------------------------------------
+VISU_LookupTable *
+VISU_ScalarMapPL
+::GetMapperTable()
+{ 
+  return myMapperTable;
+}
+
+VISU_LookupTable*
+VISU_ScalarMapPL
+::GetBarTable()
+{
+  return myBarTable;
+}
+
+
+//----------------------------------------------------------------------------
+void 
+VISU_ScalarMapPL
+::SetMapScale(float theMapScale)
+{
   myMapperTable->SetMapScale(theMapScale);
   myMapperTable->Build();
 }
-float VISU_ScalarMapPL::GetMapScale(){
+
+float
+VISU_ScalarMapPL::GetMapScale()
+{
   return myMapperTable->GetMapScale();
 }
 
 
-void VISU_ScalarMapPL::GetSourceRange(float theRange[2]){
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::GetSourceRange(float theRange[2])
+{
   myExtractor->Update();
   myExtractor->GetOutput()->GetScalarRange(theRange);
 }
 
-void VISU_ScalarMapPL::SetSourceRange(){
+void
+VISU_ScalarMapPL
+::SetSourceRange()
+{
   float aRange[2];
   GetSourceRange(aRange);
   SetScalarRange(aRange);
index b535828514d01134e177b403d46ca9abec74b8e2..1d810fb93cfcca60630bee33aa835bc6b3e510df 100644 (file)
 #include "VISU_PipeLine.hxx"
 #include "VISU_ScalarBarActor.hxx"
 
+class vtkCell;
 class vtkDataSet;
 
 class VISU_Extractor;
 class VISU_FieldTransform;
 
-class VISU_ScalarMapPL : public VISU_PipeLine{
+
+//============================================================================
+class VISU_ScalarMapPL : public VISU_PipeLine
+{
 protected:
   VISU_ScalarMapPL();
   VISU_ScalarMapPL(const VISU_ScalarMapPL&);
+
+  virtual
+  ~VISU_ScalarMapPL();
+
 public:
+  //----------------------------------------------------------------------------
   vtkTypeMacro(VISU_ScalarMapPL,VISU_PipeLine);
-  static VISU_ScalarMapPL* New();
-  virtual ~VISU_ScalarMapPL();
-  virtual void ShallowCopy(VISU_PipeLine *thePipeLine);
 
-  virtual int GetScalarMode();
-  virtual void SetScalarMode(int theScalarMode = 0);
+  static
+  VISU_ScalarMapPL* 
+  New();
+
+  virtual
+  void
+  ShallowCopy(VISU_PipeLine *thePipeLine);
+
+  //----------------------------------------------------------------------------
+  virtual
+  int
+  GetScalarMode();
+
+  virtual
+  void
+  SetScalarMode(int theScalarMode = 0);
   
-  virtual int GetScaling();
-  virtual void SetScaling(int theScaling = VTK_SCALE_LINEAR);
+  virtual
+  int
+  GetScaling();
+  virtual
+  void
+  SetScaling(int theScaling = VTK_SCALE_LINEAR);
   
-  virtual float* GetScalarRange();
-  virtual void SetScalarRange(float theRange[2]);
-  virtual void SetScalarMin(float theValue);
-  virtual void SetScalarMax(float theValue);
+  virtual
+  float* 
+  GetScalarRange();
+
+  virtual
+  void
+  SetScalarRange(float theRange[2]);
+
+  virtual
+  void
+  SetScalarMin(float theValue);
+
+  virtual
+  void
+  SetScalarMax(float theValue);
   
-  virtual void SetNbColors(int theNbColors = 16);
-  virtual int GetNbColors();
+  virtual
+  void
+  SetNbColors(int theNbColors = 16);
+
+  virtual
+  int
+  GetNbColors();
   
+  //----------------------------------------------------------------------------
 public:
-  virtual void Init();
-  virtual void Build();
-  virtual void Update();
+  virtual
+  void
+  Init();
+
+  virtual
+  void
+  Build();
+
+  virtual
+  void
+  Update();
   
-  virtual VISU_LookupTable *GetMapperTable(){ return myMapperTable;}
-  virtual VISU_LookupTable *GetBarTable(){ return myBarTable;}
+  virtual
+  VISU_LookupTable*
+  GetMapperTable();
+
+  virtual 
+  VISU_LookupTable*
+  GetBarTable();
+
+  virtual 
+  void
+  SetMapScale(float theMapScale = 1.0);
+
+  virtual
+  float
+  GetMapScale();
 
-  virtual void SetMapScale(float theMapScale = 1.0);
-  virtual float GetMapScale();
+  virtual
+  void
+  GetSourceRange(float theRange[2]);
 
-  virtual void GetSourceRange(float theRange[2]);
-  virtual void SetSourceRange();
+  virtual
+  void
+  SetSourceRange();
 
+  //----------------------------------------------------------------------------
 protected:
   typedef vtkDataSet THook;
   virtual THook* DoHook();
 
-  VISU_LookupTable *myMapperTable, *myBarTable;
-  VISU_FieldTransform *myFieldTransform;
+  VISU_LookupTable* myMapperTable;
+  VISU_LookupTable* myBarTable;
+  VISU_FieldTransform* myFieldTransform;
   VISU_Extractor* myExtractor;
 };
   
index 9b9f781e77b42214f5bfbfc1e445b3d9b6db1647..6690dc42d80fbce38cd2b2d3fb9941783b3ac879 100644 (file)
@@ -74,14 +74,15 @@ VISU_StreamLinesPL::~VISU_StreamLinesPL(){
 }
 
 void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
-  if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine))
+  if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
     SetParams(aPipeLine->GetIntegrationStep(),
              aPipeLine->GetPropagationTime(),
              aPipeLine->GetStepLength(),
              aPipeLine->GetSource(),
              aPipeLine->GetUsedPoints(),
              aPipeLine->GetDirection());
+  }
+  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
 }
 
 
index c34d36d9de8c7aaa94e0dd53497450ddf1489917..9ffb775a68cc914bd8a38fb312f826d81086932f 100644 (file)
@@ -70,11 +70,11 @@ VISU_VectorsPL::~VISU_VectorsPL(){
 }
 
 void VISU_VectorsPL::ShallowCopy(VISU_PipeLine *thePipeLine){
-  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
   if(VISU_VectorsPL *aPipeLine = dynamic_cast<VISU_VectorsPL*>(thePipeLine)){
     SetGlyphType(aPipeLine->GetGlyphType());
     SetGlyphPos(aPipeLine->GetGlyphPos());
   }
+  VISU_DeformedShapePL::ShallowCopy(thePipeLine);
 }
 
 
diff --git a/src/PIPELINE/VISU_img2vti.cxx b/src/PIPELINE/VISU_img2vti.cxx
new file mode 100644 (file)
index 0000000..8cc0a47
--- /dev/null
@@ -0,0 +1,88 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+// File:    VISU_img2vti.cxx
+// Author:  Oleg UVAROV
+// Module : VISU
+
+#include <vtkImageData.h>
+#include <vtkBMPReader.h>
+#include <vtkPNGReader.h>
+#include <vtkJPEGReader.h>
+#include <vtkXMLImageDataWriter.h>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+int main( int argc, char** argv )
+{
+  if(MYDEBUG) std::cout << "Converting the image to VTI format" << std::endl;
+
+  if( argc != 4 )
+  {
+    std::cout << "Usage : VISU_img2vti ImageFormat InputFileName OutputFileName" << std::endl;
+    return 1;
+  }
+
+  if(MYDEBUG){
+    std::cout << argv[1] << std::endl;
+    std::cout << argv[2] << std::endl;
+    std::cout << argv[3] << std::endl;
+  }
+
+  vtkImageReader2* aReader = NULL;
+  if( !strcmp( argv[1], "BMP" ) || !strcmp( argv[1], "bmp" ) )
+  {
+    if(MYDEBUG) std::cout << "Input image format - BMP" << std::endl;
+    aReader = vtkBMPReader::New();
+  }
+  else if( !strcmp( argv[1], "PNG" ) || !strcmp( argv[1], "png" ) )
+  {
+    if(MYDEBUG) std::cout << "Input image format - PNG" << std::endl;
+    aReader = vtkPNGReader::New();
+  }
+  else if( !strcmp( argv[1], "JPG" ) || !strcmp( argv[1], "jpg" ) )
+  {
+    if(MYDEBUG) std::cout << "Input image format - JPG" << std::endl;
+    aReader = vtkJPEGReader::New();
+  }
+  else
+  {
+    std::cout << "Unknown input image format... Must be BMP, PNG or JPG." << std::endl;
+    return 1;
+  }
+  aReader->SetFileName( argv[2] );
+  aReader->Update();
+
+  vtkXMLImageDataWriter* aWriter = vtkXMLImageDataWriter::New();
+  aWriter->SetInput( aReader->GetOutput() );
+  aWriter->SetFileName( argv[3] );
+  aWriter->Write();
+
+  aWriter->Delete();
+  aReader->Delete();
+
+  return 0;
+}
index 88fccafa0086921dcf294e830f112225c73853ac..84579bf285f70eb068e252e3b15fbb67e666fb5c 100644 (file)
@@ -35,12 +35,11 @@ VPATH=.:@srcdir@
 
 # header files 
 EXPORT_HEADERS= \
-                VisuGUI_NonIsometricDlg.h \
                VisuGUI_Tools.h
 
 # .po files to transform in .qm
 PO_FILES = \
-          VISU_msg_en.po VISU_images.po
+          VISU_msg_en.po VISU_images.po VISUM_msg_en.po VISUM_images.po
 
 # Libraries targets
 LIB = libVISU.la
@@ -49,8 +48,10 @@ LIB = libVISU.la
 
 LIB_SRC =      VisuGUI.cxx \
                VisuGUI_Factory.cxx \
+               VisuGUI_Module.cxx \
                VisuGUI_Selection.cxx \
                VisuGUI_Tools.cxx \
+               VisuGUI_ViewTools.cxx \
                VisuGUI_PopupTools.cxx \
                VisuGUI_NameDlg.cxx \
                VisuGUI_FileDlg.cxx \
@@ -58,21 +59,21 @@ LIB_SRC =   VisuGUI.cxx \
                VisuGUI_TimeAnimation.cxx \
                VisuGUI_EditContainerDlg.cxx \
                VisuGUI_ClippingDlg.cxx \
-               VisuGUI_CubeAxesDlg.cxx \
-               VisuGUI_FontWg.cxx \
+               VisuGUI_DialogRunner.cxx \
                VisuGUI_OffsetDlg.cxx \
                VisuGUI_Plot3DDlg.cxx \
-               VisuGUI_NonIsometricDlg.cxx \
                VisuGUI_ScalarBarDlg.cxx \
+               VisuGUI_GaussPointsDlg.cxx \
                VisuGUI_DeformedShapeDlg.cxx \
                VisuGUI_IsoSurfacesDlg.cxx \
                VisuGUI_CutLinesDlg.cxx \
                VisuGUI_CutPlanesDlg.cxx \
                VisuGUI_StreamLinesDlg.cxx \
                VisuGUI_VectorsDlg.cxx \
-               VisuGUI_DialogRunner.cxx
+               VisuGUI_Timer.cxx
 
 LIB_MOC =      VisuGUI.h \
+               VisuGUI_Module.h \
                VisuGUI_Selection.h \
                VisuGUI_NameDlg.h \
                VisuGUI_FileDlg.h \
@@ -80,19 +81,17 @@ LIB_MOC =   VisuGUI.h \
                VisuGUI_TimeAnimation.h \
                VisuGUI_EditContainerDlg.h \
                VisuGUI_ClippingDlg.h \
-               VisuGUI_CubeAxesDlg.h \
-               VisuGUI_FontWg.h \
+               VisuGUI_DialogRunner.h \
                VisuGUI_OffsetDlg.h \
                VisuGUI_Plot3DDlg.h \
-               VisuGUI_NonIsometricDlg.h \
                VisuGUI_ScalarBarDlg.h \
+               VisuGUI_GaussPointsDlg.h \
                VisuGUI_DeformedShapeDlg.h \
                VisuGUI_IsoSurfacesDlg.h \
                VisuGUI_CutLinesDlg.h \
                VisuGUI_CutPlanesDlg.h \
                VisuGUI_StreamLinesDlg.h \
-               VisuGUI_VectorsDlg.h \
-               VisuGUI_DialogRunner.h
+               VisuGUI_VectorsDlg.h
 
 LIB_CLIENT_IDL = SALOME_Exception.idl \
                 VISU_Gen.idl \
@@ -111,13 +110,17 @@ LIB_SERVER_IDL =
 
 CPPFLAGS +=  -ftemplate-depth-32 $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) \
        $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
-       -I${KERNEL_ROOT_DIR}/include/salome  $(BOOST_CPPFLAGS)
+       -I${KERNEL_ROOT_DIR}/include/salome \
+       -I${MED_ROOT_DIR}/include/salome \
+       $(BOOST_CPPFLAGS)
 CXXFLAGS +=  -ftemplate-depth-32 $(OCC_CXXFLAGS) \
-       -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
+       -I${KERNEL_ROOT_DIR}/include/salome \
+       -I${GUI_ROOT_DIR}/include/salome
 
 LDFLAGS += $(QWT_LIBS) -lSalomeNS \
-       -lSVTK -lSPlot2d -lVisuObject -lVISUEngineImpl -lVISUGUITOOLS \
-       -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
+       -lSVTK -lVVTK -lSPlot2d -lVisuObject -lVISUEngineImpl -lVISUGUITOOLS \
+       -L${KERNEL_ROOT_DIR}/lib/salome \
+       -L${GUI_ROOT_DIR}/lib/salome
 
 
 @CONCLUDE@
diff --git a/src/VISUGUI/VISUM_images.po b/src/VISUGUI/VISUM_images.po
new file mode 100644 (file)
index 0000000..23082cd
--- /dev/null
@@ -0,0 +1,52 @@
+#  VISU VISUGUI : GUI of VISU component
+#
+#  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+# 
+#  This library is free software; you can redistribute it and/or 
+#  modify it under the terms of the GNU Lesser General Public 
+#  License as published by the Free Software Foundation; either 
+#  version 2.1 of the License. 
+# 
+#  This library is distributed in the hope that it will be useful, 
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+#  Lesser General Public License for more details. 
+# 
+#  You should have received a copy of the GNU Lesser General Public 
+#  License along with this library; if not, write to the Free Software 
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+# 
+#  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#
+#
+#
+#  File   : VisuGUI_icons.po
+#  Module : VISU
+
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: 2005-05-10 15:20+0400\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+msgid "ICON_GAUSS_NEW_VIEWER"
+msgstr "Visu_points.png"
+
+msgid "ICON_GAUSS_POINTS"
+msgstr "Visu_gauss_points.png"
+
+msgid "ICON_VVTK_INTERACTOR_STYLE_SWITCH"
+msgstr "Visu_vvtk_switch.png"
+
+msgid "ICON_VVTK_SELECTION_MODE_SWITCH"
+msgstr "Visu_points.png"
+
+msgid "ICON_VVTK_PLANE_SEGMENTATION_SWITCH"
+msgstr "Visu_PlaneSegmentation.png"
+
+msgid "ICON_LOAD_TEXTURE"
+msgstr "Visu_load_texture.png"
diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po
new file mode 100644 (file)
index 0000000..303fb4c
--- /dev/null
@@ -0,0 +1,512 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-02-22 16:56:46 CET\n"
+"PO-Revision-Date: 2005-06-27 12:38+0400\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+msgid "VisuGUI_Module::MEN_VISUALISATION"
+msgstr "Visualization"
+
+msgid "VisuGUI_Module::TOOL_VISUALISATION"
+msgstr "Visualization Toolbar"
+
+msgid "VisuGUI_Module::MEN_GAUSS"
+msgstr "Gauss"
+
+msgid "VisuGUI_Module::MEN_GAUSS_NEW_VIEWER"
+msgstr "Points view"
+
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_TAB_TTL"
+msgstr "Gauss Points"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL"
+msgstr "Primitive"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_CLAMP"
+msgstr "Maximum Size (Clamp)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAIN_TEXTURE"
+msgstr "Main Texture (16x16)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_TEXTURE"
+msgstr "Alpha Channel Texture (16x16)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_THRESHOLD"
+msgstr "Alpha Channel Threshold"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE_GROUP_TTL"
+msgstr "Size"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_MIN_SIZE"
+msgstr "Range value for min size (%)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAX_SIZE"
+msgstr "Range value for max size (%)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAGNIFICATION"
+msgstr "Magnification (%)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_INCREMENT"
+msgstr "+/- Ratio"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_GEOM_GROUP_TTL"
+msgstr "Geometry"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE"
+msgstr "Size of points (%)"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_COLOR"
+msgstr "Color"
+
+msgid "VisuGUI_Module::VISU_GAUSS_SCALAR_BAR_PREF_TAB_TTL"
+msgstr "Gauss Points Scalar Bar"
+
+msgid "VisuGUI_Module::VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL"
+msgstr "Gauss Points Scalar Bar"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_ACTIVE_BAR"
+msgstr "Active bar"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_LOCAL"
+msgstr "Local"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_GLOBAL"
+msgstr "Global"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_DISPLAY_GLOBAL"
+msgstr "Display global bar"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_SCALAR_BAR_MODE"
+msgstr "Scalar bar mode"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_BICOLOR"
+msgstr "Bicolor"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_RAINBOW"
+msgstr "Rainbow"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_SPACING"
+msgstr "Spacing"
+
+msgid "VisuGUI_Module::VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL"
+msgstr "Outside Cursor Gauss Points"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_COLOR_GROUP_TTL"
+msgstr "Color"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_TAB_TTL"
+msgstr "Picking"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_CURSOR_GROUP_TTL"
+msgstr "Cursor"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_PYRAMID_HEIGHT"
+msgstr "Height of the pyramids"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL"
+msgstr "Information window"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_TRANSPARENCY"
+msgstr "Transparency"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_POSITION"
+msgstr "Position"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_BELOW_POINT"
+msgstr "Centered below the point"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_TOP_LEFT_CORNER"
+msgstr "Top-left corner of the 3D view"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_CAMERA_GROUP_TTL"
+msgstr "Movement of the camera"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_ZOOM_FACTOR"
+msgstr "Zoom at first selected point (ratio)"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_STEP_NUMBER"
+msgstr "Number of steps between two positions"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_PARENT_MESH_TTL"
+msgstr "Parent mesh element"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_DISPLAY_PARENT_MESH"
+msgstr "Display parent mesh element"
+
+msgid "VisuGUI_Module::VISU_MOUSE_PREF_TAB_TLT"
+msgstr "Spacemouse"
+
+msgid "VisuGUI_Module::VISU_MOUSE_PREF_GROUP_TLT"
+msgstr "Mouse"
+
+msgid "VisuGUI_Module::VISU_MOUSE_PREF"
+msgstr "Mouse behaviour"
+
+msgid "VisuGUI_Module::VISU_MOUSE_PREF_STANDARD"
+msgstr "Salome standard controls"
+
+msgid "VisuGUI_Module::VISU_MOUSE_PREF_KEYBOARD_FREE"
+msgstr "Keyboard free"
+
+msgid "VisuGUI_Module::VISU_KEYBOARD_PREF_GROUP_TTL"
+msgstr "Keyboard"
+
+msgid "VisuGUI_Module::VISU_KEYBOARD_PREF"
+msgstr "[+]/[-] Speed increment"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF"
+msgstr "Spacemouse"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_1"
+msgstr "Decrease speed increment"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_2"
+msgstr "Increase speed increment"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_3"
+msgstr "Decrease Gauss points magnification"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_4"
+msgstr "Increase Gauss points magnification"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_5"
+msgstr "Dominant / combined switch"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_1"
+msgstr "Button 1"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_2"
+msgstr "Button 2"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_3"
+msgstr "Button 3"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_4"
+msgstr "Button 4"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_5"
+msgstr "Button 5"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_6"
+msgstr "Button 6"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_7"
+msgstr "Button 7"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_8"
+msgstr "Button 8"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_10"
+msgstr "Button 10"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_11"
+msgstr "Button 11"
+
+msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_*"
+msgstr "Button *"
+
+msgid "VisuGUI_Module::VISU_CAMERA_PREF_GROUP_TTL"
+msgstr "Camera movements"
+
+msgid "VisuGUI_Module::VISU_CAMERA_MOVE_PREF"
+msgstr "Number of steps between two positions"
+
+msgid "VisuGUI_Module::MEN_GAUSS_CREATE_PRS"
+msgstr "Gauss Points"
+
+msgid "VisuGUI_GaussPointsDlg::DLG_PREF_TITLE"
+msgstr "Gauss Points Preferences"
+
+msgid "VisuGUI_GaussPointsDlg::DLG_PROP_TITLE"
+msgstr "Gauss Points Properties"
+
+msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
+msgstr "VISU scene:%1 - viewer:%2"
+
+msgid "VVTK_MainWindow1::MNU_VVTK_INTERACTOR_STYLE_SWITCH"
+msgstr "Interaction Style Switch"
+
+msgid "VVTK_MainWindow1::DSC_VVTK_INTERACTOR_STYLE_SWITCH"
+msgstr "Interaction Style Switch"
+
+msgid "VVTK_MainWindow1::MNU_VVTK_SELECTION_MODE_SWITCH"
+msgstr "Selection Mode Switch"
+
+msgid "VVTK_MainWindow1::DSC_VVTK_SELECTION_MODE_SWITCH"
+msgstr "Selection Mode Switch"
+
+msgid "VVTK_MainWindow1::MNU_VVTK_PLANE_SEGMENTATION_SWITCH"
+msgstr "Plane Segmentation Switch"
+
+msgid "VVTK_MainWindow1::DSC_VVTK_PLANE_SEGMENTATION_SWITCH"
+msgstr "Plane Segmentation Switch"
+
+msgid "VisuGUI_GaussPointsDlg::&Cancel"
+msgstr ""
+
+msgid "VisuGUI_GaussPointsDlg::&OK"
+msgstr ""
+
+msgid "VisuGUI_GaussPointsDlg::DLG_TITLE"
+msgstr "Gauss Points"
+
+msgid "VisuGUI_GaussPointsDlg::GAUSS_POINTS_TAB"
+msgstr "Gauss Points"
+
+msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB"
+msgstr "Scalar Bar"
+
+msgid "VisuGUI_GaussPointsDlg::PRS_TITLE"
+msgstr "Presentation"
+
+msgid "VisuGUI_GaussPointsDlg::RESULTS"
+msgstr "Results"
+
+msgid "VisuGUI_GaussPointsDlg::GEOMETRY"
+msgstr "Geometry"
+
+msgid "VisuGUI_GaussPointsDlg::PRIMITIVE_TITLE"
+msgstr "Primitive"
+
+msgid "VisuGUI_GaussPointsDlg::POINT_SPRITE"
+msgstr "Point Sprite"
+
+msgid "VisuGUI_GaussPointsDlg::OPENGL_POINT"
+msgstr "OpenGL Point"
+
+msgid "VisuGUI_GaussPointsDlg::GEOMETRICAL_SPHERE"
+msgstr "Geometrical Sphere"
+
+msgid "VisuGUI_GaussPointsDlg::MAXIMUM_SIZE"
+msgstr "Maximum Size (Clamp) : "
+
+msgid "VisuGUI_GaussPointsDlg::MAIN_TEXTURE"
+msgstr "Main Texture (16x16) : "
+
+msgid "VisuGUI_GaussPointsDlg::ALPHA_TEXTURE"
+msgstr "Alpha Channel Texture (16x16) : "
+
+msgid "VisuGUI_GaussPointsDlg::ALPHA_THRESHOLD"
+msgstr "Alpha Channel Threshold : "
+
+msgid "VisuGUI_GaussPointsDlg::SIZE_TITLE"
+msgstr "Size"
+
+msgid "VisuGUI_GaussPointsDlg::SIZE"
+msgstr "Size of points (%) : "
+
+msgid "VisuGUI_GaussPointsDlg::MIN_SIZE"
+msgstr "Range values for min size (%) : "
+
+msgid "VisuGUI_GaussPointsDlg::MAX_SIZE"
+msgstr "max size (%) : "
+
+msgid "VisuGUI_GaussPointsDlg::MAGNIFICATION"
+msgstr "Magnification (%) : "
+
+msgid "VisuGUI_GaussPointsDlg::INCREMENT"
+msgstr "+/- Ratio : "
+
+msgid "VisuGUI_GaussPointsDlg::COLOR_TITLE"
+msgstr "Color"
+
+msgid "VisuGUI_GaussPointsDlg::COLOR"
+msgstr "Color : "
+
+msgid "VisuGUI_GaussScalarBarPane::ACTIVE_BAR_GRP"
+msgstr "Active bar"
+
+msgid "VisuGUI_GaussScalarBarPane::LOCAL"
+msgstr "Local"
+
+msgid "VisuGUI_GaussScalarBarPane::GLOBAL"
+msgstr "Global"
+
+msgid "VisuGUI_GaussScalarBarPane::DISPLAYED"
+msgstr "Displayed"
+
+msgid "VisuGUI_GaussScalarBarPane::SCALAR_RANGE_GRP"
+msgstr "Scalar range"
+
+msgid "VisuGUI_GaussScalarBarPane::LOGARITHMIC_SCALING"
+msgstr "Logarithmic scaling"
+
+msgid "VisuGUI_GaussScalarBarPane::FIELD_RANGE_BTN"
+msgstr "Use field range"
+
+msgid "VisuGUI_GaussScalarBarPane::IMPOSED_RANGE_BTN"
+msgstr "Use imposed range"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_MIN"
+msgstr "Min:"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_MAX"
+msgstr "Max:"
+
+msgid "VisuGUI_GaussScalarBarPane::COLORS_LABELS_GRP"
+msgstr "Colors and labels"
+
+msgid "VisuGUI_GaussScalarBarPane::BICOLOR"
+msgstr "Bicolor"
+
+msgid "VisuGUI_GaussScalarBarPane::RAINBOW"
+msgstr "Rainbow"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_NB_COLORS"
+msgstr "Nb. of colors:"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_NB_LABELS"
+msgstr "Nb. of labels:"
+
+msgid "VisuGUI_GaussScalarBarPane::ORIENTATION_GRP"
+msgstr "Orientation"
+
+msgid "VisuGUI_GaussScalarBarPane::VERTICAL_BTN"
+msgstr "Vertical"
+
+msgid "VisuGUI_GaussScalarBarPane::HORIZONTAL_BTN"
+msgstr "Horizontal"
+
+msgid "VisuGUI_GaussScalarBarPane::ORIGIN_GRP"
+msgstr "Origin"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_X"
+msgstr "X:"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_Y"
+msgstr "Y:"
+
+msgid "VisuGUI_GaussScalarBarPane::DIMENSIONS_GRP"
+msgstr "Dimensions"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_WIDTH"
+msgstr "Width:"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_HEIGHT"
+msgstr "Height:"
+
+msgid "VisuGUI_GaussScalarBarPane::LBL_SPACING"
+msgstr "Spacing:"
+
+msgid "VisuGUI_GaussScalarBarPane::SAVE_DEFAULT_CHK"
+msgstr "Save as default values"
+
+msgid "VVTK_ViewWindow::LBL_TOOLBAR_LABEL"
+msgstr "GAUSS viewer tools"
+
+msgid "VVTK_SegmentationCursorDlg::SEGMENTATION_CURSOR_DLG_TITLE"
+msgstr "Segmentation Cursor"
+
+msgid "VVTK_SegmentationCursorDlg::ORIGIN_TITLE"
+msgstr "Origin"
+
+msgid "VVTK_SegmentationCursorDlg::ORIGIN_X"
+msgstr "X: "
+
+msgid "VVTK_SegmentationCursorDlg::ORIGIN_Y"
+msgstr "Y: "
+
+msgid "VVTK_SegmentationCursorDlg::ORIGIN_Z"
+msgstr "Z: "
+
+msgid "VVTK_SegmentationCursorDlg::DIRECTION_TITLE"
+msgstr "Direction"
+
+msgid "VVTK_SegmentationCursorDlg::DIRECTION_DX"
+msgstr "DX: "
+
+msgid "VVTK_SegmentationCursorDlg::DIRECTION_DY"
+msgstr "DY: "
+
+msgid "VVTK_SegmentationCursorDlg::DIRECTION_DZ"
+msgstr "DZ: "
+
+msgid "VVTK_SegmentationCursorDlg::DEPTH_TITLE"
+msgstr "Depth"
+
+msgid "VVTK_SegmentationCursorDlg::DEPTH"
+msgstr "Depth of the cursor: "
+
+msgid "VVTK_SegmentationCursorDlg::SEGMENTATION_CURSOR_TAB"
+msgstr "Segmentation Cursor"
+
+msgid "VVTK_SegmentationCursorDlg::PRIMITIVE_TITLE"
+msgstr "Primitive"
+
+msgid "VVTK_SegmentationCursorDlg::POINT_SPRITE"
+msgstr "Point Sprite"
+
+msgid "VVTK_SegmentationCursorDlg::OPENGL_POINT"
+msgstr "OpenGL Point"
+
+msgid "VVTK_SegmentationCursorDlg::GEOMETRICAL_SPHERE"
+msgstr "Geometrical Sphere"
+
+msgid "VVTK_SegmentationCursorDlg::MAXIMUM_SIZE"
+msgstr "Maximum Size (Clamp) : "
+
+msgid "VVTK_SegmentationCursorDlg::MAIN_TEXTURE"
+msgstr "Main Texture (16x16) : "
+
+msgid "VVTK_SegmentationCursorDlg::ALPHA_TEXTURE"
+msgstr "Alpha Channel Texture (16x16) : "
+
+msgid "VVTK_SegmentationCursorDlg::ALPHA_THRESHOLD"
+msgstr "Alpha Channel Threshold : "
+
+msgid "VVTK_SegmentationCursorDlg::SIZE_TITLE"
+msgstr "Size"
+
+msgid "VVTK_SegmentationCursorDlg::SIZE"
+msgstr "Percentage of normal size (%) : "
+
+msgid "VVTK_SegmentationCursorDlg::COLOR_TITLE"
+msgstr "Color"
+
+msgid "VVTK_SegmentationCursorDlg::COLOR"
+msgstr "Color : "
+
+msgid "VVTK_SegmentationCursorDlg::OUTSIDE_CURSOR_TAB"
+msgstr "Outside Cursor Gauss Points"
+
+msgid "VVTK_PickingDlg::PICKING_DLG_TITLE"
+msgstr "Picking"
+
+msgid "VVTK_PickingDlg::CURSOR_TITLE"
+msgstr "Cursor"
+
+msgid "VVTK_PickingDlg::PYRAMID_HEIGHT"
+msgstr "Height of the pyramids :"
+
+msgid "VVTK_PickingDlg::INFO_WINDOW_TITLE"
+msgstr "Information window"
+
+msgid "VVTK_PickingDlg::TRANSPARENCY"
+msgstr "Transparency :"
+
+msgid "VVTK_PickingDlg::POSITION"
+msgstr "Position :"
+
+msgid "VVTK_PickingDlg::BELOW_POINT"
+msgstr "Centered below the point"
+
+msgid "VVTK_PickingDlg::TOP_LEFT_CORNER"
+msgstr "Top-left corner of the 3D view"
+
+msgid "VVTK_PickingDlg::CAMERA_TITLE"
+msgstr "Movement of the camera"
+
+msgid "VVTK_PickingDlg::ZOOM_FACTOR"
+msgstr "Zoom at first selected point (ratio) :"
+
+msgid "VVTK_PickingDlg::STEP_NUMBER"
+msgstr "Number of steps between two positions :"
+
+msgid "VVTK_PickingDlg::PARENT_MESH_TITLE"
+msgstr "Parent mesh element"
+
+msgid "VVTK_PickingDlg::DISPLAY_PARENT_MESH"
+msgstr "Display parent mesh element"
\ No newline at end of file
index 52de37fb81941da51bd7e2fadc2ec77caafe3c0c..def9b9fc5262927e034d45b62231750ddf51de92 100644 (file)
@@ -54,7 +54,6 @@
 
 #include "CAM_Module.h"
 
-#include "SVTK_RenderWindow.h"
 #include "SVTK_ViewWindow.h"
 #include "SVTK_ViewModel.h"
 #include "SVTK_Functor.h"
 #include "VisuGUI_Selection.h"
 #include "VisuGUI_TimeAnimation.h"
 #include "VisuGUI_EditContainerDlg.h"
-#include "VisuGUI_NonIsometricDlg.h"
 #include "VisuGUI_ClippingDlg.h"
 #include "VisuGUI_Plot3DDlg.h"
-#include "VisuGUI_CubeAxesDlg.h"
 #include "VisuGUI_OffsetDlg.h"
 
 #include "VISU_ScalarMap_i.hh"
 
 #include "VisuGUI_ActionsDef.h"
 
+#include "VisuGUI_Timer.h"
+
 using namespace VISU;
 
 #ifdef _DEBUG_
@@ -161,6 +160,9 @@ void
 VisuGUI::
 OnImportFromFile()
 {
+  VisuGUI_Timer aTimer;
+  aTimer.Start();
+
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
   CheckLock(GetCStudy(GetAppStudy(this)));
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
@@ -176,7 +178,7 @@ OnImportFromFile()
                               tr("MEN_IMPORT_FROM_FILE"),
                               true);
   if(aFileInfo.exists()) {
-    application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
+    application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
 
     VISU::Result_var aResult;
     bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
@@ -204,8 +206,9 @@ OnImportFromFile()
                              tr("ERR_ERROR_IN_THE_FILE"),
                              tr("BUT_OK"));
     }else{
-      application()->putInfo(aFileInfo.filePath() + tr("INF_DONE"));
       UpdateObjBrowser(this);
+      application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") +
+                            " in " + aTimer.GetTime() + " seconds", -1 );
     }
   }
 }
@@ -672,7 +675,7 @@ OnErasePrs()
   QApplication::setOverrideCursor(Qt::waitCursor);
 
   SVTK_ViewWindow* vw = GetViewWindow( this );
-  if (vw)
+  if (vw) 
     vw->unHighlightAll();
 
   SALOME_ListIO aList;
@@ -686,7 +689,7 @@ OnErasePrs()
     ErasePrs( this, anObject, false );
   }
 
-  if (vw)
+  if (vw) 
     vw->Repaint();
 
   QApplication::restoreOverrideCursor();
@@ -817,7 +820,6 @@ OnEraseAll()
       for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
         if (anActor->GetVisibility() > 0)
           if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
-            anVISUActor = anVISUActor->GetParent();
             anVISUActor->VisibilityOff();
           }
       }
@@ -870,20 +872,6 @@ OnMakeShrink()
   ChangeRepresentation(this, VISU::SHRINK);
 }
 
-void
-VisuGUI::
-OnSetShadingOn()
-{
-  SetShading(this, true);
-}
-
-void
-VisuGUI::
-OnSetShadingOff()
-{
-  SetShading(this, false);
-}
-
 void
 VisuGUI::
 OnChangeColor()
@@ -1131,7 +1119,7 @@ OnDeleteObjects()
 
   SALOME_ListIO aList;
   SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this);
-  mgr->selectedObjects(aList,QString::null,false);
+  mgr->selectedObjects(aList);
   int i = 0, nbSelected = aList.Extent();
   if (nbSelected < 1) return;
 
@@ -1583,10 +1571,12 @@ OnSweep()
         float aPercents = float(i)/aSteps;
         aPrsObject->SetMapScale(aPercents);
         aPrsObject->UpdateActor(aActor);
-        vw->getRenderWindow()->getRenderWindow()->Render();
+        vw->getRenderWindow()->Render();
         usleep(aTemp);
       }
     }
+    aPrsObject->SetMapScale(1.0);
+    aPrsObject->UpdateActor(aActor);
   } catch (std::exception& exc) {
     INFOS("Follow exception was occured :\n" << exc.what());
   } catch (...) {
@@ -1775,25 +1765,6 @@ OnSelectionInfo()
                            tr("BUT_OK") );
 }
 
-void
-VisuGUI::
-OnScaling()
-{
-  VisuGUI_NonIsometricDlg* m_NonIsoDlg =
-    new VisuGUI_NonIsometricDlg (GetDesktop(this), "m_NonIsoDlg",
-                                 false, Qt::WDestructiveClose);
-  m_NonIsoDlg->show();
-}
-
-void
-VisuGUI::
-OnCubeAxes()
-{
-  //Show dialog that allows to select scale function and corresponding scale factor
-  VisuGUI_CubeAxesDlg* aDlg = new VisuGUI_CubeAxesDlg (GetDesktop(this));
-  aDlg->show();
-}
-
 void
 VisuGUI::
 OnMergeScalarBars()
@@ -2150,14 +2121,6 @@ createActions()
   createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(),
                 tr("MEN_UNSHRINK"), "", 0, aParent, false,
                 this, SLOT(OnMakeShrink()));
-  
-  createAction( VISU_SHADING, tr("MEN_SHADING"), QIconSet(),
-                tr("MEN_SHADING"), "", 0, aParent, false,
-                this, SLOT(OnSetShadingOn()));
-  
-  createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIconSet(),
-                tr("MEN_NOSHADING"), "", 0, aParent, false,
-                this, SLOT(OnSetShadingOff()));
 
   createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIconSet(),
                 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
@@ -2252,16 +2215,6 @@ createActions()
                 //this, SLOT(OnEraseAll()));
                 this);
 
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALING"));
-  createAction( VISU_SCALING, tr("MEN_SCALING"), QIconSet(aPixmap),
-                tr("MEN_SCALING"), "", 0, aParent, false,
-                this, SLOT(OnScaling()));
-
-  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUBE_AXES"));
-  createAction( VISU_CUBE_AXES, tr("MEN_CUBE_AXES"), QIconSet(aPixmap),
-                tr("MEN_CUBE_AXES"), "", 0, aParent, false,
-                this, SLOT(OnCubeAxes()));
-
   createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(),
                 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
                 this, SLOT(OnShowAnimation()));
@@ -2301,8 +2254,6 @@ createMenus()
   createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
   createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
   createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
-  createMenu( VISU_SCALING, aMenuId, 10 ); // scaling
-  createMenu( VISU_CUBE_AXES, aMenuId, 10 ); // scaling
 }
 
 void
@@ -2326,8 +2277,6 @@ createToolBars()
   createTool( VISU_ERASE_ALL, aToolId );
   createTool( VISU_GLOBAL_SELECTION, aToolId );
   createTool( VISU_PARTIAL_SELECTION, aToolId );
-  createTool( VISU_SCALING, aToolId );
-  createTool( VISU_CUBE_AXES, aToolId );
 }
 
 void
@@ -2399,9 +2348,6 @@ createPopupMenus()
   mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
   mgr->insert( action( VISU_SHRINK )      , parentId, -1, -1 ); // shrink
   mgr->insert( action( VISU_UNSHRINK )    , parentId, -1, -1 ); // unshrink
-  mgr->insert( separator(), parentId, -1, -1 );
-  mgr->insert( action( VISU_SHADING )     , parentId, -1, -1 ); // shading
-  mgr->insert( action( VISU_NOSHADING )   , parentId, -1, -1 ); // noshading
 
   // "Properties" submenu
   parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
@@ -2439,17 +2385,23 @@ createPopupMenus()
 
   // Rules
 
+  QString aSel_One_ObjBr  ("client='ObjectBrowser' and selcount=1");
+  QString aSel_Some_ObjBr ("client='ObjectBrowser' and selcount>0");
+  QString aSel_Many_ObjBr ("client='ObjectBrowser' and selcount>1");
+
   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
                    "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D'");
 
+  QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
+
   // VISU root commands
-  QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
+  QString aRule = aSel_One_ObjBr + " and type='VISU::TVISUGEN'";
   mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule, true );
   mgr->setRule( action( VISU_IMPORT_TABLE ), aRule, true );
   mgr->setRule( action( VISU_PLOT2D ), aRule, true );
 
   // timestamp commands
-  aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TTIMESTAMP'";
+  aRule = aSel_One_ObjBr + " and type='VISU::TTIMESTAMP'";
   mgr->setRule( action( VISU_SCALAR_MAP ), aRule, true );
   mgr->setRule( action( VISU_ISO_SURFACES ), aRule, true );
   mgr->setRule( action( VISU_CUT_PLANES ), aRule, true );
@@ -2460,27 +2412,19 @@ createPopupMenus()
   mgr->setRule( action( VISU_VECTORS ), aRule, true );
   mgr->setRule( action( VISU_STREAM_LINES ), aRule, true );
 
-  // display/erase commands
-  QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
-  QString aTableOrCont = "(type='VISU::TTABLE' and nbChildren>0) or type='VISU::TCONTAINER'";
-  QString orCurveVisible   = "or (type='VISU::TCURVE' and isVisible)";
-  QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
-  QString aPrsVisible   = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)";
-  QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")";
-
-  QString anEraseRule = "selcount>0 and (" + aPrsVisible +
-    " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + ")))";
-
-  QString aDisplayRule = "selcount>0 and (" + aPrsInvisible +
-    " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + ")))";
+  // table commands
+  //aRule = aSel_One_ObjBr + " and type='VISU::TTABLE'";
+  //mgr->setRule( action( VISU_SHOW_TABLE ), aRule, true );
+  //mgr->setRule( action( VISU_CREATE_CURVES ), aRule, true );
+  //mgr->setRule( action( VISU_EXPORT_TABLE ), aRule, true );
 
-  QString aDOnlyRule = "selcount>0 and (($type in {'VISU::TMESH' " + aPrsAll + "})"
-    " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
-    " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))))";
+  aRule = "(" + aSel_Some_ObjBr + " and ((type='VISU::TTABLE' and nbChildren>0) or"
+          " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))"
+          ") or (selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "})";
 
-  mgr->setRule( action( VISU_ERASE ), anEraseRule, true );
-  mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
-  mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
+  mgr->setRule( action( VISU_ERASE ), aRule + "and (isVisible=true)", true );// TODO: aRule.arg(" and isVisible=1"), true );
+  mgr->setRule( action( VISU_DISPLAY ), aRule + "and ((isVisible=false and isActiveView=true) or (isActiveView=false))", true );// TODO: aRule.arg(" and isVisible=0"), true );
+  mgr->setRule( action( VISU_DISPLAY_ONLY ), aRule, true );
 
   aRule = "selcount>0 and $type in {'VISU::TMESH' " + aPrsAll + "}";
   mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
@@ -2489,7 +2433,7 @@ createPopupMenus()
   mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule, true );
   mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule, true );
 
-  // view parameters
+  // View parameters
   aRule = "selcount=1 and type='VISU::TVIEW3D'";
   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule, true );
   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0", true );
@@ -2526,9 +2470,6 @@ createPopupMenus()
   mgr->setRule( action( VISU_SHRINK )  , aRule + aShrinkType + " and isShrunk=0", true );
   mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true );
 
-  mgr->setRule( action( VISU_SHADING )  , aRule + " and isScalarMapAct=1 and isShading=0", true );
-  mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1", true );
-
   // "Properties" submenu
   mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
   mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'", true );
@@ -2539,8 +2480,6 @@ createPopupMenus()
   mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1", true );
 
   // rename command
-  QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER'";
-
   aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' " + aCurveAll + " " + aPrsAll + "})";
   mgr->setRule( action( VISU_RENAME ), aRule, true );
 
@@ -2553,25 +2492,25 @@ createPopupMenus()
   mgr->setRule( action( VISU_CURVE_PROPS ), aRule, true );
 
   // curve container commands
-  aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
+  aRule = aSel_One_ObjBr + " and type='VISU::TCONTAINER'";
   mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule, true );
   mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true );
 
-  mgr->setRule( action( VISU_EDIT_SCALARMAP ),
+  mgr->setRule( action( VISU_EDIT_SCALARMAP ), 
                "selcount=1 and type='VISU::TSCALARMAP'", true );
-  mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
+  mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ), 
                "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true );
-  mgr->setRule( action( VISU_EDIT_CUTPLANES ),
+  mgr->setRule( action( VISU_EDIT_CUTPLANES ), 
                "selcount=1 and type='VISU::TCUTPLANES'", true );
-  mgr->setRule( action( VISU_EDIT_CUTLINES ),
+  mgr->setRule( action( VISU_EDIT_CUTLINES ), 
                "selcount=1 and type='VISU::TCUTLINES'", true );
-  mgr->setRule( action( VISU_EDIT_ISOSURFACE ),
+  mgr->setRule( action( VISU_EDIT_ISOSURFACE ), 
                "selcount=1 and type='VISU::TISOSURFACE'", true );
-  mgr->setRule( action( VISU_EDIT_VECTORS ),
+  mgr->setRule( action( VISU_EDIT_VECTORS ), 
                "selcount=1 and type='VISU::TVECTORS'", true );
-  mgr->setRule( action( VISU_EDIT_STREAMLINES ),
+  mgr->setRule( action( VISU_EDIT_STREAMLINES ), 
                "selcount=1 and type='VISU::TSTREAMLINES'", true );
-  mgr->setRule( action( VISU_EDIT_PLOT3D ),
+  mgr->setRule( action( VISU_EDIT_PLOT3D ), 
                "selcount=1 and type='VISU::TPLOT3D'", true );
 
   aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
@@ -2580,7 +2519,7 @@ createPopupMenus()
   aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
   mgr->setRule( action( VISU_SWEEP ), aRule, true );
 
-  // "Selection info" popup item
+  // Selection info popup item
   aRule = "client='VTKViewer' and selcount=1" + aInsideType;
   mgr->setRule( action( VISU_SELECTION_INFO ), aRule, true );
 
@@ -2809,7 +2748,7 @@ void VisuGUI::createPreferences()
 
   int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
   setPreferenceProperty( numcol, "min", 2 );
-  setPreferenceProperty( numcol, "max", 64 );
+  setPreferenceProperty( numcol, "max", 256 );
 
   int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
   setPreferenceProperty( numlab, "min", 2 );
@@ -2922,7 +2861,7 @@ void VisuGUI::preferencesChanged( const QString&, const QString& )
 
 SUIT_ViewManager*
 VisuGUI
-::getViewManager(const QString& theType,
+::getViewManager(const QString& theType, 
                 const bool theIsCreate)
 {
   return getApp()->getViewManager(theType,theIsCreate);
index 5b64c53a4f1145d384b9d15e9ea2e32b8ca4b65f..aa8e43169a843b03d79631870ce7b1f52d47f6ca 100644 (file)
@@ -105,9 +105,6 @@ protected slots:
   void OnMakePoints();
   void OnMakeShrink();
 
-  void OnSetShadingOn();
-  void OnSetShadingOff();
-
   void OnChangeColor();
   void OnChangeWireframeColor();
   void OnChangeOpacity();
@@ -124,8 +121,8 @@ protected slots:
   void OnMergeScalarBars();
   void OnFreeScalarBars();
 
-  void OnSaveViewParams();
-  void OnRestoreViewParams();
+  virtual void OnSaveViewParams();
+  virtual void OnRestoreViewParams();
 
   void OnRename();
   void OnClippingPlanes();
@@ -140,9 +137,6 @@ protected slots:
   void OnTranslatePrs();
   void OnArrangeActors();
 
-  void OnScaling();
-  void OnCubeAxes();
-
 protected:
   virtual SalomeApp_Selection* createSelection() const;
 
diff --git a/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx b/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx
deleted file mode 100755 (executable)
index 97640bd..0000000
+++ /dev/null
@@ -1,594 +0,0 @@
-//  VISU VISUGUI : GUI for SMESH component
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-//  File   : VisuGUI_CubeAxesDlg.cxx
-//  Author : Sergey LITONIN
-//  Module : VISU
-
-#include "VisuGUI_CubeAxesDlg.h"
-
-#include "VisuGUI.h"
-#include "VisuGUI_Tools.h"
-#include "VisuGUI_FontWg.h"
-
-#include "SVTK_ViewWindow.h"
-#include "SVTK_CubeAxesActor2D.h"
-
-#include <qlayout.h>
-#include <qframe.h>
-#include <qpushbutton.h>
-#include <qtabwidget.h>
-#include <qcheckbox.h>
-#include <qgroupbox.h>
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qobjectlist.h>
-#include <qvalidator.h>
-
-#include <vtkAxisActor2D.h>
-#include <vtkTextProperty.h>
-
-/*!
- * Class       : AxisWg
- * Description : Tab of dialog
- */
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::AxisWg
-// Purpose : Constructor
-//=======================================================================
-VisuGUI_AxisWg::VisuGUI_AxisWg (QWidget* theParent)
-:  QFrame(theParent)
-{
-  QValueList< QLabel* > aLabels;
-
-  // "Name" grp
-
-  myNameGrp = new QGroupBox(3, Qt::Vertical, tr("AXIS_NAME"), this);
-  myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp);
-
-  QHBox* aHBox = new QHBox(myNameGrp);
-  aHBox->setSpacing(5);
-  QLabel* aLabel = new QLabel(tr("NAME"), aHBox);
-  myAxisName = new QLineEdit(aHBox);
-  aLabels.append(aLabel);
-
-  aHBox = new QHBox(myNameGrp);
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(tr("FONT"), aHBox);
-  myNameFont = new VisuGUI_FontWg(aHBox);
-  aLabels.append(aLabel);
-
-
-  // "Labels" grp
-
-  myLabelsGrp = new QGroupBox(4, Qt::Vertical, tr("LABELS"), this);
-  myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp);
-
-  aHBox = new QHBox(myLabelsGrp);
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(tr("NUMBER"), aHBox);
-  myLabelNumber = new QLineEdit(aHBox);
-  myLabelNumber->setValidator(new QIntValidator(0, 25, this));
-  myLabelNumber->installEventFilter(this);
-  aLabels.append(aLabel);
-
-  aHBox = new QHBox(myLabelsGrp);
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(tr("OFFSET"), aHBox);
-  myLabelOffset = new QLineEdit(aHBox);
-  aLabels.append(aLabel);
-
-  aHBox = new QHBox(myLabelsGrp);
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(tr("FONT"), aHBox);
-  myLabelsFont = new VisuGUI_FontWg(aHBox);
-  aLabels.append(aLabel);
-
-  // "Tick marks" grp
-
-  myTicksGrp = new QGroupBox(2, Qt::Vertical, tr("TICK_MARKS"), this);
-  myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp);
-
-  aHBox = new QHBox(myTicksGrp);
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(tr("LENGTH"), aHBox);
-  myTickLength = new QLineEdit(aHBox);
-  aLabels.append(aLabel);
-
-  // Layout
-
-  QVBoxLayout* aLay = new QVBoxLayout(this, 0, 5);
-  aLay->addWidget(myNameGrp);
-  aLay->addWidget(myLabelsGrp);
-  aLay->addWidget(myTicksGrp);
-
-  // init
-  myIsNameVisible->setChecked(true);
-  myIsLabelsVisible->setChecked(true);
-  myIsTicksVisible->setChecked(true);
-  updateControlState();
-
-  // Adjust label widths
-  QValueList< QLabel* >::iterator anIter;
-  int aMaxWidth = 0;
-  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
-    aMaxWidth = QMAX(aMaxWidth, (*anIter)->sizeHint().width());
-  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
-    (*anIter)->setFixedWidth(aMaxWidth);
-
-  // connect signals and slots
-  connect(myIsNameVisible, SIGNAL(stateChanged(int)), SLOT(onNameChecked()));
-  connect(myIsLabelsVisible, SIGNAL(stateChanged(int)), SLOT(onLabelsChecked()));
-  connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked()));
-}
-
-VisuGUI_AxisWg::~VisuGUI_AxisWg()
-{
-}
-
-void VisuGUI_AxisWg::updateControlState()
-{
-  onNameChecked();
-  onLabelsChecked();
-  onTicksChecked();
-}
-
-bool VisuGUI_AxisWg::eventFilter(QObject* o, QEvent* e)
-{
-  if (e->type() == QEvent::FocusOut) {
-    bool isOK = false;
-    int k = myLabelNumber->text().toInt(&isOK);
-    if (isOK && k > 25) myLabelNumber->setText("25");
-  }
-  return false;
-}
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::onNameChecked
-// Purpose :
-//=======================================================================
-void VisuGUI_AxisWg::setEnabled(QGroupBox* theGrp, const bool theState)
-{
-  QObjectList aChildren(*theGrp->children());
-  QObject* anObj;
-  for(anObj = aChildren.first(); anObj !=0; anObj = aChildren.next())
-    if (anObj !=0 && anObj->inherits("QHBox"))
-      ((QHBox*)anObj)->setEnabled(theState);
-}
-
-//=======================================================================
-// Labels    : VisuGUI_AxisWg::onLabelsChecked
-// Purpose :
-//=======================================================================
-void VisuGUI_AxisWg::onLabelsChecked()
-{
-  setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked());
-}
-
-//=======================================================================
-// Labels    : VisuGUI_AxisWg::onTicksChecked
-// Purpose :
-//=======================================================================
-void VisuGUI_AxisWg::onTicksChecked()
-{
-  setEnabled(myTicksGrp, myIsTicksVisible->isChecked());
-}
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::onNameChecked
-// Purpose :
-//=======================================================================
-void VisuGUI_AxisWg::onNameChecked()
-{
-  setEnabled(myNameGrp, myIsNameVisible->isChecked());
-}
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::UseName
-// Purpose :
-//=======================================================================
-void VisuGUI_AxisWg::UseName(const bool toUse)
-{
-  myIsNameVisible->setChecked(toUse);
-}
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::SetName
-// Purpose :
-//================================================== =====================
-void VisuGUI_AxisWg::SetName(const QString& theName)
-{
-  myAxisName->setText(theName);
-}
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::SetNameFont
-// Purpose :
-//=======================================================================
-void VisuGUI_AxisWg::SetNameFont(const QColor& theColor,
-                                  const int theFont,
-                                  const bool theIsBold,
-                                  const bool theIsItalic,
-                                  const bool theIsShadow)
-{
-  myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
-}
-
-//=======================================================================
-// name    : VisuGUI_AxisWg::SetNameFont
-// Purpose :
-//=======================================================================
-bool VisuGUI_AxisWg::ReadData(vtkAxisActor2D* theActor)
-{
-  if (theActor == 0)
-    return false;
-
-  // Name
-
-  bool useName = theActor->GetTitleVisibility();
-  QString aTitle(theActor->GetTitle());
-
-  QColor aTitleColor(255, 255, 255);
-  int aTitleFontFamily = VTK_ARIAL;
-  bool isTitleBold = false;
-  bool isTitleItalic = false;
-  bool isTitleShadow = false;
-
-  vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
-  if (aTitleProp !=0)
-  {
-    float c[ 3 ];
-    aTitleProp->GetColor(c);
-    aTitleColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
-    aTitleFontFamily = aTitleProp->GetFontFamily();
-    isTitleBold = aTitleProp->GetBold() ? true : false;
-    isTitleItalic = aTitleProp->GetItalic() ? true : false;
-    isTitleShadow = aTitleProp->GetShadow() ? true : false;
-  }
-
-  myIsNameVisible->setChecked(useName);
-  myAxisName->setText(aTitle);
-  myNameFont->SetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
-
-  // Labels
-
-  bool useLabels = theActor->GetLabelVisibility();
-  int nbLabels = theActor->GetNumberOfLabels();
-  int anOffset = theActor->GetTickOffset();
-
-  QColor aLabelsColor(255, 255, 255);
-  int aLabelsFontFamily = VTK_ARIAL;
-  bool isLabelsBold = false;
-  bool isLabelsItalic = false;
-  bool isLabelsShadow = false;
-
-  vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
-  if (aLabelsProp !=0)
-  {
-    float c[ 3 ];
-    aLabelsProp->GetColor(c);
-    aLabelsColor.setRgb((int)(c[ 0 ] * 255), (int)(c[ 1 ] * 255), (int)(c[ 2 ] * 255));
-    aLabelsFontFamily = aLabelsProp->GetFontFamily();
-    isLabelsBold = aLabelsProp->GetBold() ? true : false;
-    isLabelsItalic = aLabelsProp->GetItalic() ? true : false;
-    isLabelsShadow = aLabelsProp->GetShadow() ? true : false;
-  }
-
-  myIsLabelsVisible->setChecked(useLabels);
-  myLabelNumber->setText(QString("%1").arg(nbLabels));
-  myLabelOffset->setText(QString("%1").arg(anOffset));
-  myLabelsFont->SetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
-
-  // Tick marks
-  bool useTickMarks = theActor->GetTickVisibility();
-  int aTickLength = theActor->GetTickLength();
-
-  myIsTicksVisible->setChecked(useTickMarks);
-  myTickLength->setText(QString("%1").arg(aTickLength));
-
-  return true;
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::Apply
-// Purpose :
-//=======================================================================
-bool VisuGUI_AxisWg::Apply(vtkAxisActor2D* theActor)
-{
-   if (theActor == 0)
-    return false;
-
-  // Name
-
-  theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0);
-  theActor->SetTitle(myAxisName->text().latin1());
-
-  QColor aTitleColor(255, 255, 255);
-  int aTitleFontFamily = VTK_ARIAL;
-  bool isTitleBold = false;
-  bool isTitleItalic = false;
-  bool isTitleShadow = false;
-
-  myNameFont->GetData(aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow);
-  vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();
-  if (aTitleProp)
-  {
-    aTitleProp->SetColor(aTitleColor.red() / 255.,
-                          aTitleColor.green() / 255.,
-                          aTitleColor.blue() / 255.);
-    aTitleProp->SetFontFamily(aTitleFontFamily);
-
-    aTitleProp->SetBold(isTitleBold ? 1 : 0);
-    aTitleProp->SetItalic(isTitleItalic ? 1 : 0);
-    aTitleProp->SetShadow(isTitleShadow ? 1 : 0);
-
-    theActor->SetTitleTextProperty(aTitleProp);
-  }
-
-  // Labels
-
-  theActor->SetLabelVisibility(myIsLabelsVisible->isChecked() ? 1 : 0);
-
-  bool isOk = false;
-  int nbLabels = myLabelNumber->text().toInt(&isOk);
-  if (isOk)
-    theActor->SetNumberOfLabels(nbLabels);
-
-  int anOffset = myLabelOffset->text().toInt(&isOk);
-  if (isOk)
-    theActor->SetTickOffset(anOffset);
-
-  QColor aLabelsColor(255, 255, 255);
-  int aLabelsFontFamily = VTK_ARIAL;
-  bool isLabelsBold = false;
-  bool isLabelsItalic = false;
-  bool isLabelsShadow = false;
-
-  myLabelsFont->GetData(aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow);
-  vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();
-  if (aLabelsProp)
-  {
-    aLabelsProp->SetColor(aLabelsColor.red() / 255.,
-                          aLabelsColor.green() / 255.,
-                          aLabelsColor.blue() / 255.);
-    aLabelsProp->SetFontFamily(aLabelsFontFamily);
-
-    aLabelsProp->SetBold(isLabelsBold ? 1 : 0);
-    aLabelsProp->SetItalic(isLabelsItalic ? 1 : 0);
-    aLabelsProp->SetShadow(isLabelsShadow ? 1 : 0);
-
-    aLabelsProp->Modified();
-    theActor->SetLabelTextProperty(aLabelsProp);
-  }
-
-
-  // Tick marks
-  theActor->SetTickVisibility(myIsTicksVisible->isChecked());
-  int aTickLength = myTickLength->text().toInt(&isOk);
-  if (isOk)
-    theActor->SetTickLength(aTickLength);
-
-  return true;
-}
-
-/*
-  Class       : VisuGUI_CubeAxesDlg
-  Description : Dialog for specifynig cube axes properties
-*/
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg
-// Purpose : Constructor
-//=======================================================================
-VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg(QWidget* theParent)
-: QDialog(theParent, "VisuGUI_CubeAxesDlg", false,
-    WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose)
-{
-  setCaption(tr("CAPTION"));
-
-  QVBoxLayout* aLay = new QVBoxLayout(this, 5, 5);
-  aLay->addWidget(createMainFrame(this));
-  aLay->addWidget(createButtonFrame(this));
-
-  Init();
-
-//if (VISU::GetDesktop()->getMainFrame())
-//  connect(VISU::GetDesktop()->getMainFrame(), SIGNAL(windowActivated(QWidget*)),
-//          SLOT(onWindowActivated(QWidget*)));
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
-QWidget* VisuGUI_CubeAxesDlg::createMainFrame(QWidget* theParent)
-{
-  QFrame* aFrame = new QFrame(theParent);
-
-  myTabWg = new QTabWidget(aFrame);
-
-  myAxes[ 0 ] = new VisuGUI_AxisWg(myTabWg);
-  myAxes[ 1 ] = new VisuGUI_AxisWg(myTabWg);
-  myAxes[ 2 ] = new VisuGUI_AxisWg(myTabWg);
-
-  myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS"));
-  myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS"));
-  myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS"));
-
-  myTabWg->setMargin(5);
-
-  myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame);
-
-  QVBoxLayout* aLay = new QVBoxLayout(aFrame, 0, 5);
-  aLay->addWidget(myTabWg);
-  aLay->addWidget(myIsVisible);
-
-  return aFrame;
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::createButtonFrame
-// Purpose : Create frame containing buttons
-//=======================================================================
-QWidget* VisuGUI_CubeAxesDlg::createButtonFrame(QWidget* theParent)
-{
-  QFrame* aFrame = new QFrame(theParent);
-  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
-
-  myOkBtn    = new QPushButton(tr("BUT_OK"), aFrame);
-  myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame);
-  myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame);
-
-  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
-  QHBoxLayout* aLay = new QHBoxLayout(aFrame, 5, 5);
-
-  aLay->addWidget(myOkBtn);
-  aLay->addWidget(myApplyBtn);
-  aLay->addItem(aSpacer);
-  aLay->addWidget(myCloseBtn);
-
-  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
-  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
-  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
-
-  return aFrame;
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg
-// Purpose : Destructor
-//=======================================================================
-VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg()
-{
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::Init
-// Purpose : Init dialog fields, connect signals and slots, show dialog
-//=======================================================================
-bool VisuGUI_CubeAxesDlg::Init()
-{
-  SVTK_ViewWindow* aFrame = VISU::GetViewWindow();
-  if (aFrame == 0)
-    return false;
-
-  SVTK_CubeAxesActor2D* anActor = aFrame->GetCubeAxes();
-  if (anActor == 0)
-    return false;
-
-  myAxes[ 0 ]->ReadData(anActor->GetXAxisActor2D());
-  myAxes[ 1 ]->ReadData(anActor->GetYAxisActor2D());
-  myAxes[ 2 ]->ReadData(anActor->GetZAxisActor2D());
-
-  myIsVisible->setChecked(anActor->GetVisibility() ? true : false);
-
-  return true;
-
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::isValid
-// Purpose : Verify validity of entry data
-//=======================================================================
-bool VisuGUI_CubeAxesDlg::isValid() const
-{
-  return true;
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::onApply
-// Purpose : Verify validity of entry data
-//=======================================================================
-bool VisuGUI_CubeAxesDlg::onApply()
-{
-  bool isOk = true;
-
-  try
-  {
-    SVTK_ViewWindow* aFrame = VISU::GetViewWindow();
-    if (aFrame == 0)
-      return false;
-
-    SVTK_CubeAxesActor2D* anActor = aFrame->GetCubeAxes();
-    if (anActor == 0)
-      return false;
-
-    isOk = isOk && myAxes[ 0 ]->Apply(anActor->GetXAxisActor2D());
-    isOk = isOk && myAxes[ 1 ]->Apply(anActor->GetYAxisActor2D());
-    isOk = isOk && myAxes[ 2 ]->Apply(anActor->GetZAxisActor2D());
-
-
-    //anActor->SetXLabel(myAxes[ 0 ]->myAxisName->text());
-    //anActor->SetYLabel(myAxes[ 1 ]->myAxisName->text());
-    //anActor->SetZLabel(myAxes[ 2 ]->myAxisName->text());
-
-    //anActor->SetNumberOfLabels(anActor->GetXAxisActor2D()->GetNumberOfLabels());
-    if (myIsVisible->isChecked())
-      anActor->VisibilityOn();
-    else
-      anActor->VisibilityOff();
-
-    if (isOk)
-      aFrame->Repaint();
-  }
-  catch(...)
-  {
-    isOk = false;
-  }
-
-  return isOk;
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
-void VisuGUI_CubeAxesDlg::onOk()
-{
-  if (onApply())
-    onClose();
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void VisuGUI_CubeAxesDlg::onClose()
-{
-  reject();
-}
-
-//=======================================================================
-// name    : VisuGUI_CubeAxesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void VisuGUI_CubeAxesDlg::onWindowActivated (QWidget*)
-{
-  SVTK_ViewWindow* aFrame = VISU::GetViewWindow();
-  if (aFrame)
-    Init();
-  else
-    onClose();
-}
diff --git a/src/VISUGUI/VisuGUI_CubeAxesDlg.h b/src/VISUGUI/VisuGUI_CubeAxesDlg.h
deleted file mode 100755 (executable)
index 59bcbb0..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-//  File   : VisuGUI_CubeAxesDlg.h
-//  Author : Sergey LITONIN
-//  Module : VISU
-
-
-#ifndef VisuGUI_CubeAxesDlg_H
-#define VisuGUI_CubeAxesDlg_H
-
-#include <qdialog.h>
-#include <qframe.h>
-
-class QWidget;
-class QFrame;
-class QPushButton;
-class QTabWidget;
-class QCheckBox;
-class QLineEdit;
-class VisuGUI_FontWg;
-class QGroupBox;
-class VisuGUI_AxisWg;
-class vtkAxisActor2D;
-
-/*!
- * Class       : VisuGUI_CubeAxesDlg
- * Description : Dialog for specifynig cube axes properties
- */
-class VisuGUI_CubeAxesDlg : public QDialog
-{
-  Q_OBJECT
-
-public:
-                  VisuGUI_CubeAxesDlg( QWidget* );
-  virtual         ~VisuGUI_CubeAxesDlg();
-
-  bool            Init();
-
-private slots:
-  void            onOk();
-  bool            onApply();
-  void            onClose();
-
-  void            onWindowActivated( QWidget* );
-
-private:
-  QWidget*        createButtonFrame( QWidget* );
-  QWidget*        createMainFrame  ( QWidget* );
-  bool            isValid() const;
-
-private:
-  QTabWidget*     myTabWg;
-  QCheckBox*      myIsVisible;
-
-  QPushButton*    myOkBtn;
-  QPushButton*    myApplyBtn;
-  QPushButton*    myCloseBtn;
-  VisuGUI_AxisWg* myAxes[ 3 ];
-};
-
-/*!
- * Class       : VisuGUI_AxisWg
- * Description : Tab of dialog
- */
-class VisuGUI_AxisWg : public QFrame
-{
-  Q_OBJECT
-
-public:
-                  VisuGUI_AxisWg( QWidget* );
-                  ~VisuGUI_AxisWg();
-
-  void            UseName( const bool );
-  void            SetName( const QString& );
-  void            SetNameFont( const QColor&, const int, const bool, const bool, const bool );
-  bool            ReadData( vtkAxisActor2D* );
-  bool            Apply( vtkAxisActor2D* );
-
-protected:
-  bool            eventFilter(QObject*, QEvent*);
-
-private slots:
-  void            onNameChecked();
-  void            onLabelsChecked();
-  void            onTicksChecked();
-
-private:
-  void            updateControlState();
-  void            setEnabled( QGroupBox*, const bool );
-
-private:
-  // name
-  QGroupBox*      myNameGrp;
-  QCheckBox*      myIsNameVisible;
-  QLineEdit*      myAxisName;
-  VisuGUI_FontWg* myNameFont;
-
-  // labels
-  QGroupBox*      myLabelsGrp;
-  QCheckBox*      myIsLabelsVisible;
-  QLineEdit*      myLabelNumber;
-  QLineEdit*      myLabelOffset;
-  VisuGUI_FontWg* myLabelsFont;
-
-  // tick marks
-  QGroupBox*      myTicksGrp;
-  QCheckBox*      myIsTicksVisible;
-  QLineEdit*      myTickLength;
-
-  friend class VisuGUI_CubeAxesDlg;
-};
-
-#endif
index 24ea841b2dad44f178bd481aa8d06f9cda2c066a..fea679cb0426c48627624e671a37b8d43fcfd517 100644 (file)
@@ -26,7 +26,7 @@
 //  Module : VISU
 //  $Header$
 
-#include "VisuGUI.h"
+#include "VisuGUI_Module.h"
 
 #include "CAM_Module.h"
 
@@ -34,7 +34,7 @@ extern "C" {
   CAM_Module*
   createModule()
   {
-    return new VisuGUI();
+    return new VisuGUI_Module();
   }
 }
 
diff --git a/src/VISUGUI/VisuGUI_FontWg.cxx b/src/VISUGUI/VisuGUI_FontWg.cxx
deleted file mode 100755 (executable)
index 78d62a1..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-//  VISU VISUGUI : GUI for SMESH component
-//
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-//  File   : VisuGUI_CubeAxesDlg.cxx
-//  Author : Sergey LITONIN
-//  Module : VISU
-
-#include "VisuGUI_FontWg.h"
-
-#include <qtoolbutton.h>
-#include <qcombobox.h>
-#include <qcolordialog.h>
-#include <qcheckbox.h>
-
-#include <vtkTextProperty.h>
-
-/*!
- * Class       : VisuGUI_FontWg
- * Description : Dialog for specifynig font
- */
-
-//=======================================================================
-// name    : VisuGUI_FontWg
-// Purpose : Constructor
-//=======================================================================
-VisuGUI_FontWg::VisuGUI_FontWg( QWidget* theParent )
-: QHBox( theParent )
-{
-  setSpacing( 5 );
-  myColorBtn = new QToolButton( this );
-  myColorBtn->setMinimumWidth( 20 );
-
-  myFamily = new QComboBox( this );
-  myFamily->insertItem( tr( "ARIAL" ) );
-  myFamily->insertItem( tr( "COURIER" ) );
-  myFamily->insertItem( tr( "TIMES" ) );
-
-  myBold = new QCheckBox( tr( "BOLD" ), this );
-  myItalic = new QCheckBox( tr( "ITALIC" ), this );
-  myShadow = new QCheckBox( tr( "SHADOW" ), this );
-
-  connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
-}
-
-//=======================================================================
-// name    : ~VisuGUI_FontWg
-// Purpose : Destructor
-//=======================================================================
-VisuGUI_FontWg::~VisuGUI_FontWg()
-{
-}
-
-//=======================================================================
-// name    : SetColor
-// Purpose :
-//=======================================================================
-void VisuGUI_FontWg::SetColor( const QColor& theColor )
-{
-  myColorBtn->setPaletteBackgroundColor( theColor );
-}
-
-//=======================================================================
-// name    : GetColor
-// Purpose :
-//=======================================================================
-QColor VisuGUI_FontWg::GetColor() const
-{
-  return myColorBtn->paletteBackgroundColor();
-}
-
-//=======================================================================
-// name    : onColor
-// Purpose :
-//=======================================================================
-void VisuGUI_FontWg::onColor()
-{
-  QColor aColor = QColorDialog::getColor( GetColor(), this );
-  if ( aColor.isValid() )
-    SetColor( aColor );
-}
-
-//=======================================================================
-// name    : SetData
-// Purpose :
-//=======================================================================
-void VisuGUI_FontWg::SetData( const QColor& theColor,
-                              const int theFamily,
-                              const bool theBold,
-                              const bool theItalic,
-                              const bool theShadow )
-{
-  SetColor( theColor );
-
-  if ( theFamily == VTK_ARIAL )
-    myFamily->setCurrentItem( 0 );
-  else if ( theFamily == VTK_COURIER )
-    myFamily->setCurrentItem( 1 );
-  else
-    myFamily->setCurrentItem( 2 );
-
-  myBold->setChecked( theBold );
-  myItalic->setChecked( theItalic );
-  myShadow->setChecked( theShadow );
-}
-
-//=======================================================================
-// name    : GetData
-// Purpose :
-//=======================================================================
-void VisuGUI_FontWg::GetData( QColor& theColor,
-                              int& theFamily,
-                              bool& theBold,
-                              bool& theItalic,
-                              bool& theShadow ) const
-{
-  theColor = GetColor();
-
-  int anItem =myFamily->currentItem();
-  if ( anItem == 0 )
-    theFamily = VTK_ARIAL;
-  else if ( anItem == 1 )
-    theFamily = VTK_COURIER;
-  else
-    theFamily = VTK_TIMES;
-
-  theBold = myBold->isChecked();
-  theItalic = myItalic->isChecked();
-  theShadow = myShadow->isChecked();
-}
diff --git a/src/VISUGUI/VisuGUI_FontWg.h b/src/VISUGUI/VisuGUI_FontWg.h
deleted file mode 100755 (executable)
index e3a45ee..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-//  File   : VisuGUI_FontWg.h
-//  Author : Sergey LITONIN
-//  Module : VISU
-
-
-#ifndef VisuGUI_FontWg_H
-#define VisuGUI_FontWg_H
-
-#include <qhbox.h>
-
-class QToolButton;
-class QComboBox;
-class QCheckBox;
-class QColor;
-
-
-/*!
- * Class       : VisuGUI_FontWg
- * Description : Dialog for specifynig font
- */
-class VisuGUI_FontWg : public QHBox
-{
-  Q_OBJECT
-
-public:
-                VisuGUI_FontWg( QWidget* );
-  virtual       ~VisuGUI_FontWg();
-
-  void          SetColor( const QColor& );
-  QColor        GetColor() const;
-
-  void          SetData( const QColor&, const int, const bool, const bool, const bool );
-
-  void          GetData( QColor&, int&, bool&, bool&, bool& ) const;
-
-private slots:
-  void          onColor();
-
-private:
-  QToolButton*  myColorBtn;
-  QComboBox*    myFamily;
-  QCheckBox*    myBold;
-  QCheckBox*    myItalic;
-  QCheckBox*    myShadow;
-};
-
-#endif
diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx
new file mode 100644 (file)
index 0000000..cb16e78
--- /dev/null
@@ -0,0 +1,801 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_MagnitudeDlg.cxx
+//  Author : Laurent CORNABE & Hubert ROLLAND
+//  Module : VISU
+
+#include "VisuGUI_GaussPointsDlg.h"
+
+#include "VISUConfig.hh"
+
+#include "VisuGUI_Tools.h"
+
+#include "VISU_GaussPoints_i.hh"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_Convertor.hxx"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_Module.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SVTK_FontWidget.h"
+
+#include <qlayout.h>
+#include <qtabwidget.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qfiledialog.h>
+#include <qvalidator.h>
+#include <qcolordialog.h>
+
+using namespace std;
+
+VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent, bool SetPref):
+  QVBox(parent)
+{
+  myVerX = 0.01;  myVerY = 0.10;  myVerW = 0.10;  myVerH = 0.80;
+  myHorX = 0.20;  myHorY = 0.01;  myHorW = 0.60;  myHorH = 0.12;
+  Imin = 0.0; Imax = 0.0;
+  myRangeMode = -1;
+
+  setSpacing(6);
+  //setMargin(11);
+
+  // Active bar ========================================================
+  QGroupBox* ActiveBarGroup = new QGroupBox (tr("ACTIVE_BAR_GRP"), this, "ActiveBarGroup");
+  ActiveBarGroup->setColumnLayout(0, Qt::Vertical );
+  ActiveBarGroup->layout()->setSpacing( 0 );
+  ActiveBarGroup->layout()->setMargin( 0 );
+  QGridLayout* ActiveBarGroupLayout = new QGridLayout( ActiveBarGroup->layout() );
+  ActiveBarGroupLayout->setAlignment( Qt::AlignTop );
+  ActiveBarGroupLayout->setSpacing( 6 );
+  ActiveBarGroupLayout->setMargin( 11 );
+
+  QButtonGroup* BarTypeGroup = new QButtonGroup( 2, Qt::Vertical, ActiveBarGroup, "BarTypeGroup" );
+  BarTypeGroup->setRadioButtonExclusive( true );
+  BarTypeGroup->setFrameStyle( QFrame::NoFrame );
+  BarTypeGroup->layout()->setMargin( 0 );
+
+  myRBLocal = new QRadioButton( tr( "LOCAL" ), BarTypeGroup );
+  myRBGlobal = new QRadioButton( tr( "GLOBAL" ), BarTypeGroup );
+
+  myCBDisplayed = new QCheckBox( tr( "DISPLAYED" ), ActiveBarGroup );
+
+  ActiveBarGroupLayout->addMultiCellWidget( BarTypeGroup, 0, 1, 0, 0 );
+  ActiveBarGroupLayout->addWidget( myCBDisplayed, 1, 1 );
+
+  // Range ============================================================
+  RangeGroup = new QButtonGroup (tr("SCALAR_RANGE_GRP"), this, "RangeGroup");
+  RangeGroup->setColumnLayout(0, Qt::Vertical );
+  RangeGroup->layout()->setSpacing( 0 );
+  RangeGroup->layout()->setMargin( 0 );
+  QGridLayout* RangeGroupLayout = new QGridLayout( RangeGroup->layout() );
+  RangeGroupLayout->setAlignment( Qt::AlignTop );
+  RangeGroupLayout->setSpacing( 6 );
+  RangeGroupLayout->setMargin( 11 );
+
+  myModeLbl = new QLabel("Scalar Mode", RangeGroup);
+
+  myModeCombo = new QComboBox(RangeGroup);
+
+  RangeGroupLayout->addWidget( myModeLbl, 0, 0 );
+  RangeGroupLayout->addWidget( myModeCombo, 0, 1 );
+
+  //TopLayout->addWidget( RangeGroup );
+
+  // Colors and Labels ========================================================
+  QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this, "ColLabGroup");
+  ColLabGroup->setColumnLayout(0, Qt::Vertical );
+  ColLabGroup->layout()->setSpacing( 0 );
+  ColLabGroup->layout()->setMargin( 0 );
+  QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup->layout() );
+  ColLabGroupLayout->setAlignment( Qt::AlignTop );
+  ColLabGroupLayout->setSpacing( 6 );
+  ColLabGroupLayout->setMargin( 11 );
+
+  QButtonGroup* TypeGroup = new QButtonGroup( 2, Qt::Vertical, ColLabGroup, "TypeGroup" );
+  TypeGroup->setRadioButtonExclusive( true );
+  TypeGroup->setFrameStyle( QFrame::NoFrame );
+  TypeGroup->layout()->setMargin( 0 );
+
+  BicolorButton = new QRadioButton( tr( "BICOLOR" ), TypeGroup );
+  RainbowButton = new QRadioButton( tr( "RAINBOW" ), TypeGroup );
+
+  ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup, "ColorLabel");
+  ColorSpin = new QSpinBox( 2, 256, 1, ColLabGroup );
+  ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  ColorSpin->setMinimumWidth( 70 );
+  ColorSpin->setValue( 64 );
+
+  LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup, "LabelLabel");
+  LabelSpin = new QSpinBox( 2, 65, 1, ColLabGroup );
+  LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  LabelSpin->setMinimumWidth( 70 );
+  LabelSpin->setValue( 5 );
+
+  ColLabGroupLayout->addMultiCellWidget( TypeGroup, 0, 1, 0, 0);
+  ColLabGroupLayout->addWidget( ColorLabel, 1, 1);
+  ColLabGroupLayout->addWidget( ColorSpin,  1, 2);
+  ColLabGroupLayout->addWidget( LabelLabel, 1, 3);
+  ColLabGroupLayout->addWidget( LabelSpin,  1, 4);
+
+  //TopLayout->addWidget( ColLabGroup );
+
+  // Orientation ==========================================================
+  QButtonGroup* OrientGroup = new QButtonGroup (tr("ORIENTATION_GRP"), this, "OrientGroup");
+  OrientGroup->setColumnLayout(0, Qt::Vertical );
+  OrientGroup->layout()->setSpacing( 0 );
+  OrientGroup->layout()->setMargin( 0 );
+  QGridLayout* OrientGroupLayout = new QGridLayout( OrientGroup->layout() );
+  OrientGroupLayout->setAlignment( Qt::AlignTop );
+  OrientGroupLayout->setSpacing( 6 );
+  OrientGroupLayout->setMargin( 11 );
+
+  RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGroup, "RBvert");
+  RBvert->setChecked( true );
+  RBhori = new QRadioButton (tr("HORIZONTAL_BTN"), OrientGroup, "RBhori");
+  OrientGroupLayout->addWidget( RBvert, 0, 0 );
+  OrientGroupLayout->addWidget( RBhori, 0, 1 );
+
+  //  TopLayout->addWidget( OrientGroup );
+
+  // Origin ===============================================================
+  QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this, "OriginGroup");
+  OriginGroup->setColumnLayout(0, Qt::Vertical );
+  OriginGroup->layout()->setSpacing( 0 );
+  OriginGroup->layout()->setMargin( 0 );
+  QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
+  OriginGroupLayout->setAlignment( Qt::AlignTop );
+  OriginGroupLayout->setSpacing( 6 );
+  OriginGroupLayout->setMargin( 11 );
+
+  QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup, "XLabel");
+  XSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+  XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  XSpin->setMinimumWidth( 70 );
+  XSpin->setValue( 0.01 );
+
+  QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup, "YLabel");
+  YSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, OriginGroup );
+  YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  YSpin->setMinimumWidth( 70 );
+  YSpin->setValue( 0.01 );
+
+  OriginGroupLayout->addWidget( XLabel, 0, 0);
+  OriginGroupLayout->addWidget( XSpin,  0, 1);
+  OriginGroupLayout->addWidget( YLabel, 0, 2);
+  OriginGroupLayout->addWidget( YSpin,  0, 3);
+
+  //TopLayout->addWidget( OriginGroup );
+
+  // Dimensions =========================================================
+  QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this, "DimGroup");
+  DimGroup->setColumnLayout(0, Qt::Vertical );
+  DimGroup->layout()->setSpacing( 0 );
+  DimGroup->layout()->setMargin( 0 );
+  QGridLayout* DimGroupLayout = new QGridLayout( DimGroup->layout() );
+  DimGroupLayout->setAlignment( Qt::AlignTop );
+  DimGroupLayout->setSpacing( 6 );
+  DimGroupLayout->setMargin( 11 );
+
+  QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup, "WidthLabel");
+  WidthSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+  WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  WidthSpin->setMinimumWidth( 70 );
+  WidthSpin->setValue( 0.1 );
+
+  QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup, "HeightLabel");
+  HeightSpin = new QtxDblSpinBox( 0.0, 1.0, 0.1, DimGroup );
+  HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  HeightSpin->setMinimumWidth( 70 );
+  HeightSpin->setValue( 0.8 );
+
+  QLabel* SpacingLabel = new QLabel (tr("LBL_SPACING"), DimGroup, "SpacingLabel");
+  SpacingSpin = new QtxDblSpinBox( 0.0, 1.0, 0.01, DimGroup );
+  SpacingSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  SpacingSpin->setMinimumWidth( 70 );
+  SpacingSpin->setValue( 0.01 );
+
+  DimGroupLayout->addWidget( WidthLabel, 0, 0);
+  DimGroupLayout->addWidget( WidthSpin,  0, 1);
+  DimGroupLayout->addWidget( HeightLabel, 0, 2);
+  DimGroupLayout->addWidget( HeightSpin,  0, 3);
+  DimGroupLayout->addWidget( SpacingLabel, 0, 4);
+  DimGroupLayout->addWidget( SpacingSpin,  0, 5);
+
+  //TopLayout->addWidget( DimGroup );
+
+  // Save check box ===========================================================
+  QHBox* aSaveBox = new QHBox(this);
+  if (!SetPref) {
+    CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), aSaveBox, "CBSave");
+    //TopLayout->addWidget(CBSave);
+  }
+  else {
+    CBSave = 0;
+  }
+  myTextBtn = new QPushButton("Text properties...", aSaveBox);
+  myTextDlg = new VisuGUI_TextPrefDlg(this);
+  myTextDlg->setTitleVisible(!SetPref);
+
+  // signals and slots connections ===========================================
+  connect( myRBLocal,     SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setEnabled( bool ) ) );
+  connect( myRBGlobal,    SIGNAL( toggled( bool ) ), myCBDisplayed, SLOT( setChecked( bool ) ) );
+  connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorLabel, SLOT( setEnabled( bool ) ) );
+  connect( RainbowButton, SIGNAL( toggled( bool ) ), ColorSpin, SLOT( setEnabled( bool ) ) );
+  connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelLabel, SLOT( setEnabled( bool ) ) );
+  connect( RainbowButton, SIGNAL( toggled( bool ) ), LabelSpin, SLOT( setEnabled( bool ) ) );
+  connect( OrientGroup,   SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
+  connect( XSpin,         SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+  connect( YSpin,         SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
+  connect( myTextBtn,     SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
+
+  changeDefaults( 0 );
+  myIsStoreTextProp = false;
+}
+
+/**
+ * Initialise dialog box from presentation object
+ */
+void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) {
+  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
+  setPosAndSize( thePrs->GetPosX(),
+                thePrs->GetPosY(),
+                thePrs->GetWidth(),
+                thePrs->GetHeight(),
+                thePrs->GetBarOrientation());
+
+  SpacingSpin->setValue(thePrs->GetSpacing());
+
+  bool activeLocal = thePrs->GetIsActiveLocalScalarBar();
+  myRBLocal->setChecked( activeLocal );
+  myRBGlobal->setChecked( !activeLocal );
+  myCBDisplayed->setEnabled( activeLocal );
+  myCBDisplayed->setChecked( thePrs->GetIsDispGlobalScalarBar() );
+
+  bool bicolor = thePrs->GetGaussPointsPL()->GetBicolor();
+  BicolorButton->setChecked( bicolor );
+  RainbowButton->setChecked( !bicolor );
+  ColorLabel->setEnabled( !bicolor );
+  ColorSpin->setEnabled( !bicolor );
+  LabelLabel->setEnabled( !bicolor );
+  LabelSpin->setEnabled( !bicolor );
+
+  setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
+
+  // Update myModeCombo
+  int aNbComp = thePrs->GetField()->myNbComp;
+  bool isScalarMode = (aNbComp > 1);
+  myModeCombo->clear();
+  myModeCombo->insertItem("<Modulus>");
+  const VISU::PField& aField = thePrs->GetField();
+  const VISU::TNames& aCompNames = aField->myCompNames;
+  const VISU::TNames& aUnitNames = aField->myUnitNames;
+  for(int i = 0; i < aNbComp; i++){
+    QString aComponent = QString(aCompNames[i]).simplifyWhiteSpace();
+    if(aComponent.isNull() || aComponent == "")
+      aComponent = "Component " + QString::number(i+1);
+    else
+      aComponent = "[" + QString::number(i+1) + "] " + aComponent;
+
+    QString anUnit = QString(aUnitNames[i]).simplifyWhiteSpace();
+    if(anUnit.isNull() || anUnit == "")
+      anUnit = "-";
+    
+    aComponent = aComponent + ", " + anUnit;
+
+    myModeCombo->insertItem(aComponent);
+  }
+  //
+  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
+  if (aNbComp==1){
+    myModeCombo->setCurrentItem(1);
+  }
+  //
+  myModeLbl->setEnabled(isScalarMode);
+  myModeCombo->setEnabled(isScalarMode);
+
+  // "Title"
+  myTextDlg->setTitleText(QString(thePrs->GetTitle()));
+
+  float R, G, B;
+  thePrs->GetTitleColor(&R, &G, &B);
+
+  myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+                                  thePrs->GetTitFontType(),
+                                  thePrs->IsBoldTitle(),
+                                  thePrs->IsItalicTitle(),
+                                  thePrs->IsShadowTitle());
+
+  // "Labels"
+  thePrs->GetLabelColor(&R, &G, &B);
+
+  myTextDlg->myLabelFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
+                                  thePrs->GetLblFontType(),
+                                  thePrs->IsBoldLabel(),
+                                  thePrs->IsItalicLabel(),
+                                  thePrs->IsShadowLabel());
+}
+
+/**
+ * Store values to presentation object
+ */
+int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) {
+  thePrs->SetScalarMode(myModeCombo->currentItem());
+  thePrs->SetPosition(XSpin->value(), YSpin->value());
+  thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
+  thePrs->SetSpacing(SpacingSpin->value());
+  thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+  thePrs->SetIsActiveLocalScalarBar(myRBLocal->isChecked());
+  thePrs->SetIsDispGlobalScalarBar(myCBDisplayed->isChecked());
+  thePrs->SetNbColors(ColorSpin->value());
+  thePrs->SetLabels(LabelSpin->value());
+
+  thePrs->GetGaussPointsPL()->SetBicolor(BicolorButton->isChecked());
+
+  //if (isToSave()) storeToResources();
+
+  if (myIsStoreTextProp) {
+    // "Title"
+    thePrs->SetTitle(myTextDlg->getTitleText().latin1());
+
+    QColor aTitColor (255, 255, 255);
+    int aTitleFontFamily = VTK_ARIAL;
+    bool isTitleBold = false;
+    bool isTitleItalic = false;
+    bool isTitleShadow = false;
+
+    myTextDlg->myTitleFont->GetData(aTitColor, aTitleFontFamily,
+                                    isTitleBold, isTitleItalic, isTitleShadow);
+
+    thePrs->SetBoldTitle(isTitleBold);
+    thePrs->SetItalicTitle(isTitleItalic);
+    thePrs->SetShadowTitle(isTitleShadow);
+    thePrs->SetTitFontType(aTitleFontFamily);
+    thePrs->SetTitleColor(aTitColor.red()/255.,
+                         aTitColor.green()/255.,
+                         aTitColor.blue()/255.);
+
+    // "Label"
+    QColor aLblColor (255, 255, 255);
+    int aLabelFontFamily = VTK_ARIAL;
+    bool isLabelBold = false;
+    bool isLabelItalic = false;
+    bool isLabelShadow = false;
+
+    myTextDlg->myLabelFont->GetData(aLblColor, aLabelFontFamily,
+                                    isLabelBold, isLabelItalic, isLabelShadow);
+
+    thePrs->SetBoldLabel(isLabelBold);
+    thePrs->SetItalicLabel(isLabelItalic);
+    thePrs->SetShadowLabel(isLabelShadow);
+    thePrs->SetLblFontType(aLabelFontFamily);
+    thePrs->SetLabelColor(aLblColor.red()/255.,
+                         aLblColor.green()/255.,
+                         aLblColor.blue()/255.);
+  }
+
+  return 1;
+}
+
+/*!
+  Called when orientation is changed
+*/
+void VisuGUI_GaussScalarBarPane::changeDefaults( int )
+{
+  if ( RBvert->isChecked() ) {
+    XSpin->setValue( myVerX );
+    YSpin->setValue( myVerY );
+    WidthSpin->setValue( myVerW );
+    HeightSpin->setValue( myVerH );
+  }
+  else {
+    XSpin->setValue( myHorX );
+    YSpin->setValue( myHorY );
+    WidthSpin->setValue( myHorW );
+    HeightSpin->setValue( myHorH );
+  }
+}
+
+/*!
+  Called when X,Y position is changed
+*/
+void VisuGUI_GaussScalarBarPane::XYChanged( double )
+{
+  QtxDblSpinBox* snd = (QtxDblSpinBox*)sender();
+  if ( snd == XSpin ) {
+    WidthSpin->setMaxValue( 1.0 - XSpin->value() );
+  }
+  if ( snd == YSpin ) {
+    HeightSpin->setMaxValue( 1.0 - YSpin->value() );
+  }
+}
+
+/*!
+  Sets size and position
+*/
+void VisuGUI_GaussScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
+{
+  if ( vert ) {
+    myVerX = x;
+    myVerY = y;
+    myVerW = w;
+    myVerH = h;
+    RBvert->setChecked( true );
+  }
+  else {
+    myHorX = x;
+    myHorY = y;
+    myHorW = w;
+    myHorH = h;
+    RBhori->setChecked( true );
+  }
+  changeDefaults( 0 );
+}
+
+/*!
+  Sets colors and labels number
+*/
+void VisuGUI_GaussScalarBarPane::setScalarBarData( int colors, int labels )
+{
+  ColorSpin->setValue( colors );
+  LabelSpin->setValue( labels );
+}
+
+/*!
+  Gets orientation
+*/
+int  VisuGUI_GaussScalarBarPane::getOrientation()
+{
+  if (RBvert->isChecked() )
+    return  1;
+  else
+    return 0;
+}
+
+
+void VisuGUI_GaussScalarBarPane::onTextPref()
+{
+  myIsStoreTextProp = myTextDlg->exec();
+}
+
+
+/*!
+ * Constructor
+ */
+VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool SetPref):
+  QDialog(VISU::GetDesktop(theModule), 
+         "VisuGUI_GaussPointsDlg", true,
+         WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+  setName("VisuGUI_ScalarBarDlg");
+  setCaption(SetPref ? tr("DLG_PREF_TITLE") : tr("DLG_PROP_TITLE"));
+  setSizeGripEnabled(TRUE);
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  QVBoxLayout* TopLayout = new QVBoxLayout(this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+
+  // Presentation
+  QButtonGroup* PrsGroup = new QButtonGroup( 2, Qt::Horizontal, tr( "PRS_TITLE" ), this, "PrimitiveTypeGroup" );
+  PrsGroup->setRadioButtonExclusive( true );
+  PrsGroup->layout()->setMargin( 11 );
+  PrsGroup->layout()->setSpacing(6);
+
+  myResultsButton = new QRadioButton( tr( "RESULTS" ), PrsGroup );
+  myGeometryButton = new QRadioButton( tr( "GEOMETRY" ), PrsGroup );
+
+  QTabWidget* aTabBox = new QTabWidget (this);
+
+  // Gauss points pane
+  QVBox* aBox = new QVBox (this);
+  aBox->setMargin(11);
+  aBox->setSpacing(6);
+
+  // Primitive
+  QGroupBox* PrimitiveGroup = new QGroupBox ( tr( "PRIMITIVE_TITLE" ), aBox, "PrimitiveGroup" );
+  PrimitiveGroup->setColumnLayout(0, Qt::Vertical );
+  PrimitiveGroup->layout()->setSpacing( 0 );
+  PrimitiveGroup->layout()->setMargin( 0 );
+
+  QGridLayout* PrimitiveGroupLayout = new QGridLayout (PrimitiveGroup->layout());
+  PrimitiveGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  PrimitiveGroupLayout->setSpacing(6);
+  PrimitiveGroupLayout->setMargin(11);
+
+  // Primitive Type
+  QButtonGroup* aPrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, PrimitiveGroup, "PrimitiveTypeGroup" );
+  aPrimitiveTypeGroup->setRadioButtonExclusive( true );
+  aPrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame );
+  aPrimitiveTypeGroup->layout()->setMargin( 0 );
+
+  QRadioButton* aPointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), aPrimitiveTypeGroup );
+  aPointSpriteButton->setChecked( true );
+
+  QRadioButton* anOpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), aPrimitiveTypeGroup );
+  anOpenGLPointButton->setEnabled( false );
+
+  QRadioButton* aGeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), aPrimitiveTypeGroup );
+  aGeometricalSphereButton->setEnabled( false );
+
+  PrimitiveGroupLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 );
+
+  // Clamp
+  QLabel* aClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup );
+  myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup );
+  myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  PrimitiveGroupLayout->addWidget( aClampLabel, 1, 0 );
+  PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 );
+
+  // Main Texture
+  QLabel* aMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), PrimitiveGroup );
+  myMainTextureLineEdit = new QLineEdit( PrimitiveGroup );
+  QPushButton* aMainTextureButton = new QPushButton( PrimitiveGroup );
+  aMainTextureButton->setAutoDefault( false );
+  aMainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
+  connect( aMainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) );
+
+  PrimitiveGroupLayout->addWidget( aMainTextureLabel, 2, 0 );
+  PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 );
+  PrimitiveGroupLayout->addWidget( aMainTextureButton, 2, 2 );
+
+  // Alpha Texture
+  QLabel* aAlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), PrimitiveGroup );
+  myAlphaTextureLineEdit = new QLineEdit( PrimitiveGroup );
+  QPushButton* aAlphaTextureButton = new QPushButton( PrimitiveGroup );
+  aAlphaTextureButton->setAutoDefault( false );
+  aAlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
+  connect( aAlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) );
+
+  PrimitiveGroupLayout->addWidget( aAlphaTextureLabel, 3, 0 );
+  PrimitiveGroupLayout->addWidget( myAlphaTextureLineEdit, 3, 1 );
+  PrimitiveGroupLayout->addWidget( aAlphaTextureButton, 3, 2 );
+
+  // Alpha Threshold
+  QLabel* aAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup );
+  myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup );
+  myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  PrimitiveGroupLayout->addWidget( aAlphaThresholdLabel, 4, 0 );
+  PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 );
+
+  // Size
+  QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), aBox, "SizeGroup" );
+  SizeGroup->setColumnLayout(0, Qt::Vertical );
+  SizeGroup->layout()->setSpacing( 0 );
+  SizeGroup->layout()->setMargin( 0 );
+
+  QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout());
+  SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  SizeGroupLayout->setSpacing(6);
+  SizeGroupLayout->setMargin(11);
+
+  // Geometry Size
+  mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup );
+  mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+  mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  SizeGroupLayout->addWidget( mySizeLabel, 0, 0 );
+  SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 );
+
+  // Min Size
+  myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup );
+  myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+  myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 );
+  SizeGroupLayout->addWidget( myMinSizeSpinBox, 1, 1 );
+
+  // Max Size
+  myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup );
+  myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+  myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 );
+  SizeGroupLayout->addWidget( myMaxSizeSpinBox, 1, 3 );
+
+  // Magnification
+  QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup );
+  myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup );
+  myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  SizeGroupLayout->addWidget( aMagnificationLabel, 2, 0 );
+  SizeGroupLayout->addWidget( myMagnificationSpinBox, 2, 1 );
+
+  // Increment
+  QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup );
+  myIncrementSpinBox = new QtxDblSpinBox( 0.01, 10, 0.1, SizeGroup );
+  myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  SizeGroupLayout->addWidget( aIncrementLabel, 2, 2 );
+  SizeGroupLayout->addWidget( myIncrementSpinBox, 2, 3 );
+
+
+  // Color
+  myColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), aBox, "ColorGroup" );
+  myColorGroup->setColumnLayout(0, Qt::Vertical );
+  myColorGroup->layout()->setSpacing( 0 );
+  myColorGroup->layout()->setMargin( 0 );
+
+  QGridLayout* ColorGroupLayout = new QGridLayout (myColorGroup->layout());
+  ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+  ColorGroupLayout->setSpacing(6);
+  ColorGroupLayout->setMargin(11);
+
+  QLabel* ColorLabel = new QLabel( tr( "COLOR" ), myColorGroup );
+  myColorButton = new QPushButton( myColorGroup );
+
+  ColorGroupLayout->addWidget( ColorLabel, 0, 0 );
+  ColorGroupLayout->addWidget( myColorButton, 0, 1 );
+
+  connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) );
+
+  connect( myGeometryButton, SIGNAL( toggled( bool ) ), myColorGroup,     SLOT( setEnabled( bool ) ) );
+  connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeLabel,      SLOT( setEnabled( bool ) ) );
+  connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeSpinBox,    SLOT( setEnabled( bool ) ) );
+  connect( myResultsButton,  SIGNAL( toggled( bool ) ), myMinSizeLabel,   SLOT( setEnabled( bool ) ) );
+  connect( myResultsButton,  SIGNAL( toggled( bool ) ), myMinSizeSpinBox, SLOT( setEnabled( bool ) ) );
+  connect( myResultsButton,  SIGNAL( toggled( bool ) ), myMaxSizeLabel,   SLOT( setEnabled( bool ) ) );
+  connect( myResultsButton,  SIGNAL( toggled( bool ) ), myMaxSizeSpinBox, SLOT( setEnabled( bool ) ) );
+
+  myScalarPane = new VisuGUI_GaussScalarBarPane(this, SetPref);
+  myScalarPane->setMargin(5);
+
+
+  aTabBox->addTab(aBox, tr("GAUSS_POINTS_TAB"));
+  aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+
+  // Common buttons ===========================================================
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+  buttonOk->setAutoDefault( TRUE );
+  buttonOk->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+  buttonCancel->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+  TopLayout->addWidget( PrsGroup );
+  TopLayout->addWidget( aTabBox );
+  TopLayout->addWidget( GroupButtons );
+
+  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
+  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs )
+{
+  bool isResults = thePrs->GetIsColored();
+  myResultsButton->setChecked( isResults );
+  myGeometryButton->setChecked( !isResults );
+
+  myColorGroup->setEnabled( !isResults );
+  mySizeLabel->setEnabled( !isResults );
+  mySizeSpinBox->setEnabled( !isResults );
+  myMinSizeLabel->setEnabled( isResults );
+  myMinSizeSpinBox->setEnabled( isResults );
+  myMaxSizeLabel->setEnabled( isResults );
+  myMaxSizeSpinBox->setEnabled( isResults );
+
+  myColorButton->setPaletteBackgroundColor( thePrs->GetColor() );
+
+  myClampSpinBox->setMaxValue( thePrs->GetMaximumSupportedSize() );
+  myClampSpinBox->setValue( thePrs->GetClamp() );
+
+  mySizeSpinBox->setValue( thePrs->GetConstSize() );
+  myMinSizeSpinBox->setValue( thePrs->GetMinSize() );
+  myMaxSizeSpinBox->setValue( thePrs->GetMaxSize() );
+
+  myMagnificationSpinBox->setValue( thePrs->GetMagnification() );
+  myIncrementSpinBox->setValue( thePrs->GetMagnificationIncrement() );
+
+  myMainTextureLineEdit->setText( thePrs->GetMainTexture().section( '/', -1 ) );
+  myAlphaTextureLineEdit->setText( thePrs->GetAlphaTexture().section( '/', -1 ) );
+  myAlphaThresholdSpinBox->setValue( thePrs->GetAlphaThreshold() );
+
+  myScalarPane->initFromPrsObject(thePrs);
+}
+
+int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs )
+{
+  thePrs->SetClamp( myClampSpinBox->value() );
+
+  bool isResults = myResultsButton->isChecked();
+  if( isResults )
+  {
+    thePrs->SetIsColored( true );
+    thePrs->SetMinSize( myMinSizeSpinBox->value() );
+    thePrs->SetMaxSize( myMaxSizeSpinBox->value() );
+  }
+  else
+  {
+    thePrs->SetIsColored( false );
+    thePrs->SetColor( myColorButton->paletteBackgroundColor() );
+    thePrs->SetConstSize( mySizeSpinBox->value() );
+  }
+
+  thePrs->SetMagnification( myMagnificationSpinBox->value() );
+  thePrs->SetMagnificationIncrement( myIncrementSpinBox->value() );
+
+  myMainTexture = myMainTexture.isNull() ? thePrs->GetMainTexture() : myMainTexture;
+  myAlphaTexture = myAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : myAlphaTexture;
+  thePrs->SetTextures( myMainTexture, myAlphaTexture );
+
+  thePrs->SetAlphaThreshold( myAlphaThresholdSpinBox->value() );
+
+  return myScalarPane->storeToPrsObject(thePrs);
+}
+
+void VisuGUI_GaussPointsDlg::accept()
+{
+  //if( myScalarPane->check() )
+  QDialog::accept();
+}
+
+void VisuGUI_GaussPointsDlg::onBrowseMainTexture()
+{
+  QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
+  QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this );
+
+  if( aFileName.isNull() )
+    return;
+
+  myMainTexture = aFileName;
+  myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) );
+}
+
+void VisuGUI_GaussPointsDlg::onBrowseAlphaTexture()
+{
+  QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
+  QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this );
+
+  if( aFileName.isNull() )
+    return;
+
+  myAlphaTexture = aFileName;
+  myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) );
+}
+
+void VisuGUI_GaussPointsDlg::onColorButtonPressed()
+{
+  QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this );
+  if( aColor.isValid() )
+    myColorButton->setPaletteBackgroundColor( aColor );
+}
diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h
new file mode 100644 (file)
index 0000000..772367b
--- /dev/null
@@ -0,0 +1,166 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_MagnitudeDlg.h
+//  Author : Laurent CORNABE & Hubert ROLLAND
+//  Module : VISU
+//  $Header$
+
+#ifndef VISUGUI_GAUSSPOINTSDLS_H
+#define VISUGUI_GAUSSPOINTSDLS_H
+
+#include "VisuGUI_ScalarBarDlg.h"
+
+#include <qvbox.h>
+#include <qdialog.h>
+#include <qgroupbox.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qtoolbutton.h>
+
+class SalomeApp_Module;
+class VisuGUI_TextPrefDlg;
+
+namespace VISU
+{
+  class GaussPoints_i;
+}
+
+class VisuGUI_GaussScalarBarPane : public QVBox
+{
+  Q_OBJECT
+
+ public:
+  VisuGUI_GaussScalarBarPane(QWidget* parent, bool SetPref);
+  ~VisuGUI_GaussScalarBarPane() {};
+
+  int     getOrientation();
+  void    setPosAndSize( double x, double y, double w, double h, bool vert );
+  double  getX() {return XSpin->value();}
+  double  getY() {return YSpin->value();}
+  double  getWidth() {return WidthSpin->value();}
+  double  getHeight() {return HeightSpin->value();}
+  void    setScalarBarData( int colors, int labels );
+  int     getNbColors() {return ColorSpin->value();}
+  int     getNbLabels() {return LabelSpin->value();}
+  bool    isToSave() {return CBSave ? CBSave->isChecked() : false;}
+
+  void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
+  int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
+
+ protected:
+  QButtonGroup*   RangeGroup;
+
+  QRadioButton*   RBhori;
+  QRadioButton*   RBvert;
+
+  QtxDblSpinBox*  XSpin;
+  QtxDblSpinBox*  YSpin;
+
+  QtxDblSpinBox*  WidthSpin;
+  QtxDblSpinBox*  HeightSpin;
+  QtxDblSpinBox*  SpacingSpin;
+
+  QRadioButton*   BicolorButton;
+  QRadioButton*   RainbowButton;
+  QLabel*         ColorLabel;
+  QSpinBox*       ColorSpin;
+  QLabel*         LabelLabel;
+  QSpinBox*       LabelSpin;
+
+  QCheckBox*      CBSave;
+  QLabel*         myModeLbl;
+  QComboBox*      myModeCombo;
+  QPushButton*    myTextBtn;
+  VisuGUI_TextPrefDlg* myTextDlg;
+  QRadioButton*   myRBLocal;
+  QRadioButton*   myRBGlobal;
+  QCheckBox*      myCBDisplayed;
+
+  double          Imin,   Imax;
+  double          myHorX, myHorY, myHorW, myHorH;
+  double          myVerX, myVerY, myVerW, myVerH;
+  int             myRangeMode;
+  bool myIsStoreTextProp;
+
+ private slots:
+  void changeDefaults( int );
+  void changeRange( int );
+  void XYChanged( double );
+  void onTextPref();
+};
+
+class VisuGUI_GaussPointsDlg : public QDialog
+{
+    Q_OBJECT
+
+public:
+    VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE);
+    ~VisuGUI_GaussPointsDlg() {};
+
+  void    initFromPrsObject(VISU::GaussPoints_i* thePrs);
+  int     storeToPrsObject(VISU::GaussPoints_i* thePrs);
+
+protected slots:
+  void    accept();
+
+  void    onBrowseMainTexture();
+  void    onBrowseAlphaTexture();
+  void    onColorButtonPressed();
+
+private:
+  VisuGUI_GaussScalarBarPane* myScalarPane;
+
+  QString                  myMainTexture;
+  QString                  myAlphaTexture;
+
+  QtxDblSpinBox*           myClampSpinBox;
+
+  QLineEdit*               myMainTextureLineEdit;
+  QLineEdit*               myAlphaTextureLineEdit;
+  QtxDblSpinBox*           myAlphaThresholdSpinBox;
+
+  QRadioButton*            myResultsButton;
+  QRadioButton*            myGeometryButton;
+
+  QLabel*                  mySizeLabel;
+  QtxDblSpinBox*           mySizeSpinBox;
+  QLabel*                  myMinSizeLabel;
+  QtxDblSpinBox*           myMinSizeSpinBox;
+  QLabel*                  myMaxSizeLabel;
+  QtxDblSpinBox*           myMaxSizeSpinBox;
+
+  QtxDblSpinBox*           myMagnificationSpinBox;
+  QtxDblSpinBox*           myIncrementSpinBox;
+
+  QGroupBox*               myColorGroup;
+  QPushButton*             myColorButton;
+};
+
+#endif // VISUGUI_GAUSSPOINTSDLS_H
diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx
new file mode 100644 (file)
index 0000000..b897498
--- /dev/null
@@ -0,0 +1,1133 @@
+
+//
+//  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   : VisuGUI_Module.cxx
+//  Author : Laurent CORNABE
+//  Module : VISU
+//  $Header$
+
+#include "VisuGUI_Module.h"
+
+#include "SUIT_Study.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Accel.h"
+#include "SUIT_Session.h"
+
+#include "CAM_Module.h"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_VTKSelector.h"
+#include "SalomeApp_Preferences.h"
+
+#include "VVTK_ViewManager.h"
+#include "VVTK_ViewWindow.h"
+#include "VVTK_ViewModel.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewManager.h"
+#include "SVTK_MainWindow.h"
+#include "VISU_Event.h"
+
+#include "VisuGUI_Prs3dTools.h"
+
+#include "VISU_GaussPoints_i.hh"
+#include "VisuGUI_GaussPointsDlg.h"
+
+#include "VISU_Gen_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_CutLines_i.hh"
+
+#include "VISU_Actor.h"
+#include "VisuGUI_Tools.h"
+#include "VisuGUI_ActionsDef.h"
+
+#include "VISU_ImplicitFunctionWidget.h"
+#include "SalomeApp_Study.h"
+#include "VVTK_MainWindow.h"
+#include "VISU_View_i.hh"
+
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
+#include <sstream>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+#define GAUSS_NEW_VIEWER         5100
+#define GAUSS_CREATE_PRS         5200
+#define GAUSS_EDIT_PRS           5300
+#define GAUSS_ERASE_PRS          5400
+#define GAUSS_DISPLAY_PRS        5500
+#define GAUSS_DISPLAY_ONLY_PRS   5600
+
+void
+CreateCurves( SalomeApp_Module* theModule,
+              VISU::CutLines_i* thePrs,
+              QDialog* theDlg,
+              const bool theCreate = true );
+
+using namespace VISU;
+
+namespace VISU
+{
+  //---------------------------------------------------------------
+  class Viewer
+  {
+    VVTK_ViewManager* myViewManager;
+    SalomeApp_VTKSelector* mySelector;
+  public:
+
+    Viewer(VisuGUI_Module* theModule, TViewerMap& theViewerMap)
+    {
+      SalomeApp_Application* anApp = theModule->getApp();
+      myViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
+      VVTK_Viewer* aViewer = (VVTK_Viewer*)myViewManager->getViewModel();
+      mySelector = new SalomeApp_VTKSelector( aViewer, anApp->selectionMgr() );
+      anApp->addViewManager( myViewManager );
+
+      theViewerMap.insert(TViewerMap::value_type(myViewManager,PViewer(this)));
+      QObject::connect( myViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
+                       theModule, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
+      
+      //aViewer->setBackgroundColor( Qt::darkGreen );
+      myViewManager->createViewWindow();
+    }
+    
+    VVTK_ViewManager* getViewManager() 
+    {
+      return myViewManager;
+    }
+
+    virtual
+    ~Viewer()
+    {
+    }
+  };
+
+
+  //---------------------------------------------------------------
+  typedef void (SUIT_ViewWindow::* TViewVisibility)();
+  void
+  SetViewVisibility(const TViewerMap& theViewerMap, 
+                   TViewVisibility theViewVisibility)
+  {
+    TViewerMap::const_iterator anIter = theViewerMap.begin();
+    for(; anIter != theViewerMap.end(); anIter++){
+      if(SUIT_ViewManager* aViewManager = anIter->first){
+       QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+       int aSize = aViews.size();
+       for(int anId = 0; anId < aSize; anId++){
+         if(SUIT_ViewWindow* aView = aViews[anId]){
+           (aView->* theViewVisibility)();
+         }
+       }
+      }
+    }
+  }
+
+}
+
+//---------------------------------------------------------------
+VisuGUI_Module
+::VisuGUI_Module() : 
+  VisuGUI()
+{
+}
+
+
+//---------------------------------------------------------------
+VisuGUI_Module
+::~VisuGUI_Module()
+{
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::initialize( CAM_Application* theApp )
+{
+  VisuGUI::initialize( theApp );
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  QPixmap aPixmap;
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
+  createAction( GAUSS_NEW_VIEWER, 
+               tr("MEN_GAUSS_NEW_VIEWER"), 
+               aPixmap,
+                tr("MEN_GAUSS_NEW_VIEWER"), 
+               tr("MEN_GAUSS_NEW_VIEWER"),
+               ALT+Key_S, 
+               this, 
+               false,
+                this, 
+               SLOT(onCreateViewManager()));
+  int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
+  int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
+  createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
+  
+  // Add actions to menus
+  createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
+  //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
+
+  QString aViewerType = VVTK_Viewer::Type();
+  SUIT_Accel* accel = getApp()->accel();
+  accel->setActionKey( SUIT_Accel::PanLeft, Key_Left, aViewerType );
+  accel->setActionKey( SUIT_Accel::PanRight, Key_Right, aViewerType );
+  accel->setActionKey( SUIT_Accel::PanUp, Key_Up, aViewerType );
+  accel->setActionKey( SUIT_Accel::PanDown, Key_Down, aViewerType );
+  accel->setActionKey( SUIT_Accel::ZoomIn, Key_PageUp, aViewerType );
+  accel->setActionKey( SUIT_Accel::ZoomOut, Key_PageDown, aViewerType );
+  accel->setActionKey( SUIT_Accel::RotateLeft, CTRL+Key_Left, aViewerType );
+  accel->setActionKey( SUIT_Accel::RotateRight, CTRL+Key_Right, aViewerType );
+  accel->setActionKey( SUIT_Accel::RotateUp, CTRL+Key_Up, aViewerType );
+  accel->setActionKey( SUIT_Accel::RotateDown, CTRL+Key_Down, aViewerType );
+  accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Key_Plus, aViewerType );
+  accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Key_Minus, aViewerType );
+
+  connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
+
+  // Prepare popup menus
+  QtxPopupMgr* mgr = popupMgr();
+  QString aRule;
+
+  aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_GAUSS_POINTS" ) );
+  createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), aPixmap,
+                tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
+                this, SLOT(OnCreateGaussPoints()));
+  mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
+  mgr->setRule( action( GAUSS_CREATE_PRS ), 
+               "client='ObjectBrowser' and selcount=1 "
+               "and type='VISU::TTIMESTAMP' "
+               "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
+               "and $medSource in {'eImportFile' 'eCopyAndImportFile'} ",
+               true );
+
+  createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
+  createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
+
+  createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(),
+                VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
+                this, SLOT(OnEditGaussPoints()));
+  mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
+  mgr->setRule( action( GAUSS_EDIT_PRS ), 
+               "selcount=1 and type='VISU::TGAUSSPOINTS'", 
+               true );
+
+  aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
+
+  createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(),
+                VisuGUI::tr("MEN_ERASE"), "", 0, this, false,
+                this, SLOT(OnErasePrs()));
+  mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
+  mgr->setRule( action( GAUSS_ERASE_PRS ), 
+               aRule + " and (isVisible=true)", true );
+
+  createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(),
+                VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false,
+                this, SLOT(OnDisplayPrs()));
+  mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
+  mgr->setRule( action( GAUSS_DISPLAY_PRS ), 
+               aRule + " and (isVisible=false)", true );
+
+  createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(),
+                VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
+                this, SLOT(OnDisplayOnlyPrs()));
+  mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
+  mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), 
+               aRule, true );
+
+  mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "selcount=1 and $type in {'VISU::TVIEW3D' VISU::TGAUSSVIEW}", true );
+  mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), "$client in {'VTKViewer' 'SVTK'} and selcount=0", true );
+  aRule = "selcount=1 and "
+    "((type='VISU::TVIEW3D' and activeView='VTKViewer') or "
+    "(type='VISU::TGAUSSVIEW' and activeView='VVTK'))";
+  mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), aRule, true );
+}
+
+//---------------------------------------------------------------
+bool
+VisuGUI_Module
+::activateModule( SUIT_Study* theStudy )
+{
+  VisuGUI::activateModule( theStudy );
+
+  SetViewVisibility(myViewerMap,&SUIT_ViewWindow::show);
+
+  return true;
+}
+
+
+//---------------------------------------------------------------
+bool
+VisuGUI_Module
+::deactivateModule( SUIT_Study* theStudy )
+{
+  VisuGUI::deactivateModule( theStudy );
+
+  SetViewVisibility(myViewerMap,&SUIT_ViewWindow::hide);
+
+  return true;
+}
+
+
+//---------------------------------------------------------------
+SUIT_ViewManager*
+VisuGUI_Module
+::onCreateViewManager()
+{
+  Viewer* aViewer = new Viewer( this, myViewerMap );
+  return aViewer->getViewManager();
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::onLastViewClosed(SUIT_ViewManager* theViewManager)
+{
+  myViewerMap.erase(theViewManager);
+}
+
+
+//---------------------------------------------------------------
+void 
+VisuGUI_Module
+::createPreferences()
+{
+  VisuGUI::createPreferences();
+
+  createGaussPointsPreferences();
+  createScalarBarPreferences();
+  createOutsideCursorPreferences();
+  createPickingPreferences();
+  createSpaceMousePreferences();
+}
+
+
+//---------------------------------------------------------------
+void 
+VisuGUI_Module
+::createGaussPointsPreferences()
+{
+  int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
+  int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
+  setPreferenceProperty( primitiveGr, "columns", 1 );
+
+  int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
+                                SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" );
+  setPreferenceProperty( clampPref, "min", 1 );
+  setPreferenceProperty( clampPref, "max", 512 );
+
+  addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "point_sprite_main_texture" );
+
+  addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
+
+  int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
+                                         SalomeApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" );
+  setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
+  setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
+  setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
+
+  int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
+  setPreferenceProperty( sizeGr, "columns", 2 );
+
+  int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
+                                  SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" );
+  setPreferenceProperty( minSizePref, "min", 1 );
+  setPreferenceProperty( minSizePref, "max", 100 );
+
+  int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
+                                  SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" );
+  setPreferenceProperty( maxSizePref, "min", 1 );
+  setPreferenceProperty( maxSizePref, "max", 100 );
+
+  int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
+                                        SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" );
+  setPreferenceProperty( magnificationPref, "min", 10 );
+  setPreferenceProperty( magnificationPref, "max", 1000 );
+
+  int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr,
+                                    SalomeApp_Preferences::DblSpin, "VISU", "point_sprite_increment" );
+  setPreferenceProperty( incrementPref, "min", 0.01 );
+  setPreferenceProperty( incrementPref, "max", 10 );
+  setPreferenceProperty( incrementPref, "step", 0.1 );
+
+  int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
+  setPreferenceProperty( geomGr, "columns", 1 );
+
+  int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
+                               SalomeApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
+  setPreferenceProperty( sizePref, "min", 1 );
+  setPreferenceProperty( sizePref, "max", 100 );
+
+  addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
+                SalomeApp_Preferences::Color, "VISU", "point_sprite_color" );
+}
+
+
+//---------------------------------------------------------------
+void 
+VisuGUI_Module
+::createScalarBarPreferences()
+{
+  int scalarBarTab = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_TAB_TTL" ) );
+  int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), scalarBarTab );
+  setPreferenceProperty( scalarBarGr, "columns", 1 );
+
+  int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
+                                    SalomeApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
+
+  QStringList values;
+  values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
+  values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
+  QValueList<QVariant> indices;
+  indices.append( 0 );
+  indices.append( 1 );
+  setPreferenceProperty( activeBarPref, "strings", values );
+  setPreferenceProperty( activeBarPref, "indexes", indices );
+
+  addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
+                SalomeApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
+
+  int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
+                                SalomeApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
+
+  values.clear();
+  values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
+  values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
+  indices.clear();
+  indices.append( 0 );
+  indices.append( 1 );
+  setPreferenceProperty( colorPref, "strings", values );
+  setPreferenceProperty( colorPref, "indexes", indices );
+
+  int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
+                                    SalomeApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
+  setPreferenceProperty( spacingPref, "min", 0.01 );
+  setPreferenceProperty( spacingPref, "max", 1.0 );
+  setPreferenceProperty( spacingPref, "step", 0.01 );
+
+}
+
+
+//---------------------------------------------------------------
+void 
+VisuGUI_Module
+::createOutsideCursorPreferences()
+{
+  int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
+
+  int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab );
+  setPreferenceProperty( primitiveGr, "columns", 1 );
+
+  int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
+                                SalomeApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" );
+  setPreferenceProperty( clampPref, "min", 1 );
+  setPreferenceProperty( clampPref, "max", 512 );
+
+  addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
+
+  addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
+                SalomeApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
+
+  int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
+                                         SalomeApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" );  setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
+  setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
+  setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
+
+  int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab );
+
+  int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr,
+                               SalomeApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" );
+  setPreferenceProperty( sizePref, "min", 1 );
+  setPreferenceProperty( sizePref, "max", 100 );
+
+  int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
+
+  addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
+                SalomeApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
+}
+
+
+//---------------------------------------------------------------
+void 
+VisuGUI_Module
+::createPickingPreferences()
+{
+  int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
+
+  int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
+  int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
+                                        SalomeApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
+  setPreferenceProperty( pyramidHeightPref, "min", 1 );
+  setPreferenceProperty( pyramidHeightPref, "max", 100 );
+
+  int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
+  setPreferenceProperty( infoWindowGr, "columns", 1 );
+
+  int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
+                                       SalomeApp_Preferences::IntSpin, "VISU", "picking_transparency" );
+  setPreferenceProperty( transparencyPref, "min", 0 );
+  setPreferenceProperty( transparencyPref, "max", 100 );
+  setPreferenceProperty( transparencyPref, "step", 10 );
+
+  int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
+                                    SalomeApp_Preferences::Selector, "VISU", "picking_position" );
+  QStringList values;
+  values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
+  values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
+  QValueList<QVariant> indices;
+  indices.append( 0 );
+  indices.append( 1 );
+  setPreferenceProperty( positionPref, "strings", values );
+  setPreferenceProperty( positionPref, "indexes", indices );
+
+  int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
+  setPreferenceProperty( cameraGr, "columns", 1 );
+
+  int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
+                                     SalomeApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
+  setPreferenceProperty( zoomFactorPref, "min", 0.1 );
+  setPreferenceProperty( zoomFactorPref, "max", 10.0 );
+  setPreferenceProperty( zoomFactorPref, "step", 0.1 );
+
+  int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr,
+                                     SalomeApp_Preferences::IntSpin, "VISU", "picking_step_number" );
+  setPreferenceProperty( stepNumberPref, "min", 1 );
+  setPreferenceProperty( stepNumberPref, "max", 100 );
+
+  int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
+  setPreferenceProperty( parentMeshGr, "columns", 1 );
+
+  addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
+                SalomeApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
+}
+
+
+//---------------------------------------------------------------
+void 
+VisuGUI_Module
+::createSpaceMousePreferences()
+{
+  int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
+
+  int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
+  int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, SalomeApp_Preferences::Selector, "VISU", "mouse_behaviour" );
+  QStringList values;
+  values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
+  values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
+  QValueList<QVariant> indices;
+  indices.append( 0 );
+  indices.append( 1 );
+  setPreferenceProperty( mousePref, "strings", values );
+  setPreferenceProperty( mousePref, "indexes", indices );
+
+  int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
+  int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, SalomeApp_Preferences::IntSpin, "VISU", "speed_increment" );
+  setPreferenceProperty( keybrdPref,  "max",  1000  );
+
+  int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
+  setPreferenceProperty( spacemouseGr, "columns", 1 );
+  int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment
+  int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func2_btn" ); //increase_speed_increment
+  int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
+  int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func4_btn" ); //increase_gauss_point_magnification
+  int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr, SalomeApp_Preferences::Selector, "VISU", "spacemouse_func5_btn" ); //dominant_combined_switch
+  values.clear();
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
+  values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
+  indices.clear();
+  indices.append( 1 );
+  indices.append( 2 );
+  indices.append( 3 );
+  indices.append( 4 );
+  indices.append( 5 );
+  indices.append( 6 );
+  indices.append( 7 );
+  indices.append( 8 );
+  indices.append( 9 ); // == button_*
+  indices.append( 10 );
+  indices.append( 11 );
+  setPreferenceProperty( spacemousePref1, "strings", values );
+  setPreferenceProperty( spacemousePref1, "indexes", indices );
+  setPreferenceProperty( spacemousePref2, "strings", values );
+  setPreferenceProperty( spacemousePref2, "indexes", indices );
+  setPreferenceProperty( spacemousePref3, "strings", values );
+  setPreferenceProperty( spacemousePref3, "indexes", indices );
+  setPreferenceProperty( spacemousePref4, "strings", values );
+  setPreferenceProperty( spacemousePref4, "indexes", indices );
+  setPreferenceProperty( spacemousePref5, "strings", values );
+  setPreferenceProperty( spacemousePref5, "indexes", indices );
+
+  int cameraGr = addPreference( tr( "VISU_CAMERA_PREF_GROUP_TTL" ), mouseTab );
+  int cameraPref = addPreference( tr( "VISU_CAMERA_MOVE_PREF" ), cameraGr, SalomeApp_Preferences::IntSpin, "VISU", "camera_movement_steps" );
+  setPreferenceProperty( cameraPref,  "max",  1000  );
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::OnCreateGaussPoints()
+{
+  CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_GaussPointsDlg,1>(this,true);
+}
+
+void
+VisuGUI_Module
+::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
+{
+  QString type = viewMgr->getViewModel()->getType();
+  if ( type == VVTK_Viewer::Type() ) 
+    connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
+}
+
+void
+VisuGUI_Module
+::OnViewCreated(SUIT_ViewWindow* view)
+{
+  SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
+  if ( viewWindow ) {
+    setProperty( viewWindow, "speed_increment" );
+    setProperty( viewWindow, "spacemouse_func1_btn" );
+    setProperty( viewWindow, "spacemouse_func2_btn" );
+    setProperty( viewWindow, "spacemouse_func3_btn" );
+    setProperty( viewWindow, "spacemouse_func4_btn" );
+    setProperty( viewWindow, "spacemouse_func5_btn" );
+  }
+}
+
+void
+VisuGUI_Module
+::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
+{
+  if ( !viewWindow )
+    return;
+
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
+  int val;
+  if ( pref == "speed_increment" ) {
+    val = resMgr->integerValue( "VISU", pref, 10 );
+    aMainWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
+  }
+  else if ( pref == "spacemouse_func1_btn" ) {
+    val = resMgr->integerValue( "VISU", pref, 1 );
+    aMainWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
+  }
+  else if ( pref == "spacemouse_func2_btn" ) {
+    val = resMgr->integerValue( "VISU", pref, 2 );
+    aMainWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
+  }
+  else if ( pref == "spacemouse_func3_btn" ) {
+    val = resMgr->integerValue( "VISU", pref, 10 );
+    aMainWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
+  }
+  else if ( pref == "spacemouse_func4_btn" ) {
+    val = resMgr->integerValue( "VISU", pref, 11 );
+    aMainWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
+  }
+  else if ( pref == "spacemouse_func5_btn" ) {
+    val = resMgr->integerValue( "VISU", pref, 9 );
+    aMainWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
+  }
+}
+
+void
+VisuGUI_Module
+::setProperty( SVTK_ViewManager* vm, const QString& prop )
+{
+  if ( !vm )
+    return;
+
+  QPtrVector<SUIT_ViewWindow> windows = vm->getViews();
+  for ( int n = windows.count(), i = 0; i < n; i++ )
+    setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
+}
+
+void
+VisuGUI_Module
+::preferencesChanged( const QString& group, const QString& pref )
+{
+  if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
+                           pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" || 
+                           pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
+
+    // update properties of VVTK view windows
+    SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
+    if ( vm ) 
+      setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
+  }
+}
+
+
+//---------------------------------------------------------------
+SUIT_ViewManager*
+VisuGUI_Module
+::getViewManager(const QString& theType, 
+                const bool theIsCreate)
+{
+  if(SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
+    return aViewManager;
+
+  if(theIsCreate && VVTK_Viewer::Type() == theType)
+    return onCreateViewManager();
+
+  return NULL;
+}
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::OnEditGaussPoints()
+{
+  Handle(SALOME_InteractiveObject) anIO;
+  if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
+    EditPrs3d<VISU::GaussPoints_i,VisuGUI_GaussPointsDlg,1>(this, aPrs3d);
+    if(SVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this,true)){
+      aViewWindow->highlight(anIO,1);
+    }
+  }
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::OnDisplayPrs()
+{
+  if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs");
+
+  QApplication::setOverrideCursor(Qt::waitCursor);
+
+  if(SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
+    SALOME_ListIO aList;
+    aSelectionMgr->selectedObjects(aList);
+    for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
+      Handle(SALOME_InteractiveObject) anIO = it.Value();
+      CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
+
+      // is it a Prs3d object ?
+      if(!CORBA::is_nil(anObject)){
+       if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
+         if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object");
+         if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
+           VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
+         else
+           VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
+         continue;
+       }
+      }
+
+      // is it Curve ?
+      if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in())){
+        if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Curve object");
+        PlotCurve( this, aCurve, VISU::eDisplay );
+        continue;
+      }
+
+      // is it Container ?
+      if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in())){
+        if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Container object");
+        PlotContainer( this, aContainer, VISU::eDisplay );
+        continue;
+      }
+
+      // is it Table ?
+      if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in())){
+        if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Table object");
+        PlotTable( this, aTable, VISU::eDisplay );
+        continue;
+      }
+    }
+  }
+
+  QApplication::restoreOverrideCursor();
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::OnEraseAll()
+{
+  if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
+    QString aType = aViewManager->getType();
+    if(aType == SVTK_Viewer::Type())
+      VISU::OnEraseAll<SVTK_Viewer>(this);
+    else if(aType == VVTK_Viewer::Type())
+      VISU::OnEraseAll<VVTK_Viewer>(this);
+    else if(aType == SPlot2d_Viewer::Type())
+      VISU::OnEraseAll<SPlot2d_Viewer>(this);
+  }
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::OnDisplayOnlyPrs()
+{
+  if(SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
+    SALOME_ListIO aList;
+    aSelectionMgr->selectedObjects(aList);
+    for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
+      Handle(SALOME_InteractiveObject) anIO = it.Value();
+      CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
+
+      if(!CORBA::is_nil(anObject)){
+       if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
+         if(aPrs3d->GetType() != VISU::TGAUSSPOINTS)
+           VISU::OnEraseAll<SVTK_Viewer>(this);
+         else
+           VISU::OnEraseAll<VVTK_Viewer>(this);
+         break;
+       }
+      }
+    }
+  }
+  OnDisplayPrs();
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module
+::OnErasePrs()
+{
+  QApplication::setOverrideCursor(Qt::waitCursor);
+
+  SALOME_ListIO aList;
+  SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+  aSelectionMgr->selectedObjects(aList);
+
+  for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
+    Handle(SALOME_InteractiveObject) anIO = it.Value();
+    CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this),anIO->getEntry());
+    if(!CORBA::is_nil(anObject)){
+      VISU::Base_var aBase = VISU::Base::_narrow(anObject);
+      if(!CORBA::is_nil(aBase)) 
+       VISU::ErasePrs(this,aBase,true);
+    }
+  }
+
+  QApplication::restoreOverrideCursor();
+}
+
+
+//---------------------------------------------------------------
+namespace
+{
+  void
+  GetViewParams(VVTK_MainWindow* theViewWindow,
+               const char* theSuffix,
+               std::ostringstream& theStr)
+  {
+    float aColor[3];
+    vtkRenderer* aRenderer = theViewWindow->getRenderer();
+    aRenderer->GetBackground(aColor);
+    Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".R",aColor[0]);
+    Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".G",aColor[1]);
+    Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".B",aColor[2]);
+      
+    double aPosition[3];
+    vtkCamera* aCamera = aRenderer->GetActiveCamera();
+    aCamera->GetPosition(aPosition);
+    Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[0]",aPosition[0]);
+    Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[1]",aPosition[1]);
+    Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[2]",aPosition[2]);
+
+    double aFocalPnt[3];
+    aCamera->GetFocalPoint(aFocalPnt);
+    Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[0]",aFocalPnt[0]);
+    Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[1]",aFocalPnt[1]);
+    Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[2]",aFocalPnt[2]);
+      
+    double aViewUp[3];
+    aCamera->GetViewUp(aViewUp);
+    Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[0]",aViewUp[0]);
+    Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[1]",aViewUp[1]);
+    Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[2]",aViewUp[2]);
+      
+    float aParallelScale = aCamera->GetParallelScale();
+    Storable::DataToStream(theStr,std::string("myParallelScale") + theSuffix,aParallelScale);
+      
+    double aScaleFactor[3];
+    theViewWindow->GetScale(aScaleFactor);
+    Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[0]",aScaleFactor[0]);
+    Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[1]",aScaleFactor[1]);
+    Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[2]",aScaleFactor[2]);
+  }
+
+  //---------------------------------------------------------------
+  void
+  SetViewParams(VVTK_MainWindow* theViewWindow,
+               const char* theSuffix,
+               const Storable::TRestoringMap& theMap)
+  {
+    float aColor[3];
+    aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
+    aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble();
+    aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble();
+    vtkRenderer* aRenderer = theViewWindow->getRenderer();
+    aRenderer->SetBackground(aColor);
+      
+    double aPosition[3];
+    aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble();
+    aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble();
+    aPosition[2] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[2]").toDouble();
+    vtkCamera* aCamera = aRenderer->GetActiveCamera();
+    aCamera->SetPosition(aPosition);
+
+    double aFocalPnt[3];
+    aFocalPnt[0] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[0]").toDouble();
+    aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble();
+    aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble();
+    aCamera->SetFocalPoint(aFocalPnt);
+      
+    double aViewUp[3];
+    aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble();
+    aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble();
+    aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble();
+    aCamera->SetViewUp(aViewUp);
+
+    float aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble();
+    aCamera->SetParallelScale(aParallelScale);
+      
+    double aScaleFactor[3];
+    aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble();
+    aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble();
+    aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
+    theViewWindow->SetScale(aScaleFactor);
+  }
+
+  //---------------------------------------------------------------
+  void
+  GetViewParams(VVTK_MainWindow1* theViewWindow,
+               std::ostringstream& theStr)
+  {
+    GetViewParams(theViewWindow,"1",theStr);
+
+    VISU_ImplicitFunctionWidget* aWidget = theViewWindow->GetImplicitFunctionWidget();
+    float anOrigin[3];
+    aWidget->GetOrigin(anOrigin);
+    Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]);
+    Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]);
+    Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]);
+
+    float aNormal[3];
+    aWidget->GetNormal(aNormal);
+    Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]);
+    Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]);
+    Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]);
+
+    float aDepth = aWidget->Distance();
+    Storable::DataToStream(theStr,"myCursorDepth",aDepth);
+  }
+
+  //---------------------------------------------------------------
+  void
+  SetViewParams(VVTK_MainWindow1* theViewWindow,
+               const Storable::TRestoringMap& theMap)
+  {
+    SetViewParams(theViewWindow,"1",theMap);
+
+    VISU_ImplicitFunctionWidget* aWidget = theViewWindow->GetImplicitFunctionWidget();
+    float anOrigin[3];
+    anOrigin[0] = Storable::FindValue(theMap,"myCursorOrigin[0]").toDouble();
+    anOrigin[1] = Storable::FindValue(theMap,"myCursorOrigin[1]").toDouble();
+    anOrigin[2] = Storable::FindValue(theMap,"myCursorOrigin[2]").toDouble();
+    aWidget->SetOrigin(anOrigin);
+
+    float aNormal[3];
+    aNormal[0] = Storable::FindValue(theMap,"myCursorNormal[0]").toDouble();
+    aNormal[1] = Storable::FindValue(theMap,"myCursorNormal[1]").toDouble();
+    aNormal[2] = Storable::FindValue(theMap,"myCursorNormal[2]").toDouble();
+    aWidget->SetNormal(aNormal);
+
+    float aDepth = Storable::FindValue(theMap,"myCursorDepth").toDouble();
+    aWidget->SetDistance(aDepth);
+  }
+
+
+  //---------------------------------------------------------------
+  void
+  GetViewParams(VVTK_MainWindow2* theViewWindow,
+               std::ostringstream& theStr)
+  {
+    GetViewParams(theViewWindow,"2",theStr);
+  }
+
+  void
+  SetViewParams(VVTK_MainWindow2* theViewWindow,
+               const Storable::TRestoringMap& theMap)
+  {
+    SetViewParams(theViewWindow,"2",theMap);
+  }
+
+
+  //---------------------------------------------------------------
+  std::string
+  GetViewParams(VVTK_ViewWindow* theViewWindow)
+  {
+    std::ostringstream aStream;
+
+    Storable::DataToStream(aStream,"myComment","GAUSSVIEW");
+    
+    GetViewParams(theViewWindow->getMainWindow1(),aStream);
+    GetViewParams(theViewWindow->getMainWindow2(),aStream);
+
+    return aStream.str();
+  }
+
+  //---------------------------------------------------------------
+  void
+  SetViewParams(VVTK_ViewWindow* theViewWindow,
+               const Storable::TRestoringMap& theMap)
+  {
+    SetViewParams(theViewWindow->getMainWindow1(),theMap);
+    SetViewParams(theViewWindow->getMainWindow2(),theMap);
+  }
+
+}
+
+void
+VisuGUI_Module::
+OnSaveViewParams()
+{
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  if (CheckLock(aCStudy))
+    return;
+
+  SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+
+  SALOME_ListIO aListIO;
+  aSelectionMgr->selectedObjects(aListIO);
+  if(aListIO.Extent() > 1)
+    return;
+
+  std::string aName;
+  if(aListIO.Extent() == 0){
+    aName = VISU::View3D_i::GenerateViewParamsName().latin1();
+  }else{
+    const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+    aName = anIO->getName();
+  }
+
+  SUIT_ViewManager* aViewManager = getApp()->activeViewManager();
+  if(aViewManager->getType() == SVTK_Viewer::Type())
+    VISU::View3D_i::SaveViewParams(aViewManager,aName.c_str());
+  else if(aViewManager->getType() == VVTK_Viewer::Type()){
+    SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
+    VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
+    std::string aValue = GetViewParams(aViewWindow);
+
+    SUIT_Study* aSStudy = aViewManager->study();
+    SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy);
+    _PTR(Study) aCStudy = aStudy->studyDS();
+    std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(aName,"VISU");
+    _PTR(GenericAttribute) anAttr;
+    int iEnd = aList.size();
+    for(int i = 0; i < iEnd; i++){
+      _PTR(SObject) anObj = aList[i];
+      std::string anEntry = anObj->GetID();
+      if(anObj->FindAttribute(anAttr,"AttributeComment")){
+       _PTR(AttributeComment) aCmnt (anAttr);
+       std::string aComm (aCmnt->Value());
+       if(aComm.compare(View3D_i::myComment) >= 0){
+         aCmnt->SetValue(aValue.c_str());
+         return;
+       }
+      }
+    }
+    
+    _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
+    std::string aSComponentEntry = aSComponent->GetID();
+    std::string anEntry = CreateAttributes(aCStudy, 
+                                          aSComponentEntry.c_str(), 
+                                          "", 
+                                          "", 
+                                           aName.c_str(),
+                                          "",
+                                          aValue.c_str());
+  }else
+    return;
+
+  UpdateObjBrowser(this);
+}
+
+
+//---------------------------------------------------------------
+void
+VisuGUI_Module::
+OnRestoreViewParams()
+{
+  SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+
+  SALOME_ListIO aListIO;
+  aSelectionMgr->selectedObjects(aListIO);
+  if(aListIO.Extent() > 1)
+    return;
+
+  const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
+  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+  _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
+  std::string aName = aSObj->GetName();
+
+  SUIT_ViewManager* aViewManager = getApp()->activeViewManager();
+  if(aViewManager->getType() == SVTK_Viewer::Type())
+    VISU::View3D_i::RestoreViewParams(aViewManager,aName.c_str());
+  else if(aViewManager->getType() == VVTK_Viewer::Type()){
+    _PTR(GenericAttribute) anAttr;
+    if(aSObj->FindAttribute(anAttr,"AttributeComment")){
+      _PTR(AttributeComment) aCmnt(anAttr);
+      QString aStream(aCmnt->Value().c_str());
+      Storable::TRestoringMap aMap;
+      Storable::StrToMap(aStream,aMap);
+      SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
+      VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
+      SetViewParams(aViewWindow,aMap);
+    }
+  }
+}
+
diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h
new file mode 100644 (file)
index 0000000..33a1ec0
--- /dev/null
@@ -0,0 +1,160 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_Module.h
+//  Author : 
+//  Module : VISU
+//  $Header$
+
+#ifndef VisuGUI_Module_HeaderFile
+#define VisuGUI_Module_HeaderFile
+
+#include "VisuGUI.h"
+#include "STD_Application.h"
+
+class SUIT_ViewManager;
+class SVTK_ViewManager;
+class SVTK_ViewWindow;
+
+#include "MED_SharedPtr.hxx"
+
+namespace VISU
+{
+  class Viewer;
+  typedef MED::SharedPtr<Viewer> PViewer;
+  
+  typedef std::map<SUIT_ViewManager*,PViewer> TViewerMap;
+}
+
+
+class VisuGUI_Module: public VisuGUI
+{
+  Q_OBJECT;
+
+  friend class VISU::Viewer;
+
+public:
+  VisuGUI_Module();
+
+  virtual
+  ~VisuGUI_Module();
+
+  virtual
+  void
+  initialize( CAM_Application* );
+
+  virtual 
+  void 
+  createPreferences();
+
+  virtual
+  void
+  preferencesChanged( const QString&, const QString& );
+
+  virtual
+  SUIT_ViewManager*
+  getViewManager(const QString& theType, 
+                const bool theIsCreate);
+
+public slots:
+  virtual 
+  bool
+  deactivateModule( SUIT_Study* );
+
+  virtual 
+  bool
+  activateModule( SUIT_Study* );
+
+protected:
+  virtual 
+  void 
+  createGaussPointsPreferences();
+
+  virtual 
+  void 
+  createScalarBarPreferences();
+
+  virtual 
+  void 
+  createOutsideCursorPreferences();
+
+  virtual 
+  void 
+  createPickingPreferences();
+
+  virtual 
+  void 
+  createSpaceMousePreferences();
+
+protected slots:
+  SUIT_ViewManager*
+  onCreateViewManager();
+
+  void
+  onLastViewClosed(SUIT_ViewManager*);
+
+  void
+  OnCreateGaussPoints();
+
+  void
+  OnViewCreated(SUIT_ViewWindow*);
+
+  void 
+  OnViewManagerAdded(SUIT_ViewManager*);
+
+  virtual
+  void
+  OnEditGaussPoints();
+
+  virtual 
+  void
+  OnDisplayPrs();
+
+  virtual 
+  void
+  OnDisplayOnlyPrs();
+
+  virtual
+  void
+  OnEraseAll();
+
+  virtual
+  void
+  OnErasePrs();
+
+  virtual
+  void
+  OnSaveViewParams();
+
+  virtual
+  void
+  OnRestoreViewParams();
+
+protected:
+  VISU::TViewerMap myViewerMap;
+
+  void setProperty( SVTK_ViewWindow*, const QString& );  // set a property (speed_increment, etc ) for SVTK ViewWindow
+  void setProperty( SVTK_ViewManager*, const QString& ); // set a property for SVTK ViewWindow // set only 1 property for all ViewWindows of given view manager
+};
+
+#endif
diff --git a/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx b/src/VISUGUI/VisuGUI_NonIsometricDlg.cxx
deleted file mode 100644 (file)
index beca47a..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-//  VISU VISUGUI : GUI of VISU component
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : SALOMEGUI_NonIsometricDlg.cxx
-//  Author : Vasily Rusyaev
-//  Module : VISU
-//  $Header$
-
-#include "VisuGUI_NonIsometricDlg.h"
-
-#include "VisuGUI_Tools.h"
-
-#include "VISU_Actor.h"
-#include "VISU_PipeLine.hxx"
-
-#include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
-
-#include "SVTK_ViewWindow.h"
-#include "SVTK_RenderWindowInteractor.h"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-#include "SUIT_ViewWindow.h"
-
-#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOME_ListIO.hxx"
-
-#include "QtxDblSpinBox.h"
-
-#include "utilities.h"
-
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-
-using namespace std;
-
-/*!
-  Constructor
-*/
-VisuGUI_NonIsometricDlg::VisuGUI_NonIsometricDlg (QWidget* parent, const char* name, bool modal, WFlags fl)
-    : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
-{
-  if (!name)
-    setName("NonIsometricDlg");
-  setCaption(tr("DLG_TITLE"));
-  setSizeGripEnabled(TRUE);
-
-  SVTK_ViewWindow* aViewWnd = VISU::GetViewWindow();
-
-  // Create layout for this dialog
-  QGridLayout* layoutDlg = new QGridLayout (this);
-  layoutDlg->setSpacing(6);
-  layoutDlg->setMargin(11);
-
-  // Create croup box with grid layout
-  QGroupBox* GroupBox = new QGroupBox(this, "GroupBox");
-  QGridLayout* glGroupBox = new QGridLayout(GroupBox);
-  glGroupBox->setMargin(11);
-  glGroupBox->setSpacing(6);
-
-  // "X" scaling
-  QLabel* TextLabelX = new QLabel (tr("LBL_X"), GroupBox, "TextLabelX");
-  m_sbXcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
-  m_sbXcoeff->setMinimumWidth(80);
-  m_sbXcoeff->setValue(1.0);
-
-  // "Y" scaling
-  QLabel* TextLabelY = new QLabel (tr("LBL_Y"), GroupBox, "TextLabelY");
-  m_sbYcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
-  m_sbYcoeff->setMinimumWidth(80);
-  m_sbYcoeff->setValue(1.0);
-
-  // "Z" scaling
-  QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), GroupBox, "TextLabelZ");
-  m_sbZcoeff = new QtxDblSpinBox(-DBL_MAX, DBL_MAX, 0.1, GroupBox);
-  m_sbZcoeff->setMinimumWidth(80);
-  m_sbZcoeff->setValue(1.0);
-
-  // Get initial values from the current VTK viewer
-  if (aViewWnd) {
-    double aScaleFactor[3];
-    aViewWnd->GetScale(aScaleFactor);
-    m_sbXcoeff -> setValue(aScaleFactor[0]);
-    m_sbYcoeff -> setValue(aScaleFactor[1]);
-    m_sbZcoeff -> setValue(aScaleFactor[2]);
-  }
-
-  // Create <Reset> button
-  m_bReset = new QPushButton(tr("&Reset"), GroupBox, "m_bReset");
-
-  // Layout widgets in the group box
-  glGroupBox->addWidget(TextLabelX, 0, 0);
-  glGroupBox->addWidget(m_sbXcoeff, 0, 1);
-  glGroupBox->addWidget(TextLabelY, 0, 2);
-  glGroupBox->addWidget(m_sbYcoeff, 0, 3);
-  glGroupBox->addWidget(TextLabelZ, 0, 4);
-  glGroupBox->addWidget(m_sbZcoeff, 0, 5);
-  glGroupBox->addWidget(m_bReset,   0, 6);
-
-  // OK, CANCEL, Apply button
-  QGroupBox* aWgt = new QGroupBox(this);
-  QHBoxLayout* aHBoxLayout = new QHBoxLayout(aWgt);
-  aHBoxLayout->setMargin(11);
-  aHBoxLayout->setSpacing(6);
-  // Create <OK> button
-  QPushButton* m_bOk = new QPushButton(tr("O&K"), aWgt, "m_bOk");
-  m_bOk->setDefault(TRUE);
-  m_bOk->setAutoDefault(TRUE);
-  // Create <Apply> button
-  QPushButton* m_bApply = new QPushButton(tr("&Apply"), aWgt, "m_bApply");
-  m_bApply->setAutoDefault(TRUE);
-  // Create <Cancel> button
-  QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aWgt, "m_bCancel");
-  m_bCancel->setAutoDefault(TRUE);
-
-  // Layout buttons
-  aHBoxLayout->addWidget(m_bOk);
-  aHBoxLayout->addWidget(m_bApply);
-  aHBoxLayout->addStretch();
-  aHBoxLayout->addWidget(m_bCancel);
-
-  // Layout top level widgets
-  layoutDlg->addWidget(GroupBox,0,0);
-  layoutDlg->addWidget(aWgt,1,0);
-
-  // signals and slots connections
-  connect(m_bCancel, SIGNAL(clicked()), this, SLOT(reject()));
-  connect(m_bOk,     SIGNAL(clicked()), this, SLOT(onClickOk()));
-  connect(m_bApply,  SIGNAL(clicked()), this, SLOT(onClickApply()));
-  connect(m_bReset,  SIGNAL(clicked()), this, SLOT(onClickReset()));
-
-  this->resize(100, this->sizeHint().height());
-}
-
-/*
- *  Destroys the object and frees any allocated resources
- */
-VisuGUI_NonIsometricDlg::~VisuGUI_NonIsometricDlg()
-{
-  // no need to delete child widgets, Qt does it all for us
-}
-
-void VisuGUI_NonIsometricDlg::onClickOk()
-{
-  //apply changes
-  onClickApply();
-  //Close dialog
-  accept();
-}
-
-void VisuGUI_NonIsometricDlg::onClickApply()
-{
-  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
-    (SUIT_Session::session()->activeApplication());
-  SalomeApp_SelectionMgr* mgr = anApp->selectionMgr();
-
-  SVTK_ViewWindow* vf = VISU::GetViewWindow();
-  if (!vf)
-    return;
-
-  double aScale[3] = {m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value()};
-  vf->SetScale(aScale);
-
-  SALOME_ListIO selected;
-  mgr->selectedObjects(selected);
-  SALOME_ListIteratorOfListIO Itinit(selected);
-
-  if (vf)
-    for (; Itinit.More(); Itinit.Next()) {
-      vf->highlight(Itinit.Value(), true);
-    }
-}
-
-void VisuGUI_NonIsometricDlg::onClickReset()
-{
-  m_bReset->setFocus();
-  m_sbXcoeff->setValue(1.0);
-  m_sbYcoeff->setValue(1.0);
-  m_sbZcoeff->setValue(1.0);
-}
diff --git a/src/VISUGUI/VisuGUI_NonIsometricDlg.h b/src/VISUGUI/VisuGUI_NonIsometricDlg.h
deleted file mode 100644 (file)
index 739f87e..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//  VISU VISUGUI : GUI of VISU component
-//
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
-//
-//  File   : VisuGUI_NonIsometricDlg.h
-//  Author : Vasily Rusyaev
-//  Module : VISU
-//  $Header$
-
-#ifndef VisuGUI_NONISOMETRICDLG_H
-#define VisuGUI_NONISOMETRICDLG_H
-
-#include <qdialog.h>
-class QtxDblSpinBox;
-class QPushButton;
-
-class VisuGUI_NonIsometricDlg : public QDialog
-{
-  Q_OBJECT
-
-public:
-  VisuGUI_NonIsometricDlg (QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
-  ~VisuGUI_NonIsometricDlg();
-
-private:
-  QtxDblSpinBox* m_sbXcoeff;
-  QtxDblSpinBox* m_sbYcoeff;
-  QtxDblSpinBox* m_sbZcoeff;
-  QPushButton*   m_bReset  ;
-
-private slots:
-  void onClickApply();
-  void onClickReset();
-  void onClickOk();
-  void onFunctionChanged();
-};
-
-#endif // VisuGUI_NONISOMETRICDLG_H
index 73826c9682b25aa172326d9f8add8c8d906190b9..88bb64803256a7be57bbd2edfc97b3b7c771cd3d 100644 (file)
 //  Module : VISU
 
 #include "VisuGUI_PopupTools.h"
+#include "VisuGUI_ViewTools.h"
 #include "VisuGUI_Tools.h"
 
-#include "VISU_Actor.h"
-#include "VISU_ScalarMapAct.h"
+#include "VISU_Result_i.hh"
+#include "SalomeApp_Study.h"
 
 using namespace VISU;
 
@@ -43,15 +44,15 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const
   if ( !val.isValid() ) {
     if      ( p == "type"           ) val = QtxValue( type( ind ) );
     else if ( p == "nbComponents"   ) val = QtxValue( nbComponents( ind ) );
+    else if ( p == "medEntity"   ) val = QtxValue( medEntity( ind ) );
+    else if ( p == "medSource"   ) val = QtxValue( medSource( ind ) );
     else if ( p == "representation" ) val = QtxValue( representation( ind ) );
     else if ( p == "nbTimeStamps"   ) val = QtxValue( nbTimeStamps( ind ) );
     else if ( p == "nbChildren"     ) val = QtxValue( nbChildren( ind ) );
     else if ( p == "nbNamedChildren") val = QtxValue( nbNamedChildren( ind ) );
-//    else if ( p == "isVisible"      ) val = QtxValue( isVisible( ind ) );
+    else if ( p == "isVisible"      ) val = QtxValue( isVisible( ind ) );
     else if ( p == "isShrunk"       ) val = QtxValue( isShrunk( ind ) );
     else if ( p == "hasActor"       ) val = QtxValue( hasActor( ind ) );
-    else if ( p == "isShading"      ) val = QtxValue( isShading( ind ) );
-    else if ( p == "isScalarMapAct" ) val = QtxValue( isScalarMapAct( ind ) );
   }
 
   return val;
@@ -128,6 +129,56 @@ QString VisuGUI_Selection::nbComponents( const int ind ) const
   return aResStr;
 }
 
+QString VisuGUI_Selection::medEntity( const int ind ) const
+{
+  bool isExist;
+  VISU::Storable::TRestoringMap aMap;
+  GetSelectedObj( study(), entry( ind ), &aMap );  
+  const QString& aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist);
+  if ( isExist ) {
+    using namespace VISU;
+    TEntity anEntityId = TEntity(aVal.toInt());
+    switch(anEntityId){
+    case NODE_ENTITY :
+      return "NODE_ENTITY";
+    case EDGE_ENTITY :
+      return "EDGE_ENTITY";
+    case FACE_ENTITY :
+      return "FACE_ENTITY";
+    case CELL_ENTITY :
+      return "CELL_ENTITY";
+    default:
+      return QString();
+    }
+  }
+  return QString();
+}
+
+QString VisuGUI_Selection::medSource( const int ind ) const
+{
+  _PTR(Study) aStudyDS = study()->studyDS();
+  if(_PTR(SObject) aSObject = aStudyDS->FindObjectID(entry(ind))){
+    VISU::Result_var aRes;
+    if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){
+      using namespace VISU;
+      Result_i::ECreationId aCreationId = aResult->GetCreationId();
+      switch(aCreationId){
+      case Result_i::eImportFile :
+       return "eImportFile";
+      case Result_i::eCopyAndImportFile :
+       return "eCopyAndImportFile";
+      case Result_i::eImportMed :
+       return "eImportMed";
+      case Result_i::eImportMedField :
+       return "eImportMedField";
+      default:
+       return QString();
+      }      
+    }
+  }
+  return QString();
+}
+
 QString VisuGUI_Selection::nbTimeStamps( const int ind ) const
 {
   QString aResStr;
@@ -191,15 +242,47 @@ QString VisuGUI_Selection::nbNamedChildren( const int ind ) const
   return aResStr;
 }
 
-QString VisuGUI_Selection::isVisible( const int ind ) const
+namespace
 {
-  QString aResStr;
+  struct TIsVisibleFunctor
+  {
+    template<class TViewer>
+    QString
+    Get(VisuGUI* theModule, 
+       const QString& theEntry)
+    {
+      typedef typename TViewer::TViewWindow TViewWindow;
+      if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule))
+       if(VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1()))
+         return anActor->GetVisibility() ? "true" : "false";
 
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      aResStr = anVISUActor->GetVisibility() ? "1" : "0";
+      return QString();
+    }
+  };
 
-  return aResStr;
+  template<class TPopupFunctor>
+  struct TPopupDispatcher
+  {
+    QString
+    operator()(VisuGUI* theModule, 
+              const QString& theEntry)
+    {
+      if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){
+       QString aType = aViewManager->getType();
+       TPopupFunctor aFunctor;
+       if(aType == SVTK_Viewer::Type())
+         return aFunctor.template Get<SVTK_Viewer>(theModule,theEntry);
+       else if(aType == VVTK_Viewer::Type())
+         return aFunctor.template Get<VVTK_Viewer>(theModule,theEntry);
+      }
+      return QString();
+    }    
+  };
+}
+
+QString VisuGUI_Selection::isVisible( const int ind ) const
+{
+  return TPopupDispatcher<TIsVisibleFunctor>()((VisuGUI*)myModule,entry(ind));
 }
 
 QString VisuGUI_Selection::isShrunk( const int ind ) const
@@ -218,29 +301,3 @@ QString VisuGUI_Selection::hasActor( const int ind ) const
 {
   return representation( ind ).isEmpty() ? "0" : "1";
 }
-
-QString VisuGUI_Selection::isShading( const int ind ) const
-{
-  QString aResStr;
-  
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      if ( VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor) )
-       aResStr = anActor->IsShading() ? "1" : "0";
-  
-  return aResStr;      
-}
-
-QString VisuGUI_Selection::isScalarMapAct( const int ind ) const
-{
-  QString aResStr;
-
-  if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) )
-    if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) )
-      {
-       VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(anVISUActor);
-       aResStr = anActor ? "1" : "0";
-      }
-  
-  return aResStr;
-}
index 537dfafb3780e8f4fe1396242c8da7b92bef2e48..42b6a839874f557991b9ddc89c2e86edaed81eb9 100644 (file)
@@ -47,6 +47,8 @@ public:
 private:
   QString          type( const int ) const;
   QString          nbComponents( const int ) const;
+  QString          medEntity( const int ) const;
+  QString          medSource( const int ) const;
   QString          nbTimeStamps( const int ) const;
   QString          representation( const int ) const;
   QString          nbChildren( const int ) const;
@@ -54,8 +56,6 @@ private:
   QString          isVisible( const int ) const;
   QString          isShrunk( const int ) const;
   QString          hasActor( const int ) const;
-  QString          isShading( const int ) const;
-  QString          isScalarMapAct( const int ) const;
 
 private:
   int              nbChild( const int, const bool ) const;
index 10716c3680cff6de7637acd25ecefd3dfa42419f..4287a9abe700782ea7a9a88fd40ab29922cd495f 100644 (file)
 #ifndef VisuGUI_Prs3dTools_HeaderFile
 #define VisuGUI_Prs3dTools_HeaderFile
 
-#include "VisuGUI_Tools.h"
+#include "VISU_Gen_i.hh"
+#include "VisuGUI_ViewTools.h"
 #include "VisuGUI_DialogRunner.h"
 
-int runAndWait( QDialog* dlg, const bool modal )
-{
-  VisuGUI_DialogRunner r( dlg );
-  return r.run( modal );
-}
+#include <vtkRenderer.h>
 
 namespace VISU
 {
   class CutLines_i;
 
   //---------------------------------------------------------------
-  template<class TPrs3d_i, class TDlg, int IsDlgModal >
+  inline
+  int
+  runAndWait( QDialog* dlg, const bool modal )
+  {
+    VisuGUI_DialogRunner r( dlg );
+    return r.run( modal );
+  }
+
+  //---------------------------------------------------------------
+  template<class TPrs3d_i, class TViewer, class TDlg, int TIsDlgModal>
   void
-  EditPrs3d (SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs3d)
+  EditPrs3d(VisuGUI* theModule, 
+           VISU::Prs3d_i* thePrs3d)
   {
-    TPrs3d_i* aPrsObject = dynamic_cast<TPrs3d_i*>(thePrs3d);
-    if (aPrsObject) {
+    if(TPrs3d_i* aPrs3d = dynamic_cast<TPrs3d_i*>(thePrs3d)){
       TDlg* aDlg = new TDlg (theModule);
-      aDlg->initFromPrsObject(aPrsObject);
-      if (runAndWait(aDlg,IsDlgModal)) {
-       if (!(aDlg->storeToPrsObject(aPrsObject))) {
+      aDlg->initFromPrsObject(aPrs3d);
+      if (runAndWait(aDlg,TIsDlgModal)) {
+       if (!(aDlg->storeToPrsObject(aPrs3d))) {
          delete aDlg;
          return;
        }
-       RecreateActor(theModule, aPrsObject);
-       if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) {
-         vw->getRenderer()->ResetCameraClippingRange();
-         vw->Repaint();
+       aPrs3d->UpdateActors();
+       typedef typename TViewer::TViewWindow TViewWindow;
+       if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
+         aViewWindow->getRenderer()->ResetCameraClippingRange();
+         aViewWindow->Repaint();
        }
        // Optionally, create table and curves for cut lines
        QApplication::setOverrideCursor(Qt::waitCursor);
        CreateCurves( theModule,
-                     dynamic_cast<VISU::CutLines_i*>( aPrsObject ),
+                     dynamic_cast<VISU::CutLines_i*>( aPrs3d ),
                      aDlg,
                      false ); // in edition mode
        QApplication::restoreOverrideCursor();
@@ -73,11 +80,20 @@ namespace VISU
     }
   }
 
+  template<class TPrs3d_i, class TDlg, int TIsDlgModal>
+  inline
+  void
+  EditPrs3d(VisuGUI* theModule, 
+           VISU::Prs3d_i* thePrs3d)
+  {
+    EditPrs3d<TPrs3d_i,SVTK_Viewer,TDlg,TIsDlgModal>(theModule,thePrs3d);
+  }
 
   //---------------------------------------------------------------
   template<class TPrs3d_i>
+  inline
   TPrs3d_i*
-  CreatePrs3d(SalomeApp_Module* theModule,
+  CreatePrs3d(VisuGUI* theModule,
              _PTR(SObject) theTimeStamp,
              const char* theMeshName,
              VISU::Entity theEntity,
@@ -87,13 +103,12 @@ namespace VISU
     VISU::Result_var aResult;
     if (CheckResult(theModule,theTimeStamp,aResult)){
       QApplication::setOverrideCursor(Qt::waitCursor);
-      typedef typename TPrs3d_i::TInterface TPrs3d;
-      typename TPrs3d::_var_type aPrs3d =
-       GetVisuGen(theModule)->template Prs3dOnField<TPrs3d_i>
+      TPrs3d_i* aPrs3d =
+       GetVisuGen(theModule)->template CreatePrs3d<TPrs3d_i>
        (aResult,theMeshName,theEntity,theFieldName,theTimeId);
       QApplication::restoreOverrideCursor();
-      if (!CORBA::is_nil(aPrs3d.in()))
-       return dynamic_cast<TPrs3d_i*>(VISU::GetServant(aPrs3d.in()).in());
+      if(aPrs3d)
+       return aPrs3d;
     }
     SUIT_MessageBox::warn1(GetDesktop(theModule),
                           QObject::tr("WRN_VISU"),
@@ -104,18 +119,21 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  template<class TPrs3d_i, class TDlg, int IsDlgModal>
+  template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
+  inline
   bool
-  CreatePrs3d(SalomeApp_Module* theModule,
+  CreatePrs3d(VisuGUI* theModule,
              _PTR(SObject) theTimeStamp,
-             const Handle(SALOME_InteractiveObject)& theIO)
+             const Handle(SALOME_InteractiveObject)& theIO,
+             const bool theIsCreateView = false)
   {
-    using namespace VISU;
     Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp);
+
     bool isExist;
     QString aType = Storable::FindValue(aMap,"myType",&isExist);
     if(!isExist || aType.toInt() != TTIMESTAMP )
       return false;
+
     QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
     QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
     QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
@@ -154,37 +172,49 @@ namespace VISU
            }
        }
       }
-      PublishInView(theModule,aPrs3d);
+      PublishInView<TViewer>(theModule,aPrs3d,true,theIsCreateView);
+
       return true;
     }
+
     return false;
   }
   
   
   //---------------------------------------------------------------
-  template<class TPrs3d_i, class TDlg, int IsDlgModal>
+  template<class TPrs3d_i, class TViewer, class TDlg, int IsDlgModal>
+  inline
   void
-  CreatePrs3d(SalomeApp_Module* theModule)
+  CreatePrs3d(VisuGUI* theModule,
+             const bool theIsCreateView = true)
   {
     if (CheckLock(GetCStudy(GetAppStudy(theModule))))
       return;
     
     _PTR(SObject) aTimeStampSObj;
     Handle(SALOME_InteractiveObject) anIO;
-    if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
+    if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO))
       return;
     
-    if (!CreatePrs3d<TPrs3d_i,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO))
+    if(!CreatePrs3d<TPrs3d_i,TViewer,TDlg,IsDlgModal>(theModule,aTimeStampSObj,anIO,theIsCreateView))
       return;
     
     theModule->application()->putInfo(QObject::tr("INF_DONE"));
-    theModule->updateObjBrowser();
     UpdateObjBrowser(theModule);
     
-    if (SVTK_ViewWindow* aView = GetViewWindow(theModule))
+    typedef typename TViewer::TViewWindow TView;
+    if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView))
       aView->onFitAll();
   }
 
+  template<class TPrs3d_i, class TDlg, int IsDlgModal>
+  inline
+  void
+  CreatePrs3d(VisuGUI* theModule,
+             const bool theIsCreateView = true)
+  {
+    CreatePrs3d<TPrs3d_i,SVTK_Viewer,TDlg,IsDlgModal>(theModule,theIsCreateView);
+  }
 }
 
 #endif
index 3769e64653e1f63b4b501f04f9ddc1c9b87fcb7f..c55615ff0a9a94821e83b92fde4b2788334d5b46 100644 (file)
 
 #include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
-#include "VisuGUI_FontWg.h"
 
-#include "SVTK_ViewWindow.h"
+#include "SVTK_FontWidget.h"
 
 #include "VISUConfig.hh"
 #include "VISU_Convertor.hxx"
 
 #include "VISU_ScalarMapPL.hxx"
 #include "VISU_ScalarMap_i.hh"
-#include "VISU_ScalarMapAct.h"
 
 #include "SalomeApp_Application.h"
 
 #include <qvalidator.h>
 #include <qcolordialog.h>
 
-#include <vtkTextProperty.h>
-
 using namespace std;
 
 
 VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
-  QVBox(parent), myPreviewActor(0)
+  QVBox(parent)
 {
   myVerX = 0.01;  myVerY = 0.10;  myVerW = 0.10;  myVerH = 0.80;
   myHorX = 0.20;  myHorY = 0.01;  myHorW = 0.60;  myHorH = 0.12;
@@ -80,10 +76,6 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
   myModeLbl = new QLabel("Scalar Mode", RangeGroup);
 
   myModeCombo = new QComboBox(RangeGroup);
-  myModeCombo->insertItem("Modulus");
-  myModeCombo->insertItem("Component 1");
-  myModeCombo->insertItem("Component 2");
-  myModeCombo->insertItem("Component 3");
 
   CBLog = new QCheckBox (tr("LOGARITHMIC_SCALING"), RangeGroup);
   CBLog->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
@@ -238,30 +230,13 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref):
   myTextDlg = new VisuGUI_TextPrefDlg(this);
   myTextDlg->setTitleVisible(!SetPref);
 
-  QGroupBox* CheckGroup = new QGroupBox("", this, "CheckGroup");
-  CheckGroup->setColumnLayout(0, Qt::Vertical );
-  CheckGroup->layout()->setSpacing( 0 );
-  CheckGroup->layout()->setMargin( 0 );
-  QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup->layout() );
-  
-  myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
-  myPreviewCheck->setChecked(false);
-  CheckGroupLayout->addWidget(myPreviewCheck , 0, 0 );
-
   // signals and slots connections ===========================================
   connect( RangeGroup,   SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
   connect( OrientGroup,  SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
   connect( XSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
   connect( YSpin,        SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
   connect( myTextBtn,    SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
-  connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
-  connect( ColorSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
-  connect( LabelSpin,    SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
-  connect( WidthSpin,    SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
-  connect( HeightSpin,   SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
-  connect( MinEdit,      SIGNAL( textChanged( const QString& ) ), this, SLOT( updatePreview() ));
-  connect( MaxEdit,      SIGNAL( textChanged( const QString& ) ), this, SLOT( updatePreview() ));
-  connect( CBLog,        SIGNAL( toggled( bool ) ), this, SLOT( updatePreview() ));
+
   changeRange( 0 );
   changeDefaults( 0 );
   myIsStoreTextProp = false;
@@ -528,8 +503,6 @@ void VisuGUI_ScalarBarPane::storeToResources() {
  */
 void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
   initFromResources();
-  myScalarMap = thePrs;
-  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
   setPosAndSize( thePrs->GetPosX(),
                 thePrs->GetPosY(),
                 thePrs->GetWidth(),
@@ -548,7 +521,36 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
   setRange( thePrs->GetMin(), thePrs->GetMax(),
            /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
   setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
-  bool isScalarMode = (thePrs->GetField()->myNbComp > 1);
+
+  // Update myModeCombo
+  int aNbComp = thePrs->GetField()->myNbComp;
+  bool isScalarMode = (aNbComp > 1);
+  myModeCombo->clear();
+  myModeCombo->insertItem("<Modulus>");
+  const VISU::PField& aField = thePrs->GetField();
+  const VISU::TNames& aCompNames = aField->myCompNames;
+  const VISU::TNames& aUnitNames = aField->myUnitNames;
+  for(int i = 0; i < aNbComp; i++){
+    QString aComponent = QString(aCompNames[i]).simplifyWhiteSpace();
+    if(aComponent.isNull() || aComponent == "")
+      aComponent = "Component " + QString::number(i+1);
+    else
+      aComponent = "[" + QString::number(i+1) + "] " + aComponent;
+
+    QString anUnit = QString(aUnitNames[i]).simplifyWhiteSpace();
+    if(anUnit.isNull() || anUnit == "")
+      anUnit = "-";
+    
+    aComponent = aComponent + ", " + anUnit;
+
+    myModeCombo->insertItem(aComponent);
+  }
+  //
+  myModeCombo->setCurrentItem(thePrs->GetScalarMode());
+  if (aNbComp==1){
+    myModeCombo->setCurrentItem(1);
+  }
+  //
   myModeLbl->setEnabled(isScalarMode);
   myModeCombo->setEnabled(isScalarMode);
 
@@ -572,136 +574,8 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
                                   thePrs->IsBoldLabel(),
                                   thePrs->IsItalicLabel(),
                                   thePrs->IsShadowLabel());
-
-  // Draw Preview
-  if (myPreviewCheck->isChecked()) {
-    createScalarBar();
-    updatePreview();
-  }
-
 }
-/*! Slot update preview of scalar bar, if preview is checked
- */
-void VisuGUI_ScalarBarPane::updatePreview()
-{
-  if (myPreviewCheck->isChecked()) {
-    if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
-      deleteScalarBar();
-      createScalarBar();
-      vf->Repaint();
-    }
-  }
-}
-
-/*! Creating preview scalar bar
- */
-void VisuGUI_ScalarBarPane::createScalarBar()
-{
-  if (VISU::GetViewWindow() == NULL) return;
-  if (myPreviewActor != 0) return;
-  if (myScalarMap == NULL) return;
 
-  int sbCol,sbLab;
-  sbCol = getNbColors();
-  sbLab = getNbLabels();
-  if(sbCol < 2) sbCol=2;
-  if(sbCol > 64) sbCol=64;
-  if(sbLab < 2) sbLab=2;
-  if(sbLab > 65) sbLab=65;
-  myPreviewActor = VISU_ScalarMapAct::New();
-  VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
-  myPreviewActor->GetScalarBar()->VisibilityOn();
-  myPreviewActor->PickableOff();
-  
-  myScalarMap->SetScalarMode(myModeCombo->currentItem());
-  myScalarMap->SetPosition(getX(),getY());
-  myScalarMap->SetSize(getWidth(),getHeight());
-  myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
-  if(isLogarithmic())
-    myScalarMap->SetScaling(VISU::LOGARITHMIC);
-  else
-    myScalarMap->SetScaling(VISU::LINEAR);
-  if (RBFrange->isChecked()) {
-    myScalarMap->SetSourceRange();
-  } else {
-    myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
-  }
-  myScalarMap->SetNbColors(sbCol);
-  myScalarMap->SetLabels(sbLab); 
-  
-  myScalarMap->GetScalarMapPL()->SetNbColors(sbCol);
-  myScalarMap->GetScalarMapPL()->Update();
-    
-  aScalarBarActor->SetLookupTable(myScalarMap->GetScalarMapPL()->GetBarTable());
-  
-  if (myTextDlg->getTitleText().latin1() != "") 
-    aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
-  else
-    aScalarBarActor->SetTitle(myScalarMap->GetTitle());
-  aScalarBarActor->SetOrientation(getOrientation());
-  aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
-  aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
-  aScalarBarActor->SetWidth(getWidth());
-  aScalarBarActor->SetHeight(getHeight());
-  aScalarBarActor->SetNumberOfLabels(sbLab);
-  aScalarBarActor->SetMaximumNumberOfColors(sbCol);
-
-  // title text property
-  QColor aTitleColor;
-  int aTitleFontFamily;
-  bool isTitleBold;
-  bool isTitleItalic;
-  bool isTitleShadow;
-  myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
-                                 isTitleBold,isTitleItalic,isTitleShadow);
-  vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
-  aTitleProp->SetFontFamily(aTitleFontFamily);
-  aTitleProp->SetColor(float(aTitleColor.red())/255.,
-                      float(aTitleColor.green())/255.,
-                      float(aTitleColor.blue())/255.);
-  (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
-  (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
-  (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-  
-  // label text property
-  QColor aLabelColor;
-  int aLabelFontFamily;
-  bool isLabelBold;
-  bool isLabelItalic;
-  bool isLabelShadow;
-  myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
-                                 isLabelBold, isLabelItalic, isLabelShadow);
-  vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
-  aLabelProp->SetFontFamily(aLabelFontFamily);
-  aLabelProp->SetColor(float(aLabelColor.red())/255.,
-                      float(aLabelColor.green())/255.,
-                      float(aLabelColor.blue())/255.);
-  (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
-  (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
-  (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
-
-  aScalarBarActor->Modified();
-
-  VISU::GetViewWindow()->AddActor(myPreviewActor);
-}
-/*! Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deleteScalarBar()
-{
-  if (myPreviewActor == 0) return;
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){
-    vf->RemoveActor(myPreviewActor);
-    myPreviewActor->GetScalarBar()->VisibilityOff();
-  }
-  myPreviewActor->Delete();
-  myPreviewActor = 0;
-}
-/*! public: Deleting preview scalar bar
- */
-void VisuGUI_ScalarBarPane::deletePreview()
-{
-  deleteScalarBar();
-}
 /**
  * Store values to presentation object
  */
@@ -785,7 +659,6 @@ void VisuGUI_ScalarBarPane::changeDefaults( int )
     WidthSpin->setValue( myHorW );
     HeightSpin->setValue( myHorH );
   }
-  updatePreview();
 }
 
 /*!
@@ -823,7 +696,6 @@ void VisuGUI_ScalarBarPane::changeRange( int )
     MaxEdit->setText( QString::number( Imax ) );
   }
   myRangeMode = mode;
-  updatePreview();
 }
 
 /*!
@@ -838,7 +710,6 @@ void VisuGUI_ScalarBarPane::XYChanged( double )
   if ( snd == YSpin ) {
     HeightSpin->setMaxValue( 1.0 - YSpin->value() );
   }
-  updatePreview();
 }
 
 /*!
@@ -957,20 +828,8 @@ bool VisuGUI_ScalarBarPane::check()
 void VisuGUI_ScalarBarPane::onTextPref()
 {
   myIsStoreTextProp = myTextDlg->exec();
-  updatePreview();
 }
 
-void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview)
-{
-  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
-    if (thePreview) {
-      createScalarBar();
-    } else {
-      deleteScalarBar();
-    }
-    vf->Repaint();
-  }
-}
 
 //#######################################################################################
 
@@ -1023,19 +882,9 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se
 */
 void VisuGUI_ScalarBarDlg::accept()
 {
-  myScalarPane->deletePreview();
   if (myScalarPane->check()) QDialog::accept();
 }
 
-/*!
-  Called when <Cancel> button is clicked, remove preview and closes dialog
-*/
-void VisuGUI_ScalarBarDlg::reject()
-{
-  myScalarPane->deletePreview();
-  QDialog::reject();
-}
-
 
 //#######################################################################################
 VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
@@ -1058,7 +907,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   //   font
   QHBox* aHBox = new QHBox (aTitleGrp);
   aHBox->setSpacing(5);
-  myTitleFont = new VisuGUI_FontWg (aHBox);
+  myTitleFont = new SVTK_FontWidget (aHBox);
 
   TopLayout->addWidget(aTitleGrp);
 
@@ -1068,7 +917,7 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent)
   //   font
   aHBox = new QHBox (aLabelsGrp);
   aHBox->setSpacing(5);
-  myLabelFont = new VisuGUI_FontWg (aHBox);
+  myLabelFont = new SVTK_FontWidget (aHBox);
 
   TopLayout->addWidget(aLabelsGrp);
 
index 33c55f963a00f7f129da10b59560dd424e653b63..4695f47546d3321c9be8cf127c7d9dd3bd4a626d 100644 (file)
@@ -60,8 +60,7 @@ class QToolButton;
 
 class QtxDblSpinBox;
 class SalomeApp_Module;
-class VisuGUI_FontWg;
-class VISU_ScalarMapAct;
+class SVTK_FontWidget;
 
 class VisuGUI_TextPrefDlg: public QDialog
 {
@@ -78,8 +77,8 @@ class VisuGUI_TextPrefDlg: public QDialog
     { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); }
 
  public:
-  VisuGUI_FontWg* myTitleFont;
-  VisuGUI_FontWg* myLabelFont;
+  SVTK_FontWidget* myTitleFont;
+  SVTK_FontWidget* myLabelFont;
 
  private:
   QLineEdit* myTitleEdt;
@@ -118,7 +117,6 @@ class VisuGUI_ScalarBarPane : public QVBox
   int storeToPrsObject(VISU::ScalarMap_i* thePrs);
 
   bool check();
-  void deletePreview();
 
  protected:
   QButtonGroup*   RangeGroup;
@@ -157,16 +155,6 @@ class VisuGUI_ScalarBarPane : public QVBox
   void changeRange( int );
   void XYChanged( double );
   void onTextPref();
-  void onPreviewCheck(bool thePreview);
-  void updatePreview();
-
- private:
-  void createScalarBar();
-  void deleteScalarBar();
-
-  QCheckBox* myPreviewCheck;
-  VISU_ScalarMapAct* myPreviewActor;
-  VISU::ScalarMap_i* myScalarMap;
 };
 
 
@@ -188,7 +176,6 @@ class VisuGUI_ScalarBarDlg : public QDialog
 
  protected slots:
   void accept();
-  void reject();
 
  protected:
   VisuGUI_ScalarBarPane* myScalarPane;
index 433b64673207b693712e618506d3698e472d3397..0948023b459d92bb790f3b14a6d4b53536123988 100644 (file)
@@ -414,33 +414,34 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
       vtkPointData* aPntData = aDataSet->GetPointData();
 
       for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
-        int aID = aMapIndex(ind);
+        int anID = aMapIndex(ind);
 
         switch (aType) {
         case 0:
           {
-            float aCoord[3];
-            aDataSet->GetPoint(aID, aCoord);
+            float* aCoord = anVISUActor->GetNodeCoord(anID);
+           int aVTKID = anVISUActor->GetNodeVTKID(anID);
             myXValLbl->setText( QString::number( aCoord[0] ) );
             myYValLbl->setText( QString::number( aCoord[1] ) );
             myZValLbl->setText( QString::number( aCoord[2] ) );
-            myIDValLbl->setText( QString::number(aID) );
-            myScalarValLbl->setText(getValue(aPntData, aID));
-            myVectorValLbl->setText(getVector(aPntData, aID));
+            myIDValLbl->setText( QString::number(anID) );
+            myScalarValLbl->setText(getValue(aPntData, aVTKID));
+            myVectorValLbl->setText(getVector(aPntData, aVTKID));
           }
           break;
         case 1:
           {
-            vtkCellData* aData = aDataSet->GetCellData();
-            vtkCell* aCell = aDataSet->GetCell(aID);
+            vtkCellData* aCellData = aDataSet->GetCellData();
+            vtkCell* aCell = anVISUActor->GetElemCell(anID);
+           int aVTKID = anVISUActor->GetElemVTKID(anID);
             if (aCell != NULL) {
               int aNbOfPoints = aCell->GetNumberOfPoints();
-              if (aNbOfPoints <=1 ) { // Cell is point
+              if ( aNbOfPoints <= 1 ) { // Cell is point
                 clearFields();
               } else {
-                myCellIDValLbl->setText( QString::number(aID) );
-                myCellScalarValLbl->setText(getValue(aData, aID));
-                myCellVectorValLbl->setText(getVector(aData, aID));
+                myCellIDValLbl->setText( QString::number(anID) );
+                myCellScalarValLbl->setText(getValue(aCellData, aVTKID));
+                myCellVectorValLbl->setText(getVector(aCellData, aVTKID));
 
                 float* aCoord;
                 vtkIdList *aPointList = aCell->GetPointIds();
index 1e7ac208b9c7a19c1335ab84a1b70382482443ca..8ff2718a3da2a5307879a8a00f18c7dcc57329f2 100644 (file)
@@ -94,7 +94,7 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow)
     VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor);
     if (anVISUActor)
       if (anVISUActor->GetVisibility() != 0) {
-       VISU::Prs3d_i* aPrs = anVISUActor->GetParent()->GetPrs3d();
+       VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
        if (aPrs) {
          if (!myPrsMap.contains(aPrs)) {
            SALOMEDS::SObject_var aSObject = aPrs->GetSObject();
@@ -373,9 +373,9 @@ void ArrangeDlg::acceptViewWindow()
          aDist = fabs(aBounds[5] - aBounds[4]);
        }
        float aOffset[3];
-        aOffset[0] = aOffset[1] = aOffset[2] = 0;
-        aOffset[aAxis] =
-          (aBounds[2*aAxis+1] < aBounds[2*aAxis]) ? -aBounds[2*aAxis+1] : -aBounds[2*aAxis];
+       aOffset[0] = (aBounds[1] < aBounds[0]) ? -aBounds[1] : -aBounds[0];
+        aOffset[1] = (aBounds[3] < aBounds[2]) ? -aBounds[3] : -aBounds[2];
+        aOffset[2] = (aBounds[5] < aBounds[4]) ? -aBounds[5] : -aBounds[4];
 
         if (i > 0) {
           float aCCDist = (aDist + aPrevDist) / 2.0;
diff --git a/src/VISUGUI/VisuGUI_Timer.cxx b/src/VISUGUI/VisuGUI_Timer.cxx
new file mode 100644 (file)
index 0000000..ce88bbf
--- /dev/null
@@ -0,0 +1,103 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VisuGUI_Timer.cxx
+//  Module : SALOME
+
+#include "VisuGUI_Timer.h"
+
+#include "SUIT_Desktop.h"
+
+#include "utilities.h"
+
+#ifndef WNT
+static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
+#else
+//timezone *tz=_timezone;
+#endif
+
+#ifndef CLK_TCK
+# define CLK_TCK      CLOCKS_PER_SEC
+#endif
+
+VisuGUI_Timer::VisuGUI_Timer() :
+  Utils_Timer()
+{
+}
+
+VisuGUI_Timer::~VisuGUI_Timer()
+{
+}
+
+void VisuGUI_Timer::Start()
+{
+  if (Stopped) {
+    Stopped = 0;
+#ifndef WNT
+    times(RefToInitialTMS);
+    gettimeofday(RefToInitialTimeB,tz);
+#else
+    SYSTEMTIME st;
+    GetSystemTime(&st);
+    SystemTimeToFileTime(&st, RefToInitialTMS);
+         time(RefToCurrentTimeB);
+#endif
+  }
+}
+
+void VisuGUI_Timer::Stop()
+{
+  if (!Stopped) {
+#ifndef WNT
+    times(RefToCurrentTMS);
+    int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime;
+    int diffr_sys  = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
+    gettimeofday(RefToCurrentTimeB,tz);
+
+    Cumul_user += (double) diffr_user / CLK_TCK ;
+    Cumul_sys  += (double) diffr_sys  / CLK_TCK ;
+#else
+    SYSTEMTIME st;
+    GetSystemTime(&st);
+    SystemTimeToFileTime(&st, RefToCurrentTMS);
+    Cumul_user += (int)(((ULARGE_INTEGER*)(RefToCurrentTMS))->QuadPart - ((ULARGE_INTEGER*)(RefToInitialTMS))->QuadPart) / 10000000;
+         Cumul_sys = Cumul_user;
+         time(RefToCurrentTimeB);
+#endif
+   Stopped = 1;
+  }
+}
+
+void VisuGUI_Timer::Reset() {
+  Stopped     = 1;
+  Cumul_user  = Cumul_sys = 0. ;
+}
+
+QString VisuGUI_Timer::GetTime() {
+  bool StopSav = Stopped;
+  if (!StopSav) Stop();
+
+  return QString::number( Cumul_user );
+
+  if (!StopSav) Start();
+}
diff --git a/src/VISUGUI/VisuGUI_Timer.h b/src/VISUGUI/VisuGUI_Timer.h
new file mode 100644 (file)
index 0000000..bbfb7e5
--- /dev/null
@@ -0,0 +1,43 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : VisuGUI_Timer.h
+//  Module : SALOME
+
+#include <Utils_Timer.hxx>
+
+#include <qstring.h>
+
+class VisuGUI_Timer : public Utils_Timer
+{
+ public:
+  VisuGUI_Timer();
+  virtual ~VisuGUI_Timer();
+
+ public:
+  void Start();
+  void Stop();
+  void Reset();
+
+  QString GetTime();
+};
index 86f6b65463e33252bdbb91f231cd06691ab02e95..71b4bcefe4664cfce41987def8f2acb21d81e71d 100644 (file)
@@ -36,7 +36,6 @@
 #include "VISU_ViewManager_i.hh"
 
 #include "VISU_Actor.h"
-#include "VISU_ScalarMapAct.h"
 
 #include "SalomeApp_Module.h"
 #include "SalomeApp_Study.h"
@@ -501,36 +500,6 @@ namespace VISU
       }
     }
   }
-  
-  void
-  SetShading ( const SalomeApp_Module* theModule,
-             bool theOn )
-  {
-    SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type());
-    if (!aView) return;
-    SVTK_ViewWindow* vw  = dynamic_cast<SVTK_ViewWindow*>( aView );
-    if( !vw )
-      return;
-    
-    Handle(SALOME_InteractiveObject) anIO;
-    CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO);
-    if (CORBA::is_nil(anObject)) return;
-
-    VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
-    if (CORBA::is_nil(aVisuObj)) return;
-
-    PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-    if (!aServant.in()) return;
-
-    VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
-    if (aPrs3d) {
-      if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) {
-       if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
-         aScalarMapActor->SetShading( theOn );
-      }
-      vw->Repaint();
-    }
-  }
 
   //************************************************************
   // SObject type
@@ -563,6 +532,9 @@ namespace VISU
               _PTR(SObject)           theSource,
               VISU::Result_var&       theResult)
   {
+    if(theSource->Depth() < 3) // Bug of SALOMEDS : can\t get father from root object
+      return NULL;
+      
     _PTR(SObject) aSObj = theSource->GetFather();
     if (!aSObj)
       return NULL;
@@ -587,13 +559,7 @@ namespace VISU
       return NULL;
 
     theResult = VISU::Result::_narrow(anObject);
-    VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
-    if (pResult == NULL)
-      SUIT_MessageBox::warn1(GetDesktop(theModule),
-                             QObject::tr("WRN_VISU"),
-                             QObject::tr("WRN_NO_AVAILABLE_DATA"),
-                             QObject::tr("BUT_OK"));
-    return pResult;
+    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
   }
 
   //************************************************************
@@ -683,7 +649,7 @@ namespace VISU
       }catch(std::exception& exc){
        SUIT_MessageBox::warn1(GetDesktop(theModule),
                               QObject::tr("WRN_VISU"),
-                              QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
+                              QObject::tr("ERR_CANT_CREATE_ACTOR"),
                               QObject::tr("BUT_OK"));
       }
       QApplication::restoreOverrideCursor();
@@ -713,12 +679,12 @@ namespace VISU
         VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
         if(aPrs == NULL) continue;
         if (thePrs == aPrs) {
-          aResActor = anVISUActor->GetParent();
+          aResActor = anVISUActor;
           thePrs->UpdateActor(aResActor);
           aResActor->VisibilityOn();
 
         } else if (theDispOnly) {
-          anVISUActor->GetParent()->VisibilityOff();
+          anVISUActor->VisibilityOff();
         } else {
         }
       } else if (theDispOnly && anActor->GetVisibility()) {
@@ -764,11 +730,11 @@ namespace VISU
   FindActor(SVTK_ViewWindow* theViewWindow,
             const char* theEntry)
   {
-    using namespace VTK;
+    using namespace SVTK;
     if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
       if(vtkActorCollection* aCollection = aRenderer->GetActors()){
         if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
-          return anActor->GetParent();
+          return anActor;
         }
       }
     }
@@ -789,7 +755,6 @@ namespace VISU
                  VISU::Prs3d_i* thePrs)
   {
     QApplication::setOverrideCursor(Qt::waitCursor);
-    bool isPublished = false;
 
     SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
     CORBA::String_var anEntry = aSObject->GetID();
@@ -801,7 +766,6 @@ namespace VISU
       for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) {
         SVTK_ViewWindow* aView = aViewWindows[i];
         if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) {
-          isPublished = true;
           thePrs->UpdateActor(anActor);
         }
       }
@@ -809,7 +773,7 @@ namespace VISU
       INFOS(ex.what());
       QApplication::restoreOverrideCursor();
       SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"),
-                              QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(ex.what()),
+                              QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()),
                               QObject::tr("BUT_OK"));
 
       TViewWindows aViewWindows = GetViews(theModule);
@@ -823,9 +787,6 @@ namespace VISU
       return;
     }
     QApplication::restoreOverrideCursor();
-
-    if (!isPublished)
-      PublishInView(theModule, thePrs);
   }
 
   static bool ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow,
@@ -1203,7 +1164,7 @@ namespace VISU
         INFOS(exc.what());
         SUIT_MessageBox::warn1 (GetDesktop(theModule),
                                 QObject::tr("WRN_VISU"),
-                                QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
+                                QObject::tr("ERR_CANT_CREATE_ACTOR") + " " + QObject::tr(exc.what()),
                                 QObject::tr("BUT_OK"));
       }
     }
index f5fee0973b4c0921703119b20419f7cd383d8339..3d6fd0e56892d317e97109da5c4988d6f513d459 100644 (file)
@@ -110,8 +110,6 @@ namespace VISU {
   void ChangeRepresentation (const SalomeApp_Module* theModule,
                             VISU::PresentationType  theType);
 
-  void SetShading ( const SalomeApp_Module* theModule, bool theOn = true );
-
   // SObject type
   bool                                 CheckTimeStamp(const SalomeApp_Module* theModule,
                                                      _PTR(SObject)&          theSObject,
diff --git a/src/VISUGUI/VisuGUI_ViewTools.cxx b/src/VISUGUI/VisuGUI_ViewTools.cxx
new file mode 100644 (file)
index 0000000..bc2650d
--- /dev/null
@@ -0,0 +1,69 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_Tools.cxx
+//  Author : Sergey Anikin
+//  Module : VISU
+
+
+#include "VisuGUI_ViewTools.h"
+
+#include "VISU_Actor.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+
+namespace VISU 
+{
+  void
+  ErasePrs(VisuGUI* theModule,
+          VISU::Base_ptr theBase, 
+          bool thIsUpdate)
+  {
+    VISU::VISUType aType = theBase->GetType();
+    switch (aType) {
+    case VISU::TCURVE: {
+      if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(theBase).in()))
+       PlotCurve(theModule, aCurve, VISU::eErase );
+      break;
+    }
+    case VISU::TCONTAINER: {
+      if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(theBase).in()))
+       PlotContainer(theModule, aContainer, VISU::eErase );
+      break;
+    }
+    case VISU::TTABLE: {
+      if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theBase).in()))
+       PlotTable(theModule, aTable, VISU::eErase );
+      break;
+    }
+    default: {
+      if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(theBase).in())){
+       if(aType == VISU::TGAUSSPOINTS)
+         ErasePrs3d<VVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+       else
+         ErasePrs3d<SVTK_Viewer>(theModule,aPrsObject,thIsUpdate);
+      }
+    }} // switch (aType)
+  }
+}
diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h
new file mode 100644 (file)
index 0000000..f732ab2
--- /dev/null
@@ -0,0 +1,241 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+//  File   : VisuGUI_Tools.h
+//  Author : Sergey Anikin
+//  Module : VISU
+
+#ifndef VisuGUI_ViewTools_HeaderFile
+#define VisuGUI_ViewTools_HeaderFile
+
+#include "VisuGUI.h"
+
+#include "SUIT_MessageBox.h"
+#include "SUIT_ViewManager.h"
+#include "SUIT_ViewWindow.h"
+
+#include "SalomeApp_Module.h"
+#include "SalomeApp_Application.h"
+
+#include "VISU_Prs3d_i.hh"
+
+#include "VVTK_ViewModel.h"
+#include "VVTK_ViewWindow.h"
+
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+
+#include "VisuGUI_Tools.h"
+#include "VTKViewer_Algorithm.h"
+#include "SVTK_Functor.h"
+
+#include "VISU_Table_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "SALOME_ListIO.hxx"
+#include "SALOME_ListIteratorOfListIO.hxx"
+
+#include "SPlot2d_ViewModel.h"
+
+#include "VISU_Actor.h"
+
+#include <vtkActorCollection.h>
+#include <vtkRenderer.h>
+
+class VVTK_Viewer;
+
+namespace VISU 
+{
+  //---------------------------------------------------------------
+  template<class TViewer>
+  inline
+  typename TViewer::TViewWindow*
+  GetViewWindow(VisuGUI* theModule, 
+               const bool theIsViewCreate = false)
+  {
+    typedef typename TViewer::TViewWindow TView;
+    if(SUIT_ViewManager* aViewManager = theModule->getViewManager(TViewer::Type(),theIsViewCreate)){
+      if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
+       if(TView* aView = dynamic_cast<TView*>(aViewWindow)){
+         aViewWindow->raise();
+         aViewWindow->setFocus();
+         return aView;
+       }
+      }
+    }
+    return NULL;
+  }
+
+
+  //---------------------------------------------------------------
+  template<class TViewer>
+  inline
+  VISU_Actor*
+  PublishInView(VisuGUI* theModule,
+                Prs3d_i* thePrs,
+               const bool theIsHighlight = false,
+               const bool theIsCreateView = false)
+  {
+    typedef typename TViewer::TViewWindow TView;
+    if(TView* aView = GetViewWindow<TViewer>(theModule,theIsCreateView)){
+      QApplication::setOverrideCursor( Qt::waitCursor );
+      try{
+       if(VISU_Actor* anActor = thePrs->CreateActor()){
+         aView->AddActor(anActor);
+         if(theIsHighlight)
+           aView->highlight(anActor->getIO(),true);
+         aView->getRenderer()->ResetCameraClippingRange();
+         aView->Repaint();
+         QApplication::restoreOverrideCursor();
+         return anActor;
+       }
+      }catch(std::exception& exc){
+       SUIT_MessageBox::warn1(GetDesktop(theModule),
+                              QObject::tr("WRN_VISU"),
+                              QObject::tr("ERR_CANT_CREATE_ACTOR"),
+                              QObject::tr("BUT_OK"));
+      }
+    }
+    return NULL;
+  }
+
+
+  //---------------------------------------------------------------
+  template<class TViewer>
+  inline
+  VISU_Actor*
+  UpdateViewer(VisuGUI* theModule,
+               VISU::Prs3d_i* thePrs,
+               bool theDispOnly = false,
+              const bool theIsHighlight = false,
+              const bool theIsViewCreate = false)
+  {
+    typedef typename TViewer::TViewWindow TView;
+    if(TView* aView = GetViewWindow<TViewer>(theModule,theIsViewCreate)){
+      vtkRenderer *aRen = aView->getRenderer();
+      vtkActorCollection *anActColl = aRen->GetActors();
+      anActColl->InitTraversal();
+      VISU_Actor* aResActor = NULL;
+      while(vtkActor *anAct = anActColl->GetNextActor()){
+       if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)){
+         if(VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()){
+           if(thePrs == aPrs3d){
+             aResActor = anActor;
+             thePrs->UpdateActors();
+             aResActor->VisibilityOn();
+           }else if(theDispOnly){
+             anActor->VisibilityOff();
+           }
+         }else if(theDispOnly && anActor->GetVisibility()){
+           anActor->VisibilityOff();
+         }
+       }
+      }
+      if(aResActor){
+       if(theIsHighlight)
+         aView->highlight(aResActor->getIO(),true);
+       aView->getRenderer()->ResetCameraClippingRange();
+       aView->Repaint();
+       return aResActor;
+      }
+      return PublishInView<TViewer>(theModule,thePrs,theIsHighlight,theIsViewCreate);
+    }
+    return NULL;
+  }
+
+
+  //---------------------------------------------------------------
+  template<class TViewer>
+  inline
+  void
+  OnEraseAll(VisuGUI* theModule)
+  {
+    typedef typename TViewer::TViewWindow TViewWindow;
+    if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
+      aViewWindow->unHighlightAll();
+      if(vtkRenderer *aRen = aViewWindow->getRenderer()){
+       vtkActorCollection *aCollection = aRen->GetActors();
+       aCollection->InitTraversal();
+       while(vtkActor *anAct = aCollection->GetNextActor()){
+         if(anAct->GetVisibility() > 0)
+           if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)){
+             anActor->VisibilityOff();
+           }
+       }
+       aViewWindow->Repaint();
+      }
+    }
+  }
+  
+  template<>
+  inline
+  void
+  OnEraseAll<SPlot2d_Viewer>(VisuGUI* theModule)
+  {
+    if(SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule,false))
+      aPlot2d->EraseAll();
+  }
+
+
+  //---------------------------------------------------------------
+  template<class TVieweWindow>
+  inline
+  VISU_Actor*
+  FindActor(TVieweWindow* theViewWindow,
+            const char* theEntry)
+  {
+    using namespace SVTK;
+    if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
+      if(vtkActorCollection* aCollection = aRenderer->GetActors()){
+        if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
+          return anActor;
+        }
+      }
+    }
+    return NULL;
+  }
+
+  template<class TViewer>
+  inline
+  void
+  ErasePrs3d(VisuGUI* theModule,
+             VISU::Prs3d_i* thePrs,
+            const bool thIsUpdate = true)
+  {
+    typedef typename TViewer::TViewWindow TViewWindow;
+    if(TViewWindow* aViewWindow = GetViewWindow<TViewer>(theModule)){
+      if(VISU_Actor* anActor = FindActor(aViewWindow,thePrs)){
+        anActor->VisibilityOff();
+       if(thIsUpdate)
+         aViewWindow->Repaint();
+      }
+    }
+  }
+
+
+  void
+  ErasePrs(VisuGUI* theModule,
+          VISU::Base_ptr theBase, 
+          bool thIsUpdate);
+}
+
+#endif
index 330d5468e8cc6e122d06a238e5dba347d80562c1..bad03e4f3d0f1c3aafe9f984a3c4a6a72d1a25cd 100644 (file)
@@ -18,50 +18,149 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 # Libraries targets
 LIB = libVISUEngineImpl.la
 
-LIB_SRC = VISUConfig.cc VISU_Gen_i.cc \
-       VISU_Result_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
-       VISU_Prs3d_i.cc VISU_Mesh_i.cc VISU_ScalarMap_i.cc \
-       VISU_IsoSurfaces_i.cc VISU_DeformedShape_i.cc \
-       VISU_Plot3D_i.cc VISU_CutPlanes_i.cc VISU_CutLines_i.cc \
-       VISU_Vectors_i.cc VISU_StreamLines_i.cc \
-       VISU_ViewManager_i.cc VISU_View_i.cc \
-       VISU_TimeAnimation.cxx VISU_CorbaMedConvertor.cxx \
+LIB_SRC = \
+       VISUConfig.cc \
+       VISU_PrsObject_i.cc \
+       VISU_Prs3d_i.cc \
+       VISU_ColoredPrs3d_i.cc \
+       VISU_ScalarMap_i.cc \
+       VISU_GaussPoints_i.cc \
+       VISU_IsoSurfaces_i.cc \
+       VISU_DeformedShape_i.cc \
+       VISU_Plot3D_i.cc \
+       VISU_CutPlanes_i.cc \
+       VISU_CutLines_i.cc \
+       VISU_Vectors_i.cc \
+       VISU_StreamLines_i.cc \
+       VISU_Mesh_i.cc \
+       VISU_Table_i.cc \
+       VISU_Gen_i.cc \
+       VISU_Result_i.cc \
+       VISU_ViewManager_i.cc \
+       VISU_View_i.cc \
+       VISU_TimeAnimation.cxx \
+       VISU_CorbaMedConvertor.cxx \
        VISU_DumpPython.cc
 
-LIB_MOC = VISU_TimeAnimation.h
+LIB_MOC = \
+       VISU_TimeAnimation.h
 
-LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl \
-                 SALOME_Exception.idl SALOME_GenericObj.idl MED.idl
+LIB_SERVER_IDL = \
+       MED.idl \
+       VISU_Gen.idl \
+       SALOME_Component.idl \
+       SALOME_Exception.idl \
+       SALOME_GenericObj.idl 
 
-LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Comm.idl
+LIB_CLIENT_IDL = \
+       SALOMEDS.idl \
+       SALOMEDS_Attributes.idl \
+       SALOME_Comm.idl
 
 # Executables targets
-BIN =
+BIN = VISU_I
 BIN_SRC =
 
 BIN_CLIENT_IDL =
 BIN_SERVER_IDL =
 
-EXPORT_HEADERS = VISUConfig.hh VISU_Gen_i.hh \
-       VISU_Result_i.hh VISU_PrsObject_i.hh VISU_Table_i.hh \
-       VISU_Prs3d_i.hh VISU_Mesh_i.hh VISU_ScalarMap_i.hh \
-       VISU_IsoSurfaces_i.hh VISU_DeformedShape_i.hh \
-       VISU_Plot3D_i.hh VISU_CutPlanes_i.hh VISU_CutLines_i.hh \
-       VISU_Vectors_i.hh VISU_StreamLines_i.hh \
-       VISU_ViewManager_i.hh VISU_View_i.hh \
+EXPORT_HEADERS = \
+       VISUConfig.hh \
+       VISU_Gen_i.hh \
+       VISU_Result_i.hh \
+       VISU_PrsObject_i.hh \
+       VISU_Table_i.hh \
+       VISU_Prs3d_i.hh \
+       VISU_Mesh_i.hh \
+       VISU_ColoredPrs3d_i.hh \
+       VISU_ScalarMap_i.hh \
+       VISU_IsoSurfaces_i.hh \
+       VISU_DeformedShape_i.hh \
+       VISU_Plot3D_i.hh \
+       VISU_CutPlanes_i.hh \
+       VISU_CutLines_i.hh \
+       VISU_Vectors_i.hh \
+       VISU_StreamLines_i.hh \
+       VISU_GaussPoints_i.hh \
+       VISU_ViewManager_i.hh \
+       VISU_View_i.hh \
        VISU_TimeAnimation.h
 
 # additionnal information to compil and link file
-CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
-       $(HDF5_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)\
-       -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome
-
-LDFLAGS  += $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \
-       -lSalomeContainer -lOpUtil -lSalomeApp -lVTKViewer -lSVTK -lSPlot2d -lSalomeHDFPersist \
-       -lSalomeGenericObj -lVisuConvertor -lVisuPipeLine -lVisuObject -lVISUGUITOOLS \
-       -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lEvent
-
-LIBS+=  -lPlot2d -L${KERNEL_ROOT_DIR}/lib/salome
+CPPFLAGS += \
+       -ftemplate-depth-32 \
+       $(QT_INCLUDES) \
+       $(PYTHON_INCLUDES) \
+       $(OCC_INCLUDES) \
+       $(VTK_INCLUDES) \
+       $(HDF5_INCLUDES) \
+       $(QWT_INCLUDES) \
+       $(BOOST_CPPFLAGS)\
+       -I${KERNEL_ROOT_DIR}/include/salome \
+       -I${MED_ROOT_DIR}/include/salome \
+       -I${GUI_ROOT_DIR}/include/salome
+
+LDFLAGS  += \
+       $(PYTHON_LIBS) \
+       $(QT_MT_LIBS) \
+       $(VTK_LIBS) \
+       $(QWT_LIBS) \
+       $(BOOST_LIBS) \
+       -L${KERNEL_ROOT_DIR}/lib/salome \
+       -L${GUI_ROOT_DIR}/lib/salome \
+       -L${MED_ROOT_DIR}/lib/salome 
+
+LIBS+=  -lboost_signals-mt \
+       -lSalomeHDFPersist \
+       -lSalomeGenericObj \
+       -lSalomeContainer \
+       -lSalomeNS \
+       -lTOOLSDS \
+       -lOpUtil \
+       -lEvent \
+       -lCASCatch \
+       -lSalomeApp \
+       -lSalomeSession \
+       -lVTKViewer \
+       -lSVTK \
+       -lSPlot2d \
+       -lVisuConvertor \
+       -lVisuPipeLine \
+       -lVisuObject \
+       -lVISUGUITOOLS
+
+LDFLAGSFORBIN=$(LDFLAGS) $(LIBS) \
+       -L${KERNEL_ROOT_DIR}/lib/salome \
+       -lSALOMEBasics \
+       -lSalomeCatalog \
+       -lwith_loggerTraceCollector \
+       -lSalomeLifeCycleCORBA \
+       -lRegistry \
+       -lSalomeNotification \
+       -lSALOMELocalTrace \
+       -lSalomeResourcesManager \
+       -lSalomeDS \
+       -lSalomeDSImpl \
+       -lSalomeObject \
+       -lqtx \
+       -lsuit \
+       -lstd \
+       -lCAM \
+       -lObjBrowser \
+       -lSalomePrs \
+       -lPyInterp \
+       -lPythonConsole \
+       -lLogWindow \
+       -lToolsGUI  \
+       -lGLViewer \
+       -lOCCViewer \
+       -lSOCC \
+       -lPlot2d \
+       -lMEDWrapper \
+       -lMEDWrapperBase \
+       -lMEDWrapper_V2_2 \
+       -lMEDWrapper_V2_1 \
+       -lmed_V2_1
 
 # additional file to be cleaned
 MOSTLYCLEAN =
index 3224f05abd36c7ab41a0d13f706a53a69d2855bc..6ec9a2d015ba90dce00fdd20403169043f77a357 100644 (file)
@@ -39,8 +39,8 @@
 #include "Utils_CorbaException.hxx"
 #include "utilities.h"
 
-#include <SALOMEDSClient_SObject.hxx>
-#include <SALOMEDSClient_Study.hxx>
+#include "SALOMEDSClient_SObject.hxx"
+#include "SALOMEDSClient_Study.hxx"
 
 // QT headers
 #include <qstring.h>
@@ -61,8 +61,8 @@
 class SUIT_Session;
 class SUIT_ResourceMgr;
 
-
-namespace VISU{
+namespace VISU
+{
 
   SUIT_Session *GetSession();
   SUIT_ResourceMgr *GetResourceMgr();
diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc
new file mode 100644 (file)
index 0000000..a47ea45
--- /dev/null
@@ -0,0 +1,694 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//  File   : VISU_PrsObject_i.cxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#include "VISU_ColoredPrs3d_i.hh"
+
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_Result_i.hh"
+#include "VISU_Convertor.hxx"
+
+#include "SUIT_ResourceMgr.h"
+
+#include <vtkMapper.h>
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//============================================================================
+VISU::ColoredPrs3d_i::
+ColoredPrs3d_i(Result_i* theResult,
+              bool theAddToStudy) :
+  PrsObject_i(theResult->GetStudyDocument()),
+  Prs3d_i(theResult,theAddToStudy),
+  myScalarMapPL(NULL),
+  myIsFixedRange(false)
+{}
+
+VISU::ColoredPrs3d_i::
+ColoredPrs3d_i(Result_i* theResult,
+              SALOMEDS::SObject_ptr theSObject) :
+  PrsObject_i(theResult->GetStudyDocument()),
+  Prs3d_i(theResult,theSObject),
+  myScalarMapPL(NULL),
+  myIsFixedRange(false)
+{}
+
+VISU::ColoredPrs3d_i
+::~ColoredPrs3d_i()
+{}
+
+void 
+VISU::ColoredPrs3d_i
+::RemoveFromStudy()
+{
+  TSuperClass::RemoveFromStudy();
+  VISU::RemoveFromStudy(mySObject,false);
+}
+
+void
+VISU::ColoredPrs3d_i
+::SameAs(const ColoredPrs3d_i* theOrigin)
+{
+  DoHook();
+
+  ColoredPrs3d_i* anOrigin = const_cast<ColoredPrs3d_i*>(theOrigin);
+  myField = anOrigin->GetField();
+  myMeshName = myField->myMeshName;
+  myEntity = myField->myEntity;
+  myIteration = anOrigin->GetIteration();
+  myFieldName = anOrigin->GetFieldName();
+
+  Build(-1);
+
+  TSuperClass::SameAs(theOrigin);
+
+  SetScalarMode(anOrigin->GetScalarMode());
+  SetNbColors(anOrigin->GetNbColors());
+  SetBarOrientation(anOrigin->GetBarOrientation());
+
+  SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
+  SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
+  SetLabels(anOrigin->GetLabels());
+  SetTitle(anOrigin->GetTitle());
+
+  SetBoldTitle(anOrigin->IsBoldTitle());
+  SetItalicTitle(anOrigin->IsItalicTitle());
+  SetShadowTitle(anOrigin->IsShadowTitle());
+  SetTitFontType(anOrigin->GetTitFontType());
+  float r,g,b;
+  anOrigin->GetTitleColor(&r,&g,&b);
+  SetTitleColor(r,g,b);
+
+  SetBoldLabel(anOrigin->IsBoldLabel());
+  SetItalicLabel(anOrigin->IsItalicLabel());
+  SetShadowLabel(anOrigin->IsShadowLabel());
+  SetLblFontType(anOrigin->GetLblFontType());
+  anOrigin->GetLabelColor(&r,&g,&b);
+  SetLabelColor(r,g,b);
+}
+
+void
+VISU::ColoredPrs3d_i
+::SameAsParams(const ColoredPrs3d_i* theOrigin)
+{
+  int anIteration = GetIteration();
+  SameAs(theOrigin);
+  myIteration = anIteration;
+
+  Build(-1);
+  Update();
+}
+
+
+//----------------------------------------------------------------------------
+CORBA::Long 
+VISU::ColoredPrs3d_i
+::GetScalarMode()
+{
+  return myScalarMapPL->GetScalarMode();
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetScalarMode(CORBA::Long theScalarMode) 
+{
+  myScalarMapPL->SetScalarMode(theScalarMode);
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetNbColors(CORBA::Long theNbColors)
+{
+  myScalarMapPL->SetNbColors(theNbColors);
+}
+
+CORBA::Long 
+VISU::ColoredPrs3d_i
+::GetNbColors()
+{
+  return myScalarMapPL->GetNbColors();
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetBarOrientation(VISU::ScalarMap::Orientation theOrientation)
+{
+  myOrientation = theOrientation;
+}
+
+VISU::ScalarMap::Orientation 
+VISU::ColoredPrs3d_i
+::GetBarOrientation() 
+{
+  return myOrientation;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetPosition(CORBA::Double X, CORBA::Double Y) 
+{ 
+  myPosition[0] = X; 
+  myPosition[1] = Y;
+}
+
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetPosX() 
+{
+  return myPosition[0];
+}
+
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetPosY() 
+{ 
+  return myPosition[1];
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) 
+{
+  myWidth = theWidth; 
+  myHeight = theHeight;
+}
+
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetWidth() 
+{
+  return myWidth;
+}
+
+CORBA::Double
+VISU::ColoredPrs3d_i
+::GetHeight() 
+{ 
+  return myHeight;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetLabels(CORBA::Long theNbLabels)
+{
+  myNumberOfLabels = theNbLabels;
+}
+
+CORBA::Long
+VISU::ColoredPrs3d_i
+::GetLabels() 
+{ 
+  return myNumberOfLabels;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetTitle(const char* theName) 
+{
+  myTitle = theName;
+}
+
+char* 
+VISU::ColoredPrs3d_i
+::GetTitle() 
+{ 
+  return CORBA::string_dup(myTitle.c_str());
+}
+
+bool
+VISU::ColoredPrs3d_i
+::IsBoldTitle() 
+{ 
+  return myIsBoldTitle;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetBoldTitle(bool isBold)
+{
+  myIsBoldTitle = isBold;
+}
+
+bool
+VISU::ColoredPrs3d_i
+::IsItalicTitle() 
+{ 
+  return myIsItalicTitle;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetItalicTitle(bool isItalic)
+{ 
+  myIsItalicTitle = isItalic;
+}
+
+bool
+VISU::ColoredPrs3d_i
+::IsShadowTitle() 
+{ 
+  return myIsShadowTitle;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetShadowTitle(bool isShadow)
+{ 
+  myIsShadowTitle = isShadow;
+}
+
+int
+VISU::ColoredPrs3d_i
+::GetTitFontType()
+{
+  return myTitFontType;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetTitFontType(int theType)
+{
+  myTitFontType = theType;
+}
+
+void
+VISU::ColoredPrs3d_i
+::GetTitleColor(float* theR, float* theG, float* theB)
+{
+  *theR = myTitleColor[0]; 
+  *theG = myTitleColor[1]; 
+  *theB = myTitleColor[2];
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetTitleColor(float theR, float theG, float theB)
+{
+  myTitleColor[0] = theR; 
+  myTitleColor[1] = theG; 
+  myTitleColor[2] = theB; 
+}
+
+bool
+VISU::ColoredPrs3d_i
+::IsBoldLabel()
+{
+  return myIsBoldLabel;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetBoldLabel(bool isBold) 
+{
+  myIsBoldLabel = isBold;
+}
+
+bool
+VISU::ColoredPrs3d_i
+::IsItalicLabel() 
+{
+  return myIsItalicLabel;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetItalicLabel(bool isItalic)
+{
+  myIsItalicLabel = isItalic;
+}
+
+bool
+VISU::ColoredPrs3d_i
+::IsShadowLabel() 
+{
+  return myIsShadowLabel;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetShadowLabel(bool isShadow)
+{
+  myIsShadowLabel = isShadow;
+}
+
+int
+VISU::ColoredPrs3d_i
+::GetLblFontType()
+{
+  return myLblFontType;
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetLblFontType(int theType)
+{
+  myLblFontType = theType;
+}
+
+void
+VISU::ColoredPrs3d_i
+::GetLabelColor(float* theR, float* theG, float* theB)
+{
+  *theR = myLabelColor[0]; 
+  *theG = myLabelColor[1]; 
+  *theB = myLabelColor[2];
+}
+
+void
+VISU::ColoredPrs3d_i
+::SetLabelColor(float theR, float theG, float theB)
+{
+  myLabelColor[0] = theR; 
+  myLabelColor[1] = theG; 
+  myLabelColor[2] = theB; 
+}
+
+
+//----------------------------------------------------------------------------
+/**
+ * Creates ColoredPrs3d and initialises it from resources
+ */
+VISU::Storable* 
+VISU::ColoredPrs3d_i
+::Create(const char* theMeshName, 
+        VISU::Entity theEntity,
+        const char* theFieldName, 
+        int theIteration)
+{
+  DoHook(); // to create proper pipeline
+
+  myMeshName = theMeshName;
+  myEntity = (VISU::TEntity)theEntity;
+  myFieldName =theFieldName;
+  myIteration = theIteration;
+
+  Build(false); // to get corresponding input from result and initilize the pipeline
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
+  SetScalarMode(aScalarMode);
+
+  int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
+  SetNbColors(aNumberOfColors);
+
+  // Orientation
+  int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
+  if(anOrientation == 1)
+    myOrientation = VISU::ScalarMap::HORIZONTAL;
+  else
+    myOrientation = VISU::ScalarMap::VERTICAL;
+
+  // Scalar Bar origin
+  QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
+
+  float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2;
+  aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
+  myPosition[0] = aXorigin;
+
+  float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012;
+  aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
+  myPosition[1] = aYorigin;
+
+  // Scalar Bar size
+  myWidth = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.1 : 0.6;
+  myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
+
+  myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12;
+  myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
+
+  // Nb of Labels
+  myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
+
+  // Fonts properties definition
+  myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
+  myTitFontType = VTK_ARIAL;
+
+  if(aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" )){
+    QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
+    if ( f.family() == "Arial" )
+      myTitFontType = VTK_ARIAL;
+    else if ( f.family() == "Courier" )
+      myTitFontType = VTK_COURIER;
+    else if ( f.family() == "Times" )
+      myTitFontType = VTK_TIMES;
+    
+    myIsBoldTitle   = f.bold();
+    myIsItalicTitle = f.italic();
+    myIsShadowTitle =  f.underline();
+  }
+
+  QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
+
+  myTitleColor[0] = aTextColor.red()   / 255;
+  myTitleColor[1] = aTextColor.green() / 255;
+  myTitleColor[2] = aTextColor.blue()  / 255;
+
+  myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
+  myLblFontType = VTK_ARIAL;
+
+  if( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" )){
+    QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
+    if ( f.family() == "Arial" )
+      myLblFontType = VTK_ARIAL;
+    else if ( f.family() == "Courier" )
+      myLblFontType = VTK_COURIER;
+    else if ( f.family() == "Times" )
+      myLblFontType = VTK_TIMES;
+    
+    myIsBoldLabel   = f.bold();
+    myIsItalicLabel = f.italic();
+    myIsShadowLabel =  f.underline();
+  }
+
+  QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
+
+  myLabelColor[0] = aLabelColor.red()   / 255;
+  myLabelColor[1] = aLabelColor.green() / 255;
+  myLabelColor[2] = aLabelColor.blue()  / 255;
+
+  return this;
+}
+
+VISU::Storable* 
+VISU::ColoredPrs3d_i
+::Restore(const Storable::TRestoringMap& theMap)
+{
+  DoHook();
+
+  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
+  myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
+  myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
+  myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
+
+  myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
+
+  Build(true);
+
+  TSuperClass::Restore(theMap);
+
+  SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
+  SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
+  SetBarOrientation((VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt());
+  
+  myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
+  myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
+  myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
+  myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
+  myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
+  myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
+
+  myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
+  myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
+  myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
+  myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
+  myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
+  myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
+  myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
+
+  myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
+  myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
+  myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
+  myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
+  myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
+  myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
+  myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
+
+  return this;
+}
+
+void 
+VISU::ColoredPrs3d_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
+  Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
+  Storable::DataToStream( theStr, "myOrientation",    myOrientation );
+
+  Storable::DataToStream( theStr, "myMeshName",       myMeshName.c_str() );
+  Storable::DataToStream( theStr, "myEntity",         myEntity );
+  Storable::DataToStream( theStr, "myFieldName",      myFieldName.c_str() );
+  Storable::DataToStream( theStr, "myIteration",      myIteration );
+
+  Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
+  Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
+  Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
+  Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
+  Storable::DataToStream( theStr, "myWidth",          myWidth );
+  Storable::DataToStream( theStr, "myHeight",         myHeight );
+
+  Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
+  Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
+  Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
+  Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
+  Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
+  Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
+  Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
+
+  Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
+  Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
+  Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
+  Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
+  Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
+  Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
+  Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::ColoredPrs3d_i
+::DoHook()
+{
+  if(MYDEBUG) MESSAGE("ColoredPrs3d_i::DoHook() - "<<myPipeLine);
+  if(!myPipeLine){
+    myPipeLine = VISU_ScalarMapPL::New();
+    myPipeLine->GetMapper()->SetScalarVisibility(1);
+  }
+  myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
+}
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::ColoredPrs3d_i
+::Build(int theRestoring)
+{
+  if(MYDEBUG)
+    MESSAGE("ColoredPrs3d_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
+  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+  if(myAddToStudy) 
+    aStudyBuilder->NewCommand();  // There is a transaction
+  try{
+    DoSetInput(myResult);
+    QString aComment;
+    myName = "NoName";
+    if(theRestoring <= 0){
+      if(theRestoring == 0) myScalarMapPL->Init();
+      if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
+      const VISU::TValField& aValField = myField->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(myAddToStudy){
+      myName = GenerateName().latin1();
+      aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                      VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
+      string aResultEntry = myResult->GetEntry();
+      string aRefFatherEntry = myResult->GetRefFatherEntry();
+      string anEntry = myResult->GetEntry(aComment.latin1());
+      if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
+      aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                      GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
+      CORBA::String_var anIOR = GetID();
+      CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
+      mySObject = myStudy->FindObjectIOR(anIOR);
+    }
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+    throw;
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+    throw;
+  }
+  if(myAddToStudy) 
+    aStudyBuilder->CommitCommand();
+  return this;
+}
+
+
+//----------------------------------------------------------------------------
+const VISU::PField&
+VISU::ColoredPrs3d_i
+::GetField() const 
+{ 
+  return myField;
+}
+
+const std::string&
+VISU::ColoredPrs3d_i
+::GetMeshName() const 
+{ 
+  return myMeshName;
+}
+
+VISU::Entity
+VISU::ColoredPrs3d_i
+::GetEntity() const 
+{ 
+  return VISU::Entity(myEntity);
+}
+
+const std::string&
+VISU::ColoredPrs3d_i
+::GetFieldName() const 
+{ 
+  return myFieldName;
+}
+
+int
+VISU::ColoredPrs3d_i
+::GetIteration() const 
+{ 
+  return myIteration;
+}
+
+VISU_ScalarMapPL*
+VISU::ColoredPrs3d_i
+::GetScalarMapPL()
+{ 
+  return myScalarMapPL;
+}
diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh
new file mode 100644 (file)
index 0000000..cdbfaeb
--- /dev/null
@@ -0,0 +1,296 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//  File   : VISU_PrsObject_i.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_ColoredPrs3d_i_HeaderFile
+#define VISU_ColoredPrs3d_i_HeaderFile
+
+#include "VISU_Prs3d_i.hh"
+
+class VISU_ScalarMapPL;
+
+namespace VISU
+{
+  //============================================================================
+  class ColoredPrs3d_i : public virtual POA_VISU::ColoredPrd3d,
+                        public virtual Prs3d_i
+  {
+    ColoredPrs3d_i();
+    ColoredPrs3d_i(const ColoredPrs3d_i&);
+  public:
+    //----------------------------------------------------------------------------
+    typedef Prs3d_i TSuperClass;
+
+    explicit
+    ColoredPrs3d_i(Result_i* theResult,
+                  bool theAddToStudy);
+    explicit
+    ColoredPrs3d_i(Result_i* theResult,
+                  SALOMEDS::SObject_ptr theSObject);
+
+    virtual
+    ~ColoredPrs3d_i();
+
+    virtual
+    void
+    RemoveFromStudy();
+
+    //----------------------------------------------------------------------------
+    virtual
+    CORBA::Long
+    GetScalarMode();
+
+    virtual
+    void 
+    SetScalarMode(CORBA::Long theScalarMode);
+
+    virtual 
+    void 
+    SetNbColors(CORBA::Long theNbColors);
+
+    virtual
+    CORBA::Long 
+    GetNbColors();
+
+    virtual
+    void
+    SetBarOrientation(VISU::ScalarMap::Orientation theOrientation);
+
+    virtual 
+    VISU::ScalarMap::Orientation 
+    GetBarOrientation();
+
+    virtual
+    void
+    SetPosition(CORBA::Double X, CORBA::Double Y);
+
+    virtual
+    CORBA::Double
+    GetPosX();
+
+    virtual
+    CORBA::Double
+    GetPosY();
+
+    virtual 
+    void
+    SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
+    
+    virtual 
+    CORBA::Double
+    GetWidth();
+
+    virtual
+    CORBA::Double
+    GetHeight();
+
+    virtual 
+    void
+    SetLabels(CORBA::Long theNbLabels);
+
+    virtual
+    CORBA::Long
+    GetLabels();
+
+    virtual
+    void
+    SetTitle(const char* theName);
+
+    virtual
+    char* 
+    GetTitle();
+
+    //----------------------------------------------------------------------------
+  protected:
+    VISU::ScalarMap::Orientation myOrientation;
+    std::string myTitle;
+    int myNumberOfLabels;
+    float myPosition[2], myWidth, myHeight;
+
+  public:
+    //----------------------------------------------------------------------------
+    virtual
+    Storable* 
+    Create(const char* theMeshName, 
+          VISU::Entity theEntity,
+          const char* theFieldName, 
+          int theIteration);
+
+    virtual 
+    Storable* 
+    Restore(const Storable::TRestoringMap& theMap);
+
+    virtual 
+    void
+    ToStream(std::ostringstream& theStr);
+
+    virtual 
+    void
+    SameAs(const ColoredPrs3d_i* theOrigin);
+
+    /*!
+     *  \brief Works like SameAs() method, but keep myIteration value unchanged.
+     *
+     *  Is used in VISU_TimeAnimation class implementation.
+     */
+    void
+    SameAsParams(const ColoredPrs3d_i* theOrigin);
+
+    const VISU::PField&
+    GetField() const;
+
+    const std::string& 
+    GetMeshName() const;
+
+    VISU::Entity
+    GetEntity() const;
+
+    const std::string& 
+    GetFieldName() const;
+
+    int
+    GetIteration() const;
+
+    VISU_ScalarMapPL* 
+    GetScalarMapPL();
+
+    virtual 
+    bool
+    IsBoldTitle();
+
+    virtual
+    void
+    SetBoldTitle(bool isBold);
+
+    virtual
+    bool
+    IsItalicTitle();
+
+    virtual
+    void
+    SetItalicTitle(bool isItalic);
+
+    virtual 
+    bool
+    IsShadowTitle();
+
+    virtual
+    void
+    SetShadowTitle(bool isShadow);
+
+    virtual 
+    int
+    GetTitFontType();
+
+    virtual
+    void
+    SetTitFontType(int theType);
+
+    virtual 
+    void
+    GetTitleColor(float* theR, float* theG, float* theB);
+    
+    virtual
+    void
+    SetTitleColor(float theR, float theG, float theB);    
+
+    virtual
+    bool
+    IsBoldLabel();
+
+    virtual
+    void
+    SetBoldLabel(bool isBold);
+
+    virtual
+    bool
+    IsItalicLabel();
+
+    virtual
+    void
+    SetItalicLabel(bool isItalic);
+
+    virtual
+    bool
+    IsShadowLabel();
+
+    virtual
+    void
+    SetShadowLabel(bool isShadow);
+
+    virtual 
+    int
+    GetLblFontType();
+
+    virtual
+    void
+    SetLblFontType(int theType);
+
+    virtual 
+    void
+    GetLabelColor(float* theR, float* theG, float* theB);
+
+    virtual
+    void
+    SetLabelColor(float theR, float theG, float theB);
+
+    //----------------------------------------------------------------------------
+  protected:
+    PField myField;
+    TEntity myEntity;
+    std::string myFieldName;
+    int myIteration;
+
+    //Font management
+    bool myIsBoldTitle;
+    bool myIsItalicTitle;
+    bool myIsShadowTitle;
+    int  myTitFontType;
+    float myTitleColor[3];
+
+    bool myIsBoldLabel;
+    bool myIsItalicLabel;
+    bool myIsShadowLabel;
+    int  myLblFontType;
+    float myLabelColor[3];
+
+    VISU_ScalarMapPL* myScalarMapPL;
+    bool myIsFixedRange;
+
+    virtual 
+    void
+    DoSetInput(Result_i* theResult) = 0;
+
+    Storable* 
+    Build(int theRestoring);
+
+    virtual
+    void 
+    DoHook();
+  };
+
+}
+
+#endif
index 56c39876d4d2fea091de8ace7501fd8a9826bde7..78d2d2873a412da178d51ce1bc716eba0c729409 100644 (file)
@@ -39,7 +39,7 @@ using namespace VISU;
 #define USER_INTERLACE MED_FULL_INTERLACE
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -58,7 +58,8 @@ extern "C" {
   }
 }
 
-namespace{
+namespace
+{
   using namespace SALOME_MED;
   
   const int MED_NBR_GEOMETRIE_MAILLE = 15;
@@ -107,7 +108,10 @@ namespace{
     MED_POINT1,
   };
   
-  int GetEntity2Geom(const VISU::TEntity& theEntity, medGeometryElement*& theVector)
+
+  //---------------------------------------------------------------
+  int
+  GetEntity2Geom(const VISU::TEntity& theEntity, medGeometryElement*& theVector)
   {
     switch(theEntity){
     case CELL_ENTITY: theVector = CELLGEOM; return MED_NBR_GEOMETRIE_MAILLE; break;
@@ -118,7 +122,10 @@ namespace{
     return -1;
   }
   
-  int MEDGeom2NbNodes(int theMEDGeomType)
+
+  //---------------------------------------------------------------
+  int
+  MEDGeom2NbNodes(int theMEDGeomType)
   { 
     switch(theMEDGeomType){
     case MED_NONE: return 0;
@@ -141,45 +148,35 @@ namespace{
     return -1;
   }
   
-  int MEDGeomToVTK(medGeometryElement theMEDGeomType)
-  { 
-    switch(theMEDGeomType){
-    case MED_NONE: return VTK_EMPTY_CELL;
-    case MED_POINT1: return VTK_VERTEX;
-    case MED_SEG2: return VTK_LINE;
-    case MED_SEG3: return VTK_LINE;
-    case MED_TRIA3: return VTK_TRIANGLE;
-    case MED_TRIA6: return VTK_TRIANGLE;
-    case MED_QUAD4: return VTK_QUAD;
-    case MED_QUAD8: return VTK_QUAD;
-    case MED_TETRA4: return VTK_TETRA;
-    case MED_TETRA10: return VTK_TETRA;
-    case MED_HEXA8: return VTK_HEXAHEDRON;
-    case MED_HEXA20: return VTK_HEXAHEDRON;
-    case MED_PENTA6: return VTK_WEDGE;
-    case MED_PENTA15: return VTK_WEDGE;
-    case MED_PYRA5: return VTK_PYRAMID;
-    case MED_PYRA13: return VTK_PYRAMID;
-    }
-    return -1;
-  }
-  
-  int VTKGeom2NbNodes(int theVTKGeomType)
+
+  //---------------------------------------------------------------
+  VISU::EGeometry
+  MEDGeom2VISU(medGeometryElement theGeom)
   { 
-    switch(theVTKGeomType){
-    case VTK_VERTEX: return 1;
-    case VTK_LINE: return 2;
-    case VTK_TRIANGLE: return 3;
-    case VTK_QUAD: return 4;
-    case VTK_TETRA: return 4;
-    case VTK_HEXAHEDRON: return 8;
-    case VTK_WEDGE: return 6;
-    case VTK_PYRAMID: return 5;
+    switch(theGeom){
+    case MED_POINT1: return VISU::ePOINT1;
+    case MED_SEG2: return VISU::eSEG2;
+    case MED_SEG3: return VISU::eSEG3;
+    case MED_TRIA3: return VISU::eTRIA3;
+    case MED_TRIA6: return VISU::eTRIA6;
+    case MED_QUAD4: return VISU::eQUAD4;
+    case MED_QUAD8: return VISU::eQUAD8;
+    case MED_TETRA4: return VISU::eTETRA4;
+    case MED_TETRA10: return VISU::eTETRA10;
+    case MED_HEXA8: return VISU::eHEXA8;
+    case MED_HEXA20: return VISU::eHEXA20;
+    case MED_PENTA6: return VISU::ePENTA6;
+    case MED_PENTA15: return VISU::ePENTA15;
+    case MED_PYRA5: return VISU::ePYRA5;
+    case MED_PYRA13: return VISU::ePYRA13;
     }
-    return -1;
+    return VISU::eNONE;
   }
   
-  medGeometryElement VTKGeomToMED(int theVTKGeomType)
+
+  //---------------------------------------------------------------
+  medGeometryElement 
+  VTKGeomToMED(int theVTKGeomType)
   { 
     switch(theVTKGeomType){
     case VTK_VERTEX: return MED_POINT1;
@@ -194,7 +191,9 @@ namespace{
     return medGeometryElement(-1);
   }
   
-  VISU::TEntity MEDEntityToVTK(medEntityMesh theMEDEntity)
+  //---------------------------------------------------------------
+  VISU::TEntity
+  MEDEntityToVTK(medEntityMesh theMEDEntity)
   {
     switch(theMEDEntity){
     case MED_NODE: return NODE_ENTITY;
@@ -205,7 +204,9 @@ namespace{
     return VISU::TEntity(-1);
   }
   
-  medEntityMesh VTKEntityToMED(VISU::TEntity theVTKEntity)
+  //---------------------------------------------------------------
+  medEntityMesh 
+  VTKEntityToMED(VISU::TEntity theVTKEntity)
   {
     switch(theVTKEntity){
     case NODE_ENTITY: return MED_NODE;
@@ -215,8 +216,12 @@ namespace{
     }
     return medEntityMesh(-1);
   }
+
   
-  string GetSObjectName(SALOMEDS::SObject_ptr aSObject){
+  //---------------------------------------------------------------
+  std::string 
+  GetSObjectName(SALOMEDS::SObject_ptr aSObject)
+  {
     SALOMEDS::GenericAttribute_var anAttr;
     if (aSObject->FindAttribute(anAttr,"AttributeName")) {
       SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
@@ -226,6 +231,8 @@ namespace{
     return "";
   }
   
+
+  //---------------------------------------------------------------
   void 
   GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
               SALOME_MED::MESH_ptr theMEDMesh,
@@ -248,6 +255,7 @@ namespace{
   }
   
   
+  //---------------------------------------------------------------
   void 
   GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
               SALOME_MED::FAMILY_ptr theMEDFamily)
@@ -269,6 +277,7 @@ namespace{
   }
   
   
+  //---------------------------------------------------------------
   void
   GetCellsSize(VISU::PCMesh theMesh, 
               SALOME_MED::MESH_ptr theMEDMesh, 
@@ -277,17 +286,14 @@ namespace{
     TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
     VISU::PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[theEntity];
     if(theEntity == NODE_ENTITY){
-      theMesh->myNbPoints = theMEDMesh->getNumberOfNodes();
       aMeshOnEntity->myNbCells = theMesh->myNbPoints;
       aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
       vtkIdType aNbCells, aCellsSize;
       GetCellsSize(aNbCells,aCellsSize,theMEDMesh,CELL_ENTITY);
       if(aNbCells > 0){
-       
        TMeshOnEntityMap::iterator aIter = aMeshOnEntityMap.find(CELL_ENTITY);
        if (aIter != aMeshOnEntityMap.end()){
          VISU::PCMeshOnEntity aMeshOnCells = aIter->second;
-       
          aMeshOnCells->myEntity = VISU::CELL_ENTITY;
          aMeshOnCells->myMeshName = theMesh->myName;
          aMeshOnCells->myNbCells = aNbCells;
@@ -302,6 +308,7 @@ namespace{
 }
 
 
+//---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MEDFieldConvertor::Build()
 {
@@ -322,11 +329,15 @@ VISU_MEDFieldConvertor::Build()
   CORBA::String_var aFieldName = myField->getName();
 
   PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
+  aMesh->myNamedPointCoords(new TNamedPointCoords());
+  aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
   aMesh->myDim = aMEDMesh->getSpaceDimension();
-  aMesh->myPointsDim.resize(aMesh->myDim);
   aMesh->myName = aMeshName.in();
   aMesh->myMesh = aMEDMesh;
 
+  TNamedPointCoords& aCoords = aMesh->myNamedPointCoords;
+  aCoords.Init(aMesh->myNbPoints,aMesh->myDim);
+
   if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
   TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
@@ -354,10 +365,8 @@ VISU_MEDFieldConvertor::Build()
   aField->myName = aFieldName.in();
   aField->myEntity = aVEntity;
   aField->myMeshName = aMeshName.in();
-  aField->myNbComp = myField->getNumberOfComponents();
+  aField->InitArrays(myField->getNumberOfComponents());
   aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
-  aField->myCompNames.resize(aField->myNbComp);
-  aField->myUnitNames.resize(aField->myNbComp);
 
   if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
@@ -377,6 +386,7 @@ VISU_MEDFieldConvertor::Build()
 }
 
 
+//---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MEDConvertor::Build() 
 {
@@ -394,11 +404,14 @@ VISU_MEDConvertor::Build()
   return Build(aTimeStampIterator);
 }
 
+
 namespace{
 
   using namespace boost;
 
-  struct TSObjectByName{
+  //---------------------------------------------------------------
+  struct TSObjectByName
+  {
     std::string myName;
     typedef tuple<SALOMEDS::SObject_var> TRet;
 
@@ -421,7 +434,10 @@ namespace{
 
   };
 
-  struct TMeshByName{
+
+  //---------------------------------------------------------------
+  struct TMeshByName
+  {
     std::string myName;
     typedef tuple<SALOME_MED::MESH_var,SALOMEDS::SObject_var> TRet;
 
@@ -445,6 +461,8 @@ namespace{
     }
   };
 
+
+  //---------------------------------------------------------------
   template<typename TFun>
   typename TFun::TRet
   Find(SALOMEDS::SObject_ptr theStartSObj, 
@@ -466,6 +484,8 @@ namespace{
 
 }
 
+
+//---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
 {
@@ -498,11 +518,15 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
 
       PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
       SALOME_MED::MESH_var aMEDMesh = boost::get<0>(aMeshByNameRet);
+      aMesh->myNamedPointCoords(new TNamedPointCoords());
+      aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
       aMesh->myDim = aMEDMesh->getSpaceDimension();
       aMesh->myName = aMeshName.in();
-      aMesh->myPointsDim.resize(aMesh->myDim);
       aMesh->myMesh = aMEDMesh;
 
+      TNamedPointCoords& aCoords = aMesh->myNamedPointCoords;
+      aCoords.Init(aMesh->myNbPoints,aMesh->myDim);
+
       if(MYDEBUG) 
        MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
@@ -605,11 +629,11 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
          if(aNbCells > 0){
            TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
            PCFamily aFamily = aFamilyMap[aSupportName.in()](new TCFamily());
-           aFamily->myName = aSupportName.in();
            aFamily->myEntity = aVEntity;
            aFamily->myNbCells = aNbCells;
            aFamily->myCellsSize = aCellsSize;
            aFamily->myId = aMEDFamily->getIdentifier();
+           aFamily->myName = aSupportName.in();
            aFamily->myFamily = aMEDFamily;
          }
        }
@@ -644,30 +668,23 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
 
          PCGroup aGroup(new TCGroup());
          aGroup->myGroup = aMEDGroup;
-         aGroup->myName = aSupportName.in();
-         aGroup->myMeshName = aMeshName.in();
-         VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
+         VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
          
          SALOME_MED::Family_array_var aFamilies = aMEDGroup->getFamilies();
          int iFamilyEnd = aFamilies->length();
          for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
            SALOME_MED::FAMILY_var aMEDFamily = aFamilies[iFamaily];
            CORBA::String_var aFamilyName = aMEDFamily->getName();
-           PFamily aFamily = FindFamily(aMesh,aFamilyName.in());
+           TFindFamilyOnEntity aFindFamilyOnEntity = 
+             FindFamilyOnEntity(aMeshName.in(),aVEntity,aFamilyName.in());
+           PCFamily aFamily = boost::get<2>(aFindFamilyOnEntity);
            if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"' = "<<bool(aFamily));
            if(aFamily){
-             TFamilyAndEntity aFamilyAndEntity(aFamilyName.in(),aFamily->myEntity);
-             aFamilyAndEntitySet.insert(aFamilyAndEntity);
-             
-             aGroup->myNbCells += aFamily->myNbCells;
-             aGroup->myCellsSize += aFamily->myCellsSize;
-             
-             VISU::TBindGroups& aBindGroups = aFamily->myGroups;
-             aBindGroups.insert(aSupportName.in());
+             aFamilySet.insert(aFamily);
            }
          }
          
-         if(!aGroup->myFamilyAndEntitySet.empty()){
+         if(!aFamilySet.empty()){
            TGroupMap& aGroupMap = aMesh->myGroupMap;
            aGroupMap[aSupportName.in()] = aGroup;
          }
@@ -731,12 +748,10 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
          aField->myName = aFieldName.in();
          aField->myEntity = anEntity;
          aField->myMeshName = aMeshName.in();
-         aField->myNbComp = aMEDField->getNumberOfComponents();
+         aField->InitArrays(aMEDField->getNumberOfComponents());
          aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
          if(MYDEBUG) 
            MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
-         aField->myCompNames.resize(aField->myNbComp);
-         aField->myUnitNames.resize(aField->myNbComp);
        }else
          aField = aFieldMapIter->second;
 
@@ -757,6 +772,7 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
 }
  
 
+//---------------------------------------------------------------
 VISU_Convertor* 
 VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
 {
@@ -785,11 +801,15 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
     CORBA::String_var aFieldName = aMEDField->getName();
 
     PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
+    aMesh->myNamedPointCoords(new TNamedPointCoords());
+    aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
     aMesh->myDim = aMEDMesh->getSpaceDimension();
-    aMesh->myPointsDim.resize(aMesh->myDim);
     aMesh->myName = aMeshName.in();
-    aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
     aMesh->myMesh = aMEDMesh;
+
+    TNamedPointCoords& aCoords = aMesh->myNamedPointCoords;
+    aCoords.Init(aMesh->myNbPoints,aMesh->myDim);
+
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<"'; myDim = "<<aMesh->myDim);
 
     TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
@@ -797,17 +817,20 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
     aMeshOnEntity->myEntity = aVEntity;
     aMeshOnEntity->myMeshName = aMeshName.in();
     aMeshOnEntity->mySupport = aMEDSupport;
+
+    PCMeshOnEntity aMeshOnEntity2;
     if(aVEntity == NODE_ENTITY){
-      PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
-      *aMeshOnEntity2 = *aMeshOnEntity;
-      aMeshOnEntity->myEntity = CELL_ENTITY;
-      GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY);
+      aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
+      aMeshOnEntity2->myEntity = CELL_ENTITY;
     }else{
-      PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
-      *aMeshOnEntity2 = *aMeshOnEntity;
-      aMeshOnEntity->myEntity = NODE_ENTITY;
-      GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
+      aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
+      aMeshOnEntity2->myEntity = NODE_ENTITY;
     }
+
+    aMeshOnEntity2->myMeshName = aMeshName.in();
+    aMeshOnEntity2->mySupport = aMEDSupport;
+    GetCellsSize(aMesh,aMEDMesh,aMeshOnEntity2->myEntity);
+
     GetCellsSize(aMesh,aMEDMesh,aVEntity);
     TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
     TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
@@ -819,12 +842,10 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
       aField->myName = aFieldName.in();
       aField->myEntity = aVEntity;
       aField->myMeshName = aMeshName.in();
-      aField->myNbComp = aMEDField->getNumberOfComponents();
+      aField->InitArrays(aMEDField->getNumberOfComponents());
       aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
       if(MYDEBUG) 
        MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
-      aField->myCompNames.resize(aField->myNbComp);
-      aField->myUnitNames.resize(aField->myNbComp);
     }
     TValField& aValField = aField->myValField;
     int anId = aMEDField->getIterationNumber();
@@ -841,43 +862,65 @@ VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
 }
 
 
+//---------------------------------------------------------------
 int
-VISU_MEDConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                                   const string& theFamilyName)
+VISU_MEDConvertor
+::LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity)
 {
-  //Main part of code
-  const string& aMeshName = theMeshOnEntity->myMeshName;
   const TEntity& aVEntity = theMeshOnEntity->myEntity;
-  PCMesh aMesh = myMeshMap[aMeshName];
-  int isPointsUpdated;
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
   if(aVEntity == NODE_ENTITY) 
-    isPointsUpdated = LoadPoints(aMesh,theFamilyName);
-  else 
-    isPointsUpdated = LoadPoints(aMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMesh,theMeshOnEntity,theFamilyName);
+    isPointsUpdated += LoadPoints(theMesh);
+  else{
+    isPointsUpdated += LoadPoints(theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,theMeshOnEntity);
+  }
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
 }
  
  
+//---------------------------------------------------------------
+int
+VISU_MEDConvertor
+::LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily)
+{
+  const TEntity& anEntity = theMeshOnEntity->myEntity;
+  int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
+  if(anEntity == NODE_ENTITY){
+    isPointsUpdated += LoadPointsOnFamily(theMesh,theFamily);
+  }else{
+    isPointsUpdated += LoadPoints(theMesh);
+    isCellsOnEntityUpdated += LoadCellsOnFamily(theMesh,theMeshOnEntity,theFamily);
+  }
+
+  return (isPointsUpdated || isCellsOnEntityUpdated);
+}
+
+
+//---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
-                                  const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+VISU_MEDConvertor
+::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilySet& theFamilySet)
 {
   //Main part of code
   int isPointsUpdated = 0;
   int isCellsOnEntityUpdated = 0;
-  VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
-  for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
-    const string& aFamilyName = aFamilyAndEntitySetIter->first;
-    const VISU::TEntity& aVEntity = aFamilyAndEntitySetIter->second;
+  TFamilySet::const_iterator aFamilyIter = theFamilySet.begin();
+  for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){
+    PCFamily aFamily = *aFamilyIter;
+    const VISU::TEntity& aVEntity = aFamily->myEntity;
     PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
     if(aVEntity == VISU::NODE_ENTITY){
-      isPointsUpdated += LoadPoints(theMesh,aFamilyName);
+      isPointsUpdated += LoadPointsOnFamily(theMesh,aFamily);
       isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity);
     }else{
       isPointsUpdated += LoadPoints(theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnFamily(theMesh,aMeshOnEntity,aFamily);
     }
   }
 
@@ -885,11 +928,13 @@ VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh,
 }
 
 
+//---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
-                                  VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                                  VISU::PFieldImpl theField, 
-                                  VISU::PValForTimeImpl theValForTime)
+VISU_MEDConvertor
+::LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime)
 {
   //Main part of code
   int isPointsUpdated = LoadPoints(theMesh);
@@ -899,209 +944,298 @@ VISU_MEDConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh,
   return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
 }
 
+
+//---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadPoints(VISU::PCMesh theMesh, 
-                             const string& theFamilyName)
+VISU_MEDConvertor
+::LoadPoints(VISU::PCMesh theMesh)
 {
   //Check on existing family
   PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
-  PCFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+  
   //Check on loading already done
-  bool isPointsLoaded = !theMesh->myPointsCoord.empty();
-  if(isPointsLoaded) 
-    if(!aFamily) 
-      return 0;
-    else if(!aFamily->mySubMesh.empty()) 
-      return 0;
-
-  if(MYDEBUG) 
-    MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
-
+  if(theMesh->myIsDone) 
+    return 0;
+  
   SALOME_MED::MESH_var& aMedMesh = theMesh->myMesh;
-  int iNumElemEnd = aMedMesh->getNumberOfNodes();
-  TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
+  int aDim = theMesh->myDim;
+  TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+  int aNbElem = aCoords.GetNbPoints();
 
-  if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
+  if(MYDEBUG) MESSAGE("LoadPoints - aNbElem = "<<aNbElem);
 
-  if (iNumElemEnd <= 0) 
+  if(aNbElem <= 0) 
     throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
 
-  aPointsCoord.resize(theMesh->myDim*iNumElemEnd,0.0);
-  SALOME_MED::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
-  if(!isPointsLoaded){
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
-      for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iNumElem2Dim++)
-       aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
+  SALOME_MED::double_array_var aCCoord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
+  for(int iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+    VISU::TCoordSlice aCoordSlice = aCoords.GetCoordSlice(iElem);
+    for(int iDim = 0; iDim < aDim; iDim++)
+      aCoordSlice[iDim] = aCCoord[anId++];
+  }
+  
+  if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+  
+  TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
+  PSubMeshImpl aSubMesh = aGeom2SubMesh[VISU::ePOINT1](new TCSubMesh());
 
-    if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+  aSubMesh->myNbCells = theMesh->myNbPoints;
+  aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
 
-    TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
-    aConnForCellType.resize(iNumElemEnd);
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-      aConnForCellType[iNumElem] = TMeshOnEntityImpl::TConnect(1,iNumElem);
-  }
-  if(aFamily){
-    if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
-
-    SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
-    CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
-    TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
-
-    if(!anIsOnAllElements){
-      SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
-      SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
-      int iNumElemEndTmp = iNumElemEnd;
-      iNumElemEnd = aCellNumForType->length();
-      for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-       int tmp = aCellNumForType[iNumElem]-1;
-       if(0 > tmp || tmp >= iNumElemEndTmp) {
-         static QString aString;
-         aString.sprintf("LoadPoints >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEnd,iNumElem,tmp);
-         throw std::runtime_error(aString.latin1());
-       }
-       aSubMeshOnCellType.insert(tmp);
-      }
-    }else{
-      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
-       aSubMeshOnCellType.insert(iNumElem);
+  TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+  aCell2Connect.resize(aNbElem);
+  for(int iElem = 0; iElem < aNbElem; iElem++)
+    aCell2Connect[iElem] = TConnect(1,iElem);
+  
+  theMesh->myIsDone = true;
+
+  return 1;
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MEDConvertor
+::LoadPointsOnFamily(VISU::PCMesh theMesh, 
+                    VISU::PCFamily theFamily)
+{
+  PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+
+  if(theFamily->myIsDone) 
+    return 0;
+
+  TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+  int aNbElem = aCoords.GetNbPoints();
+
+  SALOME_MED::FAMILY_var aMedFamily = theFamily->myFamily;
+  CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
+  TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[VISU::ePOINT1];
+  
+  if(!anIsOnAllElements){
+    SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
+    SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
+    int aMaxElemId = aNbElem;
+    aNbElem = aCellNumForType->length();
+    for(int iElem = 0; iElem < aNbElem; iElem++){
+      int aTmp = aCellNumForType[iElem]-1;
+      if(0 > aTmp || aTmp >= aMaxElemId){
+       static QString aString;
+       aString.sprintf("LoadPointsOnFamily - aMaxElemId(%d) <= aCellNumForType[%d]=%d < 0",aMaxElemId,iElem,aTmp);
+       throw std::runtime_error(aString.latin1());
       }
+      aSubMeshID.push_back(aTmp);
+    }
+  }else{
+    for(int iElem = 0; iElem < aNbElem; iElem++){
+      aSubMeshID.push_back(iElem);
     }
   }
+  
+  theFamily->myIsDone = true;
+
   return 1;
 }
 
 
+//---------------------------------------------------------------
 int 
-VISU_MEDConvertor::LoadCellsOnEntity(VISU::PCMesh theMesh,
-                                    VISU::PCMeshOnEntity theMeshOnEntity, 
-                                    const string& theFamilyName)
+VISU_MEDConvertor
+::LoadCellsOnEntity(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity)
 {
-  //Check on existing family
-  PCFamily aFamily = GetFamily(theMeshOnEntity,theFamilyName);
-  //Check on loading already done
-  bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
-  if(isCellsLoaded) 
-    if(!aFamily) 
-      return 0;
-    else if(!aFamily->mySubMesh.empty()) 
-      return 0;
+  if(theMeshOnEntity->myIsDone) 
+    return 0;
 
   SALOME_MED::SUPPORT_var& aMedSupport = theMeshOnEntity->mySupport;
   SALOME_MED::MESH_var aMedMesh = aMedSupport->getMesh();
-  if(MYDEBUG) {
-    MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
-    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily));
-  }
 
   //Main part of code
   SALOME_MED::medGeometryElement* aGeomElems;
   const TEntity& aVEntity = theMeshOnEntity->myEntity;
   int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
   const SALOME_MED::medEntityMesh& aMEntity = VTKEntityToMED(aVEntity);
-  int aNbPoints = theMesh->myPointsCoord.size()/theMesh->myDim;
-  if(!isCellsLoaded){
-    for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
-      SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
-      int aMNbNodes = MEDGeom2NbNodes(aGeom);
-      int aVGeom = MEDGeomToVTK(aGeom);
-      int aVNbNodes = VTKGeom2NbNodes(aVGeom);
-      int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aGeom);
-      if (iNumElemEnd > 0) {
-       SALOME_MED::long_array_var conn = 
-         aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
-       TMeshOnEntityImpl::TConnForCellType& aConnForCellType = theMeshOnEntity->myCellsConn[aVGeom];
-       //APO - aConnForCellType.resize(iNumElemEnd);
-       vector<int> aConnect(aMNbNodes);
-       int aNbConnForElem = conn->length()/iNumElemEnd;
-       if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
-                           "; iNumElemEnd = "<<iNumElemEnd<<
-                           "; aNbConnForElem = "<<aNbConnForElem);
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-         VISU::TMeshOnEntityImpl::TConnect anArray(aVNbNodes);
-         for (int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++) {
-           aConnect[k] = conn[kj+k] - 1;
-         }
-         switch(aGeom){
-         case SALOME_MED::MED_TETRA4 :
-         case SALOME_MED::MED_TETRA10 :
-           anArray[0] = aConnect[0];
-           anArray[1] = aConnect[1];
-           anArray[2] = aConnect[3];  
-           anArray[3] = aConnect[2];  
-           break;
-         case SALOME_MED::MED_PYRA5 :
-         case SALOME_MED::MED_PYRA13 :
-           anArray[0] = aConnect[0];
-           anArray[1] = aConnect[3];  
-           anArray[2] = aConnect[2];
-           anArray[3] = aConnect[1];  
-           anArray[4] = aConnect[4];
-           break;
-         default:
-           for (int k = 0; k < aVNbNodes; k++) 
-             anArray[k] = aConnect[k];
-         }
+  const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+  TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+  int aNbPoints = aCoords.GetNbPoints();
+
+  for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
+    SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
+    int aMNbNodes = MEDGeom2NbNodes(aMGeom);
+    VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+    int aVNbNodes = VISUGeom2NbNodes(aEGeom);
+    int aNbElem = aMedMesh->getNumberOfElements(aMEntity,aMGeom);
+    if (aNbElem > 0) {
+      using namespace SALOME_MED;
+      SALOME_MED::long_array_var conn = 
+       aMedMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,aMEntity,aMGeom);
+      PSubMeshImpl aSubMesh = aGeom2SubMesh[aEGeom](new TCSubMesh());
+
+      aSubMesh->myNbCells = aNbElem;      
+      aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
+
+      TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
+      std::vector<int> aConnect(aMNbNodes);
+      int aNbConnForElem = conn->length()/aNbElem;
+
+      if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aMGeom = "<<aMGeom<<
+                         "; aNbElem = "<<aNbElem<<
+                         "; aMNbNodes = "<<aMNbNodes<<
+                         "; aVNbNodes = "<<aVNbNodes<<
+                         "; aNbConnForElem = "<<aNbConnForElem);
+
+      for(int iElem = 0; iElem < aNbElem; iElem++){
+       VISU::TConnect anArray(aVNbNodes);
+       for(int k = 0, kj = iElem*aNbConnForElem; k < aMNbNodes; k++)
+         aConnect[k] = conn[kj+k] - 1;
+
+       switch(aMGeom){
+#if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_SEG3:
+         anArray[0] = aConnect[0];
+         anArray[2] = aConnect[1];  
+         
+         anArray[1] = aConnect[2];
+         break;
+#endif
+#if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_TRIA6:
+         anArray[0] = aConnect[0];
+         anArray[2] = aConnect[1];  
+         anArray[4] = aConnect[2];  
+         
+         anArray[1] = aConnect[3];
+         anArray[3] = aConnect[4];  
+         anArray[5] = aConnect[5];  
+         break;
+#endif
+#if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_QUAD8:
+         anArray[0] = aConnect[0];
+         anArray[2] = aConnect[1];  
+         anArray[4] = aConnect[2];  
+         anArray[6] = aConnect[3];  
+         
+         anArray[1] = aConnect[4];
+         anArray[3] = aConnect[5];  
+         anArray[5] = aConnect[6];  
+         anArray[7] = aConnect[7];  
+         break;
+#endif
+#if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_TETRA10 :
+#endif
+       case SALOME_MED::MED_TETRA4 :
+         anArray[0] = aConnect[0];
+         anArray[1] = aConnect[1];
+         anArray[2] = aConnect[3];  
+         anArray[3] = aConnect[2];  
+         break;
+#if (defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC)
+       case SALOME_MED::MED_PYRA13:
+#endif
+       case SALOME_MED::MED_PYRA5 :
+         anArray[0] = aConnect[0];
+         anArray[1] = aConnect[3];  
+         anArray[2] = aConnect[2];
+         anArray[3] = aConnect[1];  
+         anArray[4] = aConnect[4];
+         break;
+       default:
          for (int k = 0; k < aVNbNodes; k++) 
-           if(anArray[k] < 0 || aNbPoints <= anArray[k]){
-             static QString aString;
-             aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
-             throw std::runtime_error(aString.latin1());
-           }
-         aConnForCellType.push_back(anArray);
+           anArray[k] = aConnect[k];
        }
-       //Workaround for MED Component data structure
-       int aSize = aConnForCellType.size();
-       theMeshOnEntity->myCellsFirstIndex[aGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
-       aCounter += aSize;
-      }
-    }
-  }
-  //Filling aFamily SubMesh
-  if(aFamily){
-    SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
-    CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
-    if(!anIsOnAllElements){
-      SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
-      iGeomEnd = aGeoms->length();
-      if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
-      for (int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
-       SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
-       SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
-       int aVGeom = MEDGeomToVTK(aGeom);
-       TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom]; 
-       int iNumElemEndTmp = theMeshOnEntity->myCellsConn[aVGeom].size();
-       int iNumElemEnd = aCellNumForType->length();
-       int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
-       if(MYDEBUG) 
-         MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
-                 "; iNumElemEnd = "<<iNumElemEnd<<
-                 "; aCounter = "<<aCounter);
-       for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-         int tmp = aCellNumForType[iNumElem]-aCounter-1;
-         if(0 > tmp || tmp >= iNumElemEndTmp) {
+       for (int k = 0; k < aVNbNodes; k++) 
+         if(anArray[k] < 0 || aNbPoints <= anArray[k]){
            static QString aString;
-           aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+           aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iElem,k,anArray[k]);
            throw std::runtime_error(aString.latin1());
          }
-         aSubMeshOnCellType.insert(tmp);
-       }
+       aCell2Connect.push_back(anArray);
       }
-    }else{
-      const TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
-      TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
-      for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-       int aVGeom = aCellsConnIter->first;
-       const TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConnIter->second;
-       TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom];
-       int iNumElemEnd = aConnForCellType.size();
-       for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-         aSubMeshOnCellType.insert(iNumElem);
+      //Workaround for MED Component data structure
+      int aSize = aCell2Connect.size();
+      theMeshOnEntity->myCellsFirstIndex[aMGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
+      aCounter += aSize;
+    }
+  }
+
+  theMeshOnEntity->myIsDone = true;
+
+  return 1;
+}
+
+
+//---------------------------------------------------------------
+int 
+VISU_MEDConvertor
+::LoadCellsOnFamily(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity, 
+                   VISU::PCFamily theFamily)
+{
+  if(theFamily->myIsDone) 
+    return 0;
+
+  const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+  SALOME_MED::FAMILY_var aMedFamily = theFamily->myFamily;
+  CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements();
+  if(!anIsOnAllElements){
+    SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
+    int iGeomEnd = aGeoms->length();
+    if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
+    for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
+      SALOME_MED::medGeometryElement aMGeom = aGeoms[iGeom];
+      SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aMGeom);
+      VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+
+      int iNumElemEndTmp = 0;
+      TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.find(aEGeom);
+      if(anIter != aGeom2SubMesh.end()){
+       const VISU::TSubMeshImpl& aSubMesh = anIter->second;
+       const VISU::TCell2Connect& anArray = aSubMesh.myCell2Connect;
+       iNumElemEndTmp = anArray.size();
       }
+
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aEGeom]; 
+
+      int iNumElemEnd = aCellNumForType->length();
+      int aCounter = theMeshOnEntity->myCellsFirstIndex[aMGeom].first;
+      
+      if(MYDEBUG) 
+       MESSAGE("LoadCellsOnFamily "<<
+               "- aMGeom = "<<aMGeom<<
+               "; iNumElemEnd = "<<iNumElemEnd<<
+               "; aCounter = "<<aCounter);
+      
+      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++){
+       int tmp = aCellNumForType[iNumElem]-aCounter-1;
+       if(0 > tmp || tmp >= iNumElemEndTmp){
+         static QString aString;
+         aString.sprintf("LoadCellsOnEntity >> iNumElemEndTmp(%d) <= aCellNumForType[%d]=%d < 0 !!!",iNumElemEndTmp,iNumElem,tmp);
+         throw std::runtime_error(aString.latin1());
+       }
+       aSubMeshID.push_back(tmp);
+      }
+    }
+  }else{
+    const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh;
+    VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
+    for(; anIter != aGeom2SubMesh.end(); anIter++){
+      VISU::EGeometry aEGeom = anIter->first;
+      const VISU::TSubMeshImpl& aSubMesh = anIter->second;
+      const VISU::TCell2Connect& aCell2Connect = aSubMesh.myCell2Connect;
+      TSubMeshID& aSubMeshID = theFamily->myGeom2SubMeshID[aEGeom];
+      int iNumElemEnd = aCell2Connect.size();
+      for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+       aSubMeshID.push_back(iNumElem);
     }
   }
+  
+  theFamily->myIsDone = true;
+
   return 1;
 }
 
+
 template<class TArray> 
 int 
 ImportField(TArray& theArray, 
@@ -1110,35 +1244,56 @@ ImportField(TArray& theArray,
            VISU::PCValForTime theValForTime,
            VISU::PCMeshOnEntity theMeshOnEntity)
 {
+  int aNbComp = theField->myNbComp;
   if(theField->myEntity == NODE_ENTITY){
-    TValForTimeImpl::TValForCellsWithType& aValForCellsWithType = 
-      theValForTime->myValForCells[VTK_VERTEX];
-    int iNumElemEnd = theMesh->myPointsCoord.size()/theMesh->myDim*theField->myNbComp;
-    if(MYDEBUG) MESSAGE("ImportField - iNumElemEnd = "<<iNumElemEnd);
-    aValForCellsWithType.resize(iNumElemEnd);
-    for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
-      aValForCellsWithType[iNumElem] = theArray[iNumElem];
+    VISU::EGeometry aEGeom = VISU::ePOINT1;
+    int aNbGauss = theValForTime->GetNbGauss(aEGeom);
+    const TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
+    int aNbPoints = aCoords.GetNbPoints();
+    int aNbElem = aNbPoints*aNbComp;
+
+    if(MYDEBUG) MESSAGE("ImportField - aNbElem = "<<aNbElem);
+
+    TMeshValue& aMeshValue = theValForTime->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 aGeom = aGeomElems[iGeom];
-      int aVGeom = MEDGeomToVTK(aGeom);
+      SALOME_MED::medGeometryElement aMGeom = aGeomElems[iGeom];
+      VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom);
+      int aNbGauss = theValForTime->GetNbGauss(aEGeom);
       const TCMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex;
-      TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aGeom);
+      TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMGeom);
       if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
        const TCMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
-       int iNumElemEnd = aIndexAndSize.second;
        if(MYDEBUG) 
-         MESSAGE("ImportField - aGeom = "<<aGeom<<
+         MESSAGE("ImportField - aMGeom = "<<aMGeom<<
                  "; aIndexAndSize = {"<<aIndexAndSize.first<<
                  ","<<aIndexAndSize.second<<"}");
-       TValForTimeImpl::TValForCellsWithType& aValForCellsWithType = theValForTime->myValForCells[aVGeom];
-       aValForCellsWithType.resize(iNumElemEnd*theField->myNbComp);
-       for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-         for(int k = 0, kj = iNumElem*theField->myNbComp; k < theField->myNbComp; k++)
-           aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField->myNbComp+kj+k];
+
+       int aNbElem = aIndexAndSize.second;
+       int aStart = aIndexAndSize.first*aNbComp;
+       TMeshValue& aMeshValue = theValForTime->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];
+         }
+       }
       }
     }
   }
@@ -1146,15 +1301,21 @@ ImportField(TArray& theArray,
 }
 
 int
-VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh,
-                            VISU::PCMeshOnEntity theMeshOnEntity,
-                            VISU::PField theField, 
-                            VISU::PCValForTime theValForTime)
+VISU_MEDConvertor
+::LoadField(VISU::PCMesh theMesh,
+           VISU::PCMeshOnEntity theMeshOnEntity,
+           VISU::PField theField, 
+           VISU::PCValForTime theValForTime)
 {
   //Check on loading already done
-  if(!theValForTime->myValForCells.empty()) 
+  PIDMapperFilter anIDMapperFilter = theValForTime->myIDMapperFilter;
+  if(anIDMapperFilter->myIsVTKDone) 
     return 0;
+  
+  PCProfile aProfile(new TCProfile());
+  aProfile->myIsAll = true;
+  theValForTime->myProfile = aProfile;
+
   SALOME_MED::FIELD_var aMEDField = theValForTime->myField;
   SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
   if(!aFieldDouble->_is_nil()){
@@ -1168,5 +1329,8 @@ VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh,
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
     ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
   }
+
+  anIDMapperFilter->myIsVTKDone = true;
+
   return 1;
 }
index 6b7c94107ae077047bfd960a113b1fcc7ed26f90..f4a975aae5375fef6d5f5732e19851e73ad7a6e3 100644 (file)
 
 #include <string>      
 
-namespace VISU{
-
-  struct TCMesh: TMeshImpl{
+namespace VISU
+{
+  //---------------------------------------------------------------
+  struct TCMesh: virtual TMeshImpl
+  {
     SALOME_MED::MESH_var myMesh;
   };
-  typedef shared_ptr<TCMesh> PCMesh;
+  typedef SharedPtr<TCMesh> PCMesh;
+
+
+  //---------------------------------------------------------------
+  struct TCProfile: virtual TProfileImpl
+  {};
+  typedef SharedPtr<TCProfile> PCProfile;
+
+
+  //---------------------------------------------------------------
+  struct TCSubMesh: virtual TSubMeshImpl
+  {};
+  typedef SharedPtr<TCSubMesh> PCSubMesh;
+
 
-  struct TCMeshOnEntity: TMeshOnEntityImpl{
+  //---------------------------------------------------------------
+  struct TCMeshOnEntity: virtual TMeshOnEntityImpl
+  {
     SALOME_MED::SUPPORT_var mySupport;
     typedef std::pair<int,int> TIndexAndSize;
     typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
     TCellsFirstIndex myCellsFirstIndex;
   };
-  typedef shared_ptr<TCMeshOnEntity> PCMeshOnEntity;
+  typedef SharedPtr<TCMeshOnEntity> PCMeshOnEntity;
   
-  struct TCFamily: TFamilyImpl{
+
+  //---------------------------------------------------------------
+  struct TCFamily: virtual TFamilyImpl
+  {
     SALOME_MED::FAMILY_var myFamily;
   };
-  typedef shared_ptr<TCFamily> PCFamily;
+  typedef SharedPtr<TCFamily> PCFamily;
   
-  struct TCGroup: TGroupImpl{
+
+  //---------------------------------------------------------------
+  struct TCGroup: virtual TGroupImpl
+  {
     SALOME_MED::GROUP_var myGroup;
   };
-  typedef shared_ptr<TCGroup> PCGroup;
+  typedef SharedPtr<TCGroup> PCGroup;
 
-  struct TCField: TFieldImpl{
-  };
-  typedef shared_ptr<TCField> PCField;
 
-  struct TCValForTime: TValForTimeImpl{
+  //---------------------------------------------------------------
+  struct TCField: virtual TFieldImpl
+  {};
+  typedef SharedPtr<TCField> PCField;
+
+
+  //---------------------------------------------------------------
+  struct TCValForTime: virtual TValForTimeImpl
+  {
     SALOME_MED::FIELD_var myField;
   };
-  typedef shared_ptr<TCValForTime> PCValForTime;
+  typedef SharedPtr<TCValForTime> PCValForTime;
 
 }
 
@@ -78,47 +106,93 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
   VISU_MEDConvertor() {};
 
  public:
-  VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject) : mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) {}
-  virtual VISU_Convertor* Build();
-
- protected:
-
-  VISU_Convertor* Build(SALOME_MED::MED_ptr theMED);
-  VISU_Convertor* Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
-
-  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                              const std::string& theFamilyName = "");
+  VISU_MEDConvertor(SALOMEDS::SObject_ptr theMedSObject): 
+    mySObject(SALOMEDS::SObject::_duplicate(theMedSObject)) 
+  {}
 
-  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
-                             const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
+  virtual
+  VISU_Convertor* 
+  Build();
 
-  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
-                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
-                             VISU::PFieldImpl theField, 
-                             VISU::PValForTimeImpl theValForTime);
+ protected:
 
-  int LoadPoints(VISU::PCMesh theMesh,
-                const std::string& theFamilyName = "") ;
+  VISU_Convertor* 
+  Build(SALOME_MED::MED_ptr theMED);
+  
+  VISU_Convertor* 
+  Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
 
-  int LoadCellsOnEntity(VISU::PCMesh theMesh,
-                       VISU::PCMeshOnEntity theMeshOnEntity, 
-                       const std::string& theFamilyName = "");
+  virtual
+  int
+  LoadMeshOnEntity(VISU::PMeshImpl theMesh,
+                  VISU::PMeshOnEntityImpl theMeshOnEntity);
   
-  int LoadField(VISU::PCMesh theMesh,
-               VISU::PCMeshOnEntity theMeshOnEntity,
-               VISU::PField theField, 
-               VISU::PCValForTime theValForTime);
+  virtual
+  int
+  LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
+                    VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                    VISU::PFamilyImpl theFamily);
+  
+  virtual
+  int
+  LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
+                 const VISU::TFamilySet& theFamilySet);
+
+  virtual 
+  int
+  LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
+                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                      VISU::PFieldImpl theField, 
+                      VISU::PValForTimeImpl theValForTime);
+
+  virtual
+  int
+  LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
+                          VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                          VISU::PFieldImpl theField, 
+                          VISU::PValForTimeImpl theValForTime)
+  {
+    return 0;
+  }
+
+  int 
+  LoadPoints(VISU::PCMesh theMesh) ;
+
+  int 
+  LoadPointsOnFamily(VISU::PCMesh theMesh, 
+                    VISU::PCFamily theFamily) ;
+
+  int 
+  LoadCellsOnEntity(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity);
+  
+  int 
+  LoadCellsOnFamily(VISU::PCMesh theMesh,
+                   VISU::PCMeshOnEntity theMeshOnEntity, 
+                   VISU::PCFamily theFamily);
+  
+  int 
+  LoadField(VISU::PCMesh theMesh,
+           VISU::PCMeshOnEntity theMeshOnEntity,
+           VISU::PField theField, 
+           VISU::PCValForTime theValForTime);
 
 };
 
-class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
+class VISU_MEDFieldConvertor: public VISU_MEDConvertor
+{
  protected:
   SALOME_MED::FIELD_var myField;
+
  public:
+
   VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
     myField(SALOME_MED::FIELD::_duplicate(theField)) 
   {}
-  virtual VISU_Convertor* Build() ;
+
+  virtual 
+  VISU_Convertor* 
+  Build();
 };
 
 extern "C" {
index d542b221b8865cf642f28e0852d631a71c1818d6..90eb9f0c93d6daf550e97236c501b4d0aafdb4d8 100644 (file)
 //  Author : Alexey PETROV
 //  Module : VISU
 
-#include "VISU_CutLinesPL.hxx"
-#include "VISU_Result_i.hh"
 #include "VISU_CutLines_i.hh"
-#include "VISU_Actor.h"
+#include "VISU_Result_i.hh"
 
+#include "VISU_Actor.h"
+#include "VISU_CutLinesPL.hxx"
+#include "VISU_Convertor.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
 #include <vtkAppendPolyData.h>
@@ -62,10 +63,10 @@ CutLines_i(Result_i* theResult,
           bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
   myCutLinesPL(NULL)
-{
-}
+{}
 
 
 VISU::CutLines_i::
@@ -73,6 +74,7 @@ CutLines_i(Result_i* theResult,
           SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
   myCutLinesPL(NULL)
 {
@@ -248,6 +250,17 @@ void VISU::CutLines_i::DoHook(){
   ScalarMap_i::DoHook();
 }
 
+VISU_Actor* 
+VISU::CutLines_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+    anActor->SetVTKMapping(true);
+    return anActor;
+  }
+  return NULL;
+}
+
 void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
   try{
     if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
index 81ba7ffa206c537640a23cea656f0e7d5abe3be3..cbc68366e1c64d375fe1d74944d66ec5f8dfcbdc 100644 (file)
@@ -102,6 +102,10 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap);
 
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
     void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
 
     static const std::string myComment;
index b0dca7d0340edd9ddbc094c9e280f965eb439483..cff4a1a2cfd95b4cc31aeb1074d9af03727e626f 100644 (file)
@@ -58,10 +58,10 @@ CutPlanes_i(Result_i* theResult,
            bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
   myCutPlanesPL(NULL)
-{
-}
+{}
 
 
 VISU::CutPlanes_i::
@@ -69,10 +69,10 @@ CutPlanes_i(Result_i* theResult,
            SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
   myCutPlanesPL(NULL)
-{
-}
+{}
 
 
 void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin){
@@ -185,3 +185,15 @@ void VISU::CutPlanes_i::DoHook(){
 
   ScalarMap_i::DoHook();
 }
+
+VISU_Actor* 
+VISU::CutPlanes_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+    anActor->SetVTKMapping(true);
+    return anActor;
+  }
+  return NULL;
+}
+
index 28abd7d30165de36dc2fed1f4b3db60fb1489666..b68062433558f41aacf53d253b4df4b1686d3116 100644 (file)
@@ -87,6 +87,10 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap);
 
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
     static const std::string myComment;
     virtual const char* GetComment() const;
     virtual QString GenerateName();
index 1198ad2d3d31b797a08d9d0136589fdc4eedb4db..ae4dbe45f9329356342ad81a693c89c9a7e4f84d 100644 (file)
 //  Author : Alexey PETROV
 //  Module : VISU
 
-#include "VISU_DeformedShapePL.hxx"
-#include "VISU_Result_i.hh"
 #include "VISU_DeformedShape_i.hh"
+#include "VISU_Result_i.hh"
+
 #include "VISU_ScalarMapAct.h"
+#include "VISU_DeformedShapePL.hxx"
+#include "VISU_Convertor.hxx"
 
 #include <vtkDataSetMapper.h>
 
@@ -67,6 +69,7 @@ DeformedShape_i(Result_i* theResult,
                bool theAddToStudy) : 
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
   myDeformedShapePL(NULL)
 {
@@ -79,6 +82,7 @@ DeformedShape_i(Result_i* theResult,
                SALOMEDS::SObject_ptr theSObject) : 
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
   myDeformedShapePL(NULL)
 {
@@ -157,11 +161,14 @@ void VISU::DeformedShape_i::SetMapScale(double theMapScale){
 }
 
 
-VISU_Actor* VISU::DeformedShape_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+VISU_Actor* 
+VISU::DeformedShape_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
 {
   VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO);
   anActor->SetRepresentation(1);
   anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
+  anActor->SetVTKMapping(false);
   return anActor;
 }
 
index a930c37df2daed393f0682929b629a7623eb1688..396060115188d6ea97b249bc28799a212418eed9 100644 (file)
@@ -85,7 +85,9 @@ namespace VISU{
 
     virtual void SetMapScale(double theMapScale = 1.0);
 
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
 
     virtual void UpdateActor(VISU_Actor* theActor) ;
   };
diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc
new file mode 100644 (file)
index 0000000..71750c4
--- /dev/null
@@ -0,0 +1,719 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//  File   :
+//  Author :
+//  Module :
+
+#include "VISU_GaussPoints_i.hh"
+#include "VISU_ScalarMap_i.hh"
+
+#include "VISU_Result_i.hh"
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPointsPL.hxx"
+
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+#include "VISU_ScalarBarCtrl.hxx"
+
+#include "SUIT_ResourceMgr.h"
+
+#include <vtkImageData.h>
+#include <vtkXMLImageDataReader.h>
+#include <vtkScalarBarActor.h>
+#include <vtkTextProperty.h>
+
+
+using namespace VISU;
+using namespace std;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//----------------------------------------------------------------------------
+int
+VISU::GaussPoints_i
+::IsPossible(Result_i* theResult, 
+            const char* theMeshName, 
+            VISU::Entity theEntity, 
+            const char* theFieldName, 
+            int theIteration, 
+            int isMemoryCheck)
+{
+  try{
+    if(theEntity != VISU::NODE)
+      return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
+    else
+      return false;
+  }catch(std::exception& exc){
+    INFOS("Follow exception was occured :\n"<<exc.what());
+  }catch(...){
+    INFOS("Unknown exception was occured!");
+  }
+  return 0;
+}
+
+//----------------------------------------------------------------------------
+int VISU::GaussPoints_i::myNbPresent = 0;
+
+QString 
+VISU::GaussPoints_i
+::GenerateName()
+{
+  return VISU::GenerateName("Gauss Points",myNbPresent++);
+}
+
+//----------------------------------------------------------------------------
+const string VISU::GaussPoints_i::myComment = "GAUSSPOINTS";
+
+const char* 
+VISU::GaussPoints_i
+::GetComment() const 
+{ 
+  return myComment.c_str();
+}
+
+
+//----------------------------------------------------------------------------
+VISU::GaussPoints_i::
+GaussPoints_i(Result_i* theResult, 
+             bool theAddToStudy) : 
+  PrsObject_i(theResult->GetStudyDocument()), 
+  Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
+  myGaussPointsPL(NULL),
+  myIsColored(true),
+  myColor(Qt::blue),
+  myIsActiveLocalScalarBar(true),
+  myIsDispGlobalScalarBar(true),
+  mySpacing(0.01)
+{
+  if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::GaussPoints_i::
+GaussPoints_i(Result_i* theResult, 
+             SALOMEDS::SObject_ptr theSObject) : 
+  PrsObject_i(theResult->GetStudyDocument()), 
+  Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
+  myGaussPointsPL(NULL),
+  myIsColored(true),
+  myColor(Qt::blue),
+  myIsActiveLocalScalarBar(true),
+  myIsDispGlobalScalarBar(true)
+{
+  if(MYDEBUG) MESSAGE("GaussPoints_i::GaussPoints_i - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::GaussPoints_i
+::Create(const char* theMeshName, 
+        VISU::Entity theEntity, 
+        const char* theFieldName, 
+        int theIteration)
+{
+  TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
+
+  SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+
+  int anActiveLocal = aResourceMgr->integerValue( "VISU", "scalar_bar_active_local", GetIsActiveLocalScalarBar() );
+  SetIsActiveLocalScalarBar( anActiveLocal == 0 );
+
+  bool aDisplayGlobal = aResourceMgr->booleanValue( "VISU", "scalar_bar_diplay_global", GetIsDispGlobalScalarBar() );
+  SetIsDispGlobalScalarBar( aDisplayGlobal );
+
+  int aBicolor = aResourceMgr->integerValue( "VISU", "scalar_bar_bicolor", GetBiColor() );
+  SetBiColor( aBicolor == 0 );
+
+  float aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() );
+  SetSpacing( aSpacing );
+
+  float aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() );
+  SetClamp( aClamp );
+
+  float aMinSize = aResourceMgr->doubleValue( "VISU", "point_sprite_min_size", GetMinSize() );
+  SetMinSize( aMinSize );
+
+  float aMaxSize = aResourceMgr->doubleValue( "VISU", "point_sprite_max_size", GetMaxSize() );
+  SetMaxSize( aMaxSize );
+
+  float aConstSize = aResourceMgr->doubleValue( "VISU", "point_sprite_size", GetConstSize() );
+  SetConstSize( aConstSize );
+
+  float aMagnification = aResourceMgr->doubleValue( "VISU", "point_sprite_magnification", GetMagnification() );
+  SetMagnification( aMagnification );
+
+  float anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() );
+  SetMagnificationIncrement( anIncrement );
+
+  bool isColored = aResourceMgr->booleanValue( "VISU", "point_sprite_results", GetIsColored() );
+  SetIsColored( isColored );
+
+  QColor aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", GetColor() );
+  SetColor( aColor );
+
+  float anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() );
+  SetAlphaThreshold( anAlphaThreshold );
+
+  QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
+  aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture );
+
+  QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
+  anAlphaTexture = aResourceMgr->stringValue( "VISU", "point_sprite_alpha_texture", anAlphaTexture );
+
+  SetTextures( aMainTexture, anAlphaTexture );
+
+  return this;
+}
+
+
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::GaussPoints_i
+::Restore(const Storable::TRestoringMap& theMap)
+{
+  TSuperClass::Restore(theMap);
+
+  SetIsActiveLocalScalarBar(Storable::FindValue(theMap,"myIsActiveLocalScalarBar").toInt());
+  SetIsDispGlobalScalarBar(Storable::FindValue(theMap,"myIsDispGlobalScalarBar").toInt());
+  SetBiColor(Storable::FindValue(theMap,"myIsBiColor").toInt());
+  SetSpacing(Storable::FindValue(theMap,"mySpacing").toDouble());
+
+  SetClamp(Storable::FindValue(theMap,"myClamp").toDouble());
+  SetMinSize(Storable::FindValue(theMap,"myMinSize").toDouble());
+  SetMaxSize(Storable::FindValue(theMap,"myMaxSize").toDouble());
+  SetConstSize(Storable::FindValue(theMap,"myConstSize").toDouble());
+
+  SetMagnification(Storable::FindValue(theMap,"myMagnification").toDouble());
+  SetMagnificationIncrement(Storable::FindValue(theMap,"myMagnificationIncrement").toDouble());
+
+  SetIsColored(Storable::FindValue(theMap,"myIsColored").toInt());
+  int aRed = Storable::FindValue(theMap,"myColor.R").toInt();
+  int aGreen = Storable::FindValue(theMap,"myColor.G").toInt();
+  int aBlue = Storable::FindValue(theMap,"myColor.B").toInt();
+  SetColor( QColor(aRed,aGreen,aBlue) );
+
+  SetAlphaThreshold(Storable::FindValue(theMap,"myAlphaThreshold").toDouble());
+
+  SetTextures( Storable::FindValue(theMap,"myMainTexture"),
+              Storable::FindValue(theMap,"myAlphaTexture") );
+
+  return this;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
+
+  Storable::DataToStream( theStr, "myIsActiveLocalScalarBar", myIsActiveLocalScalarBar );
+  Storable::DataToStream( theStr, "myIsDispGlobalScalarBar", myIsDispGlobalScalarBar );
+  Storable::DataToStream( theStr, "myIsBiColor", GetBiColor() );
+  Storable::DataToStream( theStr, "mySpacing", GetSpacing() );
+
+  Storable::DataToStream( theStr, "myClamp", GetClamp() );
+  Storable::DataToStream( theStr, "myMinSize", GetMinSize() );
+  Storable::DataToStream( theStr, "myMaxSize", GetMaxSize() );
+  Storable::DataToStream( theStr, "myConstSize", GetConstSize() );
+
+  Storable::DataToStream( theStr, "myMagnification", GetMagnification() );
+  Storable::DataToStream( theStr, "myMagnificationIncrement", GetMagnificationIncrement() );
+
+  Storable::DataToStream( theStr, "myIsColored", GetIsColored() );
+  QColor aColor = GetColor();
+  Storable::DataToStream( theStr, "myColor.R", aColor.red() );
+  Storable::DataToStream( theStr, "myColor.G", aColor.green() );
+  Storable::DataToStream( theStr, "myColor.B", aColor.blue() );
+
+  Storable::DataToStream( theStr, "myAlphaThreshold", GetAlphaThreshold() );
+  Storable::DataToStream( theStr, "myMainTexture", GetMainTexture() );
+  Storable::DataToStream( theStr, "myAlphaTexture", GetAlphaTexture() );
+}
+
+
+VISU::GaussPoints_i
+::~GaussPoints_i()
+{
+  if(MYDEBUG) MESSAGE("GaussPoints_i::~GaussPoints_i() - this = "<<this);
+}
+
+
+//----------------------------------------------------------------------------
+VISU_GaussPointsPL* 
+VISU::GaussPoints_i
+::GetGaussPointsPL()
+{ 
+  return myGaussPointsPL; 
+}
+
+void
+VISU::GaussPoints_i
+::SetIsColored( bool theIsColored )
+{
+  myIsColored = theIsColored;
+  myGaussPointsPL->SetIsColored( theIsColored );
+}
+
+bool
+VISU::GaussPoints_i
+::SetMainTexture( const QString& theMainTexture ) 
+{
+  bool update = myMainTexture != theMainTexture;
+  myMainTexture = theMainTexture;
+  return update;
+}
+
+const QString&
+VISU::GaussPoints_i
+::GetMainTexture() 
+{ 
+  return myMainTexture; 
+}
+
+bool
+VISU::GaussPoints_i
+::SetAlphaTexture( const QString& theAlphaTexture ) 
+{
+  bool update = myAlphaTexture != theAlphaTexture;
+  myAlphaTexture = theAlphaTexture;
+  return update;
+}
+
+const QString&
+VISU::GaussPoints_i
+::GetAlphaTexture() 
+{ 
+  return myAlphaTexture; 
+}
+
+void
+VISU::GaussPoints_i
+::SetAlphaThreshold( float theAlphaThreshold )
+{
+  myGaussPointsPL->SetAlphaThreshold( theAlphaThreshold );
+}
+
+float
+VISU::GaussPoints_i
+::GetAlphaThreshold()
+{
+  return myGaussPointsPL->GetAlphaThreshold();
+}
+
+float
+VISU::GaussPoints_i
+::GetMaximumSupportedSize()
+{
+  return myGaussPointsPL->GetMaximumSupportedSize();
+}
+
+void
+VISU::GaussPoints_i
+::SetClamp(float theClamp)
+{
+  myGaussPointsPL->SetClamp( theClamp );
+}
+
+float
+VISU::GaussPoints_i
+::GetClamp()
+{
+  return myGaussPointsPL->GetClamp();
+}
+
+void
+VISU::GaussPoints_i
+::SetConstSize( float theConstSize )
+{
+  myGaussPointsPL->SetSize( theConstSize );
+}
+
+float
+VISU::GaussPoints_i
+::GetConstSize()
+{
+  return myGaussPointsPL->GetSize();
+}
+
+void
+VISU::GaussPoints_i
+::SetMinSize( float theMinSize )
+{
+  myGaussPointsPL->SetMinSize( theMinSize );
+}
+
+float
+VISU::GaussPoints_i
+::GetMinSize()
+{
+  return myGaussPointsPL->GetMinSize();
+}
+
+void
+VISU::GaussPoints_i
+::SetMaxSize( float theMaxSize )
+{
+  myGaussPointsPL->SetMaxSize( theMaxSize );
+}
+
+float
+VISU::GaussPoints_i
+::GetMaxSize()
+{
+  return myGaussPointsPL->GetMaxSize();
+}
+
+void
+VISU::GaussPoints_i
+::SetMagnification( float theMagnification )
+{
+  myGaussPointsPL->SetMagnification( theMagnification );
+}
+
+float
+VISU::GaussPoints_i
+::GetMagnification()
+{
+  return myGaussPointsPL->GetMagnification();
+}
+
+void
+VISU::GaussPoints_i
+::SetMagnificationIncrement( float theIncrement )
+{
+  myGaussPointsPL->SetMagnificationIncrement( theIncrement );
+}
+
+float
+VISU::GaussPoints_i
+::GetMagnificationIncrement()
+{
+  return myGaussPointsPL->GetMagnificationIncrement();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::DoSetInput(Result_i* theResult)
+{
+  VISU::Result_i::TInput* anInput = theResult->GetInput();
+  if(!anInput)
+    throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!");
+
+  myField = anInput->GetField(myMeshName,myEntity,myFieldName);
+  if(!myField) 
+    throw std::runtime_error("There is no Field with the parameters !!!");
+
+  VISU::PGaussPtsIDMapper aGaussPtsIDMapper =
+    anInput->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration);
+
+  if(!aGaussPtsIDMapper) 
+    throw std::runtime_error("There is no TimeStamp with the parameters !!!");
+
+  myGaussPointsPL->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+  myScalarMapPL->Init();
+  myGaussPointsPL->Build();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::DoHook()
+{
+  if(!myPipeLine) 
+    myPipeLine = VISU_GaussPointsPL::New();
+
+  myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(myPipeLine);
+
+  TSuperClass::DoHook();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PipeLine* 
+VISU::GaussPoints_i
+::GetPipeLine()
+{
+  // We create a new PipeLine instance in order to provide
+  //   different representations for different actors (basic and segmented)
+  VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
+  aPipeLine->ShallowCopy(myPipeLine);
+  aPipeLine->Update();
+  return aPipeLine;
+}
+
+
+//----------------------------------------------------------------------------
+bool 
+VISU::GaussPoints_i
+::OnCreateActor(VISU_GaussPtsAct* theActor,
+               const Handle(SALOME_InteractiveObject)& theIO)
+{
+  try{
+    TSuperClass::CreateActor(theActor,theIO);
+    theActor->GetPipeLine()->Delete();
+    theActor->SetRepresentation(VTK_POINTS);
+    UpdateActor(theActor);
+    return true;
+  }catch(...){
+    theActor->Delete();
+    throw ;
+  }
+  return false;
+}
+
+VISU_GaussPtsAct1* 
+VISU::GaussPoints_i
+::OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  VISU_GaussPtsAct1* anActor = VISU_GaussPtsAct1::New();
+  if(OnCreateActor(anActor,theIO))
+    return anActor;
+  return NULL;
+}
+
+VISU_GaussPtsAct2* 
+VISU::GaussPoints_i
+::OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  VISU_GaussPtsAct2* anActor = VISU_GaussPtsAct2::New();
+  if(OnCreateActor(anActor,theIO))
+    return anActor;
+  return NULL;
+}
+
+VISU_Actor* 
+VISU::GaussPoints_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+{
+  return OnCreateActor1(theIO);
+}
+
+//----------------------------------------------------------------------------
+VISU_GaussPtsAct2* 
+VISU::GaussPoints_i
+::CloneActor(VISU_GaussPtsAct1* theActor) 
+{
+  if(MYDEBUG) MESSAGE("GaussPoints_i::CloneActor - this = "<<this);
+  if(VISU_GaussPtsAct2* anActor = OnCreateActor2()){
+    theActor->Connect(anActor);
+    return anActor;
+  }
+  return NULL;
+}
+
+//----------------------------------------------------------------------------
+void 
+VISU::GaussPoints_i
+::UpdateActor(VISU_Actor* theActor) 
+{
+  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    if(GetIsColored()){
+      anActor->SetBarVisibility(true);
+      myPipeLine->GetMapper()->SetScalarVisibility(1);
+
+      if(VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl()){
+       float aRange[2];
+       myScalarMapPL->GetSourceRange(aRange);
+       aScalarBarCtrl->SetRangeLocal(aRange);
+
+       vtkIdType aScalarMode = GetScalarMode();
+       TMinMax aTMinMax = myField->GetMinMax(aScalarMode);
+       aScalarBarCtrl->SetRangeGlobal(aTMinMax.first, aTMinMax.second);
+
+       aScalarBarCtrl->SetOrientation(myOrientation);
+
+       int aScalarBarMode;
+       aScalarBarMode = 1; //global sb
+       if(myIsActiveLocalScalarBar){
+         if (myIsDispGlobalScalarBar){
+           aScalarBarMode = 2; 
+         }
+         else{
+           aScalarBarMode = 0; 
+         }
+       }
+       
+       aScalarBarCtrl->SetMode(aScalarBarMode);
+
+       // Position
+       aScalarBarCtrl->SetWidth(myWidth);
+       aScalarBarCtrl->SetHeight(myHeight);
+       aScalarBarCtrl->SetPosition(myPosition);
+
+       aScalarBarCtrl->SetSpacing(mySpacing);
+
+       // Bicolor
+       bool anIsBicolor = GetGaussPointsPL()->GetBicolor();
+       aScalarBarCtrl->SetBicolor(anIsBicolor);
+      
+       aScalarBarCtrl->Update();
+      
+       for(int i = 0; i < 2; ++i){
+         vtkScalarBarActor *aScalarBar = aScalarBarCtrl->GetScalarBarActor(i);
+         aScalarBar->SetTitle(myTitle.c_str());
+         aScalarBar->SetNumberOfLabels(myNumberOfLabels);
+
+         vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
+         aTitleProp->SetFontFamily(myTitFontType);
+         aTitleProp->SetColor(myTitleColor);
+         (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+         (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+         (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+       
+         vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
+         aLabelProp->SetFontFamily(myLblFontType);
+         aLabelProp->SetColor(myLabelColor);
+         (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+         (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+         (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+       
+         aScalarBar->Modified();
+       }
+      }
+    }
+    else{
+      anActor->SetBarVisibility(false);
+      myPipeLine->GetMapper()->SetScalarVisibility(0);
+
+      anActor->GetProperty()->SetColor(myColor.red() / 255.0,
+                                      myColor.green() / 255.0,
+                                      myColor.blue() / 255.0);
+    }
+  }
+  TSuperClass::UpdateActor(theActor);
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::UpdateFromActor(VISU_GaussPtsAct* theActor) 
+{
+  if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this);
+  myGaussPointsPL->ChangeMagnification(theActor->ChangeMagnification());
+  UpdateActors();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::SetTextures( const QString& theMainTexture, 
+              const QString& theAlphaTexture )
+{
+  bool updateMainTexture = SetMainTexture( theMainTexture );
+  bool updateAlphaTexture = SetAlphaTexture( theAlphaTexture );
+  if( !updateMainTexture && !updateAlphaTexture )
+    return;
+
+  QString mainTextureFormat = theMainTexture.section( '.', -1 );
+  QString mainTextureVTI = theMainTexture.section( '.', 0, -2 ) + ".vti";
+  QString command1 = QString( "VISU_img2vti " ) + mainTextureFormat +
+                     " " + theMainTexture + " " + mainTextureVTI;
+  //cout << command1.latin1() << endl;
+  bool convertMainTexture = system( command1.latin1() ) == 0;
+
+  QString alphaTextureFormat = theAlphaTexture.section( '.', -1 );
+  QString alphaTextureVTI = theAlphaTexture.section( '.', 0, -2 ) + ".vti";
+  QString command2 = QString( "VISU_img2vti " ) + alphaTextureFormat +
+                     " " + theAlphaTexture + " " + alphaTextureVTI;
+  //cout << command2.latin1() << endl;
+  bool convertAlphaTexture = system( command2.latin1() ) == 0;
+
+  if( convertMainTexture && convertAlphaTexture ){
+    vtkImageData* anImageData =
+      VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(), 
+                                      alphaTextureVTI.latin1());
+    myGaussPointsPL->SetImageData( anImageData );
+    if( anImageData )
+      anImageData->Delete();
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::GaussPoints_i
+::SetIsActiveLocalScalarBar(const bool theFlag)
+{
+  myIsActiveLocalScalarBar = theFlag;
+}
+
+bool
+VISU::GaussPoints_i
+::GetIsActiveLocalScalarBar() const 
+{
+  return myIsActiveLocalScalarBar;
+}
+
+void
+VISU::GaussPoints_i
+::SetIsDispGlobalScalarBar(const bool theFlag)
+{
+  myIsDispGlobalScalarBar=theFlag;
+}
+
+bool
+VISU::GaussPoints_i
+::GetIsDispGlobalScalarBar() const 
+{
+  return myIsDispGlobalScalarBar;
+}
+
+void
+VISU::GaussPoints_i
+::SetBiColor(bool theIsBiColor)
+{
+  GetGaussPointsPL()->SetBicolor(theIsBiColor);
+}
+
+bool
+VISU::GaussPoints_i
+::GetBiColor() 
+{
+  return GetGaussPointsPL()->GetBicolor();
+}
+
+void
+VISU::GaussPoints_i
+::SetSpacing(const float theSpacing)
+{
+  mySpacing = theSpacing;
+}
+
+float
+VISU::GaussPoints_i
+::GetSpacing() const 
+{
+  return mySpacing;
+}
diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh
new file mode 100644 (file)
index 0000000..85d9762
--- /dev/null
@@ -0,0 +1,260 @@
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//  File   : VISU_PrsObject_i.hxx
+//  Author : Alexey PETROV
+//  Module : VISU
+
+#ifndef VISU_GaussPoints_i_HeaderFile
+#define VISU_GaussPoints_i_HeaderFile
+
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_GaussPtsActorFactory.h"
+
+class VISU_GaussPointsPL;
+
+namespace VISU
+{
+  class GaussPoints_i : public virtual POA_VISU::GaussPoints,
+                       public virtual VISU::TGaussPtsActorFactory,
+                       public virtual ColoredPrs3d_i
+  {
+    static int myNbPresent;
+    GaussPoints_i();
+    GaussPoints_i(const GaussPoints_i&);
+
+  public:
+    //----------------------------------------------------------------------------
+    typedef ColoredPrs3d_i TSuperClass;
+
+    explicit
+    GaussPoints_i(Result_i* theResult,
+                 bool theAddToStudy);
+    explicit
+    GaussPoints_i(Result_i* theResult,
+                 SALOMEDS::SObject_ptr theSObject);
+
+    virtual
+    ~GaussPoints_i();
+
+    virtual 
+    VISU::VISUType 
+    GetType() 
+    {
+      return VISU::TGAUSSPOINTS;
+    }
+
+    typedef VISU::GaussPoints TInterface;
+
+    VISU_GaussPointsPL* 
+    GetGaussPointsPL();
+
+    QColor
+    GetColor() { return myColor; }
+
+    void
+    SetColor( const QColor& theColor ) { myColor = theColor; }
+
+    bool 
+    GetIsColored() { return myIsColored; }
+
+    void
+    SetIsColored( bool theIsColored );
+
+    bool
+    SetMainTexture( const QString& theMainTexture );
+
+    const QString&
+    GetMainTexture();
+
+    bool
+    SetAlphaTexture( const QString& theAlphaTexture );
+
+    const QString&
+    GetAlphaTexture();
+
+    void
+    SetTextures( const QString& theMainTexture,
+                const QString& theAlphaTexture );
+
+    void
+    SetAlphaThreshold(float theAlphaThreshold);
+
+    float
+    GetAlphaThreshold();
+
+    float 
+    GetMaximumSupportedSize();
+
+    void
+    SetClamp(float theClamp);
+
+    float
+    GetClamp();
+
+    void
+    SetConstSize(float theConstSize);
+
+    float 
+    GetConstSize();
+
+    void
+    SetMinSize(float theMinSize);
+
+    float 
+    GetMinSize();
+
+    void
+    SetMaxSize(float theMaxSize);
+
+    float 
+    GetMaxSize();
+
+    float
+    GetMaxPointSize();
+
+    void
+    SetMagnification(float theMagnification);
+
+    float
+    GetMagnification();
+
+    void
+    SetMagnificationIncrement(float theIncrement);
+
+    float
+    GetMagnificationIncrement();
+
+    void
+    SetIsActiveLocalScalarBar(const bool theFlag);
+
+    bool
+    GetIsActiveLocalScalarBar() const;
+
+    void
+    SetIsDispGlobalScalarBar(const bool theFlag);
+
+    bool
+    GetIsDispGlobalScalarBar() const;
+
+    void
+    SetBiColor(bool theIsBiColor);
+
+    bool
+    GetBiColor();
+
+    void
+    SetSpacing(const float theSpacing);
+
+    float
+    GetSpacing() const;
+
+  protected:
+    virtual
+    void
+    DoSetInput(Result_i* theResult);
+
+    virtual
+    void
+    DoHook();
+
+    virtual 
+    VISU_PipeLine* 
+    GetPipeLine();
+    
+    bool
+    OnCreateActor(VISU_GaussPtsAct* theActor,
+                 const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+    VISU_GaussPtsAct1* 
+    OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+    VISU_GaussPtsAct2* 
+    OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+
+    VISU_GaussPointsPL *myGaussPointsPL;
+
+    bool myIsColored;
+    bool myIsDispGlobalScalarBar;
+    bool myIsActiveLocalScalarBar;
+    QColor myColor;
+    float mySpacing;
+
+    QString myMainTexture;
+    QString myAlphaTexture;
+
+  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);
+
+    static const std::string myComment;
+
+    virtual
+    const char* 
+    GetComment() const;
+
+    virtual
+    QString
+    GenerateName();
+
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
+    virtual 
+    Storable* 
+    Restore(const Storable::TRestoringMap& theMap);
+
+    //----------------------------------------------------------------------------
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+    virtual 
+    VISU_GaussPtsAct2* 
+    CloneActor(VISU_GaussPtsAct1* theActor);
+
+    virtual
+    void
+    UpdateActor(VISU_Actor* theActor);
+
+    virtual 
+    void
+    UpdateFromActor(VISU_GaussPtsAct* theActor);
+  };
+}
+
+#endif
+
index d1b47cf3e84d14dc8a6711170f10b3b6d0acf92d..58c7a2ddd623b7f1776ea1a66dcd8303190ba996 100644 (file)
@@ -38,6 +38,7 @@
 #include "VISU_CutLines_i.hh"
 #include "VISU_Vectors_i.hh"
 #include "VISU_StreamLines_i.hh"
+#include "VISU_GaussPoints_i.hh"
 #include "VISU_Plot3D_i.hh"
 #include "VISU_Table_i.hh"
 #include "VISU_TimeAnimation.h"
@@ -89,7 +90,7 @@ using namespace std;
 static QFileInfo aFileInfo;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -186,6 +187,7 @@ namespace VISU{
     Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore));
     Storable::Registry(Mesh_i::myComment.c_str(),&(Restore<Mesh_i>));
     Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore<ScalarMap_i>));
+    Storable::Registry(GaussPoints_i::myComment.c_str(),&(Restore<GaussPoints_i>));
     Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore<DeformedShape_i>));
     Storable::Registry(CutPlanes_i::myComment.c_str(),&(Restore<CutPlanes_i>));
     Storable::Registry(CutLines_i::myComment.c_str(),&(Restore<CutLines_i>));
@@ -425,8 +427,8 @@ namespace VISU{
            if (SUIT_Study* aSStudy = anApp->activeStudy()) {
              if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
                 if (_PTR(Study) aCStudy = aStudy->studyDS()) {
-                 MESSAGE("There is an application with active study : StudyId = "
-                         << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
+                 if(MYDEBUG) MESSAGE("There is an application with active study : StudyId = "
+                                     << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
                  if (myStudyName == aCStudy->Name()) {
                    isActive = true;
                    break;
@@ -448,12 +450,12 @@ namespace VISU{
     {
       CORBA::String_var aName = theStudy->Name();
       std::string aStudyName (aName.in());
-      MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
+      if(MYDEBUG) MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
       myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
 
       ProcessVoidEvent(new TEvent(aStudyName));
     } else {
-      MESSAGE("CORBA::is_nil(theStudy)");
+      INFOS("CORBA::is_nil(theStudy)");
     }
   }
 
@@ -607,6 +609,15 @@ namespace VISU{
     return Prs3dOnField<VISU::ScalarMap_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn();
   }
 
+  GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult,
+                                                const char* theMeshName,
+                                                VISU::Entity theEntity,
+                                                const char* theFieldName,
+                                                CORBA::Double theIteration)
+  {
+    return Prs3dOnField<VISU::GaussPoints_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn();
+  }
+
   DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult,
                                                     const char* theMeshName,
                                                     VISU::Entity theEntity,
index abaac0a6e46e0d1dc3a7f46fd8e3d022e4211a6e..a387b2e5186ba9292f35130ce3da052169edde2c 100644 (file)
@@ -59,21 +59,24 @@ namespace VISU{
     CreatePrs3d(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
                const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
     {
-      TPrs3d_i* aPresent = NULL;
       if(myStudyDocument->GetProperties()->IsLocked()) 
-       return aPresent;
+       return NULL;
 
       typedef typename TPrs3d_i::TInterface TPrs3d;
       typename TPrs3d::_var_type aPrs3d;
       Mutex mt(myMutex);
       if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
        if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
-         aPresent = new TPrs3d_i(pResult,theAddToStudy);
-         if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) == NULL)
-           aPresent->_remove_ref();
+         TPrs3d_i* aPresent = new TPrs3d_i(pResult,theAddToStudy);
+         try{
+           if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)))
+             return aPresent;
+         }catch(...){
+         }
+         aPresent->_remove_ref();
        }
       }
-      return aPresent;
+      return NULL;
     }
 
     template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
@@ -90,6 +93,9 @@ namespace VISU{
     virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult,
                                           const char* theMeshName, VISU::Entity theEntity,
                                           const char* theFieldName, CORBA::Double theIteration);
+    virtual GaussPoints_ptr GaussPointsOnField(Result_ptr theResult,
+                                              const char* theMeshName, VISU::Entity theEntity,
+                                              const char* theFieldName, CORBA::Double theIteration);
     virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult,
                                                   const char* theMeshName, VISU::Entity theEntity,
                                                   const char* theFieldName, CORBA::Double theIteration);
diff --git a/src/VISU_I/VISU_I.cxx b/src/VISU_I/VISU_I.cxx
new file mode 100644 (file)
index 0000000..a3a39f2
--- /dev/null
@@ -0,0 +1,54 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   :
+//  Author :
+//  Module :
+//  $Header$
+
+#include "VISUConfig.hh"
+#include "VISU_Gen_i.hh"
+#include "VISU_Result_i.hh"
+#include "VISU_PrsObject_i.hh"
+#include "VISU_Table_i.hh"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Mesh_i.hh"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_Plot3D_i.hh"
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutLines_i.hh"
+#include "VISU_Vectors_i.hh"
+#include "VISU_StreamLines_i.hh"
+#include "VISU_GaussPoints_i.hh"
+#include "VISU_ViewManager_i.hh"
+#include "VISU_View_i.hh"
+#include "VISU_TimeAnimation.h"
+
+int
+main(int argc, char** argv)
+{
+  return 0;
+}
index 79b2a877fd328bda3c1605e5d1aa3fcb1298cdba..2ea83ae041645291bdf262d3e1fe96548dd7ba60 100644 (file)
@@ -56,10 +56,10 @@ IsoSurfaces_i(Result_i* theResult,
              bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
   myIsoSurfacesPL(NULL)
-{
-}
+{}
 
 
 VISU::IsoSurfaces_i::
@@ -67,10 +67,10 @@ IsoSurfaces_i(Result_i* theResult,
              SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
   myIsoSurfacesPL(NULL)
-{
-}
+{}
 
 
 void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) {
@@ -139,6 +139,17 @@ void VISU::IsoSurfaces_i::DoHook(){
 }
 
 
+VISU_Actor* 
+VISU::IsoSurfaces_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+    anActor->SetVTKMapping(true);
+    return anActor;
+  }
+  return NULL;
+}
+
 void VISU::IsoSurfaces_i::SetMapScale(double theMapScale){
   myIsoSurfacesPL->SetMapScale(theMapScale);
 }
index c7371b6a48b4130e08b91e22aa62acc11bc6f7ee..9b442b68ba11918a8d52a31bd5dae820a481e349 100644 (file)
@@ -78,6 +78,10 @@ namespace VISU{
 
     virtual Storable* Restore(const Storable::TRestoringMap& theMap);
 
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
     virtual void SetMapScale(double theMapScale = 1.0);
   };
 }
index 6d8851026cffc5f8d9b7b9b16bb237ee8807cdaf..fd62cdc115d7252b36c8c362c77f0d9c534533f1 100644 (file)
@@ -29,8 +29,9 @@
 #include "VISU_Result_i.hh"
 #include "VISU_ViewManager_i.hh"
 
-#include "VISU_MeshPL.hxx"
 #include "VISU_MeshAct.h"
+#include "VISU_MeshPL.hxx"
+#include "VISU_Convertor.hxx"
 
 using namespace VISU;
 using namespace std;
@@ -74,7 +75,7 @@ Mesh_i(Result_i* theResult,
 
 void VISU::Mesh_i::RemoveFromStudy()
 {
-  VISU::DeleteActors(this);
+  VISU::Prs3d_i::RemoveFromStudy();
   VISU::RemoveFromStudy(mySObject);
 }
 
@@ -92,7 +93,7 @@ int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName,
   try{
     MESSAGE("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
     float aSize = INCMEMORY*
-      theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity,theFamilyName);
+      theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity);
     bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
     MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
     return aResult;
@@ -214,41 +215,42 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring)
       myNodeColor.R = myNodeColor.G = 1.0;  myNodeColor.B = 1.0;
       myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.;
     }
-    //jfa IPAL9284:if (int(myEntity) >= 0)
-    if (myEntity >= 0) //jfa IPAL9284
-      if (mySubMeshName == "")
+
+    if(myEntity >= 0)
+      if(mySubMeshName == "")
        myType = VISU::TENTITY;
       else
        myType = VISU::TFAMILY;
     else
       myType = VISU::TGROUP;
+
     if(MYDEBUG) MESSAGE("Mesh_i::Build - myType = "<<myType);
     QString aComment;
 
-    VISU_Convertor::TOutput *anOutput;
+    VISU::PIDMapper anIDMapper;
     switch(myType){
     case VISU::TENTITY :
-      //jfa IPAL9284:anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity);
-      anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284
+      anIDMapper = myResult->GetInput()->GetMeshOnEntity(myMeshName,(VISU::TEntity)myEntity);//jfa IPAL9284
       aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
                       VISU::TENTITY,myMeshName.c_str(),myEntity);
       break;
     case VISU::TFAMILY :
-      //jfa IPAL9284:anOutput = myResult->GetInput()->GetMeshOnEntity(myMeshName,myEntity,mySubMeshName);
-      anOutput = myResult->GetInput()->GetMeshOnEntity
-        (myMeshName,(VISU::TEntity)myEntity,mySubMeshName);//jfa IPAL9284
+      anIDMapper = myResult->GetInput()->GetFamilyOnEntity(myMeshName,(VISU::TEntity)myEntity,mySubMeshName);
       aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
                       VISU::TFAMILY,myMeshName.c_str(),myEntity,mySubMeshName.c_str());
       break;
     case VISU::TGROUP :
-      anOutput = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
+      anIDMapper = myResult->GetInput()->GetMeshOnGroup(myMeshName,mySubMeshName);
       aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
                       VISU::TGROUP,myMeshName.c_str(),mySubMeshName.c_str());
       break;
     }
-    if(anOutput == NULL) throw std::runtime_error("Mesh_i::Build - anOutput == NULL !!!");
-    myMeshPL->SetInput(anOutput);
+    if(!anIDMapper) 
+      throw std::runtime_error("Mesh_i::Build - !anIDMapper !!!");
+
+    myMeshPL->SetIDMapper(anIDMapper);
     myMeshPL->Build();
+
     if(!theRestoring) { //Setting IOR on the label
       myMeshPL->Init();
       string aResultEntry = myResult->GetEntry();
index 6acc32d19ff72edcb40ec626aed0a5d06470a32d..cb6dff6142132d652f050b9d297cb931738a094a 100644 (file)
@@ -29,21 +29,25 @@ QString VISU::Plot3D_i::GenerateName() { return VISU::GenerateName("Plot3D",myNb
 const string VISU::Plot3D_i::myComment = "PLOT3D";
 const char* VISU::Plot3D_i::GetComment() const { return myComment.c_str(); }
 
-VISU::Plot3D_i::Plot3D_i (Result_i* theResult, bool theAddToStudy)
-     : PrsObject_i(theResult->GetStudyDocument()),
-       Prs3d_i(theResult,theAddToStudy),
-       ScalarMap_i(theResult,theAddToStudy),
-       myPlot3DPL(NULL)
-{
-}
-
-VISU::Plot3D_i::Plot3D_i (Result_i* theResult, SALOMEDS::SObject_ptr theSObject)
-     : PrsObject_i(theResult->GetStudyDocument()),
-       Prs3d_i(theResult,theSObject),
-       ScalarMap_i(theResult,theSObject),
-       myPlot3DPL(NULL)
-{
-}
+VISU::Plot3D_i
+::Plot3D_i(Result_i* theResult, 
+          bool theAddToStudy) :
+  PrsObject_i(theResult->GetStudyDocument()),
+  Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
+  ScalarMap_i(theResult,theAddToStudy),
+  myPlot3DPL(NULL)
+{}
+
+VISU::Plot3D_i
+::Plot3D_i(Result_i* theResult, 
+          SALOMEDS::SObject_ptr theSObject) :
+  PrsObject_i(theResult->GetStudyDocument()),
+  Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
+  ScalarMap_i(theResult,theSObject),
+  myPlot3DPL(NULL)
+{}
 
 void VISU::Plot3D_i::SameAs (const Plot3D_i* theOrigin)
 {
@@ -165,6 +169,17 @@ void VISU::Plot3D_i::DoHook()
   ScalarMap_i::DoHook();
 }
 
+VISU_Actor* 
+VISU::Plot3D_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+{
+  if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){
+    anActor->SetVTKMapping(true);
+    return anActor;
+  }
+  return NULL;
+}
+
 void VISU::Plot3D_i::SetMapScale(double theMapScale)
 {
   myPlot3DPL->SetMapScale(theMapScale);
index dd5ce19923cdfa989451203a39160ddb57fee609..9e21442458657188dd0320ff12db19c5fcc24cd6 100644 (file)
@@ -68,6 +68,10 @@ namespace VISU {
 
     virtual Storable* Restore (const Storable::TRestoringMap& theMap);
 
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
     static const std::string myComment;
     virtual const char* GetComment() const;
     virtual QString GenerateName();
index 7838834f72dde338e7c79200c08526d3dd9ec5b7..2cd195836391936d2c8e8e3d22e5d40b1fe11aac 100644 (file)
 //  Module : VISU
 
 #include "VISU_PipeLine.hxx"
-#include "VISU_Result_i.hh"
 #include "VISU_Prs3d_i.hh"
+
+#include "VISU_Result_i.hh"
 #include "VISU_Actor.h"
 
-#include <vtkGeometryFilter.h>
-#include <vtkDataSetMapper.h>
+#include <vtkActorCollection.h>
+#include <vtkMapper.h>
+
+
+#include <boost/bind.hpp>
 
 using namespace VISU;
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
 
-VISU::Prs3d_i::
-Prs3d_i(Result_i* theResult,
-       SALOMEDS::SObject_ptr theSObject) :
+
+//----------------------------------------------------------------------------
+VISU::Prs3d_i
+::Prs3d_i(Result_i* theResult,
+         SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()),
-  myResult(theResult),
   mySObject(SALOMEDS::SObject::_duplicate(theSObject)),
+  myActorCollection(vtkActorCollection::New()),
+  myResult(theResult),
   myAddToStudy(true),
   myPipeLine(NULL)
 {
+  if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
   myOffset[0] = myOffset[1] = myOffset[2] = 0;
+  myActorCollection->Delete();
   myResult->Register();
 }
 
-VISU::Prs3d_i::
-Prs3d_i(Result_i* theResult,
-       bool theAddToStudy) :
+VISU::Prs3d_i
+::Prs3d_i(Result_i* theResult,
+         bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()),
-  myResult(theResult),
+  myActorCollection(vtkActorCollection::New()),
   mySObject(SALOMEDS::SObject::_nil()),
   myAddToStudy(theAddToStudy),
+  myResult(theResult),
   myPipeLine(NULL)
 {
+  if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<<this);
   myOffset[0] = myOffset[1] = myOffset[2] = 0;
+  myActorCollection->Delete();
   myResult->Register();
 }
 
-void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
+void
+VISU::Prs3d_i
+::SameAs(const Prs3d_i* theOrigin)
 {
   if (Prs3d_i* aOrigin = const_cast<Prs3d_i*>(theOrigin)) {
     myPipeLine->SameAs(aOrigin->GetPL());
@@ -75,60 +89,20 @@ void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
   }
 }
 
-VISU::Prs3d_i::~Prs3d_i() {
-  if(MYDEBUG) MESSAGE("~Prs3d_i() - this = "<<this
-                     <<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
+VISU::Prs3d_i
+::~Prs3d_i() 
+{
+  if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<<this);
+  myRemoveActorsFromRendererSignal();
   myPipeLine->Delete();
   myResult->Destroy();
 }
 
-void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
-{
-  try{
-    Update();
-    //    if(myAddToStudy){
-    Handle(SALOME_InteractiveObject) anIO = theIO;
-    if(anIO.IsNull() && (!mySObject->_is_nil())){
-      anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName());
-      theActor->setIO(anIO);
-    }
-      // }
-    theActor->SetPipeLine(GetPipeLine());
-    theActor->SetPrs3d(this);
-    theActor->SetPosition(myOffset);
-  }catch(std::bad_alloc& ex){
-    throw std::runtime_error("CreateActor >> No enough memory");
-    throw ex;
-  } catch(std::exception& ex){
-    throw ex;
-  }catch(...) {
-    throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
-  }
-}
-
-void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) {
-  if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<<this);
-
-  // fix for bug 9808 BEGIN
-  vtkMapper *aMapper = myPipeLine->GetMapper();
-  vtkDataSet *aDataSet = aMapper->GetInput();
-  if (!aDataSet)
-    throw std::runtime_error("There is no input data !!!");
-  aDataSet->Update();
-  static float eps = VTK_LARGE_FLOAT * 0.1 ;
-  if (!aDataSet->GetNumberOfCells())
-    throw std::runtime_error("There is no visible elements");
-  if (aDataSet->GetLength() > eps)
-    throw std::runtime_error("Diagonal of the actor is too large !!!");
-  // fix for bug 9808 END
-
-  //theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
-  theActor->GetMapper()->ShallowCopy(aMapper);
-  theActor->SetPosition(myOffset);
-  theActor->Modified();
-}
 
-VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
+//----------------------------------------------------------------------------
+VISU::Storable* 
+VISU::Prs3d_i
+::Restore(const Storable::TRestoringMap& theMap)
 {
   myName = VISU::Storable::FindValue(theMap,"myName").latin1();
   myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat();
@@ -137,15 +111,51 @@ VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
   return this;
 }
 
-void VISU::Prs3d_i::ToStream(std::ostringstream& theStr){
+void
+VISU::Prs3d_i
+::ToStream(std::ostringstream& theStr)
+{
   Storable::DataToStream( theStr, "myName",   myName.c_str() );
   Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] );
   Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] );
   Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] );
 }
 
-void VISU::Prs3d_i::Update() {
-  if(MYDEBUG) MESSAGE("Prs3d_i::Update() - this = "<<this);
+
+//----------------------------------------------------------------------------
+SALOMEDS::SObject_var 
+VISU::Prs3d_i
+::GetSObject()
+{
+  if(CORBA::is_nil(mySObject.in())){
+    const SALOMEDS::Study_var& aStudy = myResult->GetStudyDocument();
+    CORBA::String_var anIOR = GetID();
+    mySObject = aStudy->FindObjectIOR(anIOR);
+  }
+  return mySObject;
+}
+
+Result_i* 
+VISU::Prs3d_i
+::GetResult() const 
+{ 
+  return myResult;
+}
+
+const std::string& 
+VISU::Prs3d_i
+::GetMeshName() const 
+{ 
+  return myMeshName; 
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::Update() 
+{
+  if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<<this);
   try{
     myPipeLine->Update();
   }catch(...){
@@ -153,84 +163,189 @@ void VISU::Prs3d_i::Update() {
   }
 }
 
-VISU_PipeLine* VISU::Prs3d_i::GetPipeLine(){
+void
+VISU::Prs3d_i
+::RemoveFromStudy() 
+{
+  myRemoveActorsFromRendererSignal();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_PipeLine* 
+VISU::Prs3d_i
+::GetPipeLine()
+{
   return GetPL();
 }
 
-VISU_PipeLine* VISU::Prs3d_i::GetPL(){
+VISU_PipeLine* 
+VISU::Prs3d_i
+::GetPL()
+{
   return myPipeLine;
 }
 
-vtkUnstructuredGrid* VISU::Prs3d_i::GetInput(){
+vtkUnstructuredGrid* 
+VISU::Prs3d_i::
+GetInput()
+{
   return myPipeLine->GetInput();
 }
 
 
-SALOMEDS::SObject_var VISU::Prs3d_i::GetSObject(){
-  if (CORBA::is_nil(mySObject.in())) {
-    const SALOMEDS::Study_var& aStudy = myResult->GetStudyDocument();
-    CORBA::String_var anIOR = GetID();
-    mySObject = aStudy->FindObjectIOR(anIOR);
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
+{
+  try{
+    Handle(SALOME_InteractiveObject) anIO = theIO;
+    if(anIO.IsNull() && (!mySObject->_is_nil())){
+      anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName());
+      theActor->setIO(anIO);
+    }
+
+    Update();
+    theActor->SetPrs3d(this);
+    theActor->SetPosition(myOffset);
+    theActor->SetPipeLine(GetPipeLine());
+
+    theActor->SetFactory(this);
+    myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::Update,theActor));
+    myRemoveActorsFromRendererSignal.connect(boost::bind(&VISU_Actor::RemoveFromRender,theActor));
+
+    myActorCollection->AddItem(theActor);
+    theActor->Delete();
+
+  }catch(std::bad_alloc& ex){
+    throw std::runtime_error("CreateActor >> No enough memory");
+    throw ex;
+  } catch(std::exception& ex){
+    throw ex;
+  }catch(...) {
+    throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
   }
-  return mySObject;
 }
 
-void VISU::Prs3d_i::GetBounds(float aBounds[6]){
-  myPipeLine->GetMapper()->GetBounds(aBounds);
+void
+VISU::Prs3d_i
+::UpdateActor(VISU_Actor* theActor) 
+{
+  if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
+  theActor->ShallowCopyPL(myPipeLine);
+  theActor->SetPosition(myOffset);
+  theActor->Modified();
 }
 
-// Clipping planes
+void
+VISU::Prs3d_i
+::RemoveActor(VISU_Actor* theActor) 
+{
+  if(MYDEBUG) MESSAGE("Prs3d_i::RemoveActor - this = "<<this<<"; theActor = "<<theActor);
+  myActorCollection->RemoveItem(theActor);
+}
 
-void VISU::Prs3d_i::RemoveAllClippingPlanes(){
-  myPipeLine->RemoveAllClippingPlanes();
+void
+VISU::Prs3d_i
+::UpdateActors()
+{
+  if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors - this = "<<this);
+  Update();
+  myUpdateActorsSignal();
 }
 
-vtkIdType VISU::Prs3d_i::GetNumberOfClippingPlanes() const{
-  return myPipeLine->GetNumberOfClippingPlanes();
+
+//----------------------------------------------------------------------------
+// Clipping planes
+void
+VISU::Prs3d_i
+::RemoveAllClippingPlanes()
+{
+  myPipeLine->RemoveAllClippingPlanes();
 }
 
-bool VISU::Prs3d_i::AddClippingPlane(vtkPlane* thePlane){
+bool
+VISU::Prs3d_i
+::AddClippingPlane(vtkPlane* thePlane)
+{
   return myPipeLine->AddClippingPlane(thePlane);
 }
 
-vtkPlane* VISU::Prs3d_i::GetClippingPlane(vtkIdType theID) const{
+vtkIdType
+VISU::Prs3d_i
+::GetNumberOfClippingPlanes() const
+{
+  return myPipeLine->GetNumberOfClippingPlanes();
+}
+
+vtkPlane* 
+VISU::Prs3d_i::
+GetClippingPlane(vtkIdType theID) const
+{
   return myPipeLine->GetClippingPlane(theID);
 }
 
-void VISU::Prs3d_i::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane) {
+void
+VISU::Prs3d_i
+::SetPlaneParam (float theDir[3], float theDist, vtkPlane* thePlane) 
+{
   myPipeLine->SetPlaneParam(theDir, theDist, thePlane);
 }
 
-VISU::Result_i* VISU::GetResult(SALOMEDS::SObject_ptr theSObject){
-  VISU::Result_var aResult = FindResult(theSObject);
-  if(!aResult->_is_nil())
-    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
-  return NULL;
+
+//----------------------------------------------------------------------------
+void
+VISU::Prs3d_i
+::GetBounds(float aBounds[6])
+{
+  myPipeLine->GetMapper()->GetBounds(aBounds);
 }
 
-void VISU::Prs3d_i::SetOffset(const float* theOffsets)
+void 
+VISU::Prs3d_i
+::SetOffset(const float* theOffsets)
 {
   myOffset[0] = theOffsets[0];
   myOffset[1] = theOffsets[1];
   myOffset[2] = theOffsets[2];
 }
 
-void VISU::Prs3d_i::SetOffset(float theDx, float theDy, float theDz)
+void
+VISU::Prs3d_i
+::SetOffset(float theDx, float theDy, float theDz)
 {
   myOffset[0] = theDx;
   myOffset[1] = theDy;
   myOffset[2] = theDz;
 }
 
-void VISU::Prs3d_i::GetOffset(float* theOffsets)
+void
+VISU::Prs3d_i
+::GetOffset(float* theOffsets)
 {
   theOffsets[0] = myOffset[0];
   theOffsets[1] = myOffset[1];
   theOffsets[2] = myOffset[2];
 }
-void VISU::Prs3d_i::GetOffset(float& theDx, float& theDy, float& theDz)
+
+void 
+VISU::Prs3d_i
+::GetOffset(float& theDx, float& theDy, float& theDz)
 {
   theDx = myOffset[0];
   theDy = myOffset[1];
   theDz = myOffset[2];
 }
+
+
+//----------------------------------------------------------------------------
+VISU::Result_i* 
+VISU::GetResult(SALOMEDS::SObject_ptr theSObject)
+{
+  VISU::Result_var aResult = FindResult(theSObject);
+  if(!aResult->_is_nil())
+    return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
+  return NULL;
+}
+
index 124a97ff75ca206d0f9ecea8bb68695a355542f1..7bad0b68048906198ab95dee51e4a5e10052a5b8 100644 (file)
 #define VISU_Prs3d_i_HeaderFile
 
 #include "VISU_PrsObject_i.hh"
+
+#include "VISU_ActorFactory.h"
+#include "VISU_ConvertorDef.hxx"
+
 #include "SALOME_GenericObj_i.hh"
-#include "Handle_SALOME_InteractiveObject.hxx"
-#include "VISU_Convertor.hxx"
+#include "SALOME_InteractiveObject.hxx"
 
-#include <vtkPlaneSource.h>
+#include <boost/signals/signal0.hpp>
+#include <vtkSmartPointer.h>
 
 class VISU_PipeLine;
 class VISU_Actor;
 
 class vtkPlane;
+class vtkActorCollection;
 class vtkUnstructuredGrid;
 
-namespace VISU{
+namespace VISU
+{
   class Result_i;
 
+  //----------------------------------------------------------------------------
   class Prs3d_i :
     public virtual POA_VISU::Prs3d,
     public virtual SALOME::GenericObj_i,
+    public virtual TActorFactory,
     public virtual PrsObject_i
 
   {
@@ -53,70 +61,149 @@ namespace VISU{
     Prs3d_i(const Prs3d_i&);
 
   public:
+    //----------------------------------------------------------------------------
     explicit
     Prs3d_i(Result_i* theResult,
            bool theAddToStudy);
     explicit
     Prs3d_i(Result_i* theResult,
            SALOMEDS::SObject_ptr theSObject);
-    virtual void SameAs(const Prs3d_i* theOrigin);
-    virtual ~Prs3d_i();
+    virtual
+    void
+    SameAs(const Prs3d_i* theOrigin);
 
-  protected:
-    bool myAddToStudy;
-    float myOffset[3];
-    Result_i *myResult;
-    VISU_PipeLine *myPipeLine;
-    SALOMEDS::SObject_var mySObject;
-    std::string myMeshName;
+    virtual
+    ~Prs3d_i();
 
-    void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL);
-    virtual VISU_PipeLine* GetPipeLine();
+    //----------------------------------------------------------------------------
+    virtual
+    const char* 
+    GetComment() const = 0;
 
-  public:
-    virtual void Update() ;
-    VISU_PipeLine* GetPL();
+    virtual
+    QString
+    GenerateName() = 0;
+
+    virtual
+    Storable* 
+    Restore(const Storable::TRestoringMap& theMap);
+
+    virtual
+    void
+    ToStream(std::ostringstream& theStr);
+
+    //----------------------------------------------------------------------------
+    Result_i* 
+    GetResult() const;
 
-    vtkUnstructuredGrid* GetInput();
+    virtual
+    SALOMEDS::SObject_var 
+    GetSObject();
 
-    void GetBounds(float aBounds[6]);
+    const std::string& 
+    GetMeshName() const;
 
-    void SetOffset(const float* theOffsets);
-    virtual void SetOffset(float theDx, float theDy, float theDz);
+    //----------------------------------------------------------------------------
+    virtual 
+    void
+    Update();
 
-    void GetOffset(float* theOffsets);
-    virtual void GetOffset(float& theDx, float& theDy, float& theDz);
+    virtual
+    void
+    RemoveFromStudy();
 
-    virtual const char* GetComment() const = 0;
-    virtual QString GenerateName() = 0;
+    //----------------------------------------------------------------------------
+    VISU_PipeLine* 
+    GetPL();
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    vtkUnstructuredGrid* 
+    GetInput();
 
-    virtual void ToStream(std::ostringstream& theStr);
+    //----------------------------------------------------------------------------
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
 
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0;
+    virtual 
+    void
+    RemoveActor(VISU_Actor* theActor);
 
-    virtual void UpdateActor(VISU_Actor* theActor) ;
+    virtual 
+    void
+    UpdateActor(VISU_Actor* theActor);
 
-    Result_i* GetResult() const { return myResult;}
-    virtual SALOMEDS::SObject_var GetSObject();
-    const std::string& GetMeshName() const { return myMeshName; }
+    virtual 
+    void
+    UpdateActors();
 
+    //----------------------------------------------------------------------------
     // Clipping planes
-    void RemoveAllClippingPlanes();
-    vtkIdType GetNumberOfClippingPlanes() const;
-    bool AddClippingPlane(vtkPlane* thePlane);
-    vtkPlane* GetClippingPlane(vtkIdType theID) const;
+    void
+    RemoveAllClippingPlanes();
+
+    bool
+    AddClippingPlane(vtkPlane* thePlane);
+
+    vtkIdType
+    GetNumberOfClippingPlanes() const;
+
+    vtkPlane* 
+    GetClippingPlane(vtkIdType theID) const;
+
+    void
+    SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
+
+    //----------------------------------------------------------------------------
+    void
+    GetBounds(float aBounds[6]);
+
+    void
+    SetOffset(const float* theOffsets);
+
+    virtual
+    void
+    SetOffset(float theDx, float theDy, float theDz);
+
+    void
+    GetOffset(float* theOffsets);
+
+    virtual
+    void
+    GetOffset(float& theDx, float& theDy, float& theDz);
+
+    //----------------------------------------------------------------------------
+  protected:
+    void
+    CreateActor(VISU_Actor* theActor, 
+               const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
+    virtual 
+    VISU_PipeLine* 
+    GetPipeLine();
+
+    bool myAddToStudy;
+    float myOffset[3];
+    Result_i *myResult;
+    VISU_PipeLine *myPipeLine;
+    SALOMEDS::SObject_var mySObject;
+    std::string myMeshName;
+
+    boost::signal0<void> myUpdateActorsSignal;
+    boost::signal0<void> myRemoveActorsFromRendererSignal;
+    vtkSmartPointer<vtkActorCollection> myActorCollection;
 
-    void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
   };
 
-  Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+  //----------------------------------------------------------------------------
+  Result_i* 
+  GetResult(SALOMEDS::SObject_ptr theSObject);
 
+  //----------------------------------------------------------------------------
   template<class TPrs3d>
-  Storable* Restore(SALOMEDS::SObject_ptr theSObject,
-                   const std::string& thePrefix,
-                   const Storable::TRestoringMap& theMap)
+  Storable* 
+  Restore(SALOMEDS::SObject_ptr theSObject,
+         const std::string& thePrefix,
+         const Storable::TRestoringMap& theMap)
   {
     VISU::Result_i* pResult = GetResult(theSObject);
     if(pResult != NULL){
@@ -125,6 +212,7 @@ namespace VISU{
     }
     return NULL;
   }
+  //----------------------------------------------------------------------------
 }
 
 #endif
index 15cf901e109f38e87b12dbce24ab33c5bbd6ee0c..2ecd1f0fcf551cd969d12070090f523e81acbc6d 100644 (file)
@@ -140,6 +140,7 @@ void VISU::Result_i::RemoveFromStudy()
 {
   // Remove the result with all presentations and other possible sub-objects
   VISU::RemoveFromStudy(mySObject,false);
+  Destroy();
 }
 
 
@@ -218,7 +219,7 @@ BuildAll()
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
          try{
-           myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+           myInput->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName);
          }catch(std::exception& exc){
            INFOS("Follow exception was occured :\n"<<exc.what());
          }catch(...){
@@ -249,68 +250,65 @@ VISU::Storable*
 VISU::Result_i::
 Build(SALOMEDS::SObject_ptr theSObject)
 {
-  if(MYDEBUG) MESSAGE("Result_i::Build");
-
   SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
   aStudyBuilder->NewCommand();  // There is a transaction
-
-  try {
+  if(MYDEBUG) MESSAGE("Result_i::Build");
+  try{
     const TMeshMap& aMeshMap = myInput->GetMeshMap();
-    if (aMeshMap.empty())
+    if(aMeshMap.empty())
       throw std::runtime_error("Build - There is no any mesh information in the file !!!");
-
     mySComponent = FindOrCreateVisuComponent(myStudyDocument);
     CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
     string aRefFatherEntry = GetRefFatherEntry();
-
     QString aComment;
     aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
-                    GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(),
+                    GetComment(),
+                    VISU::TRESULT,
+                    myFileInfo.filePath().latin1(),
                     myInitFileName.c_str()); // Restoring of Python dump
     string aResultEntry =
-      CreateAttributes(myStudyDocument, aSComponentEntry, aRefFatherEntry.c_str(),
-                      anIOR, myName.c_str(), "", aComment.latin1(), true);
-
+      CreateAttributes(myStudyDocument,
+                      aSComponentEntry,
+                      aRefFatherEntry.c_str(),
+                      anIOR,
+                      myName.c_str(),
+                      "",
+                      aComment.latin1(),
+                      true);
     mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
-    if (mySObject->_is_nil())
-      throw std::runtime_error("Build - There is no SObject for the Result !!!");
-
-    if (!CORBA::is_nil(theSObject)) {
+    if(mySObject->_is_nil()) throw std::runtime_error("Build - There is no SObject for the Result !!!");
+    if(!CORBA::is_nil(theSObject)){
       CORBA::String_var aString = theSObject->GetID();
-      CreateReference(myStudyDocument, aResultEntry, aString.in());
+      CreateReference(myStudyDocument,aResultEntry,aString.in());
     }
-
     TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
-    for (; aMeshMapIter != aMeshMap.end(); aMeshMapIter++) {
+    for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
       const VISU::PMesh aMesh = aMeshMapIter->second;
-      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
-                      aMeshName.c_str(), aMesh->myDim);
-      string aMeshEntry =
-       CreateAttributes(myStudyDocument, aResultEntry.c_str(), aRefFatherEntry.c_str(),
-                        "", aMeshName.c_str(), "", aComment.latin1(), true);
-
       const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
-      if (aMeshOnEntityMap.empty()) continue;
-
-      aComment.sprintf("myComment=FAMILIES;myMeshName=%s", aMeshName.c_str());
-      string aSubMeshesEntry =
-       CreateAttributes(myStudyDocument, aMeshEntry.c_str(), aRefFatherEntry.c_str(),
-                        "", "Families", "", aComment.latin1(), true);
-
+      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
+      aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
+                      aMeshName.c_str(),aMesh->myDim);
+      string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
+                                          "",aMeshName.c_str(),"",aComment.latin1(),true);
+      if(aMeshOnEntityMap.empty()) continue;
+      aComment.sprintf("myComment=FAMILIES;myMeshName=%s",aMeshName.c_str());
+      string aSubMeshesEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "","Families","",aComment.latin1(),true);
       //Import entities and according families
+      aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       typedef std::map<std::string,std::string> TComment2EntryMap;
-      typedef std::map<VISU::TEntity,std::string> TEntity2EntryMap;
       TComment2EntryMap aComment2EntryMap;
+      typedef std::map<VISU::TEntity,std::string> TEntity2EntryMap;
       TEntity2EntryMap aEntity2EntryMap;
-
-      VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for (; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
        aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d",
-                        VISU::TENTITY, aMeshName.c_str(), anEntity);
+                        VISU::TENTITY,
+                        aMeshName.c_str(),
+                        anEntity);
        string anEntityName;
-       switch (anEntity) {
+       switch(anEntity){
        case VISU::NODE_ENTITY : anEntityName = "onNodes"; break;
        case VISU::EDGE_ENTITY : anEntityName = "onEdges"; break;
        case VISU::FACE_ENTITY : anEntityName = "onFaces"; break;
@@ -321,103 +319,120 @@ Build(SALOMEDS::SObject_ptr theSObject)
        aEntity2EntryMap[anEntity] = CreateAttributes
          (myStudyDocument, aSubMeshesEntry.c_str(), aRefFatherEntry.c_str(),
           "", anEntityName.c_str(), "", aComment.latin1(), true);
-
        const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
        const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
-       for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++) {
+       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
          aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                          VISU::TFAMILY, aMeshName.c_str(), anEntity, aFamilyName.c_str());
+                          VISU::TFAMILY,
+                          aMeshName.c_str(),
+                          anEntity,
+                          aFamilyName.c_str());
          aComment2EntryMap[aComment.latin1()] =
-           CreateAttributes(myStudyDocument, aEntity2EntryMap[anEntity].c_str(), aRefFatherEntry.c_str(),
-                            "", aFamilyName.c_str(), "", aComment.latin1(), true);
+           CreateAttributes(myStudyDocument,
+                            aEntity2EntryMap[anEntity].c_str(),
+                            aRefFatherEntry.c_str(),
+                            "",
+                            aFamilyName.c_str(),
+                            "",
+                            aComment.latin1(),
+                            true);
        }
       }
-
       //Importing groups
       const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
-      if (aGroupMap.size() > 0) {
-       aComment.sprintf("myComment=GROUPS;myMeshName=%s", aMeshName.c_str());
+      if(aGroupMap.size() > 0){
+       aComment.sprintf("myComment=GROUPS;myMeshName=%s",
+                        aMeshName.c_str());
        string aGroupsEntry =
-         CreateAttributes(myStudyDocument, aMeshEntry.c_str(), aRefFatherEntry.c_str(),
-                          "", "Groups", "", aComment.latin1(), true);
-
+         CreateAttributes(myStudyDocument,
+                          aMeshEntry.c_str(),
+                          aRefFatherEntry.c_str(),
+                          "",
+                          "Groups",
+                          "",
+                          aComment.latin1(),
+                          true);
        VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
-       for (; aGroupMapIter != aGroupMap.end(); aGroupMapIter++) {
+       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
          const string& aGroupName = aGroupMapIter->first;
          aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s",
-                          VISU::TGROUP, aMeshName.c_str(), aGroupName.c_str());
-         string aGroupEntry =
-           CreateAttributes(myStudyDocument, aGroupsEntry.c_str(), aRefFatherEntry.c_str(),
-                            "", aGroupName.c_str(), "", aComment.latin1(), true);
-
+                          VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
+         string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "",aGroupName.c_str(),"",aComment.latin1(),true);
          const VISU::PGroup aGroup = aGroupMapIter->second;
-         const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
-         VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
-         for (; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++) {
-           const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
-           const string& aFamilyName = aFamilyAndEntity.first;
-           const VISU::TEntity& anEntity = aFamilyAndEntity.second;
+         const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet;
+         VISU::TFamilySet::const_iterator aFamilyIter = aFamilySet.begin();
+         for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){
+           const VISU::PFamily& aFamily = *aFamilyIter;
+           const string& aFamilyName = aFamily->myName;
+           const VISU::TEntity& anEntity = aFamily->myEntity;
            aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
-                            VISU::TFAMILY, aMeshName.c_str(), anEntity, aFamilyName.c_str());
-           if (aComment2EntryMap.count(aComment.latin1()) > 0)
-             CreateReference(myStudyDocument, aGroupEntry, aComment2EntryMap[aComment.latin1()]);
+                            VISU::TFAMILY,
+                            aMeshName.c_str(),
+                            anEntity,
+                            aFamilyName.c_str());
+           TComment2EntryMap::const_iterator anIter = aComment2EntryMap.find(aComment.latin1());
+           if(anIter != aComment2EntryMap.end()){
+             const std::string& anEntry = anIter->second;
+             CreateReference(myStudyDocument,aGroupEntry,anEntry);
+           }
          }
        }
       }
-
       //Import fields
       string aFieldsEntry;
       bool isFieldEntryCreated = 0;
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
-      for (; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
+      for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
        const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
        const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
        VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
-       for (; aFieldMapIter != aFieldMap.end(); aFieldMapIter++) {
-         if (!isFieldEntryCreated) {
-           aComment.sprintf("myComment=FIELDS;myMeshName=%s", aMeshName.c_str());
+       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
+         if(!isFieldEntryCreated){
+           aComment.sprintf("myComment=FIELDS;myMeshName=%s",
+                            aMeshName.c_str());
            aFieldsEntry =
-             CreateAttributes(myStudyDocument, aMeshEntry.c_str(), aRefFatherEntry.c_str(),
-                              "", "Fields", "", aComment.latin1(), true);
+             CreateAttributes(myStudyDocument,
+                              aMeshEntry.c_str(),
+                              aRefFatherEntry.c_str(),
+                              "",
+                              "Fields",
+                              "",
+                              aComment.latin1(),
+                              true);
            isFieldEntryCreated = true;
          }
          const string& aFieldName = aFieldMapIter->first;
          const VISU::PField aField = aFieldMapIter->second;
          const VISU::TValField& aValField = aField->myValField;
          QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField->myUnitNames[0]);
-         aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;"
-                          "myNbTimeStamps=%d;myNumComponent=%d",
-                          VISU::TFIELD, aMeshName.c_str(), anEntity, aFieldName.c_str(),
-                          aValField.size(), aField->myNbComp);
-         string aFieldEntry =
-           CreateAttributes(myStudyDocument, aFieldsEntry.c_str(), aRefFatherEntry.c_str(),
-                            "", aFieldNameWithUnit.latin1(), "", aComment.latin1(), true);
-         CreateReference(myStudyDocument, aFieldEntry, aEntity2EntryMap[anEntity]);
-
+         aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
+                          VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField->myNbComp);
+         string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
+                                               "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true);
+         CreateReference(myStudyDocument,aFieldEntry,aEntity2EntryMap[anEntity]);
          VISU::TValField::const_iterator aValFieldIter = aValField.begin();
-         for (; aValFieldIter != aValField.end(); aValFieldIter++) {
+         for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
            const VISU::PValForTime aValForTime = aValFieldIter->second;
-           aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;"
-                            "myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                            VISU::TTIMESTAMP, aMeshName.c_str(), anEntity,
-                            aFieldName.c_str(), aTimeStamp, aField->myNbComp);
+           aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
+                            VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField->myNbComp);
            string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
-           CreateAttributes(myStudyDocument, aFieldEntry.c_str(), aRefFatherEntry.c_str(),
-                            "", aTimeStampId.c_str(), "", aComment.latin1(), true);
+           CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
+                            "",aTimeStampId.c_str(),"",aComment.latin1(),true);
          }
        }
       }
     }
     bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false);
-    if (isBuildAll) BuildAll();
-  } catch(std::exception& exc) {
+    if(isBuildAll) BuildAll();
+  }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
     return NULL;
-  } catch(...) {
+  }catch(...){
     INFOS("Unknown exception was occured!!!");
     return NULL;
   }
@@ -714,9 +729,12 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName,
       MESSAGE("No mesh named " << theMeshName );
       return components;
     }
-    VISU_Convertor::TOutput* vtkMesh = myInput->GetMeshOnEntity (theMeshName,
-                                                                 CELL_ENTITY);
-    if ( !vtkMesh || vtkMesh->GetNumberOfCells() == 0 ) {
+
+    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;
     }
@@ -727,9 +745,9 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName,
     gp_Vec axDirs[ nbAxes ];
     float minSize[3] = { FLT_MAX, FLT_MAX, FLT_MAX };
     bool axesComputed = false;
-    for ( vtkIdType iCell = 0; iCell < vtkMesh->GetNumberOfCells(); ++iCell )
+    for ( vtkIdType iCell = 0; iCell < aMesh->GetNumberOfCells(); ++iCell )
     {
-      vtkCell* cell = vtkMesh->GetCell( iCell );
+      vtkCell* cell = aMesh->GetCell( iCell );
       int nbPnt = cell->GetNumberOfPoints();
       if ( nbPnt != 8 )
         continue;
@@ -777,8 +795,8 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName,
     // on axis direction; define bnd box
     set< float > comps[ 3 ];
     Bnd_Box box;
-    vtkPoints * points = vtkMesh->GetPoints();
-    vtkIdType iP, nbP = vtkMesh->GetNumberOfPoints();
+    vtkPoints * points = aMesh->GetPoints();
+    vtkIdType iP, nbP = aMesh->GetNumberOfPoints();
     for ( iP = 0; iP < nbP; ++iP )
     {
       float* coo = points->GetPoint( iP );
index ebd818ed8b8efeacf805ae444a2819dc9259f0f7..da9ea7773f3d947eb23a4be7d849d93c0ee5aec3 100644 (file)
@@ -29,8 +29,9 @@
 #include "VISU_Result_i.hh"
 #include "VISU_ViewManager_i.hh"
 
-#include "VISU_ScalarMapPL.hxx"
 #include "VISU_ScalarMapAct.h"
+#include "VISU_ScalarMapPL.hxx"
+#include "VISU_Convertor.hxx"
 
 #include "SUIT_ResourceMgr.h"
 
@@ -48,8 +49,14 @@ static int MYDEBUG = 0;
 
 static int INCMEMORY = 4;
 
-int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
-                                 const char* theFieldName, int theIteration, int isMemoryCheck)
+
+//============================================================================
+int
+VISU::ScalarMap_i
+::IsPossible(Result_i* theResult, 
+            const char* theMeshName, 
+            VISU::Entity theEntity,
+            const char* theFieldName, int theIteration, int isMemoryCheck)
 {
   try{
     float aSize = INCMEMORY*
@@ -68,149 +75,93 @@ int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName,
   return 0;
 }
 
-int VISU::ScalarMap_i::myNbPresent = 0;
-QString VISU::ScalarMap_i::GenerateName() { return VISU::GenerateName("ScalarMap",myNbPresent++);}
+//----------------------------------------------------------------------------
+int
+VISU::ScalarMap_i
+::myNbPresent = 0;
+
+QString
+VISU::ScalarMap_i
+::GenerateName() 
+{ 
+  return VISU::GenerateName("ScalarMap",myNbPresent++);
+}
+
+const string
+VISU::ScalarMap_i
+::myComment = "SCALARMAP";
+
+const char* 
+VISU::ScalarMap_i
+::GetComment() const { 
+  return myComment.c_str();
+}
+
 
-const string VISU::ScalarMap_i::myComment = "SCALARMAP";
-const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
+//----------------------------------------------------------------------------
 VISU::ScalarMap_i::
 ScalarMap_i(Result_i* theResult,
            bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()),
   Prs3d_i(theResult,theAddToStudy),
-  myScalarMapPL(NULL)
-{
-}
-
+  ColoredPrs3d_i(theResult,theAddToStudy)
+{}
 
 VISU::ScalarMap_i::
 ScalarMap_i(Result_i* theResult,
            SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()),
   Prs3d_i(theResult,theSObject),
-  myScalarMapPL(NULL)
-{
-}
+  ColoredPrs3d_i(theResult,theSObject)
+{}
 
+VISU::ScalarMap_i
+::~ScalarMap_i()
+{}
 
-void VISU::ScalarMap_i::RemoveFromStudy()
-{
-  VISU::DeleteActors(this);
-  VISU::RemoveFromStudy(mySObject,false);
-}
 
-
-void VISU::ScalarMap_i::SameAs(const ScalarMap_i* theOrigin)
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::SameAs(const ScalarMap_i* theOrigin)
 {
-  ScalarMap_i* aScalarMap = const_cast<ScalarMap_i*>(theOrigin);
-  DoHook();
-  VISU::Prs3d_i::SameAs(aScalarMap);
-  myField = aScalarMap->GetField();
-  myMeshName = myField->myMeshName;
-  myEntity = myField->myEntity;
-  myIteration = aScalarMap->GetIteration();
-  myFieldName = aScalarMap->GetFieldName();
-
-  SetScalarMode(aScalarMap->GetScalarMode());
-
-  SetRange(aScalarMap->GetMin(), aScalarMap->GetMax());
-  myIsFixedRange = aScalarMap->IsRangeFixed();
-
-  SetScaling(aScalarMap->GetScaling());
-
-  SetBarOrientation(aScalarMap->GetBarOrientation());
-  SetPosition(aScalarMap->GetPosX(), aScalarMap->GetPosY());
-  SetSize(aScalarMap->GetWidth(), aScalarMap->GetHeight());
-  SetNbColors(aScalarMap->GetNbColors());
-  SetLabels(aScalarMap->GetLabels());
-  SetTitle(aScalarMap->GetTitle());
-
-  SetBoldTitle(aScalarMap->IsBoldTitle());
-  SetItalicTitle(aScalarMap->IsItalicTitle());
-  SetShadowTitle(aScalarMap->IsShadowTitle());
-  SetTitFontType(aScalarMap->GetTitFontType());
-  float r,g,b;
-  aScalarMap->GetTitleColor(&r,&g,&b);
-  SetTitleColor(r,g,b);
-
-  SetBoldLabel(aScalarMap->IsBoldLabel());
-  SetItalicLabel(aScalarMap->IsItalicLabel());
-  SetShadowLabel(aScalarMap->IsShadowLabel());
-  SetLblFontType(aScalarMap->GetLblFontType());
-  aScalarMap->GetLabelColor(&r,&g,&b);
-  SetLabelColor(r,g,b);
-
-  Build(-1);
-  Update();
-}
+  TSuperClass::SameAs(theOrigin);
 
-void VISU::ScalarMap_i::SameAsParams (const ScalarMap_i* theOrigin)
-{
-  int time = GetIteration();
-  SameAs(theOrigin);
-  myIteration = time;
+  ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(theOrigin);
+  SetRange(anOrigin->GetMin(), anOrigin->GetMax());
+  myIsFixedRange = anOrigin->IsRangeFixed();
+
+  SetScaling(anOrigin->GetScaling());
 
-  //??Build(true);
-  Build(-1);
   Update();
 }
 
 
+//----------------------------------------------------------------------------
 /**
  * Creates Scalar Map and initialises it from resources
  */
-VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity theEntity,
-                                         const char* theFieldName, int theIteration)
+VISU::Storable* 
+VISU::ScalarMap_i
+::Create(const char* theMeshName, 
+        VISU::Entity theEntity,
+        const char* theFieldName, 
+        int theIteration)
 {
-  DoHook();
+  TSuperClass::Create(theMeshName,theEntity,theFieldName,theIteration);
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
-  int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0);
-  SetScalarMode(aScalarMode);
-
-  // Orientation
-  int orient = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
-  if (orient == 1)
-    myOrientation = VISU::ScalarMap::HORIZONTAL;
-  else
-    myOrientation = VISU::ScalarMap::VERTICAL;
-
-  // Scalar Bar origin
-  QString propertyName = QString( "scalar_bar_%1_" ).arg( orient == 0 ? "vertical" : "horizontal" );
-
-  float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2;
-  aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
-  myPosition[0] = aXorigin;
-
-  float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012;
-  aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
-  myPosition[1] = aYorigin;
-
-  // Scalar Bar size
-  myWidth = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.1 : 0.6;
-  myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
-
-  myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12;
-  myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
-
-  // Nb of Colors
-  int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 );
-  SetNbColors(aNumberOfColors);
-
-  // Nb of Labels
-  myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 );
-
   // Scalar Range
-  int rangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
-  myIsFixedRange = (rangeType == 1) ? true : false;
-
-  if (myIsFixedRange)
-    {
-      float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
-      float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
-      SetRange(aMin,aMax);
-    }
+  int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0);
+  myIsFixedRange = (aRangeType == 1) ? true : false;
+
+  if(myIsFixedRange){
+    float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0);
+    float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0);
+    SetRange(aMin,aMax);
+  }
 
   bool isLog = aResourceMgr->booleanValue("VISU", "scalar_bar_logarithmic", false);
 
@@ -219,280 +170,157 @@ VISU::Storable* VISU::ScalarMap_i::Create(const char* theMeshName, VISU::Entity
   else
     SetScaling(VISU::LINEAR);
 
-  // Fonts properties definition
-  myIsBoldTitle = myIsItalicTitle = myIsShadowTitle = true;
-  myTitFontType = VTK_ARIAL;
-
-  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_title_font" ) )
-    {
-      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_title_font" );
-
-      if ( f.family() == "Arial" )
-       myTitFontType = VTK_ARIAL;
-      else if ( f.family() == "Courier" )
-       myTitFontType = VTK_COURIER;
-      else if ( f.family() == "Times" )
-       myTitFontType = VTK_TIMES;
-
-      myIsBoldTitle   = f.bold();
-      myIsItalicTitle = f.italic();
-      myIsShadowTitle =  f.underline();
-    }
-
-  QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
-
-  myTitleColor[0] = aTextColor.red()   / 255;
-  myTitleColor[1] = aTextColor.green() / 255;
-  myTitleColor[2] = aTextColor.blue()  / 255;
-
-  ///
-
-  myIsBoldLabel = myIsItalicLabel = myIsShadowLabel = true;
-  myLblFontType = VTK_ARIAL;
-
-  if ( aResourceMgr->hasValue( "VISU", "scalar_bar_label_font" ) )
-    {
-      QFont f = aResourceMgr->fontValue( "VISU", "scalar_bar_label_font" );
-
-      if ( f.family() == "Arial" )
-       myLblFontType = VTK_ARIAL;
-      else if ( f.family() == "Courier" )
-       myLblFontType = VTK_COURIER;
-      else if ( f.family() == "Times" )
-       myLblFontType = VTK_TIMES;
-
-      myIsBoldLabel   = f.bold();
-      myIsItalicLabel = f.italic();
-      myIsShadowLabel =  f.underline();
-    }
-
-  QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
-
-  myLabelColor[0] = aLabelColor.red()   / 255;
-  myLabelColor[1] = aLabelColor.green() / 255;
-  myLabelColor[2] = aLabelColor.blue()  / 255;
-
-
-  myMeshName = theMeshName;
-  myEntity = (VISU::TEntity)theEntity;
-  myFieldName =theFieldName;
-  myIteration = theIteration;
-
-  return Build(false);
+  return this;
 }
 
-
-VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap)
+VISU::Storable* 
+VISU::ScalarMap_i
+::Restore(const Storable::TRestoringMap& theMap)
 {
-  DoHook();
-  myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
-  myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
-  myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
-  myIteration = VISU::Storable::FindValue(theMap,"myIteration").toInt();
+  TSuperClass::Restore(theMap);
 
-  SetScalarMode(VISU::Storable::FindValue(theMap,"myScalarMode").toInt());
   SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
+
   float aMin = VISU::Storable::FindValue(theMap,"myScalarRange[0]").toDouble();
   float aMax = VISU::Storable::FindValue(theMap,"myScalarRange[1]").toDouble();
   SetRange(aMin,aMax);
+
   myIsFixedRange = VISU::Storable::FindValue(theMap,"myIsFixedRange").toInt();
 
-  myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1();
-  myOrientation = (VISU::ScalarMap::Orientation)VISU::Storable::FindValue(theMap,"myOrientation").toInt();
-  SetNbColors(VISU::Storable::FindValue(theMap,"myNumberOfColors").toInt());
-  myNumberOfLabels = VISU::Storable::FindValue(theMap,"myNumberOfLabels").toInt();
-  myPosition[0] = VISU::Storable::FindValue(theMap,"myPosition[0]").toDouble();
-  myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
-  myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
-  myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
-
-  myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
-  myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
-  myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
-  myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
-  myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
-  myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
-  myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
-
-  myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
-  myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
-  myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
-  myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
-  myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
-  myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
-  myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
-
-  Prs3d_i::Restore(theMap);
-  myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
-  return Build(true);
+  return this;
 }
 
+void 
+VISU::ScalarMap_i
+::ToStream(std::ostringstream& theStr)
+{
+  TSuperClass::ToStream(theStr);
 
-void VISU::ScalarMap_i::ToStream(std::ostringstream& theStr){
-  Prs3d_i::ToStream(theStr);
-
-  Storable::DataToStream( theStr, "myMeshName",       myMeshName.c_str() );
-  Storable::DataToStream( theStr, "myEntity",         myEntity );
-  Storable::DataToStream( theStr, "myFieldName",      myFieldName.c_str() );
-  Storable::DataToStream( theStr, "myIteration",      myIteration );
-
-  Storable::DataToStream( theStr, "myScalarMode",     int(GetScalarMode()) );
   Storable::DataToStream( theStr, "myScalarRange[0]", GetMin() );
   Storable::DataToStream( theStr, "myScalarRange[1]", GetMax() );
   Storable::DataToStream( theStr, "myIsFixedRange",   myIsFixedRange );
   Storable::DataToStream( theStr, "myScaling",        GetScaling() );
-
-  Storable::DataToStream( theStr, "myTitle",          myTitle.c_str() );
-  Storable::DataToStream( theStr, "myOrientation",    myOrientation );
-  Storable::DataToStream( theStr, "myNumberOfColors", int(GetNbColors()) );
-  Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
-  Storable::DataToStream( theStr, "myPosition[0]",    myPosition[0] );
-  Storable::DataToStream( theStr, "myPosition[1]",    myPosition[1] );
-  Storable::DataToStream( theStr, "myWidth",          myWidth );
-  Storable::DataToStream( theStr, "myHeight",         myHeight );
-
-  Storable::DataToStream( theStr, "myTitFontType",    myTitFontType );
-  Storable::DataToStream( theStr, "myIsBoldTitle",    myIsBoldTitle );
-  Storable::DataToStream( theStr, "myIsItalicTitle",  myIsItalicTitle );
-  Storable::DataToStream( theStr, "myIsShadowTitle",  myIsShadowTitle );
-  Storable::DataToStream( theStr, "myTitleColor[0]",  myTitleColor[0] );
-  Storable::DataToStream( theStr, "myTitleColor[1]",  myTitleColor[1] );
-  Storable::DataToStream( theStr, "myTitleColor[2]",  myTitleColor[2] );
-
-  Storable::DataToStream( theStr, "myLblFontType",    myLblFontType );
-  Storable::DataToStream( theStr, "myIsBoldLabel",    myIsBoldLabel );
-  Storable::DataToStream( theStr, "myIsItalicLabel",  myIsItalicLabel );
-  Storable::DataToStream( theStr, "myIsShadowLabel",  myIsShadowLabel );
-  Storable::DataToStream( theStr, "myLabelColor[0]",  myLabelColor[0] );
-  Storable::DataToStream( theStr, "myLabelColor[1]",  myLabelColor[1] );
-  Storable::DataToStream( theStr, "myLabelColor[2]",  myLabelColor[2] );
 }
 
 
-CORBA::Long VISU::ScalarMap_i::GetScalarMode(){
-  return myScalarMapPL->GetScalarMode();
-}
-void VISU::ScalarMap_i::SetScalarMode(CORBA::Long theScalarMode) {
-  myScalarMapPL->SetScalarMode(theScalarMode);
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::SetBarOrientation(VISU::ScalarMap::Orientation theOrientation)
+{
+  TSuperClass::SetBarOrientation(theOrientation);
 }
 
+VISU::ScalarMap::Orientation 
+VISU::ScalarMap_i
+::GetBarOrientation() 
+{
+  return TSuperClass::GetBarOrientation();
+}
 
-VISU::Scaling VISU::ScalarMap_i::GetScaling(){
+VISU::Scaling 
+VISU::ScalarMap_i
+::GetScaling()
+{
   return VISU::Scaling(myScalarMapPL->GetScaling());
 }
-void VISU::ScalarMap_i::SetScaling(VISU::Scaling theScaling){
+
+void
+VISU::ScalarMap_i
+::SetScaling(VISU::Scaling theScaling)
+{
   myScalarMapPL->SetScaling(theScaling);
 }
 
-
-void VISU::ScalarMap_i::SetRange(CORBA::Double theMin, CORBA::Double theMax){
-  if(theMin > theMax) return;
+void
+VISU::ScalarMap_i
+::SetRange(CORBA::Double theMin, CORBA::Double theMax)
+{
+  if(theMin > theMax) 
+    return;
   float aScalarRange[2] = {theMin, theMax};
   myScalarMapPL->SetScalarRange(aScalarRange);
   myIsFixedRange = true;
 }
 
-CORBA::Double VISU::ScalarMap_i::GetMin(){
+CORBA::Double 
+VISU::ScalarMap_i
+::GetMin()
+{
   return myScalarMapPL->GetScalarRange()[0];
 }
 
-CORBA::Double VISU::ScalarMap_i::GetMax(){
+CORBA::Double 
+VISU::ScalarMap_i
+::GetMax()
+{
   return myScalarMapPL->GetScalarRange()[1];
 }
 
 
-void VISU::ScalarMap_i::SetNbColors(CORBA::Long theNbColors){
-  myScalarMapPL->SetNbColors(theNbColors);
-}
-
-CORBA::Long VISU::ScalarMap_i::GetNbColors(){
-  return myScalarMapPL->GetNbColors();
-}
+//----------------------------------------------------------------------------
+void 
+VISU::ScalarMap_i
+::DoSetInput(Result_i* theResult)
+{
+  VISU::Result_i::TInput* anInput = theResult->GetInput();
+  if(!anInput)
+    throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!");
 
+  myField = anInput->GetField(myMeshName,myEntity,myFieldName);
+  if(!myField) 
+    throw std::runtime_error("There is no Field with the parameters !!!");
 
-VISU::ScalarMap_i::~ScalarMap_i(){}
+  VISU::PIDMapper anIDMapper =
+    anInput->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
 
+  if(!anIDMapper) 
+    throw std::runtime_error("There is no TimeStamp with the parameters !!!");
 
-VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
-  if(MYDEBUG)
-    MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
-  SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
-  if(myAddToStudy) aStudyBuilder->NewCommand();  // There is a transaction
-  try{
-    DoSetInput(myResult);
-    QString aComment;
-    myName = "NoName";
-    if(theRestoring <= 0){
-      if(theRestoring == 0) myScalarMapPL->Init();
-      if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
-      const VISU::TValField& aValField = myField->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(myAddToStudy){
-      myName = GenerateName().latin1();
-      aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                      VISU::TTIMESTAMP,myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
-      string aResultEntry = myResult->GetEntry();
-      string aRefFatherEntry = myResult->GetRefFatherEntry();
-      string anEntry = myResult->GetEntry(aComment.latin1());
-      if(anEntry == "") throw std::runtime_error("There is no Entry for binding the presentation !!!");
-      aComment.sprintf("myComment=%s;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                      GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
-      CORBA::String_var anIOR = GetID();
-      CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
-      mySObject = myStudy->FindObjectIOR(anIOR);
-    }
-  }catch(std::exception& exc){
-    INFOS("Follow exception was occured :\n"<<exc.what());
-    return NULL;
-  }catch(...){
-    INFOS("Unknown exception was occured!");
-    return NULL;
-  }
-  if(myAddToStudy) aStudyBuilder->CommitCommand();
-  return this;
+  myScalarMapPL->SetIDMapper(anIDMapper);
+  myScalarMapPL->Init();
+  myScalarMapPL->Build();
 }
 
-
-void VISU::ScalarMap_i::DoSetInput(Result_i* theResult){
-  if(theResult->GetInput() == NULL)
-    throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!");
-  myField = theResult->GetInput()->GetField(myMeshName,myEntity,myFieldName);
-  if(myField == NULL) 
-    throw std::runtime_error("There is no Field with the parameters !!!");
-  VISU_Convertor::TOutput *anOutput =
-    theResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
-  if(anOutput == NULL) 
-    throw std::runtime_error("There is no TimeStamp with the parameters !!!");
-  myScalarMapPL->SetInput(anOutput);
-  myScalarMapPL->Build();
+void
+VISU::ScalarMap_i
+::Update() 
+{
+  TSuperClass::Update();
 }
 
 
-void VISU::ScalarMap_i::DoHook(){
-  if(MYDEBUG)  MESSAGE("ScalarMap_i::DoHook() - "<<myPipeLine);
-  if(!myPipeLine) {
-    myPipeLine = VISU_ScalarMapPL::New();
-    myPipeLine->GetMapper()->SetScalarVisibility(1);
-  }
-  myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
+//----------------------------------------------------------------------------
+void
+VISU::ScalarMap_i
+::SetMapScale(double theMapScale)
+{
+  myScalarMapPL->SetMapScale(theMapScale);
 }
 
-void VISU::ScalarMap_i::Update() {
-  VISU::Prs3d_i::Update();
+bool
+VISU::ScalarMap_i
+::IsRangeFixed() 
+{ 
+  return myIsFixedRange; 
 }
 
-void VISU::ScalarMap_i::SetMapScale(double theMapScale){
-  myScalarMapPL->SetMapScale(theMapScale);
+void
+VISU::ScalarMap_i
+::SetSourceRange()
+{
+  myScalarMapPL->SetSourceRange();
+  myIsFixedRange = false;
 }
 
-VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+//----------------------------------------------------------------------------
+VISU_Actor* 
+VISU::ScalarMap_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
 {
   VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New();
   try{
-    VISU::Prs3d_i::CreateActor(anActor,theIO);
+    TSuperClass::CreateActor(anActor,theIO);
     anActor->SetBarVisibility(true);
     anActor->SetRepresentation(2);
     UpdateActor(anActor);
@@ -503,9 +331,11 @@ VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject
   return anActor;
 }
 
-void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) {
+void
+VISU::ScalarMap_i
+::UpdateActor(VISU_Actor* theActor) 
+{
   if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
-    VISU::Prs3d_i::UpdateActor(theActor);
     VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
     aScalarBar->SetLookupTable(myScalarMapPL->GetBarTable());
     aScalarBar->SetTitle(myTitle.c_str());
@@ -532,10 +362,5 @@ void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) {
 
     aScalarBar->Modified();
   }
-}
-
-
-void VISU::ScalarMap_i::SetSourceRange(){
-  myScalarMapPL->SetSourceRange();
-  myIsFixedRange = false;
+  TSuperClass::UpdateActor(theActor);
 }
index 3ff150209184e1f5993f98d0109ee32f4fc02136..acdf7af3c46aff37e496479d2fbd4a79ed18ec46 100644 (file)
 #ifndef VISU_ScalarMap_i_HeaderFile
 #define VISU_ScalarMap_i_HeaderFile
 
-#include "VISU_Prs3d_i.hh"
+#include "VISU_ColoredPrs3d_i.hh"
 
-class VISU_ScalarMapPL;
 
-namespace VISU{
+namespace VISU
+{
+  //============================================================================
   class ScalarMap_i : public virtual POA_VISU::ScalarMap,
-                     public virtual Prs3d_i
+                     public virtual ColoredPrs3d_i
   {
     static int myNbPresent;
     ScalarMap_i();
     ScalarMap_i(const ScalarMap_i&);
 
   public:
+    //----------------------------------------------------------------------------
+    typedef ColoredPrs3d_i TSuperClass;
+
     explicit
     ScalarMap_i(Result_i* theResult,
                bool theAddToStudy);
     explicit
     ScalarMap_i(Result_i* theResult,
                SALOMEDS::SObject_ptr theSObject);
-    virtual void SameAs(const ScalarMap_i* theOrigin);
-    virtual ~ScalarMap_i();
-    virtual void RemoveFromStudy();
-
-    virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
-
-    virtual CORBA::Long GetScalarMode();
-    virtual void SetScalarMode(CORBA::Long theScalarMode);
-
-    virtual VISU::Scaling GetScaling();
-    virtual void SetScaling(VISU::Scaling theScaling);
-
-    virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax);
-    virtual CORBA::Double GetMin();
-    virtual CORBA::Double GetMax();
-
-    virtual void SetNbColors(CORBA::Long theNbColors);
-    virtual CORBA::Long GetNbColors();
-
-    virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){
-      myOrientation = theOrientation;
-    }
-    virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;}
-
-    virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
-    virtual CORBA::Double GetPosX() { return myPosition[0];}
-    virtual CORBA::Double GetPosY() { return myPosition[1];}
-
-    virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight) {
-      myWidth = theWidth; myHeight = theHeight;
+    virtual
+    ~ScalarMap_i();
+
+    virtual
+    VISU::VISUType 
+    GetType() 
+    { 
+      return VISU::TSCALARMAP;
     }
-    virtual CORBA::Double GetWidth() { return myWidth;}
-    virtual CORBA::Double GetHeight() { return myHeight;}
 
-    virtual void SetLabels(CORBA::Long theNbLabels) { myNumberOfLabels = theNbLabels;}
-    virtual CORBA::Long GetLabels() { return myNumberOfLabels;}
+    virtual 
+    VISU::Scaling 
+    GetScaling();
 
-    virtual void SetTitle(const char* theName) { myTitle = theName;}
-    virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
+    virtual
+    void
+    SetScaling(VISU::Scaling theScaling);
 
-    virtual bool IsBoldTitle() { return myIsBoldTitle;}
-    virtual void SetBoldTitle(bool isBold) { myIsBoldTitle = isBold;}
+    virtual
+    void
+    SetRange(CORBA::Double theMin, CORBA::Double theMax);
 
-    virtual bool IsItalicTitle() { return myIsItalicTitle;}
-    virtual void SetItalicTitle(bool isItalic) { myIsItalicTitle = isItalic;}
+    virtual
+    CORBA::Double 
+    GetMin();
 
-    virtual bool IsShadowTitle() { return myIsShadowTitle;}
-    virtual void SetShadowTitle(bool isShadow) { myIsShadowTitle = isShadow;}
+    virtual
+    CORBA::Double 
+    GetMax();
 
-    virtual int GetTitFontType() { return myTitFontType;}
-    virtual void SetTitFontType(int theType) { myTitFontType = theType;}
+    // To provide backward compatibility
+    virtual
+    void
+    SetBarOrientation(VISU::ScalarMap::Orientation theOrientation);
 
-    virtual void GetTitleColor(float* theR, float* theG, float* theB)
-    {*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];}
-    virtual void SetTitleColor(float theR, float theG, float theB)
-    {myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; }
-
-    /////
-    virtual bool IsBoldLabel() { return myIsBoldLabel;}
-    virtual void SetBoldLabel(bool isBold) { myIsBoldLabel = isBold;}
-
-    virtual bool IsItalicLabel() { return myIsItalicLabel;}
-    virtual void SetItalicLabel(bool isItalic) { myIsItalicLabel = isItalic;}
-
-    virtual bool IsShadowLabel() { return myIsShadowLabel;}
-    virtual void SetShadowLabel(bool isShadow) {myIsShadowLabel = isShadow;}
-
-    virtual int GetLblFontType() { return myLblFontType;}
-    virtual void SetLblFontType(int theType) { myLblFontType = theType;}
-
-    virtual void GetLabelColor(float* theR, float* theG, float* theB)
-    {*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];}
-    virtual void SetLabelColor(float theR, float theG, float theB)
-    {myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; }
+    virtual 
+    VISU::ScalarMap::Orientation 
+    GetBarOrientation();
 
     typedef VISU::ScalarMap TInterface;
-    VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;}
-
-    /*!
-     *  \brief Works like SameAs() method, but keep myIteration value unchanged.
-     *
-     *  Is used in VISU_TimeAnimation class implementation.
-     */
-    void SameAsParams (const ScalarMap_i* theOrigin);
 
   protected:
-    Storable* Build(int theRestoring);
-    virtual void DoSetInput(Result_i* theResult);
-    virtual void DoHook();
-
-    VISU_ScalarMapPL* myScalarMapPL;
-    PField myField;
-
-    // std::string myMeshName; move it to Prs3d_i
-    TEntity myEntity;
-    std::string myFieldName;
-    int myIteration;
-
-    bool myIsFixedRange;
-
-    std::string myTitle;
-    int myNumberOfLabels;
-    float myPosition[2], myWidth, myHeight;
-    VISU::ScalarMap::Orientation myOrientation;
-
-    //Font management
-    bool myIsBoldTitle;
-    bool myIsItalicTitle;
-    bool myIsShadowTitle;
-    int  myTitFontType;
-    float myTitleColor[3];
-
-    bool myIsBoldLabel;
-    bool myIsItalicLabel;
-    bool myIsShadowLabel;
-    int  myLblFontType;
-    float myLabelColor[3];
+    virtual 
+    void
+    DoSetInput(Result_i* theResult);
 
   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);
+    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);
+
+    static const std::string myComment;
 
-    const std::string& GetMeshName() const { return myMeshName;}
-    VISU::Entity GetEntity() const { return VISU::Entity(myEntity);}
-    const string& GetFieldName() const { return myFieldName;}
-    int GetIteration() const { return myIteration;}
+    virtual
+    const char* 
+    GetComment() const;
 
-    virtual void ToStream(std::ostringstream& theStr);
+    virtual
+    QString
+    GenerateName();
 
-    static const std::string myComment;
-    virtual const char* GetComment() const;
-    virtual QString GenerateName();
+    virtual 
+    Storable* 
+    Restore(const Storable::TRestoringMap& theMap);
 
-    virtual Storable* Restore(const Storable::TRestoringMap& theMap);
+    static 
+    Storable* 
+    Restore(SALOMEDS::SObject_ptr theSObject,
+           const std::string& thePrefix, 
+           const Storable::TRestoringMap& theMap);
 
-    static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
-                            const std::string& thePrefix, const Storable::TRestoringMap& theMap);
+    virtual
+    void
+    Update() ;
 
-    virtual void Update() ;
-    virtual void SetMapScale(double theMapScale = 1.0);
+    virtual
+    void
+    SetMapScale(double theMapScale = 1.0);
 
-    const VISU::PField GetField() const { return myField;}
+    virtual
+    bool
+    IsRangeFixed();
 
-    virtual bool IsRangeFixed() { return myIsFixedRange; }
-    virtual void SetSourceRange();
+    virtual 
+    void
+    SetSourceRange();
 
-    virtual int GetIteration() { return myIteration; }
+    virtual 
+    void
+    SameAs(const ScalarMap_i* theOrigin);
 
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
 
-    virtual void UpdateActor(VISU_Actor* theActor) ;
+    virtual
+    void
+    UpdateActor(VISU_Actor* theActor);
   };
 }
 
index ecfe43c5942117fc36e2752bdcd2ba668c8ab5d1..0ccf6dec34e8bddbaa510e52b7c0aacbb0565189 100644 (file)
 //  Author : Alexey PETROV
 //  Module : VISU
 
-#include "VISU_StreamLinesPL.hxx"
-#include "VISU_Result_i.hh"
 #include "VISU_StreamLines_i.hh"
+#include "VISU_Result_i.hh"
+
 #include "VISU_Actor.h"
+#include "VISU_StreamLinesPL.hxx"
+#include "VISU_Convertor.hxx"
 
 #include <vtkDataSetMapper.h>
 #include <vtkAppendFilter.h>
@@ -46,10 +48,13 @@ 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)) return 0;
-    VISU_Convertor::TOutput *anOutput = 
+    if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) 
+      return 0;
+
+    VISU::PIDMapper anIDMapper = 
       theResult->GetInput()->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
-    bool aResult = VISU_StreamLinesPL::IsPossible(anOutput);
+    VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
+    bool aResult = VISU_StreamLinesPL::IsPossible(aDataSet);
     MESSAGE("StreamLines_i::IsPossible - aResult = "<<aResult);
     return aResult;
   }catch(std::exception& exc){
@@ -74,6 +79,7 @@ StreamLines_i(Result_i* theResult,
              bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
   DeformedShape_i(theResult,theAddToStudy),
   myStreamLinesPL(NULL),
@@ -87,6 +93,7 @@ StreamLines_i(Result_i* theResult,
              SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
   DeformedShape_i(theResult,theSObject),
   myStreamLinesPL(NULL),
@@ -255,9 +262,15 @@ void VISU::StreamLines_i::Update() {
 }
 
 
-VISU_Actor* VISU::StreamLines_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+VISU_Actor* 
+VISU::StreamLines_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
 {
-  return VISU::DeformedShape_i::CreateActor(theIO);
+  if(VISU_Actor* anActor = VISU::DeformedShape_i::CreateActor(theIO)){
+    anActor->SetVTKMapping(true);
+    return anActor;
+  }
+  return NULL;
 }
 
 
index ab8429033c669e926ef33eabfd47bfbd9dbc89f4..a952a9010f57f10c6b6e49ae0533d2f62954777e 100644 (file)
@@ -93,7 +93,9 @@ namespace VISU{
 
     virtual void Update();
 
-    virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
+    virtual 
+    VISU_Actor* 
+    CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL);
 
     virtual void UpdateActor(VISU_Actor* theActor);
 
index 95b90d5b342d1fc96dd02c065addb6eb3d4be64b..cacc4046195e0b58baa47b29480a75ec89c76a1b 100644 (file)
@@ -123,7 +123,6 @@ void VISU_TimeAnimation::clearData(FieldData& theData) {
     for (int i = 0, iEnd = theData.myActors.size(); i < iEnd; i++) {
       if (theData.myActors[i] != 0) {
        theData.myActors[i]->RemoveFromRender(aRen);
-       theData.myActors[i]->Delete();
       }
     }
     theData.myActors.clear();
@@ -331,7 +330,6 @@ void VISU_TimeAnimation::clearView() {
       for (int i = 0, iEnd = aData.myActors.size(); i < iEnd; i++) {
        if (aData.myActors[i] != 0) {
          aData.myActors[i]->RemoveFromRender(aRen);
-         aData.myActors[i]->Delete();
        }
       }
       aData.myActors.clear();
index bd086a600491d10d3f657e513fb2c365d6603259..26218a0b375624fd5e528e47f3c327c0b76afc4d 100644 (file)
 //  Author : Alexey PETROV
 //  Module : VISU
 
-#include "VISU_VectorsPL.hxx"
-#include "VISU_Result_i.hh"
 #include "VISU_Vectors_i.hh"
+#include "VISU_Result_i.hh"
+
 #include "VISU_VectorsAct.h"
+#include "VISU_VectorsPL.hxx"
+#include "VISU_Convertor.hxx"
 
 using namespace VISU;
 using namespace std;
@@ -74,6 +76,7 @@ Vectors_i(Result_i* theResult,
          bool theAddToStudy) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theAddToStudy),
+  ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
   DeformedShape_i(theResult,theAddToStudy),
   myVectorsPL(NULL)
@@ -86,6 +89,7 @@ Vectors_i(Result_i* theResult,
          SALOMEDS::SObject_ptr theSObject) :
   PrsObject_i(theResult->GetStudyDocument()), 
   Prs3d_i(theResult,theSObject),
+  ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
   DeformedShape_i(theResult,theSObject),
   myVectorsPL(NULL)
@@ -179,6 +183,7 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)&
   VISU_VectorsAct* anActor = VISU_VectorsAct::New();
   try{
     VISU::Prs3d_i::CreateActor(anActor,theIO);
+    anActor->SetVTKMapping(true);
     anActor->SetBarVisibility(true);
     anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B);
     anActor->GetProperty()->SetLineWidth(GetLineWidth());
index bcb4ab2fd2a108860504a75e0f1be590c66930f3..4750308c5b0630b3bf98b54a7b3e2884b3658e9a 100644 (file)
@@ -83,7 +83,9 @@ namespace VISU{
     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 = NULL);
 
     virtual void UpdateActor(VISU_Actor* theActor) ;
   };
index 4c6c97e06d45de956e9b5243c267cdbea97ca233..df191e3e41d3f5f5ad52ee1f836df383aa5c6308 100644 (file)
@@ -36,7 +36,6 @@
 #include "SUIT_ViewWindow.h"
 #include "SUIT_ViewManager.h"
 
-#include "SVTK_RenderWindow.h"
 #include "SVTK_ViewWindow.h"
 #include "SVTK_ViewModel.h"
 #include "SPlot2d_Curve.h"
@@ -280,7 +279,7 @@ namespace VISU {
   {
     SVTK_ViewWindow* vf = GetViewWindow(theViewWindow);
     vf->getRenderer()->ResetCameraClippingRange();
-    vf->getRenderWindow()->getRenderWindow()->Render();
+    vf->getRenderWindow()->Render();
   }
 
   VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs)
@@ -296,7 +295,7 @@ namespace VISU {
       if(anActor->IsA("VISU_Actor")){
        anVISUActor = VISU_Actor::SafeDownCast(anActor);
        if (thePrs == anVISUActor->GetPrs3d()) {
-         aResActor = anVISUActor->GetParent();
+         aResActor = anVISUActor;
          if(theDisplaing < eErase)
            aResActor->VisibilityOn();
          else
@@ -457,7 +456,7 @@ namespace VISU {
     while (vtkActor *anActor = anActColl->GetNextActor())
       if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
        if (thePrs3d == anVISUActor->GetPrs3d())
-         return anVISUActor->GetParent();
+         return anVISUActor;
     return NULL;
   }
 
@@ -689,13 +688,12 @@ namespace VISU {
            for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
               if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
                if (thePrs == anVISUActor->GetPrs3d()) {
-                 anActor = anVISUActor->GetParent();
+                 anActor = anVISUActor;
                 }
               }
             }
             if (anActor) {
              vw->RemoveActor(anActor);
-             anActor->Delete();
             }
           }
         }
index e655eac9f3f098b6faf3b4688e205f8305189fc6..be9223a3a9c81864b86c9304ccff12fae4320eac 100644 (file)
@@ -46,7 +46,6 @@
 
 #include "SVTK_ViewWindow.h"
 #include "SVTK_ViewModel.h"
-#include "SVTK_RenderWindow.h"
 
 #include "SPlot2d_ViewModel.h"
 #include "Plot2d_ViewFrame.h"
index 30d837a181124299b26f248e6f55bf150af74aed..f109521824a72305e507d7f593d1a8553d89c42a 100644 (file)
@@ -36,22 +36,25 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
 
 # Libraries targets
 
-LIB = libVISU_Swigcmodule.la
+LIB = libVISU_Swigcmodule.la 
 LIB_SRC = VISU_Gen_s.cc
-SWIG_FLAGS +=
+SWIG_FLAGS += 
 
 SWIG_DEF = libVISU_Swig.i
 EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \
-       visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py \
-       visu_table.py visu_big_table.py visu_view.py visu_delete.py \
-       visu_swig_test.py test_events.py batch_test_events.py visu_split_views.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_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 test_events.py batch_test_events.py
 EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py
 
-LIB_CLIENT_IDL =
+LIB_CLIENT_IDL = 
 
 CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \
-       $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+       $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+       -I${MED_ROOT_DIR}/include/salome \
+       $(BOOST_CPPFLAGS)
+
 LDFLAGS += $(PYTHON_LIBS) -lVisuConvertor -lVisuPipeLine
 
 @CONCLUDE@
\ No newline at end of file
index 1a499def1fdd5915a4e75281bf0bca59e717905f..ddad586a1833a5bfcdb3421275d6f1b47cf6f82a 100644 (file)
@@ -48,8 +48,9 @@ ScalarMap::ScalarMap(Convertor* theConvertor, const char* theMeshName, int theEn
   : myScalarMap(NULL)
 {
   if(VISU_Convertor* aConvertor = theConvertor->GetImpl()){
-    vtkUnstructuredGrid* aDataSet = 
+    VISU::PIDMapper anIDMapper = 
       aConvertor->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
+    VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput();
     if(aDataSet){
       myScalarMap = VISU_ScalarMapPL::New();
       myScalarMap->SetInput(aDataSet);
diff --git a/src/VVTK/Makefile.in b/src/VVTK/Makefile.in
new file mode 100755 (executable)
index 0000000..1516f7d
--- /dev/null
@@ -0,0 +1,64 @@
+#  File   : Makefile.in
+#  Author : Alexander Solovyov(OCN)
+#  Module : VVTK
+# $Header: 
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+
+
+@COMMENCE@
+
+# header files
+EXPORT_HEADERS = \
+       VVTK.h \
+       VVTK_ViewManager.h \
+       VVTK_ViewModel.h \
+       VVTK_InteractorStyle.h \
+       VVTK_PickingDlg.h \
+       VVTK_SegmentationCursorDlg.h \
+       VVTK_ViewWindow.h \
+       VVTK_MainWindow.h
+
+# Libraries targets
+LIB = libVVTK.la
+
+LIB_SRC = \
+       VVTK_ViewManager.cxx \
+       VVTK_ViewModel.cxx \
+       VVTK_InteractorStyle.cxx \
+       VVTK_PickingDlg.cxx \
+       VVTK_SegmentationCursorDlg.cxx \
+       VVTK_ViewWindow.cxx \
+       VVTK_Renderer.cxx \
+       VVTK_MainWindow.cxx
+
+LIB_MOC = \
+       VVTK_ViewWindow.h \
+       VVTK_ViewModel.h \
+       VVTK_ViewManager.h \
+       VVTK_PickingDlg.h \
+       VVTK_SegmentationCursorDlg.h \
+       VVTK_MainWindow.h
+
+CPPFLAGS += \
+       $(QT_INCLUDES) \
+       $(OCC_INCLUDES) \
+       $(VTK_INCLUDES) \
+       $(BOOST_CPPFLAGS) \
+       -I$(KERNEL_ROOT_DIR)/include/salome \
+       -I$(GUI_ROOT_DIR)/include/salome \
+       -I${MED_ROOT_DIR}/include/salome
+
+LDFLAGS += \
+       $(QT_MT_LIBS) \
+       $(OCC_LIBS) \
+       $(VTK_LIBS) \
+       -L$(KERNEL_ROOT_DIR)/lib/salome \
+       -L$(GUI_ROOT_DIR)/lib/salome
+
+LIBS+= -lsuit -lCAM -lSalomeObject -lSVTK -lOpUtil
+
+@CONCLUDE@
diff --git a/src/VVTK/VVTK.h b/src/VVTK/VVTK.h
new file mode 100755 (executable)
index 0000000..d6dd064
--- /dev/null
@@ -0,0 +1,13 @@
+#ifdef WNT
+#ifdef SVTK_EXPORTS
+#define VVTK_EXPORT __declspec(dllexport)
+#else
+#define VVTK_EXPORT __declspec(dllimport)
+#endif
+#else
+#define VVTK_EXPORT
+#endif
+
+#if defined WNT
+#pragma warning ( disable: 4251 )
+#endif
diff --git a/src/VVTK/VVTK_InteractorStyle.cxx b/src/VVTK/VVTK_InteractorStyle.cxx
new file mode 100644 (file)
index 0000000..36f89c8
--- /dev/null
@@ -0,0 +1,291 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : VVTK_InteractorStyle.cxx
+//  Author : Christophe ATTANASIO
+//  Module : SALOME
+//  $Header$
+
+
+#include "VVTK_InteractorStyle.h"
+#include "VISU_GaussPtsSettings.h"
+#include "SVTK_Selector.h"
+#include "VISU_Event.h" 
+
+#include <vtkObjectFactory.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkRenderer.h>
+#include <vtkCamera.h>
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_InteractorStyle);
+//----------------------------------------------------------------------------
+
+VVTK_InteractorStyle
+::VVTK_InteractorStyle():
+  myIsMidButtonDown( false ),
+  myIsLeftButtonDown( false ),
+  mySMDecreaseMagnificationBtn(10),
+  mySMIncreaseMagnificationBtn(11),
+  myPickingSettings(NULL)
+{
+}
+
+//----------------------------------------------------------------------------
+VVTK_InteractorStyle
+::~VVTK_InteractorStyle() 
+{
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::OnLeftButtonDown(int ctrl, int shift, 
+                  int x, int y) 
+{
+  myIsLeftButtonDown = true;
+
+  if (this->HasObserver(vtkCommand::LeftButtonPressEvent)) {
+    this->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL);
+    return;
+  }
+  this->FindPokedRenderer(x, y);
+  if (this->CurrentRenderer == NULL) {
+    return;
+  }
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  myOtherPoint = myPoint = QPoint(x, y);
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    startOperation(ForcedState);
+  } else {
+    if (ctrl)
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+    else {
+      if ( myIsMidButtonDown )
+       startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+      else
+       startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE);
+    }
+  }
+  return;
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::OnMiddleButtonDown(int ctrl,
+                    int shift, 
+                    int x, int y) 
+{
+  myIsMidButtonDown = true;
+
+  if (this->HasObserver(vtkCommand::MiddleButtonPressEvent)) 
+    {
+      this->InvokeEvent(vtkCommand::MiddleButtonPressEvent,NULL);
+      return;
+    }
+  this->FindPokedRenderer(x, y);
+  if (this->CurrentRenderer == NULL)
+    {
+      return;
+    }
+  myShiftState = shift;
+  // finishing current viewer operation
+  if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+  myOtherPoint = myPoint = QPoint(x, y);
+  if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) {
+    startOperation(ForcedState);
+  }
+  else {
+    if ( myIsLeftButtonDown )
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM);
+    else
+      startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN);
+  }
+}
+
+//----------------------------------------------------------------------------
+void 
+VVTK_InteractorStyle
+::OnLeftButtonUp(int ctrl, int shift, int x, int y)
+{
+  myIsLeftButtonDown = false;
+  SVTK_InteractorStyle::OnLeftButtonUp( ctrl, shift, x, y );
+
+  if ( myIsMidButtonDown )
+    OnMiddleButtonDown( ctrl, shift, x, y );
+}
+
+//----------------------------------------------------------------------------
+void  
+VVTK_InteractorStyle
+::OnMiddleButtonUp(int ctrl, int shift, int x, int y)
+{
+  myIsMidButtonDown = false;
+  SVTK_InteractorStyle::OnMiddleButtonUp( ctrl, shift, x, y );
+
+  if ( myIsLeftButtonDown )
+    OnLeftButtonDown( ctrl, shift, x, y );
+}
+
+//----------------------------------------------------------------------------
+void  
+VVTK_InteractorStyle
+::OnKeyDown()
+{
+  if( GetSelector()->SelectionMode() != NodeSelection )
+    return;
+
+  char key = Interactor->GetKeyCode();
+
+  if ( key == 'S' ) {
+    // current mouse position (from last mouse move event or any other event)
+    int x, y;
+    Interactor->GetEventPosition( x, y ); 
+    FindPokedRenderer( x, y ); // calls SetCurrentRenderer
+
+    myOtherPoint = myPoint = QPoint(x, y);
+    //printf ( "--- myPoint[ %d, %d ], myOtherPoint[ %d, %d ] ---\n", 
+    //myPoint.x(), myPoint.y(), myOtherPoint.x(), myOtherPoint.y() );
+    
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
+    onFinishOperation();
+    startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
+  }
+}
+
+//----------------------------------------------------------------------------
+void  VVTK_InteractorStyle::onFinishOperation()
+{
+  int aNbObjWas, aNbObjNow;
+  //
+  aNbObjWas=GetSelector()->IObjectCount();
+  //
+  SVTK_InteractorStyle::onFinishOperation();
+  //
+  aNbObjNow=GetSelector()->IObjectCount();
+  
+  if (aNbObjWas+aNbObjNow==1){
+    vtkCamera *aCamera = GetCurrentRenderer()->GetActiveCamera();
+    float aZoomFactor = myPickingSettings->GetZoomFactor();
+    double aScale = aCamera->GetParallelScale();
+    if (!aNbObjWas && aNbObjNow) {
+      aCamera->SetParallelScale(aScale/aZoomFactor);
+    }
+    else {
+      aCamera->SetParallelScale(aScale*aZoomFactor);
+    }
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::SetInteractor( vtkRenderWindowInteractor* theInteractor )
+{
+  // register EventCallbackCommand as observer of standard events (keypress, mousemove, etc)
+  Superclass::SetInteractor( theInteractor );
+  if(theInteractor){ 
+    theInteractor->AddObserver( VISU::SetSMDecreaseMagnificationEvent, EventCallbackCommand, Priority );
+    theInteractor->AddObserver( VISU::SetSMIncreaseMagnificationEvent, EventCallbackCommand, Priority );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
+{
+  myPickingSettings = thePickingSettings;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::ProcessEvents( vtkObject* object,
+                unsigned long event,
+                void* clientData, 
+                void* callData )
+{
+  if ( clientData ) {
+    vtkObject* anObject = reinterpret_cast<vtkObject*>( clientData );
+    VVTK_InteractorStyle* self = dynamic_cast<VVTK_InteractorStyle*>( anObject );
+    if( self ){
+      switch ( event ) {
+      case VISU::SetSMDecreaseMagnificationEvent:
+       self->mySMDecreaseMagnificationBtn = *((int*)callData);
+       return;
+      case VISU::SetSMIncreaseMagnificationEvent:
+       self->mySMIncreaseMagnificationBtn = *((int*)callData);
+       return;
+      }
+    }
+  }
+
+  Superclass::ProcessEvents( object, event, clientData, callData );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::onSpaceMouseButton( int button )
+{
+  if( mySMDecreaseMagnificationBtn == button )    
+    DecreaseGaussPointMagnification();
+  if( mySMIncreaseMagnificationBtn == button )    
+    IncreaseGaussPointMagnification();
+
+  Superclass::onSpaceMouseButton( button );
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::DecreaseGaussPointMagnification()
+{
+  Interactor->InvokeEvent(VISU::SetSMDecreaseMagnificationEvent,NULL);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_InteractorStyle
+::IncreaseGaussPointMagnification()
+{
+  Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL);
+}
diff --git a/src/VVTK/VVTK_InteractorStyle.h b/src/VVTK/VVTK_InteractorStyle.h
new file mode 100644 (file)
index 0000000..f180b78
--- /dev/null
@@ -0,0 +1,94 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : VVTK_InteractorStyle.h
+//  Author : Christophe ATTANASIO
+//  Module : SALOME
+//  $Header$
+
+#ifndef __VVTK_InteractorStyle_h
+#define __VVTK_InteractorStyle_h
+
+#include "VVTK.h"
+
+#include "SVTK_InteractorStyle.h"
+
+class VISU_PickingSettings;
+
+
+class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle
+{
+ public:
+  // Description:
+  // This class must be supplied with a vtkRenderWindowInteractor wrapper or
+  // parent. This class should not normally be instantiated by application
+  // programmers.
+  static VVTK_InteractorStyle *New();
+  vtkTypeMacro(VVTK_InteractorStyle,SVTK_InteractorStyle);
+
+  // redefined in order to add an observer (callback) for custorm event (space mouse event)
+  virtual
+  void
+  SetInteractor( vtkRenderWindowInteractor* );
+
+  void
+  SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+
+ protected:
+  VVTK_InteractorStyle();
+  ~VVTK_InteractorStyle();
+
+  VVTK_InteractorStyle(const VVTK_InteractorStyle&); // Not implemented
+  void operator=(const VVTK_InteractorStyle&); // Not implemented
+
+  // Generic event bindings must be overridden in subclasses
+  virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y);
+  virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y);
+  virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y);
+  virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y);
+  virtual void OnKeyDown();
+  virtual void onFinishOperation();
+
+  // Main process VTK event method
+  static 
+  void
+  ProcessEvents(vtkObject* object, 
+               unsigned long event,
+               void* clientData, 
+               void* callData );
+
+  virtual void onSpaceMouseButton( int button );
+  void DecreaseGaussPointMagnification();
+  void IncreaseGaussPointMagnification();
+
+  // SpaceMouse short cuts
+  int mySMDecreaseMagnificationBtn;
+  int mySMIncreaseMagnificationBtn;
+  
+  VISU_PickingSettings* myPickingSettings;
+
+  bool myIsMidButtonDown;
+  bool myIsLeftButtonDown;
+};
+
+#endif
diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx
new file mode 100644 (file)
index 0000000..c0b4e76
--- /dev/null
@@ -0,0 +1,291 @@
+//  SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers
+//
+//  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   : 
+//  Author : 
+//  Module : 
+//  $Header$
+
+#include "VVTK_MainWindow.h"
+#include "VVTK_InteractorStyle.h"
+#include "VISU_ImplicitFunctionWidget.h"
+#include "VISU_GaussPtsAct.h"
+
+#include "SVTK_RenderWindowInteractor.h"
+#include "VVTK_Renderer.h"
+#include "VVTK_PickingDlg.h"
+#include "VVTK_SegmentationCursorDlg.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Accel.h"
+#include "QtxAction.h"
+
+#include <qtoolbar.h>
+#include <qsplitter.h>
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow
+::VVTK_MainWindow(QWidget* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr):
+  SVTK_MainWindow(theParent,theName,theResourceMgr),
+  myInteractorStyle(VVTK_InteractorStyle::New())
+{
+  myInteractorStyle->Delete();
+
+  moveDockWindow(myToolBar,Qt::DockLeft);
+  myActionsMap[NonIsometric]->removeFrom(myToolBar);
+}
+
+void
+VVTK_MainWindow
+::Initialize(SVTK_RenderWindowInteractor* theInteractor)
+{
+  SVTK_MainWindow::Initialize(theInteractor);
+  PushInteractorStyle(myInteractorStyle.GetPointer());
+}
+
+VVTK_MainWindow
+::~VVTK_MainWindow()
+{}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_MainWindow
+::OnInteractorStyleSwitch(bool theIsGaussStyleOn)
+{
+  if ( theIsGaussStyleOn )
+    this->PushInteractorStyle(myInteractorStyle.GetPointer());
+  else
+    this->PopInteractorStyle();
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_MainWindow
+::OnSelectionModeSwitch(bool theIsSelectionOn)
+{
+  SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
+}
+
+//----------------------------------------------------------------------------
+int 
+convertAction( const int accelAction );
+
+void 
+VVTK_MainWindow
+::action( const int accelAction  )
+{
+  if ( accelAction == SUIT_Accel::ZoomFit )
+    onFitAll();
+  else {
+    int anEvent = convertAction( accelAction );
+    InvokeEvent( anEvent, 0 );
+  }
+}
+
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow1
+::VVTK_MainWindow1(QSplitter* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr):
+  VVTK_MainWindow(theParent,theName,theResourceMgr),
+  myStyleSwitchAction(NULL),
+  mySplitter(theParent),
+  myPickingDlg(NULL)
+{
+  myPtsToolBar = new QToolBar(this);
+  myPtsToolBar->setCloseMode(QDockWindow::Undocked);
+  myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+  moveDockWindow(myPtsToolBar,Qt::DockLeft);
+
+  QPixmap aPixmap;
+  QtxAction* anAction;
+
+  aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) );
+  anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"), 
+                          aPixmap,
+                          tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ), 
+                          0, 
+                          this, 
+                          "VVTK/SVTK StyleSwitch", 
+                          true);
+  anAction->setToggleAction(true);
+  anAction->toggle();
+  anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
+  anAction->addTo( myPtsToolBar );
+  myStyleSwitchAction = anAction;
+
+  aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
+  anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), 
+                          aPixmap,
+                          tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ), 
+                          0, 
+                          this, 
+                          "VVTK/SVTK SelectionSwitch", 
+                          true);
+  anAction->setToggleAction(true);
+  anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH"));
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool)));
+  anAction->addTo( myPtsToolBar );
+
+  myPickingDlg = new VVTK_PickingDlg( this, "PickingDlg" );
+  myPickingDlg->SetAction( anAction );
+  myInteractorStyle->SetPickingSettings(myPickingDlg->GetPickingSettings());
+
+  aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH"));
+  anAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), 
+                          aPixmap,
+                          tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ), 
+                          0, 
+                          this, 
+                          "VVTK/SVTK PlaneSegmentationSwitch", 
+                          true);
+  anAction->setToggleAction(true);
+  anAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH"));
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnPlaneSegmentationSwitch(bool)));
+  anAction->addTo( myPtsToolBar );
+
+  mySegmentationCursorDlg = new VVTK_SegmentationCursorDlg( this, "SegmentationCursorDlg" );
+  mySegmentationCursorDlg->SetAction( anAction );
+}
+
+void
+VVTK_MainWindow1
+::Initialize(SVTK_RenderWindowInteractor* theInteractor,
+            VVTK_Renderer1* theRenderer)
+{
+  myRenderer = theRenderer;
+  VVTK_MainWindow::Initialize(theInteractor);
+
+  mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() );
+  myPickingDlg->SetInteractor( GetInteractor() );
+}
+
+VVTK_MainWindow1
+::~VVTK_MainWindow1()
+{}
+
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow2*
+VVTK_MainWindow1
+::CreateMainWindow2(QWidget* theParent, 
+                   const char* theName,
+                   SUIT_ResourceMgr* theResourceMgr,
+                   VISU_PickingSettings* thePickingSettings)
+{
+  myMainWindow2 = new VVTK_MainWindow2(theParent,
+                                      theName,
+                                      theResourceMgr,
+                                      thePickingSettings,
+                                      myStyleSwitchAction);
+  //myMainWindow2->hide();
+  return myMainWindow2;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_MainWindow1
+::OnSelectionModeSwitch(bool theIsSelectionOn)
+{
+  VVTK_MainWindow::OnSelectionModeSwitch(theIsSelectionOn);
+
+  if( theIsSelectionOn )
+  {
+    myPickingDlg->Update();
+    myPickingDlg->show();
+  }
+  else
+    myPickingDlg->hide();
+}
+
+
+//----------------------------------------------------------------------------
+VISU_ImplicitFunctionWidget* 
+VVTK_MainWindow1
+::GetImplicitFunctionWidget()
+{
+  return myRenderer->GetImplicitFunctionWidget();
+}
+
+VISU_OutsideCursorSettings* 
+VVTK_MainWindow1
+::GetOutsideCursorSettings()
+{
+  return mySegmentationCursorDlg->GetOutsideCursorSettings();
+}
+
+VISU_PickingSettings* 
+VVTK_MainWindow1
+::GetPickingSettings()
+{
+  return myPickingDlg->GetPickingSettings();
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_MainWindow1
+::OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn)
+{
+  myRenderer->GetImplicitFunctionWidget()->SetEnabled(theIsPlaneSegmentationOn);
+  //mySplitter->setCollapsible(this,!theIsPlaneSegmentationOn);
+
+  if( theIsPlaneSegmentationOn )
+  {
+    myMainWindow2->show();
+    mySegmentationCursorDlg->UpdateSegmentation();
+    mySegmentationCursorDlg->UpdateOutsideCursor();
+    mySegmentationCursorDlg->show();
+  }
+  else
+  {
+    myMainWindow2->hide();
+    mySegmentationCursorDlg->hide();
+  }
+}
+
+
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow2
+::VVTK_MainWindow2(QWidget* theParent, 
+                  const char* theName,
+                  SUIT_ResourceMgr* theResourceMgr,
+                  VISU_PickingSettings* thePickingSettings,
+                  QtxAction* theStyleSwitchAction):
+  VVTK_MainWindow(theParent,theName,theResourceMgr)
+{
+  myInteractorStyle->SetPickingSettings(thePickingSettings);
+
+  connect(theStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
+}
+
+VVTK_MainWindow2
+::~VVTK_MainWindow2()
+{}
+
diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h
new file mode 100644 (file)
index 0000000..4220d5c
--- /dev/null
@@ -0,0 +1,134 @@
+#ifndef VVTK_MAINWINDOW_H
+#define VVTK_MAINWINDOW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "VVTK.h"
+#include "SVTK_MainWindow.h"
+
+class QSplitter;
+
+class VISU_ImplicitFunctionWidget;
+class VVTK_SegmentationCursorDlg;
+class VISU_OutsideCursorSettings;
+class VISU_PickingSettings;
+class VVTK_InteractorStyle;
+class VVTK_PickingDlg;
+class VVTK_MainWindow2;
+class VVTK_Renderer1;
+class VVTK_Renderer2;
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow
+{
+  Q_OBJECT;
+
+public:
+  VVTK_MainWindow(QWidget* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr);
+  virtual
+  void
+  Initialize(SVTK_RenderWindowInteractor* theInteractor);
+
+  virtual
+  ~VVTK_MainWindow();
+
+ public slots:
+  virtual
+  void
+  OnInteractorStyleSwitch(bool theIsGaussStyleOn); 
+
+  virtual
+  void
+  OnSelectionModeSwitch(bool theIsSelectionOn); 
+
+  virtual 
+  void
+  action( const int );
+
+ protected:
+  vtkSmartPointer<VVTK_InteractorStyle> myInteractorStyle;
+};
+
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow
+{
+  Q_OBJECT;
+
+public:
+  VVTK_MainWindow1(QSplitter* theParent, 
+                  const char* theName,
+                  SUIT_ResourceMgr* theResourceMgr);
+  virtual
+  void
+  Initialize(SVTK_RenderWindowInteractor* theInteractor,
+            VVTK_Renderer1* theRenderer);
+
+  
+  virtual
+  ~VVTK_MainWindow1();
+
+  VVTK_MainWindow2*
+  CreateMainWindow2(QWidget* theParent, 
+                   const char* theName,
+                   SUIT_ResourceMgr* theResourceMgr,
+                   VISU_PickingSettings* thePickingSettings);
+
+  VISU_ImplicitFunctionWidget*
+  GetImplicitFunctionWidget();
+
+  VISU_OutsideCursorSettings*
+  GetOutsideCursorSettings();
+
+  VISU_PickingSettings* 
+  GetPickingSettings();
+
+ public slots:
+  void
+  OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); 
+
+  virtual
+  void
+  OnSelectionModeSwitch(bool theIsSelectionOn); 
+
+ protected:
+  VVTK_Renderer1* myRenderer;
+
+  VVTK_MainWindow2* myMainWindow2;
+
+  QtxAction* myStyleSwitchAction;
+  QToolBar* myPtsToolBar;
+  QSplitter* mySplitter;
+
+  VVTK_SegmentationCursorDlg* mySegmentationCursorDlg;
+  VVTK_PickingDlg* myPickingDlg;
+};
+
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow
+{
+  Q_OBJECT;
+
+  friend class VVTK_MainWindow1;
+
+  VVTK_MainWindow2(QWidget* theParent, 
+                  const char* theName,
+                  SUIT_ResourceMgr* theResourceMgr,
+                  VISU_PickingSettings* thePickingSettings,
+                  QtxAction* theStyleSwitchAction);
+public:
+  virtual
+  ~VVTK_MainWindow2();
+};
+
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif
diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx
new file mode 100644 (file)
index 0000000..ca0d7f0
--- /dev/null
@@ -0,0 +1,307 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VVTK_PickingDlg.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VVTK_PickingDlg.h"
+
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPtsSettings.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include "SVTK_RenderWindowInteractor.h"
+
+#include <vtkActorCollection.h>
+#include <vtkCallbackCommand.h>
+#include <vtkObjectFactory.h>
+#include <vtkRenderer.h>
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkSmartPointer.h>
+
+#include "utilities.h"
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qvbox.h>
+
+#include "QtxAction.h"
+#include "QtxDblSpinBox.h"
+#include "QtxIntSpinBox.h"
+
+using namespace std;
+
+VVTK_PickingDlg::VVTK_PickingDlg( QWidget* parent, const char* name )
+  :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+   myEventCallbackCommand( vtkCallbackCommand::New() ),
+   myPickingSettings( VISU_PickingSettings::New() )
+{
+  myPriority = 0.0;
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VVTK_PickingDlg::ProcessEvents);
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  setCaption( tr( "PICKING_DLG_TITLE" ) );
+  setSizeGripEnabled(TRUE);
+
+  QVBoxLayout* TopLayout = new QVBoxLayout( this );
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  QVBox* aBox = new QVBox( this );
+  aBox->setMargin(0);
+  aBox->setSpacing(6);
+
+  // Cursor
+  QGroupBox* CursorGroup = new QGroupBox( tr( "CURSOR_TITLE" ), aBox, "CursorGroup" );
+  CursorGroup->setColumnLayout(0, Qt::Vertical );
+  CursorGroup->layout()->setSpacing( 0 );
+  CursorGroup->layout()->setMargin( 0 );
+
+  QGridLayout* CursorGroupLayout = new QGridLayout (CursorGroup->layout());
+  CursorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  CursorGroupLayout->setSpacing(6);
+  CursorGroupLayout->setMargin(11);
+
+  QLabel* PyramidHeightLabel = new QLabel( tr( "PYRAMID_HEIGHT" ), CursorGroup );
+  myPyramidHeightSpinBox = new QtxDblSpinBox( 1.0, 100.0, 1.0, CursorGroup );
+  myPyramidHeightSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  CursorGroupLayout->addWidget( PyramidHeightLabel, 0, 0 );
+  CursorGroupLayout->addWidget( myPyramidHeightSpinBox, 0, 1 );
+
+  // Information window
+  QGroupBox* InfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), aBox, "InfoWindowGroup" );
+  InfoWindowGroup->setColumnLayout(0, Qt::Vertical );
+  InfoWindowGroup->layout()->setSpacing( 0 );
+  InfoWindowGroup->layout()->setMargin( 0 );
+
+  QGridLayout* InfoWindowGroupLayout = new QGridLayout (InfoWindowGroup->layout());
+  InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  InfoWindowGroupLayout->setSpacing(6);
+  InfoWindowGroupLayout->setMargin(11);
+
+  QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), InfoWindowGroup );
+  myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, InfoWindowGroup );
+  myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+  InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+
+  QLabel* PositionLabel = new QLabel( tr( "POSITION" ), InfoWindowGroup );
+  myPositionComboBox = new QComboBox( InfoWindowGroup );
+  myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  myPositionComboBox->insertItem( tr( "BELOW_POINT" ) );
+  myPositionComboBox->insertItem( tr( "TOP_LEFT_CORNER" ) );
+
+  InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+  InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+  InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 );
+  InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 );
+
+  // Movement of the camera
+  QGroupBox* CameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), aBox, "CameraGroup" );
+  CameraGroup->setColumnLayout(0, Qt::Vertical );
+  CameraGroup->layout()->setSpacing( 0 );
+  CameraGroup->layout()->setMargin( 0 );
+
+  QGridLayout* CameraGroupLayout = new QGridLayout (CameraGroup->layout());
+  CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  CameraGroupLayout->setSpacing(6);
+  CameraGroupLayout->setMargin(11);
+
+  QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), CameraGroup );
+  myZoomFactorSpinBox = new QtxDblSpinBox( 0.1, 10.0, 0.1, CameraGroup );
+  myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), CameraGroup );
+  myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, CameraGroup );
+  myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 );
+  CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 );
+  CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
+  CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
+
+  // Display parent mesh element
+  QGroupBox* ParentMeshGroup = new QGroupBox( tr( "PARENT_MESH_TITLE" ), aBox, "ParentMeshGroup" );
+  ParentMeshGroup->setColumnLayout(0, Qt::Vertical );
+  ParentMeshGroup->layout()->setSpacing( 0 );
+  ParentMeshGroup->layout()->setMargin( 0 );
+
+  QGridLayout* ParentMeshGroupLayout = new QGridLayout (ParentMeshGroup->layout());
+  ParentMeshGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+  ParentMeshGroupLayout->setSpacing(6);
+  ParentMeshGroupLayout->setMargin(11);
+
+  myDisplayParentMeshCheckBox = new QCheckBox( tr( "DISPLAY_PARENT_MESH" ), ParentMeshGroup );
+  ParentMeshGroupLayout->addWidget( myDisplayParentMeshCheckBox, 0, 0 );
+
+  // Common buttons ===========================================================
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonApply = new QPushButton( tr( "&Apply" ), GroupButtons, "buttonApply" );
+  buttonApply->setAutoDefault( TRUE );
+  buttonApply->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonApply, 0, 0 );
+  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+  QPushButton* buttonClose = new QPushButton( tr( "&Close" ) , GroupButtons, "buttonClose" );
+  buttonClose->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonClose, 0, 2 );
+
+  TopLayout->addWidget( aBox );
+  TopLayout->addWidget( GroupButtons );
+
+  connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
+  connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) );
+}
+
+VVTK_PickingDlg::~VVTK_PickingDlg()
+{
+}
+
+void VVTK_PickingDlg::AddActor( VISU_GaussPtsAct* theActor )
+{
+  theActor->SetPickingSettings( myPickingSettings.GetPointer() );
+}
+
+void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor )
+{
+  theActor->SetPickingSettings( NULL );
+}
+
+void VVTK_PickingDlg::Update()
+{
+  float aPyramidHeight = 10.0;
+  int anInfoWindowTransparency = 50;
+  int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
+  float aZoomFactor = 1.5;
+  int aStepNumber = 10;
+  bool aDisplayParentMesh = false;
+
+  if( !myPickingSettings->GetInitial() )
+  {
+    myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
+    myTransparencySpinBox->setValue( myPickingSettings->GetInfoWindowTransparency() * 100.0 );
+    myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() );
+    myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
+    myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
+    myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
+
+    return;
+  }
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
+  myPyramidHeightSpinBox->setValue( aPyramidHeight );
+
+  anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency );
+  myTransparencySpinBox->setValue( anInfoWindowTransparency );
+
+  anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition );
+  myPositionComboBox->setCurrentItem( anInfoWindowPosition );
+
+  aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor );
+  myZoomFactorSpinBox->setValue( aZoomFactor );
+
+  aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber );
+  myStepNumberSpinBox->setValue( aStepNumber );
+
+  aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh );
+  myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
+
+  onClickApply();
+}
+
+
+VISU_PickingSettings* 
+VVTK_PickingDlg
+::GetPickingSettings()
+{
+  return myPickingSettings.GetPointer();
+}
+
+void VVTK_PickingDlg::SetInteractor( SVTK_RenderWindowInteractor* theInteractor )
+{
+  myInteractor = theInteractor;
+
+  theInteractor->GetDevice()->AddObserver(vtkCommand::KeyPressEvent, 
+                                         myEventCallbackCommand.GetPointer(), 
+                                         myPriority);
+}
+
+
+void VVTK_PickingDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+                                   unsigned long theEvent,
+                                   void* theClientData, 
+                                   void* vtkNotUsed(theCallData))
+{
+  VVTK_PickingDlg* self = reinterpret_cast<VVTK_PickingDlg*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::KeyPressEvent:
+    self->KeyPressed();
+    break;
+  }
+}
+
+void VVTK_PickingDlg::KeyPressed()
+{
+  if( myInteractor->GetDevice()->GetKeyCode() == 'P' )
+  {
+    bool aDisplayParentMesh = !myPickingSettings->GetDisplayParentMesh();
+    myPickingSettings->SetDisplayParentMesh( aDisplayParentMesh );
+
+    myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
+
+    myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
+  }
+}
+
+void VVTK_PickingDlg::onClickApply()
+{
+  myPickingSettings->SetInitial( false );
+
+  myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
+  myPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 );
+  myPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentItem() );
+  myPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
+  myPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
+  myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
+
+  myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
+}
+
+void VVTK_PickingDlg::onClickClose()
+{
+  myAction->setOn( false );
+  reject();
+}
+
+void VVTK_PickingDlg::done( int r )
+{
+  myAction->setOn( false );
+  QDialog::done( r );
+}
diff --git a/src/VVTK/VVTK_PickingDlg.h b/src/VVTK/VVTK_PickingDlg.h
new file mode 100644 (file)
index 0000000..5f4fb2d
--- /dev/null
@@ -0,0 +1,86 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VVTK_PickingDlg.h
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VVTK_PICKINGDLG_H
+#define VVTK_PICKINGDLG_H
+
+#include <qdialog.h>
+
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+
+class vtkActorCollection;
+class vtkCallbackCommand;
+class vtkImageData;
+
+class QLabel;
+class QComboBox;
+class QCheckBox;
+
+class QtxAction;
+class QtxDblSpinBox;
+class QtxIntSpinBox;
+
+class VISU_GaussPtsAct;
+class VISU_PickingSettings;
+
+class SVTK_RenderWindowInteractor;
+
+class VVTK_PickingDlg : public QDialog
+{
+  Q_OBJECT
+
+public:
+  VVTK_PickingDlg( QWidget* parent = 0, const char* name = 0 );
+  ~VVTK_PickingDlg();
+
+  void             SetAction( QtxAction* theAction ) { myAction = theAction; }
+
+  void             AddActor( VISU_GaussPtsAct* );
+  void             RemoveActor( VISU_GaussPtsAct* );
+
+  void             Update();
+
+  VISU_PickingSettings* GetPickingSettings();
+
+  void             SetInteractor( SVTK_RenderWindowInteractor* );
+
+protected slots:
+  virtual void     done( int );
+
+  void             onClickApply();
+  void             onClickClose();
+
+private:
+  static void      ProcessEvents(vtkObject* theObject, 
+                                unsigned long theEvent,
+                                void* theClientData, 
+                                void* theCallData);
+
+  void             KeyPressed();
+
+private:
+  QtxDblSpinBox*   myPyramidHeightSpinBox;
+  QtxIntSpinBox*   myTransparencySpinBox;
+  QComboBox*       myPositionComboBox;
+  QtxDblSpinBox*   myZoomFactorSpinBox;
+  QtxIntSpinBox*   myStepNumberSpinBox;
+  QCheckBox*       myDisplayParentMeshCheckBox;
+
+  QtxAction*       myAction;
+  vtkSmartPointer<VISU_PickingSettings> myPickingSettings;
+
+  SVTK_RenderWindowInteractor* myInteractor;
+
+  float            myPriority;
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+};
+
+#endif
diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx
new file mode 100644 (file)
index 0000000..142008d
--- /dev/null
@@ -0,0 +1,389 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   :
+//  Author :
+//  Module :
+//  $Header$
+
+#include "VVTK_Renderer.h"
+
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_ImplicitFunctionWidget.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkProperty.h>
+
+#include <vtkRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkPlane.h>
+
+#include <vtkPropCollection.h>
+#include <vtkProp.h>
+#include <vtkActor.h>
+#include <vtkMapper.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+#include <vtkTextMapper.h>
+#include <vtkTextActor.h> 
+#include <vtkTextProperty.h>
+#include <vtkRenderer.h>
+
+#include <vtkPropCollection.h>
+#include <vtkProp.h>
+#include <vtkActor.h>
+#include <vtkMapper.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkPolyData.h>
+#include <vtkTextMapper.h>
+#include <vtkTextActor.h> 
+#include <vtkTextProperty.h>
+#include <vtkRenderer.h>
+
+#include "utilities.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+//======================================================================
+class VISU_FPSActor : public vtkTextActor 
+{
+public:
+  vtkTypeMacro( VISU_FPSActor, vtkTextActor);
+  static
+  VISU_FPSActor* 
+  New();
+
+  virtual
+  int
+  RenderOpaqueGeometry(vtkViewport *theViewport);
+};
+
+//======================================================================
+vtkStandardNewMacro(VISU_FPSActor);
+
+//======================================================================
+// function: RenderOpaqueGeometry
+// purpose :
+//======================================================================
+int
+VISU_FPSActor
+::RenderOpaqueGeometry(vtkViewport *theViewport) 
+{
+  // It's impossible to render opaque geometry of text actor
+  // if the size of the viewport is less than 1.0
+  int *size = theViewport->GetSize();
+  if( size[0] <= 1.0 || size[1] <= 1.0 )
+    return 1;
+
+  if(vtkRenderer *aRenderer = dynamic_cast<vtkRenderer*>(theViewport)){
+    static float aTol = 1.e-6;
+    float aLastRenderTimeInSeconds = aRenderer->GetLastRenderTimeInSeconds();
+    if(aLastRenderTimeInSeconds > aTol){
+      size_t aNumberOfCells = 0;
+      if(vtkActorCollection *anActorCollection = aRenderer->GetActors()){
+       anActorCollection->InitTraversal();
+       while(vtkActor *anActor = anActorCollection->GetNextActor()){
+         if(anActor->GetVisibility()){
+           if(SALOME_Actor *aSActor = dynamic_cast<SALOME_Actor*>(anActor)){
+             if(vtkMapper *aMapper = aSActor->GetMapper()){
+               if(vtkDataSet *aDataSet = aMapper->GetInput()){
+                 aNumberOfCells += aDataSet->GetNumberOfCells();
+               }
+             }
+           }
+         }
+       }
+      }
+      std::ostringstream aStr;
+      float aFPS = 1.0 / aLastRenderTimeInSeconds;
+      aStr<<"FPS: "<<aFPS<<"; NumberOfCells: "<<aNumberOfCells;
+      std::string anInput = aStr.str();
+      SetInput(anInput.c_str());
+      return Superclass::RenderOpaqueGeometry(theViewport);
+    }
+  }
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_Renderer);
+
+//----------------------------------------------------------------------------
+VVTK_Renderer
+::VVTK_Renderer():
+  myFPSActor(VISU_FPSActor::New()),
+  myPickingSettings(NULL)
+{
+  if(MYDEBUG) INFOS("VVTK_Renderer() - "<<this);
+
+  myFPSActor->Delete();
+
+  vtkTextMapper* aTextMapper = vtkTextMapper::New();
+  vtkTextProperty *aTextProperty = aTextMapper->GetTextProperty();
+  aTextProperty->SetJustificationToRight();
+  aTextProperty->SetVerticalJustificationToTop();
+  aTextProperty->SetFontSize(10);
+
+  myFPSActor->SetPickable(false); 
+  myFPSActor->ScaledTextOff();
+  myFPSActor->SetAlignmentPoint(8);
+  myFPSActor->SetPosition2 (1., 1.);
+  myFPSActor->SetMapper(aTextMapper);
+  aTextMapper->Delete();
+
+  GetDevice()->AddActor2D(myFPSActor.GetPointer());
+}
+
+VVTK_Renderer
+::~VVTK_Renderer()
+{
+  if(MYDEBUG) INFOS("~VVTK_Renderer() - "<<this);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer
+::AddActor(VTKViewer_Actor* theActor)
+{
+  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    anActor->SetPickingSettings(myPickingSettings);
+    Superclass::AddActor(anActor);
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+  using namespace VISU;  
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
+    anActor->SetPickingSettings(NULL);
+    Superclass::RemoveActor(theActor);
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer
+::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
+{
+  myPickingSettings = thePickingSettings;
+}
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_Renderer1);
+
+//----------------------------------------------------------------------------
+VVTK_Renderer1
+::VVTK_Renderer1():
+  myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New()),
+  myOutsideCursorSettings(NULL)
+{
+  if(MYDEBUG) INFOS("VVTK_Renderer1() - "<<this);
+
+  myImplicitFunctionWidget->SetPlaceFactor(1.1);
+  myImplicitFunctionWidget->SetOutlineTranslation(false);
+  vtkProperty* aSelectedPlaneProperty = myImplicitFunctionWidget->GetSelectedPlaneProperty();
+  vtkProperty* aPlaneProperty = myImplicitFunctionWidget->GetPlaneProperty();
+  aPlaneProperty->SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5);
+
+  myImplicitFunctionWidget->Delete();
+}
+
+VVTK_Renderer1
+::~VVTK_Renderer1()
+{
+  if(MYDEBUG) INFOS("~VVTK_Renderer1() - "<<this);
+  myImplicitFunctionWidget->SetInteractor(NULL);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer1
+::AddActor(VTKViewer_Actor* theActor)
+{
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
+    anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget());
+    anActor->SetOutsideCursorSettings(myOutsideCursorSettings);
+    Superclass::AddActor(anActor);
+    AdjustImplicitFunctionWidget();
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer1
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+  using namespace VISU;  
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
+    anActor->SetImplicitFunctionWidget(NULL);
+    anActor->SetOutsideCursorSettings(NULL);
+    Superclass::RemoveActor(theActor);
+    AdjustImplicitFunctionWidget();
+  }
+}
+//----------------------------------------------------------------------------
+void VVTK_Renderer1::AdjustImplicitFunctionWidget()
+{
+  if(SVTK_Renderer::OnAdjustActors()){
+    myImplicitFunctionWidget->InitialPlaceWidget(myBndBox);
+    myImplicitFunctionWidget->SetOrigin((myBndBox[1] + myBndBox[0]) / 2.0,
+                                       (myBndBox[3] + myBndBox[2]) / 2.0,
+                                       (myBndBox[5] + myBndBox[4]) / 2.0);
+    myImplicitFunctionWidget->SetHandleSize(myImplicitFunctionWidget->GetHandleSize());
+  }
+}
+//----------------------------------------------------------------------------
+void 
+VVTK_Renderer1
+::Initialize(vtkRenderWindowInteractor* theInteractor,
+            SVTK_Selector* theSelector)
+{
+  SVTK_Renderer::Initialize(theInteractor,theSelector);
+  myImplicitFunctionWidget->SetInteractor(theInteractor);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer1
+::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings)
+{
+  myOutsideCursorSettings = theOutsideCursorSettings;
+}
+
+//----------------------------------------------------------------------------
+VISU_ImplicitFunctionWidget*
+VVTK_Renderer1
+::GetImplicitFunctionWidget()
+{
+  return myImplicitFunctionWidget.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+bool
+VVTK_Renderer1
+::OnAdjustActors()
+{
+  return SVTK_Renderer::OnAdjustActors();
+}
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_Renderer2);
+
+//----------------------------------------------------------------------------
+VVTK_Renderer2
+::VVTK_Renderer2():
+  myEventCallbackCommand(vtkCallbackCommand::New())
+{
+  if(MYDEBUG) INFOS("VVTK_Renderer2() - "<<this);
+  myEventCallbackCommand->Delete();
+
+  myPriority = 0.0;
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VVTK_Renderer2::ProcessEvents);
+}
+
+VVTK_Renderer2
+::~VVTK_Renderer2()
+{
+  if(MYDEBUG) INFOS("~VVTK_Renderer2() - "<<this);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer2
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
+{
+  theWidget->AddObserver(vtkCommand::EndInteractionEvent, 
+                        myEventCallbackCommand.GetPointer(), 
+                        myPriority);
+  theWidget->AddObserver(vtkCommand::EnableEvent, 
+                        myEventCallbackCommand.GetPointer(), 
+                        myPriority);
+  theWidget->AddObserver(vtkCommand::DisableEvent, 
+                        myEventCallbackCommand.GetPointer(), 
+                        myPriority);
+  myWidget = theWidget;
+}
+
+void 
+VVTK_Renderer2
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  VVTK_Renderer2* self = reinterpret_cast<VVTK_Renderer2*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::EndInteractionEvent:
+    self->OnEndInteractionEvent();  
+    break;
+  }
+}
+
+void
+VVTK_Renderer2
+::OnEndInteractionEvent()
+{
+  AdjustActors();
+  myInteractor->Render();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer2
+::AddActor(VTKViewer_Actor* theActor)
+{
+  if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
+    if(VISU::TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
+      if(VISU_GaussPtsAct2* anActor2 = aFactory->CloneActor(anActor)){
+       anActor2->SetImplicitFunctionWidget(myWidget);
+       Superclass::AddActor(anActor2);
+      }
+    }
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer2
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+  using namespace VISU;  
+  if(VISU_GaussPtsAct2* anActor = dynamic_cast<VISU_GaussPtsAct2*>(theActor)){
+    anActor->SetImplicitFunctionWidget(NULL);
+    Superclass::RemoveActor(theActor);
+  }
+}
diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h
new file mode 100644 (file)
index 0000000..0c50b27
--- /dev/null
@@ -0,0 +1,155 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#ifndef VVTK_Renderer_h
+#define VVTK_Renderer_h
+
+#include "VVTK.h"
+
+#include "SVTK_Renderer.h"
+
+class VISU_ImplicitFunctionWidget;
+class VISU_OutsideCursorSettings;
+class VISU_PickingSettings;
+class VISU_FPSActor;
+
+class vtkImplicitFunction;
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer
+{
+ public:
+  vtkTypeMacro(VVTK_Renderer,SVTK_Renderer);
+  static VVTK_Renderer* New();
+
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor);
+
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor);
+
+  void
+  SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+
+ protected:
+  VVTK_Renderer();
+  ~VVTK_Renderer();
+
+  VISU_PickingSettings* myPickingSettings;
+  vtkSmartPointer<VISU_FPSActor> myFPSActor;
+};
+
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer
+{
+ public:
+  vtkTypeMacro(VVTK_Renderer1,VVTK_Renderer);
+  static VVTK_Renderer1* New();
+
+  virtual
+  void 
+  Initialize(vtkRenderWindowInteractor* theInteractor,
+            SVTK_Selector* theSelector);
+
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor);
+
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor);
+
+  void
+  SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
+
+  VISU_ImplicitFunctionWidget*
+  GetImplicitFunctionWidget();
+
+ protected:
+  VVTK_Renderer1();
+  ~VVTK_Renderer1();
+
+  virtual
+  bool
+  OnAdjustActors();
+
+  void AdjustImplicitFunctionWidget();
+
+  vtkSmartPointer<VISU_ImplicitFunctionWidget> myImplicitFunctionWidget;
+  VISU_OutsideCursorSettings* myOutsideCursorSettings;
+  vtkSmartPointer<VISU_FPSActor> myTextActor;
+};
+
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer
+{
+ public:
+  vtkTypeMacro(VVTK_Renderer2,VVTK_Renderer);
+  static VVTK_Renderer2* New();
+
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor);
+
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor);
+
+  void
+  SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
+
+  void
+  OnEndInteractionEvent();
+
+ protected:
+  VVTK_Renderer2();
+  ~VVTK_Renderer2();
+
+  // Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+
+  // Used to process VTK events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Priority at which events are processed
+  float myPriority;
+
+  VISU_ImplicitFunctionWidget* myWidget;
+};
+
+
+#endif
diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx
new file mode 100644 (file)
index 0000000..4e20b11
--- /dev/null
@@ -0,0 +1,544 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VVTK_SegmentationCursorDlg.cxx
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#include "VVTK_SegmentationCursorDlg.h"
+
+#include "VISU_GaussPtsAct.h"
+#include "VISU_GaussPtsSettings.h"
+#include "VISU_ImplicitFunctionWidget.h"
+
+#include "VISU_GaussPointsPL.hxx"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include <vtkActorCollection.h>
+#include <vtkCallbackCommand.h>
+#include <vtkObjectFactory.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkSmartPointer.h>
+
+#include "utilities.h"
+
+#include <qbuttongroup.h>
+#include <qcolordialog.h>
+#include <qfiledialog.h>
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qtabwidget.h>
+#include <qvbox.h>
+
+#include "QtxAction.h"
+#include "QtxDblSpinBox.h"
+
+using namespace std;
+
+VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const char* name )
+  :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+   myEventCallbackCommand( vtkCallbackCommand::New() ),
+   myOutsideCursorSettings( VISU_OutsideCursorSettings::New() )
+{
+  myPriority = 0.0;
+  myEventCallbackCommand->Delete();
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VVTK_SegmentationCursorDlg::ProcessEvents);
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  setCaption( tr( "SEGMENTATION_CURSOR_DLG_TITLE" ) );
+  setSizeGripEnabled(TRUE);
+
+  QVBoxLayout* TopLayout = new QVBoxLayout( this );
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  myTabBox = new QTabWidget( this );
+
+  // Segmentation cursor pane
+  mySegmentationCursorBox = new QVBox( this );
+  mySegmentationCursorBox->setMargin(11);
+  mySegmentationCursorBox->setSpacing(6);
+
+  // Origin
+  QGroupBox* OriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), mySegmentationCursorBox, "OriginGroup" );
+  OriginGroup->setColumnLayout( 0, Qt::Vertical );
+  OriginGroup->layout()->setSpacing( 0 );
+  OriginGroup->layout()->setMargin( 0 );
+
+  QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() );
+  OriginGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  OriginGroupLayout->setSpacing(6);
+  OriginGroupLayout->setMargin(11);
+
+  QLabel* XOriginLabel = new QLabel( tr( "ORIGIN_X" ), OriginGroup );
+  myXOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup );
+  myXOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myXOriginSpinBox->setMinimumWidth( 100 );
+  myXOriginSpinBox->setValue( 0.0 );
+
+  QLabel* YOriginLabel = new QLabel( tr( "ORIGIN_Y" ), OriginGroup );
+  myYOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup );
+  myYOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myYOriginSpinBox->setMinimumWidth( 100 );
+  myYOriginSpinBox->setValue( 0.0 );
+
+  QLabel* ZOriginLabel = new QLabel( tr( "ORIGIN_Z" ), OriginGroup );
+  myZOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup );
+  myZOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myZOriginSpinBox->setMinimumWidth( 100 );
+  myZOriginSpinBox->setValue( 0.0 );
+
+  OriginGroupLayout->addWidget(   XOriginLabel,   0, 0 );
+  OriginGroupLayout->addWidget( myXOriginSpinBox, 0, 1 );
+  OriginGroupLayout->addWidget(   YOriginLabel,   0, 2 );
+  OriginGroupLayout->addWidget( myYOriginSpinBox, 0, 3 );
+  OriginGroupLayout->addWidget(   ZOriginLabel,   0, 4 );
+  OriginGroupLayout->addWidget( myZOriginSpinBox, 0, 5 );
+
+  // Direction
+  QGroupBox* DirectionGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), mySegmentationCursorBox, "DirectionGroup" );
+  DirectionGroup->setColumnLayout( 0, Qt::Vertical );
+  DirectionGroup->layout()->setSpacing( 0 );
+  DirectionGroup->layout()->setMargin( 0 );
+
+  QGridLayout* DirectionGroupLayout = new QGridLayout( DirectionGroup->layout() );
+  DirectionGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  DirectionGroupLayout->setSpacing(6);
+  DirectionGroupLayout->setMargin(11);
+
+  QLabel* DXDirectionLabel = new QLabel( tr( "DIRECTION_DX" ), DirectionGroup );
+  myDXDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, DirectionGroup );
+  myDXDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myDXDirectionSpinBox->setMinimumWidth( 100 );
+  myDXDirectionSpinBox->setValue( 0.0 );
+
+  QLabel* DYDirectionLabel = new QLabel( tr( "DIRECTION_DY" ), DirectionGroup );
+  myDYDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, DirectionGroup );
+  myDYDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myDYDirectionSpinBox->setMinimumWidth( 100 );
+  myDYDirectionSpinBox->setValue( 0.0 );
+
+  QLabel* DZDirectionLabel = new QLabel( tr( "DIRECTION_DZ" ), DirectionGroup );
+  myDZDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, DirectionGroup );
+  myDZDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myDZDirectionSpinBox->setMinimumWidth( 100 );
+  myDZDirectionSpinBox->setValue( 1.0 );
+
+  DirectionGroupLayout->addWidget(   DXDirectionLabel,   0, 0 );
+  DirectionGroupLayout->addWidget( myDXDirectionSpinBox, 0, 1 );
+  DirectionGroupLayout->addWidget(   DYDirectionLabel,   0, 2 );
+  DirectionGroupLayout->addWidget( myDYDirectionSpinBox, 0, 3 );
+  DirectionGroupLayout->addWidget(   DZDirectionLabel,   0, 4 );
+  DirectionGroupLayout->addWidget( myDZDirectionSpinBox, 0, 5 );
+
+  // Depth
+  QGroupBox* DepthGroup = new QGroupBox( tr( "DEPTH_TITLE" ), mySegmentationCursorBox, "DepthGroup" );
+  DepthGroup->setColumnLayout( 0, Qt::Vertical );
+  DepthGroup->layout()->setSpacing( 0 );
+  DepthGroup->layout()->setMargin( 0 );
+
+  QGridLayout* DepthGroupLayout = new QGridLayout( DepthGroup->layout() );
+  DepthGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  DepthGroupLayout->setSpacing(6);
+  DepthGroupLayout->setMargin(11);
+
+  QLabel* DepthLabel = new QLabel( tr( "DEPTH" ), DepthGroup );
+  myDepthSpinBox = new QtxDblSpinBox( 0.0, VTK_LARGE_FLOAT, 0.1, DepthGroup );
+  myDepthSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+  myDepthSpinBox->setMinimumWidth( 100 );
+  myDepthSpinBox->setValue( 10.0 );
+
+  DepthGroupLayout->addWidget(   DepthLabel,   0, 0 );
+  DepthGroupLayout->addWidget( myDepthSpinBox, 0, 1 );
+
+
+  myTabBox->addTab( mySegmentationCursorBox, tr("SEGMENTATION_CURSOR_TAB") );
+
+
+  // Outside cursor pane
+  myOutsideCursorBox = new QVBox( this );
+  myOutsideCursorBox->setMargin(11);
+  myOutsideCursorBox->setSpacing(6);
+
+  // Primitive
+  QGroupBox* PrimitiveGroup = new QGroupBox( tr( "PRIMITIVE_TITLE" ), myOutsideCursorBox, "PrimitiveGroup" );
+  PrimitiveGroup->setColumnLayout(0, Qt::Vertical );
+  PrimitiveGroup->layout()->setSpacing( 0 );
+  PrimitiveGroup->layout()->setMargin( 0 );
+
+  QGridLayout* PrimitiveGroupLayout = new QGridLayout (PrimitiveGroup->layout());
+  PrimitiveGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  PrimitiveGroupLayout->setSpacing(6);
+  PrimitiveGroupLayout->setMargin(11);
+
+  // Primitive Type
+  QButtonGroup* PrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, PrimitiveGroup, "PrimitiveTypeGroup" );
+  PrimitiveTypeGroup->setRadioButtonExclusive( true );
+  PrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame );
+  PrimitiveTypeGroup->layout()->setMargin( 0 );
+
+  QRadioButton* PointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), PrimitiveTypeGroup );
+  PointSpriteButton->setChecked( true );
+
+  QRadioButton* OpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), PrimitiveTypeGroup );
+  OpenGLPointButton->setEnabled( false );
+
+  QRadioButton* GeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), PrimitiveTypeGroup );
+  GeometricalSphereButton->setEnabled( false );
+
+  PrimitiveGroupLayout->addMultiCellWidget( PrimitiveTypeGroup, 0, 0, 0, 2 );
+
+  // Clamp
+  QLabel* ClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup );
+  myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup );
+  myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  PrimitiveGroupLayout->addWidget( ClampLabel, 1, 0 );
+  PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 );
+
+  // Main Texture
+  QLabel* MainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), PrimitiveGroup );
+  myMainTextureLineEdit = new QLineEdit( PrimitiveGroup );
+  QPushButton* MainTextureButton = new QPushButton( PrimitiveGroup );
+  MainTextureButton->setAutoDefault( false );
+  MainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
+  connect( MainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) );
+
+  PrimitiveGroupLayout->addWidget( MainTextureLabel, 2, 0 );
+  PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 );
+  PrimitiveGroupLayout->addWidget( MainTextureButton, 2, 2 );
+
+  // Alpha Texture
+  QLabel* AlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), PrimitiveGroup );
+  myAlphaTextureLineEdit = new QLineEdit( PrimitiveGroup );
+  QPushButton* AlphaTextureButton = new QPushButton( PrimitiveGroup );
+  AlphaTextureButton->setAutoDefault( false );
+  AlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) );
+  connect( AlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) );
+
+  PrimitiveGroupLayout->addWidget( AlphaTextureLabel, 3, 0 );
+  PrimitiveGroupLayout->addWidget( myAlphaTextureLineEdit, 3, 1 );
+  PrimitiveGroupLayout->addWidget( AlphaTextureButton, 3, 2 );
+
+  // Alpha Threshold
+  QLabel* AlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup );
+  myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup );
+  myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  PrimitiveGroupLayout->addWidget( AlphaThresholdLabel, 4, 0 );
+  PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 );
+
+  // Size
+  QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), myOutsideCursorBox, "SizeGroup" );
+  SizeGroup->setColumnLayout(0, Qt::Vertical );
+  SizeGroup->layout()->setSpacing( 0 );
+  SizeGroup->layout()->setMargin( 0 );
+
+  QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout());
+  SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+  SizeGroupLayout->setSpacing(6);
+  SizeGroupLayout->setMargin(11);
+
+  // Geometry Size
+  mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup );
+  mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+  mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+  SizeGroupLayout->addWidget( mySizeLabel, 0, 0 );
+  SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 );
+
+  // Color
+  QGroupBox* ColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), myOutsideCursorBox, "ColorGroup" );
+  ColorGroup->setColumnLayout(0, Qt::Vertical );
+  ColorGroup->layout()->setSpacing( 0 );
+  ColorGroup->layout()->setMargin( 0 );
+
+  QGridLayout* ColorGroupLayout = new QGridLayout (ColorGroup->layout());
+  ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+  ColorGroupLayout->setSpacing(6);
+  ColorGroupLayout->setMargin(11);
+
+  myColorLabel = new QLabel( tr( "COLOR" ), ColorGroup );
+  myColorButton = new QPushButton( ColorGroup );
+  myColorButton->setPaletteBackgroundColor( Qt::blue );
+  myColorButton->setPaletteForegroundColor( Qt::blue );
+
+  ColorGroupLayout->addWidget( myColorLabel, 0, 0 );
+  ColorGroupLayout->addWidget( myColorButton, 0, 1 );
+
+  connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) );
+
+
+  myTabBox->addTab( myOutsideCursorBox, tr("OUTSIDE_CURSOR_TAB") );
+  myTabBox->showPage( myOutsideCursorBox );
+
+
+
+  // Common buttons ===========================================================
+  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+  GroupButtons->setColumnLayout(0, Qt::Vertical );
+  GroupButtons->layout()->setSpacing( 0 );
+  GroupButtons->layout()->setMargin( 0 );
+  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+  GroupButtonsLayout->setAlignment( Qt::AlignTop );
+  GroupButtonsLayout->setSpacing( 6 );
+  GroupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonApply = new QPushButton( tr( "&Apply" ), GroupButtons, "buttonApply" );
+  buttonApply->setAutoDefault( TRUE );
+  buttonApply->setDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonApply, 0, 0 );
+  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+  QPushButton* buttonClose = new QPushButton( tr( "&Close" ) , GroupButtons, "buttonClose" );
+  buttonClose->setAutoDefault( TRUE );
+  GroupButtonsLayout->addWidget( buttonClose, 0, 2 );
+
+  TopLayout->addWidget( myTabBox );
+  TopLayout->addWidget( GroupButtons );
+
+  connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
+  connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) );
+}
+
+VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg()
+{
+}
+
+void VVTK_SegmentationCursorDlg::AddActor( VISU_GaussPtsAct1* theActor )
+{
+  theActor->SetOutsideCursorSettings( myOutsideCursorSettings.GetPointer() );
+}
+
+void VVTK_SegmentationCursorDlg::RemoveActor( VISU_GaussPtsAct1* theActor )
+{
+  theActor->SetOutsideCursorSettings( NULL );
+}
+
+void VVTK_SegmentationCursorDlg::SetWidget( VISU_ImplicitFunctionWidget* theWidget )
+{
+  myWidget = theWidget;
+
+  myWidget->AddObserver(vtkCommand::EndInteractionEvent, 
+                       myEventCallbackCommand.GetPointer(), 
+                       myPriority);
+}
+
+void VVTK_SegmentationCursorDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+                                              unsigned long theEvent,
+                                              void* theClientData, 
+                                              void* vtkNotUsed(theCallData))
+{
+  VVTK_SegmentationCursorDlg* self = reinterpret_cast<VVTK_SegmentationCursorDlg*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::EndInteractionEvent:
+    self->UpdateSegmentation();
+    break;
+  }
+}
+
+void VVTK_SegmentationCursorDlg::UpdateSegmentation()
+{
+  float origin[3];
+  myWidget->GetOrigin( origin );
+  myXOriginSpinBox->setValue( origin[0] );
+  myYOriginSpinBox->setValue( origin[1] );
+  myZOriginSpinBox->setValue( origin[2] );
+
+  float normal[3];
+  myWidget->GetNormal( normal );
+  myDXDirectionSpinBox->setValue( normal[0] );
+  myDYDirectionSpinBox->setValue( normal[1] );
+  myDZDirectionSpinBox->setValue( normal[2] );
+
+  myDepthSpinBox->setValue( myWidget->Distance() );
+}
+
+void VVTK_SegmentationCursorDlg::onBrowseMainTexture()
+{
+  QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
+  QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this );
+
+  if( aFileName.isNull() )
+    return;
+
+  myMainTexture = aFileName;
+  myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) );
+}
+
+void VVTK_SegmentationCursorDlg::onBrowseAlphaTexture()
+{
+  QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
+  QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this );
+
+  if( aFileName.isNull() )
+    return;
+
+  myAlphaTexture = aFileName;
+  myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) );
+}
+
+void VVTK_SegmentationCursorDlg::onColorButtonPressed()
+{
+  QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this );
+  if( aColor.isValid() )
+    myColorButton->setPaletteBackgroundColor( aColor );
+}
+
+void VVTK_SegmentationCursorDlg::UpdateOutsideCursor()
+{
+  float aClamp = 200.0;
+  QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
+  QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
+  float anAlphaThreshold = 0.1;
+  int aSize = 25;
+  QColor aColor = Qt::blue;
+
+  if( !myOutsideCursorSettings->GetInitial() )
+  {
+    myClampSpinBox->setValue( myOutsideCursorSettings->GetClamp() );
+    myMainTextureLineEdit->setText( myMainTexture.section( '/', -1 ) );
+    myAlphaTextureLineEdit->setText( myAlphaTexture.section( '/', -1 ) );
+    myAlphaThresholdSpinBox->setValue( myOutsideCursorSettings->GetAlphaThreshold() );
+    mySizeSpinBox->setValue( myOutsideCursorSettings->GetSize() );
+
+    float* aColor = myOutsideCursorSettings->GetColor();
+    myColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ),
+                                                     ( int )( aColor[1] * 255.0 ),
+                                                     ( int )( aColor[2] * 255.0 ) ) );
+
+    return;
+  }
+
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  aClamp = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_clamp", aClamp );
+  myClampSpinBox->setValue( aClamp );
+
+  myMainTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_main_texture", aMainTexture );
+  myMainTextureLineEdit->setText( myMainTexture.section( '/', -1 ) );
+
+  myAlphaTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_alpha_texture", anAlphaTexture );
+  myAlphaTextureLineEdit->setText( myAlphaTexture.section( '/', -1 ) );
+
+  anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_alpha_threshold", anAlphaThreshold );
+  myAlphaThresholdSpinBox->setValue( anAlphaThreshold );
+
+  aSize = aResourceMgr->integerValue( "VISU", "outside_point_sprite_size", aSize );
+  mySizeSpinBox->setValue( aSize );
+
+  aColor = aResourceMgr->colorValue( "VISU", "outside_point_sprite_color", aColor );
+  myColorButton->setPaletteBackgroundColor( aColor );
+
+  ApplyOutsideCursor();
+}
+
+VISU_OutsideCursorSettings* VVTK_SegmentationCursorDlg::GetOutsideCursorSettings()
+{
+  return myOutsideCursorSettings.GetPointer();
+}
+
+vtkImageData* VVTK_SegmentationCursorDlg::MakeImageData( const QString& theMainTexture, 
+                                                        const QString& theAlphaTexture )
+{
+  //bool updateMainTexture = myMainTexture != theMainTexture;
+  //bool updateAlphaTexture = myAlphaTexture != theAlphaTexture;
+  //if( !updateMainTexture && !updateAlphaTexture )
+  //  return 0;
+
+  //myMainTexture = theMainTexture;
+  //myAlphaTexture = theAlphaTexture;
+
+  QString mainTextureFormat = theMainTexture.section( '.', -1 );
+  QString mainTextureVTI = theMainTexture.section( '.', 0, -2 ) + ".vti";
+  QString command1 = QString( "VISU_img2vti " ) + mainTextureFormat +
+                     " " + theMainTexture + " " + mainTextureVTI;
+  //cout << command1.latin1() << endl;
+  bool convertMainTexture = system( command1.latin1() ) == 0;
+
+  QString alphaTextureFormat = theAlphaTexture.section( '.', -1 );
+  QString alphaTextureVTI = theAlphaTexture.section( '.', 0, -2 ) + ".vti";
+  QString command2 = QString( "VISU_img2vti " ) + alphaTextureFormat +
+                     " " + theAlphaTexture + " " + alphaTextureVTI;
+  //cout << command2.latin1() << endl;
+  bool convertAlphaTexture = system( command2.latin1() ) == 0;
+
+  if( !convertMainTexture || !convertAlphaTexture )
+    return 0;
+
+  return VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(), 
+                                         alphaTextureVTI.latin1());
+}
+
+void VVTK_SegmentationCursorDlg::onClickApply()
+{
+  if( myTabBox->currentPage() == mySegmentationCursorBox )
+    ApplySegmentationCursor();
+  else
+    ApplyOutsideCursor();
+}
+
+void VVTK_SegmentationCursorDlg::ApplySegmentationCursor()
+{
+  float origin[3];
+  origin[0] = myXOriginSpinBox->value();
+  origin[1] = myYOriginSpinBox->value();
+  origin[2] = myZOriginSpinBox->value();
+  myWidget->SetOrigin( origin );
+
+  float normal[3];
+  normal[0] = myDXDirectionSpinBox->value();
+  normal[1] = myDYDirectionSpinBox->value();
+  normal[2] = myDZDirectionSpinBox->value();
+  myWidget->SetNormal( normal );
+
+  myWidget->SetDistance( myDepthSpinBox->value() );
+
+  myWidget->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
+  myWidget->GetInteractor()->Render();
+}
+
+void VVTK_SegmentationCursorDlg::ApplyOutsideCursor()
+{
+  vtkImageData* aTexture = this->MakeImageData( myMainTexture, myAlphaTexture );
+
+  myOutsideCursorSettings->SetInitial( false );
+  myOutsideCursorSettings->SetClamp( myClampSpinBox->value() );
+  myOutsideCursorSettings->SetTexture( aTexture );
+  myOutsideCursorSettings->SetAlphaThreshold( myAlphaThresholdSpinBox->value() );
+  myOutsideCursorSettings->SetSize( mySizeSpinBox->value() );
+
+  QColor aButtonColor = myColorButton->paletteBackgroundColor();
+  float aColor[3];
+  aColor[0] = aButtonColor.red() / 255.0;
+  aColor[1] = aButtonColor.green() / 255.0;
+  aColor[2] = aButtonColor.blue() / 255.0;
+  myOutsideCursorSettings->SetColor( aColor );
+
+  myOutsideCursorSettings->InvokeEvent(VISU::UpdateOutsideSettingsEvent,NULL);
+}
+
+void VVTK_SegmentationCursorDlg::onClickClose()
+{
+  myAction->setOn( false );
+  reject();
+}
+
+void VVTK_SegmentationCursorDlg::done( int r )
+{
+  myAction->setOn( false );
+  QDialog::done( r );
+}
diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h
new file mode 100644 (file)
index 0000000..1e63fca
--- /dev/null
@@ -0,0 +1,123 @@
+//  VISU VISUGUI : GUI of VISU component
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : VVTK_SegmentationCursorDlg.h
+//  Author : Oleg Uvarov
+//  Module : VISU
+
+#ifndef VVTK_SEGMENTATIONCURSORDLG_H
+#define VVTK_SEGMENTATIONCURSORDLG_H
+
+#include <qdialog.h>
+
+#include <vtkObject.h>
+#include <vtkSmartPointer.h>
+
+class vtkActorCollection;
+class vtkCallbackCommand;
+class vtkImageData;
+
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QTabWidget;
+class QVBox;
+
+class QtxAction;
+class QtxDblSpinBox;
+
+class VISU_GaussPtsAct1;
+class VISU_OutsideCursorSettings;
+class VISU_ImplicitFunctionWidget;
+
+class VVTK_SegmentationCursorDlg : public QDialog
+{
+  Q_OBJECT
+
+public:
+  VVTK_SegmentationCursorDlg( QWidget* parent = 0, const char* name = 0 );
+  ~VVTK_SegmentationCursorDlg();
+
+  void             AddActor( VISU_GaussPtsAct1* );
+  void             RemoveActor( VISU_GaussPtsAct1* );
+
+  void             SetWidget( VISU_ImplicitFunctionWidget* );
+  void             SetAction( QtxAction* theAction ) { myAction = theAction; }
+
+  void             UpdateSegmentation();
+
+  void             UpdateOutsideCursor();
+
+  VISU_OutsideCursorSettings* GetOutsideCursorSettings();
+
+protected:
+  void             ApplySegmentationCursor();
+  void             ApplyOutsideCursor();
+
+  vtkImageData*    MakeImageData( const QString& theMainTexture, 
+                                 const QString& theAlphaTexture );
+
+private:
+  static void      ProcessEvents(vtkObject* theObject, 
+                                unsigned long theEvent,
+                                void* theClientData, 
+                                void* theCallData);
+
+protected slots:
+  virtual void     done( int );
+
+  void             onClickApply();
+  void             onClickClose();
+
+  void             onBrowseMainTexture();
+  void             onBrowseAlphaTexture();
+  void             onColorButtonPressed();
+
+private:
+  QTabWidget*      myTabBox;
+
+  // Segmentation cursor
+  QVBox*           mySegmentationCursorBox;
+
+  QtxDblSpinBox*   myXOriginSpinBox;
+  QtxDblSpinBox*   myYOriginSpinBox;
+  QtxDblSpinBox*   myZOriginSpinBox;
+
+  QtxDblSpinBox*   myDXDirectionSpinBox;
+  QtxDblSpinBox*   myDYDirectionSpinBox;
+  QtxDblSpinBox*   myDZDirectionSpinBox;
+
+  QtxDblSpinBox*   myDepthSpinBox;
+
+  float            myPriority;
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  VISU_ImplicitFunctionWidget* myWidget;
+  QtxAction*       myAction;
+
+  // Outside cursor
+  QVBox*           myOutsideCursorBox;
+
+  QtxDblSpinBox*   myClampSpinBox;
+
+  QLineEdit*       myMainTextureLineEdit;
+  QLineEdit*       myAlphaTextureLineEdit;
+  QtxDblSpinBox*   myAlphaThresholdSpinBox;
+
+  QLabel*          mySizeLabel;
+  QtxDblSpinBox*   mySizeSpinBox;
+
+  QLabel*          myColorLabel;
+  QPushButton*     myColorButton;
+
+  QString          myMainTexture;
+  QString          myAlphaTexture;
+
+  vtkSmartPointer<VISU_OutsideCursorSettings> myOutsideCursorSettings;
+};
+
+#endif
diff --git a/src/VVTK/VVTK_ViewManager.cxx b/src/VVTK/VVTK_ViewManager.cxx
new file mode 100644 (file)
index 0000000..8c3cb03
--- /dev/null
@@ -0,0 +1,26 @@
+#include "VVTK_ViewManager.h"
+#include "VVTK_ViewModel.h"
+
+int VVTK_ViewManager::_VVTKViewMgr_Id = 0;
+
+//***************************************************************
+VVTK_ViewManager
+::VVTK_ViewManager( SUIT_Study* study, 
+                   SUIT_Desktop* theDesktop ) 
+: SUIT_ViewManager( study, theDesktop )
+{
+  myId = ++_VVTKViewMgr_Id;
+  setViewModel( new VVTK_Viewer() );
+}
+
+//***************************************************************
+VVTK_ViewManager::~VVTK_ViewManager()
+{
+}
+
+//***************************************************************
+void VVTK_ViewManager::setViewName(SUIT_ViewWindow* theView)
+{
+  int aPos = myViews.find(theView);
+  theView->setCaption( tr( "VTK_VIEW_TITLE" ).arg( myId ).arg( aPos + 1 ) );
+}
diff --git a/src/VVTK/VVTK_ViewManager.h b/src/VVTK/VVTK_ViewManager.h
new file mode 100644 (file)
index 0000000..9e70cbc
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef VVTK_VIEWMANAGER_H
+#define VVTK_VIEWMANAGER_H
+
+#include "SUIT_ViewManager.h"
+#include "VVTK.h"
+
+class SUIT_Desktop;
+
+class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager
+{
+  Q_OBJECT;
+public:
+
+  VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* );
+  virtual ~VVTK_ViewManager();
+
+protected:
+  void setViewName( SUIT_ViewWindow* theView );
+
+private:
+  int               myId;
+  static  int       _VVTKViewMgr_Id;
+};
+
+#endif
diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx
new file mode 100644 (file)
index 0000000..d2618e9
--- /dev/null
@@ -0,0 +1,208 @@
+#include <qpopupmenu.h>
+#include <qcolordialog.h>
+
+#include "VVTK_ViewModel.h"
+#include "VVTK_ViewWindow.h"
+
+#include "SVTK_View.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+
+#include "VTKViewer_ViewModel.h"
+
+//==========================================================
+VVTK_Viewer
+::VVTK_Viewer()
+{
+  myTrihedronSize = 105;
+}
+
+VVTK_Viewer
+::~VVTK_Viewer() 
+{}
+
+
+//==========================================================
+void
+VVTK_Viewer
+::setViewManager(SUIT_ViewManager* theViewManager)
+{
+  SUIT_ViewModel::setViewManager(theViewManager);
+
+  if ( !theViewManager )
+    return;
+
+  connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+}
+
+
+//==========================================================
+SUIT_ViewWindow* 
+VVTK_Viewer
+::createView( SUIT_Desktop* theDesktop )
+{
+  TViewWindow* aViewWindow = new TViewWindow(theDesktop);
+  aViewWindow->Initialize(this);
+    
+  aViewWindow->setBackgroundColor( backgroundColor() );
+  aViewWindow->SetTrihedronSize( trihedronSize() );
+
+  return aViewWindow;
+}
+
+
+//==========================================================
+void
+VVTK_Viewer
+::contextMenuPopup( QPopupMenu* thePopup )
+{
+  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+
+  thePopup->insertSeparator();
+
+  if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
+    if ( !aView->getMainWindow()->getToolBar()->isVisible() ){
+      thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+    }
+  }
+}
+
+
+//==========================================================
+void 
+VVTK_Viewer
+::Repaint()
+{
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
+      aView->getMainWindow()->Repaint();
+    }
+  }
+}
+
+
+//==========================================================
+bool
+VVTK_Viewer
+::isVisible( const Handle(SALOME_InteractiveObject)& io )
+{
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow))
+       if(!aView->getView()->isVisible( io ))
+         return false;
+
+  return true;
+}
+
+
+//==========================================================
+void
+VVTK_Viewer
+::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+void 
+VVTK_Viewer
+::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+void 
+VVTK_Viewer
+::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
+{}
+
+
+//==========================================================
+QColor
+VVTK_Viewer
+::backgroundColor() const
+{
+  return myBgColor;
+}
+
+void
+VVTK_Viewer
+::setBackgroundColor( const QColor& theColor )
+{
+  if ( !theColor.isValid() )
+    return;
+
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
+      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViewWindow)){
+       aView->getMainWindow()->SetBackgroundColor(theColor);
+      }
+    }
+  }
+
+  myBgColor = theColor;
+}
+
+//==========================================================
+int
+VVTK_Viewer
+::trihedronSize() const
+{
+  return myTrihedronSize;
+}
+
+void 
+VVTK_Viewer
+::setTrihedronSize( const int theSize )
+{
+  myTrihedronSize = theSize;
+  if(SUIT_ViewManager* aViewManager = getViewManager()){
+    QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
+    for ( int i = 0; i < aViews.count(); i++ ){
+      if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i ))){
+       aView->getMainWindow()->SetTrihedronSize( theSize );
+      }
+    }
+  }
+}
+
+//==========================================================
+void 
+VVTK_Viewer
+::onDumpView()
+{
+  if(SUIT_ViewWindow* aView = myViewManager->getActiveView())
+    aView->onDumpView();
+}
+
+//==========================================================
+void
+VVTK_Viewer
+::onChangeBgColor()
+{
+  if(SUIT_ViewWindow* aView = myViewManager->getActiveView()){
+    QColor aColor = QColorDialog::getColor( backgroundColor(), aView);
+    setBackgroundColor(aColor);
+  }
+}
+
+//==========================================================
+void
+VVTK_Viewer
+::onShowToolbar() 
+{
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at(i))){
+      aView->getMainWindow()->getToolBar()->show();
+    }
+  }
+}
+
diff --git a/src/VVTK/VVTK_ViewModel.h b/src/VVTK/VVTK_ViewModel.h
new file mode 100644 (file)
index 0000000..6c2453b
--- /dev/null
@@ -0,0 +1,57 @@
+#ifndef VVTK_VIEWMODEL_H
+#define VVTK_VIEWMODEL_H
+
+#include <qcolor.h>
+
+#include "VVTK.h"
+#include "SVTK_ViewModelBase.h"
+
+#include "SALOME_Prs.h"
+#include "SALOME_InteractiveObject.hxx"
+
+class VVTK_ViewWindow;
+
+class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
+{
+  Q_OBJECT;
+
+public:
+  typedef VVTK_ViewWindow TViewWindow;
+  static QString Type() { return "VVTK"; }
+
+  VVTK_Viewer();
+  virtual ~VVTK_Viewer();
+
+  virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
+
+  virtual void             setViewManager(SUIT_ViewManager* theViewManager);
+  virtual void             contextMenuPopup( QPopupMenu* );
+  virtual QString          getType() const { return Type(); }
+
+  virtual void Repaint();
+
+  virtual bool             isVisible( const Handle(SALOME_InteractiveObject)& );
+
+  QColor backgroundColor() const;
+  void   setBackgroundColor( const QColor& );
+
+  int    trihedronSize() const;
+  void   setTrihedronSize( const int );
+
+protected slots:
+  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
+  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
+
+  void onDumpView();
+  void onShowToolbar();
+  void onChangeBgColor();
+
+private:
+  QColor myBgColor;
+  int    myTrihedronSize;
+  bool   mySelectionEnabled;
+  bool   myMultiSelectionEnabled;
+};
+
+#endif
diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx
new file mode 100755 (executable)
index 0000000..b8561da
--- /dev/null
@@ -0,0 +1,261 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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   : 
+//  Author : 
+//  Module : SALOME
+//  $Header$
+
+#include "VVTK_ViewWindow.h"
+#include "VVTK_ViewModel.h"
+#include "VVTK_MainWindow.h"
+#include "SVTK_View.h"
+
+#include "SUIT_Session.h"
+
+#include "VVTK_Renderer.h"
+#include "SVTK_Selector.h"
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_GenericRenderWindowInteractor.h"
+
+#include <qsplitter.h>
+#include <qlayout.h>
+
+//----------------------------------------------------------------------------
+VVTK_ViewWindow
+::VVTK_ViewWindow(SUIT_Desktop* theDesktop):
+  SVTK_ViewWindow(theDesktop),
+  myMainWindow1(NULL),
+  myMainWindow2(NULL),
+  myView2(NULL)
+{}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::Initialize(SVTK_ViewModelBase* theModel)
+{
+  if(SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr()){
+    QWidget* aWidget = new QWidget(this);
+    setCentralWidget(aWidget);
+    
+    QBoxLayout* aLayout = new QVBoxLayout(aWidget);
+    aLayout->setAutoAdd(true);
+    QSplitter* aSplitter = new QSplitter(Qt::Vertical,aWidget);
+    //aSplitter->setChildrenCollapsible(true);
+
+    VISU_ImplicitFunctionWidget* anImplicitFunctionWidget = NULL;
+    VISU_OutsideCursorSettings* anOutsideCursorSettings = NULL;
+    VISU_PickingSettings* aPickingSettings = NULL;
+    SVTK_Selector* aSelector = SVTK_Selector::New();
+    {
+      myMainWindow1 = new VVTK_MainWindow1(aSplitter,
+                                          "VVTK_MainWindow",
+                                          aResourceMgr);
+
+      anOutsideCursorSettings = myMainWindow1->GetOutsideCursorSettings();
+      aPickingSettings = myMainWindow1->GetPickingSettings();
+
+      SVTK_RenderWindowInteractor* anIteractor = 
+       new SVTK_RenderWindowInteractor(myMainWindow1,"SVTK_RenderWindowInteractor1");
+      
+      SVTK_GenericRenderWindowInteractor* aDevice = 
+       SVTK_GenericRenderWindowInteractor::New();
+      aDevice->SetRenderWidget(anIteractor);
+      aDevice->SetSelector(aSelector);
+    
+      VVTK_Renderer1* aRenderer = VVTK_Renderer1::New();
+      aRenderer->Initialize(aDevice,aSelector);
+      anImplicitFunctionWidget = aRenderer->GetImplicitFunctionWidget();
+      aRenderer->SetOutsideCursorSettings(anOutsideCursorSettings);
+      aRenderer->SetPickingSettings(aPickingSettings);
+
+      anIteractor->Initialize(aDevice,aRenderer,aSelector);
+
+      SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New();
+      anIteractor->PushInteractorStyle(aStyle);
+      aStyle->Delete();
+
+      aDevice->Delete();
+      aRenderer->Delete();
+
+      myMainWindow1->Initialize(anIteractor,aRenderer);
+
+      myView1 = new SVTK_View(myMainWindow1);
+      SVTK_ViewWindow::Initialize(myView1,theModel);
+    }
+    {
+      myMainWindow2 = myMainWindow1->CreateMainWindow2(aSplitter,
+                                                      "VVTK_SegmantationWindow",
+                                                      aResourceMgr,
+                                                      aPickingSettings);
+      SVTK_RenderWindowInteractor* anIteractor = 
+       new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1");
+      
+      SVTK_GenericRenderWindowInteractor* aDevice = 
+       SVTK_GenericRenderWindowInteractor::New();
+      aDevice->SetRenderWidget(anIteractor);
+      aDevice->SetSelector(aSelector);
+    
+      VVTK_Renderer2* aRenderer = VVTK_Renderer2::New();
+      aRenderer->Initialize(aDevice,aSelector);
+      aRenderer->SetImplicitFunctionWidget(anImplicitFunctionWidget);
+      aRenderer->SetPickingSettings(aPickingSettings);
+      
+      anIteractor->Initialize(aDevice,aRenderer,aSelector);
+
+      SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New();
+      anIteractor->PushInteractorStyle(aStyle);
+      aStyle->Delete();
+
+      aDevice->Delete();
+      aRenderer->Delete();
+
+      myMainWindow2->Initialize(anIteractor);
+      
+      myView2 = new SVTK_View(myMainWindow2);
+      SVTK_ViewWindow::Initialize(myView2,theModel);
+    }
+    aSelector->Delete();
+
+    int h = height() / 2;
+    QValueList<int> aSizes;
+    aSizes.append( h );
+    aSizes.append( h );
+    aSplitter->setSizes( aSizes );
+    myMainWindow2->hide();
+
+    myMainWindow = myMainWindow1;
+    myView = myView1;
+  }
+}
+
+//----------------------------------------------------------------------------
+VVTK_ViewWindow
+::~VVTK_ViewWindow()
+{}
+
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow1* 
+VVTK_ViewWindow
+::getMainWindow1()
+{
+  return myMainWindow1;
+}
+
+VVTK_MainWindow2* 
+VVTK_ViewWindow
+::getMainWindow2()
+{
+  return myMainWindow2;
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::AddActor(VTKViewer_Actor* theActor, 
+          bool theIsUpdate)
+{
+  myMainWindow1->AddActor(theActor,theIsUpdate);
+  myMainWindow2->AddActor(theActor,theIsUpdate);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::RemoveActor(VTKViewer_Actor* theActor, 
+             bool theIsUpdate)
+{
+  myMainWindow1->RemoveActor(theActor,theIsUpdate);
+  myMainWindow2->RemoveActor(theActor,theIsUpdate);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::Repaint(bool theUpdateTrihedron)
+{
+  myMainWindow1->Repaint(theUpdateTrihedron);
+  myMainWindow2->Repaint(theUpdateTrihedron);
+}
+
+//----------------------------------------------------------------
+void 
+VVTK_ViewWindow
+::unHighlightAll() 
+{
+  myView1->unHighlightAll();
+  myView2->unHighlightAll();
+}
+
+//----------------------------------------------------------------
+void
+VVTK_ViewWindow
+::highlight(const Handle(SALOME_InteractiveObject)& theIO, 
+           bool theIsHighlight, 
+           bool theIsUpdate ) 
+{
+  myView1->highlight( theIO, theIsHighlight, theIsUpdate );
+  myView2->highlight( theIO, theIsHighlight, theIsUpdate );
+}
+
+//----------------------------------------------------------------
+void
+VVTK_ViewWindow
+::onSelectionChanged()
+{
+  myView1->onSelectionChanged();
+  myView2->onSelectionChanged();
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::onResetView()
+{
+  myMainWindow1->onResetView();
+  myMainWindow2->onResetView();
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::onFitAll()
+{
+  myMainWindow1->onFitAll();
+  myMainWindow2->onFitAll();
+}
+
+//----------------------------------------------------------------------------
+void 
+VVTK_ViewWindow
+::action( const int accelAction  )
+{
+  if(myMainWindow1->hasFocus())
+    myMainWindow1->action(accelAction);
+  if(myMainWindow2->hasFocus())
+    myMainWindow2->action(accelAction);
+}
diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h
new file mode 100755 (executable)
index 0000000..a6ddca6
--- /dev/null
@@ -0,0 +1,96 @@
+#ifndef VVTK_VIEWWINDOW_H
+#define VVTK_VIEWWINDOW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "VVTK.h"
+#include "SVTK_ViewWindow.h"
+
+#include <string>
+
+class VVTK_MainWindow1;
+class VVTK_MainWindow2;
+class SVTK_View;
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow
+{
+  Q_OBJECT;
+
+public:
+  VVTK_ViewWindow(SUIT_Desktop* theDesktop);
+
+  virtual
+  ~VVTK_ViewWindow();
+
+  virtual
+  void
+  Initialize(SVTK_ViewModelBase* theModel);
+
+  //----------------------------------------------------------------------------
+  VVTK_MainWindow1* 
+  getMainWindow1();
+
+  VVTK_MainWindow2* 
+  getMainWindow2();
+
+  //----------------------------------------------------------------------------
+  virtual
+  void
+  AddActor(VTKViewer_Actor* theActor,
+          bool theIsUpdate = false);
+
+  virtual
+  void
+  RemoveActor(VTKViewer_Actor* theActor,
+             bool theIsUpdate = false);
+
+  virtual
+  void
+  Repaint(bool theUpdateTrihedron = true);
+
+  //----------------------------------------------------------------------------
+  /*  interactive object management */
+  virtual
+  void
+  highlight(const Handle(SALOME_InteractiveObject)& theIO, 
+           bool theIsHighlight = true, 
+           bool theIsUpdate = true);
+  virtual
+  void
+  unHighlightAll();
+
+  //----------------------------------------------------------------------------
+public slots:
+  virtual
+  void
+  onSelectionChanged();
+
+  virtual
+  void
+  onResetView();     
+
+  virtual
+  void 
+  onFitAll();
+
+  //----------------------------------------------------------------------------
+protected:
+  virtual 
+  void
+  action( const int );
+
+  VVTK_MainWindow1* myMainWindow1;
+  SVTK_View* myView1;
+
+  VVTK_MainWindow2* myMainWindow2;
+  SVTK_View* myView2;
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif