/[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 943 - (show annotations)
Mon Jan 29 07:22:43 2007 UTC (14 years, 1 month ago) by jongui
File MIME type: text/x-python
File size: 1464 byte(s)
new pyvisi files
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 by the outline object.
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 a color
21 """
22
23 self.__object = object
24 self.__vtk_data_set_mapper = vtk.vtkDataSetMapper()
25 self.__setInput()
26 if(lookup_table != None):
27 self.__setLookupTable(lookup_table)
28
29 def __setInput(self):
30 """
31 Set the the input for the data set mapper.
32 """
33
34 self.__vtk_data_set_mapper.SetInput(self.__object)
35
36 def __setLookupTable(self, lookup_table):
37 """
38 Set the lookup table for the data set mapper.
39
40 @type lookup_table: vtkLookupTable
41 @param lookup_table: Map scalar values to a color
42 """
43
44 self.__vtk_data_set_mapper.SetLookupTable(lookup_table)
45
46 def _setScalarRange(self, range):
47 """
48 Set the minimum and maximum scalar range to be mapped into the lookup
49 table for the data set mapper.
50
51 @type range: tuple
52 @param range: Maximum and mimimum scalar range
53 """
54
55 self.__vtk_data_set_mapper.SetScalarRange(range)
56
57 def _getDataSetMapper(self):
58 """
59 Return the data set mapper.
60
61 @rtype: vtkDataSetMapper
62 @return: Data set mapper
63 """
64
65 return self.__vtk_data_set_mapper
66
67

  ViewVC Help
Powered by ViewVC 1.1.26