/[escript]/trunk/pyvisi/py_src/contour.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/contour.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1148 by jongui, Wed May 16 22:45:33 2007 UTC revision 1197 by jongui, Mon Jun 18 02:08:34 2007 UTC
# Line 1  Line 1 
1  """  """
2  @author: John NGUI  @var __author__: name of author
3    @var __copyright__: copyrights
4    @var __license__: licence agreement
5    @var __url__: url entry point on documentation
6    @var __version__: version
7    @var __date__: date of the version
8  """  """
9    
10    __author__="John Ngui, john.ngui@uq.edu.au"
11    __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
12                        http://www.access.edu.au
13                    Primary Business: Queensland, Australia"""
14    __license__="""Licensed under the Open Software License version 3.0
15                 http://www.opensource.org/licenses/osl-3.0.php"""
16    __url__="http://www.iservo.edu.au/esys"
17    __version__="$Revision$"
18    __date__="$Date$"
19    
20    
21  import vtk  import vtk
22  from mapper import DataSetMapper  from mapper import DataSetMapper
23  from actor import Actor3D  from actor import Actor3D
# Line 49  class Contour(DataSetMapper, Actor3D, Co Line 65  class Contour(DataSetMapper, Actor3D, Co
65          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
66          """          """
67    
         self.__scene = scene  
68          self.__data_collector = data_collector          self.__data_collector = data_collector
69          self.__viewport = viewport          self.__viewport = viewport
70          self.__lut = lut          self.__lut = lut
# Line 78  class Contour(DataSetMapper, Actor3D, Co Line 93  class Contour(DataSetMapper, Actor3D, Co
93    
94              # Default line width is 1.              # Default line width is 1.
95              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
96              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
97    
98          # ----- Contour -----          # ----- Contour -----
99    
# Line 104  class Contour(DataSetMapper, Actor3D, Co Line 119  class Contour(DataSetMapper, Actor3D, Co
119                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
120    
121          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
122          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
123            
124      def _isModified(self):        def _isModified(self):  
125          """          """
# Line 116  class Contour(DataSetMapper, Actor3D, Co Line 131  class Contour(DataSetMapper, Actor3D, Co
131    
132          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
133    
134      def _render(self):      def _render(self, scene):
135          """          """
136          Render the contour.          Render the contour.
137    
138            @type scene: L{Scene <scene.Scene>} object
139            @param scene: Scene in which objects are to be rendered on
140          """          """
141    
142          if (self._isModified() == True):          if (self._isModified() == True):
# Line 141  class Contour(DataSetMapper, Actor3D, Co Line 159  class Contour(DataSetMapper, Actor3D, Co
159              self.generateContours(contours, lower_range, upper_range)              self.generateContours(contours, lower_range, upper_range)
160              self._generateContours()              self._generateContours()
161                                                    
162              self._setScalarRange(self.__data_collector._getScalarRange())              # self._isScalarRangeSet checks whether the scalar range has been
163                # specified by the user. If it has, then the scalar range
164                # read from the source will be ignored.
165                if(not(self._isScalarRangeSet())):
166                    self._setScalarRange(self.__data_collector._getScalarRange())
167              self.__modified = False              self.__modified = False
168    
169    
# Line 191  class ContourOnPlaneCut(DataSetMapper, A Line 213  class ContourOnPlaneCut(DataSetMapper, A
213          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
214          """          """
215    
         self.__scene = scene  
