Class SymbolUtilities


  • public class SymbolUtilities
    extends java.lang.Object
    Has various utility functions for prcessing the symbol code. See SymbolID for additional functions related to parsing the symbol code.
    • Constructor Summary

      Constructors 
      Constructor Description
      SymbolUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.Boolean canSymbolHaveModifier​(java.lang.String symbolID, java.lang.String modifier)
      static java.lang.String getBasicSymbolID​(java.lang.String id)
      Gets Basic Symbol ID which is the Symbol Set + Entity Code
      static java.lang.String getBasicSymbolID2525C​(java.lang.String strSymbolID)
      Deprecated.
      function will be removed
      static java.awt.Point getCMSymbolAnchorPoint​(java.lang.String symbolID, java.awt.geom.Rectangle2D bounds)
      Gets the anchor point for single point Control Measure as the anchor point isn't always they center of the symbol.
      static java.lang.String getDateLabel​(java.util.Date time)
      Converts a Java Date object into a properly formatted String for W or W1.
      static java.awt.Color getDefaultLineColor​(java.lang.String symbolID)
      For Control Measures, returns the default color for a symbol when it differs from the affiliation line color.
      static java.lang.String getEchelonText​(int echelon)
      Reads the Symbol ID string and returns the text that represents the echelon code.
      static java.awt.Color getFillColorOfAffiliation​(java.lang.String symbolID)
      Returns the fill color for the symbol based on its affiliation
      static java.awt.Color getLineColorOfAffiliation​(java.lang.String symbolID)
      Gets line color used if no line color has been set.
      static java.lang.String getStandardIdentityModifier​(java.lang.String symbolID)
      Returns the Standard Identity Modifier based on the Symbol ID
      static float getUnitRatioHeight​(java.lang.String symbolID)
      Returns the height ratio for the unit specified by the symbol ID Based on Figure 4 in 2525E.
      static float getUnitRatioWidth​(java.lang.String symbolID)
      Returns the width ratio for the unit specified by the symbol ID Based on Figure 4 in 2525E.
      static boolean hasDefaultFill​(java.lang.String strSymbolID)
      Checks if a symbol should be filled by default
      static java.lang.Boolean hasFDI​(java.lang.String symbolID)
      Checks if the Symbol Code has FDI set.
      static java.lang.Boolean hasModifier​(java.lang.String symbolID, java.lang.String modifier)
      Determines if a symbol, based on it's symbol ID, can have the specified modifier/amplifier.
      static boolean hasRectangleFrame​(java.lang.String symbolID)
      Returens true if the unit has a rectangle frame
      static boolean isActionPoint​(java.lang.String symbolID)  
      static java.lang.Boolean isAir​(java.lang.String symbolID)
      Returns true if the symbol is from an air based symbol set
      static boolean isCBRNEvent​(java.lang.String symbolID)
      Returns true if Symbol ID represents a chemical, biological, radiological or nuclear incident.
      static java.lang.Boolean isExercise​(java.lang.String symbolID)
      Returns true if the symbol ID indicates the context is Exercise
      static boolean isGreenProtectionGraphic​(int entity, int entityType, int entitySubtype)
      Returns true if graphic is protection graphic (obstacles which render green) Assumes control measure symbol code where SS == 25
      static boolean isGreenProtectionGraphic​(java.lang.String symbolID)
      Returns true if graphic is protection graphic (obstacles which render green)
      static boolean isHQ​(java.lang.String symbolID)
      Returns true if the symbol has the HQ staff indicated by the symbol ID
      static java.lang.Boolean isInstallation​(java.lang.String symbolID)
      Returns true if the symbol is an installation
      static java.lang.Boolean isLand​(java.lang.String symbolID)
      Returns true if the symbol is from a land based symbol set
      static boolean isMultiPoint​(java.lang.String symbolID)
      Determines if the Symbol can be rendered as a multipoint graphic and not just as an icon
      static boolean isNumber​(java.lang.String text)
      Determines if a String represents a valid number
      static boolean isObstacle​(java.lang.String symbolID)
      static java.lang.Boolean isReality​(java.lang.String symbolID)
      Returns true if the symbol ID indicates the context is Reality
      static java.lang.Boolean isSimulation​(java.lang.String symbolID)
      Returns true if the symbol ID indicates the context is Simulation
      static boolean isSonobuoy​(java.lang.String symbolID)
      Returns true if Symbol ID represents a Sonobuoy.
      static java.lang.Boolean isSpace​(java.lang.String symbolID)
      Returns true if the symbol is from a space based symbol set
      static boolean isSPWithSpecialModifierLayout​(java.lang.String symbolID)
      Checks if this is a single point control measure or meteorological graphic with a unique layout.
      static boolean isTacticalGraphic​(java.lang.String strSymbolID)
      Determines if the symbol is a tactical graphic
      static java.lang.Boolean isTaskForce​(java.lang.String symbolID)
      Returns true if the symbol ID has the task for indicator
      static boolean isTGSPWithSpecialModifierLayout​(java.lang.String strSymbolID)
      static boolean isWeather​(java.lang.String symbolID)
      Return true if symbol is from the Atmospheric, Oceanographic or Meteorological Space Symbol Sets.
      static java.lang.String reconcileSymbolID​(java.lang.String symbolID)
      Attempts to resolve a bad symbol ID into a value that can be found in MSLookup.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SymbolUtilities

        public SymbolUtilities()
    • Method Detail

      • isNumber

        public static boolean isNumber​(java.lang.String text)
        Determines if a String represents a valid number
        Parameters:
        text - String
        Returns:
        "1.56" == true, "1ab" == false
      • getDateLabel

        public static java.lang.String getDateLabel​(java.util.Date time)
        Converts a Java Date object into a properly formatted String for W or W1. DDHHMMSSZMONYYYY Field W: D = day, H = hour, M = minute, S = second, Z = Greenwich or local time, MON= month and Y = year.
        Parameters:
        time - Date
        Returns:
        String
      • hasModifier

        public static java.lang.Boolean hasModifier​(java.lang.String symbolID,
                                                    java.lang.String modifier)
        Determines if a symbol, based on it's symbol ID, can have the specified modifier/amplifier.
        Parameters:
        symbolID - 30 Character String
        modifier - Modifiers
        Returns:
        Boolean
      • getBasicSymbolID

        public static java.lang.String getBasicSymbolID​(java.lang.String id)
        Gets Basic Symbol ID which is the Symbol Set + Entity Code
        Parameters:
        id - 30 Character String
        Returns:
        8 character String (Symbol Set + Entity Code)
      • getBasicSymbolID2525C

        public static java.lang.String getBasicSymbolID2525C​(java.lang.String strSymbolID)
        Deprecated.
        function will be removed
        Gets the basic Symbol ID for a 2525C symbol S*F*GPU---***** G*G*GPP---****X
        Parameters:
        strSymbolID - 15 Character String
        Returns:
        15 Character String
      • reconcileSymbolID

        public static java.lang.String reconcileSymbolID​(java.lang.String symbolID)
        Attempts to resolve a bad symbol ID into a value that can be found in MSLookup. If it fails, it will return the symbol code for a invalid symbol which is displayed as an inverted question mark (110098000010000000000000000000)
        Parameters:
        symbolID - 30 character String
        Returns:
        30 character String representing the resolved symbol ID.
      • getLineColorOfAffiliation

        public static java.awt.Color getLineColorOfAffiliation​(java.lang.String symbolID)
        Gets line color used if no line color has been set. The color is specified based on the affiliation of the symbol and whether it is a unit or not.
        Parameters:
        symbolID - 30 character String
        Returns:
        Color
      • getDefaultLineColor

        public static java.awt.Color getDefaultLineColor​(java.lang.String symbolID)
        For Control Measures, returns the default color for a symbol when it differs from the affiliation line color. If there is no default color, returns the value from getLineColorOfAffiliation(String)
        Parameters:
        symbolID - 30 Character String
        Returns:
        Color
      • hasDefaultFill

        public static boolean hasDefaultFill​(java.lang.String strSymbolID)
        Checks if a symbol should be filled by default
        Parameters:
        strSymbolID - The 20 digit representation of the 2525D symbol
        Returns:
        true if there is a default fill
      • isTacticalGraphic

        public static boolean isTacticalGraphic​(java.lang.String strSymbolID)
        Determines if the symbol is a tactical graphic
        Parameters:
        strSymbolID - 30 Character String
        Returns:
        true if symbol set is 25 (control measure), or is a weather graphic
      • isMultiPoint

        public static boolean isMultiPoint​(java.lang.String symbolID)
        Determines if the Symbol can be rendered as a multipoint graphic and not just as an icon
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isActionPoint

        public static boolean isActionPoint​(java.lang.String symbolID)
      • isTGSPWithSpecialModifierLayout

        public static boolean isTGSPWithSpecialModifierLayout​(java.lang.String strSymbolID)
        Control Measures and Tactical Graphics that have labels but not with the Action Point layout
        Parameters:
        strSymbolID - 30 Character String
        Returns:
        Boolean
      • getFillColorOfAffiliation

        public static java.awt.Color getFillColorOfAffiliation​(java.lang.String symbolID)
        Returns the fill color for the symbol based on its affiliation
        Parameters:
        symbolID - 30 Character String
        Returns:
        Color
      • canSymbolHaveModifier

        public static java.lang.Boolean canSymbolHaveModifier​(java.lang.String symbolID,
                                                              java.lang.String modifier)
        Parameters:
        symbolID - 30 Character String
        modifier - Modifiers
        Returns:
        Boolean
      • hasFDI

        public static java.lang.Boolean hasFDI​(java.lang.String symbolID)
        Checks if the Symbol Code has FDI set. Does not check if the symbol can have an FDI.
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isGreenProtectionGraphic

        public static boolean isGreenProtectionGraphic​(int entity,
                                                       int entityType,
                                                       int entitySubtype)
        Returns true if graphic is protection graphic (obstacles which render green) Assumes control measure symbol code where SS == 25
        Parameters:
        entity - Integer
        entityType - Integer
        entitySubtype - Integer
        Returns:
        Boolean
      • isGreenProtectionGraphic

        public static boolean isGreenProtectionGraphic​(java.lang.String symbolID)
        Returns true if graphic is protection graphic (obstacles which render green)
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isCBRNEvent

        public static boolean isCBRNEvent​(java.lang.String symbolID)
        Returns true if Symbol ID represents a chemical, biological, radiological or nuclear incident.
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isSonobuoy

        public static boolean isSonobuoy​(java.lang.String symbolID)
        Returns true if Symbol ID represents a Sonobuoy.
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isObstacle

        public static boolean isObstacle​(java.lang.String symbolID)
        Obstacles are generally required to have a green line color
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isWeather

        public static boolean isWeather​(java.lang.String symbolID)
        Return true if symbol is from the Atmospheric, Oceanographic or Meteorological Space Symbol Sets.
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isHQ

        public static boolean isHQ​(java.lang.String symbolID)
        Returns true if the symbol has the HQ staff indicated by the symbol ID
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isSPWithSpecialModifierLayout

        public static boolean isSPWithSpecialModifierLayout​(java.lang.String symbolID)
        Checks if this is a single point control measure or meteorological graphic with a unique layout. Basically anything that's not an action point style graphic with modifiers
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • getCMSymbolAnchorPoint

        public static java.awt.Point getCMSymbolAnchorPoint​(java.lang.String symbolID,
                                                            java.awt.geom.Rectangle2D bounds)
        Gets the anchor point for single point Control Measure as the anchor point isn't always they center of the symbol.
        Parameters:
        symbolID - 30 Character String
        bounds - Rectangle2D representing the bound of the core symbol in the image.
        Returns:
        Point representing the point in the image that is the anchor point of the symbol.
      • isInstallation

        public static java.lang.Boolean isInstallation​(java.lang.String symbolID)
        Returns true if the symbol is an installation
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isAir

        public static java.lang.Boolean isAir​(java.lang.String symbolID)
        Returns true if the symbol is from an air based symbol set
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isSpace

        public static java.lang.Boolean isSpace​(java.lang.String symbolID)
        Returns true if the symbol is from a space based symbol set
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isLand

        public static java.lang.Boolean isLand​(java.lang.String symbolID)
        Returns true if the symbol is from a land based symbol set
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isTaskForce

        public static java.lang.Boolean isTaskForce​(java.lang.String symbolID)
        Returns true if the symbol ID has the task for indicator
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isReality

        public static java.lang.Boolean isReality​(java.lang.String symbolID)
        Returns true if the symbol ID indicates the context is Reality
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isExercise

        public static java.lang.Boolean isExercise​(java.lang.String symbolID)
        Returns true if the symbol ID indicates the context is Exercise
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • isSimulation

        public static java.lang.Boolean isSimulation​(java.lang.String symbolID)
        Returns true if the symbol ID indicates the context is Simulation
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • getEchelonText

        public static java.lang.String getEchelonText​(int echelon)
        Reads the Symbol ID string and returns the text that represents the echelon code.
        Parameters:
        echelon - Integer from positions 9-10 in the symbol ID See SymbolID.getAmplifierDescriptor(String)
        Returns:
        String (23 (Army) would be "XXXX")
      • getStandardIdentityModifier

        public static java.lang.String getStandardIdentityModifier​(java.lang.String symbolID)
        Returns the Standard Identity Modifier based on the Symbol ID
        Parameters:
        symbolID - 30 Character String
        Returns:
        String
      • hasRectangleFrame

        public static boolean hasRectangleFrame​(java.lang.String symbolID)
        Returens true if the unit has a rectangle frame
        Parameters:
        symbolID - 30 Character String
        Returns:
        Boolean
      • getUnitRatioHeight

        public static float getUnitRatioHeight​(java.lang.String symbolID)
        Returns the height ratio for the unit specified by the symbol ID Based on Figure 4 in 2525E.
        Parameters:
        symbolID - 30 Character String
        Returns:
        Float
      • getUnitRatioWidth

        public static float getUnitRatioWidth​(java.lang.String symbolID)
        Returns the width ratio for the unit specified by the symbol ID Based on Figure 4 in 2525E.
        Parameters:
        symbolID - 30 Character String
        Returns:
        Float