206 |
|
|
207 |
return self.__vtk_structured_points |
return self.__vtk_structured_points |
208 |
|
|
209 |
|
|
210 |
|
############################################################################## |
211 |
|
|
212 |
|
|
213 |
|
class MaskPoints: |
214 |
|
""" |
215 |
|
Class that the masking of points. It is possible to mask every n'th point. |
216 |
|
This is useful to prevent the rendered object from being cluttered with |
217 |
|
arrows or ellipsoids. |
218 |
|
""" |
219 |
|
|
220 |
|
def __init__(self, object): |
221 |
|
""" |
222 |
|
Initialise the mask points. |
223 |
|
|
224 |
|
@type object: vtkDataSet (i.e. vtkUnstructuredGrid, etc) |
225 |
|
@param object: Data source to mask points from |
226 |
|
""" |
227 |
|
|
228 |
|
self.__object = object |
229 |
|
self.__vtk_mask_points = vtk.vtkMaskPoints() |
230 |
|
|
231 |
|
self.__setupMaskPoints() |
232 |
|
|
233 |
|
def __setupMaskPoints(self): |
234 |
|
""" |
235 |
|
Setup the mask points. |
236 |
|
""" |
237 |
|
self.__setInput() |
238 |
|
|
239 |
|
def __setInput(self): |
240 |
|
""" |
241 |
|
Set the input for the mask points. |
242 |
|
""" |
243 |
|
|
244 |
|
self.__vtk_mask_points.SetInput(self.__object) |
245 |
|
|
246 |
|
def setRatio(self, ratio): |
247 |
|
""" |
248 |
|
Mask every nth point. |
249 |
|
|
250 |
|
@type ratio: Number |
251 |
|
@param ratio: Masking ratio |
252 |
|
""" |
253 |
|
|
254 |
|
self.__vtk_mask_points.SetOnRatio(ratio) |
255 |
|
|
256 |
|
def randomOn(self): |
257 |
|
""" |
258 |
|
Enables the randomization of the points selected for masking. |
259 |
|
""" |
260 |
|
|
261 |
|
self.__vtk_mask_points.RandomModeOn() |
262 |
|
|
263 |
|
def randomOff(self): |
264 |
|
""" |
265 |
|
Disables the randomization of the points selected for masking. |
266 |
|
""" |
267 |
|
|
268 |
|
self.__vtk_mask_points.RandomModeOff() |
269 |
|
|
270 |
|
def _getOutput(self): |
271 |
|
""" |
272 |
|
Return the output of the masked points. |
273 |
|
|
274 |
|
@rtype: vtkPolyData |
275 |
|
@return: Polygonal datda |
276 |
|
""" |
277 |
|
|
278 |
|
return self.__vtk_mask_points.GetOutput() |
279 |
|
|
280 |
|
|