NASA World Wind

gov.nasa.worldwind.layers.placename
Class PlaceNameLayer

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
              extended by gov.nasa.worldwind.layers.placename.PlaceNameLayer
All Implemented Interfaces:
AVList, Disposable, MessageListener, Layer, Restorable, BulkRetrievable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
NASAWFSPlaceNameLayer

public class PlaceNameLayer
extends AbstractLayer
implements BulkRetrievable


Nested Class Summary
protected static class PlaceNameLayer.DownloadPostProcessor
           
protected static class PlaceNameLayer.GMLPlaceNameSAXHandler
           
protected  class PlaceNameLayer.NavigationTile
           
protected static class PlaceNameLayer.PlaceNameChunk
           
protected static class PlaceNameLayer.RequestTask
           
protected static class PlaceNameLayer.Tile
           
 
Field Summary
protected  boolean cullNames
           
protected  Object fileLock
           
static LatLon GRID_1152x2304
           
static LatLon GRID_144x288
           
static LatLon GRID_16x32
           
static LatLon GRID_1x1
           
static LatLon GRID_288x576
           
static LatLon GRID_36x72
           
static LatLon GRID_4x8
           
static LatLon GRID_576x1152
           
static LatLon GRID_72x144
           
static LatLon GRID_8x16
           
static double LEVEL_A
           
static double LEVEL_B
           
static double LEVEL_C
           
static double LEVEL_D
           
static double LEVEL_E
           
static double LEVEL_F
           
static double LEVEL_G
           
static double LEVEL_H
           
static double LEVEL_I
           
static double LEVEL_J
           
static double LEVEL_K
           
static double LEVEL_L
           
static double LEVEL_M
           
static double LEVEL_N
           
static double LEVEL_O
           
static double LEVEL_P
           
protected  List<PlaceNameLayer.NavigationTile> navTiles
           
protected  PlaceNameServiceSet placeNameServiceSet
           
protected  Vec4 referencePoint
           
protected  PriorityBlockingQueue<Runnable> requestQ
           
 
Constructor Summary
PlaceNameLayer(PlaceNameServiceSet placeNameServiceSet)
           
 
Method Summary
protected  PlaceNameLayer.Tile[] buildTiles(PlaceNameService placeNameService, PlaceNameLayer.NavigationTile navTile)
           
protected static Angle clampAngle(Angle a, Angle min, Angle max)
           
protected  Vec4 computeReferencePoint(DrawContext dc)
           
protected  void doRender(DrawContext dc)
           
protected  void downloadTile(PlaceNameLayer.Tile tile)
           
protected  void downloadTile(PlaceNameLayer.Tile tile, PlaceNameLayer.DownloadPostProcessor postProcessor)
           
protected  void drawOrRequestTile(DrawContext dc, PlaceNameLayer.Tile tile, double minDisplayDistanceSquared, double maxDisplayDistanceSquared)
           
 long getEstimatedMissingDataSize(Sector sector, double resolution)
          Get the estimated size in bytes of the placenames not in the World Wind file cache for the given sector and resolution.
 long getEstimatedMissingDataSize(Sector sector, double resolution, FileStore fileStore)
          Get the estimated size in bytes of the placenames not in a specified file store for the given sector and resolution.
 PlaceNameServiceSet getPlaceNameServiceSet()
           
protected  Vec4 getReferencePoint()
           
protected  PriorityBlockingQueue<Runnable> getRequestQ()
           
protected static boolean isNameVisible(DrawContext dc, PlaceNameService service, Position namePosition)
           
protected static boolean isSectorVisible(DrawContext dc, Sector sector, double minDistanceSquared, double maxDistanceSquared)
           
protected static boolean isServiceVisible(DrawContext dc, PlaceNameService placeNameService)
           
protected static boolean isTileVisible(DrawContext dc, PlaceNameLayer.Tile tile, double minDistanceSquared, double maxDistanceSquared)
           
protected  boolean loadTile(PlaceNameLayer.Tile tile, URL url)
           
 BulkRetrievalThread makeLocal(Sector sector, double resolution, BulkRetrievalListener listener)
          Start a new BulkRetrievalThread that downloads all placenames for a given sector and resolution to the current World Wind file cache.
 BulkRetrievalThread makeLocal(Sector sector, double resolution, FileStore fileStore, BulkRetrievalListener listener)
          Start a new BulkRetrievalThread that downloads all placenames for a given sector and resolution to a specified file store.
