Salome HOME
[MEDCalc] Add presentation parameters
[modules/med.git] / src / MEDCalc / tui / medpresentation.py
1 # Copyright (C) 2011-2016  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 import medcalc
21 import MEDCALC
22 from medcalc.medevents import notifyGui_addPresentation
23
24 __manager = medcalc.medcorba.factory.getPresentationManager()
25
26 def MakeScalarMap(proxy,
27                   viewMode=MEDCALC.VIEW_MODE_DEFAULT,
28                   displayedInfo=MEDCALC.DISPLAY_DEFAULT,
29                   scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
30                                                         MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
31                   colorMap=MEDCALC.COLOR_MAP_DEFAULT
32                   ):
33   # Create the presentation instance in CORBA engine
34   # The engine in turn creates the ParaView pipeline elements
35   params = MEDCALC.ScalarMapParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
36   presentation_id = __manager.makeScalarMap(params)
37   notifyGui_addPresentation(proxy.id, presentation_id)
38 #
39
40 def MakeContour(proxy,
41                 viewMode=MEDCALC.VIEW_MODE_DEFAULT,
42                 displayedInfo=MEDCALC.DISPLAY_DEFAULT,
43                 scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
44                                                       MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
45                 colorMap=MEDCALC.COLOR_MAP_DEFAULT,
46                 nbContours=MEDCALC.NB_CONTOURS_DEFAULT
47                 ):
48   params = MEDCALC.ContourParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap, nbContours)
49   presentation_id = __manager.makeContour(params)
50   notifyGui_addPresentation(proxy.id, presentation_id)
51 #
52
53 def MakeVectorField(proxy,
54                     viewMode=MEDCALC.VIEW_MODE_DEFAULT
55                     ):
56   params = MEDCALC.VectorFieldParameters(proxy.id, viewMode)
57   presentation_id = __manager.makeVectorField(params)
58   notifyGui_addPresentation(proxy.id, presentation_id)
59 #
60
61 def MakeSlices(proxy,
62                viewMode=MEDCALC.VIEW_MODE_DEFAULT,
63                orientation=MEDCALC.SLICE_ORIENTATION_DEFAULT,
64                nbSlices=MEDCALC.NB_SLICES_DEFAULT
65                ):
66   params = MEDCALC.SlicesParameters(proxy.id, viewMode, orientation, nbSlices)
67   presentation_id = __manager.makeSlices(params)
68   notifyGui_addPresentation(proxy.id, presentation_id)
69 #
70
71 def MakeDeflectionShape(proxy,
72                         viewMode=MEDCALC.VIEW_MODE_DEFAULT
73                         ):
74   params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
75   presentation_id = __manager.makeDeflectionShape(params)
76   notifyGui_addPresentation(proxy.id, presentation_id)
77 #
78
79 def MakePointSprite(proxy,
80                     viewMode=MEDCALC.VIEW_MODE_DEFAULT,
81                     displayedInfo=MEDCALC.DISPLAY_DEFAULT,
82                     scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
83                                                           MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
84                     colorMap=MEDCALC.COLOR_MAP_DEFAULT,
85                     ):
86   params = MEDCALC.PointSpriteParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
87   presentation_id = __manager.makePointSprite(params)
88   notifyGui_addPresentation(proxy.id, presentation_id)
89 #