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

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

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

revision 946 by jongui, Tue Jan 30 22:34:27 2007 UTC revision 947 by jongui, Wed Jan 31 07:17:43 2007 UTC
# Line 14  from outline import Outline Line 14  from outline import Outline
14  from point import StructuredPoints  from point import StructuredPoints
15  from probe import Probe  from probe import Probe
16    
17  # NOTE: DataSetMapper, Actor3D, Sphere, Normals and TensorGlyph were inherited  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,
18  # to allow access to their public methods from the driver.  # StructuredPoints and Probe  were inherited to allow access to their
19  class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, StructuredPoints, Probe):  # public methods from the driver.
20    class Ellipsoid(DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph,
21            StructuredPoints, Probe):
22      """      """
23      Class that show a tensor field using ellipsoid.      Class that show a tensor field using ellipsoid.
24      """      """
25            
26      # The SOUTH_WEST default viewport is used when there is only one viewport.      # The SOUTH_WEST default viewport is used when there is only one viewport.
27      # This saves the user from specifying the viewport when there is only one.      # This saves the user from specifying the viewport when there is only one.
28      # If no vector field is specified, the first encountered in the file will      # If no tensor field is specified, the first encountered in the file will
29      # be loaded automatically.      # be loaded automatically. If no lut is specified, the color scheme will
30        # be used.
31      def __init__(self, scene, data_collector, tensor = None,      def __init__(self, scene, data_collector, tensor = None,
32              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):
33    
# Line 37  class Ellipsoid(DataSetMapper, Actor3D, Line 40  class Ellipsoid(DataSetMapper, Actor3D,
40          @type tensor: String          @type tensor: String
41          @param tensor: Tensor field to load from the source file          @param tensor: Tensor field to load from the source file
42          @type viewport: L{Viewport <constant.Viewport>} constant          @type viewport: L{Viewport <constant.Viewport>} constant
43          @param viewport: Viewport in which the object is to be rendered on          @param viewport: Viewport in which objects are to be rendered on
44          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
45          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
46          @type outline: Boolean          @type outline: Boolean
# Line 62  class Ellipsoid(DataSetMapper, Actor3D, Line 65  class Ellipsoid(DataSetMapper, Actor3D,
65              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
66              # Default outline color is black.              # Default outline color is black.
67              Actor3D.setColor(self, Color.BLACK)              Actor3D.setColor(self, Color.BLACK)
68    
69              # Default line width is 1.              # Default line width is 1.
70              Actor3D._setLineWidth(self, 1)              Actor3D._setLineWidth(self, 1)
71              scene._addActor3D(viewport, Actor3D._getActor3D(self))              scene._addActor3D(viewport, Actor3D._getActor3D(self))
72    
   
73          # ----- Ellipsoid -----          # ----- Ellipsoid -----
74    
75          if(tensor != None):          if(tensor != None):
# Line 87  class Ellipsoid(DataSetMapper, Actor3D, Line 90  class Ellipsoid(DataSetMapper, Actor3D,
90                  StructuredPoints._getStructuredPoints(self))                  StructuredPoints._getStructuredPoints(self))
91    
92          Sphere.__init__(self)          Sphere.__init__(self)
         #TensorGlyph.__init__(self, data_collector._getOutput(),  
