/[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 1199 by jongui, Wed Jun 20 05:01:30 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 32  class Contour(DataSetMapper, Actor3D, Co Line 48  class Contour(DataSetMapper, Actor3D, Co
48          source is cell data, a conversion to point data may or may not be          source is cell data, a conversion to point data may or may not be
49          required, in order for the object to be rendered correctly.          required, in order for the object to be rendered correctly.
50          If a conversion is needed, the 'cell_to_point' flag must be set to          If a conversion is needed, the 'cell_to_point' flag must be set to
51          'True', otherwise 'False' (which is the default).          'True', otherwise 'False' (which is the default). On occasions, an
52            inaccurate object may be rendered from cell data even after conversion.
53    
54          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
55          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 49  class Contour(DataSetMapper, Actor3D, Co Line 66  class Contour(DataSetMapper, Actor3D, Co
66          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
67          """          """
68    
         self.__scene = scene  
69          self.__data_collector = data_collector          self.__data_collector = data_collector
70          self.__viewport = viewport          self.__viewport = viewport
71          self.__lut = lut          self.__lut = lut
# Line 78  class Contour(DataSetMapper, Actor3D, Co Line 94  class Contour(DataSetMapper, Actor3D, Co
94    
95              # Default line width is 1.              # Default line width is 1.
96              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
97              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
98    
99          # ----- Contour -----          # ----- Contour -----
100    
# Line 104  class Contour(DataSetMapper, Actor3D, Co Line 120  class Contour(DataSetMapper, Actor3D, Co
120                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
121    
122          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
123          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
124            
125      def _isModified(self):        def _isModified(self):  
126          """          """
# Line 116  class Contour(DataSetMapper, Actor3D, Co Line 132  class Contour(DataSetMapper, Actor3D, Co
132    
133          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
134    
135      def _render(self):      def _render(self, scene):
136          """          """
137          Render the contour.          Render the contour.
138    
139            @type scene: L{Scene <scene.Scene>} object
140            @param scene: Scene in which objects are to be rendered on
141          """          """
142    
143          if (self._isModified() == True):          if (self._isModified() == True):
# Line 141  class Contour(DataSetMapper, Actor3D, Co Line 160  class Contour(DataSetMapper, Actor3D, Co
160              self.generateContours(contours, lower_range, upper_range)              self.generateContours(contours, lower_range, upper_range)
161              self._generateContours()              self._generateContours()
162                                                    
163              self._setScalarRange(self.__data_collector._getScalarRange())              # self._isScalarRangeSet checks whether the scalar range has been
164                # specified by the user. If it has, then the scalar range
165                # read from the source will be ignored.
166                if(not(self._isScalarRangeSet())):
167                    self._setScalarRange(self.__data_collector._getScalarRange())
168              self.__modified = False              self.__modified = False
169    
170    
# Line 191  class ContourOnPlaneCut(DataSetMapper, A Line 214  class ContourOnPlaneCut(DataSetMapper, A
214          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
215          """          """
216    
         self.__scene = scene  
217          self.__data_collector = data_collector          self.__data_collector = data_collector
218          self.__viewport = viewport          self.__viewport = viewport
219          self.__lut = lut          self.__lut = lut
# Line 224  class ContourOnPlaneCut(DataSetMapper, A Line 246  class ContourOnPlaneCut(DataSetMapper, A
246    
247              # Default line width is 1.              # Default line width is 1.
248              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
249              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
250    
251          # ----- Contour on a cut plane -----          # ----- Contour on a cut plane -----
252    
# Line 252  class ContourOnPlaneCut(DataSetMapper, A Line 274  class ContourOnPlaneCut(DataSetMapper, A
274                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
275    
276          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
277          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
278            
279      def _isModified(self):        def _isModified(self):  
280          """          """
# Line 264  class ContourOnPlaneCut(DataSetMapper, A Line 286  class ContourOnPlaneCut(DataSetMapper, A
286    
287          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
288    
289      def _render(self):      def _render(self, scene):
290          """          """
291          Render the contour cut using a plane.          Render the contour cut using a plane.
292    
293            @type scene: L{Scene <scene.Scene>} object
294            @param scene: Scene in which objects are to be rendered on
295          """          """
296    
297          if (self._isModified() == True):          if (self._isModified() == True):
# Line 289  class ContourOnPlaneCut(DataSetMapper, A Line 314  class ContourOnPlaneCut(DataSetMapper, A
314              self.generateContours(contours, lower_range, upper_range)              self.generateContours(contours, lower_range, upper_range)
315              self._generateContours()              self._generateContours()
316                                                    
317              self._setScalarRange(self.__data_collector._getScalarRange())              # self._isScalarRangeSet checks whether the scalar range has been
318                # specified by the user. If it has, then the scalar range
319                # read from the source will be ignored.
320                if(not(self._isScalarRangeSet())):
321                    self._setScalarRange(self.__data_collector._getScalarRange())
322              self.__modified = False              self.__modified = False
323    
324    
# Line 338  class ContourOnPlaneClip(DataSetMapper, Line 367  class ContourOnPlaneClip(DataSetMapper,
367          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
368          """          """
369    
         self.__scene = scene  
370          self.__data_collector = data_collector          self.__data_collector = data_collector
371          self.__viewport = viewport          self.__viewport = viewport
372          self.__lut = lut          self.__lut = lut
# Line 371  class ContourOnPlaneClip(DataSetMapper, Line 399  class ContourOnPlaneClip(DataSetMapper,
399    
400              # Default line width is 1.              # Default line width is 1.
401              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
402              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
403    
404          # ----- Contour on a clipped plane -----          # ----- Contour on a clipped plane -----
405    
# Line 402  class ContourOnPlaneClip(DataSetMapper, Line 430  class ContourOnPlaneClip(DataSetMapper,
430                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
431    
432          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
433          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
434            
435      def _isModified(self):        def _isModified(self):  
436          """          """
437          Return whether the ContourOnPlaneClip or DataCollector has been modified.          Return whether the ContourOnPlaneClip or DataCollector has been
438            modified.
439    
440          @rtype: Boolean          @rtype: Boolean
441          @return: True or False          @return: True or False
# Line 414  class ContourOnPlaneClip(DataSetMapper, Line 443  class ContourOnPlaneClip(DataSetMapper,
443    
444          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
445    
446      def _render(self):      def _render(self, scene):
447          """          """
448          Render the contour clip using a plane.          Render the contour clip using a plane.
449    
450            @type scene: L{Scene <scene.Scene>} object
451            @param scene: Scene in which objects are to be rendered on
452          """          """
453    
454          if (self._isModified() == True):          if (self._isModified() == True):
# Line 439  class ContourOnPlaneClip(DataSetMapper, Line 471  class ContourOnPlaneClip(DataSetMapper,
471              self.generateContours(contours, lower_range, upper_range)              self.generateContours(contours, lower_range, upper_range)
472              self._generateContours()              self._generateContours()
473                                                    
474              self._setScalarRange(self.__data_collector._getScalarRange())              # self._isScalarRangeSet checks whether the scalar range has been
475                # specified by the user. If it has, then the scalar range
476                # read from the source will be ignored.
477                if(not(self._isScalarRangeSet())):
478                    self._setScalarRange(self.__data_collector._getScalarRange())
479              self.__modified = False              self.__modified = False
480    
481    

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

  ViewVC Help
Powered by ViewVC 1.1.26