Class SymbolUtilities

java.lang.Object
armyc2.c2sd.renderer.utilities.SymbolUtilities

public class SymbolUtilities extends Object
  • Constructor Details

  • Method Details

    • getBasicSymbolID

      public static String getBasicSymbolID(String strSymbolID)
      Parameters:
      strSymbolID - - IN - A 15 character MilStd code
      Returns:
      A properly formated basic symbol ID
    • getBasicSymbolIDStrict

      public static String getBasicSymbolIDStrict(String strSymbolID)
      Only for renderer use. Please use getBasicSymbolID.
      Parameters:
      strSymbolID -
      Returns:
    • reconcileSymbolID

      public static String reconcileSymbolID(String symbolID)
    • reconcileSymbolID

      public static String reconcileSymbolID(String symbolID, boolean isMultiPoint)
    • hasValidStatus

      public static Boolean hasValidStatus(String SymbolID)
      Returns true if the SymbolID has a valid Status (4th character)
      Parameters:
      SymbolID -
      Returns:
    • hasValidAffiliation

      public static Boolean hasValidAffiliation(String SymbolID)
      Returns true if the SymbolID has a valid Affiliation (2nd character)
      Parameters:
      SymbolID -
      Returns:
    • hasValidCodingScheme

      public static Boolean hasValidCodingScheme(String symbolID)
    • hasValidBattleDimension

      public static Boolean hasValidBattleDimension(String SymbolID)
      Returns true if the SymbolID has a valid BattleDimension (3rd character) "Category" for tactical graphics
      Parameters:
      SymbolID - 15 character String
      Returns:
    • hasValidCountryCode

      public static Boolean hasValidCountryCode(String symbolID)
    • getDateLabel

      public static String getDateLabel(Date time)
      converts a Java Date object into a properly formated String for W or W1
      Parameters:
      time -
      Returns:
    • canUnitHaveModifier

      public static boolean canUnitHaveModifier(String symbolID, int unitModifier)
      Parameters:
      symbolID -
      unitModifier -
      Returns:
    • hasModifier

      public static Boolean hasModifier(String symbolID, int modifier)
    • hasModifier

      public static Boolean hasModifier(String symbolID, int modifier, int symStd)
      Parameters:
      symbolID -
      modifier - - from the constants ModifiersUnits or ModifiersTG
      symStd - - 0=2525B, 1=2525C. Constants available in RendererSettings.
      Returns:
    • canSymbolHaveModifier

      public static boolean canSymbolHaveModifier(String symbolID, int tgModifier)
      Checks if a tactical graphic has the passed modifier.
      Parameters:
      symbolID - - symbolID of Tactical Graphic
      tgModifier - - ModifiersTG.AN_AZIMUTH
      Returns:
    • canSymbolHaveModifier

      public static boolean canSymbolHaveModifier(String symbolID, int tgModifier, int symStd)
      Checks if a tactical graphic has the passed modifier.
      Parameters:
      symbolID - - symbolID of Tactical Graphic
      tgModifier - - ModifiersTG.AN_AZIMUTH
      symStd - - like RendererSettings.Symbology_2525C
      Returns:
    • getLineColorOfAffiliation

      public static Color getLineColorOfAffiliation(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 -
      Returns:
    • getFillColorOfAffiliation

      public static Color getFillColorOfAffiliation(String symbolID)
      Is the fill color used if no fill 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 -
      Returns:
    • getLineColorOfWeather

      public static Color getLineColorOfWeather(String symbolID)
    • getFillColorOfWeather

      public static Color getFillColorOfWeather(String symbolID)
      Only for single points at the moment
      Parameters:
      symbolID -
      Returns:
    • hierarchyToSymbolID

      public static String hierarchyToSymbolID(String strHierarchy)
      Deprecated.
      - Not all symbols have a hierarchy anymore
      Parameters:
      strHierarchy - - IN - A MilStd hierarchy
      Returns:
      A properly formated basic symbol ID
    • isTacticalGraphic

      public static boolean isTacticalGraphic(String strSymbolID)
      Determines if the symbol is a tactical graphic
      Parameters:
      strSymbolID -
      Returns:
      true if symbol starts with "G", or is a weather graphic, or a bridge graphic
    • isBasicShape

      public static boolean isBasicShape(String symbolID)
    • isWarfighting

      public static boolean isWarfighting(String strSymbolID)
      Determines if symbols is a warfighting symbol.
      Parameters:
      strSymbolID -
      Returns:
      True if code starts with "O", "S", or "I". (or "E" in 2525C)
    • isWeather

      public static boolean isWeather(String strSymbolID)
      Determines if the symbol is a weather graphic
      Parameters:
      strSymbolID -
      Returns:
      true if symbolID starts with a "W"
    • isNumber

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

      public static String colorToHexString(Color color, Boolean withAlpha)
    • getColorFromHexString

      public static Color getColorFromHexString(String hexValue)
      Parameters:
      hexValue - - String representing hex value (formatted "0xRRGGBB" i.e. "0xFFFFFF") OR formatted "0xAARRGGBB" i.e. "0x00FFFFFF" for a color with an alpha value I will also put up with "RRGGBB" and "AARRGGBB" without the starting "0x"
      Returns:
    • isMCSSpecificTacticalGraphic

      public static boolean isMCSSpecificTacticalGraphic(SymbolDef sd)
      Symbols that don't exist outside of MCS
      Parameters:
      sd -
      Returns:
    • is3dAirspace

      public static boolean is3dAirspace(String symbolID)
    • isMCSSpecificForceElement

      public static boolean isMCSSpecificForceElement(UnitDef ud)
      Symbols that don't exist outside of MCS or units that are no longer supported like those from the SASO Proposal.
      Parameters:
      ud -
      Returns:
    • is3dGraphic

      public static Boolean is3dGraphic(String symbolID)
      Just checks the symbolID if it could be rendered in 3D. Does not check for needed modifiers.
      Parameters:
      symbolID -
      Returns:
    • isSASO

      public static boolean isSASO(UnitDef sd)
      Symbols from the SASO Proposal. Most were replaced by the USAS 13-14 update or 2525C.
      Parameters:
      sd -
      Returns:
    • isCheckPoint

      public static boolean isCheckPoint(String strSymbolID)
    • isCriticalPoint

      public static boolean isCriticalPoint(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a critical point
      Returns:
      True if the graphic is a critical point, false otherwise.
    • isRoute

      public static boolean isRoute(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a route
      Returns:
      True if the graphic is a route, false otherwise.
    • isRoad

      public static boolean isRoad(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a road
      Returns:
      True if the graphic is a road, false otherwise.
    • isJWARN

      public static boolean isJWARN(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a JWARN graphic
      Returns:
      True if the graphic is a JWARN symbol, false otherwise.
    • isMOOTW

      public static boolean isMOOTW(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a MOOTW graphic
      Returns:
      True if the graphic is a MOOTW symbol in the MIL-STD 2525B or STBOPS in 2525C, false otherwise.
    • isSTBOPS

      public static boolean isSTBOPS(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a isStabilityOperations graphic
      Returns:
      True if the graphic is a MOOTW symbol in the MIL-STD 2525B or STBOPS in 2525C, false otherwise.
    • isEvent

      public static boolean isEvent(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a MOOTW graphic
      Returns:
      True if the graphic is a MOOTW symbol in the MIL-STD 2525B, false otherwise.
    • isHQ

      public static boolean isHQ(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a HQ
      Returns:
      True if the graphic is a HQ symbol in the MIL-STD 2525B, false otherwise.
    • isTaskForce

      public static boolean isTaskForce(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it contains task force
      Returns:
      Returns true if the symbol id contains task force, false otherwise.
    • isFeintDummy

      public static boolean isFeintDummy(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it contains feint dummy
      Returns:
      Returns true if the symbol id contains FeintDummy, false otherwise.
    • isMobilityWheeled

      public static boolean isMobilityWheeled(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a Wheeled Mobility
      Returns:
      True if the graphic (equipment only) is a Wheeled Mobility in the MIL-STD 2525B, false otherwise.
    • isMobility

      public static boolean isMobility(String strSymbolID)
      Symbol has a mobility modifier
      Parameters:
      strSymbolID -
      Returns:
    • isTarget

      public static Boolean isTarget(String strSymbolID)
      Returns true if Symbol is a Target
      Parameters:
      strSymbolID -
      Returns:
    • isAirTrack

      public static Boolean isAirTrack(String strSymbolID)
      Returns true if Symbol is an Air Track
      Parameters:
      strSymbolID -
      Returns:
    • isObstacle

      public static boolean isObstacle(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is an Obstacle
      Returns:
      True if the graphic is an Obstacle in the MIL-STD 2525B, false otherwise.
    • isDeconPoint

      public static boolean isDeconPoint(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a Decon Point
      Returns:
      True if the graphic is a Decon Point in the MIL-STD 2525B, false otherwise.
    • isEchelonGraphic

      public static boolean isEchelonGraphic(String strSymbolID, int symStd)
      Deprecated.
      Parameters:
      strSymbolID - - IN - A basic MilStd2525B symbolID
      symStd - RendererSettings.Symbology_2525C
      Returns:
      True if the graphic displays an echelon, false if it ignores the echelon field
    • getEchelonText

      public static String getEchelonText(String echelon)
      Reads the Symbol ID string and returns the text that represents the echelon code.
      Parameters:
      echelon -
      Returns:
    • isUnit

      public static boolean isUnit(String strSymbolID)
      Parameters:
      strSymbolID - - IN - SymbolID we are checking on
      Returns:
      True if the graphic is a unit in the MIL-STD 2525B or is a special operation forces unit, false otherwise.
    • isNBC

      public static boolean isNBC(String strSymbolID)
      Parameters:
      strSymbolID - - IN - SymbolID we are checking on
      Returns:
      True if the graphic is a NBC in the MIL-STD 2525B, false otherwise.
    • isTGWithControlPoints

      public static boolean isTGWithControlPoints(String strSymbolID, int symStd)
      returns true if the symbol code represents a symbol that has control points
      Parameters:
      symStd - RendererSettings.Symbology_2525C
      strSymbolID -
      Returns:
    • isTGSPWithSpecialModifierLayout

      public static boolean isTGSPWithSpecialModifierLayout(String strSymbolID)
      There's a handful of single point tactical graphics with unique modifier positions.
      Parameters:
      strSymbolID -
      Returns:
    • isTGSPWithIntegralText

      public static boolean isTGSPWithIntegralText(String strSymbolID)
      Is a single point tactical graphic that has integral text (like the NBC single points)
      Parameters:
      strSymbolID -
      Returns:
    • isTGSPWithFill

      public static boolean isTGSPWithFill(String strSymbolID)
      Is tactical graphic with fill
      Parameters:
      strSymbolID -
      Returns:
    • hasDefaultFill

      public static boolean hasDefaultFill(String strSymbolID)
    • getTGFillSymbolCode

      public static String getTGFillSymbolCode(String strSymbolID)
      Parameters:
      strSymbolID -
      Returns:
    • isWeatherSPWithFill

      public static boolean isWeatherSPWithFill(String symbolID)
    • isSOF

      public static boolean isSOF(String strSymbolID)
      Parameters:
      strSymbolID - - IN - SymbolID we are checking on
      Returns:
      True if the graphic is a SOF in the MIL-STD 2525B, false otherwise.
    • isSonobuoy

      public static boolean isSonobuoy(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we are checking to see if it is a Sonobuoy Point
      Returns:
      True if the graphic is a Decon Point in the MIL-STD 2525B, false otherwise.
    • isSeaSurface

      public static boolean isSeaSurface(String strSymbolID)
      Parameters:
      strSymbolID - - IN - SymbolID we are checking on
      Returns:
      True if the graphic is a seasurface in the MIL-STD 2525B, false otherwise.
    • isSubSurface

      public static boolean isSubSurface(String strSymbolID)
      Parameters:
      strSymbolID - - IN - SymbolID we are checking on
      Returns:
      True if the graphic is a subsurface in the MIL-STD 2525B, false otherwise.
    • isEquipment

      public static boolean isEquipment(String strSymbolID)
      Parameters:
      strSymbolID - - IN - A MilStd2525B symbolID
      Returns:
      True if symbol is Equipment, false otherwise.
    • isEMSEquipment

      public static boolean isEMSEquipment(String strSymbolID)
      determines if an EMS symbol (a symbol code that starts with 'E') Is an equipment type. There is no logical pattern to EMS equipment symbol codes so all we can do is check against a list of codes.
      Parameters:
      strSymbolID -
      Returns:
    • isEMS

      public static boolean isEMS(String strSymbolID)
      determines if an symbol code represents an EMS (Emergency Management Symbol). Returns true only for those that start with 'E'
      Returns:
    • isEMSNaturalEvent

      public static boolean isEMSNaturalEvent(String strSymbolID)
      Determines if a symbol is an EMS Natural Event
      Parameters:
      strSymbolID -
      Returns:
    • isEMSIncident

      public static boolean isEMSIncident(String strSymbolID)
      Determines if a symbol is an EMS Incident
      Parameters:
      strSymbolID -
      Returns:
    • isEMSInstallation

      public static boolean isEMSInstallation(String strSymbolID)
      Determines if a symbol is an EMS Installation
      Parameters:
      strSymbolID -
      Returns:
    • isInstallation

      public static boolean isInstallation(String strSymbolID)
      Parameters:
      strSymbolID - - IN - A MilStd2525B symbolID
      Returns:
      True if symbol is an Installation, false otherwise.
    • isSIGINT

      public static boolean isSIGINT(String strSymbolID)
      Parameters:
      strSymbolID - - IN - A MilStd2525B symbolID
      Returns:
      True if symbol is a Signals Intelligence, false otherwise.
    • isFeintDummyInstallation

      public static boolean isFeintDummyInstallation(String strSymbolID)
      Parameters:
      strSymbolID - - IN - A MilStd2525B symbolID
      Returns:
      True if symbol has a feint dummy installation modifier, false otherwise.
    • hasInstallationModifier

      public static boolean hasInstallationModifier(String strSymbolID)
      has an 'H' in the 11th position Any symbol can have this character added to make it an installation.
      Parameters:
      strSymbolID -
      Returns:
    • getAffiliation

      public static char getAffiliation(String strSymbolID)
      Parameters:
      strSymbolID - - IN - Symbol Id we want the affiliation of
      Returns:
      The affiliation of the Symbol Id that was passed in.
    • getStatus

      public static String getStatus(String strSymbolID)
      Parameters:
      strSymbolID - - IN - 15 char symbol code.
      Returns:
      The status of the Symbol Id that was passed in.
    • getEchelon

      public static String getEchelon(String strSymbolID)
      Parameters:
      strSymbolID - - IN - 15 char symbol code.
      Returns:
      The echelon of the Symbol Id that was passed in.
    • getSymbolModifier

      public static String getSymbolModifier(String strSymbolID)
      Deprecated.
      9/6/2013
      Parameters:
      strSymbolID - - IN - A valid 15 char MilStd2525B code.
      Returns:
      The enumeration indicating which symbol modifier is turned on.
    • getUnitAffiliationModifier

      public static String getUnitAffiliationModifier(String symbolID, int symStd)
    • hasDirectionOfMovement

      public static boolean hasDirectionOfMovement(String symbolID, int symStd)
      checks symbol code to see if graphic has a DOM (Q) modifier
      Parameters:
      symbolID -
      symStd - RendererSettings.Symbology_2525C
      Returns:
    • hasAMmodifierWidth

      public static Boolean hasAMmodifierWidth(String symbolID)
    • hasAMmodifierWidth

      public static Boolean hasAMmodifierWidth(String symbolID, int symStd)
    • hasANmodifier

      public static Boolean hasANmodifier(String symbolID)
    • hasANmodifier

      public static Boolean hasANmodifier(String symbolID, int symStd)
    • hasAMmodifierRadius

      public static Boolean hasAMmodifierRadius(String symbolID)
    • hasAMmodifierRadius

      public static Boolean hasAMmodifierRadius(String symbolID, int symStd)
    • setAffiliation

      public static String setAffiliation(String strSymbolID, String strAffiliationID)
      Parameters:
      strSymbolID - - IN - A 15 character symbol ID
      strSymbolID - - IN - The affiliation we want to change the ID to.
      Returns:
      A string with the affiliation changed to affiliationID
    • setEchelon

      public static String setEchelon(String strSymbolID, String strEchelon)
      Parameters:
      strSymbolID - - IN - A 15 character symbol ID
      strSymbolID - - IN - A string representing the echelon we want to change the ID to. The case of the string does not matter, it can be upper or lower. The string is the name of the echelon and can be of the following choices: Null, //- Team, Crew, //A Squad, //B Section, //C Platoon, Detachment //D Company, Battery, Troop //E Battalion, Squadron, //F Regiment, Group, //G Brigade, //H Division, //I Corps, Mef, //J Army, //K Army Group, Front, //L Region //M
      Returns:
      A symbol ID with the echelon changed to echelonID
    • setStatus

      public static String setStatus(String strSymbolID, String strStatusID)
      Deprecated.
      Parameters:
      strSymbolID - - IN - A 15 character symbol ID
      strStatusID - - IN - The status we want to change the ID to. "present", "planned", "anticipated", "plannedanticipated"
      Returns:
      A string with the status changed to statusID
    • setSymbolModifier

      public static String setSymbolModifier(String strSymbolID, String symbolModifierID)
      Deprecated.
      Parameters:
      strSymbolID - - IN - A 15 character symbol ID
      symbolModifierID - - IN - The symbolModifier we want to change the ID to.
      Returns:
      A symbol ID with the symbolModifier changed to symbolModifierID