Class clsUtility
java.lang.Object
armyc2.c5isr.JavaTacticalRenderer.clsUtility
A general utility class for the tactical renderer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static void
CalcIntersectPt
(POINT2 pt1, double m1, POINT2 pt2, double m2, POINT2 ptIntersect) Calculates point where two lines intersect.protected static int
ChannelWidth
(double[] pixels, ref<double[]> distanceToChannelPOINT2) Calculates the channel width in pixels for channel typesstatic void
ClosePolygon
(ArrayList<POINT2> Pixels) Closes the polygon for areasstatic POINT2
ComputeLastPoint
(ArrayList<POINT2> arrLocation) Client utility to calculate the channel points for channel types.static void
do not allow vertical segments for these, move the point x value by 1 pixelprotected static Line2D
getExtendedLine
(TGLight tg, int index, double dist) construct a line segment outside the polygon corresponding to some indexprotected static void
GetLCPartitions
(double[] pixels, double LCChannelWith, ArrayList<P1> partitions, ArrayList<P1> singleLinePartitions) 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 DPIstatic int
GetLinetypeFromString
(String symbolId) use str if tg is nullstatic int
GetMinPoints
(int lineType) Deprecated.use MSInfo.getMinPointCount()Client will send the segment colors within a modifier.static Color
GetOpaqueColor
(Color color) static void
For each sector calculates left azimuth, right azimuth, min radius, max radius and stuff H2 with the string delimited result.protected static void
GetSegments
(double[] pixels, boolean[] segments, double factor) Called by clsChannelUtility.static void
Interpolate pixels for lines with points too close together.static boolean
isAutoshape
(TGLight tg) An auto-shape is a symbol with a fixed number of anchor pointsstatic boolean
IsChange1Area
(int lineType) Returns a boolean indicating whether the line type is a change 1 areastatic boolean
isClosedPolygon
(int linetype) static Boolean
isSameColor
(Color c1, Color c2) Deprecated.Test to see if two colors are similarstatic boolean
linesOutsideClipBounds
(TGLight tg, Rectangle2D clipBounds) returns true if the line segments are all outside the boundsstatic boolean
LinesWithFill
(int linetype) These lines allow fillprotected static Point2D
POINT2ToPoint2D
(POINT2 pt2) protected static void
ReorderPixels
(double[] pixels) Reverses the pixels except for the last point.protected static void
ResolveModifierShape
(TGLight tg, Shape2 shape) Overrides shape properties for symbols based on Mil-Std-2525static void
USAS requires a left-right orientation for ENY, which negates the upper-lower orientation we used for Mil-Std-2525 ENY compliance.static void
reviseHModifier
(ArrayList<POINT2> originalPixels, TGLight tg) Deprecated.static void
SegmentLCPoints
(TGLight tg, IPointConversion converter) Adds extra points to LC if there are angles too small to fit the channelprotected static void
SetLCColor
(TGLight tg, Shape2 shape) Sets the color for the current shape depending on the affiliationstatic void
SetShapeProperties
(TGLight tg, ArrayList<Shape2> shapes, BufferedImage bi) Sets shape properties based on other properties which were set by JavaLineArrayprotected 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 edgestatic void
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.static void
-
Constructor Details
-
clsUtility
public clsUtility()
-
-
Method Details
-
POINT2ToPoint2D
-
linesOutsideClipBounds
returns true if the line segments are all outside the bounds- Parameters:
tg
- the tactical graphicclipBounds
- the pixels based clip bounds- Returns:
-
GetMinPoints
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
- Parameters:
linetype
- line type- Returns:
- true if the line is a closed area
-
ClosePolygon
Closes the polygon for areas- Parameters:
Pixels
- the client points
-
shiftModifiersLeft
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
Overrides shape properties for symbols based on Mil-Std-2525- Parameters:
tg
-shape
-
-
GetOpaqueColor
-
LinesWithFill
These lines allow fill- Parameters:
linetype
-- Returns:
-
tweakFillColor
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
Deprecated.Test to see if two colors are similar- Parameters:
c1
-c2
-- Returns:
- true is same (or similar) color
-
getLineStroke
Customer requested routine for setting the stroke dash pattern Scales dash length with line width and DPI- Parameters:
width
-style
-cap
-join
-- Returns:
-
SetShapeProperties
Sets shape properties based on other properties which were set by JavaLineArray- Parameters:
tg
- tactical graphicshapes
- the ShapeInfo arraybi
- BufferedImage to use for setting shape TexturePaint
-
IsChange1Area
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
-
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 pointm1
- slope of first linept2
- second line pointm2
- slope of second lineptIntersect
- OUT - intersection point
-
ChannelWidth
Calculates the channel width in pixels for channel types- Parameters:
pixels
- the client points as 2-tuples x,y in pixelsdistanceToChannelPOINT2
- 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
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
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
do not allow vertical segments for these, move the point x value by 1 pixel- Parameters:
tg
- tactical graphic
-
ComputeLastPoint
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
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 pixelssegments
- OUT - the segmentsfactor
- 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
Sets the color for the current shape depending on the affiliation- Parameters:
tg
-shape
-
-
ReverseUSASLCPointsByQuadrant
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
use str if tg is null- Parameters:
symbolId
- Mil=Standard-2525 symbol id- Returns:
- line type
-
isAutoshape
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
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 clippingtg
-
-
SegmentLCPoints
Adds extra points to LC if there are angles too small to fit the channel- Parameters:
tg
-converter
-
-
InterpolatePixels
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
construct a line segment outside the polygon corresponding to some index- Parameters:
tg
-index
-dist
-- Returns:
-