93          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, Probe._getOutput(self),
94                  Sphere._getOutput(self))                  Sphere._getOutput(self))
95          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
96    
97          DataSetMapper.__init__(self, Normals._getOutput(self),          DataSetMapper.__init__(self, Normals._getOutput(self),
98                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
   
99          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
100    
101          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
102          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
103    
104    
105    ###############################################################################
106    
107    
108  from transform import Transform  from transform import Transform
109  from plane import Plane  from plane import Plane
110  from cutter import Cutter  from cutter import Cutter
111    
112  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
113  # and Cutter were inherited to allow access to their public methods from  # Cutter, StructuredPoints and Probe were inherited to allow access to
114  # the driver.  # their public methods from the driver.
115  class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneCut(DataSetMapper, Actor3D, Sphere, Normals,  
116      TensorGlyph, Transform, Plane, Cutter, StructuredPoints, Probe):      TensorGlyph, Transform, Plane, Cutter, StructuredPoints, Probe):
117      """      """
118      Class that show a tensor field using ellipsoids on a plane.      Class that show a tensor field using ellipsoids on a cut plane.
119      """      """
120    
121      # The SOUTH_WEST default viewport is used when there is only one viewport.      # The SOUTH_WEST default viewport is used when there is only one viewport.
122      # This saves the user from specifying the viewport when there is only one.      # This saves the user from specifying the viewport when there is only one.
123      # If no vector field is specified, the first encountered in the file will      # If no vector field is specified, the first encountered in the file will
124      # be loaded automatically.      # be loaded automatically. If no lut is specified, the color scheme will
125        # be used.
126      def __init__(self, scene, data_collector, tensor = None,      def __init__(self, scene, data_collector, tensor = None,
127              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):
128    
# Line 130  class EllipsoidOnPlaneCut(DataSetMapper, Line 135  class EllipsoidOnPlaneCut(DataSetMapper,
135          @type tensor: String          @type tensor: String
136          @param tensor: Tensor field to load from the source file          @param tensor: Tensor field to load from the source file
137          @type viewport: L{Viewport <constant.Viewport>} constant          @type viewport: L{Viewport <constant.Viewport>} constant
138          @param viewport: Viewport in which the object is to be rendered on          @param viewport: Viewport in which objects are to be rendered on
139          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
140          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
141          @type outline: Boolean          @type outline: Boolean
# Line 150  class EllipsoidOnPlaneCut(DataSetMapper, Line 155  class EllipsoidOnPlaneCut(DataSetMapper,
155    
156          if(outline == True):          if(outline == True):
157              outline = Outline(data_collector._getOutput())              outline = Outline(data_collector._getOutput())
158          DataSetMapper.__init__(self, outline._getOutput())              DataSetMapper.__init__(self, outline._getOutput())
159    
160          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
161          # Default outline color is black.              # Default outline color is black.
162          Actor3D.setColor(self, Color.BLACK)              Actor3D.setColor(self, Color.BLACK)
         # Default line width is 1.  
         Actor3D._setLineWidth(self, 1)  
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  
163    
164                # Default line width is 1.
165                Actor3D._setLineWidth(self, 1)
166                scene._addActor3D(viewport, Actor3D._getActor3D(self))
167    
168          # ----- Ellipsoid on a plane -----          # ----- Ellipsoid on a cut plane -----
169    
170          if(tensor != None):          if(tensor != None):
171              data_collector._setActiveTensor(tensor)              data_collector._setActiveTensor(tensor)
# Line 182  class EllipsoidOnPlaneCut(DataSetMapper, Line 187  class EllipsoidOnPlaneCut(DataSetMapper,
187          Probe.__init__(self, data_collector._getOutput(),          Probe.__init__(self, data_collector._getOutput(),
188                  StructuredPoints._getStructuredPoints(self))                  StructuredPoints._getStructuredPoints(self))
189    
         #Cutter.__init__(self, data_collector._getOutput(),  
190          Cutter.__init__(self, Probe._getOutput(self),          Cutter.__init__(self, Probe._getOutput(self),
191                  Plane._getPlane(self))                    Plane._getPlane(self))  
   
192          Sphere.__init__(self)          Sphere.__init__(self)
193    
194          TensorGlyph.__init__(self, Cutter._getOutput(self),          TensorGlyph.__init__(self, Cutter._getOutput(self),
195                  Sphere._getOutput(self))                  Sphere._getOutput(self))
196          Normals.__init__(self, TensorGlyph._getOutput(self))          Normals.__init__(self, TensorGlyph._getOutput(self))
197    
198          DataSetMapper.__init__(self, Normals._getOutput(self),          DataSetMapper.__init__(self, Normals._getOutput(self),
199              lookup_table._getLookupTable())              lookup_table._getLookupTable())
   
200          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
201    
202          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
203          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
204    
205    
206    ###############################################################################
207    
208    
209  from clipper import Clipper  from clipper import Clipper
210    
211  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Sphere, Normals, TensorGlyph, Transform, Plane,
212  # and Clipper were inherited to allow access to their public methods from  # Clipper, StructuredPoints and Probe were inherited to allow access to
213  # the driver.  # their public methods from the driver.
214  class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,    class EllipsoidOnPlaneClip(DataSetMapper, Actor3D, Sphere, Normals,  
215      TensorGlyph, Transform, Plane, Clipper, StructuredPoints, Probe):      TensorGlyph, Transform, Plane, Clipper, StructuredPoints, Probe):
216      """      """
217      Class that show a tensor field using ellipsoids on a plane.      Class that show a tensor field using ellipsoids on a clipped plane.
218      """      """
219    
220      # The SOUTH_WEST default viewport is used when there is only one viewport.      # The SOUTH_WEST default viewport is used when there is only one viewport.
221      # This saves the user from specifying the viewport when there is only one.      # This saves the user from specifying the viewport when there is only one.
222      # If no vector field is specified, the first encountered in the file will      # If no vector field is specified, the first encountered in the file will
223      # be loaded automatically.      # be loaded automatically. If no lut is specified, the color scheme will
224        # be used.
225      def __init__(self, scene, data_collector, tensor = None,      def __init__(self, scene, data_collector, tensor = None,
226              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):
227    
# Line 226  class EllipsoidOnPlaneClip(DataSetMapper Line 234  class EllipsoidOnPlaneClip(DataSetMapper
234          @type tensor: String          @type tensor: String
235          @param tensor: Tensor field to load from the source file          @param tensor: Tensor field to load from the source file
236          @type viewport: L{Viewport <constant.Viewport>} constant          @type viewport: L{Viewport <constant.Viewport>} constant
237          @param viewport: Viewport in which the object is to be rendered on          @param viewport: Viewport in which object are to be rendered on
238          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
239          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
240          @type outline: Boolean          @type outline: Boolean
# Line 246  class EllipsoidOnPlaneClip(DataSetMapper Line 254  class EllipsoidOnPlaneClip(DataSetMapper
254    
255          if(outline == True):          if(outline == True):
256              outline = Outline(data_collector._getOutput())              outline = Outline(data_collector._getOutput())
257          DataSetMapper.__init__(self, outline._getOutput())              DataSetMapper.__init__(self, outline._getOutput())
258    
259          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))              Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
260          # Default outline color is black.              # Default outline color is black.
261          Actor3D.setColor(self, Color.BLACK)              Actor3D.setColor(self, Color.BLACK)
         # Default line width is 1.  
         Actor3D._setLineWidth(self, 1)  
         scene._addActor3D(viewport, Actor3D._getActor3D(self))  
