@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.
Files changed (170) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +57 -0
  3. package/buildNode.bat +2 -0
  4. package/buildWeb.bat +2 -0
  5. package/dist/C5Ren.d.ts +6970 -0
  6. package/dist/C5Ren.js +2 -0
  7. package/dist/C5Ren.js.map +1 -0
  8. package/dist/LICENSE +201 -0
  9. package/dist/README.md +57 -0
  10. package/dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz +0 -0
  11. package/dist/manifest.json +4 -0
  12. package/dist/package.json +16 -0
  13. package/index.ts +169 -0
  14. package/package.bak +50 -0
  15. package/package.json +40 -0
  16. package/package.node.json +43 -0
  17. package/package.pack.json +19 -0
  18. package/package.packWeb.json +16 -0
  19. package/package.web.json +40 -0
  20. package/src/main/ts/android/graphics/Bitmap.ts +7 -0
  21. package/src/main/ts/android/graphics/Paint.ts +26 -0
  22. package/src/main/ts/android/graphics/Path.ts +78 -0
  23. package/src/main/ts/android/graphics/PointF.ts +14 -0
  24. package/src/main/ts/android/graphics/Rect.ts +18 -0
  25. package/src/main/ts/android/graphics/RectF.ts +50 -0
  26. package/src/main/ts/android/graphics/Region.ts +36 -0
  27. package/src/main/ts/android/graphics/Typeface.ts +11 -0
  28. package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +99 -0
  29. package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +34 -0
  30. package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +193 -0
  31. package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +2971 -0
  32. package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +4008 -0
  33. package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +93 -0
  34. package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +89 -0
  35. package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +515 -0
  36. package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +5403 -0
  37. package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +1084 -0
  38. package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +2173 -0
  39. package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +4934 -0
  40. package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +7 -0
  41. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +5601 -0
  42. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +14 -0
  43. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +648 -0
  44. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +647 -0
  45. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +2994 -0
  46. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +2663 -0
  47. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +669 -0
  48. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +971 -0
  49. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +871 -0
  50. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +3507 -0
  51. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +500 -0
  52. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +1089 -0
  53. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +2656 -0
  54. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +1419 -0
  55. package/src/main/ts/armyc2/c5isr/data/genc.json +1407 -0
  56. package/src/main/ts/armyc2/c5isr/data/msd.json +17311 -0
  57. package/src/main/ts/armyc2/c5isr/data/mse.json +18500 -0
  58. package/src/main/ts/armyc2/c5isr/data/svgd.json +31214 -0
  59. package/src/main/ts/armyc2/c5isr/data/svge.json +30558 -0
  60. package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +10 -0
  61. package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +437 -0
  62. package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +429 -0
  63. package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +7 -0
  64. package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +35 -0
  65. package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +111 -0
  66. package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +29 -0
  67. package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +18 -0
  68. package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +211 -0
  69. package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +80 -0
  70. package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +33 -0
  71. package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +16 -0
  72. package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +726 -0
  73. package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +141 -0
  74. package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +112 -0
  75. package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +261 -0
  76. package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +391 -0
  77. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +567 -0
  78. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +445 -0
  79. package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +31 -0
  80. package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +18 -0
  81. package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +45 -0
  82. package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +25 -0
  83. package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +15 -0
  84. package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +22 -0
  85. package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +269 -0
  86. package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +9882 -0
  87. package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +146 -0
  88. package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +1265 -0
  89. package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +64 -0
  90. package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +95 -0
  91. package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +93 -0
  92. package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +114 -0
  93. package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +555 -0
  94. package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +62 -0
  95. package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +120 -0
  96. package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +431 -0
  97. package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +99 -0
  98. package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +25 -0
  99. package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +203 -0
  100. package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +104 -0
  101. package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +481 -0
  102. package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +40 -0
  103. package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +1323 -0
  104. package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +51 -0
  105. package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +736 -0
  106. package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +106 -0
  107. package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +84 -0
  108. package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +87 -0
  109. package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +34 -0
  110. package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +324 -0
  111. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +127 -0
  112. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +18 -0
  113. package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +111 -0
  114. package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +219 -0
  115. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +1008 -0
  116. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +882 -0
  117. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +380 -0
  118. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +797 -0
  119. package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +1699 -0
  120. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +178 -0
  121. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +45 -0
  122. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +126 -0
  123. package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +118 -0
  124. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +11 -0
  125. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +1201 -0
  126. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +591 -0
  127. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +29 -0
  128. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +753 -0
  129. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +137 -0
  130. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +438 -0
  131. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +19 -0
  132. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +10 -0
  133. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +5 -0
  134. package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +404 -0
  135. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +525 -0
  136. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +55 -0
  137. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +36 -0
  138. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +1055 -0
  139. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +2085 -0
  140. package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +157 -0
  141. package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +86 -0
  142. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +3798 -0
  143. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +412 -0
  144. package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +124 -0
  145. package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +26 -0
  146. package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +677 -0
  147. package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +484 -0
  148. package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +62 -0
  149. package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +46 -0
  150. package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +51 -0
  151. package/src/main/ts/org/gavaghan/geodesy/Angle.ts +31 -0
  152. package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +71 -0
  153. package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +200 -0
  154. package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +55 -0
  155. package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +68 -0
  156. package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +103 -0
  157. package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +90 -0
  158. package/test/ExportSPImages.js +692 -0
  159. package/test/MPWW.html +556 -0
  160. package/test/MPWorker.js +318 -0
  161. package/test/SPWorker.js +233 -0
  162. package/test/SVGWW.html +363 -0
  163. package/test/singlePointTester3.html +751 -0
  164. package/tsconfig.json +54 -0
  165. package/typedoc.json +30 -0
  166. package/updateVersion.js +21 -0
  167. package/webpack.config.js +34 -0
  168. package/webpackn.config.js +28 -0
  169. package/webpackr.config.js +47 -0
  170. package/webpackw.config.js +23 -0
