NASA World Wind

gov.nasa.worldwind.symbology.milstd2525
Class MilStd2525PointGraphicRetriever

java.lang.Object
  extended by gov.nasa.worldwind.symbology.AbstractIconRetriever
      extended by gov.nasa.worldwind.symbology.milstd2525.MilStd2525PointGraphicRetriever
All Implemented Interfaces:
IconRetriever

public class MilStd2525PointGraphicRetriever
extends AbstractIconRetriever

Retriever to fetch icons for MIL-STD-2525C point graphics. The retriever can fetch images from either local or remote locations. See Offline Use for information on how to set the icon retrieval location.

The retriever base URL must identify a location on a local or remote file system (including zip and jar files) that holds the icon files in an expected directory structure. Each icon URL is constructed from three parts: [base]/icons/[scheme]/[sidc].png. Parts of the SIDC that do not identify a type of graphic (such as echelon, status, standard identity, order of battle, etc.) are replaced with hyphens. For example, the Underwater Datum graphic (2.X.2.1.1.1.1.1) will be retrieved from this URL: [base]/icons/tacgrp/g-g-gpuud------.png

An application should only use this class directly if it needs to access point graphics independent of the TacticalGraphic system (for example, to populate a UI independent of the globe).


Field Summary
protected static String DIR_FILL_TACGRP
          Subdirectory for fill graphics.
protected static String DIR_ICON_EMS
          Subdirectory for graphics in the Emergency Management scheme.
protected static String DIR_ICON_METOC
          Subdirectory for graphics in the Meteorological and Oceanographic scheme.
protected static String DIR_ICON_TACGRP
          Subdirectory for graphics in the Tactical Graphics scheme.
protected static String PATH_SUFFIX
          Suffix added to file names to indicate the file type.
 
Fields inherited from class gov.nasa.worldwind.symbology.AbstractIconRetriever
retrieverPath
 
Constructor Summary
MilStd2525PointGraphicRetriever(String retrieverPath)
          Create a new retriever that will retrieve icons from the specified location.
 
Method Summary
protected  String composeFilename(SymbolCode code)
          Indicates the filename of the icon for a graphic.
protected  String composeFilenameEms(SymbolCode code)
          Indicates the filename of a graphic in the Emergency Management scheme (MIL-STD-2525C Appendix G).
protected  String composeFilenameMetoc(SymbolCode code)
          Indicates the filename of a graphic in the Meteorological and Oceanographic scheme (MIL-STD-2525C Appendix C).
protected  String composeFilenameTacticalGraphic(SymbolCode code, String dir)
          Indicates the filename of a graphic in the Tactical Graphics scheme (MIL-STD-2525C Appendix B).
protected  BufferedImage composeFilledImage(BufferedImage srcImg, SymbolCode symbolCode)
          Create an image by drawing over a fill image.
protected  String composeFillPath(SymbolCode code)
          Compose a file path to the fill icon for a graphic.
 BufferedImage createIcon(String sidc, AVList params)
          Create an icon for a MIL-STD-2525C point graphic.
protected  Color getColorForStandardIdentity(SymbolCode code)
          Indicates the color to apply to a graphic based on the graphic's standard identity.
protected  Color getColorFromParams(AVList params)
          Retrieves the value of the AVKey.COLOR parameter.
protected  boolean mustDrawFill(SymbolCode code)
          Indicates whether or not a fill must be drawn for a graphic.
 
Methods inherited from class gov.nasa.worldwind.symbology.AbstractIconRetriever
drawImage, equals, getRetrieverPath, hashCode, multiply, readImage, replaceColor
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIR_FILL_TACGRP

protected static final String DIR_FILL_TACGRP
Subdirectory for fill graphics.

See Also:
Constant Field Values

DIR_ICON_EMS

protected static final String DIR_ICON_EMS
Subdirectory for graphics in the Emergency Management scheme.

See Also:
Constant Field Values

DIR_ICON_METOC

protected static final String DIR_ICON_METOC
Subdirectory for graphics in the Meteorological and Oceanographic scheme.

See Also:
Constant Field Values

DIR_ICON_TACGRP

protected static final String DIR_ICON_TACGRP
Subdirectory for graphics in the Tactical Graphics scheme.

See Also:
Constant Field Values

PATH_SUFFIX