216          self.__data_collector = data_collector          self.__data_collector = data_collector
217          self.__viewport = viewport          self.__viewport = viewport
218          self.__lut = lut          self.__lut = lut
# Line 224  class ContourOnPlaneCut(DataSetMapper, A Line 245  class ContourOnPlaneCut(DataSetMapper, A
245    
246              # Default line width is 1.              # Default line width is 1.
247              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
248              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
249    
250          # ----- Contour on a cut plane -----          # ----- Contour on a cut plane -----
251    
# Line 252  class ContourOnPlaneCut(DataSetMapper, A Line 273  class ContourOnPlaneCut(DataSetMapper, A
273                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
274    
275          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
276          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
277            
278      def _isModified(self):        def _isModified(self):  
279          """          """
# Line 264  class ContourOnPlaneCut(DataSetMapper, A Line 285  class ContourOnPlaneCut(DataSetMapper, A
285    
286          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
287    
288      def _render(self):      def _render(self, scene):
289          """          """
290          Render the contour cut using a plane.          Render the contour cut using a plane.
291    
292            @type scene: L{Scene <scene.Scene>} object
293            @param scene: Scene in which objects are to be rendered on
294          """          """
295    
296          if (self._isModified() == True):          if (self._isModified() == True):
# Line 289  class ContourOnPlaneCut(DataSetMapper, A Line 313  class ContourOnPlaneCut(DataSetMapper, A
313              self.generateContours(contours, lower_range, upper_range)              self.generateContours(contours, lower_range, upper_range)
314              self._generateContours()              self._generateContours()
315                                                    
316              self._setScalarRange(self.__data_collector._getScalarRange())              # self._isScalarRangeSet checks whether the scalar range has been
317                # specified by the user. If it has, then the scalar range
318                # read from the source will be ignored.
319                if(not(self._isScalarRangeSet())):
320                    self._setScalarRange(self.__data_collector._getScalarRange())
321              self.__modified = False              self.__modified = False
322    
323    
# Line 338  class ContourOnPlaneClip(DataSetMapper, Line 366  class ContourOnPlaneClip(DataSetMapper,
366          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
367          """          """
368    
         self.__scene = scene  
369          self.__data_collector = data_collector          self.__data_collector = data_collector
370          self.__viewport = viewport          self.__viewport = viewport
371          self.__lut = lut          self.__lut = lut
# Line 371  class ContourOnPlaneClip(DataSetMapper, Line 398  class ContourOnPlaneClip(DataSetMapper,
398    
399              # Default line width is 1.              # Default line width is 1.
400              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
401              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
402    
403          # ----- Contour on a clipped plane -----          # ----- Contour on a clipped plane -----
404    
# Line 402  class ContourOnPlaneClip(DataSetMapper, Line 429  class ContourOnPlaneClip(DataSetMapper,
429                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
430    
431          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
432          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
433            
434      def _isModified(self):        def _isModified(self):  
435          """          """
436          Return whether the ContourOnPlaneClip or DataCollector has been modified.          Return whether the ContourOnPlaneClip or DataCollector has been
437            modified.
438    
439          @rtype: Boolean          @rtype: Boolean
440          @return: True or False          @return: True or False
# Line 414  class ContourOnPlaneClip(DataSetMapper, Line 442  class ContourOnPlaneClip(DataSetMapper,
442    
443          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
444    
445      def _render(self):      def _render(self, scene):
446          """          """
447          Render the contour clip using a plane.          Render the contour clip using a plane.
448    
449            @type scene: L{Scene <scene.Scene>} object
450            @param scene: Scene in which objects are to be rendered on
451          """          """
452    
453          if (self._isModified() == True):          if (self._isModified() == True):
# Line 439  class ContourOnPlaneClip(DataSetMapper, Line 470  class ContourOnPlaneClip(DataSetMapper,
470              self.generateContours(contours, lower_range, upper_range)              self.generateContours(contours, lower_range, upper_range)
471              self._generateContours()              self._generateContours()
472                                                    
473              self._setScalarRange(self.__data_collector._getScalarRange())              # self._isScalarRangeSet checks whether the scalar range has been
474                # specified by the user. If it has, then the scalar range
475                # read from the source will be ignored.
476                if(not(self._isScalarRangeSet())):
477                    self._setScalarRange(self.__data_collector._getScalarRange())
478              self.__modified = False              self.__modified = False
479    
480    

Legend:
Removed from v.1148  
changed lines
  Added in v.1197

  ViewVC Help
Powered by ViewVC 1.1.26