@armyc2.c5isr.renderer/mil-sym-ts-web 2.2.0 → 2.2.1

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 (168) hide show
  1. package/{dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz → armyc2.c5isr.renderer-mil-sym-ts-web-2.2.1.tgz} +0 -0
  2. package/package.json +15 -39
  3. package/buildNode.bat +0 -2
  4. package/buildWeb.bat +0 -2
  5. package/dist/LICENSE +0 -201
  6. package/dist/README.md +0 -57
  7. package/dist/package.json +0 -16
  8. package/index.ts +0 -169
  9. package/package.bak +0 -50
  10. package/package.node.json +0 -43
  11. package/package.pack.json +0 -19
  12. package/package.packWeb.json +0 -16
  13. package/package.web.json +0 -40
  14. package/src/main/ts/android/graphics/Bitmap.ts +0 -7
  15. package/src/main/ts/android/graphics/Paint.ts +0 -26
  16. package/src/main/ts/android/graphics/Path.ts +0 -78
  17. package/src/main/ts/android/graphics/PointF.ts +0 -14
  18. package/src/main/ts/android/graphics/Rect.ts +0 -18
  19. package/src/main/ts/android/graphics/RectF.ts +0 -50
  20. package/src/main/ts/android/graphics/Region.ts +0 -36
  21. package/src/main/ts/android/graphics/Typeface.ts +0 -11
  22. package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +0 -99
  23. package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +0 -34
  24. package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +0 -193
  25. package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +0 -2971
  26. package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +0 -4008
  27. package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +0 -93
  28. package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +0 -89
  29. package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +0 -515
  30. package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +0 -5403
  31. package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +0 -1084
  32. package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +0 -2173
  33. package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +0 -4934
  34. package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +0 -7
  35. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +0 -5601
  36. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +0 -14
  37. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +0 -648
  38. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +0 -647
  39. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +0 -2994
  40. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +0 -2663
  41. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +0 -669
  42. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +0 -971
  43. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +0 -871
  44. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +0 -3507
  45. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +0 -500
  46. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +0 -1089
  47. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +0 -2656
  48. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +0 -1419
  49. package/src/main/ts/armyc2/c5isr/data/genc.json +0 -1407
  50. package/src/main/ts/armyc2/c5isr/data/msd.json +0 -17311
  51. package/src/main/ts/armyc2/c5isr/data/mse.json +0 -18500
  52. package/src/main/ts/armyc2/c5isr/data/svgd.json +0 -31214
  53. package/src/main/ts/armyc2/c5isr/data/svge.json +0 -30558
  54. package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +0 -10
  55. package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +0 -437
  56. package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +0 -429
  57. package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +0 -7
  58. package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +0 -35
  59. package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +0 -111
  60. package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +0 -29
  61. package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +0 -18
  62. package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +0 -211
  63. package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +0 -80
  64. package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +0 -33
  65. package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +0 -16
  66. package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +0 -726
  67. package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +0 -141
  68. package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +0 -112
  69. package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +0 -261
  70. package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +0 -391
  71. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +0 -567
  72. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +0 -445
  73. package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +0 -31
  74. package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +0 -18
  75. package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +0 -45
  76. package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +0 -25
  77. package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +0 -15
  78. package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +0 -22
  79. package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +0 -269
  80. package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +0 -9882
  81. package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +0 -146
  82. package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +0 -1265
  83. package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +0 -64
  84. package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +0 -95
  85. package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +0 -93
  86. package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +0 -114
  87. package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +0 -555
  88. package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +0 -62
  89. package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +0 -120
  90. package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +0 -431
  91. package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +0 -99
  92. package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +0 -25
  93. package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +0 -203
  94. package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +0 -104
  95. package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +0 -481
  96. package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +0 -40
  97. package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +0 -1323
  98. package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +0 -51
  99. package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +0 -736
  100. package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +0 -106
  101. package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +0 -84
  102. package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +0 -87
  103. package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +0 -34
  104. package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +0 -324
  105. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +0 -127
  106. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +0 -18
  107. package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +0 -111
  108. package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +0 -219
  109. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +0 -1008
  110. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +0 -882
  111. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +0 -380
  112. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +0 -797
  113. package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +0 -1699
  114. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +0 -178
  115. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +0 -45
  116. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +0 -126
  117. package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +0 -118
  118. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +0 -11
  119. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +0 -1201
  120. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +0 -591
  121. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +0 -29
  122. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +0 -753
  123. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +0 -137
  124. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +0 -438
  125. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +0 -19
  126. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +0 -10
  127. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +0 -5
  128. package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +0 -404
  129. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +0 -525
  130. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +0 -55
  131. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +0 -36
  132. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +0 -1055
  133. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +0 -2085
  134. package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +0 -157
  135. package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +0 -86
  136. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +0 -3798
  137. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +0 -412
  138. package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +0 -124
  139. package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +0 -26
  140. package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +0 -677
  141. package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +0 -484
  142. package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +0 -62
  143. package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +0 -46
  144. package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +0 -51
  145. package/src/main/ts/org/gavaghan/geodesy/Angle.ts +0 -31
  146. package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +0 -71
  147. package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +0 -200
  148. package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +0 -55
  149. package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +0 -68
  150. package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +0 -103
  151. package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +0 -90
  152. package/test/ExportSPImages.js +0 -692
  153. package/test/MPWW.html +0 -556
  154. package/test/MPWorker.js +0 -318
  155. package/test/SPWorker.js +0 -233
  156. package/test/SVGWW.html +0 -363
  157. package/test/singlePointTester3.html +0 -751
  158. package/tsconfig.json +0 -54
  159. package/typedoc.json +0 -30
  160. package/updateVersion.js +0 -21
  161. package/webpack.config.js +0 -34
  162. package/webpackn.config.js +0 -28
  163. package/webpackr.config.js +0 -47
  164. package/webpackw.config.js +0 -23
  165. /package/{dist/C5Ren.d.ts → C5Ren.d.ts} +0 -0
  166. /package/{dist/C5Ren.js → C5Ren.js} +0 -0
  167. /package/{dist/C5Ren.js.map → C5Ren.js.map} +0 -0
  168. /package/{dist/manifest.json → manifest.json} +0 -0
