@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,736 @@
1
+ import { LogLevel } from "./LogLevel";
2
+
3
+
4
+ /**
5
+ * Error Logging class for Renderer
6
+ *
7
+ */
8
+ export class ErrorLogger {
9
+ // private static ErrorLogger _el;
10
+ public static readonly LoggerName: string = "ErrorLogger";
11
+ //private static Logger _Logger = null;//
12
+ //private static final Logger _Logger = Logger.getLogger(LoggerName);
13
+ private static _level: LogLevel = LogLevel.INFO;
14
+ //private static java.util.logging.FileHandler fh;
15
+ private static _LoggingEnabled: boolean = false;
16
+ //private static String _LoggingPath = System.getProperty("user.dir");
17
+ //date format: Nov 19, 2012 11:41:40 AM
18
+ private static dateFormatOptions: Intl.DateTimeFormatOptions = { year: "numeric", month: "short", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" }
19
+ /*
20
+ private ErrorLogger()
21
+ {
22
+ Init();
23
+ }
24
+
25
+
26
+ private static synchronized ErrorLogger getInstance()
27
+ {
28
+
29
+ //if(_Logger == null)
30
+ if(_el == null)
31
+ {
32
+ try
33
+ {
34
+ _el = new ErrorLogger();
35
+
36
+ }
37
+ catch(Exception exc)
38
+ {
39
+ System.err.println(exc.message);
40
+ //JOptionPane.showMessageDialog(null, ioe.message, "Message", JOptionPane.PLAIN_MESSAGE);
41
+ }
42
+ }
43
+
44
+ return _el;
45
+ }
46
+
47
+ private void Init()
48
+ {
49
+ try
50
+ {
51
+ if(_Logger != null)
52
+ _Logger.setLevel(Level.INFO);
53
+ }
54
+ catch(Exception exc)
55
+ {
56
+ System.err.println(exc.message);
57
+ //JOptionPane.showMessageDialog(null, ioe.message, "Message", JOptionPane.PLAIN_MESSAGE);
58
+ }
59
+ }//*/
60
+
61
+ /**
62
+ * True if logging is enabled
63
+ * @return {@link Boolean}
64
+ */
65
+ public static getLoggingStatus(): boolean {
66
+ return ErrorLogger._LoggingEnabled;
67
+ }
68
+
69
+ /**
70
+ * Takes a throwable and puts it's stacktrace into a string.
71
+ * @param error {@link Error}
72
+ * @return {@link String}
73
+ */
74
+ public static getStackTrace(error: Error): string {
75
+ try {
76
+ return error.stack;
77
+ } catch (exc) {
78
+ if (exc instanceof Error) {
79
+ ErrorLogger.LogException("ErrorLogger", "getStackTrace", exc);
80
+ return "Error - couldn't retrieve stack trace";
81
+ } else {
82
+ throw exc;
83
+ }
84
+ }
85
+ }
86
+
87
+ /**
88
+ * TRUE: Creates a file handler that will log message to a file.
89
+ * FALSE: logging just goes to console.
90
+ * @param enable {@link Boolean}
91
+ */
92
+ public static EnableLogging(enable: boolean): void {/*
93
+ //_LoggingEnabled = enable;
94
+ if(enable && _LoggingEnabled == false)
95
+ {
96
+ if(fh == null)
97
+ {
98
+ try
99
+ {
100
+ fh = new java.util.logging.FileHandler(getFileName(),true);
101
+ fh.setFormatter(new SimpleFormatter());//comment out and will default to XML
102
+ }
103
+ catch(IOException ioe)
104
+ {
105
+ //JOptionPane.showMessageDialog(null, ioe.message, "Message", JOptionPane.PLAIN_MESSAGE);
106
+ }
107
+
108
+ }
109
+ getInstance();
110
+ fh.setLevel(_Logger.getLevel());
111
+ _Logger.addHandler(fh);
112
+ }
113
+ else
114
+ {
115
+ if(_LoggingEnabled && fh != null)
116
+ {
117
+ _Logger.removeHandler(fh);
118
+ fh=null;
119
+ }
120
+ }//*/
121
+ ErrorLogger._LoggingEnabled = enable;
122
+ }
123
+
124
+ /**
125
+ * Folder location to store the log file.
126
+ * Defaults to "System.getProperty("user.dir")"
127
+ * @param path {@link String}
128
+ * @deprecated
129
+ */
130
+ public static setLoggingPath(path: string): void {/*
131
+ _LoggingPath = path;
132
+ File foo = new File(path);
133
+ if(foo.exists() && foo.isDirectory())
134
+ {
135
+ if(_LoggingEnabled)
136
+ { //toggle logging to reset the file path.
137
+ EnableLogging(false);
138
+ EnableLogging(true);
139
+ }
140
+ }
141
+ else
142
+ {
143
+ ErrorLogger.LogMessage("ErrorLogger","setLoggingPath",
144
+ "\"" + path + "\" doesn't exist, logging path not changed.",
145
+ Level.WARNING);
146
+ }//*/
147
+ }
148
+
149
+ /**
150
+ * clears log files that are beyond a passed number of days old
151
+ * @param DaysOld {@link Integer}
152
+ * @deprecated
153
+ */
154
+ public static CleanupOldFiles(DaysOld: number): void {/*
155
+
156
+ Calendar Cal = new GregorianCalendar();
157
+ Calendar CalLastModified = new GregorianCalendar();
158
+ Cal.add(Calendar.DAY_OF_MONTH, -DaysOld);//remove anything this many days old
159
+
160
+ String path = _LoggingPath;//System.getProperty("user.dir");
161
+ File lookup = new File(path);
162
+ File[] results = lookup.listFiles();
163
+ for(File foo : results)
164
+ {
165
+ if(foo.getName().startsWith("TBCRendererLog"))
166
+ {
167
+ long age = foo.lastModified();
168
+
169
+ CalLastModified.setTimeInMillis(age);
170
+ if(Cal.after(CalLastModified))
171
+ foo.delete();
172
+ }
173
+ }//*/
174
+ }
175
+
176
+ /**
177
+ * Set minimum level at which an item can be logged.
178
+ * In descending order:
179
+ * Severe
180
+ * Warning
181
+ * Info
182
+ * Config
183
+ * Fine
184
+ * Finer
185
+ * Finest
186
+ * @param newLevel {@link Level}
187
+ */
188
+ public static setLevel(newLevel: LogLevel): void;
189
+
190
+ /**
191
+ * Set minimum level at which an item can be logged.
192
+ * In descending order:
193
+ * Severe
194
+ * Warning
195
+ * Info
196
+ * Config
197
+ * Fine
198
+ * Finer
199
+ * Finest
200
+ * @param newLevel {@link Level}
201
+ * @param setConsoleHandler logger could be set to FINE but the console
202
+ * handler could be set to INFO. In that case, anything logged at FINE
203
+ * wouldn't show because it'd get blocked by the console handler. Set to
204
+ * "true" to make sure the console handler will let you log at the level
205
+ * you want. If you're only concerned with the log file, you can leave
206
+ * "false"
207
+ */
208
+ public static setLevel(newLevel: LogLevel, setConsoleHandler: boolean): void;
209
+ public static setLevel(...args: unknown[]): void {
210
+ switch (args.length) {
211
+ case 1: {
212
+ const [newLevel] = args as [LogLevel];
213
+
214
+
215
+ ErrorLogger.setLevel(newLevel, false);
216
+
217
+
218
+ break;
219
+ }
220
+
221
+ case 2: {
222
+ const [newLevel, setConsoleHandler] = args as [LogLevel, boolean];
223
+
224
+
225
+ ErrorLogger._level = newLevel;
226
+
227
+ /*
228
+ _Logger.setLevel(newLevel);//set logger.
229
+
230
+ if(fh != null)//handler that logs to file
231
+ fh.setLevel(newLevel);
232
+
233
+ //have to set top logger/consle handler or messages will still
234
+ //get blocked.
235
+
236
+ //get the top logger
237
+ if(setConsoleHandler)
238
+ {
239
+ Logger topLogger = java.util.logging.Logger.getLogger("");
240
+ //Handler for console (resuse if it already exists)
241
+ Handler consoleHandler = null;
242
+ //see if there already is a console handler
243
+ for (Handler handler : topLogger.getHandlers())
244
+ {
245
+ if(handler instanceof ConsoleHandler)
246
+ {
247
+ //found the console handler
248
+ consoleHandler = handler;
249
+ break;
250
+ }
251
+ }
252
+
253
+ if(consoleHandler == null)
254
+ {
255
+ //there was no console handler found, create a new one
256
+ consoleHandler = new ConsoleHandler();
257
+ topLogger.addHandler(consoleHandler);
258
+ }
259
+ //set console handler to new level
260
+ consoleHandler.setLevel(newLevel);
261
+ }//*/
262
+
263
+
264
+ break;
265
+ }
266
+
267
+ default: {
268
+ throw Error(`Invalid number of arguments`);
269
+ }
270
+ }
271
+ }
272
+
273
+
274
+ /**
275
+ * Specify whether or not this logger should send its output
276
+ * to it's parent Logger. This means that any LogRecords will
277
+ * also be written to the parent's Handlers, and potentially
278
+ * to its parent, recursively up the namespace.
279
+ * Defaults to true;
280
+ *
281
+ * @param useParentHandlers true if output is to be sent to the
282
+ * logger's parent.
283
+ */
284
+ public static setUseParentHandlers(useParentHandlers: boolean): void {
285
+ //_Logger.setUseParentHandlers(useParentHandlers);
286
+ }
287
+
288
+ /**
289
+ * Gets the java.util.logging.Level that the logger is set to.
290
+ * @return {@link Level}
291
+ */
292
+ public static getLevel(): LogLevel {
293
+ return ErrorLogger._level;
294
+ //return _Logger.getLevel();
295
+ }
296
+
297
+ /**
298
+ *
299
+ * @return {@link String}
300
+ * @deprecated
301
+ */
302
+ private static getFileName(): string {
303
+ //String path = _LoggingPath;//System.getProperty("user.dir");
304
+ let fileName: string = "";
305
+ /*
306
+ SimpleDateFormat dateFormat = new SimpleDateFormat("_MMMdd");
307
+ fileName = "TBCRendererLog" + dateFormat.format(new Date()) + ".txt";
308
+ fileName = path + "\\" + fileName;
309
+ //fileName = path.substring(0, 2) + "\\" + fileName;//*/
310
+ return fileName;
311
+ }
312
+
313
+ /**
314
+ * Log a method entry.
315
+ * <p>
316
+ * This is a convenience method that can be used to log entry
317
+ * to a method. A LogRecord with message "ENTRY", log level
318
+ * FINER, and the given sourceMethod and sourceClass is logged.
319
+ * <p>
320
+ * @param sourceClass name of class that issued the logging request
321
+ * @param sourceMethod name of method that is being entered
322
+ */
323
+ public static Entering(sourceClass: string, sourceMethod: string): void;
324
+
325
+ /**
326
+ * Log a method entry, with one parameter.
327
+ * <p>
328
+ * This is a convenience method that can be used to log entry
329
+ * to a method. A LogRecord with message "ENTRY {0}", log level
330
+ * FINER, and the given sourceMethod, sourceClass, and parameter
331
+ * is logged.
332
+ * <p>
333
+ * @param sourceClass name of class that issued the logging request
334
+ * @param sourceMethod name of method that is being entered
335
+ * @param param1 parameter to the method being entered
336
+ */
337
+ public static Entering(sourceClass: string, sourceMethod: string, param1: any): void;
338
+
339
+ /**
340
+ * Log a method entry, with an array of parameters.
341
+ * <p>
342
+ * This is a convenience method that can be used to log entry
343
+ * to a method. A LogRecord with message "ENTRY" (followed by a
344
+ * format {N} indicator for each entry in the parameter array),
345
+ * log level FINER, and the given sourceMethod, sourceClass, and
346
+ * parameters is logged.
347
+ * <p>
348
+ * @param sourceClass name of class that issued the logging request
349
+ * @param sourceMethod name of method that is being entered
350
+ * @param params array of parameters to the method being entered
351
+ */
352
+ public static Entering(sourceClass: string, sourceMethod: string, params: any[]): void;
353
+ public static Entering(...args: unknown[]): void
354
+ {
355
+ if(console)
356
+ {
357
+ switch (args.length) {
358
+ case 2: {
359
+ const [sourceClass, sourceMethod] = args as [string, string];
360
+
361
+
362
+ //_Logger.entering(sourceClass, sourceMethod);
363
+ if (ErrorLogger._level.intValue() <= LogLevel.FINER.intValue()) {
364
+ console.log("Entering: " + sourceClass + "." + sourceMethod);
365
+ }
366
+
367
+
368
+ break;
369
+ }
370
+
371
+ case 3: {
372
+ if (args[2] instanceof Array) {
373
+ const [sourceClass, sourceMethod, params] = args as [string, string, any[]];
374
+
375
+ //_Logger.entering(sourceClass, sourceMethod,params);
376
+ if (ErrorLogger._level.intValue() <= LogLevel.FINER.intValue()) {
377
+ console.log("Entering: " + sourceClass + "." + sourceMethod + "with params:");
378
+ if (params != null) {
379
+ for (let param of params) {
380
+ console.log(param.toString());
381
+ }
382
+ }
383
+ }
384
+ } else {
385
+ const [sourceClass, sourceMethod, param1] = args as [string, string, any];
386
+
387
+ //_Logger.entering(sourceClass, sourceMethod,param1);
388
+ if (ErrorLogger._level.intValue() <= LogLevel.FINER.intValue()) {
389
+ console.log("Entering: " + sourceClass + "." + sourceMethod +
390
+ " - " + param1.toString());
391
+ }
392
+ }
393
+ break;
394
+ }
395
+
396
+ default: {
397
+ throw Error(`Invalid number of arguments`);
398
+ }
399
+ }
400
+ }
401
+ }
402
+
403
+
404
+ /**
405
+ * Log a method return.
406
+ * <p>
407
+ * This is a convenience method that can be used to log returning
408
+ * from a method. A LogRecord with message "RETURN", log level
409
+ * FINER, and the given sourceMethod and sourceClass is logged.
410
+ * <p>
411
+ * @param sourceClass name of class that issued the logging request
412
+ * @param sourceMethod name of the method
413
+ */
414
+ public static Exiting(sourceClass: string, sourceMethod: string): void;
415
+
416
+ /**
417
+ * Log a method return, with result object.
418
+ * <p>
419
+ * This is a convenience method that can be used to log returning
420
+ * from a method. A LogRecord with message "RETURN {0}", log level
421
+ * FINER, and the gives sourceMethod, sourceClass, and result
422
+ * object is logged.
423
+ * <p>
424
+ * @param sourceClass name of class that issued the logging request
425
+ * @param sourceMethod name of the method
426
+ * @param result Object that is being returned
427
+ */
428
+ public static Exiting(sourceClass: string, sourceMethod: string, result: any): void;
429
+ public static Exiting(...args: unknown[]): void
430
+ {
431
+ if(console)
432
+ {
433
+ switch (args.length) {
434
+ case 2: {
435
+ const [sourceClass, sourceMethod] = args as [string, string];
436
+
437
+
438
+ //_Logger.exiting(sourceClass, sourceMethod);
439
+ if (ErrorLogger._level.intValue() <= LogLevel.FINER.intValue()) {
440
+ console.log("Exiting: " + sourceClass + "." + sourceMethod);
441
+ }
442
+
443
+
444
+ break;
445
+ }
446
+
447
+ case 3: {
448
+ const [sourceClass, sourceMethod, result] = args as [string, string, any];
449
+
450
+
451
+ //_Logger.exiting(sourceClass, sourceMethod, result);
452
+ if (ErrorLogger._level.intValue() <= LogLevel.FINER.intValue()) {
453
+ console.log("Entering: " + sourceClass + "." + sourceMethod +
454
+ " - " + result.toString());
455
+ }
456
+
457
+
458
+ break;
459
+ }
460
+
461
+ default: {
462
+ throw Error(`Invalid number of arguments`);
463
+ }
464
+ }
465
+ }
466
+ }
467
+
468
+
469
+
470
+ /**
471
+ * Defaults to Level.INFO
472
+ * @param message {@link String}
473
+ */
474
+ public static LogMessage(message: string): void;
475
+
476
+ /**
477
+ * Defaults to Level.INFO
478
+ * @param message {@link String}
479
+ * @param showMessageBox (@link {@link Boolean}
480
+ */
481
+ public static LogMessage(message: string, showMessageBox: boolean): void;
482
+
483
+ /**
484
+ *
485
+ * @param message {@link String}
486
+ * @param lvl {@link Level}
487
+ * @param showMessageBox {@link Boolean}
488
+ */
489
+ public static LogMessage(message: string, lvl: LogLevel, showMessageBox: boolean): void;
490
+
491
+ public static LogMessage(sourceClass: string, sourceMethod: string, message: string): void;
492
+
493
+ public static LogMessage(sourceClass: string, sourceMethod: string, message: string, showMessageBox: boolean): void;
494
+
495
+ public static LogMessage(sourceClass: string, sourceMethod: string, message: string, lvl: LogLevel): void;
496
+
497
+ public static LogMessage(sourceClass: string, sourceMethod: string, message: string, lvl: LogLevel, showMessageBox: boolean): void;
498
+
499
+ public static LogMessage(sourceClass: string, sourceMethod: string, message: string, lvl: LogLevel, param1: any, showMessageBox: boolean): void;
500
+
501
+ public static LogMessage(sourceClass: string, sourceMethod: string, message: string, lvl: LogLevel, params: any[], showMessageBox: boolean): void;
502
+ public static LogMessage(...args: unknown[]): void
503
+ {
504
+ if(console)
505
+ {
506
+ switch (args.length) {
507
+ case 1: {
508
+ const [message] = args as [string];
509
+
510
+ ErrorLogger.LogMessage(message, LogLevel.INFO, false);
511
+
512
+ break;
513
+ }
514
+
515
+ case 2: {
516
+ const [message, showMessageBox] = args as [string, boolean];
517
+
518
+ ErrorLogger.LogMessage(message, LogLevel.INFO, showMessageBox);
519
+
520
+ break;
521
+ }
522
+
523
+ case 3: {
524
+ if (args[2] instanceof Boolean) {
525
+ const [message, lvl, showMessageBox] = args as [string, LogLevel, boolean];
526
+
527
+
528
+ if (lvl.intValue() >= ErrorLogger._level.intValue()) {
529
+ console.log(new Date().toLocaleString('en-US', this.dateFormatOptions) + ErrorLogger.LoggerName);
530
+ console.log("INFO: " + message);
531
+ }
532
+ /*_Logger.log(lvl, message);
533
+ if(showMessageBox==true &&
534
+ lvl.intValue() >= _Logger.getLevel().intValue() &&
535
+ lvl.intValue() < Integer.MAX_VALUE)
536
+ {
537
+ JOptionPane.showMessageDialog(null, message, "Message", JOptionPane.PLAIN_MESSAGE);
538
+ }//*/
539
+ } else {
540
+
541
+ const [sourceClass, sourceMethod, message] = args as [string, string, string];
542
+
543
+
544
+ ErrorLogger.LogMessage(sourceClass, sourceMethod, message, LogLevel.INFO, false);
545
+ }
546
+ break;
547
+ }
548
+
549
+ case 4: {
550
+ if (args[3] instanceof Boolean) {
551
+
552
+ const [sourceClass, sourceMethod, message, showMessageBox] = args as [string, string, string, boolean];
553
+
554
+
555
+ ErrorLogger.LogMessage(sourceClass, sourceMethod, message, LogLevel.INFO, showMessageBox);
556
+
557
+ } else {
558
+
559
+ const [sourceClass, sourceMethod, message, lvl] = args as [string, string, string, LogLevel];
560
+
561
+
562
+ ErrorLogger.LogMessage(sourceClass, sourceMethod, message, lvl, false);
563
+
564
+ }
565
+ break;
566
+ }
567
+
568
+ case 5: {
569
+ const [sourceClass, sourceMethod, message, lvl, showMessageBox] = args as [string, string, string, LogLevel, boolean];
570
+
571
+
572
+ if (lvl.intValue() >= ErrorLogger._level.intValue()) {
573
+ console.log(new Date().toLocaleString('en-US', this.dateFormatOptions) + sourceClass + "." + sourceMethod);
574
+ console.log(lvl.toString() + ": " + message);
575
+ }
576
+ /*
577
+ _Logger.logp(lvl, sourceClass, sourceMethod, message);
578
+ if(showMessageBox==true &&
579
+ lvl.intValue() >= _Logger.getLevel().intValue() &&
580
+ lvl.intValue() < Integer.MAX_VALUE)
581
+ {
582
+ //JOptionPane.showMessageDialog(null, message, "Message", JOptionPane.PLAIN_MESSAGE);
583
+ }//*/
584
+
585
+
586
+ break;
587
+ }
588
+
589
+ case 6: {
590
+ if (args[4] instanceof Array) {
591
+ const [sourceClass, sourceMethod, message, lvl, params, showMessageBox] = args as [string, string, string, LogLevel, any[], boolean];
592
+
593
+
594
+ if (lvl.intValue() >= ErrorLogger._level.intValue()) {
595
+ console.log(new Date().toLocaleString('en-US', this.dateFormatOptions) + sourceClass + "." + sourceMethod);
596
+ console.log(lvl.toString() + ": " + message);
597
+ for (let param of params) {
598
+ console.log(param.toString());
599
+ }
600
+ }
601
+ /*
602
+ _Logger.logp(lvl, sourceClass, sourceMethod, message, params);
603
+ if(showMessageBox==true &&
604
+ lvl.intValue() >= _Logger.getLevel().intValue() &&
605
+ lvl.intValue() < Integer.MAX_VALUE)
606
+ {
607
+ //JOptionPane.showMessageDialog(null, message, "Message", JOptionPane.PLAIN_MESSAGE);
608
+ }//*/
609
+ } else {
610
+ const [sourceClass, sourceMethod, message, lvl, param1, showMessageBox] = args as [string, string, string, LogLevel, any, boolean];
611
+
612
+ let params: any[] = new Array<any>(1);
613
+ params[0] = param1;
614
+ ErrorLogger.LogMessage(sourceClass, sourceMethod, message, lvl, params, showMessageBox);
615
+ }
616
+
617
+ break;
618
+ }
619
+
620
+ default: {
621
+ throw Error(`Invalid number of arguments`);
622
+ }
623
+ }
624
+ }
625
+ }
626
+
627
+
628
+ public static LogException(sourceClass: string, sourceMethod: string, exc: Error): void;
629
+
630
+ public static LogException(sourceClass: string, sourceMethod: string, exc: Error, showMessageBox: boolean): void;
631
+
632
+ public static LogException(sourceClass: string, sourceMethod: string, exc: Error, lvl: LogLevel): void;
633
+
634
+ public static LogException(sourceClass: string, sourceMethod: string, exc: Error, lvl: LogLevel, showMessageBox: boolean): void;
635
+ public static LogException(...args: unknown[]): void {
636
+ switch (args.length) {
637
+ case 3: {
638
+ const [sourceClass, sourceMethod, exc] = args as [string, string, Error];
639
+
640
+
641
+ ErrorLogger.LogException(sourceClass, sourceMethod, exc, LogLevel.INFO, false);
642
+
643
+
644
+ break;
645
+ }
646
+
647
+ case 4: {
648
+ if (args[3] instanceof Boolean) {
649
+
650
+ const [sourceClass, sourceMethod, exc, showMessageBox] = args as [string, string, Error, boolean];
651
+
652
+
653
+ ErrorLogger.LogException(sourceClass, sourceMethod, exc, LogLevel.INFO, showMessageBox);
654
+
655
+ } else {
656
+
657
+ const [sourceClass, sourceMethod, exc, lvl] = args as [string, string, Error, LogLevel];
658
+
659
+
660
+ ErrorLogger.LogException(sourceClass, sourceMethod, exc, lvl, false);
661
+ }
662
+
663
+ break;
664
+ }
665
+
666
+ case 5: {
667
+ const [sourceClass, sourceMethod, exc, lvl, showMessageBox] = args as [string, string, Error, LogLevel, boolean];
668
+
669
+
670
+ if (lvl.intValue() >= ErrorLogger._level.intValue())
671
+ {
672
+ if(console)
673
+ {
674
+ console.error(new Date().toLocaleString('en-US', this.dateFormatOptions) + sourceClass + "." + sourceMethod);
675
+ console.error(lvl.toString() + ": " + exc.message);
676
+ console.error(ErrorLogger.getStackTrace(exc));
677
+ }
678
+ else
679
+ {
680
+ throw exc;
681
+ }
682
+
683
+ }
684
+ /*
685
+ _Logger.logp(lvl, sourceClass, sourceMethod, exc.message,exc);
686
+ //_Logger.logp(Level.INFO, sourceClass, sourceMethod, exc.message);
687
+
688
+ if(exc != null && showMessageBox==true &&
689
+ lvl.intValue() >= _Logger.getLevel().intValue() &&
690
+ lvl.intValue() < Integer.MAX_VALUE)//shouldn't be showing if logging off
691
+ {
692
+ //JOptionPane.showMessageDialog(null, exc.message, "Exception: " + sourceClass + "." + sourceMethod, JOptionPane.PLAIN_MESSAGE);
693
+ }//*/
694
+
695
+
696
+ break;
697
+ }
698
+
699
+ default: {
700
+ throw Error(`Invalid number of arguments`);
701
+ }
702
+ }
703
+ }
704
+
705
+
706
+ public static PrintList(list: Array<any>): string {
707
+ let message: string = "";
708
+ for (let item of list) {
709
+ message += item.toString() + "\n";
710
+ }
711
+ return message;
712
+ }
713
+
714
+ public static PrintObjectMap(map: Map<string, any>): string {
715
+ let message: string = "";
716
+ if (map != null) {
717
+ for (let [key, val] of map) {
718
+ message += key + " : " + val + "\n";
719
+ }
720
+ }
721
+ //ErrorLogger.LogMessage(message);
722
+ return message;
723
+ }
724
+
725
+ public static PrintStringMap(map: Map<string, string>): string {
726
+ let message: string = "";
727
+ if (map != null) {
728
+ for (let [key, val] of map) {
729
+ message += key + " : " + val + "\n";
730
+ }
731
+ }
732
+ //ErrorLogger.LogMessage(message);
733
+ return message;
734
+ }
735
+
736
+ }