Skip to content

LayerStrategy

johnkit edited this page Nov 20, 2015 · 1 revision

Layers are used to organize 2D map features in vtkMap applications.

  • vtkMap internally reserves a "base" layer for map tiles
  • The application creates one or more other layers for map features. (Each map feature must be assigned to a layer.)
  • vtkMap layers are organized in a sequence. The layer order sets the rendering order.
  • Map features can be moved from one layer to another.
  • Individual layers can be marked as visible or hidden from display.

VTK data types

The VTK geometry/pipelines used by vtkMap are listed here. A more detailed description of each vtkMap feature type is also provided below as an appendix.

  • vtkPolyData/vtkPolyDataMapper/vtkActor: for displaying polyline and polygon features. vtkCellData are used to set color and opacity/visibility at the cell level.
  • vtkPolyData/vtkGlyph3DMapper/vtkActor: for displaying pointset features. vtkPointData are used to set visibility, color, and opacity for each glyph.
  • vtkImageData/vtkImageMapper/vtkImageActor: for displaying raster data. A vtkLookupTable is input to the image mapper to set the color and opacity/visibility of each pixel.
  • Map tiles are displayed as simple texture-mapped vtkPolyData.

Display requirements

  1. For ordinary (unselected) geometry, the requirement is to render each layer in order, equivalent to a back-to-front/painters algorithm. The base/map-tile layer is rendered first, and the other/feature layers are all rendered in front of it.
  2. Geometry that are selected -- which may include polydata cells, glyphs, images -- should be rendered in front of everything else; the equivalent of a front layer.
  3. The rendering order within a layer isn't prescribed, but ideally would be repeatable for a given set of geometry.

Picking modes

Picking modes are:

  • Pick all visible geometry in the selection rectangle. This is the default.
  • Pick the first geometry item at each pixel in the selection rectangle.
  • Pick the geometry from a single, application-spedified layer, in the selection rectangle.
  • And maybe, pick all geometry in the selection rectangle, whether visible or not(?)

Appendix: vtkMap data types

Map Tiles

vtkMap has a vtkMapTile class, which implements each map tile as a texture-mapped plane. The rendered geometry is a vtkPolyData.

Point features

vtkMap provides a vtkMapMarkerSet class for point locations. vtkMapMarkerSet internally uses a vtkPolyData instance to store the point locations, which are rendered using vtkGlyph3DMapper. (More specifically, each vtkMapMarkerSet stores a collection of vtkPolyData, one for each level in a cluster hierarchy. Only one vtkPolyData is displayed at a time, depending on the current zoom level.) A vtkTearDropSource class was written to provide the glyph geometry.

Polyline features

vtkMap provides a vtkPolyDataFeature class for polyline features. The internal data is a vtkPolyData instance, rendered using the vtkPolyDataMapper class. Cell data are used to set the color and opacity/visibility of each cell.

Polygon features

Applications can use the vtkPolyDataFeature for polygon data, but we also implemented a vtkPolyDataOutlineFeature class for the DataBrowser application. This class stores and renders two vtkPolyData instances; one with the polygon geometry, and the other with polylines that outline each polygon.

Raster features

vtkMap provides a vtkRasterFeature class for raster data. Internally, the class uses vtkImageData for the representation, and vtkImageMapper/vtkImageActor for rendering, using a lookup table for visibility, color and opacity. (We also plan to add contour plots and gradient/vector plots for raster data.)