Salome HOME
[MEDCalc] Show object info (ids) in OB
[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   return presentation_id
39 #
40
41 def MakeContour(proxy,
42                 viewMode=MEDCALC.VIEW_MODE_DEFAULT,
43                 displayedInfo=MEDCALC.DISPLAY_DEFAULT,
44                 scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
45                                                       MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
46                 colorMap=MEDCALC.COLOR_MAP_DEFAULT,
47                 nbContours=MEDCALC.NB_CONTOURS_DEFAULT
48                 ):
49   params = MEDCALC.ContourParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap, nbContours)
50   presentation_id = __manager.makeContour(params)
51   notifyGui_addPresentation(proxy.id, presentation_id)
52   return presentation_id
53 #
54
55 def MakeVectorField(proxy,
56                     viewMode=MEDCALC.VIEW_MODE_DEFAULT
57                     ):
58   params = MEDCALC.VectorFieldParameters(proxy.id, viewMode)
59   presentation_id = __manager.makeVectorField(params)
60   notifyGui_addPresentation(proxy.id, presentation_id)
61   return presentation_id
62 #
63
64 def MakeSlices(proxy,
65                viewMode=MEDCALC.VIEW_MODE_DEFAULT,
66                orientation=MEDCALC.SLICE_ORIENTATION_DEFAULT,
67                nbSlices=MEDCALC.NB_SLICES_DEFAULT
68                ):
69   params = MEDCALC.SlicesParameters(proxy.id, viewMode, orientation, nbSlices)
70   presentation_id = __manager.makeSlices(params)
71   notifyGui_addPresentation(proxy.id, presentation_id)
72   return presentation_id
73 #
74
75 def MakeDeflectionShape(proxy,
76                         viewMode=MEDCALC.VIEW_MODE_DEFAULT
77                         ):
78   params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
79   presentation_id = __manager.makeDeflectionShape(params)
80   notifyGui_addPresentation(proxy.id, presentation_id)
81   return presentation_id
82 #
83
84 def MakePointSprite(proxy,
85                     viewMode=MEDCALC.VIEW_MODE_DEFAULT,
86                     displayedInfo=MEDCALC.DISPLAY_DEFAULT,
87                     scalarBarRange=MEDCALC.ScalarBarRange(MEDCALC.SCALAR_BAR_RANGE_VAL_MIN_DEFAULT,
88                                                           MEDCALC.SCALAR_BAR_RANGE_VAL_MAX_DEFAULT),
89                     colorMap=MEDCALC.COLOR_MAP_DEFAULT,
90                     ):
91   params = MEDCALC.PointSpriteParameters(proxy.id, viewMode, displayedInfo, scalarBarRange, colorMap)
92   presentation_id = __manager.makePointSprite(params)
93   notifyGui_addPresentation(proxy.id, presentation_id)
94   return presentation_id
95 #