protected static CharBuffer newCharBuffer(int numElements)
           
protected static PlaceNameLayer.PlaceNameChunk readTileData(PlaceNameLayer.Tile tile, URL url)
           
protected  void requestTile(DrawContext dc, PlaceNameLayer.Tile tile)
           
protected  void saveBuffer(ByteBuffer buffer, File outFile)
           
protected  void sendRequests()
           
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
createLayerConfigElements, dispose, doPick, doPreRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit, toString
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.retrieve.BulkRetrievable
getName
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Field Detail

cullNames

protected boolean cullNames

fileLock

protected final Object fileLock

GRID_1152x2304

public static final LatLon GRID_1152x2304

GRID_144x288

public static final LatLon GRID_144x288

GRID_16x32

public static final LatLon GRID_16x32

GRID_1x1

public static final LatLon GRID_1x1

GRID_288x576

public static final LatLon GRID_288x576

GRID_36x72

public static final LatLon GRID_36x72

GRID_4x8

public static final LatLon GRID_4x8

GRID_576x1152

public static final LatLon GRID_576x1152

GRID_72x144

public static final LatLon GRID_72x144

GRID_8x16

public static final LatLon GRID_8x16

LEVEL_A

public static final double LEVEL_A
See Also:
Constant Field Values

LEVEL_B

public static final double LEVEL_B
See Also:
Constant Field Values

LEVEL_C

public static final double LEVEL_C
See Also:
Constant Field Values

LEVEL_D

public static final double LEVEL_D
See Also:
Constant Field Values

LEVEL_E

public static final double LEVEL_E
See Also:
Constant Field Values

LEVEL_F

public static final double LEVEL_F
See Also:
Constant Field Values

LEVEL_G

public static final double LEVEL_G
See Also:
Constant Field Values

LEVEL_H

public static final double LEVEL_H
See Also:
Constant Field Values

LEVEL_I

public static final double LEVEL_I
See Also:
Constant Field Values

LEVEL_J

public static final double LEVEL_J
See Also:
Constant Field Values

LEVEL_K

public static final double LEVEL_K
See Also:
Constant Field Values

LEVEL_L

public static final double LEVEL_L
See Also:
Constant Field Values

LEVEL_M

public static final double LEVEL_M
See Also:
Constant Field Values

LEVEL_N

public static final double LEVEL_N
See Also:
Constant Field Values

LEVEL_O

public static final double LEVEL_O
See Also:
Constant Field Values

LEVEL_P

public static final double LEVEL_P
See Also:
Constant Field Values

navTiles

protected List<PlaceNameLayer.NavigationTile> navTiles

placeNameServiceSet

protected final PlaceNameServiceSet placeNameServiceSet

referencePoint

protected Vec4 referencePoint

requestQ

protected PriorityBlockingQueue<Runnable> requestQ
Constructor Detail

PlaceNameLayer

public PlaceNameLayer(PlaceNameServiceSet placeNameServiceSet)
Parameters:
placeNameServiceSet - the set of PlaceNameService objects that PlaceNameLayer will render.
Throws:
IllegalArgumentException - if PlaceNameServiceSet is null
Method Detail

buildTiles

protected PlaceNameLayer.Tile[] buildTiles(PlaceNameService placeNameService,
                                           PlaceNameLayer.NavigationTile navTile)

clampAngle

protected static Angle clampAngle(Angle a,
                                  Angle min,
                                  Angle max)

computeReferencePoint

protected Vec4 computeReferencePoint(DrawContext dc)

doRender

protected void doRender(DrawContext dc)
Specified by:
doRender in class AbstractLayer

downloadTile

protected void downloadTile(PlaceNameLayer.Tile tile)

downloadTile

protected void downloadTile(PlaceNameLayer.Tile tile,
                            PlaceNameLayer.DownloadPostProcessor postProcessor)

drawOrRequestTile

protected void drawOrRequestTile(DrawContext dc,
                                 PlaceNameLayer.Tile tile,
                                 double minDisplayDistanceSquared,
                                 double maxDisplayDistanceSquared)

getEstimatedMissingDataSize

