Class ScanBox

java.lang.Object
org.oscim.utils.ScanBox

public abstract class ScanBox extends Object
Scan-line fill algorithm to retrieve tile-coordinates from Viewport.

ScanBox is used to calculate tile coordinates that intersect the box (or trapezoid) which is the projection of screen bounds to the map. Usage:

 Viewport.getMapViewProjection(box)
     ScanBox sb = new ScanBox(){
          protected void setVisible(int y, int x1, int x2) {
          }
    };
 sb.scan(pos.x, pos.y, pos.scale, * zoomLevel, coords);
 

where zoomLevel is the zoom-level for which tile coordinates should be calculated.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    scan(double x, double y, double scale, int zoom, float[] box)
     
    protected abstract void
    setVisible(int y, int x1, int x2)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • mZoom

      protected int mZoom
  • Constructor Details

    • ScanBox

      public ScanBox()
  • Method Details

    • setVisible

      protected abstract void setVisible(int y, int x1, int x2)
      Parameters:
      y - the y-number of tile to be set visible.
      x1 - the start x-number of tile to be set visible.
      x2 - the end x-number of tile to be set visible (excluded).
    • scan

      public void scan(double x, double y, double scale, int zoom, float[] box)
      Parameters:
      x - Projected map position x in 0..1.
      y - Projected map position y in 0..1.
      scale - Absolute scale.
      zoom - Tile zoom level for current scale.
      box - Current visible cut-out (8 floats).