Пример #1
0
    def setup_pipeline(self):
        """Override this method so that it *creates* the tvtk
        pipeline.

        This method is invoked when the object is initialized via
        `__init__`.  Note that at the time this method is called, the
        tvtk data pipeline will *not* yet be setup.  So upstream data
        will not be available.  The idea is that you simply create the
        basic objects and setup those parts of the pipeline not
        dependent on upstream sources and filters.  You should also
        set the `actors` attribute up at this point.
        """
        # Setup the glyphs.
        sources = [
            tvtk.SphereWidget(theta_resolution=8, phi_resolution=6),
            tvtk.LineWidget(clamp_to_bounds=False),
            tvtk.PlaneWidget(),
            tvtk.PointWidget(outline=False,
                             x_shadows=False,
                             y_shadows=False,
                             z_shadows=False),
        ]
        self.widget_list = sources
        # The 'widgets' trait is set in the '_widget_changed' handler.
        self.widget = sources[0]

        for s in sources:
            self._connect(s)
 def __widget_dict_default(self):
     """Default value for source dict."""
     w = {'Box':tvtk.BoxWidget(place_factor = 0.9),
          'Sphere':tvtk.SphereWidget(place_factor = 0.9),
          'Plane':tvtk.PlaneWidget(place_factor = 0.9),
          'ImplicitPlane':
             tvtk.ImplicitPlaneWidget(place_factor=0.9,
                                      draw_plane=False)}
     return w
Пример #3
0
 def _actor_type_changed(self, value):
     if value == 'cone':
         a = actors.cone_actor()
         self.actor_map = {'cone': a}
     elif value == 'sphere':
         a = actors.sphere_actor()
         self.actor_map = {'sphere': a}
     elif value == 'plane_widget':
         w = tvtk.PlaneWidget()
         self.actor_map = {'plane_widget': w}
     elif value == 'box_widget':
         w = tvtk.BoxWidget()
         self.actor_map = {'box_widget': w}
Пример #4
0
 def _actor_type_changed(self, value):
     scene = self.scene
     if self._current_actor is not None:
         scene.remove_actors(self._current_actor)
     if value == 'cone':
         a = actors.cone_actor()
         scene.add_actors(a)
     elif value == 'sphere':
         a = actors.sphere_actor()
         scene.add_actors(a)
     elif value == 'plane_widget':
         a = tvtk.PlaneWidget()
         scene.add_actors(a)
     elif value == 'box_widget':
         a = tvtk.BoxWidget()
         scene.add_actors(a)
     self._current_actor = a