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

Contents of /trunk/pyvisi/py_src/mapper.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1004 - (show annotations)
Thu Mar 1 04:57:31 2007 UTC (12 years, 4 months ago) by jongui
File MIME type: text/x-python
File size: 1645 byte(s)
Updated the epydocs, comments and organized codes to ease readability.
1 """
2 @author: John NGUI
3 """
4
5 import vtk
6
7 class DataSetMapper:
8 """
9 Class that defines a data set mapper.
10 """
11
12 # 'lookup_table = None' is used only by the outline.
13 def __init__(self, object, lookup_table = None):
14 """
15 Initialise the data set mapper.
16
17 @type object: vtkDataSet (i.e. vtkUnstructuredGrid, vtkPolyData, etc)
18 @param object: Data source map
19 @type lookup_table: vtkLookupTable
20 @param lookup_table: Maps scalar values to colors
21 """
22
23 self.__object = object
24 self.__vtk_data_set_mapper = vtk.vtkDataSetMapper()
25 self.__setInput()
26
27 if(lookup_table != None): # False for the outline.
28 self.__setLookupTable(lookup_table)
29
30 def __setInput(self):
31 """
32 Set the input for the data set mapper.
33 """
34
35 self.__vtk_data_set_mapper.SetInput(self.__object)
36
37 def __setLookupTable(self, lookup_table):
38 """
39 Set the lookup table for the data set mapper.
40
41 @type lookup_table: vtkLookupTable
42 @param lookup_table: Map scalar values to colors
43 """
44
45 self.__vtk_data_set_mapper.SetLookupTable(lookup_table)
46
47 def _setScalarRange(self, range):
48 """
49 Set the minimum and maximum scalar range for the data set mapper.
50
51 @type range: Two column tuple containing numbers
52 @param range: Minimum and maximum data set mapper scalar range
53 """
54
55 self.__vtk_data_set_mapper.SetScalarRange(range)
56
57 def _setScalarVisibilityOn(self):
58 """
59 Scalar data is used to color the rendered object.
60 """
61
62 self.__vtk_data_set_mapper.ScalarVisibilityOn()
63
64 def _getDataSetMapper(self):
65 """
66 Return the data set mapper.
67
68 @rtype: vtkDataSetMapper
69 @return: Data set mapper
70 """
71
72 return self.__vtk_data_set_mapper
73
74

  ViewVC Help
Powered by ViewVC 1.1.26