package/test/MPWorker.js DELETED
@@ -1,318 +0,0 @@
1
- //https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
2
- //THIS IS AN EXAMPLE. You can implement the web worker however you like.
3
- //The ErrorLogger class will no longer log to the console as it doesn't' exist in a web worker. ErrorLogger.LogException() will just throw the exception passed into it.
4
- //You can optionally replace the ErrorLogger class (like in the commented sample below to behave differently)
5
-
6
- /* expected input format for batch
7
- var e.data = {};
8
- e.data.altMode = "absolute";//for 3D
9
- e.data.scale = scale4;//for 3D like 50000.0; a number corresponding to how many meters one meter of our map represents. A value "50000" would mean 1:50K which means for every meter of our map it represents 50000 meters of real world distance.
10
- e.data.bbox = bbox4;//like "66.25,30.60,66.28,30.65";"lowerLeftX,lowerLeftY,upperRightX,upperRightY."
11
- e.data.format = format;//0 for KML, 2 for GeoJSON, 6 for GeoSVG
12
- e.data.pHeight = pixelHeight;//for 2D
13
- e.data.pWidth = pixelWidth;//for 2D
14
- e.data.fontInfo = {name:"Arial",weight:"bold",size:15} OPTIONAL
15
- e.data.batch = [{id:"ID",name:"name",description:"description",symbolID:"110325000014170000000000000000",points:controlPoints,symStd:symStd,modifiers:{ModifiersTG.T_UNIQUE_DESIGNATION_1:"T"},attributes:{MilStdAttributes.LineColor:"#00FF00"}}];
16
-
17
- */
18
-
19
- /* return objects for batch
20
- {
21
- //GeoJSON
22
- [{id:batch.id,symbolID:symbolID,geojson:"geojson string"]
23
- Error message in item.geojson looks like:
24
- {"type":"error","error":"There was an error creating the MilStdSymbol 110325000014170000000000000000 - ID: ID - Basic ID: 25141700 requires a minimum of 3 points. 2 are present."}
25
- }
26
- */
27
-
28
-
29
-
30
- //importScripts('dist/C5RenDebug.js');
31
- importScripts('../dist/C5Ren.js');
32
-
33
- let path = "/dist/";
34
- //let path = self.location;
35
-
36
- //C5Ren.initialize(path);//self.location
37
-
38
- /*
39
- //ErrorLogger can't output to console in a webworker so change behavior here if you like//////////////////////
40
- C5Ren.ErrorLogger = {};
41
- C5Ren.ErrorLogger.LogMessage = function(sourceClass, sourceMethod, message){throw {message:(sourceClass + "-" + sourceMethod + ": " + message)}};
42
- C5Ren.ErrorLogger.LogWarning = function(sourceClass, sourceMethod, message, level){throw {message:(sourceClass + "-" + sourceMethod + ": " + message)}};
43
- C5Ren.ErrorLogger.LogException = function(sourceClass, sourceMethod, err, level)
44
- {
45
- var strMessage = (sourceClass + "." + sourceMethod + "(): " + err.message);
46
- var myStack = "";
47
- if(err.stack !== undefined)
48
- {
49
- myStack = err.stack;
50
- }
51
-
52
- if(!(myStack))
53
- {
54
- if(err.filename && err.lineno)
55
- {
56
- myStack = err.filename + " @ line# " + err.lineno;
57
- }
58
- }
59
- strMessage += "\n" + myStack;
60
- err.message += "\n" + myStack;
61
- throw strMessage;
62
- //throw {message:strMessage,error:err, stack:myStack};
63
- };
64
-
65
-
66
- var window = {};
67
- var console = {};
68
- console.log = console.log || function(){};
69
- console.info = console.info || function(){};
70
- console.warn = console.warn || function(){};
71
- console.error = console.error || function(){};
72
- window.console = console;
73
-
74
- var document = {};//*/
75
-
76
- ///////////////////////////////////////////////////////////////////////////////
77
-
78
- convertToMap = function(obj)
79
- {
80
- var map = new Map();
81
- if(obj != null)
82
- {
83
- for (const [key, value] of Object.entries(obj))
84
- {
85
- //console.log(`${key}: ${value}`);
86
- map.set(key, value);
87
- }
88
- }
89
- return map;
90
- }
91
-
92
- parseMetaData = function(svg)
93
- {
94
- var width = 0;
95
- var height = 0;
96
- var symbolID = "";
97
- var geoTL = 0;
98
- var geoBR = 0;
99
- var geoTR = 0;
100
- var geoBL = 0;
101
- var north = 0;
102
- var south = 0;
103
- var east = 0;
104
- var west = 0;
105
- var wasClipped = false;
106
- var strPoint = "";
107
- var arrPoint = null;
108
- var b64;
109
-
110
- var start = 0;
111
- var end = 0;
112
- if(svg != null && typeof svg == "string")
113
- {
114
- start = svg.indexOf("width=\"") + 7;
115
- end = svg.indexOf("px",start);
116
- width = parseInt(svg.substring(start,end));
117
-
118
- start = svg.indexOf("height=\"",end) + 8;
119
- end = svg.indexOf("px",start);
120
- height = parseInt(svg.substring(start,end));
121
-
122
- start = svg.indexOf("<symbolID>",end) + 10;
123
- end = svg.indexOf("</symbolID>",start);
124
- symbolID = svg.substring(start,end);
125
-
126
- start = svg.indexOf("<geoTL>",end) + 7;
127
- end = svg.indexOf("</geoTL>",start);
128
- strPoint = (svg.substring(start,end));
129
- arrPoint = strPoint.split(" ");
130
- geoTL = new C5Ren.Point2D(arrPoint[0],arrPoint[1]);
131
-
132
- start = svg.indexOf("<geoBR>",end) + 7;
133
- end = svg.indexOf("</geoBR>",start);
134
- strPoint = (svg.substring(start,end));
135
- arrPoint = strPoint.split(" ");
136
- geoBR = new C5Ren.Point2D(arrPoint[0],arrPoint[1]);
137
-
138
- start = svg.indexOf("<geoTR>",end) + 7;
139
- end = svg.indexOf("</geoTR>",start);
140
- strPoint = (svg.substring(start,end));
141
- arrPoint = strPoint.split(" ");
142
- geoTR = new C5Ren.Point2D(arrPoint[0],arrPoint[1]);
143
-
144
- start = svg.indexOf("<geoBL>",end) + 7;
145
- end = svg.indexOf("</geoBL>",start);
146
- strPoint = (svg.substring(start,end));
147
- arrPoint = strPoint.split(" ");
148
- geoBL = new C5Ren.Point2D(arrPoint[0],arrPoint[1]);
149
-
150
- start = svg.indexOf("<north>",end) + 7;
151
- end = svg.indexOf("</north>",start);
152
- north = parseFloat(svg.substring(start,end));
153
-
154
- start = svg.indexOf("<south>",end) + 7;
155
- end = svg.indexOf("</south>",start);
156
- south = parseFloat(svg.substring(start,end));
157
-
158
- start = svg.indexOf("<east>",end) + 6;
159
- end = svg.indexOf("</east>",start);
160
- east = parseFloat(svg.substring(start,end));
161
-
162
- start = svg.indexOf("<west>",end) + 6;
163
- end = svg.indexOf("</west>",start);
164
- west = parseFloat(svg.substring(start,end));
165
-
166
- start = svg.indexOf("<wasClipped>",end) + 12;
167
- end = svg.indexOf("</wasClipped>",start);
168
- if(svg.substring(start,end).length==4)
169
- wasClipped = true;
170
- else
171
- wasClipped = false;
172
-
173
- b64 = "data:image/svg+xml;base64," + btoa(svg);
174
- }
175
- return {svg:svg, symbolID,symbolID, height:height, width:width, geoTL:geoTL,geoBR:geoBR,geoTR:geoTR,geoBL:geoBL,north:north,south:south,east:east,west:west,wasClipped,wasClipped,b64:b64};
176
- }
177
-
178
-
179
- onmessage = function(e)
180
- {
181
- var si = null;
182
- var batch = null;
183
- var msir = C5Ren.MilStdIconRenderer.getInstance();
184
- var RS = C5Ren.RendererSettings.getInstance();
185
- var output = null;
186
- var converter = null;
187
- var fontInfo = null;
188
- var oldFont = null;
189
- var format = ["kml","json","geojson"];
190
-
191
- if(e.data.fontInfo)
192
- {
193
- fontInfo = e.data.fontInfo;
194
- oldFont = RS.getMPLabelFont();
195
- RS.setMPLabelFont(fontInfo.name, fontInfo.style, fontInfo.size);
196
- }
197
-
198
-
199
-
200
- if(e.data && e.data.batch && e.data.batch.length > 0)
201
- {
202
- var result = null;
203
- var len = e.data.batch.length;
204
- var items = e.data.batch;
205
- var temp = null;
206
- var mod;
207
- var att;
208
- //output = new Array(len);
209
- output = [];
210
- try
211
- {
212
- for(var i = 0; i < len; i++)
213
- {
214
- item = items[i];
215
-
216
- if(item.modifiers instanceof Map)
217
- mod = item.modifiers;
218
- else
219
- mod = convertToMap(item.modifiers);
220
- if(item.attributes instanceof Map)
221
- att = item.attributes;
222
- else
223
- att = convertToMap(item.attributes);
224
-
225
-
226
- if(e.data.altMode)
227
- {
228
- if(e.data.converter)
229
- converter = e.data.converter;
230
- //data for symbol on 3d map so call RenderSymbol
231
- result = C5Ren.WebRenderer.RenderSymbol(item.id,item.name,item.description, item.symbolID, item.points, e.data.altMode,e.data.scale, e.data.bbox, mod, att, e.data.format);
232
- }
233
- else
234
- {
235
- //data for symbol on 2D map so call RenderSymbol2D
236
- result = C5Ren.WebRenderer.RenderSymbol2D(item.id,item.name,item.description, item.symbolID, item.points, e.data.pixelWidth,e.data.pixelHeight, e.data.bbox, mod, att, e.data.format);
237
- }
238
- if(result)
239
- {
240
- if(e.data.format === C5Ren.WebRenderer.OUTPUT_FORMAT_GEOSVG)
241
- {
242
- //result.id = item.id;
243
- //result.symbolID = item.symbolID;
244
- //output[i] = result;
245
- result = parseMetaData(result);
246
- result.id = item.id;
247
- output.push(result);
248
- }
249
- else//KML or GeoJSON return string
250
- {
251
- temp = {id:item.id, symbolID:item.symbolID}
252
- temp[format[e.data.format]] = result;
253
- output.push(temp);
254
- }
255
- }
256
- }
257
- }
258
- catch(err)
259
- {
260
- throw(err);
261
- }
262
- //[{id:batch.id,symbolID:symbolID,svg:dataURI,geoTL:geoCoordTL, geoBR:geoCoordBR, wasClipped:wasClipped}]
263
- }
264
- else if(e.data)
265
- {
266
- if(item.modifiers instanceof Map)
267
- mod = item.modifiers;
268
- else
269
- mod = convertToMap(item.modifiers);
270
- if(item.attributes instanceof Map)
271
- att = item.attributes;
272
- else
273
- att = convertToMap(item.attributes);
274
-
275
- if(e.data.altMode)
276
- {
277
- if(e.data.converter)
278
- converter = e.data.converter;
279
- //data for symbol on 3d map so call RenderSymbol
280
- output = C5Ren.WebRenderer.RenderSymbol(e.data.id,e.data.name,e.data.description, e.data.symbolID, e.data.points, e.data.altMode,e.data.scale, e.data.bbox, mod, att, e.data.format);
281
- }
282
- else
283
- {
284
- //data for symbol on 2D map so call RenderSymbol2D
285
- output = C5Ren.WebRenderer.RenderSymbol2D(e.data.id,e.data.name,e.data.description, e.data.symbolID, e.data.points, e.data.pixelWidth,e.data.pixelHeight, e.data.bbox, mod, att, e.data.format);
286
- }
287
- }
288
-
289
- if(fontInfo)
290
- {
291
- RS.setMPLabelFont(oldFont.getName(), oldFont.getType(), oldFont.getSize());//name, size, style, scale
292
- }
293
-
294
- if(e.data.batch)
295
- {
296
- postMessage({result:output,format:e.data.format});
297
- }
298
- else
299
- {
300
- if(output && output.substring)//kml or geojson
301
- {
302
- //return results
303
- var format = e.data.format;
304
- if(output.substring(0,15) === '{"type":"error"')
305
- {
306
- format = "ERROR";
307
- }
308
- postMessage({id:e.data.id,result:output,format:format});
309
-
310
- }
311
- else if(output)//SVG
312
- {
313
- postMessage({id:e.data.id,result:output,format:format});
314
- }
315
- }
316
-
317
- }
318
-
package/test/SPWorker.js DELETED
@@ -1,233 +0,0 @@
1
- //https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
2
- //THIS IS AN EXAMPLE. You can implement the web worker however you like.
3
- //The ErrorLogger class will no longer log to the console as it doesn't' exist in a web worker. ErrorLogger.LogException() will just throw the exception passed into it.
4
- //You can optionally replace the ErrorLogger class (like in the commented sample below to behave differently)
5
-
6
- /* expected input format for non-batch
7
- var batch = [];//batch objects look like {id:"ID",symbolID:"SFGPU----------",modifiers:{Modifiers.T_UNIQUE_DESIGNATION_1:"T",MilStdAttributes.PixelSize:"50"}};
8
- var e.data = {base64:true, batch:batch};
9
- e.data.batch[].id = "ID";
10
- e.data.batch[].symbolID = "SFGPU----------";//A 15 character symbolID corresponding to one of the graphics in the MIL-STD-2525C
11
- e.data.batch[].modifiers = Map<string,string> {ModifiersUnits.T_UNIQUE_DESIGNATION_1:"T"};
12
- e.data.batch[].attributes = Map<string,string> {MilStdAttributes.PixelSize:50};
13
- e.data.format = "svg", "base64", "both"
14
- if(format === "svg"), return object will have a .svg property with the svg string
15
- if(format === "base64"), return object will have a .base64 property with the svg string like:
16
- "data:image/svg+xml;base64,[SVG string after run through btoa()]
17
- if(format === "both"), return object will have both properties.
18
- */
19
-
20
- /* return object for non-batch
21
- {
22
- id:e.data.id,//same as what was passed in
23
- symbolID:e.data.SymbolID,//resultant kml,json or error message
24
- svg:svg string
25
- anchorPoint:
26
- symbolBounds:
27
- imageBounds:
28
- base64:svg string like: "data:image/svg+xml;base64,[SVG string after run through btoa()]".
29
- }
30
- */
31
-
32
- /* expected input format for batch
33
- var e.data = {};
34
- e.data.batch = {fontInfo:fontInfo,batch:[{id:"ID",symbolID:"SFGPU----------",modifiers:{ModifiersUnits.T_UNIQUE_DESIGNATION_1:"T"},attributes:{MilStdAttributes.PixelSize:50}}]}
35
- */
36
-
37
- /* return object for batch
38
- {
39
- [{id:batch.id,symbolID:batch.symbolID,svg:si.getSVG(),anchorPoint:si.getSymbolCenterPoint(),symbolBounds:si.getSymbolBounds(),bounds:si.getImageBounds()}]
40
- }
41
- */
42
-
43
-
44
-
45
- //importScripts('dist/C5RenDebug.js');
46
- importScripts('../dist/C5Ren.js');
47
-
48
- let path = "/dist/";
49
- //let path = self.location;
50
-
51
- //C5Ren.initialize(path);//self.location
52
- /*
53
- //ErrorLogger can't output to console in a webworker so change behavior here if you like//////////////////////
54
- C5Ren.ErrorLogger = {};
55
- C5Ren.ErrorLogger.LogMessage = function(sourceClass, sourceMethod, message){throw {message:(sourceClass + "-" + sourceMethod + ": " + message)}};
56
- C5Ren.ErrorLogger.LogWarning = function(sourceClass, sourceMethod, message, level){throw {message:(sourceClass + "-" + sourceMethod + ": " + message)}};
57
- C5Ren.ErrorLogger.LogException = function(sourceClass, sourceMethod, err, level)
58
- {
59
- var strMessage = (sourceClass + "." + sourceMethod + "(): " + err.message);
60
- var myStack = "";
61
- if(err.stack !== undefined)
62
- {
63
- myStack = err.stack;
64
- }
65
-
66
- if(!(myStack))
67
- {
68
- if(err.filename && err.lineno)
69
- {
70
- myStack = err.filename + " @ line# " + err.lineno;
71
- }
72
- }
73
- strMessage += "\n" + myStack;
74
- err.message += "\n" + myStack;
75
- throw strMessage;
76
- //throw {message:strMessage,error:err, stack:myStack};
77
- };
78
-
79
-
80
- var window = {};
81
- var console = {};
82
- console.log = console.log || function(){};
83
- console.info = console.info || function(){};
84
- console.warn = console.warn || function(){};
85
- console.error = console.error || function(){};
86
- window.console = console;
87
-
88
- var document = {};
89
- //*/
90
- ///////////////////////////////////////////////////////////////////////////
91
-
92
- convertToMap = function(obj)
93
- {
94
- var map = new Map();
95
- if(obj != null)
96
- {
97
- for (const [key, value] of Object.entries(obj))
98
- {
99
- //console.log(`${key}: ${value}`);
100
- map.set(key, value);
101
- }
102
- }
103
- return map;
104
- }
105
-
106
- onmessage = function(e)
107
- {
108
- var si = null;
109
- var batch = null;
110
- var msir = C5Ren.MilStdIconRenderer.getInstance();
111
-
112
- if(e.data !== null)
113
- {
114
- try
115
- {
116
- if(e.data.fontInfo)//set the font to be used with this batch of symbols, if not set will use last value
117
- {
118
- fontInfo = e.data.fontInfo;
119
- RS.setLabelFont(fontInfo.name, fontInfo.style, fontInfo.size);
120
- }
121
-
122
- var returnVal = null;
123
- if(e.data.batch && e.data.batch.length > 0)
124
- {
125
- var batch = e.data.batch;
126
- var returnBatch = [];
127
- var len = e.data.batch.length;
128
- var item = null;
129
-
130
- for(var i = 0; i < len; i++)
131
- {
132
- item = batch[i];
133
- var mod;
134
- var att;
135
-
136
- if(item.modifiers instanceof Map)
137
- mod = item.modifiers;
138
- else
139
- mod = convertToMap(item.modifiers);
140
- if(item.attributes instanceof Map)
141
- att = item.attributes;
142
- else
143
- att = convertToMap(item.attributes);
144
-
145
- if(msir.CanRender(item.symbolID, item.attributes))
146
- {
147
- si = msir.RenderSVG(item.symbolID,mod,att);
148
- if(si == null)
149
- throw(new Error("Failed to Render: " + item.symbolID));
150
- returnVal = {id:item.id,symbolID:item.symbolID,anchorPoint:si.getSymbolCenterPoint(),symbolBounds:si.getSymbolBounds(),bounds:si.getImageBounds()};
151
- if(e.data.format === "base64")
152
- returnVal.base64 = si.getSVGDataURI();
153
- else if(e.data.format === "both")
154
- {
155
- returnVal.base64 = si.getSVGDataURI();
156
- returnVal.svg = si.getSVG();
157
- }
158
- else
159
- returnVal.svg = si.getSVG();
160
-
161
- returnBatch.push(returnVal);
162
- }
163
- else
164
- {
165
- returnVal = {id:item.id,symbolID:item.symbolID,anchorPoint:null,symbolBounds:null,bounds:null,svg:null,base64:null};
166
- returnVal.error = "Can't render code: " + item.symbolID + ", ID: " + item.id;
167
-
168
- var msi = C5Ren.MSLookup.getInstance().getMSLInfo(item.symbolID);
169
- if(msi == null)
170
- returnVal.error += "/n code not found in the Lookup."
171
- else
172
- {
173
- if(msi.getDrawRule()==0)
174
- returnVal.error += "/n code is not a drawable symbol and likely just representative of a symbol category."
175
- }
176
- returnBatch.push(returnVal);
177
- }
178
- }
179
- if(si !== null)
180
- {
181
- postMessage(returnBatch);
182
- }
183
- else
184
- {
185
- postMessage({error:"no results"});
186
- }
187
- }
188
- else if(e.data.id && e.data.symbolID)
189
- {
190
- var mod = convertToMap(e.data.modifiers);
191
- var att = convertToMap(e.data.attributes);
192
- si = msir.RenderSVG(e.data.symbolID,mod,att);
193
-
194
- if(si !== null)
195
- {
196
- //return results
197
- returnVal = {id:e.data.id,symbolID:e.data.symbolID,svg:si.getSVG(),anchorPoint:si.getSymbolCenterPoint(),symbolBounds:si.getSymbolBounds(),bounds:si.getImageBounds()};
198
-
199
- if(e.data.format === "base64")
200
- returnVal.base64 = si.getSVGDataURI();
201
- else if(e.data.format === "both")
202
- {
203
- returnVal.base64 = si.getSVGDataURI();
204
- returnVal.svg = si.getSVG();
205
- }
206
- else
207
- returnVal.svg = si.getSVG();
208
-
209
- postMessage(returnVal);
210
- }
211
- else
212
- {
213
- postMessage({error:"no results"});
214
- }
215
- }
216
- else
217
- {
218
- JSON.stringify(e.data);
219
- postMessage({error:"no batch object or symbol information" + JSON.stringify(e.data)});
220
- }
221
-
222
-
223
- }
224
- catch(err)
225
- {
226
- C5Ren.ErrorLogger.LogException("SPWorker","onmessage",err);
227
- }
228
- }
229
-
230
-
231
-
232
- }
233
-