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

Diff of /trunk/pyvisi/py_src/streamline.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 lookuptable import LookupTable  from lookuptable import LookupTable
# Line 38  class StreamLine(DataSetMapper, Actor3D, Line 54  class StreamLine(DataSetMapper, Actor3D,
54          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
55          required, in order for the object to be rendered correctly.          required, in order for the object to be rendered correctly.
56          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
57          'True', otherwise 'False' (which is the default).          'True', otherwise 'False' (which is the default). On occasions, an
58            inaccurate object may be rendered from cell data even after conversion.
59    
60          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
61          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 57  class StreamLine(DataSetMapper, Actor3D, Line 74  class StreamLine(DataSetMapper, Actor3D,
74          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
75          """          """
76    
         self.__scene = scene  
77          self.__data_collector = data_collector          self.__data_collector = data_collector
78          self.__viewport = viewport          self.__viewport = viewport
79          self.__color_mode = color_mode          self.__color_mode = color_mode
# Line 90  class StreamLine(DataSetMapper, Actor3D, Line 106  class StreamLine(DataSetMapper, Actor3D,
106    
107              # Default line width is 1.              # Default line width is 1.
108              actor3D._setLineWidth(1)              actor3D._setLineWidth(1)
109              self.__scene._addActor3D(self.__viewport, actor3D._getActor3D())              scene._addActor3D(self.__viewport, actor3D._getActor3D())
110    
111          # ----- Streamline -----          # ----- Streamline -----
112    
# Line 122  class StreamLine(DataSetMapper, Actor3D, Line 138  class StreamLine(DataSetMapper, Actor3D,
138                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
139    
140          self._setupActor3D(self._getDataSetMapper())          self._setupActor3D(self._getDataSetMapper())
141          self.__scene._addActor3D(self.__viewport, self._getActor3D())          scene._addActor3D(self.__viewport, self._getActor3D())
142    
143      def _isModified(self):        def _isModified(self):  
144          """          """
# Line 134  class StreamLine(DataSetMapper, Actor3D, Line 150  class StreamLine(DataSetMapper, Actor3D,
150    
151          return self.__modified or self.__data_collector._isModified()          return self.__modified or self.__data_collector._isModified()
152    
153      def _render(self):      def _render(self, scene):
154          """          """
155          Render the streamline.          Render the streamline.
156    
157            @type scene: L{Scene <scene.Scene>} object
158            @param scene: Scene in which objects are to be rendered on
159          """          """
160    
161          if (self._isModified() == True):          if (self._isModified() == True):
# Line 156  class StreamLine(DataSetMapper, Actor3D, Line 175  class StreamLine(DataSetMapper, Actor3D,
175              if(self.__color_mode == ColorMode.VECTOR):                            if(self.__color_mode == ColorMode.VECTOR):              
176                  self._setScalarVisibilityOn()                  self._setScalarVisibilityOn()
177                  self._setSpeedScalarsOn()                  self._setSpeedScalarsOn()
178                  self._setScalarRange(self.__data_collector._getVectorRange())  
179                    # self._isScalarRangeSet checks whether the scalar range has
180                    # beenspecified by the user. If it has, then the scalar range
181                    # read from the source will be ignored.
182                    if(not(self._isScalarRangeSet())):
183                        self._setScalarRange(\
184                                self.__data_collector._getVectorRange())
185              # Color streamline by scalar.              # Color streamline by scalar.
186              elif(self.__color_mode == ColorMode.SCALAR):                              elif(self.__color_mode == ColorMode.SCALAR):                
187                  self._setScalarVisibilityOn()                  self._setScalarVisibilityOn()
188                  self._setSpeedScalarsOff()                  self._setSpeedScalarsOff()
189                  self._setScalarRange(self.__data_collector._getScalarRange())  
190                    # self._isScalarRangeSet checks whether the scalar range has
191                    # beenspecified by the user. If it has, then the scalar range
192                    # read from the source will be ignored.
193                    if(not(self._isScalarRangeSet())):
194                        self._setScalarRange(\
195                                self.__data_collector._getScalarRange())
196    
197              self.__modified = False              self.__modified = False
198    

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

  ViewVC Help
Powered by ViewVC 1.1.26