262    
263                # Default line width is 1.
264                Actor3D._setLineWidth(self, 1)
265                scene._addActor3D(viewport, Actor3D._getActor3D(self))
266    
267          # ----- Ellipsoid on a clipped plane -----          # ----- Ellipsoid on a clipped plane -----
268    
# Line 281  class EllipsoidOnPlaneClip(DataSetMapper Line 289  class EllipsoidOnPlaneClip(DataSetMapper
289          # NOTE: TensorGlyph must come before Clipper. Otherwise the output          # NOTE: TensorGlyph must come before Clipper. Otherwise the output
290          # will be incorrect.          # will be incorrect.
291          Sphere.__init__(self)          Sphere.__init__(self)
         #TensorGlyph.__init__(self, data_collector._getOutput(),  
292          TensorGlyph.__init__(self, Probe._getOutput(self),          TensorGlyph.__init__(self, Probe._getOutput(self),
293                  Sphere._getOutput(self))                  Sphere._getOutput(self))
         Normals.__init__(self, TensorGlyph._getOutput(self))  
   
294    
295            Normals.__init__(self, TensorGlyph._getOutput(self))
296          # NOTE: Clipper must come after TensorGlyph. Otherwise the output          # NOTE: Clipper must come after TensorGlyph. Otherwise the output
297          # will be incorrect.          # will be incorrect.
298          Clipper.__init__(self, Normals._getOutput(self),          Clipper.__init__(self, Normals._getOutput(self),
299                  Plane._getPlane(self))                    Plane._getPlane(self))  
300          Clipper._setClipFunction(self)          Clipper._setClipFunction(self)
301    
   
302          DataSetMapper.__init__(self, Clipper._getOutput(self),          DataSetMapper.__init__(self, Clipper._getOutput(self),
303              lookup_table._getLookupTable())              lookup_table._getLookupTable())
   
304          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())          DataSetMapper._setScalarRange(self, data_collector._getScalarRange())
305    
306          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
307          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
308    

Legend:
Removed from v.946  
changed lines
  Added in v.947

  ViewVC Help
Powered by ViewVC 1.1.26