@@ -0,0 +1,753 @@
1
+ import { Rectangle2D } from "../../graphics2d/Rectangle2D"
2
+ import { RendererSettings } from "../../renderer/utilities/RendererSettings"
3
+ import { SVGInfo } from "../../renderer/utilities/SVGInfo"
4
+ import { SymbolID } from "../../renderer/utilities/SymbolID"
5
+ import { ErrorLogger } from "./ErrorLogger";
6
+ import { RendererUtilities } from "./RendererUtilities";
7
+
8
+ import jsond from '../../data/svgd.json';
9
+ import jsone from '../../data/svge.json';
10
+
11
+ export class SVGLookup
12
+ {
13
+ private static _instance: SVGLookup;
14
+ private static _initCalled: boolean = false;
15
+ private static _isReady: boolean = false;
16
+ private static _SVGLookupD: Map<string, SVGInfo>;
17
+ private static _SVGLookupE: Map<string, SVGInfo>;
18
+
19
+ private static svgd:any;
20
+ private static svge:any;
21
+
22
+ private static svgdJSON:string = "/svgd.json";
23
+ private static svgeJSON:string = "/svge.json";
24
+
25
+ /*public static async loadData(location?:string)
26
+ {
27
+
28
+ let pathd:string = SVGLookup.svgdJSON;//String(svgdj);
29
+ let pathe:string = SVGLookup.svgeJSON;//String(svgej);
30
+ if(location)
31
+ {
32
+ pathd = location + pathd.substring(pathd.lastIndexOf('/')+1,pathd.length);
33
+ pathe = location + pathe.substring(pathe.lastIndexOf('/')+1,pathe.length);
34
+ }
35
+
36
+ let promises:Array<Promise<any>> = new Array<Promise<any>>()
37
+
38
+ promises.push(RendererUtilities.getData(pathd));
39
+ promises.push(RendererUtilities.getData(pathe));// RendererUtilities.getData(String(svgd)).then(function(result){this.genc = result;this.init();});
40
+ await Promise.all(promises).then(values => {SVGLookup.svgd = values[0];SVGLookup.svge = values[1];}).catch(error => {throw error;})
41
+
42
+ //let promises:Array<Promise<any>> = new Array<Promise<any>>()
43
+
44
+ //promises.push(RendererUtilities.getData(String(svgdj)));
45
+ //promises.push(RendererUtilities.getData(String(svgej)));// RendererUtilities.getData(String(svgd)).then(function(result){this.genc = result;this.init();});
46
+ //await Promise.all(promises).then(values => {SVGLookup.svgd = values[0];SVGLookup.svge = values[1];}).catch(error => {throw error;})
47
+ }//*/
48
+
49
+ /**
50
+ *
51
+ * @param urls
52
+ * @deprecated
53
+ */
54
+ public static async setData(urls:string[])
55
+ {
56
+ /*let promises:Array<Promise<any>> = new Array<Promise<any>>();
57
+
58
+ promises.push(RendererUtilities.getData(urls[0]));
59
+ promises.push(RendererUtilities.getData(urls[1]));// RendererUtilities.getData(String(svgd)).then(function(result){this.genc = result;this.init();});
60
+ await Promise.all(promises).then(values => {SVGLookup.svgd = values[0];SVGLookup.svge = values[1];}).catch(error => {throw error;})//*/
61
+ }
62
+
63
+ /*public static setDataObject()
64
+ {
65
+ this.svgd = jsond;
66
+ this.svge = jsone;
67
+ }//*/
68
+
69
+ private constructor() {
70
+
71
+ this.init();
72
+ }
73
+
74
+ public static getInstance(): SVGLookup {
75
+ if (!SVGLookup._instance) {
76
+ SVGLookup._instance = new SVGLookup();
77
+ //SVGLookup._instance.init();
78
+ }
79
+ return SVGLookup._instance;
80
+ }
81
+
82
+ private init(): void {
83
+
84
+ if(typeof jsond === 'object')
85
+ {
86
+ SVGLookup.svgd = jsond;
87
+ SVGLookup.svge = jsone;
88
+ }
89
+
90
+ if (SVGLookup._initCalled === false) {
91
+ SVGLookup._initCalled = true;
92
+ SVGLookup._SVGLookupD = new Map();
93
+ SVGLookup._SVGLookupE = new Map();
94
+ try
95
+ {
96
+ //TODO: potentially wrap this in a web worker.
97
+ this.populateLookup(SVGLookup.svgd, SymbolID.Version_2525Dch1);
98
+ this.populateLookup(SVGLookup.svge, SymbolID.Version_2525E);
99
+ if(SVGLookup._SVGLookupD.size > 0 && SVGLookup._SVGLookupD.size > 0)
100
+ SVGLookup._isReady = true;
101
+
102
+ }
103
+ catch (exc)
104
+ {
105
+ SVGLookup._initCalled = false;
106
+ throw exc;
107
+ }
108
+ }
109
+
110
+
111
+ }
112
+
113
+ public isReady():boolean
114
+ {
115
+ return SVGLookup._isReady;
116
+ }
117
+
118
+ private populateLookup(svgData:any, version: number): void {
119
+ let temp: string[];
120
+ let id: string;
121
+ let bbox: Rectangle2D;
122
+ let svg: string;
123
+ let delimiter: string = "~";
124
+ //let element: any = null;
125
+
126
+ try
127
+ {
128
+
129
+ let lookup: Map<string, SVGInfo>;
130
+
131
+ if (version === SymbolID.Version_2525E) {
132
+
133
+ lookup = SVGLookup._SVGLookupE;
134
+ }
135
+
136
+ else {
137
+
138
+ lookup = SVGLookup._SVGLookupD;
139
+ }
140
+
141
+ let svgCount:number = svgData.svgdata.SVGElements.length;
142
+
143
+
144
+ for (let i:number = 0; i < svgCount; i++)
145
+ {
146
+ let temp : any = svgData.svgdata.SVGElements[i];
147
+
148
+
149
+ if(temp != null)
150
+ {
151
+ let id:string = temp.id;
152
+ let left: number = 0;
153
+ let top: number = 0;
154
+ let width: number = 0;
155
+ let height: number = 0;
156
+ left = parseFloat(temp.X);
157
+ top = parseFloat(temp.Y);
158
+ width = parseFloat(temp.Width);
159
+ height = parseFloat(temp.Height);
160
+ svg = temp.SVG;
161
+ bbox = new Rectangle2D(left, top, width, height);//RectUtilities.makeRectF(left, top, width, height);
162
+
163
+ lookup.set(id, new SVGInfo(id, bbox, svg));
164
+ }
165
+ }
166
+ }
167
+ catch (e) {
168
+ console.log((e as Error).message);
169
+ }
170
+ }
171
+
172
+ /**
173
+ *
174
+ * @param id
175
+ * @return
176
+ */
177
+ public getSVGLInfo(id: string, version: number): SVGInfo | null {
178
+ if (version >= SymbolID.Version_2525E) {
179
+ if (SVGLookup._SVGLookupE.has(id)) {
180
+
181
+ return SVGLookup._SVGLookupE.get(id);
182
+ }
183
+
184
+ }
185
+ else {
186
+ if (SVGLookup._SVGLookupD.has(id)) {
187
+
188
+ return SVGLookup._SVGLookupD.get(id);
189
+ }
190
+
191
+ }
192
+
193
+ return null;
194
+ }
195
+
196
+ public getSVGOctagon(): SVGInfo | null {
197
+ if (SVGLookup._SVGLookupD.has("octagon")) {
198
+
199
+ return SVGLookup._SVGLookupD.get("octagon");
200
+ }
201
+
202
+ else {
203
+
204
+ return null;
205
+ }
206
+
207
+ }
208
+
209
+ public static getFrameID(symbolID: string): string {
210
+ //SIDC positions 3_456_7
211
+ // String frameID = symbolID.charAt(2) + "_" + symbolID.substring(3, 6) + "_" + symbolID.charAt(6);
212
+
213
+ let frameID: string;
214
+ let ss: string;
215
+ let affiliation: number = SymbolID.getAffiliation(symbolID);
216
+ let status: number = SymbolID.getStatus(symbolID);
217
+ //Some affiliations are always dashed and only have one SVG for status with a value of 0
218
+ if (affiliation === SymbolID.StandardIdentity_Affiliation_Pending ||
219
+ affiliation === SymbolID.StandardIdentity_Affiliation_AssumedFriend ||
220
+ affiliation === SymbolID.StandardIdentity_Affiliation_Suspect_Joker) {
221
+ // "When the frame is assumed friend, suspect, or pending, the status shall not be displayed."
222
+ status = 0;
223
+ }
224
+ if (status > 1) {
225
+ // Anything above 1 for status means present for the frame
226
+ status = 0;
227
+ }
228
+
229
+
230
+ let context: number = SymbolID.getContext(symbolID);
231
+ //they didn't make duplicate frame so I have to change the number for
232
+ //the lookup to work.
233
+
234
+ if (SymbolID.getVersion(symbolID) < SymbolID.Version_2525E)//2525Dch1 or less
235
+ {
236
+ switch (SymbolID.getSymbolSet(symbolID)) {
237
+ case 1: //Air
238
+ case 2: //Air Missile
239
+ case 51: { //Air SIGINT
240
+ ss = "01";
241
+ break;
242
+ }
243
+
244
+ case 5: //Space
245
+ case 6: //Space Missile
246
+ case 50: { //Space SIGINT
247
+ ss = "05";
248
+ break;
249
+ }
250
+
251
+ case 10: //Land Unit
252
+ case 11: {//Land Civilian Unit/Org
253
+ ss = "10";
254
+ break;
255
+ }
256
+
257
+ case 15://Land Equipment
258
+ case 52://Land SigInt
259
+ case 53: {//Sea Surface SIGINT
260
+ ss = "30";
261
+ break;
262
+ }
263
+
264
+ case 30: {//Sea Surface
265
+ ss = "30";
266
+ if (SymbolID.getEntityCode(symbolID) === 150000) {
267
+
268
+ return "octagon";
269
+ }
270
+ //this symbol has no frame and a size of 1L x 1L.
271
+ break;
272
+ }
273
+
274
+ case 20: { //Land Installation
275
+ ss = "20";
276
+ break;
277
+ }
278
+
279
+ case SymbolID.SymbolSet_DismountedIndividuals: { //Dismount Individual
280
+ ss = "27";
281
+ break;
282
+ }
283
+
284
+ case 35: //Sea Subsurface
285
+ case 36: //Mine Warfare
286
+ case 54: { //Sea Subsurface SigInt
287
+ ss = "35";
288
+ break;
289
+ }
290
+
291
+ case 40: { //Activities/Events
292
+ ss = "40";
293
+ break;
294
+ }
295
+
296
+ case 60: { //Cyberspace
297
+ ss = "60"; //No cyberspace SVG frame at the moment so setting to activities
298
+ break;
299
+ }
300
+
301
+ default: {
302
+ ss = "00";
303
+
304
+ if (context === SymbolID.StandardIdentity_Context_Exercise && affiliation > SymbolID.StandardIdentity_Affiliation_Unknown) {
305
+ //really there are no unknown exercise symbols outside of pending and unknown
306
+ //default to unknown
307
+ affiliation = SymbolID.StandardIdentity_Affiliation_Unknown;
308
+ }
309
+ }
310
+
311
+ }
312
+ frameID = context + "_" + affiliation + ss + "_" + status;
313
+ }
314
+ else//2525E or above
315
+ {
316
+ let frameShape: string = SymbolID.getFrameShape(symbolID);
317
+ if (frameShape === SymbolID.FrameShape_Unknown) {
318
+
319
+ /*if(SymbolID.getSymbolSet(symbolID) != SymbolID.SymbolSet_SignalsIntelligence)
320
+ {//get frame shape associated with symbol set
321
+ frameShape=SymbolID.getDefaultFrameShape(symbolID);
322
+ }//*/
323
+ frameShape = SymbolID.getDefaultFrameShape(symbolID);
324
+ if (context === SymbolID.StandardIdentity_Context_Exercise &&
325
+ SymbolID.getSymbolSet(symbolID) === SymbolID.SymbolSet_Unknown &&
326
+ affiliation > SymbolID.StandardIdentity_Affiliation_Unknown) {
327
+ //really there are no unknown exercise symbols outside pending and unknown affiliations
328
+ //default to unknown
329
+ affiliation = SymbolID.StandardIdentity_Affiliation_Unknown;
330
+
331
+ }
332
+ }
333
+ if (SymbolID.getSymbolSet(symbolID) === SymbolID.SymbolSet_SeaSurface &&
334
+ SymbolID.getEntityCode(symbolID) === 150000 && //Own Ship
335
+ (frameShape === SymbolID.FrameShape_LandEquipment_SeaSurface || frameShape === SymbolID.FrameShape_Unknown)) {
336
+ return "octagon";
337
+ }
338
+ frameID = context + "_" + affiliation + frameShape + "_" + status;
339
+ }
340
+
341
+ return frameID;
342
+ }
343
+
344
+ public static getMainIconID(symbolID: string): string {
345
+ //SIDC positions 5-6 + 11-16
346
+ let mainIconID: string = symbolID.substring(4, 6) + symbolID.substring(10, 16);
347
+ let ss: number = SymbolID.getSymbolSet(symbolID);
348
+
349
+ if (ss === SymbolID.SymbolSet_MineWarfare) {
350
+ if (RendererSettings.getInstance().getSeaMineRenderMethod() === RendererSettings.SeaMineRenderMethod_ALT ||
351
+ mainIconID === "36110600" || mainIconID === "36110700") {
352
+ mainIconID += "_a";
353
+ }
354
+ }
355
+ else {
356
+ if (ss === SymbolID.SymbolSet_LandUnit) {
357
+ switch (SymbolID.getEntityCode(symbolID)) {
358
+ case 111000:
359
+ case 111001:
360
+ case 111002:
361
+ case 111003:
362
+ case 111004:
363
+ case 111005:
364
+ case 111500:
365
+ case 120100:
366
+ case 120400:
367
+ case 120401:
368
+ case 120402:
369
+ case 120501:
370
+ case 120502:
371
+ case 120601:
372
+ case 120801:
373
+ case 121100:
374
+ case 121101:
375
+ case 121102:
376
+ case 121103:
377
+ case 121104:
378
+ case 121105:
379
+ case 121106:
380
+ case 121107:
381
+ case 121300:
382
+ case 121301:
383
+ case 121302:
384
+ case 121303:
385
+ case 121304:
386
+ case 121802:
387
+ case 122100:
388
+ case 130100:
389
+ case 130101:
390
+ case 130102:
391
+ case 130103:
392
+ case 130200:
393
+ case 130302:
394
+ case 130303:
395
+ case 140102:
396
+ case 140103:
397
+ case 140104:
398
+ case 140105:
399
+ case 140702:
400
+ case 140703:
401
+ case 141702:
402
+ case 150504:
403
+ case 150800:
404
+ case 160200:
405
+ case 161200:
406
+ case 161300:
407
+ case 161400:
408
+ case 161700:
409
+ case 161800:
410
+ case 161900:
411
+ case 162000:
412
+ case 162100:
413
+ case 162200:
414
+ case 163400:
415
+ case 163700:
416
+ case 163800:
417
+ case 163900:
418
+ case 164000:
419
+ case 164100:
420
+ case 164200:
421
+ case 164300:
422
+ case 164400:
423
+ case 164500:
424
+ case 164600:
425
+ case 165000: {//NATO Only
426
+ //do thing to append correct number
427
+ mainIconID += SVGLookup.getPostFixForIcon(symbolID);
428
+ break;
429
+ }
430
+
431
+ default: {
432
+ break;
433
+ }
434
+
435
+ }
436
+
437
+ }
438
+ else {
439
+ if (ss === SymbolID.SymbolSet_LandEquipment) {
440
+ switch (SymbolID.getEntityCode(symbolID)) {
441
+ case 120111: {
442
+ //do thing to append correct number
443
+ mainIconID += SVGLookup.getPostFixForIcon(symbolID);
444
+ break;
445
+ }
446
+
447
+ default: {
448
+ break;
449
+ }
450
+
451
+ }
452
+ }
453
+ else {
454
+ if (ss === SymbolID.SymbolSet_LandInstallation) {
455
+ switch (SymbolID.getEntityCode(symbolID)) {
456
+ case 110300:
457
+ case 111200:
458
+ case 120103:
459
+ case 120105:
460
+ case 120106:
461
+ case 120107:
462
+ case 120701:
463
+ case 120702: {
464
+ //do thing to append correct number
465
+ mainIconID += SVGLookup.getPostFixForIcon(symbolID);
466
+ break;
467
+ }
468
+
469
+ default: {
470
+ break;
471
+ }
472
+
473
+ }
474
+ }
475
+ else {
476
+ if (ss === SymbolID.SymbolSet_Activities) {
477
+ switch (SymbolID.getEntityCode(symbolID)) {
478
+ case 110303:
479
+ case 130201:
480
+ case 131202:
481
+ case 131208: {
482
+ //do thing to append correct number
483
+ mainIconID += SVGLookup.getPostFixForIcon(symbolID);
484
+ break;
485
+ }
486
+
487
+ default: {
488
+ break;
489
+ }
490
+
491
+ }
492
+ }
493
+ else {
494
+ if (ss === SymbolID.SymbolSet_Unknown) {
495
+
496
+ mainIconID = "00000000";
497
+ }
498
+ //unknown with question mark
499
+ else {
500
+ if (ss !== SymbolID.SymbolSet_Air &&
501
+ ss !== SymbolID.SymbolSet_AirMissile &&
502
+ ss !== SymbolID.SymbolSet_Space &&
503
+ ss !== SymbolID.SymbolSet_SpaceMissile &&
504
+ ss !== SymbolID.SymbolSet_LandCivilianUnit_Organization &&
505
+ ss !== SymbolID.SymbolSet_DismountedIndividuals &&
506
+ ss !== SymbolID.SymbolSet_ControlMeasure &&
507
+ ss !== SymbolID.SymbolSet_SeaSurface &&
508
+ ss !== SymbolID.SymbolSet_SeaSubsurface &&
509
+ ss !== SymbolID.SymbolSet_Atmospheric &&
510
+ ss !== SymbolID.SymbolSet_Oceanographic &&
511
+ ss !== SymbolID.SymbolSet_MeteorologicalSpace &&
512
+ ss !== SymbolID.SymbolSet_SignalsIntelligence_Space &&
513
+ ss !== SymbolID.SymbolSet_SignalsIntelligence_Air &&
514
+ ss !== SymbolID.SymbolSet_SignalsIntelligence_Land &&
515
+ ss !== SymbolID.SymbolSet_SignalsIntelligence_SeaSurface &&
516
+ ss !== SymbolID.SymbolSet_SignalsIntelligence_SeaSubsurface &&
517
+ ss !== SymbolID.SymbolSet_CyberSpace) {
518
+ mainIconID = "98100000";//invalid symbol, inverted question mark
519
+ }
520
+ }
521
+
522
+ }
523
+
524
+ }
525
+
526
+ }
527
+
528
+ }
529
+
530
+ }
531
+
532
+
533
+ return mainIconID;
534
+ }
535
+
536
+
537
+ private static getPostFixForIcon(symbolID: string): string {
538
+ let aff: number = SymbolID.getAffiliation(symbolID);
539
+ let pf: string = "";
540
+ if (aff === SymbolID.StandardIdentity_Affiliation_Friend ||
541
+ aff === SymbolID.StandardIdentity_Affiliation_AssumedFriend) {
542
+
543
+ pf += "_1";
544
+ }
545
+
546
+ else {
547
+ if (aff === SymbolID.StandardIdentity_Affiliation_Neutral) {
548
+
549
+ pf += "_2";
550
+ }
551
+
552
+ else {
553
+ if (aff === SymbolID.StandardIdentity_Affiliation_Hostile_Faker ||
554
+ aff === SymbolID.StandardIdentity_Affiliation_Suspect_Joker) {
555
+
556
+ pf += "_3";
557
+ }
558
+
559
+ else {
560
+ if (aff === SymbolID.StandardIdentity_Affiliation_Unknown ||
561
+ aff === SymbolID.StandardIdentity_Affiliation_Pending) {
562
+
563
+ pf += "_0";
564
+ }
565
+
566
+ }
567
+
568
+ }
569
+
570
+ }
571
+
572
+
573
+ return pf;
574
+ }
575
+
576
+ public static getMod1ID(symbolID: string): string {
577
+ let mod1ID: string;
578
+
579
+
580
+ if ((SymbolID.getVersion(symbolID) >= SymbolID.Version_2525E) && symbolID.charAt(20) !== '0') {//2525E with Modifier 1 Indicator set
581
+ mod1ID = symbolID.substring(20, 21) + symbolID.substring(16, 18) + "_1";
582
+ }
583
+ else //2525D or no Modifier 1 Indicator set
584
+ {
585
+ //SIDC positions 5-6 + 17-18 + "1"
586
+
587
+ if (SymbolID.getEntity(symbolID) >= 11) {
588
+
589
+ mod1ID = symbolID.substring(4, 6) + symbolID.substring(16, 18) + "1";
590
+ }
591
+
592
+ else {
593
+
594
+ mod1ID = symbolID.substring(4, 6) + "001";
595
+ }
596
+
597
+
598
+ if (SymbolID.getSymbolSet(symbolID) === SymbolID.SymbolSet_LandUnit) {
599
+ switch (SymbolID.getModifier1(symbolID)) {
600
+ case 98: {
601
+ mod1ID += SVGLookup.getPostFixForIcon(symbolID);
602
+ break;
603
+ }
604
+
605
+ default: {
606
+ break;
607
+ }
608
+
609
+ }
610
+ }
611
+ }
612
+ return mod1ID;
613
+ }
614
+
615
+ public static getMod2ID(symbolID: string): string {
616
+ let mod2ID: string;
617
+ if ((SymbolID.getVersion(symbolID) >= SymbolID.Version_2525E) && symbolID.charAt(21) !== '0') {//2525E with Modifier 1 Indicator set
618
+ mod2ID = symbolID.substring(21, 22) + symbolID.substring(18, 20) + "_2";
619
+ }
620
+ else //2525D or no Modifier 1 Indicator set
621
+ {
622
+ //SIDC positions 5-6 + 19-20 + "2"
623
+ if (SymbolID.getEntity(symbolID) >= 11) {
624
+
625
+ mod2ID = symbolID.substring(4, 6) + symbolID.substring(18, 20) + "2";
626
+ }
627
+
628
+ else {
629
+
630
+ mod2ID = symbolID.substring(4, 6) + "002";
631
+ }
632
+
633
+
634
+ if (SymbolID.getSymbolSet(symbolID) === SymbolID.SymbolSet_LandUnit) {
635
+ switch (SymbolID.getModifier2(symbolID)) {
636
+ case 60:
637
+ case 62:
638
+ case 84:
639
+ case 89: {
640
+ mod2ID += SVGLookup.getPostFixForIcon(symbolID);
641
+ break;
642
+ }
643
+
644
+ default: {
645
+ break;
646
+ }
647
+
648
+ }
649
+ }
650
+ }
651
+ return mod2ID;
652
+ }
653
+
654
+ public static getEchelonAmplifier(symbolID: string): string {
655
+ let amp: string;
656
+ let ver: number = SymbolID.getVersion(symbolID);
657
+ if (ver < SymbolID.Version_2525E) {
658
+ amp = symbolID.charAt(3) + symbolID.substring(8, 10);
659
+ }
660
+ else // >= 2525E
661
+ {
662
+ //This will eventually be different with the introduction of the frame shape modifier
663
+ amp = symbolID.charAt(3) + symbolID.substring(8, 10);
664
+ }
665
+ return amp;
666
+ }
667
+
668
+ public static getHQTFFD(symbolID: string): string {
669
+ let hqtffd: string;
670
+ let ver: number = SymbolID.getVersion(symbolID);
671
+ if (ver < SymbolID.Version_2525E) {
672
+ hqtffd = symbolID.substring(3, 6) + symbolID.charAt(7);
673
+ }
674
+ else // >= 2525E
675
+ {
676
+ //This will eventually be different with the introduction of the frame shape modifier
677
+ hqtffd = symbolID.substring(3, 6) + symbolID.charAt(7);
678
+ }
679
+ return hqtffd;
680
+ }
681
+
682
+ public static getOCA(symbolID: string, useSlash: boolean): string | null {
683
+ if (useSlash) {
684
+ let status: number = SymbolID.getStatus(symbolID);
685
+ if (status === SymbolID.Status_Present_Damaged || status === SymbolID.Status_Present_Destroyed) {
686
+
687
+ return status.toString();
688
+ }
689
+
690
+ else {
691
+
692
+ return null;
693
+ }
694
+
695
+ }
696
+ else//get the bar
697
+ {
698
+ let oca: string;
699
+ let ver: number = SymbolID.getVersion(symbolID);
700
+ if (ver < SymbolID.Version_2525E) {
701
+ oca = symbolID.substring(2, 7) + "2";
702
+ }
703
+ else // >= 2525E
704
+ {
705
+ //This will eventually be different with the introduction of the frame shape modifier
706
+ oca = symbolID.substring(2, 7) + "2";
707
+ }
708
+ return oca;
709
+ }
710
+ }
711
+
712
+ public static getAllKeys(): Array<string> {
713
+ let kl: Array<string> = new Array();
714
+ let keys: any = SVGLookup._SVGLookupD.keys();//keys is an iterator
715
+
716
+ for(const value of keys)
717
+ {
718
+ kl.push(value);
719
+ }
720
+ return kl;
721
+ }
722
+
723
+ public addCustomSymbol(svgInfo:SVGInfo, version:number):boolean
724
+ {
725
+ let success:boolean = false;
726
+ try
727
+ {
728
+ let basicID = svgInfo.getID();
729
+ if (version < SymbolID.Version_2525E)
730
+ {
731
+ if(SVGLookup._SVGLookupD.has(svgInfo.getID()) == false)
732
+ {
733
+ SVGLookup._SVGLookupD.set(svgInfo.getID(),svgInfo);
734
+ }
735
+ }
736
+ else if (version === SymbolID.Version_2525E)
737
+ {
738
+ if(SVGLookup._SVGLookupE.has(svgInfo.getID()) == false)
739
+ {
740
+ SVGLookup._SVGLookupE.set(svgInfo.getID(),svgInfo);
741
+ }
742
+ }
743
+ }
744
+ catch(e)
745
+ {
746
+ ErrorLogger.LogException("SVGLookup","addCUstomSymbol",e);
747
+ }
748
+ return success;
749
+ }
750
+
751
+ }
752
+
753
+