[vtkusers] DEMReader, Actor 2D, and Bounding Boxes

Justin Luitjens luitjens at cs.utah.edu
Tue Oct 4 19:18:03 EDT 2005


I am trying to display a color heightmap (in 2D and 3D) of some DEM 
data.  In version 4.2 the 3d and the 2d just showed a single color.  In 
version 4.4 the 3D works just fine but the 2D shows up zoomed way in on 
one spot (as if the bounding box wasn't computed correctly), using the 
latest CVS tree doesn't help either.  The 3D works just fine but the 2D 
shows nothing.  Below is some code fragments that show the flow and 
objects used.  In addition I have attached the full source code (but not 
the datasets).   Is there a bug in the DEM reader module or am I doing 
something wrong?


Thanks,
Justin


********************Some Declerations********************************
#height map render
vtkRenderer ren1
    ren1 SetBackground .5 .5 .5

vtkRenderWindow heightRen
    heightRen AddRenderer ren1
    heightRen SetSize 400 400

vtkRenderer ren2
    ren2 SetBackground .5 .5 .5
vtkRenderWindow flatRen
    flatRen AddRenderer ren2
     flatRen SetSize 400 400

#Readers
vtkDEMReader DEMreader

#Look up Table
vtkLookupTable ColorMap
    ColorMap SetAlphaRange 1.0 1.0
    ColorMap SetNumberOfColors 256

#Mappers
vtkDataSetMapper heightMapper
    heightMapper SetLookupTable ColorMap

vtkPolyDataMapper2D flatMapper
    flatMapper SetLookupTable ColorMap

vtkActor actor
actor SetMapper heightMapper

vtkActor2D actor2d
actor2d SetMapper flatMapper
*************************************************************
...snip....
*************************************************************

proc ShowRapid {} {

    DEMreader SetFileName "rapid_city-e.dat"
   
    resample SetInput [DEMreader GetOutput]
    resample InterpolateOn
    resample SetAxisMagnificationFactor 0 .25
    resample SetAxisMagnificationFactor 1 .25
    resample SetAxisMagnificationFactor 2 .25

    geometry SetInput [resample GetOutput]

      warp SetInput [geometry GetOutput]
      warp SetScaleFactor 20

      merge SetGeometry [warp GetOutput]
      merge SetScalars  [resample GetOutput]

      elevation SetInput [merge GetOutput]
      elevation SetLowPoint 0 0 12000
      elevation SetHighPoint 0 0 20000
   
      heightMapper SetInput [elevation GetOutput]
      heightMapper SetScalarRange 0 1

    flatMapper SetInput [elevation GetOutput]
    flatMapper SetScalarRange 0 1

    ren1 ResetCamera
    ren2 ResetCamera

    heightRen Render
    flatRen Render
}
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: part1.tcl
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051004/02825def/attachment.txt>


More information about the vtkusers mailing list