NASA World Wind

gov.nasa.worldwind.symbology.milstd2525
Class MilStd2525GraphicFactory

java.lang.Object
  extended by gov.nasa.worldwind.symbology.milstd2525.MilStd2525GraphicFactory
All Implemented Interfaces:
TacticalGraphicFactory

public class MilStd2525GraphicFactory
extends Object
implements TacticalGraphicFactory

Graphic factory to create tactical graphics for the MIL-STD-2525 symbol set.


Field Summary
protected  Map<String,Class> classMap
          Map to associate MIL-STD-2525C function codes with implementation classes.
 
Constructor Summary
MilStd2525GraphicFactory()
          Create a new factory.
 
Method Summary
 TacticalCircle createCircle(String sidc, Position center, double radius, AVList modifiers)
          Create a circular graphic.
 MilStd2525TacticalGraphic createGraphic(String sidc, Iterable<? extends Position> positions, AVList modifiers)
          Create a tactical graphic positioned by more than one control point.
 TacticalPoint createPoint(String sidc, Position position, AVList params)
          Create a tactical graphic positioned by a single control point.
 TacticalQuad createQuad(String sidc, Iterable<? extends Position> positions, AVList modifiers)
          Create a graphic with four sides.
 TacticalRoute createRoute(String sidc, Iterable<? extends TacticalPoint> controlPoints, AVList modifiers)
          Create a route graphic.
protected  Class getClassForCode(SymbolCode symbolCode)
          Get the implementation class that implements a particular graphic.
 boolean isSupported(String sidc)
          Determines if this factory can create a graphic for a given symbol identifier.
protected  void mapClass(Class clazz, List<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(String sidc, Class clazz)
          Specifies the class that the factory will instantiate for a given symbol identifier.
protected  void setModifiers(TacticalGraphic graphic, AVList props)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classMap

protected Map<String,Class> classMap
Map to associate MIL-STD-2525C function codes with implementation classes.

Constructor Detail

MilStd2525GraphicFactory

public MilStd2525GraphicFactory()
Create a new factory.

Method Detail

createCircle

public TacticalCircle createCircle(String sidc,
                                   Position center,
                                   double radius,
                                   AVList modifiers)
Create a circular graphic.

Specified by:
createCircle in interface TacticalGraphicFactory
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.

createGraphic

public MilStd2525TacticalGraphic createGraphic(String sidc,
                                               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 interface TacticalGraphicFactory
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(String sidc,
                                 Position position,
                                 AVList params)
Create a tactical graphic positioned by a single control point.

Specified by:
createPoint in interface TacticalGraphicFactory
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.

createQuad

public TacticalQuad createQuad(String sidc,
                               Iterable<? extends Position> positions,
                               AVList modifiers)
Create a graphic with four sides.

Specified by:
createQuad in interface TacticalGraphicFactory
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(String sidc,
                                 Iterable<? extends TacticalPoint> controlPoints,
                                 AVList modifiers)
Create a route graphic. A route is composed of point graphics connected by lines.

Specified by:
createRoute in interface TacticalGraphicFactory
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.

getClassForCode

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

isSupported

public boolean isSupported(String sidc)
Determines if this factory can create a graphic for a given symbol identifier.

Specified by:
isSupported in interface TacticalGraphicFactory
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.

mapClass

protected void mapClass(Class clazz,
                        List<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 by clazz.

populateClassMap

protected void populateClassMap()
Populate the map that maps function IDs to implementation classes.


setImplementationClass

public void setImplementationClass(String sidc,
                                   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()

setModifiers

protected void setModifiers(TacticalGraphic graphic,
                            AVList props)

NASA World Wind