public long getEstimatedMissingDataSize(Sector sector,
                                        double resolution)
Get the estimated size in bytes of the placenames not in the World Wind file cache for the given sector and resolution.

Note that the target resolution must be provided in radians of latitude per texel, which is the resolution in meters divided by the globe radius.

Specified by:
getEstimatedMissingDataSize in interface BulkRetrievable
Parameters:
sector - the sector to estimate.
resolution - the target resolution, provided in radians of latitude per texel.
Returns:
the estimated size in bytes of the missing placenames.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.

getEstimatedMissingDataSize

public long getEstimatedMissingDataSize(Sector sector,
                                        double resolution,
                                        FileStore fileStore)
Get the estimated size in bytes of the placenames not in a specified file store for the given sector and resolution.

Note that the target resolution must be provided in radians of latitude per texel, which is the resolution in meters divided by the globe radius.

Specified by:
getEstimatedMissingDataSize in interface BulkRetrievable
Parameters:
sector - the sector to estimate.
resolution - the target resolution, provided in radians of latitude per texel.
fileStore - the file store to examine. If null the current World Wind file cache is used.
Returns:
the estimated size in byte of the missing placenames.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.

getPlaceNameServiceSet

public final PlaceNameServiceSet getPlaceNameServiceSet()

getReferencePoint

protected Vec4 getReferencePoint()

getRequestQ

protected PriorityBlockingQueue<Runnable> getRequestQ()

isNameVisible

protected static boolean isNameVisible(DrawContext dc,
                                       PlaceNameService service,
                                       Position namePosition)

isSectorVisible

protected static boolean isSectorVisible(DrawContext dc,
                                         Sector sector,
                                         double minDistanceSquared,
                                         double maxDistanceSquared)

isServiceVisible

protected static boolean isServiceVisible(DrawContext dc,
                                          PlaceNameService placeNameService)

isTileVisible

protected static boolean isTileVisible(DrawContext dc,
                                       PlaceNameLayer.Tile tile,
                                       double minDistanceSquared,
                                       double maxDistanceSquared)

loadTile

protected boolean loadTile(PlaceNameLayer.Tile tile,
                           URL url)

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution,
                                     BulkRetrievalListener listener)
Start a new BulkRetrievalThread that downloads all placenames for a given sector and resolution to the current World Wind file cache.

This method creates and starts a thread to perform the download. A reference to the thread is returned. To create a downloader that has not been started, construct a PlaceNameLayerBulkDownloader.

Note that the target resolution must be provided in radians of latitude per texel, which is the resolution in meters divided by the globe radius.

Specified by:
makeLocal in interface BulkRetrievable
Parameters:
sector - the sector to download data for.
resolution - the target resolution, provided in radians of latitude per texel.
listener - an optional retrieval listener. May be null.
Returns:
the PlaceNameLayerBulkDownloader that executes the retrieval.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
PlaceNameLayerBulkDownloader

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution,
                                     FileStore fileStore,
                                     BulkRetrievalListener listener)
Start a new BulkRetrievalThread that downloads all placenames for a given sector and resolution to a specified file store.

This method creates and starts a thread to perform the download. A reference to the thread is returned. To create a downloader that has not been started, construct a PlaceNameLayerBulkDownloader.

Note that the target resolution must be provided in radians of latitude per texel, which is the resolution in meters divided by the globe radius.

Specified by:
makeLocal in interface BulkRetrievable
Parameters:
sector - the sector to download data for.
resolution - the target resolution, provided in radians of latitude per texel.
fileStore - the file store in which to place the downloaded elevations. If null the current World Wind file cache is used.
listener - an optional retrieval listener. May be null.
Returns:
the PlaceNameLayerBulkDownloader that executes the retrieval.
Throws:
IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
PlaceNameLayerBulkDownloader

newCharBuffer

protected static CharBuffer newCharBuffer(int numElements)

readTileData

protected static PlaceNameLayer.PlaceNameChunk readTileData(PlaceNameLayer.Tile tile,
                                                            URL url)

requestTile

protected void requestTile(DrawContext dc,
                           PlaceNameLayer.Tile tile)

saveBuffer

protected void saveBuffer(ByteBuffer buffer,
                          File outFile)
                   throws IOException
Throws:
IOException

sendRequests

protected void sendRequests()

NASA World Wind