@armyc2.c5isr.renderer/mil-sym-ts-web 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +57 -0
- package/buildNode.bat +2 -0
- package/buildWeb.bat +2 -0
- package/dist/C5Ren.d.ts +6970 -0
- package/dist/C5Ren.js +2 -0
- package/dist/C5Ren.js.map +1 -0
- package/dist/LICENSE +201 -0
- package/dist/README.md +57 -0
- package/dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz +0 -0
- package/dist/manifest.json +4 -0
- package/dist/package.json +16 -0
- package/index.ts +169 -0
- package/package.bak +50 -0
- package/package.json +40 -0
- package/package.node.json +43 -0
- package/package.pack.json +19 -0
- package/package.packWeb.json +16 -0
- package/package.web.json +40 -0
- package/src/main/ts/android/graphics/Bitmap.ts +7 -0
- package/src/main/ts/android/graphics/Paint.ts +26 -0
- package/src/main/ts/android/graphics/Path.ts +78 -0
- package/src/main/ts/android/graphics/PointF.ts +14 -0
- package/src/main/ts/android/graphics/Rect.ts +18 -0
- package/src/main/ts/android/graphics/RectF.ts +50 -0
- package/src/main/ts/android/graphics/Region.ts +36 -0
- package/src/main/ts/android/graphics/Typeface.ts +11 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +99 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +34 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +193 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +2971 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +4008 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +93 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +89 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +515 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +5403 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +1084 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +2173 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +4934 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +7 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +5601 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +14 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +648 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +647 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +2994 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +2663 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +669 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +971 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +871 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +3507 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +500 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +1089 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +2656 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +1419 -0
- package/src/main/ts/armyc2/c5isr/data/genc.json +1407 -0
- package/src/main/ts/armyc2/c5isr/data/msd.json +17311 -0
- package/src/main/ts/armyc2/c5isr/data/mse.json +18500 -0
- package/src/main/ts/armyc2/c5isr/data/svgd.json +31214 -0
- package/src/main/ts/armyc2/c5isr/data/svge.json +30558 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +10 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +437 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +429 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +7 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +35 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +111 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +29 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +211 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +80 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +33 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +16 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +726 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +141 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +112 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +261 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +391 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +567 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +445 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +31 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +45 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +15 -0
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +22 -0
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +269 -0
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +9882 -0
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +146 -0
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +1265 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +64 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +95 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +93 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +114 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +555 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +62 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +120 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +431 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +99 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +203 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +104 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +481 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +40 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +1323 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +51 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +736 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +106 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +84 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +87 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +34 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +324 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +127 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +18 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +111 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +219 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +1008 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +882 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +380 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +797 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +1699 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +178 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +45 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +126 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +118 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +11 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +1201 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +591 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +29 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +753 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +137 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +438 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +19 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +10 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +5 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +404 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +525 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +55 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +36 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +1055 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +2085 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +157 -0
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +86 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +3798 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +412 -0
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +124 -0
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +26 -0
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +677 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +484 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +62 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +46 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +51 -0
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +31 -0
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +71 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +200 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +55 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +68 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +103 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +90 -0
- package/test/ExportSPImages.js +692 -0
- package/test/MPWW.html +556 -0
- package/test/MPWorker.js +318 -0
- package/test/SPWorker.js +233 -0
- package/test/SVGWW.html +363 -0
- package/test/singlePointTester3.html +751 -0
- package/tsconfig.json +54 -0
- package/typedoc.json +30 -0
- package/updateVersion.js +21 -0
- package/webpack.config.js +34 -0
- package/webpackn.config.js +28 -0
- package/webpackr.config.js +47 -0
- package/webpackw.config.js +23 -0
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
|
|
2
|
+
// This import is if we need to call a javascript function
|
|
3
|
+
// It requires that you import the plugins.jar from the jdk folder into the project libraries
|
|
4
|
+
//import netscape.javascript.JSObject;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { type long, type double, type int } from "../../../c5isr/graphics2d/BasicTypes";
|
|
9
|
+
import { Font } from "../../graphics2d/Font";
|
|
10
|
+
import { Point2D } from "../../graphics2d/Point2D";
|
|
11
|
+
import { Rectangle2D } from "../../graphics2d/Rectangle2D";
|
|
12
|
+
import { Color } from "../../renderer/utilities/Color";
|
|
13
|
+
import { ErrorLogger } from "../../renderer/utilities/ErrorLogger";
|
|
14
|
+
import { LogLevel } from "../../renderer/utilities/LogLevel";
|
|
15
|
+
import { MilStdAttributes } from "../../renderer/utilities/MilStdAttributes";
|
|
16
|
+
import { MilStdSymbol } from "../../renderer/utilities/MilStdSymbol";
|
|
17
|
+
import { Modifiers } from "../../renderer/utilities/Modifiers";
|
|
18
|
+
import { RendererSettings } from "../../renderer/utilities/RendererSettings";
|
|
19
|
+
import { SymbolUtilities } from "../../renderer/utilities/SymbolUtilities";
|
|
20
|
+
import { MultiPointHandler } from "./MultiPointHandler";
|
|
21
|
+
import { SymbolModifiers } from "./SymbolModifiers";
|
|
22
|
+
import { JavaRendererUtilities } from "./utilities/JavaRendererUtilities";
|
|
23
|
+
import { RendererUtilities } from "../../renderer/utilities/RendererUtilities";
|
|
24
|
+
import { mdlGeodesic } from "../../JavaTacticalRenderer/mdlGeodesic"
|
|
25
|
+
import { POINT2 } from "../../JavaLineArray/POINT2";
|
|
26
|
+
import { ref } from "../../JavaLineArray/ref"
|
|
27
|
+
import { BasicShapes } from "../../JavaLineArray/BasicShapes";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Main class for rendering multi-point graphics such as Control Measures, Atmospheric, and Oceanographic.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
//@SuppressWarnings("unused")
|
|
35
|
+
export class WebRenderer /* extends Applet */ {
|
|
36
|
+
// private static readonly serialVersionUID: long = -2691218568602318366n;
|
|
37
|
+
|
|
38
|
+
public static readonly OUTPUT_FORMAT_KML = 0;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
public static readonly OUTPUT_FORMAT_JSON = 1;
|
|
43
|
+
public static readonly OUTPUT_FORMAT_GEOJSON = 2;
|
|
44
|
+
public static readonly OUTPUT_FORMAT_GEOSVG = 3;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
// Arbitrary default values of attributes
|
|
48
|
+
public static readonly MIN_ALT_DEFAULT: double = 0.0;
|
|
49
|
+
public static readonly MAX_ALT_DEFAULT: double = 100.0;
|
|
50
|
+
public static readonly RADIUS1_DEFAULT: double = 50.0;
|
|
51
|
+
public static readonly RADIUS2_DEFAULT: double = 100.0;
|
|
52
|
+
public static readonly LEFT_AZIMUTH_DEFAULT: double = 0.0;
|
|
53
|
+
public static readonly RIGHT_AZIMUTH_DEFAULT: double = 90.0;
|
|
54
|
+
|
|
55
|
+
public static readonly ERR_ATTRIBUTES_NOT_FORMATTED: string = "{\"type\":\"error\","
|
|
56
|
+
+ "\"error\":\"The attribute paramaters are not formatted "
|
|
57
|
+
+ "correctly";
|
|
58
|
+
|
|
59
|
+
public static readonly DEFAULT_ATTRIBUTES: string =
|
|
60
|
+
`{"attributes":[{"radius1":${WebRenderer.RADIUS1_DEFAULT},
|
|
61
|
+
"radius2":${WebRenderer.RADIUS2_DEFAULT},
|
|
62
|
+
"minalt":${WebRenderer.MIN_ALT_DEFAULT},"maxalt":${WebRenderer.MAX_ALT_DEFAULT},
|
|
63
|
+
"leftAzimuth":${WebRenderer.LEFT_AZIMUTH_DEFAULT},"rightAzimuth":${WebRenderer.RIGHT_AZIMUTH_DEFAULT}}]}`;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
private static _initSuccess: boolean = false;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
private static init(): void {
|
|
70
|
+
try {
|
|
71
|
+
if (WebRenderer._initSuccess === false) {
|
|
72
|
+
//use WebRenderer.setLoggingLevel()
|
|
73
|
+
|
|
74
|
+
//sets default value for single point symbology to have an outline.
|
|
75
|
+
//outline color will be automatically determined based on line color
|
|
76
|
+
//unless a color value is manually set.
|
|
77
|
+
|
|
78
|
+
//Set Renderer Settings/////////////////////////////////////////////
|
|
79
|
+
RendererSettings.getInstance().setTextBackgroundMethod(
|
|
80
|
+
RendererSettings.TextBackgroundMethod_OUTLINE_QUICK);
|
|
81
|
+
//RendererSettings.getInstance().setLabelForegroundColor(Color.BLACK);
|
|
82
|
+
//RendererSettings.getInstance().setLabelBackgroundColor(new Color(255, 255, 255, 200));
|
|
83
|
+
RendererSettings.getInstance().setLabelFont("arial", Font.PLAIN, 12);
|
|
84
|
+
ErrorLogger.setLevel(LogLevel.FINE);
|
|
85
|
+
|
|
86
|
+
WebRenderer._initSuccess = true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
} catch (exc) {
|
|
90
|
+
if (exc instanceof Error) {
|
|
91
|
+
ErrorLogger.LogException("WebRenderer", "init", exc, LogLevel.WARNING);
|
|
92
|
+
} else {
|
|
93
|
+
throw exc;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**\
|
|
101
|
+
* Set minimum level at which an item can be logged.
|
|
102
|
+
* In descending order:
|
|
103
|
+
* OFF = Integer.MAX_VALUE
|
|
104
|
+
* Severe = 1000
|
|
105
|
+
* Warning = 900
|
|
106
|
+
* Info = 800
|
|
107
|
+
* Config = 700
|
|
108
|
+
* Fine = 500
|
|
109
|
+
* Finer = 400
|
|
110
|
+
* Finest = 300
|
|
111
|
+
* All = Integer.MIN_VALUE
|
|
112
|
+
* Use like WebRenderer.setLoggingLevel(Level.INFO);
|
|
113
|
+
* or
|
|
114
|
+
* Use like WebRenderer.setLoggingLevel(800);
|
|
115
|
+
*/
|
|
116
|
+
public static setLoggingLevel(level: LogLevel | int): void {
|
|
117
|
+
if (level instanceof LogLevel) {
|
|
118
|
+
try {
|
|
119
|
+
ErrorLogger.setLevel(level, true);
|
|
120
|
+
ErrorLogger.LogMessage("WebRenderer", "setLoggingLevel(Level)",
|
|
121
|
+
"Logging level set to: " + ErrorLogger.getLevel().getName(),
|
|
122
|
+
LogLevel.CONFIG);
|
|
123
|
+
} catch (exc) {
|
|
124
|
+
if (exc instanceof Error) {
|
|
125
|
+
ErrorLogger.LogException("WebRenderer", "setLoggingLevel(Level)", exc, LogLevel.INFO);
|
|
126
|
+
} else {
|
|
127
|
+
throw exc;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
try {
|
|
132
|
+
if (level > 1000) {
|
|
133
|
+
ErrorLogger.setLevel(LogLevel.OFF, true);
|
|
134
|
+
} else if (level > 900) {
|
|
135
|
+
ErrorLogger.setLevel(LogLevel.SEVERE, true);
|
|
136
|
+
} else if (level > 800) {
|
|
137
|
+
ErrorLogger.setLevel(LogLevel.WARNING, true);
|
|
138
|
+
} else if (level > 700) {
|
|
139
|
+
ErrorLogger.setLevel(LogLevel.INFO, true);
|
|
140
|
+
} else if (level > 500) {
|
|
141
|
+
ErrorLogger.setLevel(LogLevel.CONFIG, true);
|
|
142
|
+
} else if (level > 400) {
|
|
143
|
+
ErrorLogger.setLevel(LogLevel.FINE, true);
|
|
144
|
+
} else if (level > 300) {
|
|
145
|
+
ErrorLogger.setLevel(LogLevel.FINER, true);
|
|
146
|
+
} else if (level > Number.MIN_VALUE) {
|
|
147
|
+
ErrorLogger.setLevel(LogLevel.FINEST, true);
|
|
148
|
+
} else {
|
|
149
|
+
ErrorLogger.setLevel(LogLevel.ALL, true);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
ErrorLogger.LogMessage("WebRenderer", "setLoggingLevel(int)",
|
|
153
|
+
"Logging level set to: " + ErrorLogger.getLevel().getName(),
|
|
154
|
+
LogLevel.CONFIG);
|
|
155
|
+
} catch (exc) {
|
|
156
|
+
if (exc instanceof Error) {
|
|
157
|
+
ErrorLogger.LogException("WebRenderer", "setLoggingLevel(int)", exc, LogLevel.INFO);
|
|
158
|
+
} else {
|
|
159
|
+
throw exc;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Single Point Tactical Graphics are rendered from font files.
|
|
168
|
+
* The font size you specify here determines how big the symbols will
|
|
169
|
+
* be rendered. This should be set once at startup.
|
|
170
|
+
* @param size
|
|
171
|
+
*/
|
|
172
|
+
public static setTacticalGraphicPointSize(size: int): void {
|
|
173
|
+
// sps.setTacticalGraphicPointSize(size);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Units are rendered from font files.
|
|
178
|
+
* The font size you specify here determines how big the symbols will
|
|
179
|
+
* be rendered. This should be set once at startup.
|
|
180
|
+
* @param size
|
|
181
|
+
*/
|
|
182
|
+
public static setUnitPointSize(size: int): void {
|
|
183
|
+
// sps.setUnitPointSize(size);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Modifier Text Color will by default match the line color.
|
|
188
|
+
* This will override all modifier text color.
|
|
189
|
+
* @param hexColor
|
|
190
|
+
*/
|
|
191
|
+
/* public static void setModifierTextColor(String hexColor)
|
|
192
|
+
{
|
|
193
|
+
Color textColor = RendererUtilities.getColorFromHexString(hexColor);
|
|
194
|
+
if(textColor==null)
|
|
195
|
+
{
|
|
196
|
+
textColor = Color.black;
|
|
197
|
+
}
|
|
198
|
+
RendererSettings.getInstance().setLabelForegroundColor(textColor);
|
|
199
|
+
}*/
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Renders all multi-point symbols, creating KML that can be used to draw
|
|
207
|
+
* it on a Google map. Multipoint symbols cannot be draw the same
|
|
208
|
+
* at different scales. For instance, graphics with arrow heads will need to
|
|
209
|
+
* redraw arrowheads when you zoom in on it. Similarly, graphics like a
|
|
210
|
+
* Forward Line of Troops drawn with half circles can improve performance if
|
|
211
|
+
* clipped when the parts of the graphic that aren't on the screen. To help
|
|
212
|
+
* readjust graphics and increase performance, this function requires the
|
|
213
|
+
* scale and bounding box to help calculate the new locations.
|
|
214
|
+
* @param id A unique identifier used to identify the symbol by Google map.
|
|
215
|
+
* The id will be the folder name that contains the graphic.
|
|
216
|
+
* @param name a string used to display to the user as the name of the
|
|
217
|
+
* graphic being created.
|
|
218
|
+
* @param description a brief description about the graphic being made and
|
|
219
|
+
* what it represents.
|
|
220
|
+
* @param symbolCode A 20-30 digit symbolID corresponding to one of the
|
|
221
|
+
* graphics in the MIL-STD-2525D
|
|
222
|
+
* @param controlPoints The vertices of the graphics that make up the
|
|
223
|
+
* graphic. Passed in the format of a string, using decimal degrees
|
|
224
|
+
* separating lat and lon by a comma, separating coordinates by a space.
|
|
225
|
+
* The following format shall be used "x1,y1[,z1] [xn,yn[,zn]]..."
|
|
226
|
+
* @param altitudeMode Indicates whether the symbol should interpret
|
|
227
|
+
* altitudes as above sea level or above ground level. Options are
|
|
228
|
+
* "clampToGround", "relativeToGround" (from surface of earth), "absolute"
|
|
229
|
+
* (sea level), "relativeToSeaFloor" (from the bottom of major bodies of
|
|
230
|
+
* water).
|
|
231
|
+
* @param scale A number corresponding to how many meters one meter of our
|
|
232
|
+
* map represents. A value "50000" would mean 1:50K which means for every
|
|
233
|
+
* meter of our map it represents 50000 meters of real world distance.
|
|
234
|
+
* @param bbox The viewable area of the map. Passed in the format of a
|
|
235
|
+
* string "lowerLeftX,lowerLeftY,upperRightX,upperRightY." Not required
|
|
236
|
+
* but can speed up rendering in some cases.
|
|
237
|
+
* example: "-50.4,23.6,-42.2,24.2"
|
|
238
|
+
* @param modifiers {@link Map}, keyed using constants from Modifiers.
|
|
239
|
+
* Pass in comma delimited String for modifiers with multiple values like AM, AN & X
|
|
240
|
+
* @param attributes {@link Map}, keyed using constants from MilStdAttributes.
|
|
241
|
+
* @param format An enumeration: 2 for GeoJSON.
|
|
242
|
+
* @return A JSON string representation of the graphic.
|
|
243
|
+
*/
|
|
244
|
+
public static RenderSymbol(id: string, name: string, description: string,
|
|
245
|
+
symbolCode: string, controlPoints: string, altitudeMode: string,
|
|
246
|
+
scale: double, bbox: string, modifiers: Map<string, string>, attributes: Map<string, string>, format: int): string {
|
|
247
|
+
let output: string = "";
|
|
248
|
+
try {
|
|
249
|
+
|
|
250
|
+
JavaRendererUtilities.addAltModeToModifiersString(attributes, altitudeMode);
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
output = MultiPointHandler.RenderSymbol(id, name, description, symbolCode, controlPoints,
|
|
254
|
+
scale, bbox, modifiers, attributes, format);
|
|
255
|
+
|
|
256
|
+
//DEBUGGING
|
|
257
|
+
if (ErrorLogger.getLevel().intValue() <= LogLevel.FINER.intValue()) {
|
|
258
|
+
console.log("");
|
|
259
|
+
let sb: string = "";
|
|
260
|
+
sb += ("\nID: " + id + "\n");
|
|
261
|
+
sb += ("Name: " + name + "\n");
|
|
262
|
+
sb += ("Description: " + description + "\n");
|
|
263
|
+
sb += ("SymbolID: " + symbolCode + "\n");
|
|
264
|
+
sb += ("Scale: " + scale.toString() + "\n");
|
|
265
|
+
sb += ("BBox: " + bbox + "\n");
|
|
266
|
+
sb += ("Coords: " + controlPoints + "\n");
|
|
267
|
+
sb += ("Modifiers: " + modifiers + "\n");
|
|
268
|
+
ErrorLogger.LogMessage("WebRenderer", "RenderSymbol", sb.toString(), LogLevel.FINER);
|
|
269
|
+
}
|
|
270
|
+
if (ErrorLogger.getLevel().intValue() <= LogLevel.FINEST.intValue()) {
|
|
271
|
+
let briefOutput: string = output.replaceAll("</Placemark>", "</Placemark>\n");
|
|
272
|
+
briefOutput = output.replaceAll("(?s)<description[^>]*>.*?</description>", "<description></description>");
|
|
273
|
+
ErrorLogger.LogMessage("WebRenderer", "RenderSymbol", "Output:\n" + briefOutput, LogLevel.FINEST);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
} catch (ea) {
|
|
279
|
+
if (ea instanceof Error) {
|
|
280
|
+
|
|
281
|
+
output = "{\"type\":'error',error:'There was an error creating the MilStdSymbol - " + ea.toString() + "'}";
|
|
282
|
+
ErrorLogger.LogException("WebRenderer", "RenderSymbol", ea, LogLevel.WARNING);
|
|
283
|
+
} else {
|
|
284
|
+
throw ea;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return output;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Renders all multi-point symbols, creating KML or JSON for the user to
|
|
297
|
+
* parse and render as they like.
|
|
298
|
+
* This function requires the bounding box to help calculate the new
|
|
299
|
+
* locations.
|
|
300
|
+
* @param id A unique identifier used to identify the symbol by Google map.
|
|
301
|
+
* The id will be the folder name that contains the graphic.
|
|
302
|
+
* @param name a string used to display to the user as the name of the
|
|
303
|
+
* graphic being created.
|
|
304
|
+
* @param description a brief description about the graphic being made and
|
|
305
|
+
* what it represents.
|
|
306
|
+
* @param symbolCode A 20-30 digit symbolID corresponding to one of the
|
|
307
|
+
* graphics in the MIL-STD-2525D
|
|
308
|
+
* @param controlPoints The vertices of the graphics that make up the
|
|
309
|
+
* graphic. Passed in the format of a string, using decimal degrees
|
|
310
|
+
* separating lat and lon by a comma, separating coordinates by a space.
|
|
311
|
+
* The following format shall be used "x1,y1 [xn,yn]..."
|
|
312
|
+
* @param pixelWidth pixel dimensions of the viewable map area
|
|
313
|
+
* @param pixelHeight pixel dimensions of the viewable map area
|
|
314
|
+
* @param bbox The viewable area of the map. Passed in the format of a
|
|
315
|
+
* string "lowerLeftX,lowerLeftY,upperRightX,upperRightY."
|
|
316
|
+
* example: "-50.4,23.6,-42.2,24.2"
|
|
317
|
+
* @param modifiers {@link Map}, keyed using constants from Modifiers.
|
|
318
|
+
* Pass in comma delimited String for modifiers with multiple values like AM, AN & X
|
|
319
|
+
* @param attributes {@link Map}, keyed using constants from MilStdAttributes.
|
|
320
|
+
* @param format An enumeration: 2 for GeoJSON.
|
|
321
|
+
* @return A JSON (1) or KML (0) string representation of the graphic.
|
|
322
|
+
*/
|
|
323
|
+
public static RenderSymbol2D(id: string, name: string, description: string, symbolCode: string, controlPoints: string,
|
|
324
|
+
pixelWidth: int, pixelHeight: int, bbox: string, modifiers: Map<string, string>,
|
|
325
|
+
attributes: Map<string, string>, format: int): string {
|
|
326
|
+
let output: string = "";
|
|
327
|
+
try {
|
|
328
|
+
output = MultiPointHandler.RenderSymbol2D(id, name, description,
|
|
329
|
+
symbolCode, controlPoints, pixelWidth, pixelHeight, bbox,
|
|
330
|
+
modifiers, attributes, format);
|
|
331
|
+
} catch (exc) {
|
|
332
|
+
if (exc instanceof Error) {
|
|
333
|
+
output = "{\"type\":'error',error:'There was an error creating the MilStdSymbol: " + symbolCode + " - ID: " + id + " " + exc.toString() + "'}";
|
|
334
|
+
} else {
|
|
335
|
+
throw exc;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return output;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Renders all MilStd 2525 multi-point symbols, creating MilStdSymbol that contains the
|
|
344
|
+
* information needed to draw the symbol on the map.
|
|
345
|
+
* DOES NOT support RADARC, CAKE, TRACK etc...
|
|
346
|
+
* ArrayList<Point2D> milStdSymbol.getSymbolShapes[index].getPolylines()
|
|
347
|
+
* and
|
|
348
|
+
* ShapeInfo = milStdSymbol.getModifierShapes[index].
|
|
349
|
+
*
|
|
350
|
+
*
|
|
351
|
+
* @param id
|
|
352
|
+
* A unique identifier used to identify the symbol by Google map.
|
|
353
|
+
* The id will be the folder name that contains the graphic.
|
|
354
|
+
* @param name
|
|
355
|
+
* a string used to display to the user as the name of the
|
|
356
|
+
* graphic being created.
|
|
357
|
+
* @param description
|
|
358
|
+
* a brief description about the graphic being made and what it
|
|
359
|
+
* represents.
|
|
360
|
+
* @param symbolCode
|
|
361
|
+
* A 20-30 digit symbolID corresponding to one of the graphics
|
|
362
|
+
* in the MIL-STD-2525D
|
|
363
|
+
* @param controlPoints
|
|
364
|
+
* The vertices of the graphics that make up the graphic. Passed
|
|
365
|
+
* in the format of a string, using decimal degrees separating
|
|
366
|
+
* lat and lon by a comma, separating coordinates by a space. The
|
|
367
|
+
* following format shall be used "x1,y1[,z1] [xn,yn[,zn]]..."
|
|
368
|
+
* @param altitudeMode
|
|
369
|
+
* Indicates whether the symbol should interpret altitudes as
|
|
370
|
+
* above sea level or above ground level. Options are
|
|
371
|
+
* "clampToGround", "relativeToGround" (from surface of earth),
|
|
372
|
+
* "absolute" (sea level), "relativeToSeaFloor" (from the bottom
|
|
373
|
+
* of major bodies of water).
|
|
374
|
+
* @param scale
|
|
375
|
+
* A number corresponding to how many meters one meter of our map
|
|
376
|
+
* represents. A value "50000" would mean 1:50K which means for
|
|
377
|
+
* every meter of our map it represents 50000 meters of real
|
|
378
|
+
* world distance.
|
|
379
|
+
* @param bbox
|
|
380
|
+
* The viewable area of the map. Passed in the format of a string
|
|
381
|
+
* "lowerLeftX,lowerLeftY,upperRightX,upperRightY." Not required
|
|
382
|
+
* but can speed up rendering in some cases. example:
|
|
383
|
+
* "-50.4,23.6,-42.2,24.2"
|
|
384
|
+
* @param modifiers
|
|
385
|
+
* Used like:
|
|
386
|
+
* modifiers.set(Modifiers.T_UNIQUE_DESIGNATION_1, "T");
|
|
387
|
+
* Or
|
|
388
|
+
* modifiers.set(Modifiers.AM_DISTANCE, "1000,2000,3000");
|
|
389
|
+
* @param attributes
|
|
390
|
+
* Used like:
|
|
391
|
+
* attributes.set(MilStdAttributes.LineWidth, "3");
|
|
392
|
+
* Or
|
|
393
|
+
* attributes.set(MilStdAttributes.LineColor, "#00FF00");
|
|
394
|
+
* @return MilStdSymbol
|
|
395
|
+
*/
|
|
396
|
+
public static RenderMultiPointAsMilStdSymbol(id: string, name: string, description: string, symbolCode: string,
|
|
397
|
+
controlPoints: string, altitudeMode: string, scale: double, bbox: string, modifiers: Map<string, string>, attributes: Map<string, string>): MilStdSymbol {
|
|
398
|
+
let mSymbol: MilStdSymbol;
|
|
399
|
+
try {
|
|
400
|
+
mSymbol = MultiPointHandler.RenderSymbolAsMilStdSymbol(id, name, description, symbolCode,
|
|
401
|
+
controlPoints, scale, bbox, modifiers, attributes);
|
|
402
|
+
|
|
403
|
+
//Uncomment to show sector1 modifiers as fill pattern
|
|
404
|
+
// int symbolSet = SymbolID.getEntityCode(symbolCode);
|
|
405
|
+
// if(symbolSet == 270707 || symbolSet == 270800 || symbolSet == 270801 || symbolSet == 151100) //Mined Areas
|
|
406
|
+
// {
|
|
407
|
+
// int size = RendererSettings.getInstance().getDefaultPixelSize();
|
|
408
|
+
//
|
|
409
|
+
// ArrayList<ShapeInfo> shapes = mSymbol.getSymbolShapes();
|
|
410
|
+
// if(shapes.length > 0){
|
|
411
|
+
// ShapeInfo shape = shapes[0];
|
|
412
|
+
// shape.setPatternFillImage(PatternFillRendererD.MakeSymbolPatternFill(symbolCode,size));
|
|
413
|
+
// if(shape.getPatternFillImage() != null)
|
|
414
|
+
// shape.setShader(new BitmapShader(shape.getPatternFillImage(), Shader.TileMode.REPEAT, Shader.TileMode.REPEAT));
|
|
415
|
+
// }
|
|
416
|
+
// }
|
|
417
|
+
} catch (ea) {
|
|
418
|
+
if (ea instanceof Error) {
|
|
419
|
+
mSymbol = null;
|
|
420
|
+
ErrorLogger.LogException("WebRenderer", "RenderMultiPointAsMilStdSymbol" + " - " + symbolCode, ea, LogLevel.WARNING);
|
|
421
|
+
} else {
|
|
422
|
+
throw ea;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
//console.log("RenderMultiPointAsMilStdSymbol exit");
|
|
427
|
+
return mSymbol;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Renders all MilStd 2525 multi-point symbols, creating MilStdSymbol that contains the
|
|
432
|
+
* information needed to draw the symbol on the map.
|
|
433
|
+
* DOES NOT support RADARC, CAKE, TRACK etc...
|
|
434
|
+
* ArrayList<Point2D> milStdSymbol.getSymbolShapes[index].getPolylines()
|
|
435
|
+
* and
|
|
436
|
+
* ShapeInfo = milStdSymbol.getModifierShapes[index].
|
|
437
|
+
*
|
|
438
|
+
*
|
|
439
|
+
* @param id
|
|
440
|
+
* A unique identifier used to identify the symbol by Google map.
|
|
441
|
+
* The id will be the folder name that contains the graphic.
|
|
442
|
+
* @param name
|
|
443
|
+
* a string used to display to the user as the name of the
|
|
444
|
+
* graphic being created.
|
|
445
|
+
* @param description
|
|
446
|
+
* a brief description about the graphic being made and what it
|
|
447
|
+
* represents.
|
|
448
|
+
* @param basicShapeType
|
|
449
|
+
* {@link BasicShapes}
|
|
450
|
+
* @param controlPoints
|
|
451
|
+
* The vertices of the graphics that make up the graphic. Passed
|
|
452
|
+
* in the format of a string, using decimal degrees separating
|
|
453
|
+
* lat and lon by a comma, separating coordinates by a space. The
|
|
454
|
+
* following format shall be used "x1,y1[,z1] [xn,yn[,zn]]..."
|
|
455
|
+
* @param altitudeMode
|
|
456
|
+
* Indicates whether the symbol should interpret altitudes as
|
|
457
|
+
* above sea level or above ground level. Options are
|
|
458
|
+
* "clampToGround", "relativeToGround" (from surface of earth),
|
|
459
|
+
* "absolute" (sea level), "relativeToSeaFloor" (from the bottom
|
|
460
|
+
* of major bodies of water).
|
|
461
|
+
* @param scale
|
|
462
|
+
* A number corresponding to how many meters one meter of our map
|
|
463
|
+
* represents. A value "50000" would mean 1:50K which means for
|
|
464
|
+
* every meter of our map it represents 50000 meters of real
|
|
465
|
+
* world distance.
|
|
466
|
+
* @param bbox
|
|
467
|
+
* The viewable area of the map. Passed in the format of a string
|
|
468
|
+
* "lowerLeftX,lowerLeftY,upperRightX,upperRightY." Not required
|
|
469
|
+
* but can speed up rendering in some cases. example:
|
|
470
|
+
* "-50.4,23.6,-42.2,24.2"
|
|
471
|
+
* @param modifiers
|
|
472
|
+
* Used like:
|
|
473
|
+
* modifiers.set(Modifiers.T_UNIQUE_DESIGNATION_1, "T");
|
|
474
|
+
* Or
|
|
475
|
+
* modifiers.set(Modifiers.AM_DISTANCE, "1000,2000,3000");
|
|
476
|
+
* @param attributes
|
|
477
|
+
* Used like:
|
|
478
|
+
* attributes.set(MilStdAttributes.LineWidth, "3");
|
|
479
|
+
* Or
|
|
480
|
+
* attributes.set(MilStdAttributes.LineColor, "#00FF00");
|
|
481
|
+
* @return MilStdSymbol
|
|
482
|
+
*/
|
|
483
|
+
public static RenderBasicShapeAsMilStdSymbol(id: string, name: string, description: string, basicShapeType: int,
|
|
484
|
+
controlPoints: string, altitudeMode: string, scale: double, bbox: string, modifiers: Map<string, string>, attributes: Map<string, string>): MilStdSymbol {
|
|
485
|
+
let mSymbol: MilStdSymbol;
|
|
486
|
+
try {
|
|
487
|
+
if (SymbolUtilities.isBasicShape(basicShapeType))
|
|
488
|
+
mSymbol = MultiPointHandler.RenderBasicShapeAsMilStdSymbol(id, name, description, basicShapeType,
|
|
489
|
+
controlPoints, scale, bbox, modifiers, attributes);
|
|
490
|
+
} catch (ea) {
|
|
491
|
+
if (ea instanceof Error) {
|
|
492
|
+
mSymbol = null;
|
|
493
|
+
ErrorLogger.LogException("WebRenderer", "RenderMultiPointAsMilStdSymbol" + " - " + basicShapeType, ea, LogLevel.WARNING);
|
|
494
|
+
} else {
|
|
495
|
+
throw ea;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return mSymbol;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Renders all multi-point symbols, creating KML that can be used to draw
|
|
504
|
+
* it on a Google map. Multipoint symbols cannot be draw the same
|
|
505
|
+
* at different scales. For instance, graphics with arrow heads will need to
|
|
506
|
+
* redraw arrowheads when you zoom in on it. Similarly, graphics like a
|
|
507
|
+
* Forward Line of Troops drawn with half circles can improve performance if
|
|
508
|
+
* clipped when the parts of the graphic that aren't on the screen. To help
|
|
509
|
+
* readjust graphics and increase performance, this function requires the
|
|
510
|
+
* scale and bounding box to help calculate the new locations.
|
|
511
|
+
* @param id A unique identifier used to identify the symbol by Google map.
|
|
512
|
+
* The id will be the folder name that contains the graphic.
|
|
513
|
+
* @param name a string used to display to the user as the name of the
|
|
514
|
+
* graphic being created.
|
|
515
|
+
* @param description a brief description about the graphic being made and
|
|
516
|
+
* what it represents.
|
|
517
|
+
* @param basicShapeType {@link BasicShapes}
|
|
518
|
+
* @param controlPoints The vertices of the graphics that make up the
|
|
519
|
+
* graphic. Passed in the format of a string, using decimal degrees
|
|
520
|
+
* separating lat and lon by a comma, separating coordinates by a space.
|
|
521
|
+
* The following format shall be used "x1,y1[,z1] [xn,yn[,zn]]..."
|
|
522
|
+
* @param altitudeMode Indicates whether the symbol should interpret
|
|
523
|
+
* altitudes as above sea level or above ground level. Options are
|
|
524
|
+
* "clampToGround", "relativeToGround" (from surface of earth), "absolute"
|
|
525
|
+
* (sea level), "relativeToSeaFloor" (from the bottom of major bodies of
|
|
526
|
+
* water).
|
|
527
|
+
* @param scale A number corresponding to how many meters one meter of our
|
|
528
|
+
* map represents. A value "50000" would mean 1:50K which means for every
|
|
529
|
+
* meter of our map it represents 50000 meters of real world distance.
|
|
530
|
+
* @param bbox The viewable area of the map. Passed in the format of a
|
|
531
|
+
* string "lowerLeftX,lowerLeftY,upperRightX,upperRightY." Not required
|
|
532
|
+
* but can speed up rendering in some cases.
|
|
533
|
+
* example: "-50.4,23.6,-42.2,24.2"
|
|
534
|
+
* @param modifiers {@link Map}, keyed using constants from Modifiers.
|
|
535
|
+
* Pass in comma delimited String for modifiers with multiple values like AM, AN & X
|
|
536
|
+
* @param attributes {@link Map}, keyed using constants from MilStdAttributes.
|
|
537
|
+
* @param format An enumeration: 2 for GeoJSON.
|
|
538
|
+
* @return A JSON string representation of the graphic.
|
|
539
|
+
*/
|
|
540
|
+
public static RenderBasicShape(id: string, name: string, description: string,
|
|
541
|
+
basicShapeType: int, controlPoints: string, altitudeMode: string,
|
|
542
|
+
scale: double, bbox: string, modifiers: Map<string, string>, attributes: Map<string, string>, format: int): string {
|
|
543
|
+
let output: string = "";
|
|
544
|
+
try {
|
|
545
|
+
JavaRendererUtilities.addAltModeToModifiersString(attributes, altitudeMode);
|
|
546
|
+
if (SymbolUtilities.isBasicShape(basicShapeType))
|
|
547
|
+
output = MultiPointHandler.RenderBasicShape(id, name, description, basicShapeType, controlPoints,
|
|
548
|
+
scale, bbox, modifiers, attributes, format);
|
|
549
|
+
} catch (ea) {
|
|
550
|
+
if (ea instanceof Error) {
|
|
551
|
+
output = "{\"type\":'error',error:'There was an error creating the MilStdSymbol - " + ea.toString() + "'}";
|
|
552
|
+
ErrorLogger.LogException("WebRenderer", "RenderSymbol", ea, LogLevel.WARNING);
|
|
553
|
+
} else {
|
|
554
|
+
throw ea;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
return output;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Given a symbol code meant for a single point symbol, returns the
|
|
563
|
+
* anchor point at which to display that image based off the image returned
|
|
564
|
+
* from the URL of the SinglePointServer.
|
|
565
|
+
*
|
|
566
|
+
* @param symbolID - the 20-30 digit symbolID of a single point MilStd2525
|
|
567
|
+
* symbol.
|
|
568
|
+
* @return A pixel coordinate of the format "x,y".
|
|
569
|
+
* Returns an empty string if an error occurs.
|
|
570
|
+
* @deprecated
|
|
571
|
+
*/
|
|
572
|
+
public getSinglePointAnchor(symbolID: string): string {
|
|
573
|
+
let anchorPoint: string = "";
|
|
574
|
+
let anchor: Point2D = new Point2D();
|
|
575
|
+
anchorPoint = anchor.getX() + "," + anchor.getY();
|
|
576
|
+
return anchorPoint;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Given a symbol code meant for a single point symbol, returns the
|
|
581
|
+
* anchor point at which to display that image based off the image returned
|
|
582
|
+
* from the URL of the SinglePointServer.
|
|
583
|
+
*
|
|
584
|
+
* @param symbolID - the 20-30 digit symbolID of a single point MilStd2525
|
|
585
|
+
* symbol.
|
|
586
|
+
* @return A pixel coordinate of the format "anchorX,anchorY,SymbolBoundsX,
|
|
587
|
+
* SymbolBoundsY,SymbolBoundsWidth,SymbolBoundsHeight,IconWidth,IconHeight".
|
|
588
|
+
* Anchor, represents the center point of the core symbol within the image.
|
|
589
|
+
* The image should be centered on this point.
|
|
590
|
+
* Symbol bounds represents the bounding rectangle of the core symbol within
|
|
591
|
+
* the image.
|
|
592
|
+
* IconWidth/Height represents the height and width of the image in its
|
|
593
|
+
* entirety.
|
|
594
|
+
* Returns an empty string if an error occurs.
|
|
595
|
+
* @deprecated
|
|
596
|
+
*/
|
|
597
|
+
public static getSinglePointInfo(symbolID: string): string {
|
|
598
|
+
let info: string = "";
|
|
599
|
+
let anchor: Point2D = new Point2D();
|
|
600
|
+
let symbolBounds: Rectangle2D = new Rectangle2D();
|
|
601
|
+
return info;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Returns true if we recommend clipping a particular symbol.
|
|
606
|
+
* Would return false for and Ambush but would return true for a Line of
|
|
607
|
+
* Contact due to the decoration on the line.
|
|
608
|
+
* @param symbolID
|
|
609
|
+
* @return
|
|
610
|
+
*/
|
|
611
|
+
public static ShouldClipMultipointSymbol(symbolID: string): string {
|
|
612
|
+
if (MultiPointHandler.ShouldClipSymbol(symbolID)) {
|
|
613
|
+
|
|
614
|
+
return "true";
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
else {
|
|
618
|
+
|
|
619
|
+
return "false";
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Given a symbol code meant for a single point symbol, returns the
|
|
626
|
+
* symbol as a byte array.
|
|
627
|
+
*
|
|
628
|
+
* @param symbolID - the 20-30 digit symbolID of a single point MilStd2525
|
|
629
|
+
* symbol.
|
|
630
|
+
* @return byte array.
|
|
631
|
+
* @deprecated
|
|
632
|
+
*/
|
|
633
|
+
public static getSinglePointByteArray(symbolID: string): null {
|
|
634
|
+
//return sps.getSinglePointByteArray(symbolID);
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Converts a rectangle with two points and a width to a polygon that contains the four corners of the rectangle
|
|
640
|
+
*
|
|
641
|
+
* @param endpoints the two end points of the rectangle
|
|
642
|
+
* @param width the width of the rectangle
|
|
643
|
+
* @returns the points of a polygon containing the four points of a rectangle
|
|
644
|
+
*/
|
|
645
|
+
public static getRectangleCorners(endpoints: string, width: number) {
|
|
646
|
+
let pt0 = new POINT2();
|
|
647
|
+
let pt1 = new POINT2();
|
|
648
|
+
const points: POINT2[] = [];
|
|
649
|
+
|
|
650
|
+
let attitude = new ref<number[]>();
|
|
651
|
+
let a21 = new ref<number[]>();
|
|
652
|
+
|
|
653
|
+
let coordinates = endpoints.split(" ");
|
|
654
|
+
let latlon = coordinates[0].split(",");
|
|
655
|
+
pt0.x = parseFloat(latlon[0]);
|
|
656
|
+
pt0.y = parseFloat(latlon[1]);
|
|
657
|
+
|
|
658
|
+
latlon = coordinates[1].split(",");
|
|
659
|
+
pt1.x = parseFloat(latlon[0]);
|
|
660
|
+
pt1.y = parseFloat(latlon[1]);
|
|
661
|
+
|
|
662
|
+
mdlGeodesic.geodesic_distance(pt0, pt1, attitude, a21);
|
|
663
|
+
|
|
664
|
+
points.push(mdlGeodesic.geodesic_coordinate(pt0, width / 2.0, attitude.value[0] - 90)); //top left
|
|
665
|
+
points.push(mdlGeodesic.geodesic_coordinate(pt0, width / 2.0, attitude.value[0] + 90)); //top right
|
|
666
|
+
points.push(mdlGeodesic.geodesic_coordinate(pt1, width / 2.0, attitude.value[0] + 90)); //bottom right
|
|
667
|
+
points.push(mdlGeodesic.geodesic_coordinate(pt1, width / 2.0, attitude.value[0] - 90)); //bottom left
|
|
668
|
+
|
|
669
|
+
let pointString = "";
|
|
670
|
+
for(let point of points) {
|
|
671
|
+
pointString += `${point.getX()},${point.getY()} `;
|
|
672
|
+
}
|
|
673
|
+
;
|
|
674
|
+
return pointString.trim();
|
|
675
|
+
|
|
676
|
+
}
|
|
677
|
+
}
|