1 # Copyright (C) 2011-2016 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 import MEDCALC, SALOME
22 from medcalc.medevents import notifyGui_addPresentation, notifyGui_removePresentation, notifyGui_error
24 __manager = medcalc.medcorba.factory.getPresentationManager()
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
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)
36 presentation_id = __manager.makeScalarMap(params, viewMode)
37 notifyGui_addPresentation(proxy.id, presentation_id)
38 return presentation_id
39 except SALOME.SALOME_Exception as e:
40 notifyGui_error("An error occured while creating the scalar map:\n" + e.details.text)
41 raise Exception(e.details.text)
43 def MakeContour(proxy,
44 viewMode=MEDCALC.VIEW_MODE_DEFAULT,
45 displayedComponent=MEDCALC.DISPLAY_DEFAULT,
46 scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
47 colorMap=MEDCALC.COLOR_MAP_DEFAULT,
48 nbContours=MEDCALC.NB_CONTOURS_DEFAULT
50 params = MEDCALC.ContourParameters(proxy.id, scalarBarRange, colorMap, nbContours)
52 presentation_id = __manager.makeContour(params, viewMode)
53 notifyGui_addPresentation(proxy.id, presentation_id)
54 return presentation_id
55 except SALOME.SALOME_Exception as e:
56 notifyGui_error("An error occured while creating the contour:\n" + e.details.text)
57 raise Exception(e.details.text)
61 #def MakeVectorField(proxy,
62 # viewMode=MEDCALC.VIEW_MODE_DEFAULT
64 # params = MEDCALC.VectorFieldParameters(proxy.id, viewMode)
65 # presentation_id = __manager.makeVectorField(params)
66 # notifyGui_addPresentation(proxy.id, presentation_id)
67 # return presentation_id
70 #def MakeSlices(proxy,
71 # viewMode=MEDCALC.VIEW_MODE_DEFAULT,
72 # orientation=MEDCALC.SLICE_ORIENTATION_DEFAULT,
73 # nbSlices=MEDCALC.NB_SLICES_DEFAULT
75 # params = MEDCALC.SlicesParameters(proxy.id, viewMode, orientation, nbSlices)
76 # presentation_id = __manager.makeSlices(params)
77 # notifyGui_addPresentation(proxy.id, presentation_id)
78 # return presentation_id
81 #def MakeDeflectionShape(proxy,
82 # viewMode=MEDCALC.VIEW_MODE_DEFAULT
84 # params = MEDCALC.DeflectionShapeParameters(proxy.id, viewMode)
85 # presentation_id = __manager.makeDeflectionShape(params)
86 # notifyGui_addPresentation(proxy.id, presentation_id)
87 # return presentation_id
90 #def MakePointSprite(proxy,
91 # viewMode=MEDCALC.VIEW_MODE_DEFAULT,
92 # displayedComponent=MEDCALC.DISPLAY_DEFAULT,
93 # scalarBarRange=MEDCALC.SCALAR_BAR_RANGE_DEFAULT,
94 # colorMap=MEDCALC.COLOR_MAP_DEFAULT,
96 # params = MEDCALC.PointSpriteParameters(proxy.id, viewMode, displayedComponent, scalarBarRange, colorMap)
97 # presentation_id = __manager.makePointSprite(params)
98 # notifyGui_addPresentation(proxy.id, presentation_id)
99 # return presentation_id
102 def RemovePresentation(presentation_id):
103 ok = __manager.removePresentation(presentation_id)
105 notifyGui_removePresentation(presentation_id)
108 def GetScalarMapParameters(presentation_id):
109 # TODO: check that pres id is really a ScalarMap ...
110 params = __manager.getScalarMapParameters(presentation_id)
113 def GetContourParameters(presentation_id):
114 # TODO: check that pres id is really a ScalarMap ...
115 params = __manager.getContourParameters(presentation_id)
118 def UpdateScalarMap(presentation_id, params):
119 __manager.updateScalarMap(presentation_id, params)
121 def UpdateContour(presentation_id, params):
122 __manager.updateContour(presentation_id, params)