コード例 #1
0
 def plotContinents(self,x1,x2,y1,y2,projection,wrap,tmpl):
     contData = vcs2vtk.prepContinents(self.canvas._continents)
     contMapper = vtk.vtkPolyDataMapper()
     contMapper.SetInputData(contData)
     contActor = vtk.vtkActor()
     contActor.SetMapper(contMapper)
     contActor.GetProperty().SetColor(0.,0.,0.)
     contActor = vcs2vtk.doWrap(contActor,[x1,x2,y1,y2],wrap)
     if projection.type!="linear":
         contData=contActor.GetMapper().GetInput()
         cpts = contData.GetPoints()
         geo, gcpts = vcs2vtk.project(cpts,projection,[x1,x2,y1,y2])
         contData.SetPoints(gcpts)
         contMapper = vtk.vtkPolyDataMapper()
         contMapper.SetInputData(contData)
         contActor = vtk.vtkActor()
         contActor.SetMapper(contMapper)
         contActor.GetProperty().SetColor(0.,0.,0.)
     else:
         geo=None
     ren = vtk.vtkRenderer()
     self.renWin.AddRenderer(ren)
     self.setLayer(ren,tmpl.data.priority)
     vcs2vtk.fitToViewport(contActor,ren,[tmpl.data.x1,tmpl.data.x2,tmpl.data.y1,tmpl.data.y2],wc=[x1,x2,y1,y2],geo=geo)
     if tmpl.data.priority!=0:
       ren.AddActor(contActor)
コード例 #2
0
 def plotContinents(self,x1,x2,y1,y2,projection,wrap,ren,tmpl):
     contData = vcs2vtk.prepContinents(self.canvas._continents)
     contMapper = vtk.vtkPolyDataMapper()
     contMapper.SetInputData(contData)
     contActor = vtk.vtkActor()
     contActor.SetMapper(contMapper)
     contActor.GetProperty().SetColor(0.,0.,0.)
     cpts = contData.GetPoints()
     gcpts = vcs2vtk.project(cpts,projection)
     contData.SetPoints(gcpts)
     contActor = vcs2vtk.doWrap(contActor,[x1,x2,y1,y2],wrap)
     vcs2vtk.fitToViewport(contActor,ren,[tmpl.data.x1,tmpl.data.x2,tmpl.data.y1,tmpl.data.y2],[x1,x2,y1,y2])
     if tmpl.data.priority!=0:
       ren.AddActor(contActor)
コード例 #3
0
  def plotContinents(self,x1,x2,y1,y2,projection,wrap,tmpl):
      contData = vcs2vtk.prepContinents(self.canvas._continents)
      contMapper = vtk.vtkPolyDataMapper()
      contMapper.SetInputData(contData)
      contActor = vtk.vtkActor()
      contActor.SetMapper(contMapper)
      contActor.GetProperty().SetColor(0.,0.,0.)
      contActor = vcs2vtk.doWrap(contActor,[x1,x2,y1,y2],wrap,fastClip=False)
      if projection.type!="linear":
          contData=contActor.GetMapper().GetInput()
          cpts = contData.GetPoints()
          geo, gcpts = vcs2vtk.project(cpts,projection,[x1,x2,y1,y2])
          contData.SetPoints(gcpts)
          contMapper = vtk.vtkPolyDataMapper()
          contMapper.SetInputData(contData)
          contActor = vtk.vtkActor()
          contActor.SetMapper(contMapper)
          contActor.GetProperty().SetColor(0.,0.,0.)
      else:
          geo=None

      ren = self.fitToViewport(contActor,[tmpl.data.x1,tmpl.data.x2,tmpl.data.y1,tmpl.data.y2],
              wc=[x1,x2,y1,y2],geo=geo,priority=tmpl.data.priority)
      return {}
コード例 #4
0
  def plotContinents(self,x1,x2,y1,y2,projection,wrap,tmpl):
      contData = vcs2vtk.prepContinents(self.canvas._continents)
      contMapper = vtk.vtkPolyDataMapper()
      contMapper.SetInputData(contData)
      contActor = vtk.vtkActor()
      contActor.SetMapper(contMapper)
      contActor.GetProperty().SetColor(0.,0.,0.)
      contActor = vcs2vtk.doWrap(contActor,[x1,x2,y1,y2],wrap,fastClip=False)
      if projection.type!="linear":
          contData=contActor.GetMapper().GetInput()
          cpts = contData.GetPoints()
          geo, gcpts = vcs2vtk.project(cpts,projection,[x1,x2,y1,y2])
          contData.SetPoints(gcpts)
          contMapper = vtk.vtkPolyDataMapper()
          contMapper.SetInputData(contData)
          contActor = vtk.vtkActor()
          contActor.SetMapper(contMapper)
          contActor.GetProperty().SetColor(0.,0.,0.)
      else:
          geo=None

      ren = self.fitToViewport(contActor,[tmpl.data.x1,tmpl.data.x2,tmpl.data.y1,tmpl.data.y2],
              wc=[x1,x2,y1,y2],geo=geo,priority=tmpl.data.priority)
      return {}
コード例 #5
0
ファイル: sanbox.py プロジェクト: doutriaux1/VTKLearning
pts = vtk.vtkPoints()
## Conver tnupmy array to vtk ones
ppV = VN.numpy_to_vtk(m3,deep=False)
pts.SetData(ppV)

# Create the VTK grid
# ??? TODO ??? Use StructuredGrid or RectlinearGrid when appropriate
if 0:
  ug = vtk.vtkPolyData()
else:
  ug = vtk.vtkUnstructuredGrid()

## Ok here we try to apply the geotransform
## And set points onto ug
if p.project!="no":
  geopts = vcs2vtk.project(pts,p.project)
  ## Sets the vertics into the grid
  ug.SetPoints(geopts)
  if p.continents:
    cpts = contData.GetPoints()
    gcpts = vcs2vtk.project(cpts)
    contData.SetPoints(gcpts)
else:
  ## Sets the vertics into the grid
  ug.SetPoints(pts)


#Now applies the actual data on each cell
data = VN.numpy_to_vtk(s.filled().flat,deep=True)
if 0:
  ug.GetPointData().SetScalars(data)