Class 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

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String DIR_FILL_TACGRP
      Subdirectory for fill graphics.
      protected static java.lang.String DIR_ICON_EMS
      Subdirectory for graphics in the Emergency Management scheme.
      protected static java.lang.String DIR_ICON_METOC
      Subdirectory for graphics in the Meteorological and Oceanographic scheme.
      protected static java.lang.String DIR_ICON_TACGRP
      Subdirectory for graphics in the Tactical Graphics scheme.
      protected static java.lang.String PATH_SUFFIX
      Suffix added to file names to indicate the file type.
    • Constructor Summary

      Constructors 
      Constructor Description
      MilStd2525PointGraphicRetriever​(java.lang.String retrieverPath)
      Create a new retriever that will retrieve icons from the specified location.
    • Field Detail

      • PATH_SUFFIX

        protected static final java.lang.String PATH_SUFFIX
        Suffix added to file names to indicate the file type.
        See Also:
        Constant Field Values
      • DIR_ICON_TACGRP

        protected static final java.lang.String DIR_ICON_TACGRP
        Subdirectory for graphics in the Tactical Graphics scheme.
        See Also:
        Constant Field Values
      • DIR_ICON_METOC

        protected static final java.lang.String DIR_ICON_METOC
        Subdirectory for graphics in the Meteorological and Oceanographic scheme.
        See Also:
        Constant Field Values
      • DIR_ICON_EMS

        protected static final java.lang.String DIR_ICON_EMS
        Subdirectory for graphics in the Emergency Management scheme.
        See Also:
        Constant Field Values
      • DIR_FILL_TACGRP

        protected static final java.lang.String DIR_FILL_TACGRP
        Subdirectory for fill graphics.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MilStd2525PointGraphicRetriever

        public MilStd2525PointGraphicRetriever​(java.lang.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

      • createIcon

        public java.awt.image.BufferedImage createIcon​(java.lang.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.
      • composeFilledImage

        protected java.awt.image.BufferedImage composeFilledImage​(java.awt.image.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.
      • 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).
      • getColorFromParams

        protected java.awt.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.
      • getColorForStandardIdentity

        protected java.awt.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.)
      • composeFillPath

        protected java.lang.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.
      • composeFilename

        protected java.lang.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.
      • composeFilenameTacticalGraphic

        protected java.lang.String composeFilenameTacticalGraphic​(SymbolCode code,
                                                                  java.lang.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.
      • composeFilenameMetoc

        protected java.lang.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.
      • composeFilenameEms

        protected java.lang.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.