Outline.py :  » Game-2D-3D » MayaVi » MayaVi-1.5 » Modules » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Game 2D 3D » MayaVi 
MayaVi » MayaVi 1.5 » Modules » Outline.py
"""

Displays an Outline for any data input.

This code is distributed under the conditions of the BSD license.  See
LICENSE.txt for details.

Copyright (c) 2001-2002, Prabhu Ramachandran.
"""

__author__ = "Prabhu Ramachandran <prabhu_r@users.sf.net>"
__version__ = "$Revision: 1.6 $"
__date__ = "$Date: 2005/08/02 18:30:13 $"

import Base.Objects, Common
import Tkinter, tkColorChooser
import vtk
import vtkPipeline.vtkMethodParser

debug = Common.debug

class Outline (Base.Objects.Module):
    """ Displays an Outline for any data input."""
    def __init__ (self, mod_m):
        debug ("In Outline::__init__ ()")
        Common.state.busy ()
        Base.Objects.Module.__init__ (self, mod_m)
        data_src = self.mod_m.get_data_source ()
        self.type = data_src.get_grid_type ()
        self.outline = vtk.vtkOutlineFilter ()
        self.outline.SetInput (mod_m.GetOutput ())
        self.mapper = self.map = vtk.vtkPolyDataMapper ()
        self.map.SetInput (self.outline.GetOutput ())
        self.actor = self.act = vtk.vtkActor ()  
        self.act.SetMapper (self.map)
        self.act.GetProperty ().SetColor (*Common.config.fg_color)
        self.renwin.add_actors (self.act)
        # used for the pipeline browser
        self.pipe_objs = self.act
        self.renwin.Render ()
        Common.state.idle ()

    def __del__ (self): 
        debug ("In Outline::__del__ ()")
        if self.act:
            self.renwin.remove_actors (self.act)
        self.renwin.Render ()

    def SetInput (self, source): 
        debug ("In Outline::SetInput ()")
        Common.state.busy ()
        self.outline.SetInput (source)
        Common.state.idle ()

    def save_config (self, file): 
        debug ("In Outline::save_config ()")
        p = vtkPipeline.vtkMethodParser.VtkPickler ()
        for obj in (self.act, self.act.GetProperty ()):
            p.dump (obj, file)

    def load_config (self, file): 
        debug ("In Outline::load_config ()")
        p = vtkPipeline.vtkMethodParser.VtkPickler ()
        for obj in (self.act, self.act.GetProperty ()):
            p.load (obj, file)
        # need this in case you load the module for different data.
        self.outline.SetInput (self.mod_m.GetOutput ())
        self.renwin.Render ()
        
    def config_changed (self): 
        debug ("In Outline::config_changed ()")
        self.act.GetProperty ().SetColor (*Common.config.fg_color)

    def make_main_gui (self):
        debug ("In Outline::make_main_gui ()")
        "Create the GUI configuration controls for this object."
        self.make_actor_gui (representation=0, scalar=0)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.