Class SurfaceObjectTileBuilder.SurfaceObjectTile

  • All Implemented Interfaces:
    Cacheable, SurfaceTile, java.lang.Comparable<Tile>
    Enclosing class:
    SurfaceObjectTileBuilder

    protected static class SurfaceObjectTileBuilder.SurfaceObjectTile
    extends TextureTile
    Represents a TextureTile who's contents is constructed by a set of surface objects. The tile maintains a collection of surface renderables that intersect the tile, and provides methods for to modify and retrieve that collection. Additionally, the method getStateKey(DrawContext) provides a mechanism to uniquely identify the tile's current state, including the state of each intersecting surface object.
    • Field Detail

      • objectSector

        protected Sector objectSector
        The sector that bounds the surface renderables intersecting the tile.
      • intersectingObjects

        protected java.util.List<SurfaceRenderable> intersectingObjects
        List of surface renderables intersecting the tile.
      • lastUpdateStateKey

        protected java.lang.Object lastUpdateStateKey
        The state key that was valid when the tile was last updated.
    • Constructor Detail

      • SurfaceObjectTile

        public SurfaceObjectTile​(Sector sector,
                                 Level level,
                                 int row,
                                 int column,
                                 java.lang.String cacheName)
        Constructs a tile for a given sector, level, row and column of the tile's containing tile set.
        Parameters:
        sector - The sector corresponding with the tile.
        level - The tile's level within a containing level set.
        row - The row index (0 origin) of the tile within the indicated level.
        column - The column index (0 origin) of the tile within the indicated level.
        cacheName - The tile's cache name. Overrides the Level's cache name to associates the tile with it's tile builder in a global cache.
        Throws:
        java.lang.IllegalArgumentException - if any of the sector, level, or cacheName are null.
    • Method Detail

      • getStateKey

        public java.lang.Object getStateKey​(DrawContext dc)
        Returns an object that uniquely identifies the tile's state on the specified draw context. This object is guaranteed to be globally unique; an equality test with a state key from another always returns false.
        Parameters:
        dc - the draw context the state key relates to.
        Returns:
        an object representing surface renderable's current state.
      • getObjectSector

        public Sector getObjectSector()
        Returns a sector that bounds the surface renderables intersecting the tile. This returns null if no surface objects intersect the tile.
        Returns:
        a sector bounding the tile's intersecting objects.
      • hasObjects

        public boolean hasObjects()
        Returns whether list of surface renderables intersecting this tile has elements.
        Returns:
        true if the list of surface renderables intersecting this tile has elements, and false otherwise.
      • getObjectList

        public java.util.List<SurfaceRenderable> getObjectList()
        Returns a list of surface renderables intersecting the tile.
        Returns:
        a tile's intersecting objects.
      • clearObjectList

        public void clearObjectList()
        Clears the tile's list of intersecting objects. getObjectSector() returns null after calling this method.
      • addSurfaceObject

        public void addSurfaceObject​(SurfaceRenderable so,
                                     Sector sector)
        Adds the specified surface renderable to the tile's list of intersecting objects.
        Parameters:
        so - the surface renderable to add.
        sector - the sector bounding the specified surface renderable.
      • addAllSurfaceObjects

        public void addAllSurfaceObjects​(java.util.List<SurfaceRenderable> c,
                                         Sector sector)
        Adds the specified collection of surface renderables to the tile's list of intersecting objects.
        Parameters:
        c - the collection of surface renderables to add.
        sector - the sector bounding the specified surface renderable collection.
      • createSubTile

        protected TextureTile createSubTile​(Sector sector,
                                            Level level,
                                            int row,
                                            int col)
        Creates a sub tile of this texture tile with the specified Sector, Level, row, and column. This is called by TextureTile.createSubTiles(gov.nasa.worldwind.util.Level), to construct a sub tile for each quadrant of this tile. Subclasses must override this method to return an instance of the derived version.

        Overridden to return a new SurfaceObjectTile. The returned tile is created with the same cache name as this tile.

        Overrides:
        createSubTile in class TextureTile
        Parameters:
        sector - the sub tile's sector.
        level - the sub tile's level.
        row - the sub tile's row.
        col - the sub tile's column.
        Returns:
        a sub tile of this texture tile.
      • createSubTileKey

        protected TileKey createSubTileKey​(Level level,
                                           int row,
                                           int col)
        Returns a key for a sub tile of this texture tile with the specified Level, row, and column. This is called by TextureTile.createSubTiles(gov.nasa.worldwind.util.Level), to create a sub tile key for each quadrant of this tile.

        Overridden to return a TileKey with the same cache name as this tile.

        Overrides:
        createSubTileKey in class TextureTile
        Parameters:
        level - the sub tile's level.
        row - the sub tile's row.
        col - the sub tile's column.
        Returns:
        a sub tile of this texture tile.