Trisurf Monte Carlo simulator
Samo Penic
2016-07-09 9e5a9c0f110d3ed02751c9d44a3716caa6010a70
python/trisurf/VTKRendering.py
@@ -10,13 +10,20 @@
      self.args=args
      self.renderer = vtkRenderer()
      self.actor=self.lastActor()
      self.textactor=self.textActor()
      self.renderer.AddActor(self.actor)
      self.renderer.AddActor(self.textactor)
      self.renderer.SetBackground(0, 0, 0) # Set background to white
      # Create the RendererWindow
      self.renderer_window = vtkRenderWindow()
      self.renderer_window.AddRenderer(self.renderer)
      self.renderer_window.SetSize(1200,600)
      self.renderer.SetViewport(0.0,0.0,0.5,1.0)
      rend=vtk.vtkRenderer()
      rend.AddActor(self.actor)
      rend.SetViewport(0.5,0.0,1.0,1.0)
      self.renderer_window.AddRenderer(rend)
# Set up a check for aborting rendering.
      # Create the RendererWindowInteractor and display the vtk_file
      interactor = vtkRenderWindowInteractor()
@@ -32,6 +39,15 @@
      Dir=trisurf.Directory(maindir=self.host['runs'][0].maindir,simdir=self.host['runs'][0].subdir)
      filename=os.path.join("./",Dir.fullpath(),self.host['runs'][0].getLastVTU())
      return filename
   def textActor(self):
      textactor=vtkTextActor()
      textactor.SetInput(self.filename)
      tp=textactor.GetTextProperty()
      tp.SetColor(1,1,1)
      tp.SetFontSize(11)
      textactor.SetDisplayPosition(20,30)
      return textactor
   def lastActor(self):
      self.filename=self.lastVTU()
@@ -52,10 +68,13 @@
   def RenderUpdate(self, obj, event):
      if(self.lastVTU()!=self.filename):
         print("updejt")
         #print("updejt")
         self.renderer.RemoveActor(self.actor)
         self.renderer.RemoveActor(self.textactor)
         self.actor=self.lastActor()
         self.textactor=self.textActor()
         self.renderer.AddActor(self.actor)
         self.renderer.AddActor(self.textactor)
         self.renderer_window.Render()
      #self.render.RemoveActor(self.actor)