def _glyph_source_changed(self, value): if self._updating == True: return gd = self.glyph_dict value_cls = camel2enthought(value.__class__.__name__) if value not in gd.values(): gd[value_cls] = value # Now change the glyph's source trait. self._updating = True recorder = self.recorder if recorder is not None: name = recorder.get_script_id(self) lhs = '%s.glyph_source'%name rhs = '%s.glyph_dict[%r]'%(name, value_cls) recorder.record('%s = %s'%(lhs, rhs)) name = value.__class__.__name__ if name == 'GlyphSource2D': configure_outputs(self, value) else: self.configure_input(self._trfm, value) configure_outputs(self, self._trfm) value.on_trait_change(self.render) self._updating = False # Now update the glyph position since the transformation might # be different. self._glyph_position_changed(self.glyph_position)
def update_pipeline(self): """Override this method so that it *updates* the tvtk pipeline when data upstream is known to have changed. This method is invoked (automatically) when any of the inputs sends a `pipeline_changed` event. """ if ((len(self.inputs) == 0) or (len(self.inputs[0].outputs) == 0)): return self._mask_input_points_changed(self.mask_input_points) if self.glyph_type == 'vector': self._color_mode_changed(self.color_mode) else: self._color_mode_tensor_changed(self.color_mode_tensor) self._scale_mode_changed(self.scale_mode) # Set our output. tvtk_common.configure_outputs(self, self.glyph) self.pipeline_changed = True
def _streamline_type_changed(self, value): if self.module_manager is None: return st = self.stream_tracer rf = self.ribbon_filter tf = self.tube_filter if value == 'line': configure_outputs(self, st) elif value == 'ribbon': self.configure_connection(rf, st) configure_outputs(self, rf) elif value == 'tube': self.configure_connection(tf, st) configure_outputs(self, tf) self.render()
def _streamline_type_changed(self, value): if self.module_manager is None: return st = self.stream_tracer rf = self.ribbon_filter tf = self.tube_filter if value == 'line': configure_outputs(self, st) elif value == 'ribbon': self.configure_connection(rf, st) configure_outputs(self, rf) elif value == 'tube': # Without a clean poly data filter, tube filter will throw could # not generate normals warning cf = self.clean_filter self.configure_connection(cf, st) self.configure_connection(tf, cf) configure_outputs(self, tf) self.render()