Class clsUtility

java.lang.Object
armyc2.c5isr.JavaTacticalRenderer.clsUtility

public final class clsUtility extends Object
A general utility class for the tactical renderer
  • Constructor Details

  • Method Details

    • POINT2ToPoint2D

      protected static Point2D POINT2ToPoint2D(POINT2 pt2)
    • linesOutsideClipBounds

      public static boolean linesOutsideClipBounds(TGLight tg, Rectangle2D clipBounds)
      returns true if the line segments are all outside the bounds
      Parameters:
      tg - the tactical graphic
      clipBounds - the pixels based clip bounds
      Returns:
    • GetMinPoints

      public static int GetMinPoints(int lineType)
      Deprecated.
      use MSInfo.getMinPointCount()
      Returns the minimum client points needed for the symbol
      Parameters:
      lineType - line type
      Returns:
      minimum number of clients required to render the line
    • isClosedPolygon

      public static boolean isClosedPolygon(int linetype)
      Parameters:
      linetype - line type
      Returns:
      true if the line is a closed area
    • ClosePolygon

      public static void ClosePolygon(ArrayList<POINT2> Pixels)
      Closes the polygon for areas
      Parameters:
      Pixels - the client points
    • shiftModifiersLeft

      protected static void shiftModifiersLeft(POINT2 p1, POINT2 p2, double shift)
      for change 1 symbol the W/w1 modifiers run too close to the symbol outline so it shifts the line along the line away from the edge
      Parameters:
      p1 -
      p2 -
      shift -
    • ResolveModifierShape

      protected static void ResolveModifierShape(TGLight tg, Shape2 shape)
      Overrides shape properties for symbols based on Mil-Std-2525
      Parameters:
      tg -
      shape -
    • GetOpaqueColor

      public static Color GetOpaqueColor(Color color)
    • LinesWithFill

      public static boolean LinesWithFill(int linetype)
      These lines allow fill
      Parameters:
      linetype -
      Returns:
    • tweakFillColor

      public static void tweakFillColor(TGLight tg)
      Deprecated.
      if the line color and fill color are the same or very close then we want to tweak the fill color a bit to make the line appear distinct from the fill.
      Parameters:
      tg -
    • isSameColor

      public static Boolean isSameColor(Color c1, Color c2)
      Deprecated.
      Test to see if two colors are similar
      Parameters:
      c1 -
      c2 -
      Returns:
      true is same (or similar) color
    • getLineStroke

      public static BasicStroke getLineStroke(int width, int style, int cap, int join)
      Customer requested routine for setting the stroke dash pattern Scales dash length with line width and DPI
      Parameters:
      width -
      style -
      cap -
      join -
      Returns:
    • SetShapeProperties

      public static void SetShapeProperties(TGLight tg, ArrayList<Shape2> shapes, BufferedImage bi)
      Sets shape properties based on other properties which were set by JavaLineArray
      Parameters:
      tg - tactical graphic
      shapes - the ShapeInfo array
      bi - BufferedImage to use for setting shape TexturePaint
    • IsChange1Area

      public static boolean IsChange1Area(int lineType)
      Returns a boolean indicating whether the line type is a change 1 area
      Parameters:
      lineType - the line type
      Returns:
      true if change 1 area
    • WriteFile

      public static void WriteFile(String str)
    • CalcIntersectPt

      protected static void CalcIntersectPt(POINT2 pt1, double m1, POINT2 pt2, double m2, POINT2 ptIntersect)
      Calculates point where two lines intersect. First line defined by pt1, m1. Second line defined by pt2, m2. result will be written to ptIntersect.
      Parameters:
      pt1 - first line point
      m1 - slope of first line
      pt2 - second line point
      m2 - slope of second line
      ptIntersect - OUT - intersection point
    • ChannelWidth

      protected static int ChannelWidth(double[] pixels, ref<double[]> distanceToChannelPOINT2)
      Calculates the channel width in pixels for channel types
      Parameters:
      pixels - the client points as 2-tuples x,y in pixels
      distanceToChannelPOINT2 - OUT - the calculated distance in pixels from the tip of the arrowhead to the back of the arrowhead.
      Returns:
      the channel width in pixels
    • GetSectorRadiiFromPoints

      public static void GetSectorRadiiFromPoints(TGLight tg)
      For each sector calculates left azimuth, right azimuth, min radius, max radius and stuff H2 with the string delimited result. The function is public, called by JavaRendererServer
      Parameters:
      tg - tactical graphic
    • ReorderPixels

      protected static void ReorderPixels(double[] pixels)
      Reverses the pixels except for the last point. This is used for the axis of advance type routes. The pixels are 2-tuples x,y
      Parameters:
      pixels - OUT - Array of client points
    • FilterVerticalSegments

      public static void FilterVerticalSegments(TGLight tg)
      do not allow vertical segments for these, move the point x value by 1 pixel
      Parameters:
      tg - tactical graphic
    • ComputeLastPoint

      public static POINT2 ComputeLastPoint(ArrayList<POINT2> arrLocation)
      Client utility to calculate the channel points for channel types. This code was ported from CJMTK.
      Parameters:
      arrLocation - the client points
      Returns:
      the channel point
    • GetSegments

      protected static void GetSegments(double[] pixels, boolean[] segments, double factor)
      Called by clsChannelUtility. The segments are used for managing double-backed segments for channel types. If the new point is double-backed then the segment at that index will be false.
      Parameters:
      pixels - the client points as 2-tuples x,y in pixels
      segments - OUT - the segments
      factor - a steepness factor for calculating whether the segment is double-backed
    • GetLCPartitions

      protected static void GetLCPartitions(double[] pixels, double LCChannelWith, ArrayList<P1> partitions, ArrayList<P1> singleLinePartitions)
    • SetLCColor

      protected static void SetLCColor(TGLight tg, Shape2 shape)
      Sets the color for the current shape depending on the affiliation
      Parameters:
      tg -
      shape -
    • ReverseUSASLCPointsByQuadrant

      public static void ReverseUSASLCPointsByQuadrant(TGLight tg)
      USAS requires a left-right orientation for ENY, which negates the upper-lower orientation we used for Mil-Std-2525 ENY compliance. Therefore we must reverse the client points for two of the quadrants
      Parameters:
      tg - tactical graphic
    • GetLinetypeFromString

      public static int GetLinetypeFromString(String symbolId)
      use str if tg is null
      Parameters:
      symbolId - Mil=Standard-2525 symbol id
      Returns:
      line type
    • isAutoshape

      public static boolean isAutoshape(TGLight tg)
      An auto-shape is a symbol with a fixed number of anchor points
      Parameters:
      tg - tactical graphic
      Returns:
      true if auto-shape
    • getMSRSegmentColors

      Client will send the segment colors within a modifier. Format is 0:FFBBBB,4:FFAAAA,... For the time being will assume the modifier being used is the H modifier
      Parameters:
      tg -
      Returns:
    • getMSRSegmentColorStrings

    • reviseHModifier

      public static void reviseHModifier(ArrayList<POINT2> originalPixels, TGLight tg)
      Deprecated.
      tg.H must be revised for clipped MSR, ASR and Boundary This function is called after the pixels were clipped
      Parameters:
      originalPixels - the tactical graphic pixels before clipping
      tg -
    • SegmentLCPoints

      public static void SegmentLCPoints(TGLight tg, IPointConversion converter)
      Adds extra points to LC if there are angles too small to fit the channel
      Parameters:
      tg -
      converter -
    • InterpolatePixels

      public static void InterpolatePixels(TGLight tg)
      Interpolate pixels for lines with points too close together. Drops successive points until the next point is at least 10 pixels from the preceding point
      Parameters:
      tg -
    • getExtendedLine

      protected static Line2D getExtendedLine(TGLight tg, int index, double dist)
      construct a line segment outside the polygon corresponding to some index
      Parameters:
      tg -
      index -
      dist -
      Returns: