1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
"""A custom grid plane with a lot more flexibility than
GridPlane. This also only works for non-unstructured/non-polygonal
datasets.
"""
# Author: Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance
from traitsui.api import View, Group, Item
# Local imports
from mayavi.components import custom_grid_plane
from mayavi.modules.contour_grid_plane import \
ContourGridPlane, Contour, Actor
######################################################################
# `CustomGridPlane` class.
######################################################################
class CustomGridPlane(ContourGridPlane):
grid_plane = Instance(custom_grid_plane.Component,
allow_none=False, record=True)
# Overriding the ContourGridPlane's default view.
view = View(Group(Item(name='grid_plane', style='custom'),
show_labels=False,
label='GridPlane'),
Group(Group(Item(name='enable_contours')),
Group(Item(name='contour', style='custom',
enabled_when='object.enable_contours'),
show_labels=False,
),
label='Contour',
),
Group(Item(name='actor', style='custom'),
label='Actor',
show_labels=False)
)
######################################################################
# `Module` interface
######################################################################
def setup_pipeline(self):
# Note that we don't call the parent class method here. This
# is intentional to avoid problems with the execution of the
# VTK pipeline.
# Create the components.
self.grid_plane = custom_grid_plane.CustomGridPlane()
self.contour = Contour(auto_contours=True, number_of_contours=10)
self.actor = Actor()
self.enable_contours = False
self.actor.property.point_size = 2
|