]> SALOME platform Git repositories - modules/med.git/blob - src/MEDCalc/tui/medpresentation.py
Salome HOME
[MEDCalc] Fully functional scalar map (other pres deactivated)
[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, notifyGui_removePresentation
23
24 __manager = medcalc.medcorba.factory.getPresentationManager()
25
26 def MakeScalarMap(proxy,
27                   viewMode=MEDCALC.VIEW_MODE_DEFAULT,
28                   displayedComponent=MEDCALC.DISPLAY_DEFAULT,
29                   scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
30                   colorMap=MEDCALC.COLOR_MAP_DEFAULT
31                   ):
32   # Create the presentation instance in CORBA engine
33   # The engine in turn creates the ParaView pipeline elements
34   params = MEDCALC.ScalarMapParameters(proxy.id, displayedComponent, scalarBarRange, colorMap)
35   presentation_id = __manager.makeScalarMap(params, viewMode)
36   notifyGui_addPresentation(proxy.id, presentation_id)
37   return presentation_id
38 #
39
40 #def MakeContour(proxy,
41 #                viewMode=MEDCALC.VIEW_MODE_DEFAULT,
42 #                displayedComponent=MEDCALC.DISPLAY_DEFAULT,
43 #                scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
44 #                colorMap=MEDCALC.COLOR_MAP_DEFAULT,
45 #                nbContours=MEDCALC.NB_CONTOURS_DEFAULT
46 #                ):
47 #  params = MEDCALC.ContourParameters(proxy.id, viewMode, displayedComponent, scalarBarRange, colorMap, nbContours)
48 #  presentation_id = __manager.makeContour(params)
49 #  notifyGui_addPresentation(proxy.id, presentation_id)
50 #  return 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 #  return presentation_id
60 ##
61 #
62 #def MakeSlices(proxy,
63 #               viewMode=MEDCALC.VIEW_MODE_DEFAULT,
64 #               orientation=MEDCALC.SLICE_ORIENTATION_DEFAULT,
65 #               nbSlices=MEDCALC.NB_SLICES_DEFAULT
66 #               ):
67 #  params = MEDCALC.SlicesParameters(proxy.id, viewMode, orientation, nbSlices)
68 #  presentation_id = __manager.makeSlices(params)
69 #  notifyGui_addPresentation(proxy.id, presentation_id)
70 #  return presentation_id
71 ##
72 #
73 #def MakeDeflectionShape(proxy,
74 #                        viewMode=MEDCALC.VIEW_MODE_DEFAULT
75 #                        ):
76 #  params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
77 #  presentation_id = __manager.makeDeflectionShape(params)
78 #  notifyGui_addPresentation(proxy.id, presentation_id)
79 #  return presentation_id
80 ##
81 #
82 #def MakePointSprite(proxy,
83 #                    viewMode=MEDCALC.VIEW_MODE_DEFAULT,
84 #                    displayedComponent=MEDCALC.DISPLAY_DEFAULT,
85 #                    scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
86 #                    colorMap=MEDCALC.COLOR_MAP_DEFAULT,
87 #                    ):
88 #  params = MEDCALC.PointSpriteParameters(proxy.id, viewMode, displayedComponent, scalarBarRange, colorMap)
89 #  presentation_id = __manager.makePointSprite(params)
90 #  notifyGui_addPresentation(proxy.id, presentation_id)
91 #  return presentation_id
92 #
93
94 def RemovePresentation(presentation_id):
95   ok = __manager.removePresentation(presentation_id)
96   if ok:
97     notifyGui_removePresentation(presentation_id)
98 #
99
100 def GetScalarMapParameters(presentation_id):
101   # TODO: check that pres id is really a ScalarMap ...
102   params = __manager.getScalarMapParameters(presentation_id)
103   return params
104
105 def UpdateScalarMap(presentation_id, params):
106   __manager.updateScalarMap(presentation_id, params)