Class 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.
    • 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • classMap

        protected java.util.Map<java.lang.String,​java.lang.Class> classMap
        Map to associate MIL-STD-2525C function codes with implementation classes.
    • Constructor Detail

      • MilStd2525GraphicFactory

        public MilStd2525GraphicFactory()
        Create a new factory.
    • 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 by clazz.
      • 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 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​(java.lang.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.
      • createCircle

        public TacticalCircle createCircle​(java.lang.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.
      • 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 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​(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 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.
      • 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 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.
      • 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.