protected static final String PATH_SUFFIX
Suffix added to file names to indicate the file type.

See Also:
Constant Field Values
Constructor Detail

MilStd2525PointGraphicRetriever

public MilStd2525PointGraphicRetriever(String retrieverPath)
Create a new retriever that will retrieve icons from the specified location. The retrieval path may be a file URL to a directory on the local file system (for example, file:///symbols/mil-std-2525). A URL to a network resource (http://myserver.com/milstd2525/), or a URL to a JAR or ZIP file (jar:file:milstd2525-symbols.zip!).

Parameters:
retrieverPath - File path or URL to the symbol directory, for example "http://myserver.com/milstd2525/".
Method Detail

composeFilename

protected String composeFilename(SymbolCode code)
Indicates the filename of the icon for a graphic.

Parameters:
code - Code that identifies a graphic in MIL-STD-2525C.
Returns:
The file name of the image file that corresponds to the specified graphic, or null if the graphic's scheme is not recognized.

composeFilenameEms

protected String composeFilenameEms(SymbolCode code)
Indicates the filename of a graphic in the Emergency Management scheme (MIL-STD-2525C Appendix G).

Parameters:
code - Code that identifies a graphic in the EMS scheme.
Returns:
The filename of the icon for the specified graphic.

composeFilenameMetoc

protected String composeFilenameMetoc(SymbolCode code)
Indicates the filename of a graphic in the Meteorological and Oceanographic scheme (MIL-STD-2525C Appendix C).

Parameters:
code - Code that identifies a graphic in the Metoc scheme.
Returns:
The filename of the icon for the specified graphic.

composeFilenameTacticalGraphic

protected String composeFilenameTacticalGraphic(SymbolCode code,
                                                String dir)
Indicates the filename of a graphic in the Tactical Graphics scheme (MIL-STD-2525C Appendix B).

Parameters:
code - Code that identifies a graphic in the Tactical Graphics scheme.
dir - Directory to prepend to file name.
Returns:
The filename of the icon for the specified graphic.

composeFilledImage

protected BufferedImage composeFilledImage(BufferedImage srcImg,
                                           SymbolCode symbolCode)
Create an image by drawing over a fill image.

Parameters:
srcImg - Image to draw over fill.
symbolCode - Symbol code that identifies the graphic.
Returns:
A new image with the srcImg drawn over the appropriate fill.

composeFillPath

protected String composeFillPath(SymbolCode code)
Compose a file path to the fill icon for a graphic.

Parameters:
code - Code the identifies the graphic.
Returns:
Path to the appropriate fill image.

createIcon

public BufferedImage createIcon(String sidc,
                                AVList params)
Create an icon for a MIL-STD-2525C point graphic. Point graphics are defined in Appendixes B (Tactical Graphics), C (Meteorological and Oceanographic), and G (Emergency Management).

Parameters:
sidc - SIDC identifier for the symbol.
params - Parameters that affect icon retrieval. This retriever accepts only one parameter: AVKey.COLOR, which determines the color of the image. By default the color will be determined from the standard identity.
Returns:
An BufferedImage containing the icon for the requested graphic, or null if the icon cannot be retrieved.

getColorForStandardIdentity

protected Color getColorForStandardIdentity(SymbolCode code)
Indicates the color to apply to a graphic based on the graphic's standard identity.

Parameters:
code - Symbol code that identifies the graphic.
Returns:
Color to apply based on the standard identity. (Red for hostile entities, black for friendly, etc.)

getColorFromParams

protected Color getColorFromParams(AVList params)
Retrieves the value of the AVKey.COLOR parameter.

Parameters:
params - Parameter list.
Returns:
The value of the AVKey.COLOR parameter, if such a parameter exists and is of type java.awt.Color. Returns null if the parameter list is null, if there is no value for key AVKey.COLOR, or if the value is not a Color.

mustDrawFill

protected boolean mustDrawFill(SymbolCode code)
Indicates whether or not a fill must be drawn for a graphic.

Parameters:
code - Symbol code of a point graphic.
Returns:
True if the graphic has a fill image. False if not. Only three graphics in MIL-STD-2525C Appendix B use a fill pattern: Nuclear Detonation Ground Zero (2.X.3.4.2), Biological Release Event (2.X.3.4.7.1), and Chemical Release Event (2.X.3.4.7.2).

NASA World Wind