Exemplo n.º 1
0
    def __init__(self, parent, ident):
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self,
                          parent,
                          ident,
                          "DRE wxVTK demo",
                          size=(400, 400))

        # create a menu
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        quitMenu = menu.Append(-1, "&Quit", "Quit")
        self.Bind(wx.EVT_MENU, self.onQuit, quitMenu)
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()

        # sequence of init is different
        self.rwi.Enable(1)

        self.listRen = self.CreateObjects()
        for ren in self.listRen:
            self.rwi.GetRenderWindow().AddRenderer(ren)
Exemplo n.º 2
0
    def __init__(self, parent, ident):
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self, parent, ident, "DRE wxVTK demo", size=(400, 400))

        # create a menu
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        quitMenu = menu.Append(-1, "&Quit", "Quit")
        self.Bind(wx.EVT_MENU, self.onQuit, quitMenu)
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)

        # make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()

        # sequence of init is different
        self.rwi.Enable(1)

        self.listRen = self.CreateObjects()
        for ren in self.listRen:
            self.rwi.GetRenderWindow().AddRenderer(ren)
Exemplo n.º 3
0
  def __init__(self):
    wxFrame.__init__(self, None, -1, "VTK Window", size=wxSize(400,400))

    # create the widget
    self.widget = wxVTKRenderWindow(self,-1)
    self.ren = vtkRenderer()
    self.ren.SetBackground(background_color)
    self.widget.GetRenderWindow().AddRenderer(self.ren)
Exemplo n.º 4
0
    def __init__(self, parent, ident):
        self.ren = None  # The Renderer
        self.rwi = None  # The reneder Windows

        self.action = ""  # No action

        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self,
                          parent,
                          ident,
                          "DRE wxVTK demo",
                          size=(400, 400))

        # create a menuBar
        menuBar = wx.MenuBar()

        # add a File Menu
        menuFile = wx.Menu()
        itemQuit = menuFile.Append(-1, "&Quit", "Quit application")
        self.Bind(wx.EVT_MENU, self.OnQuit, itemQuit)
        menuBar.Append(menuFile, "&File")

        # add an Action Menu
        #        menuAction = wx.Menu()
        #        itemSelect = menuAction.AppendCheckItem(-1, "&Select\tS", "Select an object")
        #        self.Bind(wx.EVT_MENU, self.OnSelect, itemSelect)
        #        menuBar.Append(menuAction, "&File")

        self.SetMenuBar(menuBar)
        self.statusBar = self.CreateStatusBar()
        self.statusBar.SetFieldsCount(2)
        self.statusBar.SetStatusWidths([-4, -1])

        # the render is a 3D Scene
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.2, 0.5, 0.7)

        # create the world
        self.CreateWorld(self.ren)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        self.rwi.GetRenderWindow().AddRenderer(self.ren)

        # trap mouse events
        self.rwi.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.rwi.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.rwi.Bind(wx.EVT_LEFT_DCLICK, self.OnSelect)
        self.rwi.Bind(wx.EVT_MOTION, self.OnMotion)

        # store the Picker
        self.picker = vtk.vtkCellPicker()
        self.pickedActor = None
        self.pickedProperty = None
        self.selectProperty = vtk.vtkProperty()
        self.selectProperty.SetColor(1, 0, 0)
Exemplo n.º 5
0
    def __init__(self, parent, ident):
        self.ren = None        # The Renderer
        self.rwi = None        # The reneder Windows
        
        self.action = ""       # No action         
        
        
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self, parent, ident, "DRE wxVTK demo", size=(400,400))
        
        # create a menuBar
        menuBar = wx.MenuBar()
        
        # add a File Menu
        menuFile = wx.Menu()
        itemQuit = menuFile.Append(-1, "&Quit", "Quit application")
        self.Bind(wx.EVT_MENU, self.OnQuit, itemQuit)
        menuBar.Append(menuFile, "&File")
        
        # add an Action Menu
