Options
All
  • Public
  • Public/Protected
  • All
Menu

Class QuadTree

A class used to represent a quadtree.

Hierarchy

  • QuadTree

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Readonly tilingScheme

tilingScheme: TilingScheme

The TilingScheme used by this QuadTree.

Methods

visit

  • visit(accept: (tileKey: TileKey, geoBox: GeoBox) => boolean): void
  • Visits this QuadTree and invoke the given accept method with the current TileKey and its bounding box in geo coordinates.

    Example:

    const geoPos = new GeoCoordinates(latitude, longitude);
    const quadTree = new QuadTree(hereTilingScheme);
    quadTree.visit((tileKey, geoBox) => {
        if (geoBox.contains(geoPos)) {
            console.log("tile", tileKey, "contains", geoPos);
            return tileKey.level < 14; // stop visiting the quadtree if the level is >= 14.
        }
        return false; // stop visiting the quadtree,
                      // the tile's geoBox doesn't contain the given coordinates.
    });

    Parameters

    • accept: (tileKey: TileKey, geoBox: GeoBox) => boolean

      A function that takes a TileKey and its bounding box in geo coordinates and returns true if the visit of the QuadTree should continue; otherwise false.

    Returns void

visitTileKey

  • Visits the subtree starting from the given tile.

    Parameters

    • tileKey: TileKey

      The root of the subtree that should be visited.

    • accept: (tileKey: TileKey, geoBox: GeoBox) => boolean

      A function that takes a TileKey and its bounding box in geo coordinates and returns true if the visit of the QuadTree should continue; otherwise false.

    Returns void

Generated using TypeDoc