Class JavaRenderer

java.lang.Object
ArmyC2.C2SD.Rendering.JavaRenderer
All Implemented Interfaces:
IJavaRenderer

public class JavaRenderer extends Object implements IJavaRenderer
Author:
michael.spinelli
  • Field Details

  • Method Details

    • getInstance

      public static JavaRenderer getInstance()
      Instance of the JavaRenderer
      Returns:
      the instance
    • CanRender

      public Boolean CanRender(ArmyC2.C2SD.Utilities.MilStdSymbol symbol)
      Takes a symbol and determines if it is renderable
      Specified by:
      CanRender in interface IJavaRenderer
      Parameters:
      symbol -
      Returns:
      true if symbol can be rendered based on provided information
    • CanRender

      public Boolean CanRender(String symbolCode, ArrayList<Point2D.Double> coords)
      Description copied from interface: IJavaRenderer
      Checks if the Renderer can build the symbol with the given information
      Specified by:
      CanRender in interface IJavaRenderer
      Parameters:
      symbolCode -
      coords -
      Returns:
      true if symbol can be rendered based on provided information
    • CanRender

      public Boolean CanRender(String symbolCode, ArrayList<Point2D.Double> coords, int symStd)
      takes symbol properties and determines if they can be rendered as a symbol
      Specified by:
      CanRender in interface IJavaRenderer
      Parameters:
      symbolCode -
      coords -
      symStd - Like RendererSettings.Symbology_2525C
      symbologyStandard - like RendererSettings.Symbology_2525C
      Returns:
      true if symbol can be rendered based on provided information
    • Render

      public ArmyC2.C2SD.Utilities.MilStdSymbol Render(ArmyC2.C2SD.Utilities.MilStdSymbol symbol, ArmyC2.C2SD.Utilities.IPointConversion converter, Rectangle2D clipBounds) throws ArmyC2.C2SD.Utilities.RendererException
      Populates the Symbol invalid input: '&' Modifier Shape collection of the milstdsymbol
      Specified by:
      Render in interface IJavaRenderer
      Parameters:
      symbol -
      converter - does point conversion between pixels invalid input: '&' lat/lon coordinates.
      clipBounds - dimensions of drawing surface. needed to do clipping.
      Returns:
      drawable symbol populated with shape data
      Throws:
      ArmyC2.C2SD.Utilities.RendererException
    • Render

      public ArrayList<ArmyC2.C2SD.Utilities.MilStdSymbol> Render(ArrayList<ArmyC2.C2SD.Utilities.MilStdSymbol> symbols, ArmyC2.C2SD.Utilities.IPointConversion converter, Rectangle2D clipBounds) throws ArmyC2.C2SD.Utilities.RendererException
      Populates the Symbol invalid input: '&' Modifier Shape collection of the milstdsymbol
      Specified by:
      Render in interface IJavaRenderer
      Parameters:
      symbols -
      converter - does point conversion between pixels invalid input: '&' lat/lon coordinates.
      clipBounds - dimensions of drawing surface. needed to do clipping.
      Returns:
      drawable symbols populated with shape data
      Throws:
      ArmyC2.C2SD.Utilities.TBCRendererException
      ArmyC2.C2SD.Utilities.RendererException
    • Render

      public ArmyC2.C2SD.Utilities.MilStdSymbol Render(String symbolCode, String UUID, ArrayList<Point2D.Double> coords, Map<String,String> Modifiers, ArmyC2.C2SD.Utilities.IPointConversion converter, Rectangle2D clipBounds) throws ArmyC2.C2SD.Utilities.RendererException
      Populates the Symbol invalid input: '&' Modifier Shape collection of the milstdsymbol
      Specified by:
      Render in interface IJavaRenderer
      Parameters:
      symbolCode -
      UUID -
      coords -
      Modifiers -
      converter - does point conversion between pixels invalid input: '&' lat/lon coordinates.
      clipBounds - dimensions of drawing surface. needed to do clipping.
      Returns:
      drawable symbol populated with shape data
      Throws:
      ArmyC2.C2SD.Utilities.TBCRendererException
      ArmyC2.C2SD.Utilities.RendererException
    • RenderSinglePointAsImageInfo

      public ArmyC2.C2SD.Utilities.ImageInfo RenderSinglePointAsImageInfo(String symbolCode, Map<String,String> Modifiers, int unitSize, boolean keepUnitRatio)
      Description copied from interface: IJavaRenderer
      Requires less information than RenderMilStdSymbolAsImageInfo. Can only be used for singlepoint graphics.
      Specified by:
      RenderSinglePointAsImageInfo in interface IJavaRenderer
      Parameters:
      symbolCode -
      Modifiers - keyed on values from ModifiersUnits, ModifiersTG, and MilStdAttributes.
      unitSize - 35 would make a an image where the core symbol is 35x35. label modifiers and display modifiers may fall outside of that area and final image may be bigger than 35x35. use getSinglePointTGSymbolSize or getUnitSymbolSize.
      keepUnitRatio - Recommend setting to true when drawing on a map. Only applies to force elements (units). If KeepUnitRatio is set, Symbols will be drawn with respect to each other. Unknown unit is the all around biggest, neutral unit is the smallest. if size is 35, neutral would be (35/1.5)*1.1=25.7
      Returns:
      ImageInfo, which has the image and all the information needed to position it properly.
    • RenderSinglePointAsImageInfo

      public ArmyC2.C2SD.Utilities.ImageInfo RenderSinglePointAsImageInfo(String symbolCode, Map<String,String> Modifiers, int unitSize, boolean keepUnitRatio, int symStd)
      Parameters:
      symbolCode -
      Modifiers -
      unitSize - 35 would make a an image where the core symbol is 35x35. label modifiers and display modifiers may fall outside of that area and final image may be bigger than 35x35. use getSinglePointTGSymbolSize or getUnitSymbolSize.
      keepUnitRatio - Recommend setting to true when drawing on a map. Only applies to force elements (units). If KeepUnitRatio is set, Symbols will be drawn with respect to each other. Unknown unit is the all around biggest, neutral unit is the smallest. if size is 35, neutral would be (35/1.5)*1.1=25.7
      Returns:
      ImageInfo, which has the image and all the information needed to position it properly.
    • RenderMilStdSymbolAsImageInfo

      public ArmyC2.C2SD.Utilities.ImageInfo RenderMilStdSymbolAsImageInfo(String symbolCode, String UUID, ArrayList<Point2D.Double> coords, Map<String,String> Modifiers, ArmyC2.C2SD.Utilities.IPointConversion converter, Rectangle2D clipBounds)
      Given parameters, generates an ImageInfo object. Works for all symbols
      Parameters:
      symbolCode -
      UUID -
      coords -
      Modifiers -
      converter -
      clipBounds -
      Returns:
    • RenderMilStdSymbolAsImageInfo

      public ArmyC2.C2SD.Utilities.ImageInfo RenderMilStdSymbolAsImageInfo(ArmyC2.C2SD.Utilities.MilStdSymbol symbol, ArmyC2.C2SD.Utilities.IPointConversion converter, Rectangle2D clipBounds)
      Generates an imageInfo object
      Parameters:
      symbol -
      converter -
      clipBounds -
      Returns:
    • RenderMilStdSymbolAsIcon

      public BufferedImage RenderMilStdSymbolAsIcon(String symbolID, int iconSize, Boolean showDisplayModifiers)
      Doesn't support multipoints yet. Renders using the default symbology Standard specified here: RendererSettings.getInstance().getSymbologyStandard());
      Specified by:
      RenderMilStdSymbolAsIcon in interface IJavaRenderer
      Parameters:
      symbolID -
      iconSize -
      showDisplayModifiers -
      Returns:
    • RenderMilStdSymbolAsIcon

      public BufferedImage RenderMilStdSymbolAsIcon(String symbolID, int iconSize, Boolean showDisplayModifiers, int symStd)
      Parameters:
      symbolID -
      iconSize -
      showDisplayModifiers -
      symStd -
      Returns:
    • DrawDB

      public void DrawDB(ArmyC2.C2SD.Utilities.MilStdSymbol symbol, Graphics2D destination, Rectangle clip) throws ArmyC2.C2SD.Utilities.RendererException
      Does the actual drawing of the Symbol. MilstdSymbol need to be properly populated via the Render call first. Draws to an offscreen image that blits the result to the desination Graphics2D object.
      Specified by:
      DrawDB in interface IJavaRenderer
      Parameters:
      symbol -
      destination - surface to draw to
      clip - Cannot be null. This function does not apply it to the destination object. Clip dimesions are used to determine the size of the back buffer. Also useful for making sure only an specfic area is being redrawn. It shouldn't be bigger than the drawing area, but it can be a section of the drawing area. like if the draw area is 400x400 and the clip is x200,y200,w200,h200; the bottom right quadrant is the only part that will be drawn and the back buffer will only be 200x200. Or you can simply have the dimensions of the clip match the dimensions of the draw area.
      Throws:
      ArmyC2.C2SD.Utilities.RendererException
    • DrawDB

      public void DrawDB(ArrayList<ArmyC2.C2SD.Utilities.MilStdSymbol> symbols, Graphics2D destination, Rectangle clip) throws ArmyC2.C2SD.Utilities.RendererException
      Does the actual drawing of the Symbol. MilstdSymbol need to be properly populated via the Render call first. Draws to an offscreen image that blits the result to the destination Graphics2D object.
      Specified by:
      DrawDB in interface IJavaRenderer
      Parameters:
      symbols -
      destination - surface to draw to
      clip - Cannot be null. This function does not apply it to the destination object. Clip dimensions are used to determine the size of the back buffer. Also useful for making sure only a specific area is being redrawn. It shouldn't be bigger than the drawing area, but it can be a section of the drawing area. like if the draw area is 400x400 and the clip is x200,y200,w200,h200; the bottom right quadrant is the only part that will be drawn and the back buffer will only be 200x200. Or you can simply have the dimensions of the clip match the dimensions of the draw area.
      Throws:
      ArmyC2.C2SD.Utilities.RendererException
    • Draw

      public void Draw(ArmyC2.C2SD.Utilities.MilStdSymbol symbol, Graphics2D destination) throws ArmyC2.C2SD.Utilities.RendererException
      Does the actual drawing of the Symbol. MilstdSymbol need to be properly populated via the Render call first.
      Specified by:
      Draw in interface IJavaRenderer
      Parameters:
      symbol -
      destination - surface to draw to
      Throws:
      ArmyC2.C2SD.Utilities.RendererException
    • Draw

      public void Draw(ArrayList<ArmyC2.C2SD.Utilities.MilStdSymbol> symbols, Graphics2D destination) throws ArmyC2.C2SD.Utilities.RendererException
      Does the actual drawing of the Symbol. MilstdSymbol need to be properly populated via the Render call first.
      Specified by:
      Draw in interface IJavaRenderer
      Parameters:
      symbols -
      destination - surface to draw to
      Throws:
      ArmyC2.C2SD.Utilities.RendererException
    • getSupportedFETypes

      public Map<String,ArmyC2.C2SD.Utilities.UnitDef> getSupportedFETypes(int symStd)
      Get a Map of the supported Unit or Force Element symbols
      Specified by:
      getSupportedFETypes in interface IJavaRenderer
      Parameters:
      symStd - RendererSettings.Symbology_2525C
      Returns:
      a Map of UnitDefs keyed by symbol code.
    • getSupportedTGTypes

      public Map<String,ArmyC2.C2SD.Utilities.SymbolDef> getSupportedTGTypes(int symStd)
      Get a Map of the supported Tactical Graphic symbols.
      Specified by:
      getSupportedTGTypes in interface IJavaRenderer
      Parameters:
      symStd - RendererSettings.Symbology_2525C
      Returns:
      a Map of SymbolDefs keyed by symbol code.
    • initialize

      public void initialize(Map<String,String> arg0)
      Deprecated.
      Parameters:
      arg0 -
    • setLoggingLevel

      public static void setLoggingLevel(Level newLevel)
      Set minimum level at which an item can be logged. In descending order: Severe Warning Info Config Fine Finer Finest
      Parameters:
      newLevel -
    • getSinglePointTGSymbolSize

      public int getSinglePointTGSymbolSize()
      Description copied from interface: IJavaRenderer
      Returns size currently being used to draw single point Tactical Graphics
      Specified by:
      getSinglePointTGSymbolSize in interface IJavaRenderer
    • getUnitSymbolSize

      public int getUnitSymbolSize()
      Description copied from interface: IJavaRenderer
      Returns size currently being used to draw units
      Specified by:
      getUnitSymbolSize in interface IJavaRenderer
    • setSinglePointTGSymbolSize

      public void setSinglePointTGSymbolSize(int size)
      Description copied from interface: IJavaRenderer
      determines size of single point tactical graphics
      Specified by:
      setSinglePointTGSymbolSize in interface IJavaRenderer
      Parameters:
      size - like JavaRenderer.SymbolSizeMedium or any positive integer
    • setUnitSymbolSize

      public void setUnitSymbolSize(int size)
      Description copied from interface: IJavaRenderer
      determines size of units (force elements)
      Specified by:
      setUnitSymbolSize in interface IJavaRenderer
      Parameters:
      size - JavaRenderer.SymbolSizeMedium or positive any integer
    • setModifierFont

      public void setModifierFont(String name, int type, int size)
      Set the label font to be used in the renderer Default tracking to TextAttribute.TRACKING_LOOSE and kerning to off.
      Specified by:
      setModifierFont in interface IJavaRenderer
      Parameters:
      name - like "arial"
      type - like Font.BOLD
      size - like 12
    • setModifierFont

      public void setModifierFont(String name, int type, int size, float tracking, Boolean kerning)
      Set the label font to be used in the renderer
      Specified by:
      setModifierFont in interface IJavaRenderer
      Parameters:
      name - like "arial"
      type - like Font.BOLD
      size - like 12
      tracking - like TextAttribute.TRACKING_LOOSE (0.04f)
      kerning - default false.