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, Layer, NamedObject, Restorable, BulkRetrievable, WWObject, java.beans.PropertyChangeListener, java.util.EventListener
Direct Known Subclasses:
EarthNASAPlaceNameLayer, 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  java.lang.Object fileLock
           
protected static LatLon GRID_144x288
           
protected static LatLon GRID_16x32
           
protected static LatLon GRID_1x1
           
protected static LatLon GRID_288x576
           
protected static LatLon GRID_36x72
           
protected static LatLon GRID_4x8
           
protected static LatLon GRID_72x144
           
protected static LatLon GRID_8x16
           
protected static double LEVEL_A
           
protected static double LEVEL_B
           
protected static double LEVEL_C
           
protected static double LEVEL_D
           
protected static double LEVEL_E
           
protected static double LEVEL_F
           
protected static double LEVEL_G
           
protected static double LEVEL_H
           
protected static double LEVEL_I
           
protected static double LEVEL_J
           
protected static double LEVEL_K
           
protected static double LEVEL_L
           
protected static double LEVEL_M
           
protected static double LEVEL_N
           
protected static double LEVEL_O
           
protected static double LEVEL_P
           
protected  java.util.List<PlaceNameLayer.NavigationTile> navTiles
           
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
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()
           
 boolean isCullNames()
           
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, java.net.URL url)
           
 BulkRetrievalThread makeLocal(Sector sector, double resolution)
          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)
          Start a new BulkRetrievalThread that downloads all placenames for a given sector and resolution to a specified file store.
protected static java.nio.CharBuffer newCharBuffer(int numElements)
           
protected static PlaceNameLayer.PlaceNameChunk readTileData(PlaceNameLayer.Tile tile, java.net.URL url)
           
protected  void requestTile(DrawContext dc, PlaceNameLayer.Tile tile)
           
protected  void saveBuffer(java.nio.ByteBuffer buffer, java.io.File outFile)
           
protected  void sendRequests()
           
 void setCullNames(boolean cullNames)
           
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
dispose, doPick, doPreRender, getDataFileStore, getExpiryTime, getMaxActiveAltitude, getMinActiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, 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
propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, 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.NamedObject
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
 

Field Detail

fileLock

protected final java.lang.Object fileLock

GRID_144x288

protected static final LatLon GRID_144x288

GRID_16x32

protected static final LatLon GRID_16x32

GRID_1x1

protected static final LatLon GRID_1x1

GRID_288x576

protected static final LatLon GRID_288x576

GRID_36x72

protected static final LatLon GRID_36x72

GRID_4x8

protected static final LatLon GRID_4x8

GRID_72x144

protected static final LatLon GRID_72x144

GRID_8x16

protected static final LatLon GRID_8x16

LEVEL_A

protected static final double LEVEL_A
See Also:
Constant Field Values

LEVEL_B

protected static final double LEVEL_B
See Also:
Constant Field Values

LEVEL_C

protected static final double LEVEL_C
See Also:
Constant Field Values

LEVEL_D

protected static final double LEVEL_D
See Also:
Constant Field Values

LEVEL_E

protected static final double LEVEL_E
See Also:
Constant Field Values

LEVEL_F

protected static final double LEVEL_F
See Also:
Constant Field Values

LEVEL_G

protected static final double LEVEL_G
See Also:
Constant Field Values

LEVEL_H

protected static final double LEVEL_H
See Also:
Constant Field Values

LEVEL_I

protected static final double LEVEL_I
See Also:
Constant Field Values

LEVEL_J

protected static final double LEVEL_J
See Also:
Constant Field Values

LEVEL_K

protected static final double LEVEL_K
See Also:
Constant Field Values

LEVEL_L

protected static final double LEVEL_L
See Also:
Constant Field Values

LEVEL_M

protected static final double LEVEL_M
See Also:
Constant Field Values

LEVEL_N

protected static final double LEVEL_N
See Also:
Constant Field Values

LEVEL_O

protected static final double LEVEL_O
See Also:
Constant Field Values

LEVEL_P

protected static final double LEVEL_P
See Also:
Constant Field Values

navTiles

protected java.util.List<PlaceNameLayer.NavigationTile> navTiles
Constructor Detail

PlaceNameLayer

public PlaceNameLayer(PlaceNameServiceSet placeNameServiceSet)
Parameters:
placeNameServiceSet - the set of PlaceNameService objects that PlaceNameLayer will render.
Throws:
java.lang.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:
java.lang.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:
java.lang.IllegalArgumentException - if the sector is null or the resolution is less than zero.

getPlaceNameServiceSet

public final PlaceNameServiceSet getPlaceNameServiceSet()

getReferencePoint

protected Vec4 getReferencePoint()

isCullNames

public boolean isCullNames()

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,
                           java.net.URL url)

makeLocal

public BulkRetrievalThread makeLocal(Sector sector,
                                     double resolution)
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.
Returns:
the PlaceNameLayerBulkDownloader that executes the retrieval.
Throws:
java.lang.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)
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.
Returns:
the PlaceNameLayerBulkDownloader that executes the retrieval.
Throws:
java.lang.IllegalArgumentException - if the sector is null or the resolution is less than zero.
See Also:
PlaceNameLayerBulkDownloader

newCharBuffer

protected static java.nio.CharBuffer newCharBuffer(int numElements)

readTileData

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

requestTile

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

saveBuffer

protected void saveBuffer(java.nio.ByteBuffer buffer,
                          java.io.File outFile)
                   throws java.io.IOException
Throws:
java.io.IOException

sendRequests

protected void sendRequests()

setCullNames

public void setCullNames(boolean cullNames)

NASA World Wind