#        menuAction = wx.Menu()
#        itemSelect = menuAction.AppendCheckItem(-1, "&Select\tS", "Select an object")
#        self.Bind(wx.EVT_MENU, self.OnSelect, itemSelect)
#        menuBar.Append(menuAction, "&File")
        
        self.SetMenuBar(menuBar)
        self.statusBar = self.CreateStatusBar()
        self.statusBar.SetFieldsCount(2)
        self.statusBar.SetStatusWidths([-4, -1])
        
        # the render is a 3D Scene
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.2, 0.5, 0.7)

        # create the world
        self.CreateWorld(self.ren)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        self.rwi.GetRenderWindow().AddRenderer(self.ren)
        
        # trap mouse events
        self.rwi.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.rwi.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.rwi.Bind(wx.EVT_LEFT_DCLICK, self.OnSelect)
        self.rwi.Bind(wx.EVT_MOTION, self.OnMotion)
        
        # store the Picker
        self.picker = vtk.vtkCellPicker()
        self.pickedActor = None
        self.pickedProperty = None
        self.selectProperty = vtk.vtkProperty()
        self.selectProperty.SetColor(1,0,0)
Exemplo n.º 6
0
    def __init__(self, parent, id):
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self, parent, id, "DRE wxVTK demo", size=(400,400))
        
        # create a menu
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        quitMenu = menu.Append(-1, "&Quit", "Quit")
        self.Bind(wx.EVT_MENU, self.onQuit, quitMenu)
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)
        
        # create a donut polydata source
        superquadric = vtk.vtkSuperquadricSource()
        superquadric.ToroidalOn()
        
        # connect it to Polydatamapper
        m = vtk.vtkPolyDataMapper()
        m.SetInput(superquadric.GetOutput())
        
        # create an actor to represent the donut in the scene
        a = vtk.vtkActor()
        a.SetMapper(m)
        a.GetProperty().SetColor(0.8, 0.5, 0.3)
        a.GetProperty().SetSpecular(0.3)
        
        # the render is a 3D Scene
        self.ren = vtk.vtkRenderer()
        self.ren.AddActor(a)
        self.ren.SetBackground(0.2, 0.5, 0.7)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()
        
        # sequence of init is different
        self.rwi.Enable(1)
        
        # add created renderer to the RWI's buit-in renderer window
        self.rwi.GetRenderWindow().AddRenderer(self.ren)
Exemplo n.º 7
0
    def __init__(self, parent, id):
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self, parent, id, "DRE wxVTK demo", size=(400, 400))

        # create a menu
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        quitMenu = menu.Append(-1, "&Quit", "Quit")
        self.Bind(wx.EVT_MENU, self.onQuit, quitMenu)
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)

        # create a donut polydata source
        superquadric = vtk.vtkSuperquadricSource()
        superquadric.ToroidalOn()

        # connect it to Polydatamapper
        m = vtk.vtkPolyDataMapper()
        m.SetInput(superquadric.GetOutput())

        # create an actor to represent the donut in the scene
        a = vtk.vtkActor()
        a.SetMapper(m)
        a.GetProperty().SetColor(0.8, 0.5, 0.3)
        a.GetProperty().SetSpecular(0.3)

        # the render is a 3D Scene
        self.ren = vtk.vtkRenderer()
        self.ren.AddActor(a)
        self.ren.SetBackground(0.2, 0.5, 0.7)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()

        # sequence of init is different
        self.rwi.Enable(1)

        # add created renderer to the RWI's buit-in renderer window
        self.rwi.GetRenderWindow().AddRenderer(self.ren)
Exemplo n.º 8
0
def main ():
    # example code...
    import vtk
    from vtk.wx.wxVTKRenderWindow import wxVTKRenderWindow
    
    cone = vtk.vtkConeSource()
    cone.SetResolution(8)
    transform = vtk.vtkTransformFilter ()
    transform.SetInput ( cone.GetOutput() )
    transform.SetTransform ( vtk.vtkTransform() )
    coneMapper = vtk.vtkPolyDataMapper()
    coneMapper.SetInput(transform.GetOutput())
    l = vtk.vtkLookupTable ()
    coneMapper.SetLookupTable (l)
    coneActor = vtk.vtkActor()
    coneActor.SetMapper(coneMapper)    
    axes = vtk.vtkCubeAxesActor2D ()

    app = wx.PySimpleApp()
    frame = wx.Frame(None, -1, "wx.RenderWindow", size=wx.Size(400,400))
    wid = wxVTKRenderWindow(frame, -1)

    ren = vtk.vtkRenderer()
    renWin = wid.GetRenderWindow()
    renWin.AddRenderer(ren)
    renWin.SetSize(300,300)
    ren.AddActor (coneActor)
    ren.AddActor (axes)
    axes.SetCamera (ren.GetActiveCamera ())
    renWin.Render ()

    debug ("Starting VTK Pipeline Browser...")
    pipe = vtkPipelineBrowser (frame, renWin)
    pipe.show()

    pipe_segment = vtkPipelineBrowser(frame, renWin, (coneActor, axes))
    pipe_segment.show()

    app.MainLoop()
