Class MilStd2525GraphicFactory
- java.lang.Object
-
- gov.nasa.worldwind.symbology.milstd2525.MilStd2525GraphicFactory
-
- All Implemented Interfaces:
TacticalGraphicFactory
public class MilStd2525GraphicFactory extends java.lang.Object implements TacticalGraphicFactory
Graphic factory to create tactical graphics for the MIL-STD-2525 symbol set.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Class>
classMap
Map to associate MIL-STD-2525C function codes with implementation classes.
-
Constructor Summary
Constructors Constructor Description MilStd2525GraphicFactory()
Create a new factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TacticalCircle
createCircle(java.lang.String sidc, Position center, double radius, AVList modifiers)
Create a circular graphic.MilStd2525TacticalGraphic
createGraphic(java.lang.String sidc, java.lang.Iterable<? extends Position> positions, AVList modifiers)
Create a tactical graphic positioned by more than one control point.TacticalPoint
createPoint(java.lang.String sidc, Position position, AVList params)
Create a tactical graphic positioned by a single control point.TacticalQuad
createQuad(java.lang.String sidc, java.lang.Iterable<? extends Position> positions, AVList modifiers)
Create a graphic with four sides.TacticalRoute
createRoute(java.lang.String sidc, java.lang.Iterable<? extends TacticalPoint> controlPoints, AVList modifiers)
Create a route graphic.protected java.lang.Class
getClassForCode(SymbolCode symbolCode)
Get the implementation class that implements a particular graphic.boolean
isSupported(java.lang.String sidc)
Determines if this factory can create a graphic for a given symbol identifier.protected void
mapClass(java.lang.Class clazz, java.util.List<java.lang.String> ids)
Associate an implementation class with one or more symbol identifiers.protected void
populateClassMap()
Populate the map that maps function IDs to implementation classes.void
setImplementationClass(java.lang.String sidc, java.lang.Class clazz)
Specifies the class that the factory will instantiate for a given symbol identifier.protected void
setModifiers(TacticalGraphic graphic, AVList props)
-
-
-
Method Detail
-
populateClassMap
protected void populateClassMap()
Populate the map that maps function IDs to implementation classes.
-
setImplementationClass
public void setImplementationClass(java.lang.String sidc, java.lang.Class clazz)
Specifies the class that the factory will instantiate for a given symbol identifier. This will override the default implementation class, and can be used to customize the behavior of the factory without needing to extend the class.- Parameters:
sidc
- Masked symbol identifier.clazz
- Implementation class. This class must have a constructor that accepts a string argument.- See Also:
SymbolCode.toMaskedString()
-
mapClass
protected void mapClass(java.lang.Class clazz, java.util.List<java.lang.String> ids)
Associate an implementation class with one or more symbol identifiers.- Parameters:
clazz
- Class that implements one or more tactical graphics.ids
- Masked symbol IDs of the graphics implemented byclazz
.
-
createGraphic
public MilStd2525TacticalGraphic createGraphic(java.lang.String sidc, java.lang.Iterable<? extends Position> positions, AVList modifiers)
Create a tactical graphic positioned by more than one control point. This method is general purpose, and may be used to create any type of graphic. The other creation methods in the factory (for example,createCircle
) are provided for convenience, and may be used to specific categories of graphics.- Specified by:
createGraphic
in interfaceTacticalGraphicFactory
- Parameters:
sidc
- MIL-STD-2525 symbol identification code (SIDC).positions
- Control points to use to place the graphic. How many points are required depends on the type of graphic.modifiers
- Modifiers to apply to the graphic.- Returns:
- A new TacticalGraphic configured to render at the position indicated, or
null
if no graphic can be created for the given symbol identifier.
-
createPoint
public TacticalPoint createPoint(java.lang.String sidc, Position position, AVList params)
Create a tactical graphic positioned by a single control point.- Specified by:
createPoint
in interfaceTacticalGraphicFactory
- Parameters:
sidc
- MIL-STD-2525 symbol identification code (SIDC).position
- Control point to use to place the graphic.params
- Modifiers to apply to the graphic.- Returns:
- A new TacticalGraphic configured to render at the position indicated, or
null
if no graphic can be created for the given symbol identifier.
-
createCircle
public TacticalCircle createCircle(java.lang.String sidc, Position center, double radius, AVList modifiers)
Create a circular graphic.- Specified by:
createCircle
in interfaceTacticalGraphicFactory
- Parameters:
sidc
- Identifier for the symbol within its symbol set.center
- The position of the center of the circle.radius
- The radius of the circle, in meters.modifiers
- Modifiers to apply to the graphic.- Returns:
- A new graphic configured to render at the position indicated, or
null
if no graphic can be created for the given symbol identifier.
-
createQuad
public TacticalQuad createQuad(java.lang.String sidc, java.lang.Iterable<? extends Position> positions, AVList modifiers)
Create a graphic with four sides.- Specified by:
createQuad
in interfaceTacticalGraphicFactory
- Parameters:
sidc
- Identifier for the symbol within its symbol set.positions
- Control points to use to place the graphic. How many points are required depends on the type of graphic.modifiers
- Modifiers to apply to the graphic.- Returns:
- A new graphic configured to render at the position indicated, or
null
if no graphic can be created for the given symbol identifier.
-
createRoute
public TacticalRoute createRoute(java.lang.String sidc, java.lang.Iterable<? extends TacticalPoint> controlPoints, AVList modifiers)
Create a route graphic. A route is composed of point graphics connected by lines.- Specified by:
createRoute
in interfaceTacticalGraphicFactory
- Parameters:
sidc
- Identifier for the symbol within its symbol set.controlPoints
- Graphics to place at the points along the route.modifiers
- Modifiers to apply to the graphic.- Returns:
- A new graphic configured to render at the position indicated, or
null
if no graphic can be created for the given symbol identifier.
-
isSupported
public boolean isSupported(java.lang.String sidc)
Determines if this factory can create a graphic for a given symbol identifier.- Specified by:
isSupported
in interfaceTacticalGraphicFactory
- Parameters:
sidc
- An identifier for a symbol within the symbol set.- Returns:
- True if this factory can create a graphic for the given symbol id. Returns false if the symbol identifier is not valid, or if the identifier is valid but the factory does not support the graphic.
-
setModifiers
protected void setModifiers(TacticalGraphic graphic, AVList props)
-
getClassForCode
protected java.lang.Class getClassForCode(SymbolCode symbolCode)
Get the implementation class that implements a particular graphic.- Parameters:
symbolCode
- Parsed SIDC that identifies the graphic.- Returns:
- The implementation class for the specified SIDC, or
null
if no implementation class is found.
-
-