@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.
- 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
- package/package.json +15 -39
- package/buildNode.bat +0 -2
- package/buildWeb.bat +0 -2
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -57
- package/dist/package.json +0 -16
- package/index.ts +0 -169
- package/package.bak +0 -50
- package/package.node.json +0 -43
- package/package.pack.json +0 -19
- package/package.packWeb.json +0 -16
- package/package.web.json +0 -40
- package/src/main/ts/android/graphics/Bitmap.ts +0 -7
- package/src/main/ts/android/graphics/Paint.ts +0 -26
- package/src/main/ts/android/graphics/Path.ts +0 -78
- package/src/main/ts/android/graphics/PointF.ts +0 -14
- package/src/main/ts/android/graphics/Rect.ts +0 -18
- package/src/main/ts/android/graphics/RectF.ts +0 -50
- package/src/main/ts/android/graphics/Region.ts +0 -36
- package/src/main/ts/android/graphics/Typeface.ts +0 -11
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +0 -99
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +0 -34
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +0 -193
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +0 -2971
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +0 -4008
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +0 -93
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +0 -89
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +0 -515
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +0 -5403
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +0 -1084
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +0 -2173
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +0 -4934
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +0 -7
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +0 -5601
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +0 -14
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +0 -648
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +0 -647
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +0 -2994
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +0 -2663
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +0 -669
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +0 -971
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +0 -871
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +0 -3507
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +0 -500
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +0 -1089
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +0 -2656
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +0 -1419
- package/src/main/ts/armyc2/c5isr/data/genc.json +0 -1407
- package/src/main/ts/armyc2/c5isr/data/msd.json +0 -17311
- package/src/main/ts/armyc2/c5isr/data/mse.json +0 -18500
- package/src/main/ts/armyc2/c5isr/data/svgd.json +0 -31214
- package/src/main/ts/armyc2/c5isr/data/svge.json +0 -30558
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +0 -10
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +0 -437
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +0 -429
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +0 -7
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +0 -35
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +0 -111
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +0 -29
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +0 -18
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +0 -211
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +0 -80
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +0 -33
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +0 -16
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +0 -726
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +0 -141
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +0 -112
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +0 -261
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +0 -391
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +0 -567
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +0 -445
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +0 -31
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +0 -18
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +0 -45
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +0 -25
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +0 -15
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +0 -22
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +0 -269
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +0 -9882
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +0 -146
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +0 -1265
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +0 -64
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +0 -95
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +0 -93
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +0 -114
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +0 -555
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +0 -62
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +0 -120
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +0 -431
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +0 -99
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +0 -25
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +0 -203
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +0 -104
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +0 -481
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +0 -40
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +0 -1323
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +0 -51
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +0 -736
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +0 -106
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +0 -84
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +0 -87
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +0 -34
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +0 -324
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +0 -127
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +0 -18
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +0 -111
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +0 -219
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +0 -1008
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +0 -882
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +0 -380
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +0 -797
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +0 -1699
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +0 -178
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +0 -45
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +0 -126
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +0 -118
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +0 -11
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +0 -1201
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +0 -591
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +0 -29
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +0 -753
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +0 -137
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +0 -438
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +0 -19
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +0 -10
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +0 -5
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +0 -404
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +0 -525
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +0 -55
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +0 -36
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +0 -1055
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +0 -2085
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +0 -157
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +0 -86
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +0 -3798
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +0 -412
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +0 -124
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +0 -26
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +0 -677
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +0 -484
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +0 -62
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +0 -46
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +0 -51
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +0 -31
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +0 -71
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +0 -200
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +0 -55
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +0 -68
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +0 -103
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +0 -90
- package/test/ExportSPImages.js +0 -692
- package/test/MPWW.html +0 -556
- package/test/MPWorker.js +0 -318
- package/test/SPWorker.js +0 -233
- package/test/SVGWW.html +0 -363
- package/test/singlePointTester3.html +0 -751
- package/tsconfig.json +0 -54
- package/typedoc.json +0 -30
- package/updateVersion.js +0 -21
- package/webpack.config.js +0 -34
- package/webpackn.config.js +0 -28
- package/webpackr.config.js +0 -47
- package/webpackw.config.js +0 -23
- /package/{dist/C5Ren.d.ts → C5Ren.d.ts} +0 -0
- /package/{dist/C5Ren.js → C5Ren.js} +0 -0
- /package/{dist/C5Ren.js.map → C5Ren.js.map} +0 -0
- /package/{dist/manifest.json → manifest.json} +0 -0
|
@@ -1,2656 +0,0 @@
|
|
|
1
|
-
import { GeneralPath } from "../graphics2d/GeneralPath"
|
|
2
|
-
import { PathIterator } from "../graphics2d/PathIterator"
|
|
3
|
-
import { Point2D } from "../graphics2d/Point2D"
|
|
4
|
-
import { Rectangle } from "../graphics2d/Rectangle"
|
|
5
|
-
import { Rectangle2D } from "../graphics2d/Rectangle2D"
|
|
6
|
-
import { Shape } from "../graphics2d/Shape"
|
|
7
|
-
import { arraysupport } from "../JavaLineArray/arraysupport"
|
|
8
|
-
import { lineutility } from "../JavaLineArray/lineutility"
|
|
9
|
-
import { POINT2 } from "../JavaLineArray/POINT2"
|
|
10
|
-
import { ref } from "../JavaLineArray/ref"
|
|
11
|
-
import { Shape2 } from "../JavaLineArray/Shape2"
|
|
12
|
-
import { TacticalLines } from "../JavaLineArray/TacticalLines"
|
|
13
|
-
import { clsUtility as clsUtilityJTR } from "../JavaTacticalRenderer/clsUtility"
|
|
14
|
-
import { mdlGeodesic } from "../JavaTacticalRenderer/mdlGeodesic"
|
|
15
|
-
import { TGLight } from "../JavaTacticalRenderer/TGLight"
|
|
16
|
-
import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
|
|
17
|
-
import { IPointConversion } from "../renderer/utilities/IPointConversion"
|
|
18
|
-
import { RendererException } from "../renderer/utilities/RendererException"
|
|
19
|
-
import { ShapeInfo } from "../renderer/utilities/ShapeInfo"
|
|
20
|
-
import { SymbolUtilities } from "../renderer/utilities/SymbolUtilities"
|
|
21
|
-
import { clsClipPolygon2 } from "../RenderMultipoints/clsClipPolygon2"
|
|
22
|
-
import { clsClipQuad } from "../RenderMultipoints/clsClipQuad"
|
|
23
|
-
import { clsUtility } from "../RenderMultipoints/clsUtility"
|
|
24
|
-
import { clsMETOC } from "../JavaTacticalRenderer/clsMETOC";
|
|
25
|
-
|
|
26
|
-
import { type int, type double } from "../../c5isr/graphics2d/BasicTypes";
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* CPOF utility functions taken from JavaLineArrayCPOF
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
export class clsUtilityCPOF {
|
|
34
|
-
|
|
35
|
-
private static readonly _className: string = "clsUtilityCPOF";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @param ptLatLong
|
|
40
|
-
* @param converter
|
|
41
|
-
* @return
|
|
42
|
-
*/
|
|
43
|
-
private static PointLatLongToPixels(ptLatLong: POINT2,
|
|
44
|
-
converter: IPointConversion): POINT2 {
|
|
45
|
-
let pt: POINT2 = new POINT2();
|
|
46
|
-
try {
|
|
47
|
-
let x: double = ptLatLong.x;
|
|
48
|
-
let y: double = ptLatLong.y;
|
|
49
|
-
let ptPixels: Point2D = converter.GeoToPixels(new Point2D(x, y));
|
|
50
|
-
pt.x = ptPixels.getX();
|
|
51
|
-
pt.y = ptPixels.getY();
|
|
52
|
-
pt.style = ptLatLong.style;
|
|
53
|
-
|
|
54
|
-
} catch (exc) {
|
|
55
|
-
if (exc instanceof Error) {
|
|
56
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "PointLatLongToPixels",
|
|
57
|
-
new RendererException("Failed inside PointLatLongToPixels", exc));
|
|
58
|
-
} else {
|
|
59
|
-
throw exc;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return pt;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* for the change 1 fire support areas
|
|
67
|
-
*
|
|
68
|
-
* @param tg
|
|
69
|
-
* @param lineType
|
|
70
|
-
* @param radius
|
|
71
|
-
* @param width
|
|
72
|
-
* @param length
|
|
73
|
-
* @param attitude
|
|
74
|
-
*/
|
|
75
|
-
private static GetNumericFields(tg: TGLight,
|
|
76
|
-
lineType: int,
|
|
77
|
-
radius: ref<number[]>,
|
|
78
|
-
width: ref<number[]>,
|
|
79
|
-
length: ref<number[]>,
|
|
80
|
-
attitude: ref<number[]>): void {
|
|
81
|
-
try {
|
|
82
|
-
if (lineType === TacticalLines.RANGE_FAN_FILL) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
let dist: double = 0;
|
|
86
|
-
let a12: ref<number[]> = new ref();
|
|
87
|
-
let a21: ref<number[]> = new ref();
|
|
88
|
-
let pt0: POINT2 = new POINT2(0, 0);
|
|
89
|
-
let pt1: POINT2 = new POINT2(0, 0);
|
|
90
|
-
radius.value = new Array<number>(1);
|
|
91
|
-
width.value = new Array<number>(1);
|
|
92
|
-
attitude.value = new Array<number>(1);
|
|
93
|
-
length.value = new Array<number>(1);
|
|
94
|
-
switch (lineType) {
|
|
95
|
-
case TacticalLines.CIRCULAR:
|
|
96
|
-
case TacticalLines.PBS_CIRCLE:
|
|
97
|
-
case TacticalLines.BDZ:
|
|
98
|
-
case TacticalLines.BBS_POINT:
|
|
99
|
-
case TacticalLines.FSA_CIRCULAR:
|
|
100
|
-
case TacticalLines.NOTACK:
|
|
101
|
-
case TacticalLines.FFA_CIRCULAR:
|
|
102
|
-
case TacticalLines.NFA_CIRCULAR:
|
|
103
|
-
case TacticalLines.RFA_CIRCULAR:
|
|
104
|
-
case TacticalLines.PAA_CIRCULAR:
|
|
105
|
-
case TacticalLines.ATI_CIRCULAR:
|
|
106
|
-
case TacticalLines.CFFZ_CIRCULAR:
|
|
107
|
-
case TacticalLines.SENSOR_CIRCULAR:
|
|
108
|
-
case TacticalLines.CENSOR_CIRCULAR:
|
|
109
|
-
case TacticalLines.DA_CIRCULAR:
|
|
110
|
-
case TacticalLines.CFZ_CIRCULAR:
|
|
111
|
-
case TacticalLines.ZOR_CIRCULAR:
|
|
112
|
-
case TacticalLines.TBA_CIRCULAR:
|
|
113
|
-
case TacticalLines.TVAR_CIRCULAR:
|
|
114
|
-
case TacticalLines.ACA_CIRCULAR:
|
|
115
|
-
case TacticalLines.KILLBOXBLUE_CIRCULAR:
|
|
116
|
-
case TacticalLines.KILLBOXPURPLE_CIRCULAR: {
|
|
117
|
-
if (SymbolUtilities.isNumber(tg.get_AM())) {
|
|
118
|
-
radius.value[0] = parseFloat(tg.get_AM());
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
case TacticalLines.LAUNCH_AREA:
|
|
124
|
-
case TacticalLines.DEFENDED_AREA_CIRCULAR:
|
|
125
|
-
case TacticalLines.SHIP_AOI_CIRCULAR:
|
|
126
|
-
case TacticalLines.PBS_ELLIPSE: {
|
|
127
|
-
//minor radius in meters
|
|
128
|
-
if (SymbolUtilities.isNumber(tg.get_AM1())) {
|
|
129
|
-
length.value[0] = parseFloat(tg.get_AM1());
|
|
130
|
-
}
|
|
131
|
-
//major radius in meters
|
|
132
|
-
if (SymbolUtilities.isNumber(tg.get_AM())) {
|
|
133
|
-
width.value[0] = parseFloat(tg.get_AM());
|
|
134
|
-
}
|
|
135
|
-
//rotation angle in degrees
|
|
136
|
-
if (SymbolUtilities.isNumber(tg.get_AN())) {
|
|
137
|
-
attitude.value[0] = parseFloat(tg.get_AN());
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
case TacticalLines.RECTANGULAR: {
|
|
144
|
-
if (SymbolUtilities.isNumber(tg.get_AM1())) {
|
|
145
|
-
length.value[0] = parseFloat(tg.get_AM1());
|
|
146
|
-
}
|
|
147
|
-
if (SymbolUtilities.isNumber(tg.get_AM())) {
|
|
148
|
-
width.value[0] = parseFloat(tg.get_AM());
|
|
149
|
-
}
|
|
150
|
-
//assume that attitude was passed in mils
|
|
151
|
-
//so we must multiply by 360/6400 to convert to degrees
|
|
152
|
-
if (SymbolUtilities.isNumber(tg.get_AN())) {
|
|
153
|
-
attitude.value[0] = parseFloat(tg.get_AN()) * (360 / 6400);
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
case TacticalLines.PBS_RECTANGLE:
|
|
159
|
-
case TacticalLines.PBS_SQUARE: {
|
|
160
|
-
if (SymbolUtilities.isNumber(tg.get_AM1())) {
|
|
161
|
-
length.value[0] = parseFloat(tg.get_AM1());
|
|
162
|
-
}
|
|
163
|
-
if (SymbolUtilities.isNumber(tg.get_AM())) {
|
|
164
|
-
width.value[0] = parseFloat(tg.get_AM());
|
|
165
|
-
}
|
|
166
|
-
//assume that attitude was passed in mils
|
|
167
|
-
//so we must multiply by 360/6400 to convert to degrees
|
|
168
|
-
if (SymbolUtilities.isNumber(tg.get_AN())) {
|
|
169
|
-
attitude.value[0] = parseFloat(tg.get_AN());
|
|
170
|
-
}
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
case TacticalLines.CUED_ACQUISITION: {
|
|
175
|
-
if (SymbolUtilities.isNumber(tg.get_AM())) {
|
|
176
|
-
length.value[0] = parseFloat(tg.get_AM());
|
|
177
|
-
}
|
|
178
|
-
if (SymbolUtilities.isNumber(tg.get_AM1())) {
|
|
179
|
-
width.value[0] = parseFloat(tg.get_AM1());
|
|
180
|
-
}
|
|
181
|
-
if (SymbolUtilities.isNumber(tg.get_AN())) {
|
|
182
|
-
// Make 0 degrees point north instead of East
|
|
183
|
-
attitude.value[0] = parseFloat(tg.get_AN()) + 270;
|
|
184
|
-
}
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
case TacticalLines.PAA_RECTANGULAR:
|
|
189
|
-
case TacticalLines.FSA_RECTANGULAR:
|
|
190
|
-
case TacticalLines.SHIP_AOI_RECTANGULAR:
|
|
191
|
-
case TacticalLines.DEFENDED_AREA_RECTANGULAR:
|
|
192
|
-
case TacticalLines.FFA_RECTANGULAR:
|
|
193
|
-
case TacticalLines.ACA_RECTANGULAR:
|
|
194
|
-
case TacticalLines.NFA_RECTANGULAR:
|
|
195
|
-
case TacticalLines.RFA_RECTANGULAR:
|
|
196
|
-
case TacticalLines.ATI_RECTANGULAR:
|
|
197
|
-
case TacticalLines.CFFZ_RECTANGULAR:
|
|
198
|
-
case TacticalLines.SENSOR_RECTANGULAR:
|
|
199
|
-
case TacticalLines.CENSOR_RECTANGULAR:
|
|
200
|
-
case TacticalLines.DA_RECTANGULAR:
|
|
201
|
-
case TacticalLines.CFZ_RECTANGULAR:
|
|
202
|
-
case TacticalLines.ZOR_RECTANGULAR:
|
|
203
|
-
case TacticalLines.TBA_RECTANGULAR:
|
|
204
|
-
case TacticalLines.TVAR_RECTANGULAR:
|
|
205
|
-
case TacticalLines.KILLBOXBLUE_RECTANGULAR:
|
|
206
|
-
case TacticalLines.KILLBOXPURPLE_RECTANGULAR:
|
|
207
|
-
case TacticalLines.RECTANGULAR_TARGET: {
|
|
208
|
-
if (tg.LatLongs.length >= 2) {
|
|
209
|
-
//get the length and the attitude in mils
|
|
210
|
-
pt0 = tg.LatLongs[0];
|
|
211
|
-
pt1 = tg.LatLongs[1];
|
|
212
|
-
dist = mdlGeodesic.geodesic_distance(pt0, pt1, a12, a21);
|
|
213
|
-
attitude.value[0] = a12.value[0];
|
|
214
|
-
}
|
|
215
|
-
if (SymbolUtilities.isNumber(tg.get_AM())) {
|
|
216
|
-
width.value[0] = parseFloat(tg.get_AM());
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
default: {
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
} catch (exc) {
|
|
227
|
-
if (exc instanceof Error) {
|
|
228
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "GetNumericFields",
|
|
229
|
-
new RendererException("Failed inside GetNumericFields", exc));
|
|
230
|
-
} else {
|
|
231
|
-
throw exc;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Do a 360 degree horizontal shift for points on either side of the
|
|
238
|
-
* midpoint of the display, if the MBR for the pixels is greater than 180
|
|
239
|
-
* degrees wide. Builds pixels for two symbols to draw a symbol flipped
|
|
240
|
-
* about the left edge and also a symbol flipped about the right edge. This
|
|
241
|
-
* function is typically used at world view. Caller must instantiate last
|
|
242
|
-
* two parameters.
|
|
243
|
-
*
|
|
244
|
-
* @param tg
|
|
245
|
-
* @param converter
|
|
246
|
-
* @param farLeftPixels - OUT - the resultant pixels for left shift symbol
|
|
247
|
-
* @param farRightPixels - OUT - the result pixels for the right shift
|
|
248
|
-
* symbol
|
|
249
|
-
*/
|
|
250
|
-
static GetFarPixels(tg: TGLight,
|
|
251
|
-
converter: IPointConversion,
|
|
252
|
-
farLeftPixels: POINT2[],
|
|
253
|
-
farRightPixels: POINT2[]): void {
|
|
254
|
-
try {
|
|
255
|
-
if (farLeftPixels == null || farRightPixels == null) {
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
|
-
//Cannot use tg.LatLon to get width in degrees because it shifts +/-180 at IDL.
|
|
259
|
-
//Get degrees per pixel longitude, will use it for determining width in degrees
|
|
260
|
-
let ptPixels50: Point2D = converter.GeoToPixels(new Point2D(50, 30));
|
|
261
|
-
let ptPixels60: Point2D = converter.GeoToPixels(new Point2D(60, 30));
|
|
262
|
-
let degLonPerPixel: double = 10 / Math.abs(ptPixels60.getX() - ptPixels50.getX());
|
|
263
|
-
let j: int = 0;
|
|
264
|
-
let minX: double = Number.MAX_VALUE;
|
|
265
|
-
let maxX: double = -Number.MAX_VALUE;
|
|
266
|
-
let n: int = tg.Pixels.length;
|
|
267
|
-
//for(j=0;j<tg.Pixels.length;j++)
|
|
268
|
-
for (j = 0; j < n; j++) {
|
|
269
|
-
if (tg.Pixels[j].x < minX) {
|
|
270
|
-
minX = tg.Pixels[j].x;
|
|
271
|
-
}
|
|
272
|
-
if (tg.Pixels[j].x > maxX) {
|
|
273
|
-
maxX = tg.Pixels[j].x;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
let degWidth: double = (maxX - minX) * degLonPerPixel;
|
|
277
|
-
if (Math.abs(degWidth) < 180) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
//if it did not return then we must shift the pixels left and right
|
|
282
|
-
//first get the midpoint X value to use for partitioning the points
|
|
283
|
-
let midX: double = Math.abs(180 / degLonPerPixel);
|
|
284
|
-
let x: double = 0;
|
|
285
|
-
let y: double = 0;
|
|
286
|
-
//do a shift about the left hand side
|
|
287
|
-
//for(j=0;j<tg.Pixels.length;j++)
|
|
288
|
-
for (j = 0; j < n; j++) {
|
|
289
|
-
x = tg.Pixels[j].x;
|
|
290
|
-
y = tg.Pixels[j].y;
|
|
291
|
-
if (x > midX) {
|
|
292
|
-
//shift x left by 360 degrees in pixels
|
|
293
|
-
x -= 2 * midX;
|
|
294
|
-
}
|
|
295
|
-
//else do not shift the point
|
|
296
|
-
//add the shifted (or not) point to the new arraylist
|
|
297
|
-
farLeftPixels.push(new POINT2(x, y));
|
|
298
|
-
}
|
|
299
|
-
//do a shift about the right hand side
|
|
300
|
-
//for(j=0;j<tg.Pixels.length;j++)
|
|
301
|
-
for (j = 0; j < n; j++) {
|
|
302
|
-
x = tg.Pixels[j].x;
|
|
303
|
-
y = tg.Pixels[j].y;
|
|
304
|
-
if (x < midX) {
|
|
305
|
-
//shift x right by 360 degrees in pixels
|
|
306
|
-
x += 2 * midX;
|
|
307
|
-
}
|
|
308
|
-
//else do not shift the point
|
|
309
|
-
//add the shifted (or not) point to the new arraylist
|
|
310
|
-
farRightPixels.push(new POINT2(x, y));
|
|
311
|
-
}
|
|
312
|
-
} catch (exc) {
|
|
313
|
-
if (exc instanceof Error) {
|
|
314
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "GetFarPixels",
|
|
315
|
-
new RendererException("Failed inside GetFarPixels", exc));
|
|
316
|
-
} else {
|
|
317
|
-
throw exc;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
*
|
|
324
|
-
* @param tg
|
|
325
|
-
* @param lineType
|
|
326
|
-
* @param converter
|
|
327
|
-
* @param shapes
|
|
328
|
-
* @return
|
|
329
|
-
*/
|
|
330
|
-
static Change1TacticalAreas(tg: TGLight,
|
|
331
|
-
lineType: int, converter: IPointConversion, shapes: Array<Shape2>): boolean {
|
|
332
|
-
try {
|
|
333
|
-
let width: ref<number[]> = new ref();
|
|
334
|
-
let length: ref<number[]> = new ref();
|
|
335
|
-
let attitude: ref<number[]> = new ref();
|
|
336
|
-
let radius: ref<number[]> = new ref();
|
|
337
|
-
let j: int = 0;
|
|
338
|
-
let pt0: POINT2 = tg.LatLongs[0];
|
|
339
|
-
let pt1: POINT2;
|
|
340
|
-
let ptTemp: POINT2 = new POINT2();
|
|
341
|
-
let pt00: POINT2 = new POINT2();
|
|
342
|
-
if (tg.LatLongs.length > 1) {
|
|
343
|
-
pt1 = tg.LatLongs[1];
|
|
344
|
-
} else {
|
|
345
|
-
pt1 = tg.LatLongs[0];
|
|
346
|
-
}
|
|
347
|
-
let pPoints: POINT2[];
|
|
348
|
-
let ptCenter: POINT2 = clsUtilityCPOF.PointLatLongToPixels(pt0, converter);
|
|
349
|
-
|
|
350
|
-
clsUtilityCPOF.GetNumericFields(tg, lineType, radius, width, length, attitude);
|
|
351
|
-
switch (lineType) {
|
|
352
|
-
case TacticalLines.LAUNCH_AREA:
|
|
353
|
-
case TacticalLines.DEFENDED_AREA_CIRCULAR:
|
|
354
|
-
case TacticalLines.SHIP_AOI_CIRCULAR:
|
|
355
|
-
case TacticalLines.PBS_ELLIPSE: {
|
|
356
|
-
let ellipsePts: POINT2[] = mdlGeodesic.getGeoEllipse(pt0, width.value[0], length.value[0], attitude.value[0]);
|
|
357
|
-
for (j = 0; j < ellipsePts.length; j++) //was 103
|
|
358
|
-
{
|
|
359
|
-
pt0 = ellipsePts[j];
|
|
360
|
-
pt1 = clsUtilityCPOF.PointLatLongToPixels(pt0, converter);
|
|
361
|
-
tg.Pixels.push(pt1);
|
|
362
|
-
}
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
case TacticalLines.PAA_RECTANGULAR:
|
|
367
|
-
case TacticalLines.FSA_RECTANGULAR:
|
|
368
|
-
case TacticalLines.SHIP_AOI_RECTANGULAR:
|
|
369
|
-
case TacticalLines.DEFENDED_AREA_RECTANGULAR:
|
|
370
|
-
case TacticalLines.FFA_RECTANGULAR:
|
|
371
|
-
case TacticalLines.ACA_RECTANGULAR:
|
|
372
|
-
case TacticalLines.NFA_RECTANGULAR:
|
|
373
|
-
case TacticalLines.RFA_RECTANGULAR:
|
|
374
|
-
case TacticalLines.ATI_RECTANGULAR:
|
|
375
|
-
case TacticalLines.CFFZ_RECTANGULAR:
|
|
376
|
-
case TacticalLines.SENSOR_RECTANGULAR:
|
|
377
|
-
case TacticalLines.CENSOR_RECTANGULAR:
|
|
378
|
-
case TacticalLines.DA_RECTANGULAR:
|
|
379
|
-
case TacticalLines.CFZ_RECTANGULAR:
|
|
380
|
-
case TacticalLines.ZOR_RECTANGULAR:
|
|
381
|
-
case TacticalLines.TBA_RECTANGULAR:
|
|
382
|
-
case TacticalLines.TVAR_RECTANGULAR:
|
|
383
|
-
case TacticalLines.KILLBOXBLUE_RECTANGULAR:
|
|
384
|
-
case TacticalLines.KILLBOXPURPLE_RECTANGULAR: {
|
|
385
|
-
//get the upper left corner
|
|
386
|
-
pt00 = mdlGeodesic.geodesic_coordinate(pt0, width.value[0] / 2, attitude.value[0] - 90);
|
|
387
|
-
pt00 = clsUtilityCPOF.PointLatLongToPixels(pt00, converter);
|
|
388
|
-
|
|
389
|
-
pt00.style = 0;
|
|
390
|
-
tg.Pixels.push(pt00);
|
|
391
|
-
|
|
392
|
-
//second corner (clockwise from center)
|
|
393
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt0, width.value[0] / 2, attitude.value[0] + 90);
|
|
394
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
395
|
-
ptTemp.style = 0;
|
|
396
|
-
tg.Pixels.push(ptTemp);
|
|
397
|
-
|
|
398
|
-
//third corner (clockwise from center)
|
|
399
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt1, width.value[0] / 2, attitude.value[0] + 90);
|
|
400
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
401
|
-
ptTemp.style = 0;
|
|
402
|
-
tg.Pixels.push(ptTemp);
|
|
403
|
-
|
|
404
|
-
//fourth corner (clockwise from center)
|
|
405
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt1, width.value[0] / 2, attitude.value[0] - 90);
|
|
406
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
407
|
-
ptTemp.style = 0;
|
|
408
|
-
tg.Pixels.push(ptTemp);
|
|
409
|
-
|
|
410
|
-
tg.Pixels.push(pt00);
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
case TacticalLines.RECTANGULAR_TARGET: {
|
|
415
|
-
let pts: POINT2[] = new Array<POINT2>(4); // 4 Corners
|
|
416
|
-
|
|
417
|
-
// get the upper left corner
|
|
418
|
-
pts[0] = mdlGeodesic.geodesic_coordinate(pt0, width.value[0] / 2, attitude.value[0] - 90);
|
|
419
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(pts[0], converter);
|
|
420
|
-
ptTemp.style = 0;
|
|
421
|
-
tg.Pixels.push(ptTemp);
|
|
422
|
-
|
|
423
|
-
// second corner (clockwise from center)
|
|
424
|
-
pts[1] = mdlGeodesic.geodesic_coordinate(pt0, width.value[0] / 2, attitude.value[0] + 90);
|
|
425
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(pts[1], converter);
|
|
426
|
-
ptTemp.style = 0;
|
|
427
|
-
tg.Pixels.push(ptTemp);
|
|
428
|
-
|
|
429
|
-
// third corner (clockwise from center)
|
|
430
|
-
pts[2] = mdlGeodesic.geodesic_coordinate(pt1, width.value[0] / 2, attitude.value[0] + 90);
|
|
431
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(pts[2], converter);
|
|
432
|
-
ptTemp.style = 0;
|
|
433
|
-
tg.Pixels.push(ptTemp);
|
|
434
|
-
|
|
435
|
-
// fourth corner (clockwise from center)
|
|
436
|
-
pts[3] = mdlGeodesic.geodesic_coordinate(pt1, width.value[0] / 2, attitude.value[0] - 90);
|
|
437
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(pts[3], converter);
|
|
438
|
-
ptTemp.style = 0;
|
|
439
|
-
tg.Pixels.push(ptTemp);
|
|
440
|
-
|
|
441
|
-
// Close shape
|
|
442
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(pts[0], converter);
|
|
443
|
-
ptTemp.style = 5;
|
|
444
|
-
tg.Pixels.push(ptTemp);
|
|
445
|
-
|
|
446
|
-
let heightD: double = mdlGeodesic.geodesic_distance(pts[0], pts[1], null, null);
|
|
447
|
-
let widthD: double = mdlGeodesic.geodesic_distance(pts[1], pts[2], null, null);
|
|
448
|
-
let crossLength: double = Math.min(heightD, widthD) * .4; // Length from center
|
|
449
|
-
|
|
450
|
-
let centerPt: POINT2 = lineutility.CalcCenterPointDouble2(pts, 4);
|
|
451
|
-
|
|
452
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(centerPt, crossLength, 0);
|
|
453
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
454
|
-
ptTemp.style = 0;
|
|
455
|
-
tg.Pixels.push(ptTemp);
|
|
456
|
-
|
|
457
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(centerPt, crossLength, 180);
|
|
458
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
459
|
-
ptTemp.style = 5;
|
|
460
|
-
tg.Pixels.push(ptTemp);
|
|
461
|
-
|
|
462
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(centerPt, crossLength, -90);
|
|
463
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
464
|
-
ptTemp.style = 0;
|
|
465
|
-
tg.Pixels.push(ptTemp);
|
|
466
|
-
|
|
467
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(centerPt, crossLength, 90);
|
|
468
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
469
|
-
ptTemp.style = 0;
|
|
470
|
-
tg.Pixels.push(ptTemp);
|
|
471
|
-
break;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
case TacticalLines.RECTANGULAR:
|
|
475
|
-
case TacticalLines.PBS_RECTANGLE:
|
|
476
|
-
case TacticalLines.PBS_SQUARE:
|
|
477
|
-
case TacticalLines.CUED_ACQUISITION: {
|
|
478
|
-
//AFATDS swap length and width
|
|
479
|
-
//comment next three lines to render per Mil-Std-2525
|
|
480
|
-
//double temp=width.value[0];
|
|
481
|
-
//width.value[0]=length.value[0];
|
|
482
|
-
//length.value[0]=temp;
|
|
483
|
-
|
|
484
|
-
//get the upper left corner
|
|
485
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt0, length.value[0] / 2, attitude.value[0] - 90);//was length was -90
|
|
486
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(ptTemp, width.value[0] / 2, attitude.value[0] + 0);//was width was 0
|
|
487
|
-
|
|
488
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
489
|
-
tg.Pixels.push(ptTemp);
|
|
490
|
-
//second corner (clockwise from center)
|
|
491
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt0, length.value[0] / 2, attitude.value[0] + 90); //was length was +90
|
|
492
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(ptTemp, width.value[0] / 2, attitude.value[0] + 0); //was width was 0
|
|
493
|
-
|
|
494
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
495
|
-
|
|
496
|
-
tg.Pixels.push(ptTemp);
|
|
497
|
-
|
|
498
|
-
//third corner (clockwise from center)
|
|
499
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt0, length.value[0] / 2, attitude.value[0] + 90);//was length was +90
|
|
500
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(ptTemp, width.value[0] / 2, attitude.value[0] + 180);//was width was +180
|
|
501
|
-
|
|
502
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
503
|
-
|
|
504
|
-
tg.Pixels.push(ptTemp);
|
|
505
|
-
|
|
506
|
-
//fouth corner (clockwise from center)
|
|
507
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt0, length.value[0] / 2, attitude.value[0] - 90);//was length was -90
|
|
508
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(ptTemp, width.value[0] / 2, attitude.value[0] + 180);//was width was +180
|
|
509
|
-
|
|
510
|
-
ptTemp = clsUtilityCPOF.PointLatLongToPixels(ptTemp, converter);
|
|
511
|
-
tg.Pixels.push(ptTemp);
|
|
512
|
-
tg.Pixels.push(new POINT2(tg.Pixels[0].x, tg.Pixels[0].y));
|
|
513
|
-
break;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
case TacticalLines.CIRCULAR:
|
|
517
|
-
case TacticalLines.PBS_CIRCLE:
|
|
518
|
-
case TacticalLines.BDZ:
|
|
519
|
-
case TacticalLines.BBS_POINT:
|
|
520
|
-
case TacticalLines.FSA_CIRCULAR:
|
|
521
|
-
case TacticalLines.NOTACK:
|
|
522
|
-
case TacticalLines.ACA_CIRCULAR:
|
|
523
|
-
case TacticalLines.FFA_CIRCULAR:
|
|
524
|
-
case TacticalLines.NFA_CIRCULAR:
|
|
525
|
-
case TacticalLines.RFA_CIRCULAR:
|
|
526
|
-
case TacticalLines.PAA_CIRCULAR:
|
|
527
|
-
case TacticalLines.ATI_CIRCULAR:
|
|
528
|
-
case TacticalLines.CFFZ_CIRCULAR:
|
|
529
|
-
case TacticalLines.SENSOR_CIRCULAR:
|
|
530
|
-
case TacticalLines.CENSOR_CIRCULAR:
|
|
531
|
-
case TacticalLines.DA_CIRCULAR:
|
|
532
|
-
case TacticalLines.CFZ_CIRCULAR:
|
|
533
|
-
case TacticalLines.ZOR_CIRCULAR:
|
|
534
|
-
case TacticalLines.TBA_CIRCULAR:
|
|
535
|
-
case TacticalLines.TVAR_CIRCULAR:
|
|
536
|
-
case TacticalLines.KILLBOXBLUE_CIRCULAR:
|
|
537
|
-
case TacticalLines.KILLBOXPURPLE_CIRCULAR: {
|
|
538
|
-
//get a horizontal point on the radius
|
|
539
|
-
pt0 = tg.LatLongs[0];
|
|
540
|
-
|
|
541
|
-
ptTemp = mdlGeodesic.geodesic_coordinate(pt0, radius.value[0], 90);
|
|
542
|
-
|
|
543
|
-
pPoints = new Array<POINT2>(3);
|
|
544
|
-
pPoints[0] = new POINT2(pt0);
|
|
545
|
-
pPoints[1] = new POINT2(ptTemp);
|
|
546
|
-
pPoints[2] = new POINT2(ptTemp);
|
|
547
|
-
|
|
548
|
-
let pPoints2: Array<POINT2> = mdlGeodesic.GetGeodesicArc(pPoints);
|
|
549
|
-
let ptTemp2: POINT2;
|
|
550
|
-
//fill pixels and latlongs
|
|
551
|
-
for (j = 0; j < pPoints2.length; j++) //was 103
|
|
552
|
-
{
|
|
553
|
-
pt0 = pPoints2[j];
|
|
554
|
-
ptTemp2 = new POINT2();
|
|
555
|
-
ptTemp2 = clsUtilityCPOF.PointLatLongToPixels(pt0, converter);
|
|
556
|
-
|
|
557
|
-
tg.Pixels.push(ptTemp2);
|
|
558
|
-
}
|
|
559
|
-
break;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
case TacticalLines.RANGE_FAN: {
|
|
563
|
-
//get the concentric circles
|
|
564
|
-
clsUtilityCPOF.GetConcentricCircles(tg, lineType, converter);
|
|
565
|
-
//Mil-Std-2525 Rev C does not have the orientation arrow
|
|
566
|
-
//assume we are using Rev C if there is only 1 anchor point
|
|
567
|
-
if (tg.LatLongs.length > 1) {
|
|
568
|
-
clsUtilityCPOF.RangeFanOrientation(tg, lineType, converter);
|
|
569
|
-
}
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
case TacticalLines.RANGE_FAN_SECTOR: {
|
|
574
|
-
clsUtilityCPOF.GetSectorRangeFan(tg, converter);
|
|
575
|
-
clsUtilityCPOF.RangeFanOrientation(tg, lineType, converter);
|
|
576
|
-
break;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
case TacticalLines.RADAR_SEARCH: {
|
|
580
|
-
clsUtilityCPOF.GetSectorRangeFan(tg, converter);
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
case TacticalLines.RANGE_FAN_FILL: { //circular range fan calls Change1TacticalAreas twice
|
|
585
|
-
clsUtilityCPOF.GetSectorRangeFan(tg, converter);
|
|
586
|
-
break;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
default: {
|
|
590
|
-
return false;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
//the shapes
|
|
596
|
-
let farLeftPixels: Array<POINT2> = new Array();
|
|
597
|
-
let farRightPixels: Array<POINT2> = new Array();
|
|
598
|
-
clsUtilityCPOF.GetFarPixels(tg, converter, farLeftPixels, farRightPixels);
|
|
599
|
-
let shapesLeft: Array<Shape2> = new Array();
|
|
600
|
-
let shapesRight: Array<Shape2> = new Array();
|
|
601
|
-
//ArrayList<Shape2>shapes=null; //use this to collect all the shapes
|
|
602
|
-
|
|
603
|
-
if (farLeftPixels.length === 0 || farRightPixels.length === 0) {
|
|
604
|
-
//diagnostic
|
|
605
|
-
//Change1PixelsToShapes(tg,shapes);
|
|
606
|
-
let tempPixels: Array<POINT2> = new Array();
|
|
607
|
-
tempPixels.push(...tg.Pixels);
|
|
608
|
-
clsUtilityCPOF.postSegmentFSA(tg, converter);
|
|
609
|
-
clsUtilityCPOF.Change1PixelsToShapes(tg, shapes, false);
|
|
610
|
-
//reuse the original pixels for the subsequent call to AddModifier2
|
|
611
|
-
tg.Pixels = tempPixels;
|
|
612
|
-
//end section
|
|
613
|
-
} else //symbol was more than 180 degrees wide, use left and right symbols
|
|
614
|
-
{
|
|
615
|
-
//set tg.Pixels to the left shapes for the call to Change1PixelsToShapes
|
|
616
|
-
tg.Pixels = farLeftPixels;
|
|
617
|
-
clsUtilityCPOF.Change1PixelsToShapes(tg, shapesLeft, false);
|
|
618
|
-
//set tg.Pixels to the right shapes for the call to Change1PixelsToShapes
|
|
619
|
-
tg.Pixels = farRightPixels;
|
|
620
|
-
clsUtilityCPOF.Change1PixelsToShapes(tg, shapesRight, false);
|
|
621
|
-
//load left and right shapes into shapes
|
|
622
|
-
shapes.push(...shapesLeft);
|
|
623
|
-
shapes.push(...shapesRight);
|
|
624
|
-
}
|
|
625
|
-
if (lineType == TacticalLines.BBS_POINT) {
|
|
626
|
-
let shape: Shape2 = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
|
|
627
|
-
shape.moveTo(ptCenter);
|
|
628
|
-
//ptCenter.x+=1;
|
|
629
|
-
ptCenter.y += 1;
|
|
630
|
-
shape.lineTo(ptCenter);
|
|
631
|
-
shapes.push(shape);
|
|
632
|
-
}
|
|
633
|
-
if (lineType == TacticalLines.PBS_RECTANGLE || lineType == TacticalLines.PBS_SQUARE)
|
|
634
|
-
{
|
|
635
|
-
let dist: double = radius.value[0];//Double.parseDouble(strH1);
|
|
636
|
-
pt0 = new POINT2(tg.LatLongs[0]);
|
|
637
|
-
pt1 = mdlGeodesic.geodesic_coordinate(pt0, dist, 45);//45 is arbitrary
|
|
638
|
-
let pt02d: Point2D = new Point2D(pt0.x, pt0.y);
|
|
639
|
-
let pt12d: Point2D = new Point2D(pt1.x, pt1.y);
|
|
640
|
-
pt02d = converter.GeoToPixels(pt02d);
|
|
641
|
-
pt12d = converter.GeoToPixels(pt12d);
|
|
642
|
-
pt0.x = pt02d.getX();
|
|
643
|
-
pt0.y = pt02d.getY();
|
|
644
|
-
pt1.x = pt12d.getX();
|
|
645
|
-
pt1.y = pt12d.getY();
|
|
646
|
-
dist = lineutility.CalcDistanceDouble(pt0, pt1); //pixels distance
|
|
647
|
-
//tg.Pixels.get(0).style=(int)dist;
|
|
648
|
-
let tempPixels: Array<POINT2> = [];
|
|
649
|
-
tempPixels.push(...tg.Pixels);
|
|
650
|
-
let pts: POINT2[] = tempPixels;
|
|
651
|
-
pts[0].style=Math.trunc(dist);
|
|
652
|
-
lineutility.getExteriorPoints(pts, pts.length, lineType, false);
|
|
653
|
-
tg.Pixels.length = 0;
|
|
654
|
-
for(j=0;j<pts.length;j++)
|
|
655
|
-
tg.Pixels.push(new POINT2(pts[j].x,pts[j].y));
|
|
656
|
-
|
|
657
|
-
clsUtilityCPOF.Change1PixelsToShapes(tg, shapes, true);
|
|
658
|
-
//reuse the original pixels for the subsequent call to AddModifier2
|
|
659
|
-
tg.Pixels = tempPixels;
|
|
660
|
-
}
|
|
661
|
-
return true;
|
|
662
|
-
} catch (exc) {
|
|
663
|
-
if (exc instanceof Error) {
|
|
664
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "Change1TacticalAreas",
|
|
665
|
-
new RendererException("Failed inside Change1TacticalAreas", exc));
|
|
666
|
-
} else {
|
|
667
|
-
throw exc;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
return false;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* build shapes arraylist from tg.Pixels for the Change 1 symbols
|
|
675
|
-
*
|
|
676
|
-
* @param tg
|
|
677
|
-
* @param shapes - OUT - caller instantiates the arraylist
|
|
678
|
-
*/
|
|
679
|
-
private static Change1PixelsToShapes(tg: TGLight, shapes: Array<Shape2>, fill: boolean): void {
|
|
680
|
-
let shape: Shape2;
|
|
681
|
-
let beginLine: boolean = true;
|
|
682
|
-
let currentPt: POINT2;
|
|
683
|
-
let lastPt: POINT2;
|
|
684
|
-
let k: int = 0;
|
|
685
|
-
let linetype: int = tg.get_LineType();
|
|
686
|
-
let n: int = tg.Pixels.length;
|
|
687
|
-
//a loop for the outline shapes
|
|
688
|
-
//for (k = 0; k < tg.Pixels.length; k++)
|
|
689
|
-
for (k = 0; k < n; k++) {
|
|
690
|
-
//use shapes instead of pixels
|
|
691
|
-
if (shape == null) {
|
|
692
|
-
//shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
|
|
693
|
-
if (!fill) {
|
|
694
|
-
|
|
695
|
-
shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
else {
|
|
699
|
-
if (fill) {
|
|
700
|
-
|
|
701
|
-
shape = new Shape2(Shape2.SHAPE_TYPE_FILL);
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
currentPt = tg.Pixels[k];
|
|
709
|
-
if (k > 0) {
|
|
710
|
-
lastPt = tg.Pixels[k - 1];
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
if (beginLine) {
|
|
714
|
-
if (k === 0) {
|
|
715
|
-
shape.set_Style(currentPt.style);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
if (k > 0) //doubled points with linestyle=5
|
|
719
|
-
{
|
|
720
|
-
if (currentPt.style === 5 && lastPt.style === 5) {
|
|
721
|
-
shape.lineTo(currentPt);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
shape.moveTo(currentPt);
|
|
726
|
-
beginLine = false;
|
|
727
|
-
} else {
|
|
728
|
-
shape.lineTo(currentPt);
|
|
729
|
-
if (currentPt.style === 5 || currentPt.style === 10) {
|
|
730
|
-
beginLine = true;
|
|
731
|
-
//unless there are doubled points with style=5
|
|
732
|
-
if (linetype === TacticalLines.RANGE_FAN_FILL && k < tg.Pixels.length - 1) {
|
|
733
|
-
shapes.push(shape);
|
|
734
|
-
shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
if (k === tg.Pixels.length - 1) //PBS shapes have 2 shapes, other non-LC symbols have 1 shape
|
|
739
|
-
{
|
|
740
|
-
//shapes.push(shape);
|
|
741
|
-
if (shape.getShapeType() === ShapeInfo.SHAPE_TYPE_FILL) {
|
|
742
|
-
|
|
743
|
-
shapes.splice(0, 0, shape);
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
else {
|
|
747
|
-
|
|
748
|
-
shapes.push(shape);
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
} //end for
|
|
753
|
-
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
private static GetConcentricCircles(tg: TGLight, lineType: int, converter: IPointConversion): void {
|
|
757
|
-
try {
|
|
758
|
-
let j: int = 0;
|
|
759
|
-
let l: int = 0;
|
|
760
|
-
let radius: double = 0;
|
|
761
|
-
|
|
762
|
-
let pt: POINT2 = new POINT2();
|
|
763
|
-
let pts: Array<POINT2> = new Array();
|
|
764
|
-
let radii: number[]; // AM
|
|
765
|
-
let strAM: string = tg.get_AM();
|
|
766
|
-
if (tg.LatLongs.length === 1 && strAM != null) {
|
|
767
|
-
let strs: string[] = strAM.split(",");
|
|
768
|
-
radii = new Array<number>(strs.length);
|
|
769
|
-
for (j = 0; j < strs.length; j++) {
|
|
770
|
-
radii[j] = parseFloat(strs[j]);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
let n: int = radii.length;
|
|
775
|
-
|
|
776
|
-
//loop thru the circles
|
|
777
|
-
let pPoints: POINT2[];
|
|
778
|
-
for (l = 0; l < n; l++) {
|
|
779
|
-
radius = radii[l];
|
|
780
|
-
if (radius === 0) {
|
|
781
|
-
continue;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
pPoints = new Array<POINT2>(3);
|
|
785
|
-
pt = tg.LatLongs[0];
|
|
786
|
-
pPoints[0] = new POINT2(pt);
|
|
787
|
-
//radius, 90, ref lon2c, ref lat2c);
|
|
788
|
-
pt = mdlGeodesic.geodesic_coordinate(pt, radius, 90);
|
|
789
|
-
pPoints[1] = new POINT2(pt);
|
|
790
|
-
pPoints[2] = new POINT2(pt);
|
|
791
|
-
|
|
792
|
-
pts = mdlGeodesic.GetGeodesicArc(pPoints);
|
|
793
|
-
|
|
794
|
-
let ptTemp2: POINT2;
|
|
795
|
-
//fill pixels and latlongs
|
|
796
|
-
let t: int = pts.length;
|
|
797
|
-
//for (j = 0; j < pts.length; j++)//was 103
|
|
798
|
-
for (j = 0; j < t; j++)//was 103
|
|
799
|
-
{
|
|
800
|
-
ptTemp2 = new POINT2();
|
|
801
|
-
ptTemp2 = clsUtilityCPOF.PointLatLongToPixels(pts[j], converter);
|
|
802
|
-
ptTemp2.style = 0;
|
|
803
|
-
if (j === pts.length - 1) {
|
|
804
|
-
ptTemp2.style = 5;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
tg.Pixels.push(ptTemp2);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
let length: int = tg.Pixels.length;
|
|
811
|
-
tg.Pixels[length - 1].style = 5;
|
|
812
|
-
|
|
813
|
-
} catch (exc) {
|
|
814
|
-
if (exc instanceof Error) {
|
|
815
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "GetConcentricCircles",
|
|
816
|
-
new RendererException("Failed inside GetConcentricCircles", exc));
|
|
817
|
-
} else {
|
|
818
|
-
throw exc;
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* if tg.H2 is filled then the max range sector is used to determine the
|
|
825
|
-
* orientation
|
|
826
|
-
*
|
|
827
|
-
* @param tg
|
|
828
|
-
* @return left,right,min,max
|
|
829
|
-
*/
|
|
830
|
-
private static GetMaxSector(tg: TGLight): string | null {
|
|
831
|
-
let strLeftRightMinMax: string;
|
|
832
|
-
try {
|
|
833
|
-
let max: double = 0;
|
|
834
|
-
let maxx: double = -Number.MAX_VALUE;
|
|
835
|
-
//get the number of sectors
|
|
836
|
-
strLeftRightMinMax = tg.get_LRMM();
|
|
837
|
-
let leftRightMinMax: string[] = strLeftRightMinMax.split(",");
|
|
838
|
-
let numSectors: int = leftRightMinMax.length / 4;
|
|
839
|
-
let k: int = 0;
|
|
840
|
-
let maxIndex: int = -1;
|
|
841
|
-
//there must be at least one sector
|
|
842
|
-
if (numSectors < 1) {
|
|
843
|
-
return null;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
if (numSectors * 4 !== leftRightMinMax.length) {
|
|
847
|
-
return null;
|
|
848
|
-
}
|
|
849
|
-
//get the max index
|
|
850
|
-
|
|
851
|
-
for (k = 0; k < numSectors; k++) {
|
|
852
|
-
//left = Double.parseFloat(leftRightMinMax[4 * k]);
|
|
853
|
-
//right = Double.parseFloat(leftRightMinMax[4 * k + 1]);
|
|
854
|
-
//min = Double.parseFloat(leftRightMinMax[4 * k + 2]);
|
|
855
|
-
max = parseFloat(leftRightMinMax[4 * k + 3]);
|
|
856
|
-
if (max > maxx) {
|
|
857
|
-
maxx = max;
|
|
858
|
-
maxIndex = k;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
let strLeft: string = leftRightMinMax[4 * maxIndex];
|
|
863
|
-
let strRight: string = leftRightMinMax[4 * maxIndex + 1];
|
|
864
|
-
let strMin: string = leftRightMinMax[4 * maxIndex + 2];
|
|
865
|
-
let strMax: string = leftRightMinMax[4 * maxIndex + 3];
|
|
866
|
-
strLeftRightMinMax = strLeft + "," + strRight + "," + strMin + "," + strMax;
|
|
867
|
-
} catch (exc) {
|
|
868
|
-
if (exc instanceof Error) {
|
|
869
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "GetMaxSector",
|
|
870
|
-
new RendererException("Failed inside GetMaxSector", exc));
|
|
871
|
-
} else {
|
|
872
|
-
throw exc;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
return strLeftRightMinMax;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* Create a tg with a new line type to used for circular range fan fill
|
|
880
|
-
*
|
|
881
|
-
* @param tg
|
|
882
|
-
* @return
|
|
883
|
-
*/
|
|
884
|
-
static GetCircularRangeFanFillTG(tg: TGLight): TGLight {
|
|
885
|
-
let tg1: TGLight;
|
|
886
|
-
try {
|
|
887
|
-
//instantiate a dummy tg which will be used to call GetSectorRangeFan
|
|
888
|
-
tg1 = new TGLight();
|
|
889
|
-
tg1.set_VisibleModifiers(true);
|
|
890
|
-
tg1.set_LineThickness(0);
|
|
891
|
-
tg1.set_FillColor(tg.get_FillColor());
|
|
892
|
-
tg1.set_Fillstyle(tg.get_FillStyle());
|
|
893
|
-
tg1.LatLongs = new Array<POINT2>();
|
|
894
|
-
tg1.Pixels = new Array<POINT2>();
|
|
895
|
-
//we only want the 0th point
|
|
896
|
-
tg1.LatLongs.push(tg.LatLongs[0]);
|
|
897
|
-
tg1.Pixels.push(tg.Pixels[0]);
|
|
898
|
-
tg1.Pixels.push(tg.Pixels[1]);
|
|
899
|
-
tg1.set_LineType(TacticalLines.RANGE_FAN_FILL);
|
|
900
|
-
|
|
901
|
-
if (tg.get_LineType() === TacticalLines.RANGE_FAN_SECTOR || tg.get_LineType() === TacticalLines.RADAR_SEARCH) {
|
|
902
|
-
tg1.set_LRMM(tg.get_LRMM());
|
|
903
|
-
return tg1;
|
|
904
|
-
} else {
|
|
905
|
-
if (tg.get_LineType() === TacticalLines.RANGE_FAN) {
|
|
906
|
-
let radii: string[] = tg.get_AM().split(",");
|
|
907
|
-
let strLeftRightMinMax: string = "";
|
|
908
|
-
for (let j: int = 0; j < radii.length - 1; j++) {
|
|
909
|
-
if (j > 0) {
|
|
910
|
-
strLeftRightMinMax += ",";
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
strLeftRightMinMax += "0,0," + radii[j] + "," + radii[j + 1];
|
|
914
|
-
}
|
|
915
|
-
tg1.set_LRMM(strLeftRightMinMax);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
} catch (exc) {
|
|
920
|
-
if (exc instanceof Error) {
|
|
921
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "GetCircularRangeFanFillTG",
|
|
922
|
-
new RendererException("Failed inside GetCircularRangeFanFillTG", exc));
|
|
923
|
-
} else {
|
|
924
|
-
throw exc;
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
return tg1;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
*
|
|
932
|
-
* @param tg
|
|
933
|
-
* @param converter
|
|
934
|
-
* @return
|
|
935
|
-
*/
|
|
936
|
-
private static GetSectorRangeFan(tg: TGLight, converter: IPointConversion): boolean {
|
|
937
|
-
let circle: boolean = false;
|
|
938
|
-
try {
|
|
939
|
-
let ptCenter: POINT2 = tg.LatLongs[0];
|
|
940
|
-
let k: int = 0;
|
|
941
|
-
let l: int = 0;
|
|
942
|
-
let numSectors: int = 0;
|
|
943
|
-
clsUtilityJTR.GetSectorRadiiFromPoints(tg);
|
|
944
|
-
|
|
945
|
-
//use pPoints to get each geodesic arc
|
|
946
|
-
let pPoints: Array<POINT2> = new Array();
|
|
947
|
-
let pPointsInnerArc: Array<POINT2> = new Array();
|
|
948
|
-
let pPointsOuterArc: Array<POINT2> = new Array();
|
|
949
|
-
let sectorPoints: Array<POINT2> = new Array();
|
|
950
|
-
let allPoints: Array<POINT2> = new Array();
|
|
951
|
-
|
|
952
|
-
//use these and the center to define each sector
|
|
953
|
-
let pt1: POINT2 = new POINT2();
|
|
954
|
-
let pt2: POINT2 = new POINT2();
|
|
955
|
-
|
|
956
|
-
//get the number of sectors
|
|
957
|
-
let strLeftRightMinMax: string = tg.get_LRMM();
|
|
958
|
-
let leftRightMinMax: string[] = strLeftRightMinMax.split(",");
|
|
959
|
-
|
|
960
|
-
//sanity checks
|
|
961
|
-
let left: double = 0;
|
|
962
|
-
let right: double = 0;
|
|
963
|
-
let min: double = 0;
|
|
964
|
-
let max: double = 0;
|
|
965
|
-
numSectors = leftRightMinMax.length / 4;
|
|
966
|
-
|
|
967
|
-
//there must be at least one sector
|
|
968
|
-
if (numSectors < 1) {
|
|
969
|
-
return false;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
if (numSectors * 4 !== leftRightMinMax.length) {
|
|
973
|
-
return false;
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
//left must be less than right,
|
|
977
|
-
//min must be less than max, each sector
|
|
978
|
-
|
|
979
|
-
for (k = 0; k < numSectors; k++) {
|
|
980
|
-
left = parseFloat(leftRightMinMax[4 * k]);
|
|
981
|
-
right = parseFloat(leftRightMinMax[4 * k + 1]);
|
|
982
|
-
min = parseFloat(leftRightMinMax[4 * k + 2]);
|
|
983
|
-
max = parseFloat(leftRightMinMax[4 * k + 3]);
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
for (k = 0; k < numSectors; k++) //was k=0
|
|
989
|
-
{
|
|
990
|
-
//empty any points that were there from the last sector
|
|
991
|
-
sectorPoints.length = 0; // sectorPoints.clear()
|
|
992
|
-
pPointsOuterArc.length = 0; // pPointsOuterArc.clear()
|
|
993
|
-
pPointsInnerArc.length = 0; // pPointsInnerArc.clear()
|
|
994
|
-
|
|
995
|
-
left = parseFloat(leftRightMinMax[4 * k]);
|
|
996
|
-
right = parseFloat(leftRightMinMax[4 * k + 1]);
|
|
997
|
-
min = parseFloat(leftRightMinMax[4 * k + 2]);
|
|
998
|
-
max = parseFloat(leftRightMinMax[4 * k + 3]);
|
|
999
|
-
|
|
1000
|
-
//get the first point of the sector inner arc
|
|
1001
|
-
pt1 = mdlGeodesic.geodesic_coordinate(ptCenter, min, left);
|
|
1002
|
-
|
|
1003
|
-
//get the last point of the sector inner arc
|
|
1004
|
-
pt2 = mdlGeodesic.geodesic_coordinate(ptCenter, min, right);
|
|
1005
|
-
|
|
1006
|
-
pPoints.length = 0; // pPoints.clear()
|
|
1007
|
-
|
|
1008
|
-
pPoints.push(ptCenter);
|
|
1009
|
-
pPoints.push(pt1);
|
|
1010
|
-
pPoints.push(pt2);
|
|
1011
|
-
|
|
1012
|
-
circle = mdlGeodesic.GetGeodesicArc2(pPoints, pPointsInnerArc);
|
|
1013
|
-
|
|
1014
|
-
pPoints.length = 0; // pPoints.clear()
|
|
1015
|
-
circle = false;
|
|
1016
|
-
|
|
1017
|
-
pt1 = mdlGeodesic.geodesic_coordinate(ptCenter, max, left);
|
|
1018
|
-
pt2 = mdlGeodesic.geodesic_coordinate(ptCenter, max, right);
|
|
1019
|
-
|
|
1020
|
-
pPoints.push(ptCenter);
|
|
1021
|
-
pPoints.push(pt1);
|
|
1022
|
-
pPoints.push(pt2);
|
|
1023
|
-
|
|
1024
|
-
//get the geodesic min arc from left to right
|
|
1025
|
-
circle = mdlGeodesic.GetGeodesicArc2(pPoints, pPointsOuterArc);
|
|
1026
|
-
|
|
1027
|
-
//we now have all the points and can add them to the polygon to return
|
|
1028
|
-
//we will have to reverse the order of points in the outer arc
|
|
1029
|
-
let n: int = pPointsInnerArc.length;
|
|
1030
|
-
for (l = 0; l < n; l++) {
|
|
1031
|
-
pt1 = new POINT2(pPointsInnerArc[l]);
|
|
1032
|
-
sectorPoints.push(pt1);
|
|
1033
|
-
}
|
|
1034
|
-
n = pPointsOuterArc.length;
|
|
1035
|
-
//for (l = pPointsOuterArc.length - 1; l >= 0; l--)
|
|
1036
|
-
for (l = n - 1; l >= 0; l--) {
|
|
1037
|
-
pt1 = new POINT2(pPointsOuterArc[l]);
|
|
1038
|
-
sectorPoints.push(pt1);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
//close the polygon
|
|
1042
|
-
pt1 = new POINT2(pPointsInnerArc[0]);
|
|
1043
|
-
pt1.style = 5;
|
|
1044
|
-
sectorPoints.push(pt1);
|
|
1045
|
-
n = sectorPoints.length;
|
|
1046
|
-
//for (l = 0; l < sectorPoints.length; l++)
|
|
1047
|
-
for (l = 0; l < n; l++) {
|
|
1048
|
-
allPoints.push(sectorPoints[l]);
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
//cleanup what we can
|
|
1053
|
-
pPointsInnerArc = null;
|
|
1054
|
-
pPointsOuterArc = null;
|
|
1055
|
-
ptCenter = null;
|
|
1056
|
-
|
|
1057
|
-
let ptTemp: POINT2;
|
|
1058
|
-
let n: int = allPoints.length;
|
|
1059
|
-
//for (l = 0; l < allPoints.length; l++)
|
|
1060
|
-
for (l = 0; l < n; l++) {
|
|
1061
|
-
pt1 = new POINT2();
|
|
1062
|
-
pt1 = clsUtilityCPOF.PointLatLongToPixels(allPoints[l], converter);
|
|
1063
|
-
//do not add duplicates
|
|
1064
|
-
if (ptTemp != null && pt1.x === ptTemp.x && pt1.y === ptTemp.y) {
|
|
1065
|
-
continue;
|
|
1066
|
-
}
|
|
1067
|
-
tg.Pixels.push(new POINT2(pt1));
|
|
1068
|
-
ptTemp = new POINT2(pt1);
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
return true;
|
|
1072
|
-
} catch (exc) {
|
|
1073
|
-
if (exc instanceof Error) {
|
|
1074
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "GetSectorRangeFan",
|
|
1075
|
-
new RendererException("Failed inside GetSectorRangeFan", exc));
|
|
1076
|
-
} else {
|
|
1077
|
-
throw exc;
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
return circle;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
private static RangeFanOrientation(tg: TGLight, lineType: int, converter: IPointConversion): void {
|
|
1084
|
-
try {
|
|
1085
|
-
let pt0: POINT2 = tg.LatLongs[0];
|
|
1086
|
-
let dist: double = 0;
|
|
1087
|
-
let orientation: double = 0;
|
|
1088
|
-
let radius: double = 0;
|
|
1089
|
-
//double[] radii = clsUtility.GetRadii(tg,lineType);
|
|
1090
|
-
let j: int = 0;
|
|
1091
|
-
let pt1: POINT2 = new POINT2();
|
|
1092
|
-
//if tg.PointCollection has more than one point
|
|
1093
|
-
//we use pts[1] to stuff tg.H with the orientation
|
|
1094
|
-
let a12: ref<number[]> = new ref();
|
|
1095
|
-
let a21: ref<number[]> = new ref();
|
|
1096
|
-
if (tg.LatLongs.length > 1) //rev B can use points
|
|
1097
|
-
{
|
|
1098
|
-
pt1 = tg.LatLongs[1];
|
|
1099
|
-
dist = mdlGeodesic.geodesic_distance(pt0, pt1, a12, a21);
|
|
1100
|
-
orientation = a12.value[0];
|
|
1101
|
-
} else //rev C uses H2
|
|
1102
|
-
{
|
|
1103
|
-
let strLeftRightMinMax: string = clsUtilityCPOF.GetMaxSector(tg);
|
|
1104
|
-
let sector: string[] = strLeftRightMinMax.split(",");
|
|
1105
|
-
let left: double = parseFloat(sector[0]);
|
|
1106
|
-
let right: double = parseFloat(sector[1]);
|
|
1107
|
-
let min: double = parseFloat(sector[2]);
|
|
1108
|
-
let max: double = parseFloat(sector[3]);
|
|
1109
|
-
//we want the range to be 0 to 360
|
|
1110
|
-
while (left > 360) {
|
|
1111
|
-
left -= 360;
|
|
1112
|
-
}
|
|
1113
|
-
while (right > 360) {
|
|
1114
|
-
right -= 360;
|
|
1115
|
-
}
|
|
1116
|
-
while (left < 0) {
|
|
1117
|
-
left += 360;
|
|
1118
|
-
}
|
|
1119
|
-
while (right < 0) {
|
|
1120
|
-
right += 360;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
if (left > right) {
|
|
1124
|
-
orientation = (left - 360 + right) / 2;
|
|
1125
|
-
} else {
|
|
1126
|
-
orientation = (left + right) / 2;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
dist = max;
|
|
1130
|
-
}
|
|
1131
|
-
radius = dist * 1.1;
|
|
1132
|
-
let pt0F: POINT2 = new POINT2();
|
|
1133
|
-
let pt1F: POINT2 = new POINT2();
|
|
1134
|
-
let ptBaseF: POINT2 = new POINT2();
|
|
1135
|
-
let ptLeftF: POINT2 = new POINT2();
|
|
1136
|
-
let ptRightF: POINT2 = new POINT2();
|
|
1137
|
-
let ptTipF: POINT2 = new POINT2();
|
|
1138
|
-
|
|
1139
|
-
pt0 = tg.LatLongs[0];
|
|
1140
|
-
|
|
1141
|
-
pt0F = clsUtilityCPOF.PointLatLongToPixels(pt0, converter);
|
|
1142
|
-
|
|
1143
|
-
pt1 = mdlGeodesic.geodesic_coordinate(pt0, radius, orientation);
|
|
1144
|
-
|
|
1145
|
-
pt1F = clsUtilityCPOF.PointLatLongToPixels(pt1, converter);
|
|
1146
|
-
dist = lineutility.CalcDistanceDouble(pt0F, pt1F);
|
|
1147
|
-
let base: double = 10;
|
|
1148
|
-
if (dist < 100) {
|
|
1149
|
-
base = dist / 10;
|
|
1150
|
-
}
|
|
1151
|
-
if (base < 5) {
|
|
1152
|
-
base = 5;
|
|
1153
|
-
}
|
|
1154
|
-
let basex2: double = 2 * base;
|
|
1155
|
-
ptBaseF = lineutility.ExtendAlongLineDouble(pt0F, pt1F, dist + base); //was 10
|
|
1156
|
-
ptTipF = lineutility.ExtendAlongLineDouble(pt0F, pt1F, dist + basex2); //was 20
|
|
1157
|
-
|
|
1158
|
-
ptLeftF = lineutility.ExtendDirectedLine(pt0F, ptBaseF, ptBaseF, 0, base); //was 10
|
|
1159
|
-
ptRightF = lineutility.ExtendDirectedLine(pt0F, ptBaseF, ptBaseF, 1, base); //was 10
|
|
1160
|
-
//length1 = tg.Pixels.length;
|
|
1161
|
-
|
|
1162
|
-
tg.Pixels.push(pt0F);
|
|
1163
|
-
ptTipF.style = 5;
|
|
1164
|
-
tg.Pixels.push(ptTipF);
|
|
1165
|
-
tg.Pixels.push(ptLeftF);
|
|
1166
|
-
ptTipF.style = 0;
|
|
1167
|
-
tg.Pixels.push(ptTipF);
|
|
1168
|
-
tg.Pixels.push(ptRightF);
|
|
1169
|
-
} catch (exc) {
|
|
1170
|
-
if (exc instanceof Error) {
|
|
1171
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "RangeFanOrientation",
|
|
1172
|
-
new RendererException("Failed inside RangeFanOrientation", exc));
|
|
1173
|
-
} else {
|
|
1174
|
-
throw exc;
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
/**
|
|
1180
|
-
* after filtering pixels it needs to reinitialize the style to 0 or it
|
|
1181
|
-
* causes CELineArraydotNet to build wrong shapes
|
|
1182
|
-
*
|
|
1183
|
-
* @param tg
|
|
1184
|
-
*/
|
|
1185
|
-
static ClearPixelsStyle(tg: TGLight): void {
|
|
1186
|
-
try {
|
|
1187
|
-
//do not clear pixel style for the air corridors because
|
|
1188
|
-
//arraysupport is using linestyle for these to set the segment width
|
|
1189
|
-
switch (tg.get_LineType()) {
|
|
1190
|
-
case TacticalLines.BBS_AREA:
|
|
1191
|
-
case TacticalLines.BBS_LINE:
|
|
1192
|
-
case TacticalLines.BBS_RECTANGLE:
|
|
1193
|
-
case TacticalLines.SC:
|
|
1194
|
-
case TacticalLines.MRR:
|
|
1195
|
-
case TacticalLines.SL:
|
|
1196
|
-
case TacticalLines.TC:
|
|
1197
|
-
case TacticalLines.LLTR:
|
|
1198
|
-
case TacticalLines.AC:
|
|
1199
|
-
case TacticalLines.SAAFR:
|
|
1200
|
-
case TacticalLines.BS_ELLIPSE: {
|
|
1201
|
-
return;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
default: {
|
|
1205
|
-
break;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
}
|
|
1210
|
-
let n: int = tg.Pixels.length;
|
|
1211
|
-
//for(int j=0;j<tg.Pixels.length;j++)
|
|
1212
|
-
for (let j: int = 0; j < n; j++) {
|
|
1213
|
-
tg.Pixels[j].style = 0;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
} catch (exc) {
|
|
1217
|
-
if (exc instanceof Error) {
|
|
1218
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "ClearPixelsStyle",
|
|
1219
|
-
new RendererException("Failed inside ClearPixelsStyle", exc));
|
|
1220
|
-
|
|
1221
|
-
} else {
|
|
1222
|
-
throw exc;
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* Filters too close points after segmenting and clipping
|
|
1229
|
-
*
|
|
1230
|
-
* @param tg
|
|
1231
|
-
* @param converter
|
|
1232
|
-
*/
|
|
1233
|
-
static FilterPoints2(tg: TGLight, converter: IPointConversion): void {
|
|
1234
|
-
try {
|
|
1235
|
-
let lineType: int = tg.get_LineType();
|
|
1236
|
-
let minSpikeDistance: double = 0;
|
|
1237
|
-
let segmented: boolean = true;
|
|
1238
|
-
if (tg.Pixels.length < 3) {
|
|
1239
|
-
return;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
switch (lineType) {
|
|
1243
|
-
case TacticalLines.PL:
|
|
1244
|
-
case TacticalLines.FEBA:
|
|
1245
|
-
case TacticalLines.LOA:
|
|
1246
|
-
case TacticalLines.LL:
|
|
1247
|
-
case TacticalLines.EWL:
|
|
1248
|
-
case TacticalLines.FCL:
|
|
1249
|
-
case TacticalLines.LOD:
|
|
1250
|
-
case TacticalLines.LDLC:
|
|
1251
|
-
case TacticalLines.PLD:
|
|
1252
|
-
case TacticalLines.HOLD:
|
|
1253
|
-
case TacticalLines.HOLD_GE:
|
|
1254
|
-
case TacticalLines.RELEASE:
|
|
1255
|
-
case TacticalLines.HOL:
|
|
1256
|
-
case TacticalLines.BHL:
|
|
1257
|
-
case TacticalLines.BRDGHD:
|
|
1258
|
-
case TacticalLines.BRDGHD_GE:
|
|
1259
|
-
case TacticalLines.NFL: {
|
|
1260
|
-
minSpikeDistance = arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale());
|
|
1261
|
-
segmented = false;
|
|
1262
|
-
break;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
case TacticalLines.ATDITCH:
|
|
1266
|
-
case TacticalLines.ATDITCHC:
|
|
1267
|
-
case TacticalLines.ATDITCHM:
|
|
1268
|
-
case TacticalLines.FLOT:
|
|
1269
|
-
case TacticalLines.FORT_REVD:
|
|
1270
|
-
case TacticalLines.FORT:
|
|
1271
|
-
case TacticalLines.FORTL:
|
|
1272
|
-
case TacticalLines.STRONG: {
|
|
1273
|
-
minSpikeDistance = arraysupport.getScaledSize(25, tg.get_LineThickness(), tg.get_patternScale());
|
|
1274
|
-
break;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
case TacticalLines.LC:
|
|
1278
|
-
case TacticalLines.OBSAREA:
|
|
1279
|
-
case TacticalLines.OBSFAREA:
|
|
1280
|
-
case TacticalLines.ENCIRCLE:
|
|
1281
|
-
case TacticalLines.ZONE:
|
|
1282
|
-
case TacticalLines.LINE:
|
|
1283
|
-
case TacticalLines.ATWALL:
|
|
1284
|
-
//case TacticalLines.ATWALL3D:
|
|
1285
|
-
case TacticalLines.UNSP:
|
|
1286
|
-
case TacticalLines.SFENCE:
|
|
1287
|
-
case TacticalLines.DFENCE:
|
|
1288
|
-
case TacticalLines.DOUBLEA:
|
|
1289
|
-
case TacticalLines.LWFENCE:
|
|
1290
|
-
case TacticalLines.HWFENCE:
|
|
1291
|
-
case TacticalLines.SINGLEC:
|
|
1292
|
-
case TacticalLines.DOUBLEC:
|
|
1293
|
-
case TacticalLines.TRIPLE: {
|
|
1294
|
-
minSpikeDistance = arraysupport.getScaledSize(35, tg.get_LineThickness(), tg.get_patternScale());
|
|
1295
|
-
break;
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
case TacticalLines.ICE_EDGE_RADAR: //METOCs
|
|
1299
|
-
case TacticalLines.ICE_OPENINGS_FROZEN:
|
|
1300
|
-
case TacticalLines.CRACKS_SPECIFIC_LOCATION: {
|
|
1301
|
-
minSpikeDistance = arraysupport.getScaledSize(35, tg.get_LineThickness(), tg.get_patternScale());
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
default: {
|
|
1306
|
-
return;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1310
|
-
let dist: double = 0;
|
|
1311
|
-
|
|
1312
|
-
let pts: Array<POINT2> = new Array();
|
|
1313
|
-
|
|
1314
|
-
//stuff pts with tg.Pixels
|
|
1315
|
-
//loop through pts to remove any points which are too close
|
|
1316
|
-
//then reset tg.Pixels with the new array with boundary points removed,
|
|
1317
|
-
let j: int = 0;
|
|
1318
|
-
let pt: POINT2;
|
|
1319
|
-
let pt0: POINT2;
|
|
1320
|
-
let pt1: POINT2;
|
|
1321
|
-
let n: int = tg.Pixels.length;
|
|
1322
|
-
//for(j=0;j<tg.Pixels.length;j++)
|
|
1323
|
-
for (j = 0; j < n; j++) {
|
|
1324
|
-
pt = tg.Pixels[j];
|
|
1325
|
-
pt.style = tg.Pixels[j].style;
|
|
1326
|
-
pts.push(pt);
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
let removedPt: boolean = true;
|
|
1330
|
-
//order of priority is: keep anchor points, then boundary points, then segmented points
|
|
1331
|
-
outer:
|
|
1332
|
-
while (removedPt === true) {
|
|
1333
|
-
removedPt = false;
|
|
1334
|
-
//n=pts.length;
|
|
1335
|
-
for (j = 0; j < pts.length - 1; j++) {
|
|
1336
|
-
pt0 = pts[j];
|
|
1337
|
-
pt1 = pts[j + 1];
|
|
1338
|
-
dist = lineutility.CalcDistanceDouble(pts[j], pts[j + 1]);
|
|
1339
|
-
if (dist < minSpikeDistance) {
|
|
1340
|
-
if (segmented === false) {
|
|
1341
|
-
if (j + 1 === pts.length - 1) {
|
|
1342
|
-
pts.splice(j, 1);
|
|
1343
|
-
} else {
|
|
1344
|
-
pts.splice(j + 1, 1);
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
removedPt = true;
|
|
1348
|
-
break outer;
|
|
1349
|
-
} else if (pt0.style === 0 && pt1.style === -1)//-1 are clipped boundary points
|
|
1350
|
-
{
|
|
1351
|
-
pts.splice(j + 1, 1);
|
|
1352
|
-
removedPt = true;
|
|
1353
|
-
break outer;
|
|
1354
|
-
} else if (pt0.style === 0 && pt1.style === -2)//-2 are segmented points, this should never happen
|
|
1355
|
-
{
|
|
1356
|
-
pts.splice(j + 1, 1);
|
|
1357
|
-
removedPt = true;
|
|
1358
|
-
break outer;
|
|
1359
|
-
} else if (pt0.style === -1 && pt1.style === 0) {
|
|
1360
|
-
pts.splice(j, 1);
|
|
1361
|
-
removedPt = true;
|
|
1362
|
-
break outer;
|
|
1363
|
-
} else if (pt0.style === -1 && pt1.style === -1) {
|
|
1364
|
-
pts.splice(j + 1, 1);
|
|
1365
|
-
removedPt = true;
|
|
1366
|
-
break outer;
|
|
1367
|
-
} else if (pt0.style === -1 && pt1.style === -2) {
|
|
1368
|
-
pts.splice(j + 1, 1);
|
|
1369
|
-
removedPt = true;
|
|
1370
|
-
break outer;
|
|
1371
|
-
} else if (pt0.style === -2 && pt1.style === 0)//this should never happen
|
|
1372
|
-
{
|
|
1373
|
-
pts.splice(j, 1);
|
|
1374
|
-
removedPt = true;
|
|
1375
|
-
break outer;
|
|
1376
|
-
} else if (pt0.style === -2 && pt1.style === -1) {
|
|
1377
|
-
pts.splice(j, 1);
|
|
1378
|
-
removedPt = true;
|
|
1379
|
-
break outer;
|
|
1380
|
-
} else if (pt0.style === -2 && pt1.style === -2) {
|
|
1381
|
-
pts.splice(j + 1, 1);
|
|
1382
|
-
removedPt = true;
|
|
1383
|
-
break outer;
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
//n=pts.length;
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
tg.Pixels = pts;
|
|
1390
|
-
tg.LatLongs = clsUtility.PixelsToLatLong(pts, converter);
|
|
1391
|
-
|
|
1392
|
-
} catch (exc) {
|
|
1393
|
-
if (exc instanceof Error) {
|
|
1394
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "FilterPoints2",
|
|
1395
|
-
new RendererException("Failed inside FilterPoints2", exc));
|
|
1396
|
-
|
|
1397
|
-
} else {
|
|
1398
|
-
throw exc;
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
/**
|
|
1404
|
-
* returns true if the line type can be clipped before calculating the
|
|
1405
|
-
* shapes
|
|
1406
|
-
*
|
|
1407
|
-
* @param tg tactical graphic
|
|
1408
|
-
* @return true if can pre-clip points
|
|
1409
|
-
*/
|
|
1410
|
-
public static canClipPoints(tg: TGLight): boolean {
|
|
1411
|
-
try {
|
|
1412
|
-
let symbolId: string = tg.get_SymbolId();
|
|
1413
|
-
if (clsMETOC.IsWeather(symbolId) > 0) {
|
|
1414
|
-
return true;
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
let linetype: int = tg.get_LineType();
|
|
1418
|
-
switch (linetype) {
|
|
1419
|
-
case TacticalLines.ABATIS:
|
|
1420
|
-
// case TacticalLines.BOUNDARY:
|
|
1421
|
-
case TacticalLines.FLOT:
|
|
1422
|
-
case TacticalLines.LC:
|
|
1423
|
-
case TacticalLines.PL:
|
|
1424
|
-
case TacticalLines.FEBA:
|
|
1425
|
-
case TacticalLines.LL:
|
|
1426
|
-
case TacticalLines.EWL:
|
|
1427
|
-
case TacticalLines.GENERAL:
|
|
1428
|
-
case TacticalLines.JTAA:
|
|
1429
|
-
case TacticalLines.SAA:
|
|
1430
|
-
case TacticalLines.SGAA:
|
|
1431
|
-
case TacticalLines.BS_AREA:
|
|
1432
|
-
case TacticalLines.BS_LINE:
|
|
1433
|
-
case TacticalLines.ASSY:
|
|
1434
|
-
case TacticalLines.EA:
|
|
1435
|
-
case TacticalLines.FORT_REVD:
|
|
1436
|
-
case TacticalLines.FORT:
|
|
1437
|
-
case TacticalLines.DZ:
|
|
1438
|
-
case TacticalLines.EZ:
|
|
1439
|
-
case TacticalLines.LZ:
|
|
1440
|
-
case TacticalLines.PZ:
|
|
1441
|
-
case TacticalLines.LAA:
|
|
1442
|
-
case TacticalLines.ROZ:
|
|
1443
|
-
case TacticalLines.AARROZ:
|
|
1444
|
-
case TacticalLines.UAROZ:
|
|
1445
|
-
case TacticalLines.WEZ:
|
|
1446
|
-
case TacticalLines.FEZ:
|
|
1447
|
-
case TacticalLines.JEZ:
|
|
1448
|
-
case TacticalLines.FAADZ:
|
|
1449
|
-
case TacticalLines.HIDACZ:
|
|
1450
|
-
case TacticalLines.MEZ:
|
|
1451
|
-
case TacticalLines.LOMEZ:
|
|
1452
|
-
case TacticalLines.HIMEZ:
|
|
1453
|
-
case TacticalLines.WFZ:
|
|
1454
|
-
case TacticalLines.AIRFIELD:
|
|
1455
|
-
case TacticalLines.BATTLE:
|
|
1456
|
-
case TacticalLines.PNO:
|
|
1457
|
-
case TacticalLines.DIRATKAIR:
|
|
1458
|
-
case TacticalLines.DIRATKGND:
|
|
1459
|
-
case TacticalLines.DIRATKSPT:
|
|
1460
|
-
case TacticalLines.FCL:
|
|
1461
|
-
case TacticalLines.HOLD:
|
|
1462
|
-
case TacticalLines.BRDGHD:
|
|
1463
|
-
case TacticalLines.HOLD_GE:
|
|
1464
|
-
case TacticalLines.BRDGHD_GE:
|
|
1465
|
-
case TacticalLines.LOA:
|
|
1466
|
-
case TacticalLines.LOD:
|
|
1467
|
-
case TacticalLines.LDLC:
|
|
1468
|
-
case TacticalLines.PLD:
|
|
1469
|
-
case TacticalLines.ASSAULT:
|
|
1470
|
-
case TacticalLines.ATKPOS:
|
|
1471
|
-
case TacticalLines.OBJ:
|
|
1472
|
-
case TacticalLines.PEN:
|
|
1473
|
-
case TacticalLines.RELEASE:
|
|
1474
|
-
case TacticalLines.HOL:
|
|
1475
|
-
case TacticalLines.BHL:
|
|
1476
|
-
case TacticalLines.AO:
|
|
1477
|
-
case TacticalLines.AIRHEAD:
|
|
1478
|
-
case TacticalLines.ENCIRCLE:
|
|
1479
|
-
case TacticalLines.NAI:
|
|
1480
|
-
case TacticalLines.TAI:
|
|
1481
|
-
case TacticalLines.BASE_CAMP_REVD:
|
|
1482
|
-
case TacticalLines.BASE_CAMP:
|
|
1483
|
-
case TacticalLines.GUERILLA_BASE_REVD:
|
|
1484
|
-
case TacticalLines.GUERILLA_BASE:
|
|
1485
|
-
case TacticalLines.GENERIC_AREA:
|
|
1486
|
-
case TacticalLines.LINE:
|
|
1487
|
-
case TacticalLines.ZONE:
|
|
1488
|
-
case TacticalLines.OBSAREA:
|
|
1489
|
-
case TacticalLines.OBSFAREA:
|
|
1490
|
-
case TacticalLines.ATDITCH:
|
|
1491
|
-
case TacticalLines.ATDITCHC:
|
|
1492
|
-
case TacticalLines.ATDITCHM:
|
|
1493
|
-
case TacticalLines.ATWALL:
|
|
1494
|
-
case TacticalLines.DEPICT:
|
|
1495
|
-
case TacticalLines.MINED:
|
|
1496
|
-
case TacticalLines.FENCED:
|
|
1497
|
-
case TacticalLines.UXO:
|
|
1498
|
-
case TacticalLines.UNSP:
|
|
1499
|
-
case TacticalLines.SFENCE:
|
|
1500
|
-
case TacticalLines.DFENCE:
|
|
1501
|
-
case TacticalLines.DOUBLEA:
|
|
1502
|
-
case TacticalLines.LWFENCE:
|
|
1503
|
-
case TacticalLines.HWFENCE:
|
|
1504
|
-
case TacticalLines.SINGLEC:
|
|
1505
|
-
case TacticalLines.DOUBLEC:
|
|
1506
|
-
case TacticalLines.TRIPLE:
|
|
1507
|
-
case TacticalLines.FORTL:
|
|
1508
|
-
case TacticalLines.STRONG:
|
|
1509
|
-
case TacticalLines.RAD:
|
|
1510
|
-
case TacticalLines.BIO:
|
|
1511
|
-
case TacticalLines.NUC:
|
|
1512
|
-
case TacticalLines.CHEM:
|
|
1513
|
-
case TacticalLines.DRCL:
|
|
1514
|
-
case TacticalLines.LINTGT:
|
|
1515
|
-
case TacticalLines.LINTGTS:
|
|
1516
|
-
case TacticalLines.FPF:
|
|
1517
|
-
case TacticalLines.FSCL:
|
|
1518
|
-
case TacticalLines.BCL_REVD:
|
|
1519
|
-
case TacticalLines.BCL:
|
|
1520
|
-
case TacticalLines.ICL:
|
|
1521
|
-
case TacticalLines.IFF_OFF:
|
|
1522
|
-
case TacticalLines.IFF_ON:
|
|
1523
|
-
case TacticalLines.GENERIC_LINE:
|
|
1524
|
-
case TacticalLines.CFL:
|
|
1525
|
-
case TacticalLines.TRIP:
|
|
1526
|
-
case TacticalLines.OVERHEAD_WIRE:
|
|
1527
|
-
case TacticalLines.NFL:
|
|
1528
|
-
case TacticalLines.MFP:
|
|
1529
|
-
case TacticalLines.RFL:
|
|
1530
|
-
case TacticalLines.AT:
|
|
1531
|
-
case TacticalLines.SERIES:
|
|
1532
|
-
case TacticalLines.STRIKWARN:
|
|
1533
|
-
case TacticalLines.SMOKE:
|
|
1534
|
-
case TacticalLines.BOMB:
|
|
1535
|
-
case TacticalLines.FSA:
|
|
1536
|
-
case TacticalLines.ACA:
|
|
1537
|
-
case TacticalLines.FFA:
|
|
1538
|
-
case TacticalLines.NFA:
|
|
1539
|
-
case TacticalLines.RFA:
|
|
1540
|
-
case TacticalLines.PAA:
|
|
1541
|
-
case TacticalLines.ATI:
|
|
1542
|
-
case TacticalLines.CFFZ:
|
|
1543
|
-
case TacticalLines.CFZ:
|
|
1544
|
-
case TacticalLines.SENSOR:
|
|
1545
|
-
case TacticalLines.CENSOR:
|
|
1546
|
-
case TacticalLines.DA:
|
|
1547
|
-
case TacticalLines.ZOR:
|
|
1548
|
-
case TacticalLines.TBA:
|
|
1549
|
-
case TacticalLines.TVAR:
|
|
1550
|
-
case TacticalLines.KILLBOXBLUE:
|
|
1551
|
-
case TacticalLines.KILLBOXPURPLE:
|
|
1552
|
-
// case TacticalLines.MSR:
|
|
1553
|
-
// case TacticalLines.ASR:
|
|
1554
|
-
case TacticalLines.MSR_ONEWAY:
|
|
1555
|
-
case TacticalLines.MSR_TWOWAY:
|
|
1556
|
-
case TacticalLines.MSR_ALT:
|
|
1557
|
-
case TacticalLines.ASR_ONEWAY:
|
|
1558
|
-
case TacticalLines.ASR_TWOWAY:
|
|
1559
|
-
case TacticalLines.ASR_ALT:
|
|
1560
|
-
case TacticalLines.ROUTE_ONEWAY:
|
|
1561
|
-
case TacticalLines.ROUTE_ALT:
|
|
1562
|
-
case TacticalLines.DHA_REVD:
|
|
1563
|
-
case TacticalLines.DHA:
|
|
1564
|
-
case TacticalLines.EPW:
|
|
1565
|
-
case TacticalLines.FARP:
|
|
1566
|
-
case TacticalLines.RHA:
|
|
1567
|
-
case TacticalLines.BSA:
|
|
1568
|
-
case TacticalLines.DSA:
|
|
1569
|
-
case TacticalLines.CSA:
|
|
1570
|
-
case TacticalLines.RSA:
|
|
1571
|
-
case TacticalLines.TGMF: {
|
|
1572
|
-
return true;
|
|
1573
|
-
}
|
|
1574
|
-
|
|
1575
|
-
case TacticalLines.MSR: //post clip these so there are identical points regardless whether segment data is set 10-5-16
|
|
1576
|
-
case TacticalLines.ASR:
|
|
1577
|
-
case TacticalLines.ROUTE:
|
|
1578
|
-
case TacticalLines.BOUNDARY: {
|
|
1579
|
-
return false;
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
default: {
|
|
1583
|
-
return false;
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
}
|
|
1587
|
-
} catch (exc) {
|
|
1588
|
-
if (exc instanceof Error) {
|
|
1589
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "canClipPoints",
|
|
1590
|
-
new RendererException("Failed inside canClipPoints", exc));
|
|
1591
|
-
} else {
|
|
1592
|
-
throw exc;
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
return false;
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
/**
|
|
1599
|
-
* These get clipped so the fill must be treated as a separate shape.
|
|
1600
|
-
* Normally lines with fill do not have a separate shape for the fill.
|
|
1601
|
-
*
|
|
1602
|
-
* @param linetype
|
|
1603
|
-
* @return
|
|
1604
|
-
*/
|
|
1605
|
-
static LinesWithSeparateFill(linetype: int, shapes: Array<Shape2>): boolean {
|
|
1606
|
-
if (shapes == null) {
|
|
1607
|
-
return false;
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
switch (linetype) {
|
|
1611
|
-
case TacticalLines.MSDZ: {
|
|
1612
|
-
return true;
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
//treat these as lines: because of the feint they need an extra shape for the fill
|
|
1616
|
-
case TacticalLines.OBSFAREA:
|
|
1617
|
-
case TacticalLines.OBSAREA:
|
|
1618
|
-
case TacticalLines.STRONG:
|
|
1619
|
-
case TacticalLines.ZONE:
|
|
1620
|
-
case TacticalLines.FORT_REVD:
|
|
1621
|
-
case TacticalLines.FORT:
|
|
1622
|
-
case TacticalLines.ENCIRCLE:
|
|
1623
|
-
//return true;
|
|
1624
|
-
case TacticalLines.FIX:
|
|
1625
|
-
case TacticalLines.BOUNDARY:
|
|
1626
|
-
case TacticalLines.FLOT:
|
|
1627
|
-
case TacticalLines.LC:
|
|
1628
|
-
case TacticalLines.PL:
|
|
1629
|
-
case TacticalLines.FEBA:
|
|
1630
|
-
case TacticalLines.LL:
|
|
1631
|
-
case TacticalLines.EWL:
|
|
1632
|
-
case TacticalLines.AC:
|
|
1633
|
-
case TacticalLines.MRR:
|
|
1634
|
-
case TacticalLines.SL:
|
|
1635
|
-
case TacticalLines.TC:
|
|
1636
|
-
case TacticalLines.SAAFR:
|
|
1637
|
-
case TacticalLines.SC:
|
|
1638
|
-
case TacticalLines.LLTR:
|
|
1639
|
-
case TacticalLines.DIRATKAIR:
|
|
1640
|
-
case TacticalLines.DIRATKGND:
|
|
1641
|
-
case TacticalLines.DIRATKSPT:
|
|
1642
|
-
case TacticalLines.FCL:
|
|
1643
|
-
case TacticalLines.HOLD:
|
|
1644
|
-
case TacticalLines.BRDGHD:
|
|
1645
|
-
case TacticalLines.HOLD_GE:
|
|
1646
|
-
case TacticalLines.BRDGHD_GE:
|
|
1647
|
-
case TacticalLines.LOA:
|
|
1648
|
-
case TacticalLines.LOD:
|
|
1649
|
-
case TacticalLines.LDLC:
|
|
1650
|
-
case TacticalLines.PLD:
|
|
1651
|
-
case TacticalLines.RELEASE:
|
|
1652
|
-
case TacticalLines.HOL:
|
|
1653
|
-
case TacticalLines.BHL:
|
|
1654
|
-
case TacticalLines.LINE:
|
|
1655
|
-
case TacticalLines.ABATIS:
|
|
1656
|
-
case TacticalLines.ATDITCH:
|
|
1657
|
-
case TacticalLines.ATDITCHC:
|
|
1658
|
-
case TacticalLines.ATDITCHM:
|
|
1659
|
-
case TacticalLines.ATWALL:
|
|
1660
|
-
case TacticalLines.MNFLDFIX:
|
|
1661
|
-
case TacticalLines.UNSP:
|
|
1662
|
-
case TacticalLines.SFENCE:
|
|
1663
|
-
case TacticalLines.DFENCE:
|
|
1664
|
-
case TacticalLines.DOUBLEA:
|
|
1665
|
-
case TacticalLines.LWFENCE:
|
|
1666
|
-
case TacticalLines.HWFENCE:
|
|
1667
|
-
case TacticalLines.SINGLEC:
|
|
1668
|
-
case TacticalLines.DOUBLEC:
|
|
1669
|
-
case TacticalLines.TRIPLE:
|
|
1670
|
-
case TacticalLines.FORTL:
|
|
1671
|
-
case TacticalLines.LINTGT:
|
|
1672
|
-
case TacticalLines.LINTGTS:
|
|
1673
|
-
case TacticalLines.FSCL:
|
|
1674
|
-
case TacticalLines.BCL_REVD:
|
|
1675
|
-
case TacticalLines.BCL:
|
|
1676
|
-
case TacticalLines.ICL:
|
|
1677
|
-
case TacticalLines.IFF_OFF:
|
|
1678
|
-
case TacticalLines.IFF_ON:
|
|
1679
|
-
case TacticalLines.GENERIC_LINE:
|
|
1680
|
-
case TacticalLines.CFL:
|
|
1681
|
-
case TacticalLines.TRIP:
|
|
1682
|
-
case TacticalLines.NFL:
|
|
1683
|
-
case TacticalLines.MFP:
|
|
1684
|
-
case TacticalLines.RFL:
|
|
1685
|
-
case TacticalLines.MSR:
|
|
1686
|
-
case TacticalLines.MSR_ONEWAY:
|
|
1687
|
-
case TacticalLines.MSR_TWOWAY:
|
|
1688
|
-
case TacticalLines.MSR_ALT:
|
|
1689
|
-
case TacticalLines.ASR:
|
|
1690
|
-
case TacticalLines.ASR_ONEWAY:
|
|
1691
|
-
case TacticalLines.ASR_TWOWAY:
|
|
1692
|
-
case TacticalLines.ASR_ALT:
|
|
1693
|
-
case TacticalLines.ROUTE:
|
|
1694
|
-
case TacticalLines.ROUTE_ONEWAY:
|
|
1695
|
-
case TacticalLines.ROUTE_ALT: {
|
|
1696
|
-
//undo any fill
|
|
1697
|
-
let shape: Shape2;
|
|
1698
|
-
if (shapes != null && shapes.length > 0) {
|
|
1699
|
-
let n: int = shapes.length;
|
|
1700
|
-
//for(int j=0;j<shapes.length;j++)
|
|
1701
|
-
for (let j: int = 0; j < n; j++) {
|
|
1702
|
-
shape = shapes[j];
|
|
1703
|
-
if (shape.getShapeType() === Shape2.SHAPE_TYPE_POLYLINE) {
|
|
1704
|
-
shapes[j].setFillColor(null);
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
return true;
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
default: {
|
|
1712
|
-
return false;
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
/**
|
|
1720
|
-
* uses a hash map to set the POINT2 style when creating tg.Pixels from
|
|
1721
|
-
* Point2D ArrayList
|
|
1722
|
-
*
|
|
1723
|
-
* @param pts2d
|
|
1724
|
-
* @param hashMap
|
|
1725
|
-
* @return
|
|
1726
|
-
*/
|
|
1727
|
-
static Point2DtoPOINT2Mapped(pts2d: Array<Point2D>, hashMap: Map<string, Point2D>): Array<POINT2> {
|
|
1728
|
-
let pts: Array<POINT2> = new Array();
|
|
1729
|
-
try {
|
|
1730
|
-
let pt2d: Point2D;
|
|
1731
|
-
let style: int = 0;
|
|
1732
|
-
let n: int = pts2d.length;
|
|
1733
|
-
//for(int j=0;j<pts2d.length;j++)
|
|
1734
|
-
for (let j: int = 0; j < n; j++) {
|
|
1735
|
-
pt2d = pts2d[j];
|
|
1736
|
-
//the hash map contains the original tg.Pixels before clipping
|
|
1737
|
-
if (Array.from(hashMap.values()).includes(pt2d)) {
|
|
1738
|
-
style = 0;
|
|
1739
|
-
} else {
|
|
1740
|
-
style = -1; //style set to -1 identifies it as a clip bounds point
|
|
1741
|
-
}
|
|
1742
|
-
pts.push(new POINT2(pts2d[j].getX(), pts2d[j].getY(), style));
|
|
1743
|
-
}
|
|
1744
|
-
} catch (exc) {
|
|
1745
|
-
if (exc instanceof Error) {
|
|
1746
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "Point2DToPOINT2Mapped",
|
|
1747
|
-
new RendererException("Failed inside Point2DToPOINT2Mapped", exc));
|
|
1748
|
-
} else {
|
|
1749
|
-
throw exc;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
return pts;
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
protected static Point2DtoPOINT2(pts2d: Array<Point2D>): Array<POINT2> {
|
|
1756
|
-
let pts: Array<POINT2> = new Array();
|
|
1757
|
-
try {
|
|
1758
|
-
let n: int = pts2d.length;
|
|
1759
|
-
//for(int j=0;j<pts2d.length;j++)
|
|
1760
|
-
for (let j: int = 0; j < n; j++) {
|
|
1761
|
-
pts.push(new POINT2(pts2d[j].getX(), pts2d[j].getY()));
|
|
1762
|
-
}
|
|
1763
|
-
} catch (exc) {
|
|
1764
|
-
if (exc instanceof Error) {
|
|
1765
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "Point2DToPOINT2",
|
|
1766
|
-
new RendererException("Failed inside Point2DToPOINT2", exc));
|
|
1767
|
-
} else {
|
|
1768
|
-
throw exc;
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
return pts;
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
static POINT2toPoint2D(pts: Array<POINT2>): Array<Point2D> {
|
|
1775
|
-
let pts2d: Array<Point2D> = new Array();
|
|
1776
|
-
try {
|
|
1777
|
-
let n: int = pts.length;
|
|
1778
|
-
//for(int j=0;j<pts.length;j++)
|
|
1779
|
-
for (let j: int = 0; j < n; j++) {
|
|
1780
|
-
pts2d.push(new Point2D(pts[j].x, pts[j].y));;
|
|
1781
|
-
}
|
|
1782
|
-
|
|
1783
|
-
} catch (exc) {
|
|
1784
|
-
if (exc instanceof Error) {
|
|
1785
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "POINT2toPoint2D",
|
|
1786
|
-
new RendererException("Failed inside POINT2toPoint2D", exc));
|
|
1787
|
-
} else {
|
|
1788
|
-
throw exc;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
return pts2d;
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
/**
|
|
1795
|
-
* Builds a single shape from a point array. Currently we assume the array
|
|
1796
|
-
* represents a moveTo followed by a series of lineTo operations
|
|
1797
|
-
*
|
|
1798
|
-
* @param pts2d
|
|
1799
|
-
* @return
|
|
1800
|
-
*/
|
|
1801
|
-
private static BuildShapeFromPoints(pts2d: Array<Point2D>): Shape {
|
|
1802
|
-
let shape: GeneralPath = new GeneralPath();
|
|
1803
|
-
try {
|
|
1804
|
-
shape.moveTo(pts2d[0].getX(), pts2d[0].getY());
|
|
1805
|
-
let n: int = pts2d.length;
|
|
1806
|
-
//for(int j=1;j<pts2d.length;j++)
|
|
1807
|
-
for (let j: int = 1; j < n; j++) {
|
|
1808
|
-
shape.lineTo(pts2d[j].getX(), pts2d[j].getY());
|
|
1809
|
-
}
|
|
1810
|
-
} catch (exc) {
|
|
1811
|
-
if (exc instanceof Error) {
|
|
1812
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "buildShapeFromPoints",
|
|
1813
|
-
new RendererException("Failed inside buildShapeFromPoints", exc));
|
|
1814
|
-
|
|
1815
|
-
} else {
|
|
1816
|
-
throw exc;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
return shape;
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
/**
|
|
1823
|
-
* Clips a ShapeSpec. Assumes we are not post clipping splines, therefore
|
|
1824
|
-
* all the operations are moveTo, lineTo. Each ShapeSpec is assumed to be:
|
|
1825
|
-
* moveTo, lineTo ... lineTo, followed by another moveTo, lineTo, ...
|
|
1826
|
-
* lineTo, followed by ...
|
|
1827
|
-
*
|
|
1828
|
-
* @param shapeSpec
|
|
1829
|
-
* @param pts
|
|
1830
|
-
* @param clipArea
|
|
1831
|
-
* @return a single clipped shapeSpec
|
|
1832
|
-
*/
|
|
1833
|
-
protected static buildShapeSpecFromPoints(tg0: TGLight,
|
|
1834
|
-
shapeSpec: Shape2, //the original ShapeSpec
|
|
1835
|
-
pts: Array<POINT2>,
|
|
1836
|
-
clipArea: Rectangle | Rectangle2D | Array<Point2D>): Array<Shape2> {
|
|
1837
|
-
let shapeSpecs2: Array<Shape2>;
|
|
1838
|
-
let shapeSpec2: Shape2;
|
|
1839
|
-
try {
|
|
1840
|
-
//create a tg to use for the clip
|
|
1841
|
-
shapeSpecs2 = new Array();
|
|
1842
|
-
let j: int = 0;
|
|
1843
|
-
let n: int = 0;
|
|
1844
|
-
//return null if it is outside the bounds
|
|
1845
|
-
let rect: Rectangle = shapeSpec.getBounds();
|
|
1846
|
-
let h: int = shapeSpec.getBounds().height;
|
|
1847
|
-
let w: int = shapeSpec.getBounds().width;
|
|
1848
|
-
let x: int = shapeSpec.getBounds().x;
|
|
1849
|
-
let y: int = shapeSpec.getBounds().y;
|
|
1850
|
-
// if(h==0 && w==0)
|
|
1851
|
-
// return shapeSpecs2;
|
|
1852
|
-
|
|
1853
|
-
if (h === 0) {
|
|
1854
|
-
h = 1;
|
|
1855
|
-
}
|
|
1856
|
-
if (w === 0) {
|
|
1857
|
-
w = 1;
|
|
1858
|
-
}
|
|
1859
|
-
|
|
1860
|
-
let clipBounds: Rectangle2D;
|
|
1861
|
-
let clipPoints: Array<Point2D>;
|
|
1862
|
-
if (clipArea != null && clipArea instanceof Rectangle2D) {
|
|
1863
|
-
clipBounds = clipArea as Rectangle2D;
|
|
1864
|
-
} else if (clipArea != null && clipArea instanceof Rectangle) {
|
|
1865
|
-
//clipBounds=(Rectangle2D)clipArea;
|
|
1866
|
-
let rectx: Rectangle = clipArea as Rectangle;
|
|
1867
|
-
clipBounds = new Rectangle2D(rectx.x, rectx.y, rectx.width, rectx.height);
|
|
1868
|
-
} else if (clipArea != null && clipArea instanceof Array) {
|
|
1869
|
-
clipPoints = clipArea as Array<Point2D>;
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
if (clipBounds != null && clipBounds.contains(shapeSpec.getShape().getBounds2D()) === false
|
|
1873
|
-
&& clipBounds.intersects(shapeSpec.getShape().getBounds2D()) === false) {
|
|
1874
|
-
//this tests if the shape has height or width 0
|
|
1875
|
-
//but may be contained within the clipbounds or intersect it
|
|
1876
|
-
//in that case we gave it a default width or thickness of 1
|
|
1877
|
-
if (clipBounds.contains(x, y, w, h) === false
|
|
1878
|
-
&& clipBounds.intersects(x, y, w, h) === false) {
|
|
1879
|
-
return shapeSpecs2;
|
|
1880
|
-
}
|
|
1881
|
-
} else {
|
|
1882
|
-
if (clipPoints != null) {
|
|
1883
|
-
let poly: GeneralPath = new GeneralPath();
|
|
1884
|
-
n = clipPoints.length;
|
|
1885
|
-
//for(j=0;j<clipPoints.length;j++)
|
|
1886
|
-
for (j = 0; j < n; j++) {
|
|
1887
|
-
if (j === 0) {
|
|
1888
|
-
poly.moveTo(clipPoints[j].getX(), clipPoints[j].getY());
|
|
1889
|
-
} else {
|
|
1890
|
-
poly.lineTo(clipPoints[j].getX(), clipPoints[j].getY());
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
poly.closePath();
|
|
1894
|
-
if (poly.contains(shapeSpec.getShape().getBounds2D()) === false
|
|
1895
|
-
&& poly.intersects(shapeSpec.getShape().getBounds2D()) === false) {
|
|
1896
|
-
if (poly.contains(x, y, w, h) === false
|
|
1897
|
-
&& poly.intersects(x, y, w, h) === false) {
|
|
1898
|
-
return shapeSpecs2;
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
if (shapeSpec.getShapeType() === Shape2.SHAPE_TYPE_MODIFIER
|
|
1906
|
-
|| shapeSpec.getShapeType() === Shape2.SHAPE_TYPE_MODIFIER_FILL) {
|
|
1907
|
-
shapeSpecs2.push(shapeSpec);
|
|
1908
|
-
return shapeSpecs2;
|
|
1909
|
-
}
|
|
1910
|
-
let tg: TGLight = new TGLight();
|
|
1911
|
-
let pt: POINT2;
|
|
1912
|
-
tg.set_LineType(TacticalLines.PL);
|
|
1913
|
-
let pts2: Array<POINT2> = new Array();
|
|
1914
|
-
let pts2d: Array<Point2D>;
|
|
1915
|
-
let shape: Shape;
|
|
1916
|
-
let gp: GeneralPath = new GeneralPath();
|
|
1917
|
-
//loop through the points
|
|
1918
|
-
n = pts.length;
|
|
1919
|
-
//for(j=0;j<pts.length;j++)
|
|
1920
|
-
for (j = 0; j < n; j++) {
|
|
1921
|
-
pt = pts[j];
|
|
1922
|
-
//new line
|
|
1923
|
-
switch (pt.style) {
|
|
1924
|
-
case 0: { //moveTo,
|
|
1925
|
-
//they lifted the pencil, so we build the shape from the existing pts and append it
|
|
1926
|
-
if (pts2.length > 1) {
|
|
1927
|
-
//clip the points
|
|
1928
|
-
tg = new TGLight();
|
|
1929
|
-
tg.set_LineType(TacticalLines.PL);
|
|
1930
|
-
tg.Pixels = pts2;
|
|
1931
|
-
if (clipBounds != null) {
|
|
1932
|
-
pts2d = clsClipPolygon2.ClipPolygon(tg, clipBounds);
|
|
1933
|
-
} else {
|
|
1934
|
-
if (clipPoints != null && clipPoints.length > 0) {
|
|
1935
|
-
pts2d = clsClipQuad.ClipPolygon(tg, clipPoints);
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
//build a GeneralPath from the points we collected, we will append it
|
|
1941
|
-
if (pts2d != null && pts2d.length > 1) {
|
|
1942
|
-
shape = clsUtilityCPOF.BuildShapeFromPoints(pts2d);
|
|
1943
|
-
//append the shape because we want to return only one shape
|
|
1944
|
-
gp.append(shape, false);
|
|
1945
|
-
}
|
|
1946
|
-
//clear the points array and begin the next line
|
|
1947
|
-
pts2.length = 0; // pts2.clear()
|
|
1948
|
-
pts2.push(pt);
|
|
1949
|
-
} else {
|
|
1950
|
-
pts2.push(pt);
|
|
1951
|
-
}
|
|
1952
|
-
break;
|
|
1953
|
-
}
|
|
1954
|
-
|
|
1955
|
-
case 1: { //lineTo
|
|
1956
|
-
pts2.push(pt);
|
|
1957
|
-
break;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
|
-
default: {
|
|
1961
|
-
pts2.push(pt);
|
|
1962
|
-
break;
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
}
|
|
1966
|
-
}//end for
|
|
1967
|
-
//append the last shape
|
|
1968
|
-
if (pts2.length > 1) {
|
|
1969
|
-
//clip the points
|
|
1970
|
-
tg = new TGLight();
|
|
1971
|
-
tg.set_LineType(TacticalLines.PL);
|
|
1972
|
-
tg.Pixels = pts2;
|
|
1973
|
-
if (clipBounds != null) {
|
|
1974
|
-
pts2d = clsClipPolygon2.ClipPolygon(tg, clipBounds);
|
|
1975
|
-
} else {
|
|
1976
|
-
if (clipPoints != null) {
|
|
1977
|
-
pts2d = clsClipQuad.ClipPolygon(tg, clipPoints);
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
//build a GeneralPath from the points we collected, we will append it
|
|
1982
|
-
if (pts2d != null && pts2d.length > 1) {
|
|
1983
|
-
shape = clsUtilityCPOF.BuildShapeFromPoints(pts2d);
|
|
1984
|
-
gp.append(shape, false);
|
|
1985
|
-
}
|
|
1986
|
-
tg0.set_WasClipped(tg.get_WasClipped());
|
|
1987
|
-
}
|
|
1988
|
-
//create the shapespec here
|
|
1989
|
-
//initialize the clipped ShapeSpec
|
|
1990
|
-
shapeSpec2 = new Shape2(shapeSpec.getShapeType());
|
|
1991
|
-
shapeSpec2.setLineColor(shapeSpec.getLineColor());
|
|
1992
|
-
shapeSpec2.setFillColor(shapeSpec.getFillColor());
|
|
1993
|
-
shapeSpec2.setStroke(shapeSpec.getStroke());
|
|
1994
|
-
shapeSpec2.setTexturePaint(shapeSpec.getTexturePaint());
|
|
1995
|
-
shapeSpec2.setShape(gp);
|
|
1996
|
-
shapeSpecs2.push(shapeSpec2);
|
|
1997
|
-
} catch (exc) {
|
|
1998
|
-
if (exc instanceof Error) {
|
|
1999
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "buildShapeSpecFromPoints",
|
|
2000
|
-
new RendererException("Failed inside buildShapeSpecFromPoints", exc));
|
|
2001
|
-
|
|
2002
|
-
} else {
|
|
2003
|
-
throw exc;
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
return shapeSpecs2;
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
/**
|
|
2010
|
-
* Currently assumes no MeTOC symbols are post clipped
|
|
2011
|
-
*
|
|
2012
|
-
* @param tg
|
|
2013
|
-
* @param shapeSpecsArray
|
|
2014
|
-
* @param clipArea
|
|
2015
|
-
* @return
|
|
2016
|
-
*/
|
|
2017
|
-
static postClipShapes(tg: TGLight, shapeSpecsArray: Array<Shape2>, clipArea: Point2D[] | Rectangle | Rectangle2D): Array<Shape2> | null {
|
|
2018
|
-
let shapeSpecs2: Array<Shape2>;
|
|
2019
|
-
let tempShapes: Array<Shape2>;
|
|
2020
|
-
try {
|
|
2021
|
-
if (shapeSpecsArray == null || shapeSpecsArray.length === 0) {
|
|
2022
|
-
return null;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
shapeSpecs2 = new Array();
|
|
2026
|
-
let j: int = 0;
|
|
2027
|
-
let shapeSpecs: Array<Shape2> = new Array();
|
|
2028
|
-
let n: int = shapeSpecsArray.length;
|
|
2029
|
-
//for(j=0;j<shapeSpecsArray.length;j++)
|
|
2030
|
-
for (j = 0; j < n; j++) {
|
|
2031
|
-
shapeSpecs.push(shapeSpecsArray[j]);;
|
|
2032
|
-
}
|
|
2033
|
-
|
|
2034
|
-
let pts: Array<POINT2> = new Array();//use these
|
|
2035
|
-
let shape: Shape;
|
|
2036
|
-
let pt: POINT2;
|
|
2037
|
-
let coords: number[] = new Array<number>(6);
|
|
2038
|
-
let shapeSpec: Shape2;
|
|
2039
|
-
n = shapeSpecs.length;
|
|
2040
|
-
//for(j=0;j<shapeSpecs.length;j++)
|
|
2041
|
-
for (j = 0; j < n; j++) {
|
|
2042
|
-
shapeSpec = shapeSpecs[j];
|
|
2043
|
-
shape = shapeSpec.getShape();
|
|
2044
|
-
pts.length = 0; // pts.clear()
|
|
2045
|
-
for (let i: PathIterator = shape.getPathIterator(null); !i.isDone(); i.next()) {
|
|
2046
|
-
let type: int = i.currentSegment(coords);
|
|
2047
|
-
switch (type) {
|
|
2048
|
-
case PathIterator.SEG_MOVETO: {
|
|
2049
|
-
pt = new POINT2(coords[0], coords[1]);
|
|
2050
|
-
pt.style = 0;
|
|
2051
|
-
pts.push(pt);
|
|
2052
|
-
break;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
case PathIterator.SEG_LINETO: {
|
|
2056
|
-
pt = new POINT2(coords[0], coords[1]);
|
|
2057
|
-
pt.style = 1;
|
|
2058
|
-
pts.push(pt);
|
|
2059
|
-
break;
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
case PathIterator.SEG_QUADTO: { //not using this
|
|
2063
|
-
pt = new POINT2(coords[0], coords[1]);
|
|
2064
|
-
pt.style = 2;
|
|
2065
|
-
pts.push(pt);
|
|
2066
|
-
pt = new POINT2(coords[2], coords[3]);
|
|
2067
|
-
pt.style = 2;
|
|
2068
|
-
pts.push(pt);
|
|
2069
|
-
break;
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
case PathIterator.SEG_CUBICTO: { //not using this
|
|
2073
|
-
pt = new POINT2(coords[0], coords[1]);
|
|
2074
|
-
pt.style = 3;
|
|
2075
|
-
pts.push(pt);
|
|
2076
|
-
pt = new POINT2(coords[2], coords[3]);
|
|
2077
|
-
pt.style = 3;
|
|
2078
|
-
pts.push(pt);
|
|
2079
|
-
pt = new POINT2(coords[4], coords[5]);
|
|
2080
|
-
pt.style = 3;
|
|
2081
|
-
pts.push(pt);
|
|
2082
|
-
break;
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
case PathIterator.SEG_CLOSE: {//not using this
|
|
2086
|
-
pt = new POINT2(coords[0], coords[1]);
|
|
2087
|
-
pt.style = 4;
|
|
2088
|
-
pts.push(pt);
|
|
2089
|
-
break;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
default: {
|
|
2093
|
-
pt = null;
|
|
2094
|
-
break;
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
}//end switch
|
|
2098
|
-
} //end for pathiterator i
|
|
2099
|
-
tempShapes = clsUtilityCPOF.buildShapeSpecFromPoints(tg, shapeSpec, pts, clipArea);
|
|
2100
|
-
shapeSpecs2.push(...tempShapes);
|
|
2101
|
-
}
|
|
2102
|
-
} catch (exc) {
|
|
2103
|
-
if (exc instanceof Error) {
|
|
2104
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "postClipShapes",
|
|
2105
|
-
new RendererException("Failed inside postClipShapes", exc));
|
|
2106
|
-
} else {
|
|
2107
|
-
throw exc;
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
return shapeSpecs2;
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
/**
|
|
2114
|
-
* For the 3d map we cannot pre-segment the auto-shapes or fire support
|
|
2115
|
-
* areas. We do need to pre-segment generic lines regardless of the status
|
|
2116
|
-
* if clipping is set. Currently we are not pre-segmenting axis of advance
|
|
2117
|
-
* symbols.
|
|
2118
|
-
*
|
|
2119
|
-
* @param tg
|
|
2120
|
-
* @return true if pre-segmenting is to be used
|
|
2121
|
-
*/
|
|
2122
|
-
private static segmentAnticipatedLine(tg: TGLight): boolean {
|
|
2123
|
-
try {
|
|
2124
|
-
let linetype: int = tg.get_LineType();
|
|
2125
|
-
//do not pre-segment the fire support rectangular and circular areas
|
|
2126
|
-
if (clsUtilityJTR.IsChange1Area(linetype)) {
|
|
2127
|
-
return false;
|
|
2128
|
-
}
|
|
2129
|
-
//do not pre-segment the autoshapes
|
|
2130
|
-
if (clsUtilityJTR.isAutoshape(tg)) {
|
|
2131
|
-
return false;
|
|
2132
|
-
}
|
|
2133
|
-
if (SymbolUtilities.isBasicShape(linetype)) {
|
|
2134
|
-
return false;
|
|
2135
|
-
}
|
|
2136
|
-
//temporarily do not pre-segment the channel types.
|
|
2137
|
-
switch (linetype) {
|
|
2138
|
-
case TacticalLines.OVERHEAD_WIRE:
|
|
2139
|
-
case TacticalLines.CATK:
|
|
2140
|
-
case TacticalLines.CATKBYFIRE:
|
|
2141
|
-
case TacticalLines.MAIN:
|
|
2142
|
-
case TacticalLines.SPT:
|
|
2143
|
-
case TacticalLines.AIRAOA:
|
|
2144
|
-
case TacticalLines.AAAAA: {
|
|
2145
|
-
return false;
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
case TacticalLines.MSR_ONEWAY:
|
|
2149
|
-
case TacticalLines.MSR_TWOWAY:
|
|
2150
|
-
case TacticalLines.MSR_ALT:
|
|
2151
|
-
case TacticalLines.ASR_ONEWAY:
|
|
2152
|
-
case TacticalLines.ASR_TWOWAY:
|
|
2153
|
-
case TacticalLines.ASR_ALT:
|
|
2154
|
-
case TacticalLines.ROUTE_ONEWAY:
|
|
2155
|
-
case TacticalLines.ROUTE_ALT: {
|
|
2156
|
-
//added because of segment data 4-22-13
|
|
2157
|
-
//removed from this case block since we now post-clip these because of segment color data 10-5-16
|
|
2158
|
-
// case TacticalLines.MSR:
|
|
2159
|
-
// case TacticalLines.ASR:
|
|
2160
|
-
// case TacticalLines.BOUNDARY:
|
|
2161
|
-
return false;
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
default: {
|
|
2165
|
-
break;
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
|
-
} catch (exc) {
|
|
2171
|
-
if (exc instanceof Error) {
|
|
2172
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "segmentGenericLine",
|
|
2173
|
-
new RendererException("Failed inside segmentGenericLine", exc));
|
|
2174
|
-
} else {
|
|
2175
|
-
throw exc;
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
return true;
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
/**
|
|
2182
|
-
* cannot pre-segment the fire support areas, must post segment them after
|
|
2183
|
-
* the pixels were calculated
|
|
2184
|
-
*
|
|
2185
|
-
* @param tg
|
|
2186
|
-
* @param converter
|
|
2187
|
-
*/
|
|
2188
|
-
protected static postSegmentFSA(tg: TGLight,
|
|
2189
|
-
converter: IPointConversion): void {
|
|
2190
|
-
try {
|
|
2191
|
-
if (tg.get_Client() === "2D") {
|
|
2192
|
-
return;
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
let linetype: int = tg.get_LineType();
|
|
2196
|
-
switch (linetype) {
|
|
2197
|
-
case TacticalLines.PAA_RECTANGULAR:
|
|
2198
|
-
case TacticalLines.FSA_RECTANGULAR:
|
|
2199
|
-
case TacticalLines.SHIP_AOI_RECTANGULAR:
|
|
2200
|
-
case TacticalLines.DEFENDED_AREA_RECTANGULAR:
|
|
2201
|
-
case TacticalLines.FFA_RECTANGULAR:
|
|
2202
|
-
case TacticalLines.ACA_RECTANGULAR:
|
|
2203
|
-
case TacticalLines.NFA_RECTANGULAR:
|
|
2204
|
-
case TacticalLines.RFA_RECTANGULAR:
|
|
2205
|
-
case TacticalLines.ATI_RECTANGULAR:
|
|
2206
|
-
case TacticalLines.CFFZ_RECTANGULAR:
|
|
2207
|
-
case TacticalLines.SENSOR_RECTANGULAR:
|
|
2208
|
-
case TacticalLines.CENSOR_RECTANGULAR:
|
|
2209
|
-
case TacticalLines.DA_RECTANGULAR:
|
|
2210
|
-
case TacticalLines.CFZ_RECTANGULAR:
|
|
2211
|
-
case TacticalLines.ZOR_RECTANGULAR:
|
|
2212
|
-
case TacticalLines.TBA_RECTANGULAR:
|
|
2213
|
-
case TacticalLines.TVAR_RECTANGULAR:
|
|
2214
|
-
case TacticalLines.KILLBOXBLUE_RECTANGULAR:
|
|
2215
|
-
case TacticalLines.KILLBOXPURPLE_RECTANGULAR: {
|
|
2216
|
-
break;
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
default: {
|
|
2220
|
-
return;
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
|
-
}
|
|
2224
|
-
let latLongs: Array<POINT2> = new Array();
|
|
2225
|
-
let resultPts: Array<POINT2> = new Array();
|
|
2226
|
-
let j: int = 0;
|
|
2227
|
-
let k: int = 0;
|
|
2228
|
-
let n: int = 0;
|
|
2229
|
-
let pt0: POINT2;
|
|
2230
|
-
let pt1: POINT2;
|
|
2231
|
-
let pt: POINT2;
|
|
2232
|
-
let dist: double = 0;
|
|
2233
|
-
//double interval=1000000;
|
|
2234
|
-
let interval: double = 250000;
|
|
2235
|
-
let az: double = 0;
|
|
2236
|
-
|
|
2237
|
-
let maxDist: double = 0;
|
|
2238
|
-
let pt2d: Point2D;
|
|
2239
|
-
let t: int = tg.Pixels.length;
|
|
2240
|
-
//for(j=0;j<tg.Pixels.length;j++)
|
|
2241
|
-
for (j = 0; j < t; j++) {
|
|
2242
|
-
pt0 = tg.Pixels[j];
|
|
2243
|
-
pt2d = new Point2D(pt0.x, pt0.y);
|
|
2244
|
-
pt2d = converter.PixelsToGeo(pt2d);
|
|
2245
|
-
pt0 = new POINT2(pt2d.getX(), pt2d.getY());
|
|
2246
|
-
latLongs.push(pt0);
|
|
2247
|
-
}
|
|
2248
|
-
t = latLongs.length;
|
|
2249
|
-
//for(j=0;j<latLongs.length-1;j++)
|
|
2250
|
-
for (j = 0; j < t - 1; j++) {
|
|
2251
|
-
pt0 = latLongs[j];
|
|
2252
|
-
pt1 = latLongs[j + 1];
|
|
2253
|
-
pt1.style = -1;//end point
|
|
2254
|
-
az = mdlGeodesic.GetAzimuth(pt0, pt1);
|
|
2255
|
-
dist = mdlGeodesic.geodesic_distance(latLongs[j], latLongs[j + 1], null, null);
|
|
2256
|
-
if (dist > maxDist) {
|
|
2257
|
-
maxDist = dist;
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
if (interval > maxDist) {
|
|
2262
|
-
interval = maxDist;
|
|
2263
|
-
}
|
|
2264
|
-
|
|
2265
|
-
//for(j=0;j<latLongs.length-1;j++)
|
|
2266
|
-
for (j = 0; j < t - 1; j++) {
|
|
2267
|
-
pt0 = new POINT2(latLongs[j]);
|
|
2268
|
-
pt0.style = 0;//anchor point
|
|
2269
|
-
pt1 = new POINT2(latLongs[j + 1]);
|
|
2270
|
-
pt1.style = 0;//anchor point point
|
|
2271
|
-
az = mdlGeodesic.GetAzimuth(pt0, pt1);
|
|
2272
|
-
dist = mdlGeodesic.geodesic_distance(latLongs[j], latLongs[j + 1], null, null);
|
|
2273
|
-
|
|
2274
|
-
n = Math.trunc(dist / interval);
|
|
2275
|
-
if (j === 0) {
|
|
2276
|
-
resultPts.push(pt0);
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
|
-
for (k = 1; k <= n; k++) {
|
|
2280
|
-
pt = mdlGeodesic.geodesic_coordinate(pt0, interval * k, az);
|
|
2281
|
-
pt.style = -2;
|
|
2282
|
-
//we do not want the last segment to be too close to the anchor point
|
|
2283
|
-
//only add the segment point if it is a distance at least half the inteval
|
|
2284
|
-
//from the 2nd anchor point
|
|
2285
|
-
dist = mdlGeodesic.geodesic_distance(pt, pt1, null, null);
|
|
2286
|
-
if (dist >= interval / 2) {
|
|
2287
|
-
resultPts.push(pt);
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
//ad the 2nd anchor point
|
|
2291
|
-
resultPts.push(pt1);
|
|
2292
|
-
}
|
|
2293
|
-
latLongs = resultPts;
|
|
2294
|
-
tg.Pixels = clsUtility.LatLongToPixels(latLongs, converter);
|
|
2295
|
-
} catch (exc) {
|
|
2296
|
-
if (exc instanceof Error) {
|
|
2297
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "postSegmentFSA",
|
|
2298
|
-
new RendererException("Failed inside postSegmentFSA", exc));
|
|
2299
|
-
} else {
|
|
2300
|
-
throw exc;
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
/**
|
|
2306
|
-
* Similar to Vincenty algorithm for more accurate interpolation of geo
|
|
2307
|
-
* anchor points
|
|
2308
|
-
*
|
|
2309
|
-
* @return the interpolated points
|
|
2310
|
-
*/
|
|
2311
|
-
private static toGeodesic(tg: TGLight, interval: double, hmap: Map<number, string>): Array<POINT2> | null {
|
|
2312
|
-
let locs: Array<POINT2> = new Array<POINT2>();
|
|
2313
|
-
try {
|
|
2314
|
-
let i: int = 0;
|
|
2315
|
-
let k: int = 0;
|
|
2316
|
-
let n: int = 0;
|
|
2317
|
-
let points: Array<POINT2> = tg.LatLongs;
|
|
2318
|
-
let H: string = "";
|
|
2319
|
-
let color: string = "";
|
|
2320
|
-
let bolIsAC: boolean = false;
|
|
2321
|
-
let acWidth: int = 0;
|
|
2322
|
-
let linetype: int = tg.get_LineType();
|
|
2323
|
-
switch (linetype) {
|
|
2324
|
-
case TacticalLines.AC:
|
|
2325
|
-
case TacticalLines.LLTR:
|
|
2326
|
-
case TacticalLines.MRR:
|
|
2327
|
-
case TacticalLines.SL:
|
|
2328
|
-
case TacticalLines.SAAFR:
|
|
2329
|
-
case TacticalLines.TC:
|
|
2330
|
-
case TacticalLines.SC: {
|
|
2331
|
-
bolIsAC = true;
|
|
2332
|
-
break;
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2335
|
-
default: {
|
|
2336
|
-
break;
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
}
|
|
2340
|
-
for (i = 0; i < points.length - 1; i++) {
|
|
2341
|
-
if (bolIsAC) {
|
|
2342
|
-
|
|
2343
|
-
acWidth = points[i].style;
|
|
2344
|
-
}
|
|
2345
|
-
|
|
2346
|
-
// Convert coordinates from degrees to Radians
|
|
2347
|
-
//var lat1 = points[i].latitude * (PI / 180);
|
|
2348
|
-
//var lon1 = points[i].longitude * (PI / 180);
|
|
2349
|
-
//var lat2 = points[i + 1].latitude * (PI / 180);
|
|
2350
|
-
//var lon2 = points[i + 1].longitude * (PI / 180);
|
|
2351
|
-
let lat1: double = points[i].y * Math.PI / 180.0;
|
|
2352
|
-
let lon1: double = points[i].x * Math.PI / 180.0;
|
|
2353
|
-
let lat2: double = points[i + 1].y * Math.PI / 180.0;
|
|
2354
|
-
let lon2: double = points[i + 1].x * Math.PI / 180.0;
|
|
2355
|
-
// Calculate the total extent of the route
|
|
2356
|
-
//var d = 2 * asin(sqrt(pow((sin((lat1 - lat2) / 2)), 2) + cos(lat1) * cos(lat2) * pow((sin((lon1 - lon2) / 2)), 2)));
|
|
2357
|
-
let d: double = 2 * Math.asin(Math.sqrt(Math.pow((Math.sin((lat1 - lat2) / 2)), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow((Math.sin((lon1 - lon2) / 2)), 2)));
|
|
2358
|
-
|
|
2359
|
-
let dist: double = mdlGeodesic.geodesic_distance(points[i], points[i + 1], null, null);
|
|
2360
|
-
//double dist=d;
|
|
2361
|
-
let flt: double = dist / interval;
|
|
2362
|
-
n = Math.round(flt);
|
|
2363
|
-
if (n < 1) {
|
|
2364
|
-
n = 1;
|
|
2365
|
-
}
|
|
2366
|
-
if (n > 32) {
|
|
2367
|
-
n = 32;
|
|
2368
|
-
}
|
|
2369
|
-
// Calculate positions at fixed intervals along the route
|
|
2370
|
-
for (k = 0; k <= n; k++) {
|
|
2371
|
-
//we must preserve the anchor points
|
|
2372
|
-
if (k === 0) {
|
|
2373
|
-
locs.push(new POINT2(points[i]));
|
|
2374
|
-
if (hmap != null && hmap.has(i)) {
|
|
2375
|
-
if (H.length > 0) {
|
|
2376
|
-
H += ",";
|
|
2377
|
-
}
|
|
2378
|
-
color = String(hmap.get(i));
|
|
2379
|
-
H += (locs.length - 1).toString() + ":" + color;
|
|
2380
|
-
}
|
|
2381
|
-
continue;
|
|
2382
|
-
} else {
|
|
2383
|
-
if (k === n) {
|
|
2384
|
-
if (i === points.length - 2) {
|
|
2385
|
-
locs.push(new POINT2(points[i + 1]));
|
|
2386
|
-
if (hmap != null && hmap.has(i + 1)) {
|
|
2387
|
-
if (H.length > 0) {
|
|
2388
|
-
H += ",";
|
|
2389
|
-
}
|
|
2390
|
-
color = String(hmap.get(i + 1));
|
|
2391
|
-
H += (locs.length - 1).toString() + ":" + color;
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
break;
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
|
|
2398
|
-
//var f = (k / n);
|
|
2399
|
-
//var A = sin((1 - f) * d) / sin(d);
|
|
2400
|
-
//var B = sin(f * d) / sin(d);
|
|
2401
|
-
let f: double = (k as double / n as double);
|
|
2402
|
-
let A: double = Math.sin((1 - f) * d) / Math.sin(d);
|
|
2403
|
-
let B: double = Math.sin(f * d) / Math.sin(d);
|
|
2404
|
-
// Obtain 3D Cartesian coordinates of each point
|
|
2405
|
-
//var x = A * cos(lat1) * cos(lon1) + B * cos(lat2) * cos(lon2);
|
|
2406
|
-
//var y = A * cos(lat1) * sin(lon1) + B * cos(lat2) * sin(lon2);
|
|
2407
|
-
//var z = A * sin(lat1) + B * sin(lat2);
|
|
2408
|
-
let x: double = A * Math.cos(lat1) * Math.cos(lon1) + B * Math.cos(lat2) * Math.cos(lon2);
|
|
2409
|
-
let y: double = A * Math.cos(lat1) * Math.sin(lon1) + B * Math.cos(lat2) * Math.sin(lon2);
|
|
2410
|
-
let z: double = A * Math.sin(lat1) + B * Math.sin(lat2);
|
|
2411
|
-
// Convert these to latitude/longitude
|
|
2412
|
-
//var lat = atan2(z, sqrt(pow(x, 2) + pow(y, 2)));
|
|
2413
|
-
//var lon = atan2(y, x);
|
|
2414
|
-
let lat: double = Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
|
|
2415
|
-
let lon: double = Math.atan2(y, x);
|
|
2416
|
-
lat *= 180.0 / Math.PI;
|
|
2417
|
-
lon *= 180.0 / Math.PI;
|
|
2418
|
-
let pt: POINT2 = new POINT2(lon, lat);
|
|
2419
|
-
if (bolIsAC) {
|
|
2420
|
-
|
|
2421
|
-
pt.style = -acWidth;
|
|
2422
|
-
}
|
|
2423
|
-
|
|
2424
|
-
locs.push(pt);
|
|
2425
|
-
if (hmap != null && hmap.has(i)) {
|
|
2426
|
-
if (H.length > 0) {
|
|
2427
|
-
H += ",";
|
|
2428
|
-
}
|
|
2429
|
-
color = String(hmap.get(i));
|
|
2430
|
-
H += (locs.length - 1).toString() + ":" + color;
|
|
2431
|
-
}
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
if (H.length > 0) {
|
|
2435
|
-
tg.set_H(H);
|
|
2436
|
-
}
|
|
2437
|
-
} catch (exc) {
|
|
2438
|
-
if (exc instanceof Error) {
|
|
2439
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "toGeodesic",
|
|
2440
|
-
new RendererException("Failed inside toGeodesic", exc));
|
|
2441
|
-
return null;
|
|
2442
|
-
} else {
|
|
2443
|
-
throw exc;
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
return locs;
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
/**
|
|
2450
|
-
* Pre-segment the lines based on max or min latitude for the segment
|
|
2451
|
-
* interval. This is necessary because GeoPixelconversion does not work well
|
|
2452
|
-
* over distance greater than 1M meters, especially at extreme latitudes.
|
|
2453
|
-
*
|
|
2454
|
-
* @param tg
|
|
2455
|
-
* @param converter
|
|
2456
|
-
*/
|
|
2457
|
-
static SegmentGeoPoints(tg: TGLight,
|
|
2458
|
-
converter: IPointConversion,
|
|
2459
|
-
zoomFactor: double): void {
|
|
2460
|
-
try {
|
|
2461
|
-
if (tg.get_Client() === "2D") {
|
|
2462
|
-
return;
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
let resultPts: Array<POINT2> = new Array();
|
|
2466
|
-
let lineType: int = tg.get_LineType();
|
|
2467
|
-
//double interval=1000000;
|
|
2468
|
-
let interval: double = 250000;
|
|
2469
|
-
let bolSegmentAC: boolean = false;
|
|
2470
|
-
let bolIsAC: boolean = false;
|
|
2471
|
-
bolSegmentAC = true;
|
|
2472
|
-
//conservative interval in meters
|
|
2473
|
-
//return early for those lines not requiring pre-segmenting geo points
|
|
2474
|
-
switch (lineType) {
|
|
2475
|
-
case TacticalLines.AC:
|
|
2476
|
-
case TacticalLines.LLTR:
|
|
2477
|
-
case TacticalLines.MRR:
|
|
2478
|
-
case TacticalLines.SL:
|
|
2479
|
-
case TacticalLines.SAAFR:
|
|
2480
|
-
case TacticalLines.TC:
|
|
2481
|
-
case TacticalLines.SC: {
|
|
2482
|
-
if (!bolSegmentAC) {
|
|
2483
|
-
return;
|
|
2484
|
-
}
|
|
2485
|
-
bolIsAC = true;
|
|
2486
|
-
break;
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
case TacticalLines.PLD:
|
|
2490
|
-
case TacticalLines.CFL:
|
|
2491
|
-
case TacticalLines.UNSP:
|
|
2492
|
-
case TacticalLines.TRIPLE:
|
|
2493
|
-
case TacticalLines.DOUBLEC:
|
|
2494
|
-
case TacticalLines.SINGLEC:
|
|
2495
|
-
case TacticalLines.ATDITCH:
|
|
2496
|
-
case TacticalLines.ATDITCHC:
|
|
2497
|
-
case TacticalLines.ATDITCHM:
|
|
2498
|
-
case TacticalLines.ATWALL:
|
|
2499
|
-
case TacticalLines.LINE:
|
|
2500
|
-
case TacticalLines.DIRATKAIR:
|
|
2501
|
-
case TacticalLines.STRONG:
|
|
2502
|
-
case TacticalLines.ENCIRCLE:
|
|
2503
|
-
case TacticalLines.FLOT:
|
|
2504
|
-
case TacticalLines.ZONE:
|
|
2505
|
-
case TacticalLines.OBSAREA:
|
|
2506
|
-
case TacticalLines.OBSFAREA:
|
|
2507
|
-
case TacticalLines.FORT_REVD:
|
|
2508
|
-
case TacticalLines.FORT:
|
|
2509
|
-
case TacticalLines.FORTL: {
|
|
2510
|
-
break;
|
|
2511
|
-
}
|
|
2512
|
-
|
|
2513
|
-
case TacticalLines.HWFENCE:
|
|
2514
|
-
case TacticalLines.LWFENCE:
|
|
2515
|
-
case TacticalLines.DOUBLEA:
|
|
2516
|
-
case TacticalLines.DFENCE:
|
|
2517
|
-
case TacticalLines.SFENCE: {
|
|
2518
|
-
interval = 500000;
|
|
2519
|
-
break;
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
case TacticalLines.LC: {
|
|
2523
|
-
interval = 2000000;
|
|
2524
|
-
break;
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
default: {
|
|
2528
|
-
//if the line is an anticipated generic line then segment the line
|
|
2529
|
-
if (clsUtilityCPOF.segmentAnticipatedLine(tg)) {
|
|
2530
|
-
break;
|
|
2531
|
-
}
|
|
2532
|
-
return;
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
}
|
|
2536
|
-
|
|
2537
|
-
let j: int = 0;
|
|
2538
|
-
let k: int = 0;
|
|
2539
|
-
let n: int = 0;
|
|
2540
|
-
let pt0: POINT2;
|
|
2541
|
-
let pt1: POINT2;
|
|
2542
|
-
let pt: POINT2;
|
|
2543
|
-
let dist: double = 0;
|
|
2544
|
-
let az: double = 0;
|
|
2545
|
-
|
|
2546
|
-
let maxDist: double = 0;
|
|
2547
|
-
let t: int = tg.LatLongs.length;
|
|
2548
|
-
//for(j=0;j<tg.LatLongs.length-1;j++)
|
|
2549
|
-
for (j = 0; j < t - 1; j++) {
|
|
2550
|
-
pt0 = tg.LatLongs[j];
|
|
2551
|
-
pt1 = tg.LatLongs[j + 1];
|
|
2552
|
-
if (!bolIsAC) {
|
|
2553
|
-
|
|
2554
|
-
pt1.style = -1;
|
|
2555
|
-
}
|
|
2556
|
-
//end point
|
|
2557
|
-
az = mdlGeodesic.GetAzimuth(pt0, pt1);
|
|
2558
|
-
dist = mdlGeodesic.geodesic_distance(tg.LatLongs[j], tg.LatLongs[j + 1], null, null);
|
|
2559
|
-
if (dist > maxDist) {
|
|
2560
|
-
maxDist = dist;
|
|
2561
|
-
}
|
|
2562
|
-
}
|
|
2563
|
-
|
|
2564
|
-
if (interval > maxDist) {
|
|
2565
|
-
interval = maxDist;
|
|
2566
|
-
}
|
|
2567
|
-
|
|
2568
|
-
if (zoomFactor > 0 && zoomFactor < 0.01) {
|
|
2569
|
-
zoomFactor = 0.01;
|
|
2570
|
-
}
|
|
2571
|
-
if (zoomFactor > 0 && zoomFactor < 1) {
|
|
2572
|
-
interval *= zoomFactor;
|
|
2573
|
-
}
|
|
2574
|
-
|
|
2575
|
-
let useVincenty: boolean = false;
|
|
2576
|
-
let H: string = "";
|
|
2577
|
-
let color: string = "";
|
|
2578
|
-
let hmap: Map<number, string> = clsUtilityJTR.getMSRSegmentColorStrings(tg);
|
|
2579
|
-
if (hmap != null) {
|
|
2580
|
-
tg.set_H("");
|
|
2581
|
-
}
|
|
2582
|
-
//uncomment one line to use (similar to) Vincenty algorithm
|
|
2583
|
-
useVincenty = true;
|
|
2584
|
-
if (useVincenty) {
|
|
2585
|
-
resultPts = clsUtilityCPOF.toGeodesic(tg, interval, hmap);
|
|
2586
|
-
tg.LatLongs = resultPts;
|
|
2587
|
-
tg.Pixels = clsUtility.LatLongToPixels(tg.LatLongs, converter);
|
|
2588
|
-
return;
|
|
2589
|
-
}
|
|
2590
|
-
|
|
2591
|
-
for (j = 0; j < tg.LatLongs.length - 1; j++) {
|
|
2592
|
-
pt0 = new POINT2(tg.LatLongs[j]);
|
|
2593
|
-
pt0.style = 0;//anchor point
|
|
2594
|
-
pt1 = new POINT2(tg.LatLongs[j + 1]);
|
|
2595
|
-
pt1.style = 0;//anchor point point
|
|
2596
|
-
az = mdlGeodesic.GetAzimuth(pt0, pt1);
|
|
2597
|
-
dist = mdlGeodesic.geodesic_distance(tg.LatLongs[j], tg.LatLongs[j + 1], null, null);
|
|
2598
|
-
|
|
2599
|
-
n = Math.trunc(dist / interval);
|
|
2600
|
-
if (j === 0) {
|
|
2601
|
-
resultPts.push(pt0);
|
|
2602
|
-
if (hmap != null && hmap.has(j)) {
|
|
2603
|
-
if (H.length > 0) {
|
|
2604
|
-
H += ",";
|
|
2605
|
-
}
|
|
2606
|
-
color = String(hmap.get(j));
|
|
2607
|
-
//H+=(resultPts.length-1).toString()+":"+color;
|
|
2608
|
-
H += (resultPts.length - 1).toString() + ":" + color;
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
for (k = 1; k <= n; k++) {
|
|
2612
|
-
pt = mdlGeodesic.geodesic_coordinate(pt0, interval * k, az);
|
|
2613
|
-
pt.style = -2;
|
|
2614
|
-
//we do not want the last segment to be too close to the anchor point
|
|
2615
|
-
//only add the segment point if it is a distance at least half the inteval
|
|
2616
|
-
//from the 2nd anchor point
|
|
2617
|
-
dist = mdlGeodesic.geodesic_distance(pt, pt1, null, null);
|
|
2618
|
-
if (dist >= interval / 2) {
|
|
2619
|
-
resultPts.push(pt);
|
|
2620
|
-
if (hmap != null && hmap.has(j)) {
|
|
2621
|
-
color = String(hmap.get(j));
|
|
2622
|
-
if (H.length > 0) {
|
|
2623
|
-
H += ",";
|
|
2624
|
-
}
|
|
2625
|
-
//H+=(resultPts.length-1).toString()+":"+color;
|
|
2626
|
-
H += (resultPts.length - 1).toString() + ":" + color;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
}
|
|
2630
|
-
//ad the 2nd anchor point
|
|
2631
|
-
resultPts.push(pt1);
|
|
2632
|
-
if (hmap != null && hmap.has(j + 1)) {
|
|
2633
|
-
if (H.length > 0) {
|
|
2634
|
-
H += ",";
|
|
2635
|
-
}
|
|
2636
|
-
color = String(hmap.get(j + 1));
|
|
2637
|
-
//H+=(resultPts.length-1).toString()+":"+color;
|
|
2638
|
-
H += (resultPts.length - 1).toString() + ":" + color;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
if (H.length > 0) {
|
|
2642
|
-
tg.set_H(H);
|
|
2643
|
-
}
|
|
2644
|
-
tg.LatLongs = resultPts;
|
|
2645
|
-
tg.Pixels = clsUtility.LatLongToPixels(tg.LatLongs, converter);
|
|
2646
|
-
} catch (exc) {
|
|
2647
|
-
if (exc instanceof Error) {
|
|
2648
|
-
ErrorLogger.LogException(clsUtilityCPOF._className, "SegmentGeoPoints",
|
|
2649
|
-
new RendererException("Failed inside SegmentGeoPoints", exc));
|
|
2650
|
-
} else {
|
|
2651
|
-
throw exc;
|
|
2652
|
-
}
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
|
|
2656
|
-
}
|