@armyc2.c5isr.renderer/mil-sym-ts-web 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +57 -0
- package/buildNode.bat +2 -0
- package/buildWeb.bat +2 -0
- package/dist/C5Ren.d.ts +6970 -0
- package/dist/C5Ren.js +2 -0
- package/dist/C5Ren.js.map +1 -0
- package/dist/LICENSE +201 -0
- package/dist/README.md +57 -0
- package/dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz +0 -0
- package/dist/manifest.json +4 -0
- package/dist/package.json +16 -0
- package/index.ts +169 -0
- package/package.bak +50 -0
- package/package.json +40 -0
- package/package.node.json +43 -0
- package/package.pack.json +19 -0
- package/package.packWeb.json +16 -0
- package/package.web.json +40 -0
- package/src/main/ts/android/graphics/Bitmap.ts +7 -0
- package/src/main/ts/android/graphics/Paint.ts +26 -0
- package/src/main/ts/android/graphics/Path.ts +78 -0
- package/src/main/ts/android/graphics/PointF.ts +14 -0
- package/src/main/ts/android/graphics/Rect.ts +18 -0
- package/src/main/ts/android/graphics/RectF.ts +50 -0
- package/src/main/ts/android/graphics/Region.ts +36 -0
- package/src/main/ts/android/graphics/Typeface.ts +11 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +99 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +34 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +193 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +2971 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +4008 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +93 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +89 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +515 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +5403 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +1084 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +2173 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +4934 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +7 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +5601 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +14 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +648 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +647 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +2994 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +2663 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +669 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +971 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +871 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +3507 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +500 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +1089 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +2656 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +1419 -0
- package/src/main/ts/armyc2/c5isr/data/genc.json +1407 -0
- package/src/main/ts/armyc2/c5isr/data/msd.json +17311 -0
- package/src/main/ts/armyc2/c5isr/data/mse.json +18500 -0
- package/src/main/ts/armyc2/c5isr/data/svgd.json +31214 -0
- package/src/main/ts/armyc2/c5isr/data/svge.json +30558 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +10 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +437 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +429 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +7 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +35 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +111 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +29 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +211 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +80 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +33 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +16 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +726 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +141 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +112 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +261 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +391 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +567 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +445 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +31 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +45 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +15 -0
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +22 -0
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +269 -0
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +9882 -0
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +146 -0
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +1265 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +64 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +95 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +93 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +114 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +555 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +62 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +120 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +431 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +99 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +203 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +104 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +481 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +40 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +1323 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +51 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +736 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +106 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +84 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +87 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +34 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +324 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +127 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +18 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +111 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +219 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +1008 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +882 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +380 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +797 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +1699 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +178 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +45 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +126 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +118 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +11 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +1201 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +591 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +29 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +753 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +137 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +438 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +19 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +10 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +5 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +404 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +525 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +55 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +36 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +1055 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +2085 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +157 -0
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +86 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +3798 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +412 -0
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +124 -0
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +26 -0
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +677 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +484 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +62 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +46 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +51 -0
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +31 -0
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +71 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +200 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +55 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +68 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +103 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +90 -0
- package/test/ExportSPImages.js +692 -0
- package/test/MPWW.html +556 -0
- package/test/MPWorker.js +318 -0
- package/test/SPWorker.js +233 -0
- package/test/SVGWW.html +363 -0
- package/test/singlePointTester3.html +751 -0
- package/tsconfig.json +54 -0
- package/typedoc.json +30 -0
- package/updateVersion.js +21 -0
- package/webpack.config.js +34 -0
- package/webpackn.config.js +28 -0
- package/webpackr.config.js +47 -0
- package/webpackw.config.js +23 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { type int, type double } from "../../../graphics2d/BasicTypes";
|
|
2
|
+
import { Point2D } from "../../../graphics2d/Point2D";
|
|
3
|
+
import { MilStdAttributes } from "../../../renderer/utilities/MilStdAttributes";
|
|
4
|
+
import { Modifiers } from "../../../renderer/utilities/Modifiers";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export class JavaRendererUtilities {
|
|
10
|
+
|
|
11
|
+
public static readonly HOSTILE_FILL_COLOR: string = "FFFF8080";
|
|
12
|
+
public static readonly FRIENDLY_FILL_COLOR: string = "FF80E0FF";
|
|
13
|
+
public static readonly NEUTRAL_FILL_COLOR: string = "FFAAFFAA";
|
|
14
|
+
public static readonly UNKNOWN_FILL_COLOR: string = "FFFFFF80";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Converts ARGB string format to the Google used ABGR string format. Google
|
|
18
|
+
* reverses the blue and red positioning.
|
|
19
|
+
*
|
|
20
|
+
* @param rgbString A color string of the format AARRGGBB in hex value.
|
|
21
|
+
* @return the reverse of the input string in hex. The format should now be
|
|
22
|
+
* AABBGGRR
|
|
23
|
+
*/
|
|
24
|
+
public static ARGBtoABGR(rgbString: string): string {
|
|
25
|
+
if (rgbString.length === 6) {
|
|
26
|
+
let s: string = "FF";
|
|
27
|
+
rgbString = s.concat(rgbString);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let bgrString: string = rgbString.toUpperCase();
|
|
31
|
+
|
|
32
|
+
if (rgbString.length === 8) {
|
|
33
|
+
let c: string[] = rgbString.split("");
|
|
34
|
+
let temp1: string = c[2];
|
|
35
|
+
let temp2: string = c[3];
|
|
36
|
+
c[2] = c[6];
|
|
37
|
+
c[3] = c[7];
|
|
38
|
+
c[6] = temp1;
|
|
39
|
+
c[7] = temp2;
|
|
40
|
+
bgrString = c.join("");
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (rgbString.length === 6) {
|
|
44
|
+
let c: string[] = rgbString.split("");
|
|
45
|
+
let temp1: string = c[0];
|
|
46
|
+
let temp2: string = c[1];
|
|
47
|
+
c[0] = c[4];
|
|
48
|
+
c[1] = c[5];
|
|
49
|
+
c[4] = temp1;
|
|
50
|
+
c[5] = temp2;
|
|
51
|
+
bgrString = "FF" + c.join("");
|
|
52
|
+
//bgrString = "FF" + bgrString;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.error("JavaRendererUtilties.ARGBtoABGR(): " + "\"" + rgbString.toString() + "\" is not a 6 or 8 character String in the format of RRGGBB or AARRGGBB");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
return bgrString;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Returns a symbolId with just the identifiable symbol Id pieces. All
|
|
65
|
+
* variable information is returned as '*'. For example, a boundary,
|
|
66
|
+
* "GFGPGLB----KUSX" returns "G*G*GLB---****X";
|
|
67
|
+
*
|
|
68
|
+
* @param symbolCode A 15 character symbol ID.
|
|
69
|
+
* @return The normalized SymbolCode.
|
|
70
|
+
* @deprecated
|
|
71
|
+
*/
|
|
72
|
+
public static normalizeSymbolCode(symbolCode: string): string {
|
|
73
|
+
|
|
74
|
+
let newSymbolCode: string = symbolCode;
|
|
75
|
+
|
|
76
|
+
if (symbolCode.startsWith("G") || symbolCode.startsWith("S")) {
|
|
77
|
+
// Remove Affiliation
|
|
78
|
+
newSymbolCode = newSymbolCode.substring(0, 1) + '*' + newSymbolCode.substring(2);
|
|
79
|
+
// Remove planned/present field
|
|
80
|
+
newSymbolCode = newSymbolCode.substring(0, 3) + '*' + newSymbolCode.substring(4);
|
|
81
|
+
// Remove echelon, special code and country codes
|
|
82
|
+
newSymbolCode = newSymbolCode.substring(0, 10) + "****" + newSymbolCode.substring(14);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// If a unit replace last character with *.
|
|
86
|
+
if (symbolCode.startsWith("S")) {
|
|
87
|
+
newSymbolCode = newSymbolCode.substring(0, 14) + '*';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return newSymbolCode;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public static addAltModeToModifiersString(attributes: Map<string, string>, altMode: string): void {
|
|
94
|
+
if (altMode === "relativeToGround") {
|
|
95
|
+
|
|
96
|
+
attributes.set(MilStdAttributes.AltitudeMode, "AGL");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
else {
|
|
100
|
+
if (altMode === "absolute") {
|
|
101
|
+
|
|
102
|
+
attributes.set(MilStdAttributes.AltitudeMode, "AMSL");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
*
|
|
111
|
+
* @param SymbolInfo something like
|
|
112
|
+
* "SymbolID?LineColor=0x000000&FillColor=0xFFFFFF&size=35"
|
|
113
|
+
*/
|
|
114
|
+
public static createParameterMapFromURL(SymbolInfo: string): Map<string, string> {
|
|
115
|
+
let modifiers: Map<string, string> = new Map<string, string>();
|
|
116
|
+
let symbolID: string;
|
|
117
|
+
let parameters: string;
|
|
118
|
+
let key: string;
|
|
119
|
+
let value: string;
|
|
120
|
+
let arrParameters: string[];
|
|
121
|
+
let arrKeyValue: string[];
|
|
122
|
+
let temp: string;
|
|
123
|
+
let questionIndex: int = SymbolInfo.lastIndexOf('?');
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
if (questionIndex === -1) {
|
|
127
|
+
symbolID = decodeURI(SymbolInfo);
|
|
128
|
+
} else {
|
|
129
|
+
symbolID = decodeURI(SymbolInfo.substring(0, questionIndex));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
} catch (exc) {
|
|
133
|
+
if (exc instanceof Error) {
|
|
134
|
+
console.error("Error parsing SymbolID");
|
|
135
|
+
console.error(exc.message);
|
|
136
|
+
} else {
|
|
137
|
+
throw exc;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
try { //build a map for the other createMilstdSymbol function to use
|
|
142
|
+
//to build a milstd symbol.
|
|
143
|
+
if (questionIndex > 0 && (questionIndex + 1 < SymbolInfo.length)) {
|
|
144
|
+
parameters = SymbolInfo.substring(questionIndex + 1, SymbolInfo.length);
|
|
145
|
+
arrParameters = parameters.split("&");
|
|
146
|
+
let n: int = arrParameters.length;
|
|
147
|
+
//for(int i = 0; i < arrParameters.length; i++)
|
|
148
|
+
for (let i: int = 0; i < n; i++) {
|
|
149
|
+
arrKeyValue = arrParameters[i].split("=");
|
|
150
|
+
if (arrKeyValue.length === 2 && arrKeyValue[1] != null && arrKeyValue[1] !== "") {
|
|
151
|
+
|
|
152
|
+
key = arrKeyValue[0];
|
|
153
|
+
value = arrKeyValue[1];
|
|
154
|
+
|
|
155
|
+
temp = decodeURI(value);
|
|
156
|
+
modifiers.set(key.toUpperCase(), temp);
|
|
157
|
+
|
|
158
|
+
//console.log("key: " + key + " value: " + temp);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
} catch (exc) {
|
|
163
|
+
if (exc instanceof Error) {
|
|
164
|
+
console.error("Error parsing \"" + key.toUpperCase() + "\" parameter from URL");
|
|
165
|
+
console.error(exc.message);
|
|
166
|
+
} else {
|
|
167
|
+
throw exc;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return modifiers;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
* Try to turn a bad code into something renderable.
|
|
175
|
+
*
|
|
176
|
+
* @param symbolID
|
|
177
|
+
* @return
|
|
178
|
+
* @deprecated use SymbolUtilties.reconcileSymbolID() 9/5/2013
|
|
179
|
+
*/
|
|
180
|
+
/*public static String ReconcileSymbolID(String symbolID) {
|
|
181
|
+
StringBuilder sb = new StringBuilder("");
|
|
182
|
+
char codingScheme = symbolID.charAt(0);
|
|
183
|
+
|
|
184
|
+
if (symbolID.length < 15) {
|
|
185
|
+
while (symbolID.length < 15) {
|
|
186
|
+
symbolID += "-";
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (symbolID.length > 15) {
|
|
190
|
+
symbolID = symbolID.substring(0, 14);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (symbolID != null && symbolID.length == 15) {
|
|
194
|
+
if (codingScheme == 'S' || //warfighting
|
|
195
|
+
codingScheme == 'I' ||//sigint
|
|
196
|
+
codingScheme == 'O' ||//stability operation
|
|
197
|
+
codingScheme == 'E')//emergency management
|
|
198
|
+
{
|
|
199
|
+
sb.append(codingScheme);
|
|
200
|
+
|
|
201
|
+
if (SymbolUtilities.hasValidAffiliation(symbolID) == false) {
|
|
202
|
+
sb.append('U');
|
|
203
|
+
} else {
|
|
204
|
+
sb.append(symbolID.charAt(1));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (SymbolUtilities.hasValidBattleDimension(symbolID) == false) {
|
|
208
|
+
sb.append('Z');
|
|
209
|
+
sb.replace(0, 1, "S");
|
|
210
|
+
} else {
|
|
211
|
+
sb.append(symbolID.charAt(2));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (SymbolUtilities.hasValidStatus(symbolID) == false) {
|
|
215
|
+
sb.append('P');
|
|
216
|
+
} else {
|
|
217
|
+
sb.append(symbolID.charAt(3));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
sb.append("------");
|
|
221
|
+
sb.append(symbolID.substring(10, 15));
|
|
222
|
+
|
|
223
|
+
} else if (codingScheme == 'G')//tactical
|
|
224
|
+
{
|
|
225
|
+
sb.append(codingScheme);
|
|
226
|
+
|
|
227
|
+
if (SymbolUtilities.hasValidAffiliation(symbolID) == false) {
|
|
228
|
+
sb.append('U');
|
|
229
|
+
} else {
|
|
230
|
+
sb.append(symbolID.charAt(1));
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
sb.append('G');
|
|
234
|
+
|
|
235
|
+
if (SymbolUtilities.hasValidStatus(symbolID) == false) {
|
|
236
|
+
sb.append('P');
|
|
237
|
+
} else {
|
|
238
|
+
sb.append(symbolID.charAt(3));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
sb.append("GPP---");//return an action point
|
|
242
|
+
sb.append(symbolID.substring(10, 15));
|
|
243
|
+
|
|
244
|
+
} else if (codingScheme == 'W')//weather
|
|
245
|
+
{//no default weather graphic
|
|
246
|
+
return "SUZP-----------";//unknown
|
|
247
|
+
} else//bad codingScheme
|
|
248
|
+
{
|
|
249
|
+
sb.append('S');
|
|
250
|
+
if (SymbolUtilities.hasValidAffiliation(symbolID) == false) {
|
|
251
|
+
sb.append('U');
|
|
252
|
+
} else {
|
|
253
|
+
sb.append(symbolID.charAt(1));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (SymbolUtilities.hasValidBattleDimension(symbolID) == false) {
|
|
257
|
+
sb.append('Z');
|
|
258
|
+
} else {
|
|
259
|
+
sb.append(symbolID.charAt(2));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (SymbolUtilities.hasValidStatus(symbolID) == false) {
|
|
263
|
+
sb.append('P');
|
|
264
|
+
} else {
|
|
265
|
+
sb.append(symbolID.charAt(3));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
sb.append("------");
|
|
269
|
+
sb.append(symbolID.substring(10, 15));
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
return "SUZP-----------";//unknown
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return sb.toString();
|
|
276
|
+
|
|
277
|
+
}//*/
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Checks symbolID and if the relevant modifiers are present
|
|
281
|
+
*
|
|
282
|
+
* @param symbolCode
|
|
283
|
+
* @param modifiers
|
|
284
|
+
* @return
|
|
285
|
+
* @deprecated
|
|
286
|
+
*/
|
|
287
|
+
public static is3dSymbol(symbolCode: string, modifiers: Map<string, string>): boolean {
|
|
288
|
+
let returnValue: boolean = false;
|
|
289
|
+
|
|
290
|
+
try {
|
|
291
|
+
let symbolId: string = symbolCode.substring(4, 10);
|
|
292
|
+
|
|
293
|
+
if (symbolId === "ACAI--" || // Airspace Coordination Area Irregular
|
|
294
|
+
symbolId === "ACAR--" || // Airspace Coordination Area Rectangular
|
|
295
|
+
symbolId === "ACAC--" || // Airspace Coordination Area Circular
|
|
296
|
+
symbolId === "AKPC--" || // Kill box circular
|
|
297
|
+
symbolId === "AKPR--" || // Kill box rectangular
|
|
298
|
+
symbolId === "AKPI--" || // Kill box irregular
|
|
299
|
+
symbolId === "ALC---" || // Air corridor
|
|
300
|
+
symbolId === "ALM---" || //
|
|
301
|
+
symbolId === "ALS---" || // SAAFR
|
|
302
|
+
symbolId === "ALU---" || // UAV
|
|
303
|
+
symbolId === "ALL---" || // Low level transit route
|
|
304
|
+
symbolId === "AAR---"
|
|
305
|
+
|| symbolId === "AAF---"
|
|
306
|
+
|| symbolId === "AAH---"
|
|
307
|
+
|| symbolId === "AAM---" || // MEZ
|
|
308
|
+
symbolId === "AAML--" || // LOMEZ
|
|
309
|
+
symbolId === "AAMH--") {
|
|
310
|
+
|
|
311
|
+
try {
|
|
312
|
+
if (modifiers != null) {
|
|
313
|
+
|
|
314
|
+
// These guys store array values. Put in appropriate data strucutre
|
|
315
|
+
// for MilStdSymbol.
|
|
316
|
+
if (modifiers.has(Modifiers.X_ALTITUDE_DEPTH)) {
|
|
317
|
+
let altitudes: string[] = modifiers.get(Modifiers.X_ALTITUDE_DEPTH).split(",");
|
|
318
|
+
if (altitudes.length < 2) {
|
|
319
|
+
returnValue = false;
|
|
320
|
+
} else {
|
|
321
|
+
returnValue = true;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
}
|
|
326
|
+
} catch (exc) {
|
|
327
|
+
if (exc instanceof Error) {
|
|
328
|
+
console.error(exc.message);
|
|
329
|
+
} else {
|
|
330
|
+
throw exc;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
} catch (e) {
|
|
335
|
+
if (e instanceof Error) {
|
|
336
|
+
console.error(e.message);
|
|
337
|
+
} else {
|
|
338
|
+
throw e;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return returnValue;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Determines if a String represents a valid number
|
|
346
|
+
*
|
|
347
|
+
* @param text
|
|
348
|
+
* @return "1.56" == true, "1ab" == false
|
|
349
|
+
*/
|
|
350
|
+
public static isNumber(text: string): boolean {
|
|
351
|
+
if (text != null && RegExp("((-|\\+)?[0-9]+(\\.[0-9]+)?)+").test(text)) {
|
|
352
|
+
return true;
|
|
353
|
+
} else {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Takes a throwable and puts it's stacktrace into a string.
|
|
360
|
+
*
|
|
361
|
+
* @param thrown
|
|
362
|
+
* @return
|
|
363
|
+
*/
|
|
364
|
+
public static getStackTrace(thrown: Error): string {
|
|
365
|
+
try {
|
|
366
|
+
/*
|
|
367
|
+
let writer: java.io.Writer = new java.io.StringWriter();
|
|
368
|
+
let printWriter: java.io.PrintWriter = new java.io.PrintWriter(writer);
|
|
369
|
+
thrown.printStackTrace(printWriter);
|
|
370
|
+
return writer.toString();
|
|
371
|
+
*/
|
|
372
|
+
return thrown.stack;
|
|
373
|
+
} catch (exc) {
|
|
374
|
+
if (exc instanceof Error) {
|
|
375
|
+
//console.log("JavaRendererUtilties.getStackTrace()");
|
|
376
|
+
//return "Error - couldn't retrieve stack trace";
|
|
377
|
+
return "";
|
|
378
|
+
} else {
|
|
379
|
+
throw exc;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
public static getEndPointWithAngle(ptStart: Point2D,
|
|
385
|
+
//Point2D pt1,
|
|
386
|
+
//Point2D pt2,
|
|
387
|
+
angle: double,
|
|
388
|
+
distance: double): Point2D {
|
|
389
|
+
let newX: double = 0;
|
|
390
|
+
let newY: double = 0;
|
|
391
|
+
let pt: Point2D = new Point2D();
|
|
392
|
+
try {
|
|
393
|
+
//first get the angle psi between pt0 and pt1
|
|
394
|
+
let psi: double = 0;//Math.atan((pt1.y - pt0.y) / (pt1.x - pt0.x));
|
|
395
|
+
//double psi = Math.atan((ptStart.getY() - ptStart.getY()) / (ptStart.getX() - (ptStart.getX()+100)));
|
|
396
|
+
//convert alpha to radians
|
|
397
|
+
let alpha1: double = Math.PI * angle / 180;
|
|
398
|
+
|
|
399
|
+
//theta is the angle of extension from the x axis
|
|
400
|
+
let theta: double = psi + alpha1;
|
|
401
|
+
//dx is the x extension from pt2
|
|
402
|
+
let dx: double = distance * Math.cos(theta);
|
|
403
|
+
//dy is the y extension form pt2
|
|
404
|
+
let dy: double = distance * Math.sin(theta);
|
|
405
|
+
newX = ptStart.getX() + dx;
|
|
406
|
+
newY = ptStart.getY() + dy;
|
|
407
|
+
|
|
408
|
+
pt.setLocation(newX, newY);
|
|
409
|
+
} catch (exc) {
|
|
410
|
+
if (exc instanceof Error) {
|
|
411
|
+
console.log(exc.message);
|
|
412
|
+
console.log(exc.stack)
|
|
413
|
+
} else {
|
|
414
|
+
throw exc;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
return pt;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
*
|
|
422
|
+
* @param latitude1
|
|
423
|
+
* @param longitude1
|
|
424
|
+
* @param latitude2
|
|
425
|
+
* @param longitude2
|
|
426
|
+
* @param unitOfMeasure meters, kilometers, miles, feet, yards, nautical,
|
|
427
|
+
* nautical miles.
|
|
428
|
+
* @return
|
|
429
|
+
*/
|
|
430
|
+
public static measureDistance(latitude1: double, longitude1: double, latitude2: double, longitude2: double, unitOfMeasure: string): double {
|
|
431
|
+
// latitude1,latitude2 = latitude, longitude1,longitude2 = longitude
|
|
432
|
+
//Radius is 6378.1 (km), 3963.1 (mi), 3443.9 (nm
|
|
433
|
+
|
|
434
|
+
let distance: double = -1;
|
|
435
|
+
let
|
|
436
|
+
rad: double = 0;
|
|
437
|
+
|
|
438
|
+
let uom: string = unitOfMeasure.toLowerCase();
|
|
439
|
+
|
|
440
|
+
if (uom === "meters") {
|
|
441
|
+
rad = 6378137;
|
|
442
|
+
} else {
|
|
443
|
+
if (uom === "kilometers") {
|
|
444
|
+
rad = 6378.137;
|
|
445
|
+
} else {
|
|
446
|
+
if (uom === "miles") {
|
|
447
|
+
rad = 3963.1;
|
|
448
|
+
} else {
|
|
449
|
+
if (uom === "feet") {
|
|
450
|
+
rad = 20925524.9;
|
|
451
|
+
} else {
|
|
452
|
+
if (uom === "yards") {
|
|
453
|
+
rad = 6975174.98;
|
|
454
|
+
} else {
|
|
455
|
+
if (uom === "nautical") {
|
|
456
|
+
rad = 3443.9;
|
|
457
|
+
} else {
|
|
458
|
+
if (uom === "nautical miles") {
|
|
459
|
+
rad = 3443.9;
|
|
460
|
+
} else {
|
|
461
|
+
return -1.0;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
latitude1 = latitude1 * (Math.PI / 180);
|
|
477
|
+
latitude2 = latitude2 * (Math.PI / 180);
|
|
478
|
+
longitude1 = longitude1 * (Math.PI / 180);
|
|
479
|
+
longitude2 = longitude2 * (Math.PI / 180);
|
|
480
|
+
distance = (Math.acos(Math.cos(latitude1) * Math.cos(longitude1) * Math.cos(latitude2) * Math.cos(longitude2) + Math.cos(latitude1) * Math.sin(longitude1) * Math.cos(latitude2) * Math.sin(longitude2) + Math.sin(latitude1) * Math.sin(latitude2)) * rad);
|
|
481
|
+
|
|
482
|
+
return distance;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BasicStroke } from "../../../graphics2d/BasicStroke";
|
|
2
|
+
import { Point2D } from "../../../graphics2d/Point2D";
|
|
3
|
+
import { Color } from "../../../renderer/utilities/Color";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export class LineInfo {
|
|
11
|
+
|
|
12
|
+
private lineColor: Color;
|
|
13
|
+
private fillColor: Color;
|
|
14
|
+
//private int lineWidth = 2;
|
|
15
|
+
private stroke: BasicStroke;
|
|
16
|
+
|
|
17
|
+
private _Polylines: Array<Array<Point2D>>;
|
|
18
|
+
|
|
19
|
+
public constructor() {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public setLineColor(value: Color): void {
|
|
23
|
+
this.lineColor = value;
|
|
24
|
+
}
|
|
25
|
+
public getLineColor(): Color {
|
|
26
|
+
return this.lineColor;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public setFillColor(value: Color): void {
|
|
30
|
+
this.fillColor = value;
|
|
31
|
+
}
|
|
32
|
+
public getFillColor(): Color {
|
|
33
|
+
return this.fillColor;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public getStroke(): BasicStroke {
|
|
37
|
+
return this.stroke;
|
|
38
|
+
}
|
|
39
|
+
//client will use this to do fills (if it is not null)
|
|
40
|
+
/*
|
|
41
|
+
public TexturePaint getTexturePaint()
|
|
42
|
+
{
|
|
43
|
+
return texturePaint;
|
|
44
|
+
}
|
|
45
|
+
public void setTexturePaint(TexturePaint value)
|
|
46
|
+
{
|
|
47
|
+
texturePaint=value;
|
|
48
|
+
}*/
|
|
49
|
+
|
|
50
|
+
public setStroke(s: BasicStroke): void {
|
|
51
|
+
this.stroke = s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public getPolylines(): Array<Array<Point2D>> {
|
|
55
|
+
return this._Polylines;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public setPolylines(value: Array<Array<Point2D>>): void {
|
|
59
|
+
this._Polylines = value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LineInfo } from "./LineInfo";
|
|
2
|
+
import { TextInfo } from "./TextInfo";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export class SymbolInfo {
|
|
11
|
+
|
|
12
|
+
private _LineInfo: Array<LineInfo>;
|
|
13
|
+
private _TextInfo: Array<TextInfo>;
|
|
14
|
+
|
|
15
|
+
public constructor();
|
|
16
|
+
public constructor(ti: Array<TextInfo>, li: Array<LineInfo>);
|
|
17
|
+
public constructor(...args: unknown[]) {
|
|
18
|
+
switch (args.length) {
|
|
19
|
+
case 0: {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
case 2: {
|
|
24
|
+
const [ti, li] = args as [Array<TextInfo>, Array<LineInfo>];
|
|
25
|
+
|
|
26
|
+
this._LineInfo = li;
|
|
27
|
+
this._TextInfo = ti;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
default: {
|
|
32
|
+
throw Error(`Invalid number of arguments`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
public getTextInfoList(): Array<TextInfo> {
|
|
39
|
+
return this._TextInfo;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public getLineInfoList(): Array<LineInfo> {
|
|
43
|
+
return this._LineInfo;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
//import java.awt.geom.Point2D;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import { Point2D } from "../../../graphics2d/Point2D";
|
|
11
|
+
|
|
12
|
+
type double = number;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export class TextInfo {
|
|
19
|
+
private _ModifierString: string;
|
|
20
|
+
private _ModifierStringPosition: Point2D;
|
|
21
|
+
private _ModifierStringAngle: double = 0;
|
|
22
|
+
|
|
23
|
+
public constructor() { }
|
|
24
|
+
|
|
25
|
+
//set this when returning text string.
|
|
26
|
+
public setModifierString(value: string): void {
|
|
27
|
+
this._ModifierString = value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public getModifierString(): string {
|
|
31
|
+
return this._ModifierString;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//location to draw ModifierString.
|
|
35
|
+
public setModifierStringPosition(value: Point2D): void {
|
|
36
|
+
this._ModifierStringPosition = value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public getModifierStringPosition(): Point2D {
|
|
40
|
+
return this._ModifierStringPosition;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//angle to draw ModifierString.
|
|
44
|
+
public setModifierStringAngle(value: double): void {
|
|
45
|
+
this._ModifierStringAngle = value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public getModifierStringAngle(): double {
|
|
49
|
+
return this._ModifierStringAngle;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Geodesy by Mike Gavaghan
|
|
3
|
+
*
|
|
4
|
+
* http://www.gavaghan.org/blog/free-source-code/geodesy-library-vincentys-formula/
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2007 Mike Gavaghan - mike@gavaghan.org
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export class Angle {
|
|
22
|
+
static readonly PiOver180: number = Math.PI / 180.0;
|
|
23
|
+
|
|
24
|
+
public static toRadians(degrees: number): number {
|
|
25
|
+
return degrees * Angle.PiOver180;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public static toDegrees(radians: number): number {
|
|
29
|
+
return radians / Angle.PiOver180;
|
|
30
|
+
}
|
|
31
|
+
}
|