Package armyc2.c5isr.renderer.utilities
Class SymbolUtilities
- java.lang.Object
-
- armyc2.c5isr.renderer.utilities.SymbolUtilities
-
public class SymbolUtilities extends java.lang.Object
Has various utility functions for prcessing the symbol code. SeeSymbolID
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)
Deprecated.static java.lang.String
getBasicSymbolID(java.lang.String id)
Gets Basic Symbol ID which is the Symbol Set + Entity Codestatic java.lang.String
getBasicSymbolID2525C(java.lang.String strSymbolID)
Deprecated.function will be removedstatic 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 affiliationstatic 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 IDstatic 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 defaultstatic 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 framestatic 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 setstatic 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 Exercisestatic 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 == 25static 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 IDstatic java.lang.Boolean
isInstallation(java.lang.String symbolID)
Returns true if the symbol is an installationstatic java.lang.Boolean
isLand(java.lang.String symbolID)
Returns true if the symbol is from a land based symbol setstatic boolean
isMultiPoint(java.lang.String symbolID)
Determines if the Symbol can be rendered as a multipoint graphic and not just as an iconstatic boolean
isNumber(java.lang.String text)
Determines if a String represents a valid numberstatic boolean
isObstacle(java.lang.String symbolID)
Deprecated.static java.lang.Boolean
isReality(java.lang.String symbolID)
Returns true if the symbol ID indicates the context is Realitystatic java.lang.Boolean
isSimulation(java.lang.String symbolID)
Returns true if the symbol ID indicates the context is Simulationstatic 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 setstatic 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 graphicstatic java.lang.Boolean
isTaskForce(java.lang.String symbolID)
Returns true if the symbol ID has the task for indicatorstatic boolean
isTGSPWithSpecialModifierLayout(java.lang.String strSymbolID)
Deprecated.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 inMSLookup
.
-
-
-
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 CharacterString
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 CharacterString
- Returns:
- 8 character
String
(Symbol Set + Entity Code)
-
getBasicSymbolID2525C
public static java.lang.String getBasicSymbolID2525C(java.lang.String strSymbolID)
Deprecated.function will be removedGets the basic Symbol ID for a 2525C symbol S*F*GPU---***** G*G*GPP---****X- Parameters:
strSymbolID
- 15 CharacterString
- 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 inMSLookup
. 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 characterString
- 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 characterString
- 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 fromgetLineColorOfAffiliation(String)
- Parameters:
symbolID
- 30 CharacterString
- 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 CharacterString
- 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 CharacterString
- Returns:
Boolean
-
isActionPoint
public static boolean isActionPoint(java.lang.String symbolID)
-
isTGSPWithSpecialModifierLayout
public static boolean isTGSPWithSpecialModifierLayout(java.lang.String strSymbolID)
Deprecated.Control Measures and Tactical Graphics that have labels but not with the Action Point layout- Parameters:
strSymbolID
- 30 CharacterString
- 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 CharacterString
- Returns:
Color
-
canSymbolHaveModifier
public static java.lang.Boolean canSymbolHaveModifier(java.lang.String symbolID, java.lang.String modifier)
Deprecated.- Parameters:
symbolID
- 30 CharacterString
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 CharacterString
- 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 CharacterString
- 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 CharacterString
- Returns:
Boolean
-
isSonobuoy
public static boolean isSonobuoy(java.lang.String symbolID)
Returns true if Symbol ID represents a Sonobuoy.- Parameters:
symbolID
- 30 CharacterString
- Returns:
Boolean
-
isObstacle
public static boolean isObstacle(java.lang.String symbolID)
Deprecated.Obstacles are generally required to have a green line color- Parameters:
symbolID
- 30 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 CharacterString
- 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 SeeSymbolID.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 CharacterString
- Returns:
String
-
hasRectangleFrame
public static boolean hasRectangleFrame(java.lang.String symbolID)
Returens true if the unit has a rectangle frame- Parameters:
symbolID
- 30 CharacterString
- 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 CharacterString
- 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 CharacterString
- Returns:
Float
-
-