Package gov.nasa.worldwind.render
Class SurfaceObjectTileBuilder.SurfaceObjectTile
- java.lang.Object
-
- gov.nasa.worldwind.util.Tile
-
- gov.nasa.worldwind.layers.TextureTile
-
- gov.nasa.worldwind.render.SurfaceObjectTileBuilder.SurfaceObjectTile
-
- All Implemented Interfaces:
Cacheable
,SurfaceTile
,java.lang.Comparable<Tile>
- Enclosing class:
- SurfaceObjectTileBuilder
protected static class SurfaceObjectTileBuilder.SurfaceObjectTile extends TextureTile
Represents aTextureTile
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 methodgetStateKey(DrawContext)
provides a mechanism to uniquely identify the tile's current state, including the state of each intersecting surface object.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<SurfaceRenderable>
intersectingObjects
List of surface renderables intersecting the tile.protected java.lang.Object
lastUpdateStateKey
The state key that was valid when the tile was last updated.protected Sector
objectSector
The sector that bounds the surface renderables intersecting the tile.-
Fields inherited from class gov.nasa.worldwind.layers.TextureTile
hasMipmapData, updateTime
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllSurfaceObjects(java.util.List<SurfaceRenderable> c, Sector sector)
Adds the specified collection of surface renderables to the tile's list of intersecting objects.void
addSurfaceObject(SurfaceRenderable so, Sector sector)
Adds the specified surface renderable to the tile's list of intersecting objects.void
clearObjectList()
Clears the tile's list of intersecting objects.protected TextureTile
createSubTile(Sector sector, Level level, int row, int col)
protected TileKey
createSubTileKey(Level level, int row, int col)
Returns a key for a sub tile of this texture tile with the specifiedLevel
, row, and column.java.util.List<SurfaceRenderable>
getObjectList()
Returns a list of surface renderables intersecting the tile.Sector
getObjectSector()
Returns a sector that bounds the surface renderables intersecting the tile.long
getSizeInBytes()
Returns the tile's size in bytes.java.lang.Object
getStateKey(DrawContext dc)
Returns an object that uniquely identifies the tile's state on the specified draw context.boolean
hasObjects()
Returns whether list of surface renderables intersecting this tile has elements.-
Methods inherited from class gov.nasa.worldwind.layers.TextureTile
applyInternalTransform, applyResourceTextureTransform, bind, createSubTiles, equals, getCentroidPoint, getCorners, getExtent, getFallbackTile, getMemoryCache, getTexture, getTextureData, getTileFromMemoryCache, getUpdateTime, hashCode, initializeTexture, isTextureExpired, isTextureExpired, isTextureInMemory, setFallbackTile, setTexture, setTextureData, setTextureParameters, toString, updateMemoryCache
-
Methods inherited from class gov.nasa.worldwind.util.Tile
compareTo, computeColumn, computeColumnLongitude, computeRow, computeRowLatitude, getCacheName, getColumn, getFormatSuffix, getHeight, getLabel, getLevel, getLevelName, getLevelNumber, getPath, getPathBase, getPriority, getResourceURL, getResourceURL, getRow, getSector, getTileKey, getWidth, setPriority
-
Methods inherited from interface gov.nasa.worldwind.render.SurfaceTile
getSector
-
-
-
-
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 thesector
,level
, orcacheName
arenull
.
-
-
Method Detail
-
getSizeInBytes
public long getSizeInBytes()
Returns the tile's size in bytes. Overridden to append the size of thelastUpdateStateKey
to the superclass' computed size.- Specified by:
getSizeInBytes
in interfaceCacheable
- Overrides:
getSizeInBytes
in classTextureTile
- Returns:
- The tile's size in bytes.
-
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, andfalse
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 specifiedSector
,Level
, row, and column. This is called byTextureTile.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 classTextureTile
- 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 specifiedLevel
, row, and column. This is called byTextureTile.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 classTextureTile
- 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.
-
-