Exemplo n.º 9
0
def main():
    # example code...
    import vtk
    from vtk.wx.wxVTKRenderWindow import wxVTKRenderWindow

    cone = vtk.vtkConeSource()
    cone.SetResolution(8)
    transform = vtk.vtkTransformFilter()
    transform.SetInput(cone.GetOutput())
    transform.SetTransform(vtk.vtkTransform())
    coneMapper = vtk.vtkPolyDataMapper()
    coneMapper.SetInput(transform.GetOutput())
    l = vtk.vtkLookupTable()
    coneMapper.SetLookupTable(l)
    coneActor = vtk.vtkActor()
    coneActor.SetMapper(coneMapper)
    axes = vtk.vtkCubeAxesActor2D()

    app = wx.PySimpleApp()
    frame = wx.Frame(None, -1, "wx.RenderWindow", size=wx.Size(400, 400))
    wid = wxVTKRenderWindow(frame, -1)

    ren = vtk.vtkRenderer()
    renWin = wid.GetRenderWindow()
    renWin.AddRenderer(ren)
    renWin.SetSize(300, 300)
    ren.AddActor(coneActor)
    ren.AddActor(axes)
    axes.SetCamera(ren.GetActiveCamera())
    renWin.Render()

    debug("Starting VTK Pipeline Browser...")
    pipe = vtkPipelineBrowser(frame, renWin)
    pipe.show()

    pipe_segment = vtkPipelineBrowser(frame, renWin, (coneActor, axes))
    pipe_segment.show()

    app.MainLoop()
Exemplo n.º 10
0
    def __init__(self, parent, id):
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self, parent, id, "DRE wxVTK demo", size=(400,400))
        
        # create a menu
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        quitMenu = menu.Append(-1, "&Quit", "Quit")
        self.Bind(wx.EVT_MENU, self.onQuit, quitMenu)
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)
        
        # the render is a 3D Scene
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.2, 0.5, 0.7)

        # create a cylinder
        actObj1 = MyObject('C', 0, 0, 0)
        actObj1.SetOrientation(0, 0, 90)
        self.ren.AddActor(actObj1.actor)
        actObj2 = MyObject('O', 1, 0, 0)
        self.ren.AddActor(actObj2.actor)
        actObj3 = MyObject('S', 1.3, 0, 0)
        self.ren.AddActor(actObj3.actor)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()
        
        # sequence of init is different
        self.rwi.Enable(1)
        
        # add created renderer to the RWI's buit-in renderer window
        self.rwi.GetRenderWindow().AddRenderer(self.ren)
Exemplo n.º 11
0
    def __init__(self, parent, id):
        # create wx.Frame and wxVTKRenderWindowInteractor to put in it
        wx.Frame.__init__(self, parent, id, "DRE wxVTK demo", size=(400, 400))

        # create a menu
        menuBar = wx.MenuBar()
        menu = wx.Menu()
        quitMenu = menu.Append(-1, "&Quit", "Quit")
        self.Bind(wx.EVT_MENU, self.onQuit, quitMenu)
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)

        # the render is a 3D Scene
        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(0.2, 0.5, 0.7)

        # create a cylinder
        actObj1 = MyObject('C', 0, 0, 0)
        actObj1.SetOrientation(0, 0, 90)
        self.ren.AddActor(actObj1.actor)
        actObj2 = MyObject('O', 1, 0, 0)
        self.ren.AddActor(actObj2.actor)
        actObj3 = MyObject('S', 1.3, 0, 0)
        self.ren.AddActor(actObj3.actor)

        #make sure the RWI sizes to fill the frame
        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()

        # sequence of init is different
        self.rwi.Enable(1)

        # add created renderer to the RWI's buit-in renderer window
        self.rwi.GetRenderWindow().AddRenderer(self.ren)
Exemplo n.º 12
0
Arquivo: force.py Projeto: qsnake/gpaw
plotter=Transport_Plotter(0)
plotter.read_overhead()

import vtk
from ase.visualize.vtk.atoms import vtkAtoms
usewx = False
try:
    import wx
    usewx = True
except ImportError:
    pass
if usewx:
    from vtk.wx.wxVTKRenderWindow import wxVTKRenderWindow
    app = wx.PySimpleApp()
    frame = wx.Frame(None, -1, 'wxVTKRenderWindow', size=(800,600))
    widget = wxVTKRenderWindow(frame, -1)
    win = widget.GetRenderWindow()
    ren = vtk.vtkRenderer()
    win.AddRenderer(ren)
