From: admin Date: Thu, 27 Oct 2005 14:00:10 +0000 (+0000) Subject: This commit was generated by cvs2git to create tag X-Git-Tag: BR-D5-38-2003_D2005-12-19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b78f7ff0779c7907ca2d9c847c39768272c03883;p=modules%2Fvisu.git This commit was generated by cvs2git to create tag 'BR-D5-38-2003_D2005-12-19'. Sprout from BR-D5-38-2003_Base 2005-10-27 14:00:09 UTC admin '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 '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 '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 --- diff --git a/INSTALL b/INSTALL index 5953dd67..fc58f193 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -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 diff --git a/Makefile.in b/Makefile.in index 519f470b..ca5acded 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,7 +14,7 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl: @COMMENCE@ -SUBDIRS = idl src doc +SUBDIRS = idl src examples doc BIN_SCRIPT= \ VERSION diff --git a/doc/salome/tui/VISU/doxyfile b/doc/salome/tui/VISU/doxyfile index b4346ae4..3ee35aea 100755 --- a/doc/salome/tui/VISU/doxyfile +++ b/doc/salome/tui/VISU/doxyfile @@ -1,89 +1,73 @@ -# 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 #--------------------------------------------------------------------------- @@ -92,15 +76,12 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = NO REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES - #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = - #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- @@ -121,7 +102,6 @@ DISABLE_INDEX = YES ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = YES TREEVIEW_WIDTH = 250 - #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- @@ -136,8 +116,6 @@ LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO - #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -147,7 +125,6 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = - #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- @@ -155,21 +132,16 @@ GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO - #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO -XML_OUTPUT = xml XML_SCHEMA = XML_DTD = -XML_PROGRAMLISTING = YES - #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO - #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- @@ -177,7 +149,6 @@ GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = - #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- @@ -190,16 +161,14 @@ INCLUDE_FILE_PATTERNS = 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 #--------------------------------------------------------------------------- @@ -208,22 +177,24 @@ HIDE_UNDOC_RELATIONS = NO HAVE_DOT = YES CLASS_GRAPH = YES COLLABORATION_GRAPH = NO -UML_LOOK = NO TEMPLATE_RELATIONS = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = NO -CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DOT_IMAGE_FORMAT = jpg DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1200 -MAX_DOT_GRAPH_DEPTH = 0 GENERATE_LEGEND = NO DOT_CLEANUP = YES - #--------------------------------------------------------------------------- -# Configuration::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 = diff --git a/examples/Fields_group3D.med b/examples/Fields_group3D.med new file mode 100644 index 00000000..95601774 Binary files /dev/null and b/examples/Fields_group3D.med differ diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 00000000..52f3a639 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,33 @@ +# 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) diff --git a/examples/ResOK_0000.med b/examples/ResOK_0000.med new file mode 100644 index 00000000..47afde89 Binary files /dev/null and b/examples/ResOK_0000.med differ diff --git a/examples/VISU_Example_01.py b/examples/VISU_Example_01.py new file mode 100644 index 00000000..8de2ce6c --- /dev/null +++ b/examples/VISU_Example_01.py @@ -0,0 +1,191 @@ +# 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" diff --git a/examples/VISU_Example_02.py b/examples/VISU_Example_02.py new file mode 100644 index 00000000..a7f6ea3b --- /dev/null +++ b/examples/VISU_Example_02.py @@ -0,0 +1,348 @@ +# 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" + diff --git a/examples/VISU_Example_03.py b/examples/VISU_Example_03.py new file mode 100644 index 00000000..c64de44b --- /dev/null +++ b/examples/VISU_Example_03.py @@ -0,0 +1,60 @@ +# 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" diff --git a/examples/VISU_Example_04.py b/examples/VISU_Example_04.py new file mode 100644 index 00000000..71e40845 --- /dev/null +++ b/examples/VISU_Example_04.py @@ -0,0 +1,255 @@ +# 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 diff --git a/examples/VISU_Example_05.py b/examples/VISU_Example_05.py new file mode 100644 index 00000000..a70943e4 --- /dev/null +++ b/examples/VISU_Example_05.py @@ -0,0 +1,77 @@ +# 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) + +# ============================================================================ diff --git a/examples/VISU_Example_06.py b/examples/VISU_Example_06.py new file mode 100644 index 00000000..a4eee6cc --- /dev/null +++ b/examples/VISU_Example_06.py @@ -0,0 +1,61 @@ +# 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) + +# ============================================================================ diff --git a/examples/tables_test.xls b/examples/tables_test.xls new file mode 100644 index 00000000..4fedc011 --- /dev/null +++ b/examples/tables_test.xls @@ -0,0 +1,115 @@ +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 diff --git a/src/CONVERTOR/Makefile.in b/src/CONVERTOR/Makefile.in index 59057158..5549610d 100644 --- a/src/CONVERTOR/Makefile.in +++ b/src/CONVERTOR/Makefile.in @@ -68,6 +68,6 @@ LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) \ -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@ diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index f34d4935..25aa1b32 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -88,25 +88,23 @@ void parseFile(const char* theFileName) 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<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<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++){ @@ -138,7 +136,6 @@ void parseFile(const char* theFileName) aVTKID = anIDMapper->GetElemVTKID(anObjID); cout<AddObserver(vtkCommand::DisableEvent, myEventCallbackCommand.GetPointer(), myPriority); - theWidget->AddObserver(vtkCommand::EndInteractionEvent, - myEventCallbackCommand.GetPointer(), - myPriority); + } myWidget = theWidget; @@ -364,7 +362,6 @@ VISU_GaussPtsAct { Superclass::SetVisibility(theMode); myScalarBarCtrl->SetVisibility(theMode); - Highlight(isHighlighted()); } //---------------------------------------------------------------------------- @@ -455,12 +452,6 @@ VISU_GaussPtsAct case VISU::UpdatePickingSettingsEvent: UpdatePickingSettings(); break; - case vtkCommand::EndInteractionEvent: - case vtkCommand::EnableEvent: - case vtkCommand::DisableEvent: - myCurrentPL->GetMapper()->Update(); - Highlight(isHighlighted()); - break; default: break; } @@ -517,7 +508,6 @@ bool VISU_GaussPtsAct::PreHighlight(vtkInteractorStyle* theInteractorStyle, return false; vtkIdType aVtkId = myPointPicker->GetPointId(); - if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){ vtkIdType anObjId = GetNodeObjId( aVtkId ); if(myLastObjPointID != anObjId){ @@ -619,14 +609,13 @@ bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle, } //================================================================== -// function : Highlight +// function : highlight // purpose : //================================================================== void VISU_GaussPtsAct ::Highlight(bool theIsHighlight) { - myOutlineActor->SetVisibility(false); myTextActor->SetVisibility(0); myCursorPyramidSelected->SetVisibility(0); myCursorPyramid->SetVisibility(0); @@ -724,6 +713,8 @@ VISU_GaussPtsAct myCellActor->SetVisibility(anIsVisible && theIsHighlight); } } + myOutline->SetBounds( GetInput()->GetBounds() ); + myOutlineActor->SetVisibility( anIsVisible && theIsHighlight ); } @@ -999,7 +990,6 @@ VISU_GaussPtsAct1 break; } - switch(theEvent){ case vtkCommand::EnableEvent: myCurrentPL = myInsideDeviceActor->GetPipeLine(); @@ -1007,10 +997,8 @@ VISU_GaussPtsAct1 case vtkCommand::DisableEvent: myCurrentPL = myDeviceActor->GetPipeLine(); break; - default: - break; } - + Superclass::OnInteractorEvent(theEvent); } @@ -1082,6 +1070,9 @@ VISU_GaussPtsAct2 } if(theWidget){ + theWidget->AddObserver(vtkCommand::EndInteractionEvent, + myEventCallbackCommand.GetPointer(), + myPriority); myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction()); myDeviceActor->SetVisibility(Superclass::GetVisibility() && theWidget->IsEnabled()); } @@ -1122,7 +1113,7 @@ VISU_GaussPtsAct2 } break; case vtkCommand::EndInteractionEvent: - Update(); + //vtkLODActor::SetMapper(GetMapper()); break; default: break; diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index 86eb25d2..fe4e22cf 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -131,7 +131,7 @@ VISU_GaussPtsDeviceActor myMapper->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); - Superclass::SetMapper( myMapper.GetPointer() ); + vtkLODActor::SetMapper( myMapper.GetPointer() ); } VISU_GaussPointsPL* diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index 527f726f..391ec412 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -47,7 +47,7 @@ VISU_ScalarMapAct aProperty->SetAmbient(1.0); aProperty->SetDiffuse(0.0); aProperty->SetSpecular(0.0); - + myProperty->DeepCopy(aProperty); } @@ -97,27 +97,3 @@ VISU_ScalarMapAct 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); -} diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index 1d8197a1..bae6e529 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -50,9 +50,6 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_Actor { virtual void SetBarVisibility(bool theMode); virtual bool GetBarVisibility(){ return myBarVisibility;} - virtual void SetShading(bool theOn = true); - virtual bool IsShading(); - protected: VISU_ScalarMapAct(); bool myBarVisibility; diff --git a/src/PIPELINE/Makefile.in b/src/PIPELINE/Makefile.in index 72311f9d..9515408c 100644 --- a/src/PIPELINE/Makefile.in +++ b/src/PIPELINE/Makefile.in @@ -98,6 +98,6 @@ LDFLAGS+= \ -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@ diff --git a/src/PIPELINE/SALOME_ExtractGeometry.cxx b/src/PIPELINE/SALOME_ExtractGeometry.cxx index 5a1762e8..c962e6aa 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.cxx +++ b/src/PIPELINE/SALOME_ExtractGeometry.cxx @@ -48,8 +48,7 @@ vtkStandardNewMacro(SALOME_ExtractGeometry); //---------------------------------------------------------------------------- SALOME_ExtractGeometry ::SALOME_ExtractGeometry(): - myStoreMapping(false), - myIsDoneShallowCopy(false) + myStoreMapping(false) {} SALOME_ExtractGeometry @@ -107,9 +106,9 @@ vtkIdType 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) @@ -122,9 +121,9 @@ vtkIdType 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) @@ -139,14 +138,14 @@ vtkIdType SALOME_ExtractGeometry ::GetElemObjId(int theVtkID) { - if (!myStoreMapping||myIsDoneShallowCopy){ + if (myElemVTK2ObjIds.empty()) return theVtkID; - } - // - if (theVtkIDImplicitFunction; - 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; diff --git a/src/PIPELINE/SALOME_ExtractGeometry.h b/src/PIPELINE/SALOME_ExtractGeometry.h index b225434f..d348fe60 100755 --- a/src/PIPELINE/SALOME_ExtractGeometry.h +++ b/src/PIPELINE/SALOME_ExtractGeometry.h @@ -75,7 +75,6 @@ protected: private: bool myStoreMapping; - bool myIsDoneShallowCopy; typedef std::vector TVectorId; TVectorId myElemVTK2ObjIds; TVectorId myNodeVTK2ObjIds; diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 59f5f91a..c6cdc826 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -129,23 +129,19 @@ int main(int argc, char** argv){ aPresent->Init(); aPresent->SetSourceRange(); vtkDataSet* anOutput = aPresent->GetMapper()->GetInput(); - //for(int i = 0, iEnd = anOutput->GetNumberOfCells(); i < iEnd; i++){ - // cout<GetPointSize(i)<GetNumberOfCells(); i < iEnd; i++){ + cout<GetPointSize(i)<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 ) ); diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx index 844371c9..2ac6af1d 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx @@ -168,14 +168,6 @@ static float DistanceToPlane(const float x[3], const float n[3], const float p0[3]); -static void GetBndPoints(vtkDataSet *pDataSet, - float aPnts[24]); - -static - bool IsValidPlane2Position(vtkPlane *pPx, - vtkDataSet *pDataSet, - float aTol=0.003); - vtkCxxRevisionMacro(VISU_ImplicitFunctionWidget, "$Revision$"); vtkStandardNewMacro(VISU_ImplicitFunctionWidget); @@ -201,9 +193,9 @@ VISU_ImplicitFunctionWidget::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(); @@ -213,53 +205,43 @@ VISU_ImplicitFunctionWidget::VISU_ImplicitFunctionWidget() 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(); @@ -325,14 +307,14 @@ VISU_ImplicitFunctionWidget::VISU_ImplicitFunctionWidget() //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 @@ -345,31 +327,27 @@ VISU_ImplicitFunctionWidget::VISU_ImplicitFunctionWidget() //================================================================== 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(); @@ -423,8 +401,8 @@ void VISU_ImplicitFunctionWidget::SetDistance(const float theDistance) 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]; @@ -473,51 +451,46 @@ void VISU_ImplicitFunctionWidget::SetEnabled(int enabling) 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); @@ -535,17 +508,18 @@ void VISU_ImplicitFunctionWidget::SetEnabled(int enabling) 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"); @@ -565,15 +539,14 @@ void VISU_ImplicitFunctionWidget::SetEnabled(int enabling) 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); @@ -582,14 +555,15 @@ void VISU_ImplicitFunctionWidget::SetEnabled(int enabling) this->Interactor->Render(); } -//================================================================== -// function: IsEnabled -// purpose : -//================================================================== -int VISU_ImplicitFunctionWidget::IsEnabled() + +int +VISU_ImplicitFunctionWidget +::IsEnabled() { return this->Enabled; } + + //================================================================== // function: ProcessEvents // purpose : @@ -626,8 +600,6 @@ void VISU_ImplicitFunctionWidget::ProcessEvents(vtkObject* vtkNotUsed(object), case vtkCommand::MouseMoveEvent: self->OnMouseMove(); break; - default: - break; } } //================================================================== @@ -652,6 +624,7 @@ void VISU_ImplicitFunctionWidget::HighlightNormal(int highlight) this->SphereActor->SetProperty(this->NormalProperty); } } + //================================================================== // function: HighlightPlane // purpose : @@ -659,11 +632,11 @@ void VISU_ImplicitFunctionWidget::HighlightNormal(int highlight) 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); } } @@ -673,11 +646,11 @@ void VISU_ImplicitFunctionWidget::HighlightPlane(int highlight) //================================================================== 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); } } //================================================================== @@ -720,7 +693,7 @@ void VISU_ImplicitFunctionWidget::OnLeftButtonDown() 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; } @@ -923,33 +896,26 @@ void VISU_ImplicitFunctionWidget::OnMouseMove() // 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); @@ -958,121 +924,22 @@ void VISU_ImplicitFunctionWidget::OnMouseMove() 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); @@ -1094,84 +961,23 @@ void VISU_ImplicitFunctionWidget::Rotate(int X, int Y, 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 @@ -1186,11 +992,11 @@ void VISU_ImplicitFunctionWidget::TranslatePlane(double *p1, double *p2) //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]; @@ -1213,19 +1019,19 @@ void VISU_ImplicitFunctionWidget::TranslateOutline(double *p1, double *p2) 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]; @@ -1235,7 +1041,31 @@ void VISU_ImplicitFunctionWidget::TranslateOutline(double *p1, double *p2) 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 : @@ -1250,10 +1080,10 @@ void VISU_ImplicitFunctionWidget::Scale(double *p1, double *p2, 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; } @@ -1266,8 +1096,8 @@ void VISU_ImplicitFunctionWidget::Scale(double *p1, double *p2, 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]; @@ -1276,13 +1106,71 @@ void VISU_ImplicitFunctionWidget::Scale(double *p1, double *p2, 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 @@ -1355,25 +1243,25 @@ void VISU_ImplicitFunctionWidget::PlaceWidget(float bds[6]) 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); } @@ -1391,7 +1279,7 @@ void VISU_ImplicitFunctionWidget::PlaceWidget(float bds[6]) } //================================================================== // 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) { @@ -1402,12 +1290,12 @@ 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]; @@ -1416,10 +1304,10 @@ void VISU_ImplicitFunctionWidget::SetOrigin(float x[3]) 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]; @@ -1433,12 +1321,12 @@ void VISU_ImplicitFunctionWidget::SetOrigin(float x[3]) //================================================================== 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 @@ -1451,7 +1339,7 @@ void VISU_ImplicitFunctionWidget::SetNormal(float x, float y, float z) 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; @@ -1474,7 +1362,7 @@ void VISU_ImplicitFunctionWidget::SetNormal(float n[3]) //================================================================== float* VISU_ImplicitFunctionWidget::GetNormal() { - return myPlane1->GetNormal(); + return this->Plane->GetNormal(); } //================================================================== // function: GetNormal @@ -1482,7 +1370,7 @@ float* VISU_ImplicitFunctionWidget::GetNormal() //================================================================== void VISU_ImplicitFunctionWidget::GetNormal(float xyz[3]) { - myPlane1->GetNormal(xyz); + this->Plane->GetNormal(xyz); } //================================================================== // function: SetDrawPlane @@ -1490,19 +1378,19 @@ void VISU_ImplicitFunctionWidget::GetNormal(float xyz[3]) //================================================================== 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(); @@ -1559,7 +1447,7 @@ void VISU_ImplicitFunctionWidget::SetNormalToZAxis (int var) //================================================================== void VISU_ImplicitFunctionWidget::GetPolyData(vtkPolyData *pd) { - pd->ShallowCopy(this->myCutter1->GetOutput()); + pd->ShallowCopy(this->Cutter->GetOutput()); } //================================================================== // function: GetPolyDataSource @@ -1567,7 +1455,7 @@ void VISU_ImplicitFunctionWidget::GetPolyData(vtkPolyData *pd) //================================================================== vtkPolyDataSource *VISU_ImplicitFunctionWidget::GetPolyDataSource() { - return this->myCutter1; + return this->Cutter; } //================================================================== // function:GetPlane @@ -1579,8 +1467,8 @@ void VISU_ImplicitFunctionWidget::GetPlane(vtkPlane *plane) return; } - plane->SetNormal(myPlane1->GetNormal()); - plane->SetOrigin(myPlane1->GetOrigin()); + plane->SetNormal(this->Plane->GetNormal()); + plane->SetOrigin(this->Plane->GetOrigin()); } //================================================================== // function:UpdatePlacement @@ -1588,9 +1476,9 @@ void VISU_ImplicitFunctionWidget::GetPlane(vtkPlane *plane) //================================================================== 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 @@ -1602,12 +1490,12 @@ void VISU_ImplicitFunctionWidget::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]; @@ -1633,7 +1521,7 @@ void VISU_ImplicitFunctionWidget::UpdateRepresentation() this->Sphere->SetCenter(origin); SphereActor->SetCenter(origin); - this->myEdgesMapper1->SetInput(this->myEdges1->GetOutput()); + this->EdgesMapper->SetInput(this->Edges->GetOutput()); } //================================================================== // function:SizeHandles @@ -1651,64 +1539,83 @@ void VISU_ImplicitFunctionWidget::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], diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.h b/src/PIPELINE/VISU_ImplicitFunctionWidget.h index 4930989d..99403779 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.h +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.h @@ -48,7 +48,6 @@ class vtkTransform; class vtkImplicitBoolean; class vtkImplicitFunction; class VISU_UnScaledActor; -class vtkDataSet; class VISU_ImplicitFunctionWidget : public vtkPolyDataSourceWidget { @@ -115,9 +114,8 @@ public: // 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 @@ -203,88 +201,72 @@ protected: 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; @@ -295,6 +277,17 @@ protected: // 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; @@ -305,6 +298,11 @@ protected: 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 diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 0709a853..913f0c94 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -282,7 +282,7 @@ GLhandleARB VISU_OpenGLPointSpriteMapper::InitShader() else cout << "Loading vertex program... failed" << endl << endl; */ - free( shader ); + delete shader; glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); @@ -447,6 +447,8 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) return; } + //cout << "Using OpenGLPointSpriteMapper" << endl; + vtkIdType numPts; vtkPolyData *input= this->GetInput(); @@ -798,10 +800,9 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, 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 = @@ -878,8 +879,6 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); - glDeleteBuffersARB( 1, &aBufferObjectID ); - #ifdef GL_ARB_shader_objects glUseProgramObjectARB( 0 ); #endif diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index 4554d1fb..e200b2ea 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -105,10 +105,10 @@ VISU_ScalarBarCtrl::~VISU_ScalarBarCtrl() void VISU_ScalarBarCtrl::SetMode(const int theMode) { myMode=theMode; - //myScalarBarNumber=myScalarBarNumberMax; - //if(!myMode){ - // myScalarBarNumber=1; - //} + myScalarBarNumber=myScalarBarNumberMax; + if(!myMode){ + myScalarBarNumber=1; + } } //================================================================== // function : GetMode @@ -256,7 +256,7 @@ void VISU_ScalarBarCtrl::AddToRender(vtkRenderer* theRenderer) int i; // Update(); - for (i=0; iAddActor2D(mySBA[i]); } } @@ -266,7 +266,7 @@ void VISU_ScalarBarCtrl::AddToRender(vtkRenderer* theRenderer) //================================================================== void VISU_ScalarBarCtrl::RemoveFromRender(vtkRenderer* theRenderer) { - for (int i=0; iRemoveActor2D(mySBA[i]); } } diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx index f55ae051..dab82503 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.hxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.hxx @@ -123,7 +123,7 @@ protected: protected: int myMode; - //int myScalarBarNumber; + int myScalarBarNumber; int myScalarBarNumberMax; float myDistance, myL, myB, myPosition[2]; float myRangeLocal[2]; diff --git a/src/VISUGUI/Makefile.in b/src/VISUGUI/Makefile.in index 84579bf2..3e9f92da 100644 --- a/src/VISUGUI/Makefile.in +++ b/src/VISUGUI/Makefile.in @@ -69,8 +69,7 @@ LIB_SRC = VisuGUI.cxx \ 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 \ diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 5598166f..41f32151 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -268,12 +268,6 @@ msgstr "Show Table" 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" @@ -671,9 +665,6 @@ msgstr "X:" msgid "VisuGUI_ScalarBarPane::LBL_Y" msgstr "Y:" -msgid "VisuGUI_ScalarBarPane::LBL_SHOW_PREVIEW" -msgstr "Show preview" - msgid "VisuGUI_ScalarBarPane::DIMENSIONS_GRP" msgstr "Dimensions" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index def9b9fc..b3b56888 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -131,8 +131,6 @@ #include "VisuGUI_ActionsDef.h" -#include "VisuGUI_Timer.h" - using namespace VISU; #ifdef _DEBUG_ @@ -160,9 +158,6 @@ void VisuGUI:: OnImportFromFile() { - VisuGUI_Timer aTimer; - aTimer.Start(); - if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()"); CheckLock(GetCStudy(GetAppStudy(this))); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); @@ -178,7 +173,7 @@ OnImportFromFile() 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); @@ -206,9 +201,8 @@ OnImportFromFile() tr("ERR_ERROR_IN_THE_FILE"), tr("BUT_OK")); }else{ + application()->putInfo(aFileInfo.filePath() + tr("INF_DONE")); UpdateObjBrowser(this); - application()->putInfo(aFileInfo.filePath() + tr("INF_DONE") + - " in " + aTimer.GetTime() + " seconds", -1 ); } } } diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index b3b99f36..0a795733 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -55,9 +55,6 @@ #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 diff --git a/src/VISUGUI/VisuGUI_Timer.cxx b/src/VISUGUI/VisuGUI_Timer.cxx deleted file mode 100644 index ce88bbfc..00000000 --- a/src/VISUGUI/VisuGUI_Timer.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_Timer.cxx -// Module : SALOME - -#include "VisuGUI_Timer.h" - -#include "SUIT_Desktop.h" - -#include "utilities.h" - -#ifndef WNT -static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone)); -#else -//timezone *tz=_timezone; -#endif - -#ifndef CLK_TCK -# define CLK_TCK CLOCKS_PER_SEC -#endif - -VisuGUI_Timer::VisuGUI_Timer() : - Utils_Timer() -{ -} - -VisuGUI_Timer::~VisuGUI_Timer() -{ -} - -void VisuGUI_Timer::Start() -{ - if (Stopped) { - Stopped = 0; -#ifndef WNT - times(RefToInitialTMS); - gettimeofday(RefToInitialTimeB,tz); -#else - SYSTEMTIME st; - GetSystemTime(&st); - SystemTimeToFileTime(&st, RefToInitialTMS); - time(RefToCurrentTimeB); -#endif - } -} - -void VisuGUI_Timer::Stop() -{ - if (!Stopped) { -#ifndef WNT - times(RefToCurrentTMS); - int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime; - int diffr_sys = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime; - gettimeofday(RefToCurrentTimeB,tz); - - Cumul_user += (double) diffr_user / CLK_TCK ; - Cumul_sys += (double) diffr_sys / CLK_TCK ; -#else - SYSTEMTIME st; - GetSystemTime(&st); - SystemTimeToFileTime(&st, RefToCurrentTMS); - Cumul_user += (int)(((ULARGE_INTEGER*)(RefToCurrentTMS))->QuadPart - ((ULARGE_INTEGER*)(RefToInitialTMS))->QuadPart) / 10000000; - Cumul_sys = Cumul_user; - time(RefToCurrentTimeB); -#endif - Stopped = 1; - } -} - -void VisuGUI_Timer::Reset() { - Stopped = 1; - Cumul_user = Cumul_sys = 0. ; -} - -QString VisuGUI_Timer::GetTime() { - bool StopSav = Stopped; - if (!StopSav) Stop(); - - return QString::number( Cumul_user ); - - if (!StopSav) Start(); -} diff --git a/src/VISUGUI/VisuGUI_Timer.h b/src/VISUGUI/VisuGUI_Timer.h deleted file mode 100644 index bbfb7e57..00000000 --- a/src/VISUGUI/VisuGUI_Timer.h +++ /dev/null @@ -1,43 +0,0 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_Timer.h -// Module : SALOME - -#include - -#include - -class VisuGUI_Timer : public Utils_Timer -{ - public: - VisuGUI_Timer(); - virtual ~VisuGUI_Timer(); - - public: - void Start(); - void Stop(); - void Reset(); - - QString GetTime(); -}; diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 71b4bcef..5593929b 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -730,7 +730,7 @@ namespace VISU 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(aCollection,TIsSameEntry(theEntry))){ diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index f732ab23..8a12e3c7 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -203,7 +203,7 @@ namespace VISU 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(aCollection,TIsSameEntry(theEntry))){ diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index bad03e4f..4ce33ec5 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -107,8 +107,7 @@ LDFLAGS += \ $(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 \ @@ -129,38 +128,7 @@ LIBS+= -lboost_signals-mt \ -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 = diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index a47ea458..4c6e2dff 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -639,10 +639,10 @@ VISU::ColoredPrs3d_i } }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<CommitCommand(); diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index a387b2e5..f8157bfd 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -59,24 +59,21 @@ namespace VISU{ CreatePrs3d(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true) { + TPrs3d_i* aPresent = NULL; if(myStudyDocument->GetProperties()->IsLocked()) - return NULL; + return aPresent; typedef typename TPrs3d_i::TInterface TPrs3d; typename TPrs3d::_var_type aPrs3d; Mutex mt(myMutex); if(Result_i* pResult = dynamic_cast(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::TInterface::_var_type diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index cacc4046..c4049d7a 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -59,7 +59,9 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy, if (!CORBA::is_nil(theView3D)) { VISU::View3D_i* pView = dynamic_cast(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); } diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index be9223a3..92e46a57 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -49,6 +49,7 @@ #include "SPlot2d_ViewModel.h" #include "Plot2d_ViewFrame.h" +#include "Plot2d_ViewModel.h" #include "SalomeApp_Application.h" #include "SalomeApp_Study.h" @@ -211,7 +212,7 @@ namespace VISU { struct TSplitEvent: public SALOME_Event { SalomeApp_Application * myApplication; - SUIT_ViewWindow * myVW; + SUIT_ViewWindow * myViewWindow; Qt::Orientation myOrientation; QtxWorkstack::SplitType mySplitType; @@ -221,7 +222,7 @@ namespace VISU { Qt::Orientation theOrientation, QtxWorkstack::SplitType theSplitType): myApplication(theApplication), - myVW(theViewWindow), + myViewWindow(theViewWindow), myOrientation(theOrientation), mySplitType(theSplitType) {} @@ -233,7 +234,7 @@ namespace VISU { if (tabDesk) { QtxWorkstack* workstack = tabDesk->workstack(); if (workstack) { - workstack->Split(myVW, myOrientation, mySplitType); + workstack->Split(myViewWindow, myOrientation, mySplitType); } } } @@ -243,40 +244,32 @@ namespace VISU { 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 @@ -285,31 +278,29 @@ namespace VISU { { 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: @@ -318,8 +309,8 @@ namespace VISU { SUIT_ViewWindow * theViewWindow2, bool theAttractAll): myApplication(theApplication), - myVW1(theViewWindow1), - myVW2(theViewWindow2), + myViewWindow1(theViewWindow1), + myViewWindow2(theViewWindow2), myAttractAll(theAttractAll) {} @@ -330,7 +321,7 @@ namespace VISU { if (tabDesk) { QtxWorkstack* workstack = tabDesk->workstack(); if (workstack) { - workstack->Attract(myVW1, myVW2, myAttractAll); + workstack->Attract(myViewWindow1, myViewWindow2, myAttractAll); } } } @@ -342,12 +333,7 @@ namespace VISU { { if (!CORBA::is_nil(theView)) { if (VISU::View_i* pView = dynamic_cast(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)); } } } @@ -358,12 +344,7 @@ namespace VISU { { if (!CORBA::is_nil(theView)) { if (VISU::View_i* pView = dynamic_cast(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)); } } } @@ -371,7 +352,7 @@ namespace VISU { struct TSizePositionEvent: public SALOME_Event { SalomeApp_Application * myApplication; - SUIT_ViewWindow * myVW; + SUIT_ViewWindow * myViewWindow; double myValue; bool myIsSize; @@ -381,7 +362,7 @@ namespace VISU { double theValue, bool theIsSize): myApplication(theApplication), - myVW(theViewWindow), + myViewWindow(theViewWindow), myValue(theValue), myIsSize(theIsSize) {} @@ -395,9 +376,9 @@ namespace VISU { 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); } } } @@ -411,9 +392,7 @@ namespace VISU { 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 @@ -423,15 +402,13 @@ namespace VISU { 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; @@ -443,7 +420,7 @@ namespace VISU { double theValue, bool theIsSize): myApplication(theApplication), - myVW(theViewWindow), + myViewWindow(theViewWindow), myOrientation(theOrientation), myValue(theValue), myIsSize(theIsSize) @@ -458,9 +435,9 @@ namespace VISU { 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); } } } @@ -474,10 +451,8 @@ namespace VISU { 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 @@ -487,10 +462,8 @@ namespace VISU { 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 @@ -500,10 +473,8 @@ namespace VISU { 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 @@ -513,17 +484,15 @@ namespace VISU { 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; @@ -532,7 +501,7 @@ namespace VISU { TSetViewSize(SUIT_ViewWindow* theViewWindow, TAction theAction, CORBA::Long theSize): - myVW(theViewWindow), + myViewWindow(theViewWindow), myAction(theAction), mySize(theSize) {} @@ -541,7 +510,7 @@ namespace VISU { void Execute() { - if (QWidget* aParent = myVW->parentWidget(true)) { + if (QWidget* aParent = myViewWindow->parentWidget(true)) { QRect aQRect = aParent->frameGeometry(); (aQRect.*myAction)(mySize); aParent->setGeometry(aQRect); @@ -566,7 +535,7 @@ namespace VISU { struct TGetViewSize: public SALOME_Event { - SUIT_ViewWindow* myVW; + SUIT_ViewWindow* myViewWindow; typedef int (QRect::* TAction)() const; TAction myAction; @@ -577,7 +546,7 @@ namespace VISU { public: TGetViewSize(SUIT_ViewWindow* theViewWindow, TAction theAction): - myVW(theViewWindow), + myViewWindow(theViewWindow), myAction(theAction) {} @@ -585,7 +554,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)){ + if(QWidget* aParent = myViewWindow->parentWidget(true)){ QRect aQRect = aParent->frameGeometry(); myResult = (aQRect.*myAction)(); } @@ -611,13 +580,13 @@ namespace VISU { class TWorkspaceEvent: public SALOME_Event { protected: - QWidget* myVW; + QWidget* myViewWindow; QWidget* myWorkspace; public: TWorkspaceEvent(QWidget* theViewWindow, QWidget* theWorkspace): - myVW(theViewWindow), + myViewWindow(theViewWindow), myWorkspace(theWorkspace) {} }; @@ -640,7 +609,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)) + if(QWidget* aParent = myViewWindow->parentWidget(true)) SUIT_Tools::alignWidget(aParent,myWorkspace,myAligment); } }; @@ -721,7 +690,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)) + if(QWidget* aParent = myViewWindow->parentWidget(true)) aParent->move(int(myX*myWorkspace->width()),int(myY*myWorkspace->height())); } }; @@ -748,7 +717,7 @@ namespace VISU { void Execute() { - if(QWidget* aParent = myVW->parentWidget(true)) + if(QWidget* aParent = myViewWindow->parentWidget(true)) aParent->setGeometry(aParent->x(), aParent->y(), int(myX*myWorkspace->width()), @@ -784,9 +753,7 @@ namespace VISU { } }; - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - ProcessVoidEvent(new TEvent(aVW, theColor)); + ProcessVoidEvent(new TEvent(myViewWindow,theColor)); } @@ -815,42 +782,28 @@ namespace VISU { 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 @@ -885,13 +838,13 @@ namespace VISU { 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) { @@ -899,8 +852,8 @@ namespace VISU { virtual void Execute() { - if (myVW) { - QImage img = myVW->dumpView(); + if (myViewWindow) { + QImage img = myViewWindow->dumpView(); if (!img.isNull()) { QString fileName (myFileName); if (!fileName.isEmpty()) { @@ -909,7 +862,6 @@ namespace VISU { if (fmt == "JPG" ) fmt = "JPEG"; //QApplication::setOverrideCursor(Qt::waitCursor); img.save(fileName, fmt.latin1()); - myResult = true; //QApplication::restoreOverrideCursor(); } } @@ -920,11 +872,12 @@ namespace VISU { 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 ""; } @@ -935,40 +888,76 @@ namespace VISU { { } - SUIT_ViewWindow* View_i::GetViewWindow() - { - if (myViewWindow) { - QPtrVector 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 + 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(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) @@ -978,48 +967,27 @@ namespace VISU { 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(aVW); + if (myPlot2dView->myViewWindow) { + Plot2d_ViewWindow* aPlot2dVW = dynamic_cast(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() @@ -1030,13 +998,7 @@ namespace VISU { void XYPlot_i::Close() { //jfa: may be need to be enclosed in SALOME_Event? - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - aVW->close(); - //QPtrVector aViews = myViewManager->getViews(); - //int aPos = aViews.find(myViewWindow); - //if (aPos >= 0) - // myViewWindow->close(); + myViewWindow->close(); } XYPlot_i::~XYPlot_i() { @@ -1045,59 +1007,49 @@ namespace VISU { void XYPlot_i::SetTitle (const char* theTitle) { - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (aVW, &SUIT_ViewWindow::setCaption, QString(theTitle))); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (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 - (myView, &Plot2d_ViewFrame::setTitle, QString(theTitle))); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (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 - (myView,&Plot2d_ViewFrame::setCurveType,theType,true)); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (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 - (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true)); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (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 @@ -1119,24 +1071,21 @@ namespace VISU { 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 @@ -1159,31 +1108,26 @@ namespace VISU { 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 @@ -1204,33 +1148,28 @@ namespace VISU { 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 - (myView,&Plot2d_ViewFrame::showLegend,theShowing,true)); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (myView,&Plot2d_ViewFrame::showLegend,theShowing,true)); } class TXYPlotViewEvent: public SALOME_Event @@ -1298,87 +1237,29 @@ namespace VISU { 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 (myView,&Plot2d_ViewFrame::EraseAll)); + ProcessVoidEvent(new TVoidMemFunEvent (myView,&Plot2d_ViewFrame::EraseAll)); } void XYPlot_i::FitAll() { - if (GetViewWindow()) - ProcessVoidEvent(new TVoidMemFunEvent (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 (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) @@ -1479,19 +1360,22 @@ namespace VISU { : View_i(theApplication, NULL) { if (MYDEBUG) MESSAGE("View3D_i::View3D_i"); + if (theApplication) { + myViewManager = ProcessEvent(new TNewSpecViewEvent(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) {} @@ -1500,54 +1384,33 @@ namespace VISU { 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(); @@ -1560,22 +1423,15 @@ namespace VISU { } } } - 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(aSStudy)) { @@ -1585,7 +1441,7 @@ namespace VISU { 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(); @@ -1613,18 +1469,18 @@ namespace VISU { 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; @@ -1672,18 +1528,18 @@ namespace VISU { 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; @@ -1694,7 +1550,7 @@ namespace VISU { 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; @@ -1724,59 +1580,59 @@ namespace VISU { 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<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]); @@ -1784,21 +1640,13 @@ namespace VISU { 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 aViews = myViewManager->getViews(); - //int aPos = aViews.find(myViewWindow); - //if (aPos >= 0) - // myViewWindow->close(); + myViewWindow->close(); } View3D_i::~View3D_i() @@ -1808,21 +1656,17 @@ namespace VISU { void View3D_i::SetTitle (const char* theTitle) { - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) - ProcessVoidEvent(new TVoidMemFun1ArgEvent - (aVW,&SUIT_ViewWindow::setCaption,QString(theTitle))); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (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? @@ -1830,123 +1674,110 @@ namespace VISU { 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(VISU::GetServant(anObj).in()); - if (aVW && aPrs) - ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eErase)); + if(Prs3d_i* aPrs = dynamic_cast(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(VISU::GetServant(anObj).in()); - if (aVW && aPrs) - ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplay)); + if(Prs3d_i* aPrs = dynamic_cast(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(VISU::GetServant(anObj).in()); - if (aVW && aPrs) - ProcessVoidEvent(new TUpdateViewerEvent(aVW,aPrs,eDisplayOnly)); + if(Prs3d_i* aPrs = dynamic_cast(VISU::GetServant(anObj).in())){ + ProcessVoidEvent(new TUpdateViewerEvent(myViewWindow,aPrs,eDisplayOnly)); + } } void View3D_i::FitAll() { - SUIT_ViewWindow* aVW = GetViewWindow(); - if (aVW) { - ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll)); - Update(); - } + ProcessVoidEvent(new TVoidMemFunEvent + (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 - (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView)); + (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onFrontView)); break; case VISU::View3D::BACK : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView)); + (GetViewWindow(myViewWindow), &SVTK_ViewWindow::onBackView)); break; case VISU::View3D::LEFT : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView)); + (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onLeftView)); break; case VISU::View3D::RIGHT : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView)); + (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onRightView)); break; case VISU::View3D::TOP : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView)); + (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onTopView)); break; case VISU::View3D::BOTTOM : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView)); + (GetViewWindow(myViewWindow),&SVTK_ViewWindow::onBottomView)); break; } Update(); @@ -1955,199 +1786,181 @@ namespace VISU { 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)); } } diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index 76b44da5..ae1f245b 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -49,8 +49,15 @@ namespace VISU 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: @@ -108,18 +115,6 @@ namespace VISU 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; }; @@ -148,9 +143,9 @@ namespace VISU 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(); @@ -172,11 +167,6 @@ namespace VISU virtual void Update(); virtual void FitAll(); - virtual void FitXRange(const CORBA::Double xMin,const CORBA::Double xMax); - virtual void FitYRange(const CORBA::Double yMin,const CORBA::Double yMax); - virtual void FitRange(const CORBA::Double xMin,const CORBA::Double xMax, - const CORBA::Double yMin,const CORBA::Double yMax); - virtual void GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax); virtual void Close(); protected: @@ -225,10 +215,10 @@ namespace VISU 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(); @@ -241,54 +231,54 @@ namespace VISU 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(); diff --git a/src/VISU_SWIG/VISU_Example_01.py b/src/VISU_SWIG/VISU_Example_01.py deleted file mode 100644 index 82228544..00000000 --- a/src/VISU_SWIG/VISU_Example_01.py +++ /dev/null @@ -1,191 +0,0 @@ -# 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" diff --git a/src/VISU_SWIG/VISU_Example_02.py b/src/VISU_SWIG/VISU_Example_02.py deleted file mode 100644 index be71fa76..00000000 --- a/src/VISU_SWIG/VISU_Example_02.py +++ /dev/null @@ -1,348 +0,0 @@ -# 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" - diff --git a/src/VISU_SWIG/VISU_Example_03.py b/src/VISU_SWIG/VISU_Example_03.py deleted file mode 100644 index dfa066cc..00000000 --- a/src/VISU_SWIG/VISU_Example_03.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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" diff --git a/src/VISU_SWIG/VISU_Example_04.py b/src/VISU_SWIG/VISU_Example_04.py deleted file mode 100644 index a50a831a..00000000 --- a/src/VISU_SWIG/VISU_Example_04.py +++ /dev/null @@ -1,255 +0,0 @@ -# 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 diff --git a/src/VISU_SWIG/VISU_Example_05.py b/src/VISU_SWIG/VISU_Example_05.py deleted file mode 100644 index a70943e4..00000000 --- a/src/VISU_SWIG/VISU_Example_05.py +++ /dev/null @@ -1,77 +0,0 @@ -# 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) - -# ============================================================================ diff --git a/src/VISU_SWIG/VISU_Example_06.py b/src/VISU_SWIG/VISU_Example_06.py deleted file mode 100644 index f31b80e4..00000000 --- a/src/VISU_SWIG/VISU_Example_06.py +++ /dev/null @@ -1,61 +0,0 @@ -# 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) - -# ============================================================================ diff --git a/src/VISU_SWIG/batchmode_visu_view3d.py b/src/VISU_SWIG/batchmode_visu_view3d.py index f5154355..0d41aa6d 100644 --- a/src/VISU_SWIG/batchmode_visu_view3d.py +++ b/src/VISU_SWIG/batchmode_visu_view3d.py @@ -50,7 +50,7 @@ aMeshName ="LE VOLUME" anEntity = VISU.NODE aTimeStampId = 1 -medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile myResult = myVisu.ImportFile(medFile) @@ -240,7 +240,7 @@ time.sleep(aDelay) 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); diff --git a/src/VISU_SWIG/visu_delete.py b/src/VISU_SWIG/visu_delete.py index d001d601..b73173ca 100644 --- a/src/VISU_SWIG/visu_delete.py +++ b/src/VISU_SWIG/visu_delete.py @@ -12,7 +12,7 @@ aMeshName ="LE VOLUME" 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) diff --git a/src/VISU_SWIG/visu_med.py b/src/VISU_SWIG/visu_med.py index 04715e52..2a5532ae 100644 --- a/src/VISU_SWIG/visu_med.py +++ b/src/VISU_SWIG/visu_med.py @@ -42,7 +42,7 @@ def getFieldObjectFromStudy(number,subnumber): 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 diff --git a/src/VISU_SWIG/visu_prs_example.py b/src/VISU_SWIG/visu_prs_example.py index 1453c5ad..84d65be4 100644 --- a/src/VISU_SWIG/visu_prs_example.py +++ b/src/VISU_SWIG/visu_prs_example.py @@ -22,7 +22,7 @@ import visu_gui 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 diff --git a/src/VISU_SWIG/visu_swig_test.py b/src/VISU_SWIG/visu_swig_test.py index 411e532e..9946faba 100644 --- a/src/VISU_SWIG/visu_swig_test.py +++ b/src/VISU_SWIG/visu_swig_test.py @@ -1,5 +1,5 @@ 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() diff --git a/src/VISU_SWIG/visu_view3d.py b/src/VISU_SWIG/visu_view3d.py index d1bf0721..be807a71 100644 --- a/src/VISU_SWIG/visu_view3d.py +++ b/src/VISU_SWIG/visu_view3d.py @@ -50,7 +50,7 @@ aMeshName ="LE VOLUME" anEntity = VISU.NODE aTimeStampId = 1 -medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile +medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile myResult = myVisu.ImportFile(medFile) @@ -247,7 +247,7 @@ time.sleep(aDelay) 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); diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 142008d1..a54004e6 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -209,7 +209,7 @@ VVTK_Renderer1 { if(MYDEBUG) INFOS("VVTK_Renderer1() - "<SetPlaceFactor(1.1); + myImplicitFunctionWidget->SetPlaceFactor(1.0); myImplicitFunctionWidget->SetOutlineTranslation(false); vtkProperty* aSelectedPlaneProperty = myImplicitFunctionWidget->GetSelectedPlaneProperty(); vtkProperty* aPlaneProperty = myImplicitFunctionWidget->GetPlaneProperty();