'BR-D5-38-2003_D2005-12-19'.
Sprout from BR-D5-38-2003_Base 2005-10-27 14:00:09 UTC admin <salome-admin@opencascade.com> 'This commit was generated by cvs2git to create branch 'BR-D5-38-2003_Base'.'
Cherrypick from BR-D5-38-2003 2005-10-18 15:41:31 UTC apo <apo@opencascade.com> 'To update picking settings':
src/CONVERTOR/Makefile.in
src/CONVERTOR/VISUConvertor.cxx
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.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_ImplicitFunctionWidget.cxx
src/PIPELINE/VISU_ImplicitFunctionWidget.h
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/PIPELINE/VISU_ScalarBarCtrl.cxx
src/PIPELINE/VISU_ScalarBarCtrl.hxx
src/VISUGUI/Makefile.in
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_Tools.cxx
src/VISUGUI/VisuGUI_ViewTools.h
src/VISU_I/Makefile.in
src/VISU_I/VISU_ColoredPrs3d_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_TimeAnimation.cxx
src/VISU_I/VISU_View_i.cc
src/VVTK/VVTK_Renderer.cxx
Cherrypick from master 2005-10-04 14:38:51 UTC jfa <jfa@opencascade.com> 'Update version to 3.1.0a':
INSTALL
Makefile.in
doc/salome/tui/VISU/doxyfile
examples/Fields_group3D.med
examples/Makefile.in
examples/ResOK_0000.med
examples/VISU_Example_01.py
examples/VISU_Example_02.py
examples/VISU_Example_03.py
examples/VISU_Example_04.py
examples/VISU_Example_05.py
examples/VISU_Example_06.py
examples/tables_test.xls
src/OBJECT/VISU_ScalarMapAct.h
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISU_I/VISU_View_i.hh
src/VISU_SWIG/batchmode_visu_view3d.py
src/VISU_SWIG/visu_delete.py
src/VISU_SWIG/visu_med.py
src/VISU_SWIG/visu_prs_example.py
src/VISU_SWIG/visu_swig_test.py
src/VISU_SWIG/visu_view3d.py
Delete:
src/VISUGUI/VisuGUI_Timer.cxx
src/VISUGUI/VisuGUI_Timer.h
src/VISU_SWIG/VISU_Example_01.py
src/VISU_SWIG/VISU_Example_02.py
src/VISU_SWIG/VISU_Example_03.py
src/VISU_SWIG/VISU_Example_04.py
src/VISU_SWIG/VISU_Example_05.py
src/VISU_SWIG/VISU_Example_06.py
-This is the version 3.1.0a2 of VISU
+This is the version 3.1.0a of VISU
Compatible with :
- - KERNEL 3.1.0a2
- - SALOMEGUI 3.1.0a2
- - MED 3.1.0a2
+ - KERNEL 3.1.0a
+ - SALOMEGUI 3.1.0a
+ - MED 3.1.0a
@COMMENCE@
-SUBDIRS = idl src doc
+SUBDIRS = idl src examples doc
BIN_SCRIPT= \
VERSION
-# Doxyfile 1.3.7
+# Doxyfile 1.3-rc1
#---------------------------------------------------------------------------
-# Project related configuration options
+# General configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "SALOME v.3.1.0a"
+PROJECT_NAME = "SALOME - VISU - v.2.1.0"
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
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = YES
-HIDE_UNDOC_CLASSES = YES
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
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
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 5
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/src \
- ../../../share/salome/idl
-FILE_PATTERNS = *.idl *.h *.hh *.hxx *.c *.cc *.cxx *.ixx *.jxx
-RECURSIVE = YES
+INPUT = ../../../share/salome/idl/VISU_Gen.idl
+FILE_PATTERNS =
+RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = YES
+EXAMPLE_RECURSIVE = NO
IMAGE_PATH = sources/
INPUT_FILTER =
FILTER_SOURCE_FILES = YES
-
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
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
#---------------------------------------------------------------------------
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
-
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
-LATEX_HIDE_INDICES = NO
-
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
-
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
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
#---------------------------------------------------------------------------
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
-
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
-
#---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
-
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
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::additions related to the search engine
+# Configuration::addtions 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 =
--- /dev/null
+# Copyright (C) 2005 CEA/DEN, EDF R&D
+#
+#
+#
+# File : Makefile.in
+# Author : Vasily Rusyaev (Open Cascade NN)
+# Module : examples
+# $Header:
+
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:@srcdir@
+curdir = $(shell pwd)
+instdatadir=${prefix}/examples
+
+SUBDIRS=.
+
+@COMMENCE@
+
+data:
+ (cd $(srcdir) ; cp -fr `ls | grep -v "Makefile.in"` $(curdir))
+
+clean:
+ rm -rf `ls | grep -v "Makefile"`
+
+install:
+ rm -rf $(instdatadir)
+ mkdir $(instdatadir)
+ cp -rf `ls | grep -v "Makefile"` $(instdatadir)
+
+uninstall:
+ rm -rf $(instdatadir)
--- /dev/null
+# T 2.23, 28: Displaying fields (scalar and vectorial) on nodes, change presentation options.
+# Uses MED files ResOK_0000.med and Fields_group3D.med
+#
+# This script is equivalent to non-regression test script 003/A1
+
+import salome
+import visu_gui
+import SALOMEDS
+import VISU
+import os
+
+datadir = os.getenv("VISU_ROOT_DIR") + "/examples/"
+
+#%====================Stage1: Creating a new study====================%
+
+print "**** Stage1: Creating a new study"
+
+print "Creating a new study..................",
+myVisu = visu_gui.myVisu
+myVisu.SetCurrentStudy(salome.myStudy)
+myViewManager = myVisu.GetViewManager()
+if myViewManager is None : print "Error"
+else : print "OK"
+
+#%====================Stage2: Importing MED file====================%
+
+print "**** Stage2: Importing MED file"
+
+print 'Import "ResOK_0000.med"...............',
+medFile = datadir + "ResOK_0000.med"
+myResult = myVisu.ImportFile(medFile)
+if myResult is None : print "Error"
+else : print "OK"
+
+print 'Creating new View3D...................',
+myView = myViewManager.Create3DView()
+if myView is None : print "Error"
+else : print "OK"
+
+myMeshName = 'dom'
+myCellEntity = VISU.CELL
+myNodeEntity = VISU.NODE
+
+#%====================Stage3: Displaying vector field====================%
+
+print "**** Stage3: Displaying vector field"
+
+print "Creating Scalar Map.......",
+scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
+if scalarmap is None : print "Error"
+else : print "OK"
+scalarmap.SetSize(0.15, 0.8)
+myView.DisplayOnly(scalarmap)
+myView.FitAll()
+
+print "Creating Stream Lines.....",
+streamlines = myVisu.StreamLinesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
+if streamlines is None : print "Error"
+else : print "OK"
+myView.DisplayOnly(streamlines)
+
+print "Creating Vectors..........",
+vectors = myVisu.VectorsOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
+if vectors is None : print "Error"
+else : print "OK"
+myView.DisplayOnly(vectors)
+
+
+print "Creating Iso Surfaces.....",
+isosurfaces = myVisu.IsoSurfacesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
+if isosurfaces is None : print "Error"
+else : print "OK"
+myView.DisplayOnly(isosurfaces)
+
+print "Creating Cut Planes.......",
+cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
+if cutplanes is None : print "Error"
+else : print "OK"
+cutplanes.SetNbPlanes(30)
+cutplanes.SetOrientation(VISU.CutPlanes.YZ, 0, 0)
+myView.DisplayOnly(cutplanes)
+
+#%====================Stage4: Opening a new study and Med file import====================%
+
+print "**** Stage4: Opening a new study and Med file import"
+
+print "Creating a new study..................",
+newStudy = salome.myStudyManager.NewStudy('newStudy')
+myVisu.SetCurrentStudy(newStudy)
+myViewManager = myVisu.GetViewManager()
+myView = myViewManager.Create3DView()
+if myView is None : print "Error"
+else : print "OK"
+
+print 'Importing "Fields_group3D.med"........',
+medFile = datadir + "Fields_group3D.med"
+myResult1 = myVisu.ImportFile(medFile)
+if myResult1 is None : print "Error"
+myView1 = myViewManager.Create3DView()
+if myView1 is None : print "Error"
+else : print "OK"
+
+#%====================Stage5: Displaying scalar field====================%
+
+print "**** Stage5: Displaying scalar field"
+
+myMeshName1 = 'mailles_MED'
+
+print "Creating Scalar Map.......",
+scalarmap1 = myVisu.ScalarMapOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1);
+if scalarmap1 is None : print "Error"
+else : print "OK"
+myView1.DisplayOnly(scalarmap1)
+myView1.FitAll()
+
+print "Creating Iso Surfaces.....",
+isosurfaces1 = myVisu.IsoSurfacesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1);
+if isosurfaces1 is None : print "Error"
+else : print "OK"
+myView1.DisplayOnly(isosurfaces1)
+
+print "Creating Cut Planes.......",
+cutplanes1 = myVisu.CutPlanesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1);
+if cutplanes1 is None : print "Error"
+else : print "OK"
+cutplanes1.SetOrientation(VISU.CutPlanes.YZ, 0, 0)
+myView1.DisplayOnly(cutplanes1)
+
+#%====================Stage6: Object browser popup====================%
+
+print "**** Stage6: Object browser popup"
+
+print "Creating mesh.............",
+mesh = myVisu.MeshOnEntity(myResult1,myMeshName1,myCellEntity);
+if mesh is None : print "Error"
+else : print "OK"
+myView1.DisplayOnly(mesh)
+
+
+print "Changing type of presentation of mesh:"
+mesh.SetPresentationType(VISU.WIREFRAME)
+PrsType = mesh.GetPresentationType()
+print "Presentation type..", PrsType
+myView1.DisplayOnly(mesh)
+
+mesh.SetPresentationType(VISU.SHADED)
+PrsType = mesh.GetPresentationType()
+print "Presentation type.....", PrsType
+myView1.DisplayOnly(mesh)
+
+mesh.SetPresentationType(VISU.POINT)
+PrsType = mesh.GetPresentationType()
+print "Presentation type......", PrsType
+myView1.DisplayOnly(mesh)
+myView1.Update()
+
+mesh.SetPresentationType(VISU.SHRINK)
+PrsType = mesh.GetPresentationType()
+print "Presentation type.....", PrsType
+myView1.DisplayOnly(mesh)
+
+print "Changing color of mesh....",
+aColor = SALOMEDS.Color(0,0,1)
+mesh.SetCellColor(aColor)
+myView1.DisplayOnly(mesh)
+print "OK"
+
+print "Renaming ScalarMap........",
+SObj = newStudy.FindObjectIOR(scalarmap1.GetID())
+newName = 'Renamed Object'
+SObj.Name = newName
+print "OK"
+
+print "Deleting Cut Planes.......",
+SObj = newStudy.FindObjectIOR(cutplanes1.GetID())
+myBuilder = newStudy.NewBuilder()
+myBuilder.RemoveObject(SObj)
+print "OK"
+
+print "Changing first IsoSurfaces",
+myVisu.SetCurrentStudy(salome.myStudy)
+myView.DisplayOnly(isosurfaces)
+isosurfaces.SetNbSurfaces(25)
+print "OK"
+
+myView.Maximize()
+myView.DisplayOnly(isosurfaces)
+
+print "Hide IsoSurfaces..........",
+myView.Erase(isosurfaces)
+print "OK"
--- /dev/null
+# T 2.24: Save/retrieve view parameters.
+# Uses MED file fra.med from ${KERNEL_ROOT_DIR}/examples directory.
+#
+# This script is equivalent to non-regression test script 003/A3
+
+import salome
+import visu_gui
+import SALOMEDS
+import VISU
+import os
+
+medFile = os.getenv("KERNEL_ROOT_DIR") + "/examples/fra.med"
+
+#%====================Stage1: Creating a new study====================%
+
+print "**** Stage1: Creating a new study "
+
+print "Creating a new study..................",
+myVisu = visu_gui.myVisu
+myVisu.SetCurrentStudy(salome.myStudy)
+myViewManager = myVisu.GetViewManager()
+if myViewManager is None : print "Error"
+else : print "OK"
+
+#%====================Stage2: Saving view parameters before import====================%
+
+print "**** Stage2: Saving view parameters before import "
+
+myView = myViewManager.Create3DView()
+
+print "Zooming trihedron.....................",
+aScale = myView.GetParallelScale()
+myView.SetParallelScale(aScale*4)
+print "OK"
+
+print "Rotating trihedron....................",
+aPoint = (100,100,100)
+myView.SetPointOfView(aPoint)
+print "OK"
+
+print "Saving view parameters................",
+aViewParamsName1 = 'ViewParams:1'
+aSaveRes = myView.SaveViewParams(aViewParamsName1)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+#%====================Stage3: Import MED file====================%
+
+print "**** Stage3: Import MED file"
+
+print 'Importing "fra.med"...................',
+myResult = myVisu.ImportFile(medFile)
+if myResult is None : print "Error"
+else : print "OK"
+
+print "Creating mesh.........................",
+myMeshName = 'LE VOLUME'
+myCellEntity = VISU.CELL
+mesh = myVisu.MeshOnEntity(myResult,myMeshName,myCellEntity);
+if mesh is None : print "Error"
+else : print "OK"
+
+myView.Maximize()
+myView.Display(mesh)
+myView.FitAll()
+
+#%====================Stage4: Saving view parameters after import====================%
+
+print "**** Stage4: Saving view parameters after import"
+
+print "Creating Scalar Map...................",
+myFieldName = 'TAUX_DE_VIDE'
+myNodeEntity = VISU.NODE
+scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,myFieldName,1);
+if scalarmap is None : print "Error"
+else : print "OK"
+myView.DisplayOnly(scalarmap)
+
+print "Zooming 3D view.......................",
+aScale = myView.GetParallelScale()
+myView.SetParallelScale(aScale*2)
+print "OK"
+
+print "Setting view point(LEFT)..............",
+myView.SetView((VISU.View3D.LEFT))
+print "OK"
+
+print "Saving view parameters................",
+aViewParamsName2 = 'ViewParams:2'
+aSaveRes = myView.SaveViewParams(aViewParamsName2)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+print "Creating Cut Planes...................",
+cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,myFieldName,1);
+if cutplanes is None : print "Error"
+else : print "OK"
+cutplanes.SetNbPlanes(4)
+myView.DisplayOnly(cutplanes)
+
+print "Setting scaling.......................",
+
+#Define parameters of scaling:
+myXParam = 5
+myYParam = 5
+myZParam = 1
+
+myXAxis = VISU.View3D.XAxis
+myYAxis = VISU.View3D.YAxis
+myZAxis = VISU.View3D.ZAxis
+
+myView.ScaleView(myXAxis,myXParam)
+myView.ScaleView(myYAxis,myYParam)
+myView.ScaleView(myZAxis,myZParam)
+print "OK"
+
+print "Rotating 3d view......................",
+aPoint = (100,40,0)
+myView.SetPointOfView(aPoint)
+print "OK"
+
+print "Fit All...............................",
+myView.FitAll()
+print "OK"
+
+print "Saving view parameters................",
+aViewParamsName3 = 'ViewParams:3'
+aSaveRes = myView.SaveViewParams(aViewParamsName3)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+#%====================Stage5: Restoring view parameters====================%
+
+print "**** Stage5: Restoring view parameters"
+
+print "Restoring first view parameters.......",
+aRestoreRes = myView.RestoreViewParams(aViewParamsName1)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Restoring second view parameters......",
+aRestoreRes = myView.RestoreViewParams(aViewParamsName2)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Displaing only Scalar Map.............",
+myView.DisplayOnly(scalarmap)
+print "OK"
+
+print "Displaing only Cut Planes.............",
+myView.DisplayOnly(cutplanes)
+print "OK"
+
+print "Restoring third view parameters.......",
+aRestoreRes = myView.RestoreViewParams(aViewParamsName3)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Displaing only Mesh...................",
+myView.DisplayOnly(mesh)
+print "OK"
+
+print "Displaing only Scalar Map.............",
+myView.DisplayOnly(scalarmap)
+print "OK"
+
+print "Displaing only Cut Planes.............",
+myView.DisplayOnly(cutplanes)
+print "OK"
+
+#%====================Stage6: Changing of view parameters====================%
+
+print "**** Stage6: Changing of view parameters"
+
+print "Remove scaling........................",
+myView.RemoveScale()
+print "OK"
+
+print "Fit All...............................",
+myView.FitAll()
+print "OK"
+
+print "Rotating 3d view......................",
+aPoint = (0,60,150)
+myView.SetPointOfView(aPoint)
+print "OK"
+
+print "Resaving first view parameters........",
+aSaveRes = myView.SaveViewParams(aViewParamsName1)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+print "Restoring third view parameters.......",
+aRestoreRes = myView.RestoreViewParams(aViewParamsName3)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Restoring first view parameters.......",
+aRestoreRes = myView.RestoreViewParams(aViewParamsName1)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Displaying only Mesh..................",
+myView.DisplayOnly(mesh)
+print "OK"
+
+print "Displaying only Scalar Map............",
+myView.DisplayOnly(scalarmap)
+print "OK"
+
+#%====================Stage7: Saving of created view parameters====================%
+
+print "**** Stage7: Saving of created view parameters"
+
+print "Saving study..........................",
+
+str = os.getenv("TmpDir")
+if str == None:
+ str = "/tmp"
+
+file = str+'/VISU_005.hdf'
+
+salome.myStudyManager.SaveAs(file, salome.myStudy, 0)
+study_id = salome.myStudy._get_StudyId()
+#salome.sg.CloseStudy(study_id)
+#salome.myStudyManager.Close(salome.myStudy)
+#salome.myStudy.Close()
+print "OK"
+
+print "Opening just saved study..............",
+
+openedStudy = salome.myStudyManager.Open(file)
+myVisu.SetCurrentStudy(openedStudy)
+myViewManager = myVisu.GetViewManager()
+myView1 = myViewManager.Create3DView()
+if myView1 is None : print "Error"
+else : print "OK"
+
+print "Restoring first view parameters.......",
+aRestoreRes = myView1.RestoreViewParams(aViewParamsName1)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+Builder = openedStudy.NewBuilder()
+SCom = openedStudy.FindComponent("VISU")
+Builder.LoadWith(SCom ,myVisu)
+
+print "Displaying Scalar Map.................",
+SObj = openedStudy.FindObject('ScalarMap')
+scalarmap1 = visu_gui.visu.SObjectToObject(SObj)
+if scalarmap1 is None : print "Error"
+else : print "OK"
+myView1.DisplayOnly(scalarmap1)
+
+print "Displaying Cut Planes.................",
+SObj = openedStudy.FindObject('CutPlanes')
+cutplanes1 = visu_gui.visu.SObjectToObject(SObj)
+if cutplanes1 is None : print "Error"
+else : print "OK"
+myView1.DisplayOnly(cutplanes1)
+
+print "Restoring second view parameters......",
+aRestoreRes = myView1.RestoreViewParams(aViewParamsName2)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Displaying Scalar Map.................",
+myView1.DisplayOnly(scalarmap1)
+print "OK"
+
+print "Restoring third view parameters.......",
+aRestoreRes = myView1.RestoreViewParams(aViewParamsName3)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
+print "Displaying Cut Planes.................",
+myView1.DisplayOnly(cutplanes1)
+print "OK"
+
+#%====================Stage8: Changing of saved session====================%
+
+print "**** Stage8: Changing of saved session"
+
+print "Deleting ViewParams:3,1,2.............",
+SObj = openedStudy.FindObject(aViewParamsName3)
+Builder.RemoveObject(SObj)
+SObj = openedStudy.FindObject(aViewParamsName1)
+Builder.RemoveObject(SObj)
+SObj = openedStudy.FindObject(aViewParamsName2)
+Builder.RemoveObject(SObj)
+print "OK"
+
+SObjList2 = openedStudy.FindObjectByName(aViewParamsName1, "VISU")
+print "FindObjectByName(aViewParamsName1, VISU) returned ", len(SObjList2), " objects"
+
+print "Zooming trihedron.....................",
+aScale = myView.GetParallelScale()
+myView1.SetParallelScale(aScale*2)
+myView1.Update()
+print "OK"
+
+print "Rotating trihedron....................",
+aPoint = (200,40,-40)
+myView1.SetPointOfView(aPoint)
+print "OK"
+
+print "Saving view parameters................",
+aSaveRes = myView1.SaveViewParams(aViewParamsName1)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+print "Renaming ViewParams:1.................",
+SObj = openedStudy.FindObject(aViewParamsName1)
+SObj.Name = "New_view"
+print "OK"
+
+print "Setting scaling.......................",
+#Define parameters of scaling:
+myXParam = 4
+myYParam = 4
+myZParam = 8
+
+myXAxis = VISU.View3D.XAxis
+myYAxis = VISU.View3D.YAxis
+myZAxis = VISU.View3D.ZAxis
+
+myView1.ScaleView(myXAxis,myXParam)
+myView1.ScaleView(myYAxis,myYParam)
+myView1.ScaleView(myZAxis,myZParam)
+print "OK"
+
+myView1.FitAll()
+
+print "Saving view parameters................",
+aSaveRes = myView1.SaveViewParams(aViewParamsName2)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+print "Restoring first view parameters.......",
+aRestoreRes = myView1.RestoreViewParams(aViewParamsName1)
+if aSaveRes != 1 : print "Error"
+else : print "OK"
+
+print "Restoring second view parameters......",
+aRestoreRes = myView1.RestoreViewParams(aViewParamsName2)
+if aRestoreRes != 1 : print "Error"
+else : print "OK"
+
--- /dev/null
+# Animation of "vitesse" field, stored in file TimeStamps.med
+#
+# This script is equivalent to non-regression test script 003/A5
+
+import salome
+import visu_gui
+import SALOMEDS
+import VISU
+import os
+import time
+
+medFile = os.getenv("KERNEL_ROOT_DIR") + "/examples/TimeStamps.med"
+
+print 'Importing "TimeStamps.med"................',
+myVisu = visu_gui.myVisu
+myResult = myVisu.ImportFile(medFile)
+if myResult is None : print "Error"
+else : print "OK"
+
+print "Creating Cut Lines........................",
+medMesh = 'dom'
+medField = "vitesse"
+aCutLines = myVisu.CutLinesOnField(myResult,'dom',VISU.NODE,medField,1.0)
+aCutLines.SetOrientation(VISU.CutPlanes.XY, 0, 0)
+aCutLines.SetOrientation2(VISU.CutPlanes.ZX, 0, 0)
+aCutLines.SetNbLines(20)
+if aCutLines is None : print "Error"
+else : print "OK"
+
+print "Creating a Viewer.........................",
+myViewManager = myVisu.GetViewManager();
+myView = myViewManager.Create3DView();
+if myView is None : print "Error"
+else : print "OK"
+myView.Display(aCutLines);
+myView.FitAll();
+
+aCutLinesSObj = salome.myStudy.FindObjectIOR(aCutLines.GetID())
+aFather = aCutLinesSObj.GetFather().GetFather();
+
+print "Creating an Animation.....................",
+myAnim = myVisu.CreateAnimation(myView);
+if myAnim is None : print "Error"
+else : print "OK"
+
+print "Animation.................................",
+myAnim.addField(aFather);
+myAnim.generatePresentations(0);
+myAnim.generateFrames();
+myAnim.setSpeed(33)
+myAnim.startAnimation();
+
+myView.FitAll()
+while 1:
+ time.sleep(1)
+ if not myAnim.isRunning():
+ myAnim.stopAnimation()
+ break
+
+print "OK"
--- /dev/null
+# Show some results presentations in different 3D and 2D viewers
+# with different options (view parameters and display modes).
+# Uses MED files fra.med and TimeStamps.med from ${KERNEL_ROOT_DIR}/examples directory.
+#
+# Pay attention to a viewer title to know its purpose.
+#
+# This script is equivalent to script VISU_SWIG/visu_view3d.py
+
+import os
+import time
+import math
+import VISU
+import SALOMEDS
+from visu_gui import *
+
+aDelay = 1
+
+myViewManager = myVisu.GetViewManager();
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The window will be soon destroyed!")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
+
+myView.Maximize()
+print "myView.Maximize()"
+time.sleep(aDelay)
+
+myView.Restore()
+print "myView.Restore()"
+time.sleep(aDelay)
+
+myView.Minimize()
+print "myView.Minimize()"
+time.sleep(aDelay)
+
+myViewManager.Destroy(myView)
+print "myViewManager.Destroy(myView)"
+time.sleep(aDelay)
+
+
+medFile = "fra.med"
+myFieldName = "VITESSE";
+
+aMeshName ="LE VOLUME"
+anEntity = VISU.NODE
+aTimeStampId = 1
+
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
+myResult = myVisu.ImportFile(medFile)
+
+myView = myViewManager.Create3DView();
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.3,1.0)
+myView.SetBackground(aColor);
+
+myView.SetTitle("The viewer will display ScalarMap")
+print "myViewManager.Create3DView()"
+
+aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+
+myView.Display(aScalarMap);
+print "myView.Display(aScalarMap)"
+myView.SetFocalPoint([0,0,0]);
+print "myView.SetFocalPoint(...)"
+myView.SetParallelScale(2);
+print "myView.SetParallelScale(...)"
+myView.FitAll();
+
+aMax = aScalarMap.GetMax()
+aMin = aScalarMap.GetMin()
+aDelta = (aMax - aMin)/2.0
+aNbColors = aScalarMap.GetNbColors()
+aNbColors = 64
+for i in range(2,aNbColors) :
+ aScalarMap.SetNbColors(i)
+ aX = aMin + aDelta*i/aNbColors
+ aY = aMax - aDelta*i/aNbColors
+ aScalarMap.SetRange(aX,aY)
+ myView.Update();
+ time.sleep(aDelay)
+
+aScalarMap.SetRange(aMin,aMax)
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("Here we will display CutPlanes")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.7,0.0)
+myView.SetBackground(aColor);
+
+aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+print "myVisu.CutPlanesOnField(...)"
+
+myView.DisplayOnly(aCutPlanes);
+print "myView.DisplayOnly(aCutPlanes)"
+
+aPoint = myView.GetPointOfView();
+aPoint[0] = aPoint[0] + 10;
+myView.SetPointOfView(aPoint);
+print "myView.SetPointOfView(...)"
+myView.ScaleView(VISU.View3D.YAxis,10.0);
+myView.ScaleView(VISU.View3D.XAxis,3.0);
+print "myView.ScaleView(...)"
+time.sleep(aDelay)
+
+myView.FitAll();
+
+aNbPlanes = aCutPlanes.GetNbPlanes()
+aNbPlanes = 30
+aXAngle = aCutPlanes.GetRotateX()
+aYAngle = aCutPlanes.GetRotateY()
+anOrientation = aCutPlanes.GetOrientationType()
+for i in range(aNbPlanes,1,-1) :
+ aCutPlanes.SetNbPlanes(i)
+ aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
+ aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
+ aCutPlanes.SetOrientation(anOrientation,aX,aY)
+ myView.Update();
+ time.sleep(aDelay)
+
+aNbPlanes = 10
+aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0)
+for i in range(1,aNbPlanes) :
+ aCutPlanes.SetNbPlanes(i)
+ myView.Update();
+ time.sleep(aDelay)
+
+myView.SaveViewParams('AAA')
+print "myView.SaveViewParams('AAA')"
+time.sleep(aDelay)
+
+aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0)
+myView.RemoveScale();
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+myView = myViewManager.Create3DView();
+print "myViewManager.Create3DView()"
+
+myView.SetTitle("IsoSurface's viewer")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(1.0,0.7,0.0)
+myView.SetBackground(aColor);
+time.sleep(aDelay)
+
+aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+
+myView.DisplayOnly(aIsoSurfaces);
+myView.FitAll();
+print "myView.DisplayOnly(aCutPlanes)"
+time.sleep(aDelay)
+
+aNbSurfaces = aIsoSurfaces.GetNbSurfaces()
+aNbSurfaces = 32
+for i in range(2,aNbSurfaces) :
+ aIsoSurfaces.SetNbSurfaces(i)
+ myView.Update();
+ time.sleep(aDelay)
+
+aIsoSurfaces.SetNbSurfaces(10)
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for CutLines")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.7,0.7,0.7)
+myView.SetBackground(aColor);
+time.sleep(aDelay)
+
+aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0)
+aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0)
+
+myView.DisplayOnly(aCutLines);
+myView.FitAll();
+print "myView.DisplayOnly(aCutLines)"
+time.sleep(aDelay)
+
+aSObj = myStudy.FindObjectIOR(aCutLines.GetID())
+aTable = myVisu.CreateTable( aSObj.GetID() )
+print "myVisu.CreateTable(...)"
+
+aTableView = myViewManager.CreateTableView(aTable)
+aTableView.SetTitle('Changed Title')
+
+aContainer = myVisu.CreateContainer()
+print "myVisu.CreateContainer(...)"
+
+aNbCurve = aTable.GetNbRows() - 1
+for i in range(2,aNbCurve):
+ aCurve = myVisu.CreateCurve( aTable, 1, i )
+ print i, aCurve
+ aContainer.AddCurve(aCurve)
+
+
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curves from CutLines")
+print "myViewManager.CreateXYPlot()"
+time.sleep(aDelay)
+
+myView.Display(aContainer)
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for Animation")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
+
+medFile = "TimeStamps.med"
+myFieldName = "vitesse";
+
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
+myResult = myVisu.ImportFile(medFile)
+
+anAnim = myVisu.CreateAnimation(myView);
+aSObj = myStudy.FindObjectIOR(myResult.GetID())
+aSObj = aSObj.FindSubObject(1)[1]
+aSObj = aSObj.FindSubObject(2)[1]
+aSObj = aSObj.FindSubObject(2)[1]
+anAnim.addField(aSObj)
+anAnim.setPresentationType(0,VISU.TISOSURFACE)
+print "Generate presentations"
+anAnim.generatePresentations(0)
+print "Generate frames"
+anAnim.generateFrames()
+print "Start Animation"
+anAnim.setSpeed(99)
+anAnim.startAnimation()
+myView.FitAll()
+while 1:
+ time.sleep(1+aDelay)
+ if not anAnim.isRunning():
+ anAnim.stopAnimation()
+ break
--- /dev/null
+# Create a table and show it in Plot2d viewer
+#
+# This script is equivalent to script VISU_SWIG/visu_big_table.py
+
+import salome
+import math
+import SALOMEDS
+import VISU
+#from visu_gui import *
+
+# >>> Getting study builder ==================================================
+myStudy = salome.myStudy
+myBuilder = myStudy.NewBuilder()
+
+# >>> Getting (loading) VISU component =======================================
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
+myComponent = myStudy.FindComponent("VISU")
+myVisu.SetCurrentStudy(myStudy)
+if not myComponent:
+ myComponent = myBuilder.NewComponent("VISU")
+ aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
+ aName.SetValue( salome.sg.getComponentUserName("VISU") )
+
+ A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap");
+ aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
+ aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" );
+
+ myBuilder.DefineComponentInstance(myComponent,myVisu)
+
+# >>> Creating object with Table of real[ 200 * 20 ] =========================
+myTRealObject = myBuilder.NewObject(myComponent)
+AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
+AName.SetValue("Table Of Real")
+ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
+myHorNb = 10
+myVerNb = 200
+
+k={}
+for j in range(0,myHorNb):
+ k[j] = j*10+1
+ARealTable.AddRow(k.values())
+ARealTable.SetRowTitle(1, "Frequency")
+ARealTable.SetRowUnit(1, "Hz")
+
+for i in range(1,myVerNb+1):
+ for j in range(0,myHorNb):
+ if j % 2 == 1:
+ k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5
+ else:
+ k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5
+ ARealTable.AddRow(k.values())
+ ARealTable.SetRowTitle(i+1, "Power " + str(i))
+ ARealTable.SetRowUnit(i+1, "Wt")
+
+ARealTable.SetTitle("Very useful data")
+
+# >>> Create Visu table ======================================================
+myVisuTableReal = myVisu.CreateTable( myTRealObject.GetID() )
+
+# >>> Create container and insert curves
+myContainer = myVisu.CreateContainer()
+
+# >>> Create curves ==========================================================
+for i in range(1,myVerNb+1):
+ myCurve = myVisu.CreateCurve( myVisuTableReal, 1, i+1 )
+ myContainer.AddCurve(myCurve)
+
+# >>> Updating Object Browser ================================================
+salome.sg.updateObjBrowser(1)
+
+# >>> Display curves in Plot2d viewer ========================================
+myViewManager = myVisu.GetViewManager();
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curves from the Table")
+myView.Display(myContainer)
+
+# ============================================================================
--- /dev/null
+# Import a table from file and show it in Plot2d viewer
+
+import salome
+import math
+import SALOMEDS
+import VISU
+#from visu_gui import *
+
+# >>> Getting study builder ==================================================
+myStudy = salome.myStudy
+myBuilder = myStudy.NewBuilder()
+
+# >>> Getting (loading) VISU component =======================================
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
+myComponent = myStudy.FindComponent("VISU")
+myVisu.SetCurrentStudy(myStudy)
+if not myComponent:
+ myComponent = myBuilder.NewComponent("VISU")
+ aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
+ #aName.SetValue("Visu")
+ aName.SetValue( salome.sg.getComponentUserName("VISU") )
+
+ A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap");
+ aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
+ aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" );
+
+ myBuilder.DefineComponentInstance(myComponent,myVisu)
+
+# >>> Import a tables from a file ============================================
+aFileName = os.getenv("VISU_ROOT_DIR") + "/examples/tables_test.xls"
+sobj = myVisu.ImportTables(aFileName)
+
+# >>> Create container and insert curves =====================================
+myContainer = myVisu.CreateContainer()
+
+chiter = myStudy.NewChildIterator(sobj)
+while chiter.More():
+ sobj_table = chiter.Value()
+
+ # >>> Create Visu table ====================================================
+ myVisuTableReal = myVisu.CreateTable(sobj_table.GetID())
+
+ nbRows = myVisuTableReal.GetNbRows()
+
+ # >>> Create curves ========================================================
+ for i in range(1, nbRows):
+ myCurve = myVisu.CreateCurve(myVisuTableReal, 1, i+1)
+ myContainer.AddCurve(myCurve)
+
+ chiter.Next()
+
+# >>> Updating Object Browser ================================================
+salome.sg.updateObjBrowser(1)
+
+# >>> Display curves in Plot2d viewer ========================================
+myViewManager = myVisu.GetViewManager();
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curves from the Table")
+myView.Display(myContainer)
+
+# ============================================================================
--- /dev/null
+0 1
+1 2
+2 2.5
+
+#TITLE: Table toto 1
+#COLUMN_TITLES: toto 1 | titi2 | subtitle 2.3
+#COLUMN_UNITS: s kg/m3 m
+# It's a comment ...
+0 4.3 -3 #TITLE: row title 1
+1 5 6 #TITLE: row title 2
+# Another comment
+2 -7 4.5 #TITLE: row title 3
+
+#TITLE: sinus
+0.0 0.0
+0.01 0.125333233564
+0.02 0.248689887165
+0.03 0.368124552685
+0.04 0.481753674102
+0.05 0.587785252292
+0.06 0.684547105929
+0.07 0.770513242776
+0.08 0.844327925502
+0.09 0.904827052466
+0.1 0.951056516295
+0.11 0.982287250729
+0.12 0.998026728428
+0.13 0.998026728428
+0.14 0.982287250729
+0.15 0.951056516295
+0.16 0.904827052466
+0.17 0.844327925502
+0.18 0.770513242776
+0.19 0.684547105929
+0.2 0.587785252292
+0.21 0.481753674102
+0.22 0.368124552685
+0.23 0.248689887165
+0.24 0.125333233564
+0.25 1.22460635382e-16
+0.26 -0.125333233564
+0.27 -0.248689887165
+0.28 -0.368124552685
+0.29 -0.481753674102
+0.3 -0.587785252292
+0.31 -0.684547105929
+0.32 -0.770513242776
+0.33 -0.844327925502
+0.34 -0.904827052466
+0.35 -0.951056516295
+0.36 -0.982287250729
+0.37 -0.998026728428
+0.38 -0.998026728428
+0.39 -0.982287250729
+0.4 -0.951056516295
+0.41 -0.904827052466
+0.42 -0.844327925502
+0.43 -0.770513242776
+0.44 -0.684547105929
+0.45 -0.587785252292
+0.46 -0.481753674102
+0.47 -0.368124552685
+0.48 -0.248689887165
+0.49 -0.125333233564
+0.5 -2.44921270764e-16
+0.51 0.125333233564
+0.52 0.248689887165
+0.53 0.368124552685
+0.54 0.481753674102
+0.55 0.587785252292
+0.56 0.684547105929
+0.57 0.770513242776
+0.58 0.844327925502
+0.59 0.904827052466
+0.6 0.951056516295
+0.61 0.982287250729
+0.62 0.998026728428
+0.63 0.998026728428
+0.64 0.982287250729
+0.65 0.951056516295
+0.66 0.904827052466
+0.67 0.844327925502
+0.68 0.770513242776
+0.69 0.684547105929
+0.7 0.587785252292
+0.71 0.481753674102
+0.72 0.368124552685
+0.73 0.248689887165
+0.74 0.125333233564
+0.75 3.67381906147e-16
+0.76 -0.125333233564
+0.77 -0.248689887165
+0.78 -0.368124552685
+0.79 -0.481753674102
+0.8 -0.587785252292
+0.81 -0.684547105929
+0.82 -0.770513242776
+0.83 -0.844327925502
+0.84 -0.904827052466
+0.85 -0.951056516295
+0.86 -0.982287250729
+0.87 -0.998026728428
+0.88 -0.998026728428
+0.89 -0.982287250729
+0.9 -0.951056516295
+0.91 -0.904827052466
+0.92 -0.844327925502
+0.93 -0.770513242776
+0.94 -0.684547105929
+0.95 -0.587785252292
+0.96 -0.481753674102
+0.97 -0.368124552685
+0.98 -0.248689887165
+0.99 -0.125333233564
+1.0 -4.89842541529e-16
-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
+LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lVTKViewer
@CONCLUDE@
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;
//Import mesh on entity
+ cout << "\n\n ** TEST GetMeshOnEntityIDMapper ***" << endl;
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++){
aVTKID = anIDMapper->GetElemVTKID(anObjID);
cout<<anObjID<<"; "<<aVTKID<<endl;
}
- */
}
}
theWidget->AddObserver(vtkCommand::DisableEvent,
myEventCallbackCommand.GetPointer(),
myPriority);
- theWidget->AddObserver(vtkCommand::EndInteractionEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+
}
myWidget = theWidget;
{
Superclass::SetVisibility(theMode);
myScalarBarCtrl->SetVisibility(theMode);
- Highlight(isHighlighted());
}
//----------------------------------------------------------------------------
case VISU::UpdatePickingSettingsEvent:
UpdatePickingSettings();
break;
- case vtkCommand::EndInteractionEvent:
- case vtkCommand::EnableEvent:
- case vtkCommand::DisableEvent:
- myCurrentPL->GetMapper()->Update();
- Highlight(isHighlighted());
- break;
default:
break;
}
return false;
vtkIdType aVtkId = myPointPicker->GetPointId();
-
if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
vtkIdType anObjId = GetNodeObjId( aVtkId );
if(myLastObjPointID != anObjId){
}
//==================================================================
-// function : Highlight
+// function : highlight
// purpose :
//==================================================================
void
VISU_GaussPtsAct
::Highlight(bool theIsHighlight)
{
- myOutlineActor->SetVisibility(false);
myTextActor->SetVisibility(0);
myCursorPyramidSelected->SetVisibility(0);
myCursorPyramid->SetVisibility(0);
myCellActor->SetVisibility(anIsVisible && theIsHighlight);
}
}
+ myOutline->SetBounds( GetInput()->GetBounds() );
+ myOutlineActor->SetVisibility( anIsVisible && theIsHighlight );
}
break;
}
-
switch(theEvent){
case vtkCommand::EnableEvent:
myCurrentPL = myInsideDeviceActor->GetPipeLine();
case vtkCommand::DisableEvent:
myCurrentPL = myDeviceActor->GetPipeLine();
break;
- default:
- break;
}
-
+
Superclass::OnInteractorEvent(theEvent);
}
}
if(theWidget){
+ theWidget->AddObserver(vtkCommand::EndInteractionEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
myDeviceActor->SetVisibility(Superclass::GetVisibility() && theWidget->IsEnabled());
}
}
break;
case vtkCommand::EndInteractionEvent:
- Update();
+ //vtkLODActor::SetMapper(GetMapper());
break;
default:
break;
myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() );
- Superclass::SetMapper( myMapper.GetPointer() );
+ vtkLODActor::SetMapper( myMapper.GetPointer() );
}
VISU_GaussPointsPL*
aProperty->SetAmbient(1.0);
aProperty->SetDiffuse(0.0);
aProperty->SetSpecular(0.0);
-
+
myProperty->DeepCopy(aProperty);
}
myBarVisibility = theMode;
if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility);
}
-
-void VISU_ScalarMapAct::SetShading(bool theOn)
-{
- vtkProperty* aProperty = GetProperty();
-
- if (theOn)
- {
- aProperty->SetAmbient(0.0);
- aProperty->SetDiffuse(1.0);
- }
- else
- {
- aProperty->SetAmbient(1.0);
- aProperty->SetDiffuse(0.0);
- }
- myProperty->DeepCopy(aProperty);
-}
-
-bool VISU_ScalarMapAct::IsShading()
-{
- vtkProperty* aProperty = GetProperty();
-
- return (aProperty->GetAmbient() == 0 && aProperty->GetDiffuse() == 1);
-}
virtual void SetBarVisibility(bool theMode);
virtual bool GetBarVisibility(){ return myBarVisibility;}
- virtual void SetShading(bool theOn = true);
- virtual bool IsShading();
-
protected:
VISU_ScalarMapAct();
bool myBarVisibility;
-L${GUI_ROOT_DIR}/lib/salome \
-L${MED_ROOT_DIR}/lib/salome
-LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lmed_V2_1 -lsuit -lqtx -lSALOMEBasics
+LDFLAGSFORBIN=$(LDFLAGS) -lOpUtil -lMEDWrapper -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lsuit -lqtx
@CONCLUDE@
//----------------------------------------------------------------------------
SALOME_ExtractGeometry
::SALOME_ExtractGeometry():
- myStoreMapping(false),
- myIsDoneShallowCopy(false)
+ myStoreMapping(false)
{}
SALOME_ExtractGeometry
SALOME_ExtractGeometry
::GetElemVTKId(vtkIdType theID)
{
- if(!myStoreMapping||myIsDoneShallowCopy){
+ if(myElemVTK2ObjIds.empty())
return theID;
- }
+
vtkIdType iEnd = myElemVTK2ObjIds.size();
for(vtkIdType i = 0; i < iEnd; i++)
if(myElemVTK2ObjIds[i] == theID)
SALOME_ExtractGeometry
::GetNodeVTKId(vtkIdType theID)
{
- if (!myStoreMapping||myIsDoneShallowCopy){
+ if (myElemVTK2ObjIds.empty())
return theID;
- }
+
vtkIdType iEnd = myNodeVTK2ObjIds.size();
for(vtkIdType i = 0; i < iEnd; i++)
if(myNodeVTK2ObjIds[i] == theID)
SALOME_ExtractGeometry
::GetElemObjId(int theVtkID)
{
- if (!myStoreMapping||myIsDoneShallowCopy){
+ if (myElemVTK2ObjIds.empty())
return theVtkID;
- }
- //
- if (theVtkID<myElemVTK2ObjIds.size()){
- return myElemVTK2ObjIds[theVtkID];
- }
- return -1;
+
+#if defined __GNUC_2__
+ return myElemVTK2ObjIds[theVtkID];
+#else
+ return myElemVTK2ObjIds.at(theVtkID);
+#endif
}
SALOME_ExtractGeometry
::GetNodeObjId(int theVtkID)
{
- if (!myStoreMapping||myIsDoneShallowCopy){
+ if (myNodeVTK2ObjIds.empty())
return theVtkID;
- }
- //
- if (theVtkID<myNodeVTK2ObjIds.size()){
- return myNodeVTK2ObjIds[theVtkID];
- }
- return -1;
+
+#if defined __GNUC_2__
+ return myNodeVTK2ObjIds[theVtkID];
+#else
+ return myNodeVTK2ObjIds.at(theVtkID);
+#endif
}
{
myElemVTK2ObjIds.clear();
myNodeVTK2ObjIds.clear();
- //
- myIsDoneShallowCopy = !this->ImplicitFunction;
- if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
+ bool anIsNothingToDo = !this->ImplicitFunction;
+
+ if(!anIsNothingToDo && myImplicitBoolean.GetPointer()){
if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
- myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
+ anIsNothingToDo = aFunction->GetNumberOfItems() == 0;
}
}
- if(myIsDoneShallowCopy){
+ if(anIsNothingToDo){
GetOutput()->ShallowCopy(GetInput());
Modified();
return;
private:
bool myStoreMapping;
- bool myIsDoneShallowCopy;
typedef std::vector<vtkIdType> TVectorId;
TVectorId myElemVTK2ObjIds;
TVectorId myNodeVTK2ObjIds;
aPresent->Init();
aPresent->SetSourceRange();
vtkDataSet* anOutput = aPresent->GetMapper()->GetInput();
- //for(int i = 0, iEnd = anOutput->GetNumberOfCells(); i < iEnd; i++){
- // cout<<aPresent->GetPointSize(i)<<endl;
- //}
+ 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" ) );
+ char* 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" ) );
+ char* anAlphaTexture = getenv( "VISU_ROOT_DIR" );
strcat( anAlphaTexture, "/share/salome/resources/sprite_alpha.vti" );
- //cout << anAlphaTexture << endl;
aPresent->SetImageData( VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture ) );
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);
// Build the representation of the widget
//
- myPlane1 = vtkPlane::New();
- myPlane1->SetNormal(0,0,1);
- myPlane1->SetOrigin(0,0,0);
+ Plane = vtkPlane::New();
+ Plane->SetNormal(0,0,1);
+ Plane->SetOrigin(0,0,0);
//
myDistance = 10.;
myPlane2 = vtkPlane::New();
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();
+ Box = vtkImageData::New();
+ Box->SetDimensions(2,2,2);
+ Outline = vtkOutlineFilter::New();
+ Outline->SetInput(Box);
+ OutlineMapper = vtkPolyDataMapper::New();
+ OutlineMapper->SetInput(Outline->GetOutput());
+ OutlineActor = vtkActor::New();
+ this->OutlineActor->SetMapper(this->OutlineMapper);
+ this->OutlineActor->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->Cutter = vtkCutter::New();
+ this->Cutter->SetInput(this->Box);
+ this->Cutter->SetCutFunction(this->Plane);
+ this->CutMapper = vtkPolyDataMapper::New();
+ this->CutMapper->SetInput(this->Cutter->GetOutput());
+ this->CutActor = vtkActor::New();
+ this->CutActor->SetMapper(this->CutMapper);
+ this->DrawPlane = 1;
this->myCutter2 = vtkCutter::New();
- this->myCutter2->SetInput(myBox);
+ this->myCutter2->SetInput(this->Box);
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);
+ this->Edges = vtkFeatureEdges::New();
+ Edges->SetColoring(0);
+ this->Edges->SetInput(this->Cutter->GetOutput());
+ this->EdgesMapper = vtkPolyDataMapper::New();
+ this->EdgesMapper->SetInput(this->Edges->GetOutput());
+ this->EdgesActor = vtkActor::New();
+ this->EdgesActor->SetMapper(this->EdgesMapper);
+ EdgesActor->GetProperty()->SetLineWidth(4.);
+ EdgesActor->GetProperty()->SetColor(0., .5, .7);
// Create the + plane normal
this->LineSource = vtkLineSource::New();
//Manage the picking stuff
this->Picker = vtkCellPicker::New();
this->Picker->SetTolerance(0.005);
- this->Picker->AddPickList(this->myCutActor1);
+ this->Picker->AddPickList(this->CutActor);
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->AddPickList(this->OutlineActor);
this->Picker->PickFromListOn();
// Set up the initial properties
//==================================================================
VISU_ImplicitFunctionWidget::~VISU_ImplicitFunctionWidget()
{
- myPlane1->Delete();
+ this->Plane->Delete();
this->myPlane2->Delete();
this->myImplicitFunction->Delete();
- myBox->Delete();
- this->myOutline->Delete();
- this->myOutlineMapper->Delete();
- this->myOutlineActor->Delete();
+ this->Box->Delete();
+ this->Outline->Delete();
+ this->OutlineMapper->Delete();
+ this->OutlineActor->Delete();
- this->myCutter1->Delete();
- this->myCutMapper1->Delete();
- this->myCutActor1->Delete();
+ this->Cutter->Delete();
+ this->CutMapper->Delete();
+ this->CutActor->Delete();
- this->myEdges1->Delete();
- this->myEdgesMapper1->Delete();
- this->myEdgesActor1->Delete();
-
myCutter2->Delete();
myCutMapper2->Delete();
myCutActor2->Delete();
-
- myEdges2->Delete();
- myEdgesMapper2->Delete();
- myEdgesActor2->Delete();
+
+ this->Edges->Delete();
+ this->EdgesMapper->Delete();
+ this->EdgesActor->Delete();
this->LineSource->Delete();
this->LineMapper->Delete();
myDistance=theDistance;
//
float *origin, *normal, oNew[3], aN2[3];
- origin = myPlane1->GetOrigin();
- normal = myPlane1->GetNormal();
+ origin = Plane->GetOrigin();
+ normal = Plane->GetNormal();
vtkMath::Normalize(normal);
oNew[0] = origin[0] + myDistance*normal[0];
oNew[1] = origin[1] + myDistance*normal[1];
vtkCamera *pCamera=CurrentRenderer->GetActiveCamera();
pCamera->SetParallelProjection(1);
//
- this->myImplicitFunction->AddFunction(myPlane1);
+ this->myImplicitFunction->AddFunction(this->Plane);
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,
+ if( this->HandleMoveEvent )
+ {
+ i->AddObserver(vtkCommand::MouseMoveEvent, this->EventCallbackCommand,
this->Priority);
}
- if( this->HandleLeftButtonEvent ) {
+ if( this->HandleLeftButtonEvent )
+ {
i->AddObserver(vtkCommand::LeftButtonPressEvent,
- this->EventCallbackCommand,
- this->Priority);
+ this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::LeftButtonReleaseEvent,
- this->EventCallbackCommand,
- this->Priority);
+ this->EventCallbackCommand, this->Priority);
}
- if( this->HandleMiddleButtonEvent ) {
+ if( this->HandleMiddleButtonEvent )
+ {
i->AddObserver(vtkCommand::MiddleButtonPressEvent,
- this->EventCallbackCommand,
- this->Priority);
+ this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::MiddleButtonReleaseEvent,
- this->EventCallbackCommand,
- this->Priority);
+ this->EventCallbackCommand, this->Priority);
}
- if( this->HandleRightButtonEvent ) {
+ if( this->HandleRightButtonEvent )
+ {
i->AddObserver(vtkCommand::RightButtonPressEvent,
- this->EventCallbackCommand,
- this->Priority);
+ this->EventCallbackCommand, this->Priority);
i->AddObserver(vtkCommand::RightButtonReleaseEvent,
- this->EventCallbackCommand,
- this->Priority);
+ this->EventCallbackCommand, this->Priority);
}
// add the outline
- this->CurrentRenderer->AddActor(this->myOutlineActor);
- this->myOutlineActor->SetProperty(this->OutlineProperty);
+ this->CurrentRenderer->AddActor(this->OutlineActor);
+ this->OutlineActor->SetProperty(this->OutlineProperty);
// add the edges
- this->CurrentRenderer->AddActor(this->myEdgesActor1);
- this->CurrentRenderer->AddActor(myEdgesActor2);
-
- this->myOutlineActor->SetProperty(this->EdgesProperty);
+ this->CurrentRenderer->AddActor(this->EdgesActor);
+ this->OutlineActor->SetProperty(this->EdgesProperty);
// add the normal vector
this->CurrentRenderer->AddActor(this->LineActor);
this->SphereActor->SetProperty(this->NormalProperty);
// add the plane (if desired)
- if ( this->myDrawPlane ) {
- this->CurrentRenderer->AddActor(this->myCutActor1);
+ if ( this->DrawPlane )
+ {
+ this->CurrentRenderer->AddActor(this->CutActor);
this->CurrentRenderer->AddActor(this->myCutActor2);
- }
- this->myCutActor1->SetProperty(this->PlaneProperty);
+ }
+ this->CutActor->SetProperty(this->PlaneProperty);
myCutActor2->SetProperty(this->PlaneProperty);
-
+
this->UpdateRepresentation();
this->SizeHandles();
this->InvokeEvent(vtkCommand::EnableEvent,NULL);
- }
+ }
else {//disabling----------------------------------------------------------
vtkDebugMacro(<<"Disabling plane widget");
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->OutlineActor);
+ this->CurrentRenderer->RemoveActor(this->EdgesActor);
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(this->CutActor);
this->CurrentRenderer->RemoveActor(myCutActor2);
this->InvokeEvent(vtkCommand::DisableEvent,NULL);
this->Interactor->Render();
}
-//==================================================================
-// function: IsEnabled
-// purpose :
-//==================================================================
-int VISU_ImplicitFunctionWidget::IsEnabled()
+
+int
+VISU_ImplicitFunctionWidget
+::IsEnabled()
{
return this->Enabled;
}
+
+
//==================================================================
// function: ProcessEvents
// purpose :
case vtkCommand::MouseMoveEvent:
self->OnMouseMove();
break;
- default:
- break;
}
}
//==================================================================
this->SphereActor->SetProperty(this->NormalProperty);
}
}
+
//==================================================================
// function: HighlightPlane
// purpose :
void VISU_ImplicitFunctionWidget::HighlightPlane(int highlight)
{
if ( highlight ) {
- this->myCutActor1->SetProperty(this->SelectedPlaneProperty);
+ this->CutActor->SetProperty(this->SelectedPlaneProperty);
myCutActor2->SetProperty(this->SelectedPlaneProperty);
}
else {
- this->myCutActor1->SetProperty(this->PlaneProperty);
+ this->CutActor->SetProperty(this->PlaneProperty);
myCutActor2->SetProperty(this->PlaneProperty);
}
}
//==================================================================
void VISU_ImplicitFunctionWidget::HighlightOutline(int highlight)
{
- if (highlight) {
- this->myOutlineActor->SetProperty(this->SelectedOutlineProperty);
+ if ( highlight ) {
+ this->OutlineActor->SetProperty(this->SelectedOutlineProperty);
}
else {
- this->myOutlineActor->SetProperty(this->OutlineProperty);
+ this->OutlineActor->SetProperty(this->OutlineProperty);
}
}
//==================================================================
this->HighlightNormal(1);
this->State = VISU_ImplicitFunctionWidget::Rotating;
}
- else if ( prop == this->myCutActor1) {
+ else if ( prop == this->CutActor) {
this->HighlightPlane(1);
this->State = VISU_ImplicitFunctionWidget::Pushing;
}
// Process the motion
if ( this->State == VISU_ImplicitFunctionWidget::MovingPlane ) {
- //this->TranslatePlane(prevPickPoint, pickPoint);
- //printf(" TranslatePlane\n");
+ this->TranslatePlane(prevPickPoint, pickPoint);
}
else if ( this->State == VISU_ImplicitFunctionWidget::MovingOutline ) {
- //this->TranslateOutline(prevPickPoint, pickPoint);
- //printf(" TranslateOutline\n");
+ this->TranslateOutline(prevPickPoint, pickPoint);
}
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");
+ this->Scale(prevPickPoint, pickPoint, X, Y);
}
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->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)
+void VISU_ImplicitFunctionWidget::Rotate(int X, int Y, double *p1, double *p2, double *vpn)
{
- double v[3]; //vector of motion
+ double v[3]; //vector of motion
double axis[3]; //axis of rotation
- double theta; //rotation angle
- int i;
+ double theta; //rotation angle
// 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();
+ v[0] = p2[0] - p1[0];
+ v[1] = p2[1] - p1[1];
+ v[2] = p2[2] - p1[2];
+
+ float *origin = this->Plane->GetOrigin();
+ float *normal = this->Plane->GetNormal();
// Create axis of rotation and angle of rotation
vtkMath::Cross(vpn,v,axis);
this->Transform->Translate(-origin[0],-origin[1],-origin[2]);
//Set the new normal
- float nNew[3], aN2[3], oNew[3];
+ float nNew[3], aN2[3];
this->Transform->TransformNormal(normal,nNew);
- //
- for (i=0; i<3; ++i){
- aN2[i] = -nNew[i];
- }
+ this->Plane->SetNormal(nNew);
+
+ aN2[0] = -nNew[0];
+ aN2[1] = -nNew[1];
+ aN2[2] = -nNew[2];
+ this->myPlane2->SetNormal(aN2);
+ float oNew[3];
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();
+ oNew[0] = origin[0] + myDistance*nNew[0];
+ oNew[1] = origin[1] + myDistance*nNew[1];
+ oNew[2] = origin[2] + myDistance*nNew[2];
+ this->myPlane2->SetOrigin(oNew);
+
this->UpdateRepresentation();
}
-
//==================================================================
// function: TranslatePlane
// purpose : Loop through all points and translate them
//Translate the plane
float oNew[3];
- float *origin = myPlane1->GetOrigin();
+ float *origin = this->Plane->GetOrigin();
oNew[0] = origin[0] + v[0];
oNew[1] = origin[1] + v[1];
oNew[2] = origin[2] + v[2];
- myPlane1->SetOrigin(oNew);
+ this->Plane->SetOrigin(oNew);
origin = this->myPlane2->GetOrigin();
oNew[0] = origin[0] + v[0];
v[2] = p2[2] - p1[2];
//Translate the bounding box
- float *origin = myBox->GetOrigin();
+ float *origin = this->Box->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);
+ this->Box->SetOrigin(oNew);
//Translate the plane
- origin = myPlane1->GetOrigin();
+ origin = this->Plane->GetOrigin();
oNew[0] = origin[0] + v[0];
oNew[1] = origin[1] + v[1];
oNew[2] = origin[2] + v[2];
- myPlane1->SetOrigin(oNew);
+ this->Plane->SetOrigin(oNew);
origin = this->myPlane2->GetOrigin();
oNew[0] = origin[0] + v[0];
this->UpdateRepresentation();
}
+//==================================================================
+// function: TranslateOrigin
+// purpose :Loop through all points and translate them
+//==================================================================
+void VISU_ImplicitFunctionWidget::TranslateOrigin(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];
+
+ //Add to the current point, project back down onto plane
+ float *o = this->Plane->GetOrigin();
+ float *n = this->Plane->GetNormal();
+ float newOrigin[3];
+ newOrigin[0] = o[0] + v[0];
+ newOrigin[1] = o[1] + v[1];
+ newOrigin[2] = o[2] + v[2];
+
+ vtkPlane::ProjectPoint(newOrigin,o,n,newOrigin);
+ this->SetOrigin(newOrigin);
+ this->UpdateRepresentation();
+}
//==================================================================
// function: Scale
// purpose :
v[2] = p2[2] - p1[2];
//int res = this->PlaneSource->GetXResolution();
- float *o = myPlane1->GetOrigin();
+ float *o = this->Plane->GetOrigin();
// Compute the scale factor
- float sf = vtkMath::Norm(v) / this->myOutline->GetOutput()->GetLength();
+ float sf = vtkMath::Norm(v) / this->Outline->GetOutput()->GetLength();
if ( Y > this->Interactor->GetLastEventPosition()[1] ) {
sf = 1.0 + sf;
}
this->Transform->Scale(sf,sf,sf);
this->Transform->Translate(-o[0],-o[1],-o[2]);
- float *origin = myBox->GetOrigin();
- float *spacing = myBox->GetSpacing();
+ float *origin = this->Box->GetOrigin();
+ float *spacing = this->Box->GetSpacing();
float oNew[3], p[3], pNew[3];
p[0] = origin[0] + spacing[0];
p[1] = origin[1] + spacing[1];
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->Box->SetOrigin(oNew);
+ this->Box->SetSpacing( (pNew[0]-oNew[0]), (pNew[1]-oNew[1]), (pNew[2]-oNew[2]) );
this->UpdateRepresentation();
}
+//==================================================================
+// function: Push
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::Push(double *p1, double *p2)
+{
+ //Get the motion vector
+ float v[3];
+ v[0] = p2[0] - p1[0];
+ v[1] = p2[1] - p1[1];
+ v[2] = p2[2] - p1[2];
+
+ float z0 = this->Plane->GetOrigin()[2];
+ double distance = vtkMath::Dot( v, myPlane2->GetNormal() );
+ float z1 = z0 + distance * myPlane2->GetNormal()[2];
+ if( z1 <= this->Box->GetOrigin()[2] )
+ return;
+
+ this->Plane->Push( vtkMath::Dot(v,this->Plane->GetNormal()) );
+ this->SetOrigin(this->Plane->GetOrigin());
+ myPlane2->Push( vtkMath::Dot(v,this->Plane->GetNormal()) );
+ this->UpdateRepresentation();
+}
+//==================================================================
+// function: PushDistance
+// purpose :
+//==================================================================
+void VISU_ImplicitFunctionWidget::PushDistance(double *p1, double *p2)
+{
+ float v[3], *anOrigin1, *aN1, *anOrigin2, *aN2, aD;
+ //Get the motion vector
+ v[0] = p2[0] - p1[0];
+ v[1] = p2[1] - p1[1];
+ v[2] = p2[2] - p1[2];
+ //
+ anOrigin1 = Plane->GetOrigin();
+ aN1 = Plane->GetNormal();
+ anOrigin2 = myPlane2->GetOrigin();
+ aN2 = myPlane2->GetNormal();
+
+ vtkMath::Normalize(aN1);
+ float* origin = new float[3];
+ double distance = vtkMath::Dot( v, aN2 );
+ for( int i = 0; i < 3; i++ )
+ origin[i] = anOrigin2[i] + distance * aN2[i];
+ float d = DistanceToPlane(origin, aN1, anOrigin1);
+ delete [] origin;
+
+ if( d <= 0.0 )
+ return;
+
+ myPlane2->Push( vtkMath::Dot(v, myPlane2->GetNormal()));
+ aD=DistanceToPlane(anOrigin2, aN1, anOrigin1);
+ //
+ myDistance=aD;
+ //
+ this->UpdateRepresentation();
+}
//==================================================================
// function: CreateDefaultProperties
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]),
+ this->Box->SetOrigin(bounds[0],bounds[2],bounds[4]);
+ this->Box->SetSpacing((bounds[1]-bounds[0]),(bounds[3]-bounds[2]),
(bounds[5]-bounds[4]));
- this->myOutline->Update();
+ this->Outline->Update();
if (this->Input || this->Prop3D) {
- this->LineSource->SetPoint1(myPlane1->GetOrigin());
+ this->LineSource->SetPoint1(this->Plane->GetOrigin());
if ( this->NormalToYAxis ) {
- myPlane1->SetNormal(0,1,0);
+ this->Plane->SetNormal(0,1,0);
myPlane2->SetNormal(0,-1,0);
this->LineSource->SetPoint2(0,1,0);
}
else if ( this->NormalToZAxis ) {
- myPlane1->SetNormal(0,0,1);
+ this->Plane->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);
+ this->Plane->SetNormal(1,0,0);
myPlane2->SetNormal(-1,0,0);
this->LineSource->SetPoint2(1,0,0);
}
}
//==================================================================
// function: SetOrigin
-// purpose :Set the origin of the plane.(for external calls)
+// purpose :Set the origin of the plane.
//==================================================================
void VISU_ImplicitFunctionWidget::SetOrigin(float x, float y, float z)
{
this->SetOrigin(origin);
}
//==================================================================
-// function: SetOrigin
-// purpose : Set the origin of the plane.(for external calls)
+// function: SetOrigin
+// purpose :Set the origin of the plane.
//==================================================================
-void VISU_ImplicitFunctionWidget::SetOrigin(float x[3])
+void VISU_ImplicitFunctionWidget::SetOrigin(float x[3])
{
- float *bounds = this->myOutline->GetOutput()->GetBounds();
+ float *bounds = this->Outline->GetOutput()->GetBounds();
for (int i=0; i<3; i++) {
if ( x[i] < bounds[2*i] ) {
x[i] = bounds[2*i];
x[i] = bounds[2*i+1];
}
}
- myPlane1->SetOrigin(x);
- float *origin, *normal, oNew[3];
- origin = myPlane1->GetOrigin();
- normal = myPlane1->GetNormal();
+ this->Plane->SetOrigin(x);
+ float *origin, *normal, oNew[3];
+ origin = Plane->GetOrigin();
+ normal = Plane->GetNormal();
vtkMath::Normalize(normal);
oNew[0] = origin[0] + myDistance*normal[0];
oNew[1] = origin[1] + myDistance*normal[1];
//==================================================================
float* VISU_ImplicitFunctionWidget::GetOrigin()
{
- return myPlane1->GetOrigin();
+ return this->Plane->GetOrigin();
}
void VISU_ImplicitFunctionWidget::GetOrigin(float xyz[3])
{
- myPlane1->GetOrigin(xyz);
+ this->Plane->GetOrigin(xyz);
}
//==================================================================
// function: SetNormal
n[1] = y;
n[2] = z;
vtkMath::Normalize(n);
- myPlane1->SetNormal(n);
+ this->Plane->SetNormal(n);
n[0] =- x;
n[1] =- y;
n[2] =- z;
//==================================================================
float* VISU_ImplicitFunctionWidget::GetNormal()
{
- return myPlane1->GetNormal();
+ return this->Plane->GetNormal();
}
//==================================================================
// function: GetNormal
//==================================================================
void VISU_ImplicitFunctionWidget::GetNormal(float xyz[3])
{
- myPlane1->GetNormal(xyz);
+ this->Plane->GetNormal(xyz);
}
//==================================================================
// function: SetDrawPlane
//==================================================================
void VISU_ImplicitFunctionWidget::SetDrawPlane(int drawPlane)
{
- if ( drawPlane == this->myDrawPlane ) {
+ if ( drawPlane == this->DrawPlane ) {
return;
}
this->Modified();
- this->myDrawPlane = drawPlane;
+ this->DrawPlane = drawPlane;
if ( this->Enabled ) {
if ( drawPlane ) {
- this->CurrentRenderer->AddActor(this->myCutActor1);
+ this->CurrentRenderer->AddActor(this->CutActor);
this->CurrentRenderer->AddActor(myCutActor2);
}
else {
- this->CurrentRenderer->RemoveActor(this->myCutActor1);
+ this->CurrentRenderer->RemoveActor(this->CutActor);
this->CurrentRenderer->RemoveActor(myCutActor2);
}
this->Interactor->Render();
//==================================================================
void VISU_ImplicitFunctionWidget::GetPolyData(vtkPolyData *pd)
{
- pd->ShallowCopy(this->myCutter1->GetOutput());
+ pd->ShallowCopy(this->Cutter->GetOutput());
}
//==================================================================
// function: GetPolyDataSource
//==================================================================
vtkPolyDataSource *VISU_ImplicitFunctionWidget::GetPolyDataSource()
{
- return this->myCutter1;
+ return this->Cutter;
}
//==================================================================
// function:GetPlane
return;
}
- plane->SetNormal(myPlane1->GetNormal());
- plane->SetOrigin(myPlane1->GetOrigin());
+ plane->SetNormal(this->Plane->GetNormal());
+ plane->SetOrigin(this->Plane->GetOrigin());
}
//==================================================================
// function:UpdatePlacement
//==================================================================
void VISU_ImplicitFunctionWidget::UpdatePlacement(void)
{
- this->myOutline->Update();
- this->myCutter1->Update();
- this->myEdges1->Update();
+ this->Outline->Update();
+ this->Cutter->Update();
+ this->Edges->Update();
}
//==================================================================
// function:UpdateRepresentation
return;
}
- float *origin = myPlane1->GetOrigin();
- float *normal = myPlane1->GetNormal();
+ float *origin = this->Plane->GetOrigin();
+ float *normal = this->Plane->GetNormal();
float p2[3];
// Setup the plane normal
- float d = this->myOutline->GetOutput()->GetLength();
+ float d = this->Outline->GetOutput()->GetLength();
p2[0] = origin[0] + 0.30 * d * normal[0];
p2[1] = origin[1] + 0.30 * d * normal[1];
this->Sphere->SetCenter(origin);
SphereActor->SetCenter(origin);
- this->myEdgesMapper1->SetInput(this->myEdges1->GetOutput());
+ this->EdgesMapper->SetInput(this->Edges->GetOutput());
}
//==================================================================
// function:SizeHandles
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 ( this->NormalProperty )
+ {
+ os << indent << "Normal Property: " << this->NormalProperty << "\n";
}
- }
- 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]];
- }
+ else
+ {
+ os << indent << "Normal Property: (none)\n";
+ }
+ if ( this->SelectedNormalProperty )
+ {
+ os << indent << "Selected Normal Property: "
+ << this->SelectedNormalProperty << "\n";
+ }
+ else
+ {
+ os << indent << "Selected Normal Property: (none)\n";
+ }
+
+ if ( this->PlaneProperty )
+ {
+ os << indent << "Plane Property: " << this->PlaneProperty << "\n";
+ }
+ else
+ {
+ os << indent << "Plane Property: (none)\n";
+ }
+ if ( this->SelectedPlaneProperty )
+ {
+ os << indent << "Selected Plane Property: "
+ << this->SelectedPlaneProperty << "\n";
+ }
+ else
+ {
+ os << indent << "Selected Plane Property: (none)\n";
+ }
+
+ if ( this->OutlineProperty )
+ {
+ os << indent << "Outline Property: " << this->OutlineProperty << "\n";
+ }
+ else
+ {
+ os << indent << "Outline Property: (none)\n";
+ }
+ if ( this->SelectedOutlineProperty )
+ {
+ os << indent << "Selected Outline Property: "
+ << this->SelectedOutlineProperty << "\n";
+ }
+ else
+ {
+ os << indent << "Selected Outline Property: (none)\n";
+ }
+
+ if ( this->EdgesProperty )
+ {
+ os << indent << "Edges Property: " << this->EdgesProperty << "\n";
+ }
+ else
+ {
+ os << indent << "Edges Property: (none)\n";
+ }
+
+ os << indent << "Normal To X Axis: "
+ << (this->NormalToXAxis ? "On" : "Off") << "\n";
+ os << indent << "Normal To Y Axis: "
+ << (this->NormalToYAxis ? "On" : "Off") << "\n";
+ os << indent << "Normal To Z Axis: "
+ << (this->NormalToZAxis ? "On" : "Off") << "\n";
+
+ os << indent << "Outline Translation: "
+ << (this->OutlineTranslation ? "On" : "Off") << "\n";
+ os << indent << "Draw Plane: " << (this->DrawPlane ? "On" : "Off") << "\n";
}
//==================================================================
-// function: DistanceToPlane
+// function:DistanceToPlane
// purpose :
//==================================================================
float DistanceToPlane(const float x[3],
class vtkImplicitBoolean;
class vtkImplicitFunction;
class VISU_UnScaledActor;
-class vtkDataSet;
class VISU_ImplicitFunctionWidget : public vtkPolyDataSourceWidget
{
// plane interferes with the cut surface it produces producing
// z-buffer artifacts.)
void SetDrawPlane(int plane);
- int GetDrawPlane(){
- return myDrawPlane;
- }
+ vtkGetMacro(DrawPlane,int);
+ vtkBooleanMacro(DrawPlane,int);
// Description:
// Turn on/off the ability to translate the bounding box by grabbing it
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;
-
+ void UpdateRepresentation();
// Flags to handle mouse events
bool HandleMoveEvent;
bool HandleLeftButtonEvent;
bool HandleMiddleButtonEvent;
bool HandleRightButtonEvent;
+
// The actual plane which is being manipulated
- vtkPlane *myPlane1;
+ vtkPlane *Plane;
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;
-
+ vtkImageData *Box;
+ vtkOutlineFilter *Outline;
+ vtkPolyDataMapper *OutlineMapper;
+ vtkActor *OutlineActor;
+ void HighlightOutline(int highlight);
int OutlineTranslation; //whether the outline can be moved
// The cut plane is produced with a vtkCutter
- vtkCutter *myCutter1;
- vtkPolyDataMapper *myCutMapper1;
- vtkActor *myCutActor1;
+ vtkCutter *Cutter;
+ vtkPolyDataMapper *CutMapper;
+ vtkActor *CutActor;
vtkCutter *myCutter2;
vtkPolyDataMapper *myCutMapper2;
vtkActor *myCutActor2;
-
- vtkFeatureEdges *myEdges2;
- vtkPolyDataMapper *myEdgesMapper2;
- vtkActor *myEdgesActor2;
-
- int myDrawPlane;
- vtkFeatureEdges *myEdges1;
- vtkPolyDataMapper *myEdgesMapper1;
- vtkActor *myEdgesActor1;
+ int DrawPlane;
+ void HighlightPlane(int highlight);
+
+ // Optional tubes are represented by extracting boundary edges and tubing
+ vtkFeatureEdges *Edges;
+ //vtkTubeFilter *EdgesTuber;
+ vtkPolyDataMapper *EdgesMapper;
+ vtkActor *EdgesActor;
+ //int Tubing; //control whether tubing is on
// The + normal cone
vtkConeSource *ConeSource;
vtkPolyDataMapper *ConeMapper;
VISU_UnScaledActor *ConeActor;
+ void HighlightNormal(int highlight);
+
// 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;
// Transform the normal (used for rotation)
vtkTransform *Transform;
+
+ // 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);
+
// Properties used to control the appearance of selected objects and
// the manipulator in general.
vtkProperty *NormalProperty;
vtkProperty *SelectedOutlineProperty;
vtkProperty *EdgesProperty;
+ void CreateDefaultProperties();
+
+ void GeneratePlane();
+ virtual void SizeHandles();
+
private:
VISU_ImplicitFunctionWidget(const VISU_ImplicitFunctionWidget&); //Not implemented
void operator=(const VISU_ImplicitFunctionWidget&); //Not implemented
else
cout << "Loading vertex program... failed" << endl << endl;
*/
- free( shader );
+ delete shader;
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
return;
}
+ //cout << "Using OpenGLPointSpriteMapper" << endl;
+
vtkIdType numPts;
vtkPolyData *input= this->GetInput();
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" );
+ PFNGLGENBUFFERSARBPROC glGenBuffersARB = (PFNGLGENBUFFERSARBPROC)dlsym( this->OpenGLLibrary, "glGenBuffersARB" );
+ PFNGLBINDBUFFERARBPROC glBindBufferARB = (PFNGLBINDBUFFERARBPROC)dlsym( this->OpenGLLibrary, "glBindBufferARB" );
+ PFNGLBUFFERDATAARBPROC glBufferDataARB = (PFNGLBUFFERDATAARBPROC)dlsym( this->OpenGLLibrary, "glBufferDataARB" );
#ifdef GL_ARB_shader_objects
PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB =
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
- glDeleteBuffersARB( 1, &aBufferObjectID );
-
#ifdef GL_ARB_shader_objects
glUseProgramObjectARB( 0 );
#endif
void VISU_ScalarBarCtrl::SetMode(const int theMode)
{
myMode=theMode;
- //myScalarBarNumber=myScalarBarNumberMax;
- //if(!myMode){
- // myScalarBarNumber=1;
- //}
+ myScalarBarNumber=myScalarBarNumberMax;
+ if(!myMode){
+ myScalarBarNumber=1;
+ }
}
//==================================================================
// function : GetMode
int i;
//
Update();
- for (i=0; i<myScalarBarNumberMax; ++i){
+ for (i=0; i<myScalarBarNumber; ++i){
theRenderer->AddActor2D(mySBA[i]);
}
}
//==================================================================
void VISU_ScalarBarCtrl::RemoveFromRender(vtkRenderer* theRenderer)
{
- for (int i=0; i<myScalarBarNumberMax; ++i){
+ for (int i=0; i<myScalarBarNumber; ++i){
theRenderer->RemoveActor2D(mySBA[i]);
}
}
protected:
int myMode;
- //int myScalarBarNumber;
+ int myScalarBarNumber;
int myScalarBarNumberMax;
float myDistance, myL, myB, myPosition[2];
float myRangeLocal[2];
VisuGUI_CutLinesDlg.cxx \
VisuGUI_CutPlanesDlg.cxx \
VisuGUI_StreamLinesDlg.cxx \
- VisuGUI_VectorsDlg.cxx \
- VisuGUI_Timer.cxx
+ VisuGUI_VectorsDlg.cxx
LIB_MOC = VisuGUI.h \
VisuGUI_Module.h \
msgid "VisuGUI::MEN_SHRINK"
msgstr "Shrink"
-msgid "VisuGUI::MEN_SHADING"
-msgstr "Shading On"
-
-msgid "VisuGUI::MEN_NOSHADING"
-msgstr "Shading Off"
-
msgid "VisuGUI::MEN_STREAM_LINES"
msgstr "Stream Lines"
msgid "VisuGUI_ScalarBarPane::LBL_Y"
msgstr "Y:"
-msgid "VisuGUI_ScalarBarPane::LBL_SHOW_PREVIEW"
-msgstr "Show preview"
-
msgid "VisuGUI_ScalarBarPane::DIMENSIONS_GRP"
msgstr "Dimensions"
#include "VisuGUI_ActionsDef.h"
-#include "VisuGUI_Timer.h"
-
using namespace VISU;
#ifdef _DEBUG_
VisuGUI::
OnImportFromFile()
{
- VisuGUI_Timer aTimer;
- aTimer.Start();
-
if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
CheckLock(GetCStudy(GetAppStudy(this)));
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
tr("MEN_IMPORT_FROM_FILE"),
true);
if(aFileInfo.exists()) {
- application()->putInfo( "Importing From File " + aFileInfo.filePath() + "...", -1 );
+ application()->putInfo( "Importing From File " + aFileInfo.filePath() + "..." );
VISU::Result_var aResult;
bool anIsBuild = aResourceMgr->booleanValue("VISU", "full_med_loading", false);
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 );
}
}
}
#define VISU_SHRINK 4055
#define VISU_UNSHRINK 4056
-#define VISU_SHADING 4083
-#define VISU_NOSHADING 4084
-
#define VISU_CELL_COLOR 4057
#define VISU_COLOR 4058
#define VISU_EDGE_COLOR 4059
+++ /dev/null
-// 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();
-}
+++ /dev/null
-// 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();
-};
FindActor(SVTK_ViewWindow* theViewWindow,
const char* theEntry)
{
- using namespace SVTK;
+ using namespace VTK;
if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
if(vtkActorCollection* aCollection = aRenderer->GetActors()){
if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
FindActor(TVieweWindow* theViewWindow,
const char* theEntry)
{
- using namespace SVTK;
+ using namespace VTK;
if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){
if(vtkActorCollection* aCollection = aRenderer->GetActors()){
if(VISU_Actor* anActor = Find<VISU_Actor>(aCollection,TIsSameEntry<VISU_Actor>(theEntry))){
$(QWT_LIBS) \
$(BOOST_LIBS) \
-L${KERNEL_ROOT_DIR}/lib/salome \
- -L${GUI_ROOT_DIR}/lib/salome \
- -L${MED_ROOT_DIR}/lib/salome
+ -L${GUI_ROOT_DIR}/lib/salome
LIBS+= -lboost_signals-mt \
-lSalomeHDFPersist \
-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
+LDFLAGSFORBIN=$(LDFLAGS) $(LIBS)
# additional file to be cleaned
MOSTLYCLEAN =
}
}catch(std::exception& exc){
INFOS("Follow exception was occured :\n"<<exc.what());
- throw;
+ return NULL;
}catch(...){
INFOS("Unknown exception was occured!");
- throw;
+ return NULL;
}
if(myAddToStudy)
aStudyBuilder->CommitCommand();
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 NULL;
+ return aPresent;
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))){
- TPrs3d_i* aPresent = new TPrs3d_i(pResult,theAddToStudy);
- try{
- if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)))
- return aPresent;
- }catch(...){
- }
- aPresent->_remove_ref();
+ aPresent = new TPrs3d_i(pResult,theAddToStudy);
+ if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) == NULL)
+ aPresent->_remove_ref();
}
}
- return NULL;
+ return aPresent;
}
template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
if (!CORBA::is_nil(theView3D)) {
VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
- SUIT_ViewWindow* aVW = pView->GetViewWindow();
+ //QAD_StudyFrame* aStudyFrame = pView->GetStudyFrame();
+ //myView = VISU::GetViewFrame(aStudyFrame);
+ SUIT_ViewWindow* aVW = pView->myViewWindow;
myView = VISU::GetViewWindow(aVW);
}
#include "SPlot2d_ViewModel.h"
#include "Plot2d_ViewFrame.h"
+#include "Plot2d_ViewModel.h"
#include "SalomeApp_Application.h"
#include "SalomeApp_Study.h"
struct TSplitEvent: public SALOME_Event
{
SalomeApp_Application * myApplication;
- SUIT_ViewWindow * myVW;
+ SUIT_ViewWindow * myViewWindow;
Qt::Orientation myOrientation;
QtxWorkstack::SplitType mySplitType;
Qt::Orientation theOrientation,
QtxWorkstack::SplitType theSplitType):
myApplication(theApplication),
- myVW(theViewWindow),
+ myViewWindow(theViewWindow),
myOrientation(theOrientation),
mySplitType(theSplitType)
{}
if (tabDesk) {
QtxWorkstack* workstack = tabDesk->workstack();
if (workstack) {
- workstack->Split(myVW, myOrientation, mySplitType);
+ workstack->Split(myViewWindow, myOrientation, mySplitType);
}
}
}
View_i::
SplitRight()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
- Qt::Horizontal, QtxWorkstack::SPLIT_MOVE));
+ ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
+ Qt::Horizontal,QtxWorkstack::SPLIT_MOVE));
}
void
View_i::
SplitLeft()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
- Qt::Horizontal, QtxWorkstack::SPLIT_STAY));
+ ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
+ Qt::Horizontal,QtxWorkstack::SPLIT_STAY));
}
void
View_i::
SplitBottom()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
- Qt::Vertical, QtxWorkstack::SPLIT_MOVE));
+ ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
+ Qt::Vertical,QtxWorkstack::SPLIT_MOVE));
}
void
View_i::
SplitTop()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSplitEvent(myApplication, aVW,
- Qt::Vertical, QtxWorkstack::SPLIT_STAY));
+ ProcessVoidEvent(new TSplitEvent(myApplication,myViewWindow,
+ Qt::Vertical,QtxWorkstack::SPLIT_STAY));
}
void
{
struct TOnTopEvent: public SALOME_Event
{
- SUIT_ViewWindow * myVW;
+ SUIT_ViewWindow * myViewWindow;
public:
TOnTopEvent (SUIT_ViewWindow * theViewWindow):
- myVW(theViewWindow)
+ myViewWindow(theViewWindow)
{}
virtual void Execute()
{
- if (myVW) {
- myVW->setFocus();
+ if (myViewWindow) {
+ myViewWindow->setFocus();
}
}
};
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TOnTopEvent(aVW));
+ ProcessVoidEvent(new TOnTopEvent(myViewWindow));
}
struct TAttractEvent: public SALOME_Event
{
SalomeApp_Application * myApplication;
- SUIT_ViewWindow * myVW1;
- SUIT_ViewWindow * myVW2;
+ SUIT_ViewWindow * myViewWindow1;
+ SUIT_ViewWindow * myViewWindow2;
bool myAttractAll;
public:
SUIT_ViewWindow * theViewWindow2,
bool theAttractAll):
myApplication(theApplication),
- myVW1(theViewWindow1),
- myVW2(theViewWindow2),
+ myViewWindow1(theViewWindow1),
+ myViewWindow2(theViewWindow2),
myAttractAll(theAttractAll)
{}
if (tabDesk) {
QtxWorkstack* workstack = tabDesk->workstack();
if (workstack) {
- workstack->Attract(myVW1, myVW2, myAttractAll);
+ workstack->Attract(myViewWindow1, myViewWindow2, myAttractAll);
}
}
}
{
if (!CORBA::is_nil(theView)) {
if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
- if (pView) {
- SUIT_ViewWindow* aVW1 = GetViewWindow();
- SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
- if (aVW1 && aVW2)
- ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, false));
- }
+ ProcessVoidEvent(new TAttractEvent(myApplication,myViewWindow,pView->myViewWindow,false));
}
}
}
{
if (!CORBA::is_nil(theView)) {
if (VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(theView).in())) {
- if (pView) {
- SUIT_ViewWindow* aVW1 = GetViewWindow();
- SUIT_ViewWindow* aVW2 = pView->GetViewWindow();
- if (aVW1 && aVW2)
- ProcessVoidEvent(new TAttractEvent(myApplication, aVW1, aVW2, true));
- }
+ ProcessVoidEvent(new TAttractEvent(myApplication,myViewWindow,pView->myViewWindow,true));
}
}
}
struct TSizePositionEvent: public SALOME_Event
{
SalomeApp_Application * myApplication;
- SUIT_ViewWindow * myVW;
+ SUIT_ViewWindow * myViewWindow;
double myValue;
bool myIsSize;
double theValue,
bool theIsSize):
myApplication(theApplication),
- myVW(theViewWindow),
+ myViewWindow(theViewWindow),
myValue(theValue),
myIsSize(theIsSize)
{}
QtxWorkstack* workstack = tabDesk->workstack();
if (workstack) {
if (myIsSize) {
- //jfa to do:workstack->SetRelativeSizeInSplitter(myVW, myValue);
+ //jfa to do:workstack->SetRelativeSizeInSplitter(myViewWindow, myValue);
} else {
- workstack->SetRelativePositionInSplitter(myVW, myValue);
+ workstack->SetRelativePositionInSplitter(myViewWindow, myValue);
}
}
}
if (thePosition < 0.0 || 1.0 < thePosition) {
return;
}
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, thePosition, false));
+ ProcessVoidEvent(new TSizePositionEvent(myApplication,myViewWindow,thePosition,false));
}
void
if (theSize < 0.0 || 1.0 < theSize) {
return;
}
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSizePositionEvent(myApplication, aVW, theSize, true));
+ ProcessVoidEvent(new TSizePositionEvent(myApplication,myViewWindow,theSize,true));
}
struct TWSSizePositionEvent: public SALOME_Event
{
SalomeApp_Application * myApplication;
- SUIT_ViewWindow * myVW;
+ SUIT_ViewWindow * myViewWindow;
Qt::Orientation myOrientation;
double myValue;
bool myIsSize;
double theValue,
bool theIsSize):
myApplication(theApplication),
- myVW(theViewWindow),
+ myViewWindow(theViewWindow),
myOrientation(theOrientation),
myValue(theValue),
myIsSize(theIsSize)
QtxWorkstack* workstack = tabDesk->workstack();
if (workstack) {
if (myIsSize) {
- //jfa to do:workstack->SetRelativeSize(myVW, myOrientation, myValue);
+ //jfa to do:workstack->SetRelativeSize(myViewWindow, myOrientation, myValue);
} else {
- workstack->SetRelativePosition(myVW, myOrientation, myValue);
+ workstack->SetRelativePosition(myViewWindow, myOrientation, myValue);
}
}
}
if (thePosition < 0.0 || 1.0 < thePosition) {
return;
}
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
- Qt::Horizontal, thePosition, false));
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
+ Qt::Horizontal,thePosition,false));
}
void
if (thePosition < 0.0 || 1.0 < thePosition) {
return;
}
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
- Qt::Vertical, thePosition, false));
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
+ Qt::Vertical,thePosition,false));
}
void
if (theSize < 0.0 || 1.0 < theSize) {
return;
}
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
- Qt::Horizontal, theSize, true));
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
+ Qt::Horizontal,theSize,true));
}
void
if (theSize < 0.0 || 1.0 < theSize) {
return;
}
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TWSSizePositionEvent(myApplication, aVW,
- Qt::Vertical, theSize, true));
+ ProcessVoidEvent(new TWSSizePositionEvent(myApplication,myViewWindow,
+ Qt::Vertical,theSize,true));
}
// End: New methods for view parameters management
// Begin: Old methods for view parameters management, they don't work now
struct TSetViewSize: public SALOME_Event
{
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
typedef void (QRect::* TAction)(int);
TAction myAction;
CORBA::Long mySize;
TSetViewSize(SUIT_ViewWindow* theViewWindow,
TAction theAction,
CORBA::Long theSize):
- myVW(theViewWindow),
+ myViewWindow(theViewWindow),
myAction(theAction),
mySize(theSize)
{}
void
Execute()
{
- if (QWidget* aParent = myVW->parentWidget(true)) {
+ if (QWidget* aParent = myViewWindow->parentWidget(true)) {
QRect aQRect = aParent->frameGeometry();
(aQRect.*myAction)(mySize);
aParent->setGeometry(aQRect);
struct TGetViewSize: public SALOME_Event
{
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
typedef int (QRect::* TAction)() const;
TAction myAction;
public:
TGetViewSize(SUIT_ViewWindow* theViewWindow,
TAction theAction):
- myVW(theViewWindow),
+ myViewWindow(theViewWindow),
myAction(theAction)
{}
void
Execute()
{
- if(QWidget* aParent = myVW->parentWidget(true)){
+ if(QWidget* aParent = myViewWindow->parentWidget(true)){
QRect aQRect = aParent->frameGeometry();
myResult = (aQRect.*myAction)();
}
class TWorkspaceEvent: public SALOME_Event
{
protected:
- QWidget* myVW;
+ QWidget* myViewWindow;
QWidget* myWorkspace;
public:
TWorkspaceEvent(QWidget* theViewWindow,
QWidget* theWorkspace):
- myVW(theViewWindow),
+ myViewWindow(theViewWindow),
myWorkspace(theWorkspace)
{}
};
void
Execute()
{
- if(QWidget* aParent = myVW->parentWidget(true))
+ if(QWidget* aParent = myViewWindow->parentWidget(true))
SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment);
}
};
void
Execute()
{
- if(QWidget* aParent = myVW->parentWidget(true))
+ if(QWidget* aParent = myViewWindow->parentWidget(true))
aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height()));
}
};
void
Execute()
{
- if(QWidget* aParent = myVW->parentWidget(true))
+ if(QWidget* aParent = myViewWindow->parentWidget(true))
aParent->setGeometry(aParent->x(),
aParent->y(),
int(myX*myWorkspace->width()),
}
};
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TEvent(aVW, theColor));
+ ProcessVoidEvent(new TEvent(myViewWindow,theColor));
}
View_i::
GetBackground()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- return ProcessEvent(new TBackgroundEvent(aVW));
-
- SALOMEDS::Color aBlack;
- aBlack.R = 0.0;
- aBlack.G = 0.0;
- aBlack.B = 0.0;
- return aBlack;
+ return ProcessEvent(new TBackgroundEvent(myViewWindow));
}
void
View_i::
Minimize()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMinimized));
+ ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMinimized));
}
void
View_i::
Restore()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showNormal));
+ ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showNormal));
}
void
View_i::
Maximize()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TFrameActionEvent(aVW, &SUIT_ViewWindow::showMaximized));
+ ProcessVoidEvent(new TFrameActionEvent(myViewWindow,&SUIT_ViewWindow::showMaximized));
}
void
class TSavePictureEvent: public SALOME_Event
{
- SUIT_ViewWindow * myVW;
+ SUIT_ViewWindow * myViewWindow;
const char * myFileName;
public:
typedef CORBA::Boolean TResult;
TResult myResult;
TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
- : myVW(theViewWindow),
+ : myViewWindow(theViewWindow),
myFileName(theFileName),
myResult(false)
{
virtual void Execute()
{
- if (myVW) {
- QImage img = myVW->dumpView();
+ if (myViewWindow) {
+ QImage img = myViewWindow->dumpView();
if (!img.isNull()) {
QString fileName (myFileName);
if (!fileName.isEmpty()) {
if (fmt == "JPG" ) fmt = "JPEG";
//QApplication::setOverrideCursor(Qt::waitCursor);
img.save(fileName, fmt.latin1());
- myResult = true;
//QApplication::restoreOverrideCursor();
}
}
CORBA::Boolean
View_i::SavePicture(const char* theFileName)
{
- return ProcessEvent(new TSavePictureEvent (GetViewWindow(), theFileName));
+ return ProcessEvent(new TSavePictureEvent (myViewWindow,theFileName));
}
const char*
- View_i::GetComment() const
+ View_i::
+ GetComment() const
{
return "";
}
{
}
- SUIT_ViewWindow* View_i::GetViewWindow()
- {
- if (myViewWindow) {
- QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- int aPos = aViews.find(myViewWindow);
- if (aPos < 0)
- myViewWindow = NULL;
- }
- return myViewWindow;
- }
- void View_i::SetViewWindow(SUIT_ViewWindow* theViewWindow)
+ //================= OLD CODE ===================
+
+ //QAD_Study* CheckStudy (SALOMEDS::Study_ptr theStudy)
+ //{
+ // //QAD_Desktop* aDesktop = QAD_Application::getDesktop();
+ // //QAD_Study* aStudy = aDesktop->findStudy(theStudy);
+ // if (!aStudy) {
+ // CORBA::String_var aName = theStudy->Name();
+ // aFileInfo.setFile(aName.in());
+ // if (aFileInfo.exists())
+ // aStudy = aDesktop->loadStudy(aFileInfo.baseName());
+ // else
+ // aStudy = aDesktop->loadStudy(aName.in());
+ // if (!aStudy) {
+ // MESSAGE("CheckStudy()::ERROR: Can't load study");
+ // }
+ // }
+ // return aStudy;
+ //}
+
+ template<class TViewer>
+ struct TNewSpecViewEvent: public SALOME_Event
{
- myViewWindow = theViewWindow;
- }
+ SalomeApp_Application* myApplication;
+ typedef SUIT_ViewManager* TResult;
+ TResult myResult;
+
+ TNewSpecViewEvent (SalomeApp_Application* theApplication):
+ myApplication(theApplication),
+ myResult(NULL)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ myResult = myApplication->getViewManager(TViewer::Type(), false);
+ if (!myResult) {
+ myResult = myApplication->getViewManager(TViewer::Type(), true);
+ myResult->closeAllViews();
+ }
+ }
+ };
//===========================================================================
XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
: View_i(theApplication, NULL)
{
if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
+ if (theApplication) {
+ myViewManager = ProcessEvent(new TNewSpecViewEvent<Plot2d_Viewer>(theApplication));
+ }
}
+
struct TCreatePlot2dViewEvent: public SALOME_Event
{
- XYPlot_i * myPlot2dView;
- int myNew;
+ SUIT_ViewManager* myViewManager;
+ XYPlot_i * myPlot2dView;
+ int myNew;
typedef Plot2d_ViewFrame* TResult;
TResult myResult;
- TCreatePlot2dViewEvent (XYPlot_i * thePlot2dView,
- const int theNew):
+ TCreatePlot2dViewEvent (SUIT_ViewManager* theViewManager,
+ XYPlot_i * thePlot2dView,
+ const int theNew):
+ myViewManager(theViewManager),
myPlot2dView(thePlot2dView),
myNew(theNew),
myResult(NULL)
void
Execute()
{
- if (!myPlot2dView->myApplication)
- return;
-
- SUIT_ViewManager* aViewMgr =
- myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), false);
- SUIT_ViewWindow* aVW = NULL;
-
- if (aViewMgr) {
- if (myNew)
- aVW = aViewMgr->createViewWindow();
- else
- aVW = aViewMgr->getActiveView();
+ if (myNew) {
+ myPlot2dView->myViewWindow = myViewManager->createViewWindow();
} else {
- if (myNew) {
- aViewMgr = myPlot2dView->myApplication->getViewManager(SPlot2d_Viewer::Type(), true);
- aVW = aViewMgr->getActiveView();
- } else {
- return; // there are no current Plot2d view
- }
+ myPlot2dView->myViewWindow = myViewManager->getActiveView();
}
-
- if (aVW) {
- Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(aVW);
+ if (myPlot2dView->myViewWindow) {
+ Plot2d_ViewWindow* aPlot2dVW = dynamic_cast<Plot2d_ViewWindow*>(myPlot2dView->myViewWindow);
if (aPlot2dVW) {
myResult = aPlot2dVW->getViewFrame();
if (myResult) {
myResult->Repaint();
- }
-
- myPlot2dView->myViewManager = aViewMgr;
- myPlot2dView->SetViewWindow(aVW);
- }
+ }
+ }
}
}
};
Storable* XYPlot_i::Create (int theNew)
{
- myView = ProcessEvent(new TCreatePlot2dViewEvent(this, theNew));
- if (myView)
- return this;
- return NULL;
+ myView = ProcessEvent(new TCreatePlot2dViewEvent(myViewManager, this, theNew));
+ return this;
}
void XYPlot_i::Update()
void XYPlot_i::Close()
{
//jfa: may be need to be enclosed in SALOME_Event?
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- aVW->close();
- //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- //int aPos = aViews.find(myViewWindow);
- //if (aPos >= 0)
- // myViewWindow->close();
+ myViewWindow->close();
}
XYPlot_i::~XYPlot_i() {
void XYPlot_i::SetTitle (const char* theTitle)
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
- (aVW, &SUIT_ViewWindow::setCaption, QString(theTitle)));
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
+ (myViewWindow, &SUIT_ViewWindow::setCaption, QString(theTitle)));
}
char* XYPlot_i::GetTitle()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- return CORBA::string_dup(aVW->caption().latin1());
- return CORBA::string_dup("");
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return CORBA::string_dup(myViewWindow->caption().latin1());
}
void XYPlot_i::SetSubTitle (const char* theTitle)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
- (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
+ (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle)));
}
char* XYPlot_i::GetSubTitle()
{
- if (GetViewWindow())
- return CORBA::string_dup(myView->getTitle());
- return CORBA::string_dup("");
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return CORBA::string_dup(myView->getTitle());
}
void XYPlot_i::SetCurveType (VISU::XYPlot::CurveType theType)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
- (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
}
VISU::XYPlot::CurveType XYPlot_i::GetCurveType()
{
- if (GetViewWindow())
- return (VISU::XYPlot::CurveType)myView->getCurveType();
- return VISU::XYPlot::POINTS;
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return (VISU::XYPlot::CurveType)myView->getCurveType();
}
void XYPlot_i::SetMarkerSize (CORBA::Long theSize)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
- (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
}
CORBA::Long XYPlot_i::GetMarkerSize()
{
- if (GetViewWindow())
- return myView->getMarkerSize();
- return -1;
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return myView->getMarkerSize();
}
class TEnableGridEvent: public SALOME_Event
protected:
Plot2d_ViewFrame* myView;
TFun myFun;
- CORBA::Boolean myMajor, myMinor;
- CORBA::Long myNumMajor, myNumMinor;
+ CORBA::Boolean myMajor, myNumMajor;
+ CORBA::Boolean myMinor, myNumMinor;
};
void XYPlot_i::EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
CORBA::Boolean theMinor, CORBA::Long theNumMinor)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
- theMajor,theNumMajor,theMinor,theNumMinor));
+ ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
+ theMajor,theNumMajor,theMinor,theNumMinor));
}
void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
CORBA::Boolean theMinor, CORBA::Long theNumMinor)
{
- //asl: Plot2d_ViewFrame::setYGrid has more parameters
- //if (GetViewWindow())
- // ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
- // theMajor,theNumMajor,theMinor,theNumMinor));
+ //jfa tmp:ProcessVoidEvent(new TEnableGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
+ //jfa tmp: theMajor,theNumMajor,theMinor,theNumMinor));
}
class TSetScaleModeEvent: public SALOME_Event
void XYPlot_i::SetHorScaling (VISU::Scaling theScaling)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
- theScaling == VISU::LOGARITHMIC));
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
+ theScaling == VISU::LOGARITHMIC));
}
VISU::Scaling XYPlot_i::GetHorScaling()
{
//jfa: may be need to be enclosed in SALOME_Event?
- if (GetViewWindow())
- return (VISU::Scaling)myView->getHorScaleMode();
- return VISU::LINEAR;
+ return (VISU::Scaling)myView->getHorScaleMode();
}
void XYPlot_i::SetVerScaling(VISU::Scaling theScaling)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
- theScaling == VISU::LOGARITHMIC));
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
+ theScaling == VISU::LOGARITHMIC));
}
VISU::Scaling XYPlot_i::GetVerScaling()
{
- if (GetViewWindow())
- return (VISU::Scaling)myView->getVerScaleMode();
- return VISU::LINEAR;
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return (VISU::Scaling)myView->getVerScaleMode();
}
class TSetTitleEvent: public SALOME_Event
void XYPlot_i::SetXTitle (const char* theTitle)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
+ ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::XTitle, theTitle));
}
char* XYPlot_i::GetXTitle()
{
- if (GetViewWindow())
- return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
- return CORBA::string_dup("");
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::XTitle));
}
void XYPlot_i::SetYTitle (const char* theTitle)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
+ ProcessVoidEvent(new TSetTitleEvent(myView, Plot2d_ViewFrame::YTitle, theTitle));
}
char* XYPlot_i::GetYTitle()
{
- if (GetViewWindow())
- return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
- return CORBA::string_dup("");
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return CORBA::string_dup(myView->getTitle(Plot2d_ViewFrame::YTitle));
}
void XYPlot_i::ShowLegend (CORBA::Boolean theShowing)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
- (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
+ ProcessVoidEvent(new TVoidMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
+ (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
}
class TXYPlotViewEvent: public SALOME_Event
void XYPlot_i::Display (PrsObject_ptr thePrsObj)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
+ ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplay));
}
void XYPlot_i::Erase (PrsObject_ptr thePrsObj)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
+ ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eErase));
}
void XYPlot_i::DisplayOnly (PrsObject_ptr thePrsObj)
{
- if (GetViewWindow())
- ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
+ ProcessVoidEvent(new TXYPlotViewEvent (myApplication,myView,thePrsObj,eDisplayOnly));
}
void XYPlot_i::EraseAll()
{
- if (GetViewWindow())
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::EraseAll));
}
void XYPlot_i::FitAll()
{
- if (GetViewWindow())
- ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
- }
-
- class TFitRangeEvent: public SALOME_Event
- {
- public:
- TFitRangeEvent (Plot2d_ViewFrame* theView,
- const int mode,
- const double xMin, const double xMax,
- const double yMin, const double yMax):
- myView(theView),
- myMode(mode),
- myXMin(xMin),myXMax(xMax),
- myYMin(yMin),myYMax(yMax)
- {}
- virtual void Execute()
- {
- myView->fitData(myMode,myXMin,myXMax,myYMin,myYMax);
- }
- protected:
- const int myMode;
- const double myXMin;
- const double myXMax;
- const double myYMin;
- const double myYMax;
- Plot2d_ViewFrame* myView;
- };
-
- void XYPlot_i::FitXRange(const CORBA::Double xMin,const CORBA::Double xMax)
- {
- const CORBA::Long mode = 1;
- const CORBA::Double yMin = 0.0;
- const CORBA::Double yMax = 0.0;
- ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
+ ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
}
- void XYPlot_i::FitYRange(const CORBA::Double yMin,const CORBA::Double yMax)
- {
- const CORBA::Long mode = 2;
- const CORBA::Double xMin = 0.0;
- const CORBA::Double xMax = 0.0;
- ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
- }
-
- void XYPlot_i::FitRange(const CORBA::Double xMin,const CORBA::Double xMax,
- const CORBA::Double yMin,const CORBA::Double yMax)
- {
- const CORBA::Long mode = 0;
- ProcessVoidEvent(new TFitRangeEvent(myView,mode,xMin,xMax,yMin,yMax));
- }
-
- void XYPlot_i::GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax)
- {
- double y2Min,y2Max;
- myView->getFitRanges(xMin,xMax,yMin,yMax,y2Min,y2Max);
- }
//===========================================================================
TableView_i::TableView_i (SalomeApp_Application* theApplication)
: View_i(theApplication, NULL)
{
if (MYDEBUG) MESSAGE("View3D_i::View3D_i");
+ if (theApplication) {
+ myViewManager = ProcessEvent(new TNewSpecViewEvent<SVTK_Viewer>(theApplication));
+ }
}
struct TCreateView3dEvent: public SALOME_Event
{
- View3D_i * myView3D;
- int myNew;
+ SUIT_ViewManager* myViewManager;
+ int myNew;
typedef SUIT_ViewWindow* TResult;
TResult myResult;
- TCreateView3dEvent (View3D_i * theView3D,
- const int theNew):
- myView3D(theView3D),
+ TCreateView3dEvent (SUIT_ViewManager* theViewManager,
+ const int theNew):
+ myViewManager(theViewManager),
myNew(theNew),
myResult(NULL)
{}
void
Execute()
{
- if (!myView3D->myApplication)
- return;
-
- SUIT_ViewManager * aViewMgr =
- myView3D->myApplication->getViewManager(SVTK_Viewer::Type(), false);
-
- if (aViewMgr) {
- if (myNew) {
- myResult = aViewMgr->createViewWindow();
- } else {
- myResult = aViewMgr->getActiveView();
- }
+ if (myNew) {
+ myResult = myViewManager->createViewWindow();
} else {
- if (myNew) {
- aViewMgr = myView3D->myApplication->getViewManager(SVTK_Viewer::Type(), true);
- myResult = aViewMgr->getActiveView();
- } else {
- return; // there are no current 3D view
- }
+ myResult = myViewManager->getActiveView();
}
-
- myView3D->myViewManager = aViewMgr;
}
};
Storable* View3D_i::Create (int theNew)
{
if (MYDEBUG) MESSAGE("View3D_i::Create");
- SUIT_ViewWindow* aVW = ProcessEvent(new TCreateView3dEvent(this, theNew));
- if (aVW) {
- SetViewWindow(aVW);
- return this;
- }
- return NULL;
+ myViewWindow = ProcessEvent(new TCreateView3dEvent(myViewManager, theNew));
+ return this;
}
void View3D_i::Update()
{
class TEvent: public SALOME_Event
{
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
public:
- TEvent(SUIT_ViewWindow* theViewWindow):
- myVW(theViewWindow)
+ TEvent(SUIT_ViewWindow* theStudyFrame):
+ myViewWindow(theStudyFrame)
{}
virtual void Execute()
{
- SVTK_ViewWindow* vf = VISU::GetViewWindow(myVW);
+ SVTK_ViewWindow* vf = GetViewWindow(myViewWindow);
vtkRenderer* Renderer = vf->getRenderer();
vtkActorCollection* theActors = Renderer->GetActors();
theActors->InitTraversal();
}
}
}
- RepaintView(myVW);
+ RepaintView(myViewWindow);
}
};
-
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TEvent(aVW));
+ ProcessVoidEvent(new TEvent(myViewWindow));
}
bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
{
MESSAGE("View3D_i::SaveViewParams()");
-
- if (!theViewManager || !theName)
- return false;
-
_PTR(Study) aCStudy;
if (SUIT_Study* aSStudy = theViewManager->study()) {
if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
if (!aCStudy)
return false;
- if (strcmp(theName, "") != 0) {
+ if (theName) {
std::vector<_PTR(SObject)> aList = aCStudy->FindObjectByName(theName, "VISU");
_PTR(GenericAttribute) anAttr;
int iEnd = aList.size();
class TSaveViewParamsEvent: public SALOME_Event
{
- SUIT_ViewManager* myViewMgr;
+ SUIT_ViewManager* myViewManager;
const char* myName;
public:
TSaveViewParamsEvent (SUIT_ViewManager* theViewManager,
const char* theName):
- myViewMgr(theViewManager),
+ myViewManager(theViewManager),
myName(theName)
{}
virtual void Execute()
{
- myResult = View3D_i::SaveViewParams(myViewMgr, myName);
+ myResult = View3D_i::SaveViewParams(myViewManager, myName);
}
typedef CORBA::Boolean TResult;
TResult myResult;
class TRestoreViewParamsEvent: public SALOME_Event
{
- SUIT_ViewManager* myViewMgr;
+ SUIT_ViewManager* myViewManager;
const char* myName;
public:
TRestoreViewParamsEvent (SUIT_ViewManager* theViewManager,
const char* theName):
- myViewMgr(theViewManager),
+ myViewManager(theViewManager),
myName(theName)
{}
virtual void Execute()
{
- myResult = View3D_i::RestoreViewParams(myViewMgr, myName);
+ myResult = View3D_i::RestoreViewParams(myViewManager, myName);
}
typedef CORBA::Boolean TResult;
TResult myResult;
return ProcessEvent(new TRestoreViewParamsEvent (myViewManager, theName));
}
- void View3D_i::Restore (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::Restore (SUIT_ViewWindow* theStudyFrame,
const Storable::TRestoringMap& theMap)
{
SALOMEDS::Color aColor;
aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
- SetBackground(theViewWindow,aColor);
- SetPointOfView(theViewWindow,aPosition);
- SetViewUp(theViewWindow,aViewUp);
- SetFocalPoint(theViewWindow,aFocalPnt);
- SetParallelScale(theViewWindow,aParallelScale);
- ScaleView(theViewWindow,VISU::View3D::XAxis,aScaleFactor[0]);
- ScaleView(theViewWindow,VISU::View3D::YAxis,aScaleFactor[1]);
- ScaleView(theViewWindow,VISU::View3D::ZAxis,aScaleFactor[2]);
+ SetBackground(theStudyFrame,aColor);
+ SetPointOfView(theStudyFrame,aPosition);
+ SetViewUp(theStudyFrame,aViewUp);
+ SetFocalPoint(theStudyFrame,aFocalPnt);
+ SetParallelScale(theStudyFrame,aParallelScale);
+ ScaleView(theStudyFrame,VISU::View3D::XAxis,aScaleFactor[0]);
+ ScaleView(theStudyFrame,VISU::View3D::YAxis,aScaleFactor[1]);
+ ScaleView(theStudyFrame,VISU::View3D::ZAxis,aScaleFactor[2]);
}
- string View3D_i::ToString (SUIT_ViewWindow* theViewWindow)
+ string View3D_i::ToString (SUIT_ViewWindow* theStudyFrame)
{
ostringstream strOut;
- Storable::DataToStream(strOut, "myComment", myComment.c_str());
- ToStream(theViewWindow, strOut);
- strOut << ends;
- if(MYDEBUG) MESSAGE("View3D_i::ToString - " << strOut.str());
+ Storable::DataToStream( strOut, "myComment", myComment.c_str() );
+ ToStream(theStudyFrame,strOut);
+ strOut<<ends;
+ if(MYDEBUG) MESSAGE("View3D_i::ToString - "<<strOut.str());
return strOut.str();
}
- void View3D_i::ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr)
+ void View3D_i::ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr)
{
Storable::DataToStream(theStr,"myType",VISU::TVIEW3D);
float backint[3];
- GetRenderer(theViewWindow)->GetBackground(backint);
+ GetRenderer(theStudyFrame)->GetBackground(backint);
Storable::DataToStream(theStr,"myColor.R",backint[0]);
Storable::DataToStream(theStr,"myColor.G",backint[1]);
Storable::DataToStream(theStr,"myColor.B",backint[2]);
double aPosition[3];
- GetPointOfView(theViewWindow,aPosition);
+ GetPointOfView(theStudyFrame,aPosition);
Storable::DataToStream(theStr,"myPosition[0]",aPosition[0]);
Storable::DataToStream(theStr,"myPosition[1]",aPosition[1]);
Storable::DataToStream(theStr,"myPosition[2]",aPosition[2]);
double aFocalPnt[3];
- GetFocalPoint(theViewWindow,aFocalPnt);
+ GetFocalPoint(theStudyFrame,aFocalPnt);
Storable::DataToStream(theStr,"myFocalPnt[0]",aFocalPnt[0]);
Storable::DataToStream(theStr,"myFocalPnt[1]",aFocalPnt[1]);
Storable::DataToStream(theStr,"myFocalPnt[2]",aFocalPnt[2]);
double aViewUp[3];
- GetCamera(theViewWindow)->GetViewUp(aViewUp);
+ GetCamera(theStudyFrame)->GetViewUp(aViewUp);
Storable::DataToStream(theStr,"myViewUp[0]",aViewUp[0]);
Storable::DataToStream(theStr,"myViewUp[1]",aViewUp[1]);
Storable::DataToStream(theStr,"myViewUp[2]",aViewUp[2]);
- Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow));
+ Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theStudyFrame));
double aScaleFactor[3];
- VISU::GetViewWindow(theViewWindow)->GetScale(aScaleFactor);
+ GetViewWindow(theStudyFrame)->GetScale(aScaleFactor);
Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]);
Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]);
Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]);
void View3D_i::ToStream(std::ostringstream& theStr)
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ToStream(aVW, theStr);
+ ToStream(myViewWindow,theStr);
}
void View3D_i::Close()
{
//jfa: may be need to be enclosed in SALOME_Event?
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- aVW->close();
- //QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
- //int aPos = aViews.find(myViewWindow);
- //if (aPos >= 0)
- // myViewWindow->close();
+ myViewWindow->close();
}
View3D_i::~View3D_i()
void View3D_i::SetTitle (const char* theTitle)
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
- (aVW,&SUIT_ViewWindow::setCaption,QString(theTitle)));
+ ProcessVoidEvent(new TVoidMemFun1ArgEvent<SUIT_ViewWindow,const QString&,QString>
+ (myViewWindow,&SUIT_ViewWindow::setCaption,QString(theTitle)));
}
char* View3D_i::GetTitle()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- return CORBA::string_dup(aVW->caption().latin1());
- return CORBA::string_dup("");
+ //jfa: may be need to be enclosed in SALOME_Event?
+ return CORBA::string_dup(myViewWindow->caption().latin1());
}
- void View3D_i::SetBackground (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::SetBackground (SUIT_ViewWindow* theStudyFrame,
const SALOMEDS::Color& theColor)
{
//jfa: may be need to be enclosed in SALOME_Event?
aColor[0] = int(255.0*theColor.R);
aColor[1] = int(255.0*theColor.G);
aColor[2] = int(255.0*theColor.B);
- QColor aNewColor (aColor[0],aColor[1],aColor[2]);
- VISU::GetViewWindow(theViewWindow)->setBackgroundColor(aNewColor);
+ QColor aNewColor(aColor[0],aColor[1],aColor[2]);
+ GetViewWindow(theStudyFrame)->setBackgroundColor(aNewColor);
}
- SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow)
+ SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theStudyFrame)
{
+ //jfa: may be need to be enclosed in SALOME_Event?
SALOMEDS::Color aColor;
float backint[3];
- GetRenderer(theViewWindow)->GetBackground(backint);
+ GetRenderer(theStudyFrame)->GetBackground(backint);
aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2];
return aColor;
}
class TUpdateViewerEvent: public SALOME_Event
{
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
Prs3d_i* myPrs3d;
int myDisplaing;
public:
- TUpdateViewerEvent(SUIT_ViewWindow* theViewWindow,
+ TUpdateViewerEvent(SUIT_ViewWindow* theStudyFrame,
Prs3d_i* thePrs3d,
int theDisplaing):
- myVW(theViewWindow),
+ myViewWindow(theStudyFrame),
myPrs3d(thePrs3d),
myDisplaing(theDisplaing)
{}
virtual void Execute(){
- UpdateViewer(myVW, myDisplaing, myPrs3d);
+ UpdateViewer(myViewWindow,myDisplaing,myPrs3d);
}
};
void View3D_i::EraseAll()
{
if(MYDEBUG) MESSAGE("View3D_i::EraseAll");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eEraseAll));
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eEraseAll));
}
void View3D_i::DisplayAll()
{
if(MYDEBUG) MESSAGE("View3D_i::DisplayAll");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TUpdateViewerEvent(aVW,NULL,eDisplayAll));
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,NULL,eDisplayAll));
}
void View3D_i::Erase (PrsObject_ptr thePrsObj)
{
if(MYDEBUG) MESSAGE("View3D_i::Erase");
- SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
- if (aVW && aPrs)
- ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eErase));
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eErase));
+ }
}
void View3D_i::Display (PrsObject_ptr thePrsObj)
{
if(MYDEBUG) MESSAGE("View3D_i::Display");
- SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
- if (aVW && aPrs)
- ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay));
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplay));
+ }
}
void View3D_i::DisplayOnly (PrsObject_ptr thePrsObj)
{
if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
- SUIT_ViewWindow* aVW = GetViewWindow();
CORBA::Object_ptr anObj = thePrsObj;
- Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in());
- if (aVW && aPrs)
- ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly));
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in())){
+ ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplayOnly));
+ }
}
void View3D_i::FitAll()
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW) {
- ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll));
- Update();
- }
+ ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
+ (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFitAll));
+ Update();
}
void View3D_i::SetView (VISU::View3D::ViewType theType)
{
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (!aVW)
- return;
-
switch (theType) {
case VISU::View3D::FRONT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView));
+ (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFrontView));
break;
case VISU::View3D::BACK :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView));
+ (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onBackView));
break;
case VISU::View3D::LEFT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView));
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onLeftView));
break;
case VISU::View3D::RIGHT :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView));
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onRightView));
break;
case VISU::View3D::TOP :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView));
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onTopView));
break;
case VISU::View3D::BOTTOM :
ProcessVoidEvent(new TVoidMemFunEvent<SVTK_ViewWindow>
- (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView));
+ (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onBottomView));
break;
}
Update();
class TSet3DViewParamEvent: public SALOME_Event
{
public:
- typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, const CORBA::Double theParam[3]);
+ typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, const CORBA::Double theParam[3]);
TSet3DViewParamEvent (TFun theFun,
- SUIT_ViewWindow* theViewWindow,
+ SUIT_ViewWindow* theStudyFrame,
const CORBA::Double theParam[3]):
myFun(theFun),
- myVW(theViewWindow),
+ myViewWindow(theStudyFrame),
myParam(theParam)
{}
- virtual void Execute() {
- myFun(myVW,myParam);
+ virtual void Execute(){
+ myFun(myViewWindow,myParam);
}
private:
TFun myFun;
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
const CORBA::Double* myParam;
};
- void View3D_i::SetPointOfView (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::SetPointOfView (SUIT_ViewWindow* theStudyFrame,
const CORBA::Double thePosition[3])
{
//jfa: may be need to be enclosed in SALOME_Event?
- GetCamera(theViewWindow)->SetPosition(thePosition);
+ GetCamera(theStudyFrame)->SetPosition(thePosition);
}
void View3D_i::SetPointOfView (const VISU::View3D::XYZ thePosition)
{
if(MYDEBUG) MESSAGE("View3D_i::SetPointOfView");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,aVW,thePosition));
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetPointOfView,myViewWindow,thePosition));
}
- void View3D_i::GetPointOfView (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::GetPointOfView (SUIT_ViewWindow* theStudyFrame,
CORBA::Double thePosition[3])
{
- GetCamera(theViewWindow)->GetPosition(thePosition);
+ //jfa: may be need to be enclosed in SALOME_Event?
+ GetCamera(theStudyFrame)->GetPosition(thePosition);
}
VISU::View3D::XYZ_slice* View3D_i::GetPointOfView()
{
+ //jfa: may be need to be enclosed in SALOME_Event?
if(MYDEBUG) MESSAGE("View3D_i::GetPointOfView");
CORBA::Double aPosition[3];
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- GetPointOfView(aVW,aPosition);
+ GetPointOfView(myViewWindow,aPosition);
return VISU::View3D::XYZ_dup(aPosition);
}
- void View3D_i::SetViewUp (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::SetViewUp (SUIT_ViewWindow* theStudyFrame,
const CORBA::Double theViewUp[3])
{
- GetCamera(theViewWindow)->SetViewUp(theViewUp);
+ GetCamera(theStudyFrame)->SetViewUp(theViewUp);
}
void View3D_i::SetViewUp (const VISU::View3D::XYZ theViewUp)
{
if(MYDEBUG) MESSAGE("View3D_i::SetViewUp");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,aVW,theViewUp));
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetViewUp,myViewWindow,theViewUp));
}
- void View3D_i::GetViewUp (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::GetViewUp (SUIT_ViewWindow* theStudyFrame,
CORBA::Double theViewUp[3])
{
- GetCamera(theViewWindow)->GetViewUp(theViewUp);
+ GetCamera(theStudyFrame)->GetViewUp(theViewUp);
}
VISU::View3D::XYZ_slice* View3D_i::GetViewUp()
{
+ //jfa: may be need to be enclosed in SALOME_Event?
if(MYDEBUG) MESSAGE("View3D_i::GetViewUp");
CORBA::Double aViewUp[3];
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- GetCamera(aVW)->GetViewUp(aViewUp);
+ GetCamera(myViewWindow)->GetViewUp(aViewUp);
return VISU::View3D::XYZ_dup(aViewUp);
}
- void View3D_i::SetFocalPoint (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::SetFocalPoint (SUIT_ViewWindow* theStudyFrame,
const CORBA::Double theFocalPnt[3])
{
- GetCamera(theViewWindow)->SetFocalPoint(theFocalPnt);
+ GetCamera(theStudyFrame)->SetFocalPoint(theFocalPnt);
}
void View3D_i::SetFocalPoint (const VISU::View3D::XYZ theCoord)
{
if(MYDEBUG) MESSAGE("View3D_i::SetFocalPoint");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,aVW,theCoord));
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetFocalPoint,myViewWindow,theCoord));
}
- void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame,
CORBA::Double theFocalPnt[3])
{
- GetCamera(theViewWindow)->GetFocalPoint(theFocalPnt);
+ GetCamera(theStudyFrame)->GetFocalPoint(theFocalPnt);
}
VISU::View3D::XYZ_slice* View3D_i::GetFocalPoint()
{
+ //jfa: may be need to be enclosed in SALOME_Event?
if(MYDEBUG) MESSAGE("View3D_i::GetFocalPoint");
CORBA::Double aFocalPnt[3];
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- GetFocalPoint(aVW,aFocalPnt);
+ GetFocalPoint(myViewWindow,aFocalPnt);
return VISU::View3D::XYZ_dup(aFocalPnt);
}
class TSetViewParamEvent: public SALOME_Event
{
public:
- typedef void (*TFun)(SUIT_ViewWindow* theViewWindow, CORBA::Double theParam);
+ typedef void (*TFun)(SUIT_ViewWindow* theStudyFrame, CORBA::Double theParam);
TSetViewParamEvent (TFun theFun,
- SUIT_ViewWindow* theViewWindow,
+ SUIT_ViewWindow* theStudyFrame,
CORBA::Double theParam):
myFun(theFun),
- myVW(theViewWindow),
+ myViewWindow(theStudyFrame),
myParam(theParam)
{}
virtual void Execute()
{
- myFun(myVW,myParam);
+ myFun(myViewWindow,myParam);
}
private:
TFun myFun;
- SUIT_ViewWindow* myVW;
+ SUIT_ViewWindow* myViewWindow;
CORBA::Double myParam;
};
- void View3D_i::SetParallelScale (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::SetParallelScale (SUIT_ViewWindow* theStudyFrame,
CORBA::Double theScale)
{
- GetCamera(theViewWindow)->SetParallelScale(theScale);
+ GetCamera(theStudyFrame)->SetParallelScale(theScale);
}
void View3D_i::SetParallelScale (CORBA::Double theScale)
{
if(MYDEBUG) MESSAGE("View3D_i::SetParallelScale");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,aVW,theScale));
+ ProcessVoidEvent(new TSetViewParamEvent(&SetParallelScale,myViewWindow,theScale));
}
- CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theViewWindow)
+ CORBA::Double View3D_i::GetParallelScale (SUIT_ViewWindow* theStudyFrame)
{
- return GetCamera(theViewWindow)->GetParallelScale();
+ return GetCamera(theStudyFrame)->GetParallelScale();
}
CORBA::Double View3D_i::GetParallelScale()
{
+ //jfa: may be need to be enclosed in SALOME_Event?
if(MYDEBUG) MESSAGE("View3D_i::GetParallelScale");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW)
- return GetParallelScale(aVW);
- return 1.0;
+ return GetParallelScale(myViewWindow);
}
- void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow,
+ void View3D_i::ScaleView (SUIT_ViewWindow* theStudyFrame,
VISU::View3D::Axis theAxis, CORBA::Double theParam)
{
- SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow);
+ SVTK_ViewWindow* aViewFrame = GetViewWindow(theStudyFrame);
double aScaleFactor[3];
- aViewWindow->GetScale(aScaleFactor);
+ aViewFrame->GetScale(aScaleFactor);
aScaleFactor[theAxis] = theParam;
- aViewWindow->SetScale(aScaleFactor);
+ aViewFrame->SetScale(aScaleFactor);
}
- void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3])
+ void SetScaleView (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theScale[3])
{
double aScale[3] = {theScale[0], theScale[1], theScale[2]};
- VISU::GetViewWindow(theViewWindow)->SetScale(aScale);
+ GetViewWindow(theStudyFrame)->SetScale(aScale);
}
void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam)
{
if(MYDEBUG) MESSAGE("View3D_i::ScaleView");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW) {
- double aScale[3];
- VISU::GetViewWindow(aVW)->GetScale(aScale);
- aScale[theAxis] = theParam;
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
- }
+ double aScale[3];
+ GetViewWindow(myViewWindow)->GetScale(aScale);
+ aScale[theAxis] = theParam;
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
}
void View3D_i::RemoveScale()
{
if(MYDEBUG) MESSAGE("View3D_i::RemoveScale");
- SUIT_ViewWindow* aVW = GetViewWindow();
- if (aVW) {
- double aScale[3] = {1.0, 1.0, 1.0};
- ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale));
- }
+ double aScale[3] = {1.0, 1.0, 1.0};
+ ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,myViewWindow,aScale));
}
}
public virtual Storable
{
public:
+ QWidget *myWorkspace;
+ SUIT_ViewWindow *myViewWindow;
+
+ protected:
+ SalomeApp_Application *myApplication;
+ SUIT_ViewManager *myViewManager;
+
View_i (SalomeApp_Application *theApplication,
- SUIT_ViewManager* theViewManager);
+ SUIT_ViewManager* theViewManager);
virtual ~View_i();
public:
virtual void Close() = 0;
virtual void ToStream(std::ostringstream& theStr);
virtual const char* GetComment() const;
-
- SUIT_ViewWindow* GetViewWindow();
- void SetViewWindow(SUIT_ViewWindow* theViewWindow);
-
- public:
- QWidget *myWorkspace;
-
- SalomeApp_Application *myApplication;
- SUIT_ViewManager *myViewManager;
-
- private:
- SUIT_ViewWindow *myViewWindow;
};
virtual CORBA::Long GetMarkerSize();
virtual void EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor);
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor);
virtual void EnableYGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor);
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor);
virtual void SetHorScaling (VISU::Scaling theScaling);
virtual VISU::Scaling GetHorScaling();
virtual void Update();
virtual void FitAll();
- virtual void FitXRange(const CORBA::Double xMin,const CORBA::Double xMax);
- virtual void FitYRange(const CORBA::Double yMin,const CORBA::Double yMax);
- virtual void FitRange(const CORBA::Double xMin,const CORBA::Double xMax,
- const CORBA::Double yMin,const CORBA::Double yMax);
- virtual void GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax);
virtual void Close();
protected:
virtual void SetTitle (const char* theTitle);
virtual char* GetTitle();
- static void SetBackground (SUIT_ViewWindow* theViewWindow,
+ static void SetBackground (SUIT_ViewWindow* theStudyFrame,
const SALOMEDS::Color& theColor);
- static SALOMEDS::Color GetBackground (SUIT_ViewWindow* theViewWindow);
+ static SALOMEDS::Color GetBackground (SUIT_ViewWindow* theStudyFrame);
virtual void EraseAll();
virtual void DisplayAll();
virtual void FitAll();
virtual void SetView (VISU::View3D::ViewType theType);
- static void SetPointOfView (SUIT_ViewWindow* theViewWindow,
- const CORBA::Double thePosition[3]);
+ static void SetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double thePosition[3]);
virtual void SetPointOfView (const VISU::View3D::XYZ theCoord);
- static void GetPointOfView (SUIT_ViewWindow* theViewWindow,
- CORBA::Double thePosition[3]);
+ static void GetPointOfView (SUIT_ViewWindow* theStudyFrame,
+ CORBA::Double thePosition[3]);
virtual VISU::View3D::XYZ_slice* GetPointOfView();
- static void SetViewUp (SUIT_ViewWindow* theViewWindow,
- const CORBA::Double theViewUp[3]);
+ static void SetViewUp (SUIT_ViewWindow* theStudyFrame,
+ const CORBA::Double theViewUp[3]);
virtual void SetViewUp (const VISU::View3D::XYZ theDir);
- static void GetViewUp (SUIT_ViewWindow* theViewWindow, CORBA::Double theViewUp[3]);
+ static void GetViewUp (SUIT_ViewWindow* theStudyFrame, CORBA::Double theViewUp[3]);
virtual VISU::View3D::XYZ_slice* GetViewUp();
- static void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]);
+ static void SetFocalPoint (SUIT_ViewWindow* theStudyFrame, const CORBA::Double theFocalPnt[3]);
virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord);
- static void View3D_i::GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]);
+ static void View3D_i::GetFocalPoint (SUIT_ViewWindow* theStudyFrame, CORBA::Double theFocalPnt[3]);
virtual VISU::View3D::XYZ_slice* GetFocalPoint();
- static void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale);
+ static void SetParallelScale (SUIT_ViewWindow* theStudyFrame, CORBA::Double theScale);
virtual void SetParallelScale (CORBA::Double theScale);
- static CORBA::Double GetParallelScale (SUIT_ViewWindow* theViewWindow);
+ static CORBA::Double GetParallelScale (SUIT_ViewWindow* theStudyFrame);
virtual CORBA::Double GetParallelScale ();
- static void ScaleView (SUIT_ViewWindow* theViewWindow,
- VISU::View3D::Axis theAxis, CORBA::Double theParam);
+ static void ScaleView (SUIT_ViewWindow* theStudyFrame,
+ VISU::View3D::Axis theAxis, CORBA::Double theParam);
virtual void ScaleView (VISU::View3D::Axis theAxis, CORBA::Double theParam);
virtual void RemoveScale();
- static std::string ToString (SUIT_ViewWindow* theViewWindow);
+ static std::string ToString (SUIT_ViewWindow* theStudyFrame);
- static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr);
+ static void ToStream (SUIT_ViewWindow* theStudyFrame, std::ostringstream& theStr);
static bool SaveViewParams (SUIT_ViewManager* theViewManager,
- const char* theName);
+ const char* theName);
virtual CORBA::Boolean SaveViewParams (const char* theName);
static bool RestoreViewParams (SUIT_ViewManager* theViewManager,
- const char* theName);
+ const char* theName);
virtual CORBA::Boolean RestoreViewParams (const char* theName);
static QString GenerateViewParamsName();
- static void Restore (SUIT_ViewWindow* theViewWindow,
- const Storable::TRestoringMap& theMap);
+ static void Restore (SUIT_ViewWindow* theStudyFrame,
+ const Storable::TRestoringMap& theMap);
virtual void Close();
+++ /dev/null
-# T 2.23, 28: Displaying fields (scalar and vectorial) on nodes, change presentation options.
-# Uses MED files ResOK_0000.med and Fields_group3D.med
-#
-# This script is equivalent to non-regression test script 003/A1
-
-import salome
-import visu_gui
-import SALOMEDS
-import VISU
-import os
-
-datadir = os.getenv("DATA_DIR") + "/MedFiles/"
-
-#%====================Stage1: Creating a new study====================%
-
-print "**** Stage1: Creating a new study"
-
-print "Creating a new study..................",
-myVisu = visu_gui.myVisu
-myVisu.SetCurrentStudy(salome.myStudy)
-myViewManager = myVisu.GetViewManager()
-if myViewManager is None : print "Error"
-else : print "OK"
-
-#%====================Stage2: Importing MED file====================%
-
-print "**** Stage2: Importing MED file"
-
-print 'Import "ResOK_0000.med"...............',
-medFile = datadir + "ResOK_0000.med"
-myResult = myVisu.ImportFile(medFile)
-if myResult is None : print "Error"
-else : print "OK"
-
-print 'Creating new View3D...................',
-myView = myViewManager.Create3DView()
-if myView is None : print "Error"
-else : print "OK"
-
-myMeshName = 'dom'
-myCellEntity = VISU.CELL
-myNodeEntity = VISU.NODE
-
-#%====================Stage3: Displaying vector field====================%
-
-print "**** Stage3: Displaying vector field"
-
-print "Creating Scalar Map.......",
-scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
-if scalarmap is None : print "Error"
-else : print "OK"
-scalarmap.SetSize(0.15, 0.8)
-myView.DisplayOnly(scalarmap)
-myView.FitAll()
-
-print "Creating Stream Lines.....",
-streamlines = myVisu.StreamLinesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
-if streamlines is None : print "Error"
-else : print "OK"
-myView.DisplayOnly(streamlines)
-
-print "Creating Vectors..........",
-vectors = myVisu.VectorsOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
-if vectors is None : print "Error"
-else : print "OK"
-myView.DisplayOnly(vectors)
-
-
-print "Creating Iso Surfaces.....",
-isosurfaces = myVisu.IsoSurfacesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
-if isosurfaces is None : print "Error"
-else : print "OK"
-myView.DisplayOnly(isosurfaces)
-
-print "Creating Cut Planes.......",
-cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,'vitesse',1);
-if cutplanes is None : print "Error"
-else : print "OK"
-cutplanes.SetNbPlanes(30)
-cutplanes.SetOrientation(VISU.CutPlanes.YZ, 0, 0)
-myView.DisplayOnly(cutplanes)
-
-#%====================Stage4: Opening a new study and Med file import====================%
-
-print "**** Stage4: Opening a new study and Med file import"
-
-print "Creating a new study..................",
-newStudy = salome.myStudyManager.NewStudy('newStudy')
-myVisu.SetCurrentStudy(newStudy)
-myViewManager = myVisu.GetViewManager()
-myView = myViewManager.Create3DView()
-if myView is None : print "Error"
-else : print "OK"
-
-print 'Importing "Fields_group3D.med"........',
-medFile = datadir + "Fields_group3D.med"
-myResult1 = myVisu.ImportFile(medFile)
-if myResult1 is None : print "Error"
-myView1 = myViewManager.Create3DView()
-if myView1 is None : print "Error"
-else : print "OK"
-
-#%====================Stage5: Displaying scalar field====================%
-
-print "**** Stage5: Displaying scalar field"
-
-myMeshName1 = 'mailles_MED'
-
-print "Creating Scalar Map.......",
-scalarmap1 = myVisu.ScalarMapOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1);
-if scalarmap1 is None : print "Error"
-else : print "OK"
-myView1.DisplayOnly(scalarmap1)
-myView1.FitAll()
-
-print "Creating Iso Surfaces.....",
-isosurfaces1 = myVisu.IsoSurfacesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1);
-if isosurfaces1 is None : print "Error"
-else : print "OK"
-myView1.DisplayOnly(isosurfaces1)
-
-print "Creating Cut Planes.......",
-cutplanes1 = myVisu.CutPlanesOnField(myResult1,myMeshName1,myCellEntity,'scalar field',1);
-if cutplanes1 is None : print "Error"
-else : print "OK"
-cutplanes1.SetOrientation(VISU.CutPlanes.YZ, 0, 0)
-myView1.DisplayOnly(cutplanes1)
-
-#%====================Stage6: Object browser popup====================%
-
-print "**** Stage6: Object browser popup"
-
-print "Creating mesh.............",
-mesh = myVisu.MeshOnEntity(myResult1,myMeshName1,myCellEntity);
-if mesh is None : print "Error"
-else : print "OK"
-myView1.DisplayOnly(mesh)
-
-
-print "Changing type of presentation of mesh:"
-mesh.SetPresentationType(VISU.WIREFRAME)
-PrsType = mesh.GetPresentationType()
-print "Presentation type..", PrsType
-myView1.DisplayOnly(mesh)
-
-mesh.SetPresentationType(VISU.SHADED)
-PrsType = mesh.GetPresentationType()
-print "Presentation type.....", PrsType
-myView1.DisplayOnly(mesh)
-
-mesh.SetPresentationType(VISU.POINT)
-PrsType = mesh.GetPresentationType()
-print "Presentation type......", PrsType
-myView1.DisplayOnly(mesh)
-myView1.Update()
-
-mesh.SetPresentationType(VISU.SHRINK)
-PrsType = mesh.GetPresentationType()
-print "Presentation type.....", PrsType
-myView1.DisplayOnly(mesh)
-
-print "Changing color of mesh....",
-aColor = SALOMEDS.Color(0,0,1)
-mesh.SetCellColor(aColor)
-myView1.DisplayOnly(mesh)
-print "OK"
-
-print "Renaming ScalarMap........",
-SObj = newStudy.FindObjectIOR(scalarmap1.GetID())
-newName = 'Renamed Object'
-SObj.Name = newName
-print "OK"
-
-print "Deleting Cut Planes.......",
-SObj = newStudy.FindObjectIOR(cutplanes1.GetID())
-myBuilder = newStudy.NewBuilder()
-myBuilder.RemoveObject(SObj)
-print "OK"
-
-print "Changing first IsoSurfaces",
-myVisu.SetCurrentStudy(salome.myStudy)
-myView.DisplayOnly(isosurfaces)
-isosurfaces.SetNbSurfaces(25)
-print "OK"
-
-myView.Maximize()
-myView.DisplayOnly(isosurfaces)
-
-print "Hide IsoSurfaces..........",
-myView.Erase(isosurfaces)
-print "OK"
+++ /dev/null
-# T 2.24: Save/retrieve view parameters.
-# Uses MED file fra.med from ${DATA_DIR}/MedFiles directory.
-#
-# This script is equivalent to non-regression test script 003/A3
-
-import salome
-import visu_gui
-import SALOMEDS
-import VISU
-import os
-
-medFile = os.getenv("DATA_DIR") + "/MedFiles/fra.med"
-
-#%====================Stage1: Creating a new study====================%
-
-print "**** Stage1: Creating a new study "
-
-print "Creating a new study..................",
-myVisu = visu_gui.myVisu
-myVisu.SetCurrentStudy(salome.myStudy)
-myViewManager = myVisu.GetViewManager()
-if myViewManager is None : print "Error"
-else : print "OK"
-
-#%====================Stage2: Saving view parameters before import====================%
-
-print "**** Stage2: Saving view parameters before import "
-
-myView = myViewManager.Create3DView()
-
-print "Zooming trihedron.....................",
-aScale = myView.GetParallelScale()
-myView.SetParallelScale(aScale*4)
-print "OK"
-
-print "Rotating trihedron....................",
-aPoint = (100,100,100)
-myView.SetPointOfView(aPoint)
-print "OK"
-
-print "Saving view parameters................",
-aViewParamsName1 = 'ViewParams:1'
-aSaveRes = myView.SaveViewParams(aViewParamsName1)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-#%====================Stage3: Import MED file====================%
-
-print "**** Stage3: Import MED file"
-
-print 'Importing "fra.med"...................',
-myResult = myVisu.ImportFile(medFile)
-if myResult is None : print "Error"
-else : print "OK"
-
-print "Creating mesh.........................",
-myMeshName = 'LE VOLUME'
-myCellEntity = VISU.CELL
-mesh = myVisu.MeshOnEntity(myResult,myMeshName,myCellEntity);
-if mesh is None : print "Error"
-else : print "OK"
-
-myView.Maximize()
-myView.Display(mesh)
-myView.FitAll()
-
-#%====================Stage4: Saving view parameters after import====================%
-
-print "**** Stage4: Saving view parameters after import"
-
-print "Creating Scalar Map...................",
-myFieldName = 'TAUX_DE_VIDE'
-myNodeEntity = VISU.NODE
-scalarmap = myVisu.ScalarMapOnField(myResult,myMeshName,myNodeEntity,myFieldName,1);
-if scalarmap is None : print "Error"
-else : print "OK"
-myView.DisplayOnly(scalarmap)
-
-print "Zooming 3D view.......................",
-aScale = myView.GetParallelScale()
-myView.SetParallelScale(aScale*2)
-print "OK"
-
-print "Setting view point(LEFT)..............",
-myView.SetView((VISU.View3D.LEFT))
-print "OK"
-
-print "Saving view parameters................",
-aViewParamsName2 = 'ViewParams:2'
-aSaveRes = myView.SaveViewParams(aViewParamsName2)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-print "Creating Cut Planes...................",
-cutplanes = myVisu.CutPlanesOnField(myResult,myMeshName,myNodeEntity,myFieldName,1);
-if cutplanes is None : print "Error"
-else : print "OK"
-cutplanes.SetNbPlanes(4)
-myView.DisplayOnly(cutplanes)
-
-print "Setting scaling.......................",
-
-#Define parameters of scaling:
-myXParam = 5
-myYParam = 5
-myZParam = 1
-
-myXAxis = VISU.View3D.XAxis
-myYAxis = VISU.View3D.YAxis
-myZAxis = VISU.View3D.ZAxis
-
-myView.ScaleView(myXAxis,myXParam)
-myView.ScaleView(myYAxis,myYParam)
-myView.ScaleView(myZAxis,myZParam)
-print "OK"
-
-print "Rotating 3d view......................",
-aPoint = (100,40,0)
-myView.SetPointOfView(aPoint)
-print "OK"
-
-print "Fit All...............................",
-myView.FitAll()
-print "OK"
-
-print "Saving view parameters................",
-aViewParamsName3 = 'ViewParams:3'
-aSaveRes = myView.SaveViewParams(aViewParamsName3)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-#%====================Stage5: Restoring view parameters====================%
-
-print "**** Stage5: Restoring view parameters"
-
-print "Restoring first view parameters.......",
-aRestoreRes = myView.RestoreViewParams(aViewParamsName1)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Restoring second view parameters......",
-aRestoreRes = myView.RestoreViewParams(aViewParamsName2)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Displaing only Scalar Map.............",
-myView.DisplayOnly(scalarmap)
-print "OK"
-
-print "Displaing only Cut Planes.............",
-myView.DisplayOnly(cutplanes)
-print "OK"
-
-print "Restoring third view parameters.......",
-aRestoreRes = myView.RestoreViewParams(aViewParamsName3)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Displaing only Mesh...................",
-myView.DisplayOnly(mesh)
-print "OK"
-
-print "Displaing only Scalar Map.............",
-myView.DisplayOnly(scalarmap)
-print "OK"
-
-print "Displaing only Cut Planes.............",
-myView.DisplayOnly(cutplanes)
-print "OK"
-
-#%====================Stage6: Changing of view parameters====================%
-
-print "**** Stage6: Changing of view parameters"
-
-print "Remove scaling........................",
-myView.RemoveScale()
-print "OK"
-
-print "Fit All...............................",
-myView.FitAll()
-print "OK"
-
-print "Rotating 3d view......................",
-aPoint = (0,60,150)
-myView.SetPointOfView(aPoint)
-print "OK"
-
-print "Resaving first view parameters........",
-aSaveRes = myView.SaveViewParams(aViewParamsName1)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-print "Restoring third view parameters.......",
-aRestoreRes = myView.RestoreViewParams(aViewParamsName3)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Restoring first view parameters.......",
-aRestoreRes = myView.RestoreViewParams(aViewParamsName1)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Displaying only Mesh..................",
-myView.DisplayOnly(mesh)
-print "OK"
-
-print "Displaying only Scalar Map............",
-myView.DisplayOnly(scalarmap)
-print "OK"
-
-#%====================Stage7: Saving of created view parameters====================%
-
-print "**** Stage7: Saving of created view parameters"
-
-print "Saving study..........................",
-
-str = os.getenv("TmpDir")
-if str == None:
- str = "/tmp"
-
-file = str+'/VISU_005.hdf'
-
-salome.myStudyManager.SaveAs(file, salome.myStudy, 0)
-study_id = salome.myStudy._get_StudyId()
-#salome.sg.CloseStudy(study_id)
-#salome.myStudyManager.Close(salome.myStudy)
-#salome.myStudy.Close()
-print "OK"
-
-print "Opening just saved study..............",
-
-openedStudy = salome.myStudyManager.Open(file)
-myVisu.SetCurrentStudy(openedStudy)
-myViewManager = myVisu.GetViewManager()
-myView1 = myViewManager.Create3DView()
-if myView1 is None : print "Error"
-else : print "OK"
-
-print "Restoring first view parameters.......",
-aRestoreRes = myView1.RestoreViewParams(aViewParamsName1)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-Builder = openedStudy.NewBuilder()
-SCom = openedStudy.FindComponent("VISU")
-Builder.LoadWith(SCom ,myVisu)
-
-print "Displaying Scalar Map.................",
-SObj = openedStudy.FindObject('ScalarMap')
-scalarmap1 = visu_gui.visu.SObjectToObject(SObj)
-if scalarmap1 is None : print "Error"
-else : print "OK"
-myView1.DisplayOnly(scalarmap1)
-
-print "Displaying Cut Planes.................",
-SObj = openedStudy.FindObject('CutPlanes')
-cutplanes1 = visu_gui.visu.SObjectToObject(SObj)
-if cutplanes1 is None : print "Error"
-else : print "OK"
-myView1.DisplayOnly(cutplanes1)
-
-print "Restoring second view parameters......",
-aRestoreRes = myView1.RestoreViewParams(aViewParamsName2)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Displaying Scalar Map.................",
-myView1.DisplayOnly(scalarmap1)
-print "OK"
-
-print "Restoring third view parameters.......",
-aRestoreRes = myView1.RestoreViewParams(aViewParamsName3)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
-print "Displaying Cut Planes.................",
-myView1.DisplayOnly(cutplanes1)
-print "OK"
-
-#%====================Stage8: Changing of saved session====================%
-
-print "**** Stage8: Changing of saved session"
-
-print "Deleting ViewParams:3,1,2.............",
-SObj = openedStudy.FindObject(aViewParamsName3)
-Builder.RemoveObject(SObj)
-SObj = openedStudy.FindObject(aViewParamsName1)
-Builder.RemoveObject(SObj)
-SObj = openedStudy.FindObject(aViewParamsName2)
-Builder.RemoveObject(SObj)
-print "OK"
-
-SObjList2 = openedStudy.FindObjectByName(aViewParamsName1, "VISU")
-print "FindObjectByName(aViewParamsName1, VISU) returned ", len(SObjList2), " objects"
-
-print "Zooming trihedron.....................",
-aScale = myView.GetParallelScale()
-myView1.SetParallelScale(aScale*2)
-myView1.Update()
-print "OK"
-
-print "Rotating trihedron....................",
-aPoint = (200,40,-40)
-myView1.SetPointOfView(aPoint)
-print "OK"
-
-print "Saving view parameters................",
-aSaveRes = myView1.SaveViewParams(aViewParamsName1)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-print "Renaming ViewParams:1.................",
-SObj = openedStudy.FindObject(aViewParamsName1)
-SObj.Name = "New_view"
-print "OK"
-
-print "Setting scaling.......................",
-#Define parameters of scaling:
-myXParam = 4
-myYParam = 4
-myZParam = 8
-
-myXAxis = VISU.View3D.XAxis
-myYAxis = VISU.View3D.YAxis
-myZAxis = VISU.View3D.ZAxis
-
-myView1.ScaleView(myXAxis,myXParam)
-myView1.ScaleView(myYAxis,myYParam)
-myView1.ScaleView(myZAxis,myZParam)
-print "OK"
-
-myView1.FitAll()
-
-print "Saving view parameters................",
-aSaveRes = myView1.SaveViewParams(aViewParamsName2)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-print "Restoring first view parameters.......",
-aRestoreRes = myView1.RestoreViewParams(aViewParamsName1)
-if aSaveRes != 1 : print "Error"
-else : print "OK"
-
-print "Restoring second view parameters......",
-aRestoreRes = myView1.RestoreViewParams(aViewParamsName2)
-if aRestoreRes != 1 : print "Error"
-else : print "OK"
-
+++ /dev/null
-# Animation of "vitesse" field, stored in file TimeStamps.med
-#
-# This script is equivalent to non-regression test script 003/A5
-
-import salome
-import visu_gui
-import SALOMEDS
-import VISU
-import os
-import time
-
-medFile = os.getenv("DATA_DIR") + "/MedFiles/TimeStamps.med"
-
-print 'Importing "TimeStamps.med"................',
-myVisu = visu_gui.myVisu
-myResult = myVisu.ImportFile(medFile)
-if myResult is None : print "Error"
-else : print "OK"
-
-print "Creating Cut Lines........................",
-medMesh = 'dom'
-medField = "vitesse"
-aCutLines = myVisu.CutLinesOnField(myResult,'dom',VISU.NODE,medField,1.0)
-aCutLines.SetOrientation(VISU.CutPlanes.XY, 0, 0)
-aCutLines.SetOrientation2(VISU.CutPlanes.ZX, 0, 0)
-aCutLines.SetNbLines(20)
-if aCutLines is None : print "Error"
-else : print "OK"
-
-print "Creating a Viewer.........................",
-myViewManager = myVisu.GetViewManager();
-myView = myViewManager.Create3DView();
-if myView is None : print "Error"
-else : print "OK"
-myView.Display(aCutLines);
-myView.FitAll();
-
-aCutLinesSObj = salome.myStudy.FindObjectIOR(aCutLines.GetID())
-aFather = aCutLinesSObj.GetFather().GetFather();
-
-print "Creating an Animation.....................",
-myAnim = myVisu.CreateAnimation(myView);
-if myAnim is None : print "Error"
-else : print "OK"
-
-print "Animation.................................",
-myAnim.addField(aFather);
-myAnim.generatePresentations(0);
-myAnim.generateFrames();
-myAnim.setSpeed(33)
-myAnim.startAnimation();
-
-myView.FitAll()
-while 1:
- time.sleep(1)
- if not myAnim.isRunning():
- myAnim.stopAnimation()
- break
-
-print "OK"
+++ /dev/null
-# Show some results presentations in different 3D and 2D viewers
-# with different options (view parameters and display modes).
-# Uses MED files fra.med and TimeStamps.med from ${DATA_DIR}/MedFiles directory.
-#
-# Pay attention to a viewer title to know its purpose.
-#
-# This script is equivalent to script VISU_SWIG/visu_view3d.py
-
-import os
-import time
-import math
-import VISU
-import SALOMEDS
-from visu_gui import *
-
-aDelay = 1
-
-myViewManager = myVisu.GetViewManager();
-
-myView = myViewManager.Create3DView();
-myView.SetTitle("The window will be soon destroyed!")
-print "myViewManager.Create3DView()"
-time.sleep(aDelay)
-
-myView.Maximize()
-print "myView.Maximize()"
-time.sleep(aDelay)
-
-myView.Restore()
-print "myView.Restore()"
-time.sleep(aDelay)
-
-myView.Minimize()
-print "myView.Minimize()"
-time.sleep(aDelay)
-
-myViewManager.Destroy(myView)
-print "myViewManager.Destroy(myView)"
-time.sleep(aDelay)
-
-
-medFile = "fra.med"
-myFieldName = "VITESSE";
-
-aMeshName ="LE VOLUME"
-anEntity = VISU.NODE
-aTimeStampId = 1
-
-medFile = os.getenv('DATA_DIR') + '/MedFIles/' + medFile
-myResult = myVisu.ImportFile(medFile)
-
-myView = myViewManager.Create3DView();
-
-print "myView.SetBackground(...)"
-aColor = SALOMEDS.Color(0.0,0.3,1.0)
-myView.SetBackground(aColor);
-
-myView.SetTitle("The viewer will display ScalarMap")
-print "myViewManager.Create3DView()"
-
-aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-
-myView.Display(aScalarMap);
-print "myView.Display(aScalarMap)"
-myView.SetFocalPoint([0,0,0]);
-print "myView.SetFocalPoint(...)"
-myView.SetParallelScale(2);
-print "myView.SetParallelScale(...)"
-myView.FitAll();
-
-aMax = aScalarMap.GetMax()
-aMin = aScalarMap.GetMin()
-aDelta = (aMax - aMin)/2.0
-aNbColors = aScalarMap.GetNbColors()
-aNbColors = 64
-for i in range(2,aNbColors) :
- aScalarMap.SetNbColors(i)
- aX = aMin + aDelta*i/aNbColors
- aY = aMax - aDelta*i/aNbColors
- aScalarMap.SetRange(aX,aY)
- myView.Update();
- time.sleep(aDelay)
-
-aScalarMap.SetRange(aMin,aMax)
-
-print "myView.Update()"
-myView.Update();
-print "myView.FitAll()"
-myView.FitAll();
-
-
-myView = myViewManager.Create3DView();
-myView.SetTitle("Here we will display CutPlanes")
-
-print "myView.SetBackground(...)"
-aColor = SALOMEDS.Color(0.0,0.7,0.0)
-myView.SetBackground(aColor);
-
-aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-print "myVisu.CutPlanesOnField(...)"
-
-myView.DisplayOnly(aCutPlanes);
-print "myView.DisplayOnly(aCutPlanes)"
-
-aPoint = myView.GetPointOfView();
-aPoint[0] = aPoint[0] + 10;
-myView.SetPointOfView(aPoint);
-print "myView.SetPointOfView(...)"
-myView.ScaleView(VISU.View3D.YAxis,10.0);
-myView.ScaleView(VISU.View3D.XAxis,3.0);
-print "myView.ScaleView(...)"
-time.sleep(aDelay)
-
-myView.FitAll();
-
-aNbPlanes = aCutPlanes.GetNbPlanes()
-aNbPlanes = 30
-aXAngle = aCutPlanes.GetRotateX()
-aYAngle = aCutPlanes.GetRotateY()
-anOrientation = aCutPlanes.GetOrientationType()
-for i in range(aNbPlanes,1,-1) :
- aCutPlanes.SetNbPlanes(i)
- aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
- aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
- aCutPlanes.SetOrientation(anOrientation,aX,aY)
- myView.Update();
- time.sleep(aDelay)
-
-aNbPlanes = 10
-aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0)
-for i in range(1,aNbPlanes) :
- aCutPlanes.SetNbPlanes(i)
- myView.Update();
- time.sleep(aDelay)
-
-myView.SaveViewParams('AAA')
-print "myView.SaveViewParams('AAA')"
-time.sleep(aDelay)
-
-aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0)
-myView.RemoveScale();
-
-print "myView.Update()"
-myView.Update();
-print "myView.FitAll()"
-myView.FitAll();
-
-
-myView = myViewManager.Create3DView();
-print "myViewManager.Create3DView()"
-
-myView.SetTitle("IsoSurface's viewer")
-
-print "myView.SetBackground(...)"
-aColor = SALOMEDS.Color(1.0,0.7,0.0)
-myView.SetBackground(aColor);
-time.sleep(aDelay)
-
-aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
-
-myView.DisplayOnly(aIsoSurfaces);
-myView.FitAll();
-print "myView.DisplayOnly(aCutPlanes)"
-time.sleep(aDelay)
-
-aNbSurfaces = aIsoSurfaces.GetNbSurfaces()
-aNbSurfaces = 32
-for i in range(2,aNbSurfaces) :
- aIsoSurfaces.SetNbSurfaces(i)
- myView.Update();
- time.sleep(aDelay)
-
-aIsoSurfaces.SetNbSurfaces(10)
-
-print "myView.Update()"
-myView.Update();
-print "myView.FitAll()"
-myView.FitAll();
-
-
-myView = myViewManager.Create3DView();
-myView.SetTitle("The viewer for CutLines")
-print "myViewManager.Create3DView()"
-time.sleep(aDelay)
-
-print "myView.SetBackground(...)"
-aColor = SALOMEDS.Color(0.7,0.7,0.7)
-myView.SetBackground(aColor);
-time.sleep(aDelay)
-
-aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
-aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0)
-aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0)
-
-myView.DisplayOnly(aCutLines);
-myView.FitAll();
-print "myView.DisplayOnly(aCutLines)"
-time.sleep(aDelay)
-
-aSObj = myStudy.FindObjectIOR(aCutLines.GetID())
-aTable = myVisu.CreateTable( aSObj.GetID() )
-print "myVisu.CreateTable(...)"
-
-aTableView = myViewManager.CreateTableView(aTable)
-aTableView.SetTitle('Changed Title')
-
-aContainer = myVisu.CreateContainer()
-print "myVisu.CreateContainer(...)"
-
-aNbCurve = aTable.GetNbRows() - 1
-for i in range(2,aNbCurve):
- aCurve = myVisu.CreateCurve( aTable, 1, i )
- print i, aCurve
- aContainer.AddCurve(aCurve)
-
-
-myView = myViewManager.CreateXYPlot();
-myView.SetTitle("The viewer for Curves from CutLines")
-print "myViewManager.CreateXYPlot()"
-time.sleep(aDelay)
-
-myView.Display(aContainer)
-
-
-myView = myViewManager.Create3DView();
-myView.SetTitle("The viewer for Animation")
-print "myViewManager.Create3DView()"
-time.sleep(aDelay)
-
-medFile = "TimeStamps.med"
-myFieldName = "vitesse";
-
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
-myResult = myVisu.ImportFile(medFile)
-
-anAnim = myVisu.CreateAnimation(myView);
-aSObj = myStudy.FindObjectIOR(myResult.GetID())
-aSObj = aSObj.FindSubObject(1)[1]
-aSObj = aSObj.FindSubObject(2)[1]
-aSObj = aSObj.FindSubObject(2)[1]
-anAnim.addField(aSObj)
-anAnim.setPresentationType(0,VISU.TISOSURFACE)
-print "Generate presentations"
-anAnim.generatePresentations(0)
-print "Generate frames"
-anAnim.generateFrames()
-print "Start Animation"
-anAnim.setSpeed(99)
-anAnim.startAnimation()
-myView.FitAll()
-while 1:
- time.sleep(1+aDelay)
- if not anAnim.isRunning():
- anAnim.stopAnimation()
- break
+++ /dev/null
-# Create a table and show it in Plot2d viewer
-#
-# This script is equivalent to script VISU_SWIG/visu_big_table.py
-
-import salome
-import math
-import SALOMEDS
-import VISU
-#from visu_gui import *
-
-# >>> Getting study builder ==================================================
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-# >>> Getting (loading) VISU component =======================================
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
-myComponent = myStudy.FindComponent("VISU")
-myVisu.SetCurrentStudy(myStudy)
-if not myComponent:
- myComponent = myBuilder.NewComponent("VISU")
- aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
- aName.SetValue( salome.sg.getComponentUserName("VISU") )
-
- A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap");
- aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
- aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" );
-
- myBuilder.DefineComponentInstance(myComponent,myVisu)
-
-# >>> Creating object with Table of real[ 200 * 20 ] =========================
-myTRealObject = myBuilder.NewObject(myComponent)
-AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
-AName.SetValue("Table Of Real")
-ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
-myHorNb = 10
-myVerNb = 200
-
-k={}
-for j in range(0,myHorNb):
- k[j] = j*10+1
-ARealTable.AddRow(k.values())
-ARealTable.SetRowTitle(1, "Frequency")
-ARealTable.SetRowUnit(1, "Hz")
-
-for i in range(1,myVerNb+1):
- for j in range(0,myHorNb):
- if j % 2 == 1:
- k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5
- else:
- k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5
- ARealTable.AddRow(k.values())
- ARealTable.SetRowTitle(i+1, "Power " + str(i))
- ARealTable.SetRowUnit(i+1, "Wt")
-
-ARealTable.SetTitle("Very useful data")
-
-# >>> Create Visu table ======================================================
-myVisuTableReal = myVisu.CreateTable( myTRealObject.GetID() )
-
-# >>> Create container and insert curves
-myContainer = myVisu.CreateContainer()
-
-# >>> Create curves ==========================================================
-for i in range(1,myVerNb+1):
- myCurve = myVisu.CreateCurve( myVisuTableReal, 1, i+1 )
- myContainer.AddCurve(myCurve)
-
-# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(1)
-
-# >>> Display curves in Plot2d viewer ========================================
-myViewManager = myVisu.GetViewManager();
-myView = myViewManager.CreateXYPlot();
-myView.SetTitle("The viewer for Curves from the Table")
-myView.Display(myContainer)
-
-# ============================================================================
+++ /dev/null
-# Import a table from file and show it in Plot2d viewer
-
-import salome
-import math
-import SALOMEDS
-import VISU
-#from visu_gui import *
-
-# >>> Getting study builder ==================================================
-myStudy = salome.myStudy
-myBuilder = myStudy.NewBuilder()
-
-# >>> Getting (loading) VISU component =======================================
-myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
-myComponent = myStudy.FindComponent("VISU")
-myVisu.SetCurrentStudy(myStudy)
-if not myComponent:
- myComponent = myBuilder.NewComponent("VISU")
- aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
- #aName.SetValue("Visu")
- aName.SetValue( salome.sg.getComponentUserName("VISU") )
-
- A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap");
- aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
- aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" );
-
- myBuilder.DefineComponentInstance(myComponent,myVisu)
-
-# >>> Import a tables from a file ============================================
-aFileName = os.getenv("DATA_DIR") + "/Tables/tables_test.xls"
-sobj = myVisu.ImportTables(aFileName)
-
-# >>> Create container and insert curves =====================================
-myContainer = myVisu.CreateContainer()
-
-chiter = myStudy.NewChildIterator(sobj)
-while chiter.More():
- sobj_table = chiter.Value()
-
- # >>> Create Visu table ====================================================
- myVisuTableReal = myVisu.CreateTable(sobj_table.GetID())
-
- nbRows = myVisuTableReal.GetNbRows()
-
- # >>> Create curves ========================================================
- for i in range(1, nbRows):
- myCurve = myVisu.CreateCurve(myVisuTableReal, 1, i+1)
- myContainer.AddCurve(myCurve)
-
- chiter.Next()
-
-# >>> Updating Object Browser ================================================
-salome.sg.updateObjBrowser(1)
-
-# >>> Display curves in Plot2d viewer ========================================
-myViewManager = myVisu.GetViewManager();
-myView = myViewManager.CreateXYPlot();
-myView.SetTitle("The viewer for Curves from the Table")
-myView.Display(myContainer)
-
-# ============================================================================
anEntity = VISU.NODE
aTimeStampId = 1
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
myResult = myVisu.ImportFile(medFile)
medFile = "TimeStamps.med"
myFieldName = "vitesse";
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
myResult = myVisu.ImportFile(medFile)
anAnim = myVisu.CreateAnimation(myView);
anEntity = VISU.NODE
aTimeStampId = 1
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
myResult = myVisu.ImportFile(medFile)
aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
med_comp = salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
-medDir = os.getenv('DATA_DIR') + '/MedFiles/'
+medDir = os.getenv('KERNEL_ROOT_DIR') + '/examples/'
def importMedFrom(medDir,medFile):
medFile = medDir + medFile
myVisu = visu_gui.myVisu
medFile = "pointe.med"
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
print medFile
studyCurrent = salome.myStudyName
from libVISU_Swig import *
-medFile = os.getenv('DATA_DIR') + '/MedFiles/fra.med'
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/fra.med'
myCon=Convertor(medFile)
myPrs=ScalarMap(myCon,"LE VOLUME",0,"VITESSE",1)
myView=View3D()
anEntity = VISU.NODE
aTimeStampId = 1
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
myResult = myVisu.ImportFile(medFile)
medFile = "TimeStamps.med"
myFieldName = "vitesse";
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
myResult = myVisu.ImportFile(medFile)
anAnim = myVisu.CreateAnimation(myView);
{
if(MYDEBUG) INFOS("VVTK_Renderer1() - "<<this);
- myImplicitFunctionWidget->SetPlaceFactor(1.1);
+ myImplicitFunctionWidget->SetPlaceFactor(1.0);
myImplicitFunctionWidget->SetOutlineTranslation(false);
vtkProperty* aSelectedPlaneProperty = myImplicitFunctionWidget->GetSelectedPlaneProperty();
vtkProperty* aPlaneProperty = myImplicitFunctionWidget->GetPlaneProperty();