Package JavaTacticalRenderer
Class clsUtility
java.lang.Object
JavaTacticalRenderer.clsUtility
A general utility class for the tactical renderer
- Author:
- Michael Deutch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidCalcIntersectPt(POINT2 pt1, double m1, POINT2 pt2, double m2, POINT2 ptIntersect) Calculates point where two lines intersect.protected static intChannelWidth(double[] pixels, ref<double[]> distanceToChannelPOINT2) Calculates the channel width in pixels for channel typesstatic voidClosePolygon(ArrayList<POINT2> Pixels) Closes the polygon for areasstatic POINT2ComputeLastPoint(ArrayList<POINT2> arrLocation) Client utility to calculate the channel points for channel types.static voiddo not allow vertical segments for these, move the point x value by 1 pixelprotected static Line2DgetExtendedLine(TGLight tg, int index, double dist) construct a line segment outside the polygon corresponding to some indexstatic Shape2getHatchShape(TGLight tg, BufferedImage bi) protected static voidGetLCSegments(double[] pixels, boolean[] segments) Called by clsChannelUtility.static BasicStrokegetLineStroke(float width, int style, int cap, int round) Customer requested routine for setting the stroke dash patternstatic BasicStrokegetLineStroke2(float width, int style, int cap, int round) GE clientsstatic intuse str if tg is nullstatic intGetMinPoints(int lineType) Returns the minimum client points needed for the symbolClient will send the segment colors within a modifier.static HashMapstatic ColorGetOpaqueColor(Color color) static double[]Note: Mil-Std-2525 Rev C does not use this function.static voidFor each sector calculates left azimuth, right azimuth, min radius, max radius and stuff H2 with the string delimited result.protected static voidGetSegments(double[] pixels, boolean[] segments, double factor) Called by clsChannelUtility.static booleangraphicContainsClipBounds(TGLight tg, Rectangle2D clipBounds) Deprecated.test to see if the pixels outline contains the clip boundsstatic voidinitializeLinetypes(int rev) initialize the hash tablesstatic voidInterpolate pixels for lines with points too close together.static booleanisAutoshape(TGLight tg) static booleanisBasicShape(int linetype) static booleanIsChange1Area(int lineType, ref<int[]> minPoints) Returns a boolean indicating whether the line type is a change 1 areastatic booleanisClosedPolygon(int linetype) static BooleanisSameColor(Color c1, Color c2) Deprecated.Test to see if two colors are similarstatic booleanlinesOutsideClipBounds(TGLight tg, Rectangle2D clipBounds) returns true if the line segments are all outside the boundsstatic booleanLinesWithFill(int linetype) These lines allow fillprotected static voidMovePixels(double[] pixels, int count) Deprecated.Called by clsChannelUtility to prevent pixels from being on top of each other.static voidMovePixels2(ArrayList<POINT2> pixels2) Deprecated.used for BELT to prevent vertical client segmentsprotected static Point2DPOINT2ToPoint2D(POINT2 pt2) protected static voidReorderPixels(double[] pixels) Reverses the pixels except for the last point.protected static voidResolveModifierShape(TGLight tg, Shape2 shape) Overrides shape properties for symbols based on Mil-Std-2525static voidUSAS requires a left-right orientation for ENY, which negates the upper-lower orientation we used for Mil-Std-2525 ENY compliance.static voidreviseHModifier(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 clippedprotected static voidSetLCColor(TGLight tg, Shape2 shape) Sets the color for the current shape depending on the affiliationstatic voidRev C requires max 50 anchor points for the axis of advance symbolsstatic voidSetShapeProperties(TGLight tg, ArrayList<Shape2> shapes, BufferedImage bi) Sets shape properties based on other properties which were set by JavaLineArrayprotected static voidshiftModifiersLeft(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 voidDeprecated.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:
-
graphicContainsClipBounds
Deprecated.test to see if the pixels outline contains the clip bounds- Parameters:
tg-clipBounds-- Returns:
- true if pixels outline contains the clip bounds
-
GetMinPoints
public static int GetMinPoints(int lineType) Returns the minimum client points needed for the symbol- Parameters:
lineType- line type- Returns:
- minimum number of clients required to render the line
-
isBasicShape
public static boolean isBasicShape(int linetype) - Parameters:
linetype- the line type- Returns:
- true if the line is a basic shape
-
isClosedPolygon
public static boolean isClosedPolygon(int linetype) - 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:
pt0-pt1-
-
ResolveModifierShape
Overrides shape properties for symbols based on Mil-Std-2525- Parameters:
tg-shape-
-
GetOpaqueColor
-
LinesWithFill
public static boolean LinesWithFill(int linetype) 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- Parameters:
width-style-cap-round-- Returns:
-
getLineStroke2
GE clients- Parameters:
width-style-cap-round-- 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 typeminPoints- Out - object to hold the minimum number of client points required- 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
-
GetRadii
Note: Mil-Std-2525 Rev C does not use this function. For Rev C the radii are calculated from tg.H2 Calculates the radii for circular and sector range fans.- Parameters:
tg-lineType-- Returns:
-
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
do not allow vertical segments for these, move the point x value by 1 pixel- Parameters:
tg- tactical graphic
-
MovePixels2
Deprecated.used for BELT to prevent vertical client segments- Parameters:
pixels-
-
MovePixels
protected static void MovePixels(double[] pixels, int count) Deprecated.Called by clsChannelUtility to prevent pixels from being on top of each other.- Parameters:
pixels- OUT - client points as 2 tuples x,ycount- the number of client points.
-
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
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 pixelssegments- OUT - the segmentsfactor- a steepness factor for calculating whether the segment is double-backed
-
GetLCSegments
protected static void GetLCSegments(double[] pixels, boolean[] segments) 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 segments
-
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
-
getHatchShape
- Parameters:
tg- tactical graphicbi- buffered image to use for creating a graphics object to draw- Returns:
- ShapeInfo hatch fill
-
initializeLinetypes
public static void initializeLinetypes(int rev) initialize the hash tables- Parameters:
rev- Mil-Standard-2525 revision
-
GetLinetypeFromString
use str if tg is null- Parameters:
tg- tactical graphicstr- Mil=Standard-2525 symbol id- Returns:
- line type
-
setRevC
Rev C requires max 50 anchor points for the axis of advance symbols- Parameters:
tg- tactical graphic
-
isAutoshape
- 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-
-
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:
-