else:
    ren = vtk.vtkRenderer()
    win = vtk.vtkRenderWindow()
    win.AddRenderer(ren)
    win.SetSize(800,600)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(win)
    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)
atoms = plotter.atoms.copy()
calc = GPAW()
atoms.set_calculator(calc)
Exemplo n.º 13
0
plotter = Transport_Plotter(0)
plotter.read_overhead()

import vtk
from ase.visualize.vtk.atoms import vtkAtoms
usewx = False
try:
    import wx
    usewx = True
except ImportError:
    pass
if usewx:
    from vtk.wx.wxVTKRenderWindow import wxVTKRenderWindow
    app = wx.PySimpleApp()
    frame = wx.Frame(None, -1, 'wxVTKRenderWindow', size=(800, 600))
    widget = wxVTKRenderWindow(frame, -1)
    win = widget.GetRenderWindow()
    ren = vtk.vtkRenderer()
    win.AddRenderer(ren)
else:
    ren = vtk.vtkRenderer()
    win = vtk.vtkRenderWindow()
    win.AddRenderer(ren)
    win.SetSize(800, 600)
    iren = vtk.vtkRenderWindowInteractor()
    iren.SetRenderWindow(win)
    style = vtk.vtkInteractorStyleTrackballCamera()
    iren.SetInteractorStyle(style)
atoms = plotter.atoms.copy()
calc = GPAW()
atoms.set_calculator(calc)
Exemplo n.º 14
0
    def __init__(self, parent, id):

        wx.Frame.__init__(self,
                          parent,
                          id,
                          'Examen_Estructura de Datos Avanzados',
                          size=(1024, 720))

        # Valores que seran usados para agregar y/o consultar

        self.Val_X = None
        self.Val_Y = None
        self.Val_Z = None
        self.Tamanho_Cubo = None
        # self.varbool=False
        self.actor1 = None
        # .........................................................

        #Generador del menu
        menuBar = wx.MenuBar()

        menuFile = wx.Menu()
        itemAdd = menuFile.Append(-1, "&Añadir_Punto", "Agregar punto al cubo")
        itemQuery = menuFile.Append(-1, "&Consultar", "Consutar en un rango")
        itemQuit = menuFile.Append(-1, "&Quit", "Quit application")
        self.Bind(wx.EVT_MENU, self.Salir, itemQuit)

        self.Bind(wx.EVT_MENU, self.Agregar, itemAdd)
        self.Bind(wx.EVT_MENU, self.Consultar, itemQuery)
        self.Bind(wx.EVT_MENU, self.Salir, itemQuit)

        menuBar.Append(menuFile, "&Opciones")
        self.SetMenuBar(menuBar)
        self.statusBar = self.CreateStatusBar()
        self.statusBar.SetFieldsCount(2)
        self.statusBar.SetStatusWidths([-4, -1])

        self.ren = vtk.vtkRenderer()
        self.ren.SetBackground(1, 1, 1)

        #Creacion del octree
        # Y genereacion de puntos aleatorios en el octree
        self.arbol = Octree(Rectangulo(80, 80, 80, 80, 80, 80), 4,
                            AsignarColor(1, 1, 1, 1, 1, 1),
                            AsignarColor(0, 0, 0, 0, 0, 0))
        self.Create_Cubo(80, 80, 80, 80, 80, 80, 1, 1, 1, 0.1)
        for i in range(0, 20):
            punto_color = []
            puntosG = []
            val = [False]
            val1 = randrange(150)
            val2 = randrange(150)
            val3 = randrange(150)
            p = Point(val1, val2, val3)
            self.arbol.insert(p, puntosG, val, punto_color)
            for occt in puntosG:
                self.Create_Cubo(occt.cubo.x, occt.cubo.y, occt.cubo.z,
                                 occt.cubo.w, occt.cubo.h, occt.cubo.p,
                                 occt.color.a, occt.color.b, occt.color.c, 0.1)
            self.Create_Punto(float(val1), float(val2), float(val3),
                              punto_color[0].a, punto_color[0].b,
                              punto_color[0].c)
        # p = Point(float(self.Val_X), float(self.Val_Y), float(self.Val_Z))
        #self.rwi=wxVTKRenderWindow(self, 0)

        self.rwi = wxVTKRenderWindow(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.rwi, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.Layout()
        self.rwi.Enable(1)
        self.rwi.GetRenderWindow().AddRenderer(self.ren)