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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/{dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz → armyc2.c5isr.renderer-mil-sym-ts-web-2.2.1.tgz} +0 -0
  2. package/package.json +15 -39
  3. package/buildNode.bat +0 -2
  4. package/buildWeb.bat +0 -2
  5. package/dist/LICENSE +0 -201
  6. package/dist/README.md +0 -57
  7. package/dist/package.json +0 -16
  8. package/index.ts +0 -169
  9. package/package.bak +0 -50
  10. package/package.node.json +0 -43
  11. package/package.pack.json +0 -19
  12. package/package.packWeb.json +0 -16
  13. package/package.web.json +0 -40
  14. package/src/main/ts/android/graphics/Bitmap.ts +0 -7
  15. package/src/main/ts/android/graphics/Paint.ts +0 -26
  16. package/src/main/ts/android/graphics/Path.ts +0 -78
  17. package/src/main/ts/android/graphics/PointF.ts +0 -14
  18. package/src/main/ts/android/graphics/Rect.ts +0 -18
  19. package/src/main/ts/android/graphics/RectF.ts +0 -50
  20. package/src/main/ts/android/graphics/Region.ts +0 -36
  21. package/src/main/ts/android/graphics/Typeface.ts +0 -11
  22. package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +0 -99
  23. package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +0 -34
  24. package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +0 -193
  25. package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +0 -2971
  26. package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +0 -4008
  27. package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +0 -93
  28. package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +0 -89
  29. package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +0 -515
  30. package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +0 -5403
  31. package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +0 -1084
  32. package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +0 -2173
  33. package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +0 -4934
  34. package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +0 -7
  35. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +0 -5601
  36. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +0 -14
  37. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +0 -648
  38. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +0 -647
  39. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +0 -2994
  40. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +0 -2663
  41. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +0 -669
  42. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +0 -971
  43. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +0 -871
  44. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +0 -3507
  45. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +0 -500
  46. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +0 -1089
  47. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +0 -2656
  48. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +0 -1419
  49. package/src/main/ts/armyc2/c5isr/data/genc.json +0 -1407
  50. package/src/main/ts/armyc2/c5isr/data/msd.json +0 -17311
  51. package/src/main/ts/armyc2/c5isr/data/mse.json +0 -18500
  52. package/src/main/ts/armyc2/c5isr/data/svgd.json +0 -31214
  53. package/src/main/ts/armyc2/c5isr/data/svge.json +0 -30558
  54. package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +0 -10
  55. package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +0 -437
  56. package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +0 -429
  57. package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +0 -7
  58. package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +0 -35
  59. package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +0 -111
  60. package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +0 -29
  61. package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +0 -18
  62. package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +0 -211
  63. package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +0 -80
  64. package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +0 -33
  65. package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +0 -16
  66. package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +0 -726
  67. package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +0 -141
  68. package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +0 -112
  69. package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +0 -261
  70. package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +0 -391
  71. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +0 -567
  72. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +0 -445
  73. package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +0 -31
  74. package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +0 -18
  75. package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +0 -45
  76. package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +0 -25
  77. package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +0 -15
  78. package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +0 -22
  79. package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +0 -269
  80. package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +0 -9882
  81. package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +0 -146
  82. package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +0 -1265
  83. package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +0 -64
  84. package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +0 -95
  85. package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +0 -93
  86. package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +0 -114
  87. package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +0 -555
  88. package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +0 -62
  89. package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +0 -120
  90. package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +0 -431
  91. package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +0 -99
  92. package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +0 -25
  93. package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +0 -203
  94. package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +0 -104
  95. package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +0 -481
  96. package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +0 -40
  97. package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +0 -1323
  98. package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +0 -51
  99. package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +0 -736
  100. package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +0 -106
  101. package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +0 -84
  102. package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +0 -87
  103. package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +0 -34
  104. package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +0 -324
  105. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +0 -127
  106. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +0 -18
  107. package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +0 -111
  108. package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +0 -219
  109. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +0 -1008
  110. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +0 -882
  111. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +0 -380
  112. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +0 -797
  113. package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +0 -1699
  114. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +0 -178
  115. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +0 -45
  116. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +0 -126
  117. package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +0 -118
  118. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +0 -11
  119. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +0 -1201
  120. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +0 -591
  121. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +0 -29
  122. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +0 -753
  123. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +0 -137
  124. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +0 -438
  125. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +0 -19
  126. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +0 -10
  127. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +0 -5
  128. package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +0 -404
  129. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +0 -525
  130. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +0 -55
  131. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +0 -36
  132. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +0 -1055
  133. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +0 -2085
  134. package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +0 -157
  135. package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +0 -86
  136. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +0 -3798
  137. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +0 -412
  138. package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +0 -124
  139. package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +0 -26
  140. package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +0 -677
  141. package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +0 -484
  142. package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +0 -62
  143. package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +0 -46
  144. package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +0 -51
  145. package/src/main/ts/org/gavaghan/geodesy/Angle.ts +0 -31
  146. package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +0 -71
  147. package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +0 -200
  148. package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +0 -55
  149. package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +0 -68
  150. package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +0 -103
  151. package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +0 -90
  152. package/test/ExportSPImages.js +0 -692
  153. package/test/MPWW.html +0 -556
  154. package/test/MPWorker.js +0 -318
  155. package/test/SPWorker.js +0 -233
  156. package/test/SVGWW.html +0 -363
  157. package/test/singlePointTester3.html +0 -751
  158. package/tsconfig.json +0 -54
  159. package/typedoc.json +0 -30
  160. package/updateVersion.js +0 -21
  161. package/webpack.config.js +0 -34
  162. package/webpackn.config.js +0 -28
  163. package/webpackr.config.js +0 -47
  164. package/webpackw.config.js +0 -23
  165. /package/{dist/C5Ren.d.ts → C5Ren.d.ts} +0 -0
  166. /package/{dist/C5Ren.js → C5Ren.js} +0 -0
  167. /package/{dist/C5Ren.js.map → C5Ren.js.map} +0 -0
  168. /package/{dist/manifest.json → manifest.json} +0 -0
@@ -1,1089 +0,0 @@
1
- import { Area } from "../graphics2d/Area"
2
- import { BasicStroke } from "../graphics2d/BasicStroke"
3
- import { Point } from "../graphics2d/Point"
4
- import { Point2D } from "../graphics2d/Point2D"
5
- import { Rectangle } from "../graphics2d/Rectangle"
6
- import { Rectangle2D } from "../graphics2d/Rectangle2D"
7
- import { TexturePaint } from "../graphics2d/TexturePaint"
8
- import { lineutility } from "../JavaLineArray/lineutility"
9
- import { POINT2 } from "../JavaLineArray/POINT2"
10
- import { Shape2 } from "../JavaLineArray/Shape2"
11
- import { TacticalLines } from "../JavaLineArray/TacticalLines"
12
- import { TGLight } from "../JavaTacticalRenderer/TGLight"
13
- import { PatternFillRenderer } from "../renderer/PatternFillRenderer"
14
- import { Color } from "../renderer/utilities/Color"
15
- import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
16
- import { IPointConversion } from "../renderer/utilities/IPointConversion"
17
- import { RendererException } from "../renderer/utilities/RendererException"
18
- import { ShapeInfo } from "../renderer/utilities/ShapeInfo"
19
- import { clsUtility as clsUtilityJTR } from "../JavaTacticalRenderer/clsUtility";
20
-
21
- import { type int, type double } from "../../c5isr/graphics2d/BasicTypes";
22
-
23
- /**
24
- * Server general utility class
25
- *
26
- */
27
- export class clsUtility {
28
- private static readonly _className: string = "clsUtility";
29
- public static readonly Hatch_ForwardDiagonal: int = 2;
30
- public static readonly Hatch_BackwardDiagonal: int = 3;
31
- public static readonly Hatch_Vertical: int = 4;
32
- public static readonly Hatch_Horizontal: int = 5;
33
- public static readonly Hatch_Cross: int = 8;
34
-
35
- /**
36
- * Adds hatch fill to shapes via PatternFillRendererD.MakeHatchPatternFill() or buildHatchFill()
37
- * @param tg
38
- * @param shapes
39
- */
40
- static addHatchFills(tg: TGLight, shapes: Array<ShapeInfo>): void {
41
- try {
42
- if (shapes == null || shapes.length === 0) {
43
-
44
- return;
45
- }
46
-
47
-
48
- let lineType: int = tg.get_LineType();
49
- let hatchStyle: int = tg.get_FillStyle();
50
- let j: int = 0;
51
- let hatch2: int = 0;
52
- let shape2: Shape2;
53
- let index: int = 0;
54
- let hatchLineThickness: double = 1.5 + ((tg.get_LineThickness() / 2) - 1.5) * tg.get_patternScale();
55
- let hatchColor: Color = tg.get_LineColor();
56
- let hatchSpacing: int = Math.trunc(hatchLineThickness * 10);
57
-
58
- // if(armyc2.c5isr.JavaTacticalRenderer.clsUtility.isClosedPolygon(lineType)==false)
59
- // if(armyc2.c5isr.JavaTacticalRenderer.clsUtility.IsChange1Area(lineType, null)==false)
60
- // return;
61
- if (clsUtilityJTR.isClosedPolygon(lineType) === false) {
62
- if (clsUtilityJTR.IsChange1Area(lineType) === false) {
63
- switch(lineType)
64
- {
65
- case TacticalLines.BBS_AREA:
66
- case TacticalLines.BBS_LINE:
67
- case TacticalLines.BBS_RECTANGLE:
68
- break;
69
- default:
70
- return;
71
- }
72
- }
73
- }
74
-
75
- switch (lineType) {
76
- case TacticalLines.NFA:
77
- case TacticalLines.NFA_CIRCULAR:
78
- case TacticalLines.NFA_RECTANGULAR:
79
- case TacticalLines.LAA: {
80
- hatchStyle = clsUtility.Hatch_BackwardDiagonal;
81
- break;
82
- }
83
-
84
- case TacticalLines.BIO:
85
- case TacticalLines.NUC:
86
- case TacticalLines.CHEM:
87
- case TacticalLines.RAD: {
88
- hatchStyle = clsUtility.Hatch_BackwardDiagonal;
89
- hatchColor = Color.yellow;
90
- hatchLineThickness = 3 + (tg.get_LineThickness() - 3) * tg.get_patternScale();
91
- break;
92
- }
93
-
94
- case TacticalLines.WFZ: {
95
- hatchStyle = clsUtility.Hatch_BackwardDiagonal;
96
- if (tg.get_LineColor() === Color.BLACK) {
97
-
98
- hatchColor = Color.GRAY;
99
- }
100
-
101
- hatchSpacing = Math.trunc(hatchSpacing / 2);
102
- break;
103
- }
104
-
105
- case TacticalLines.OBSAREA: {
106
- //CPOF client required adding a simple shape for
107
- //setting texturepaint which WebRenderer does not use
108
- for (j = 0; j < shapes.length; j++) {
109
- let shape: ShapeInfo = shapes[j];
110
- let color: Color = shape.getLineColor();
111
- if (color == null) {
112
-
113
- continue;
114
- }
115
-
116
- //if(shape.getLineColor().getRGB()==0)
117
- if (shape.getLineColor().toRGB() === 0) {
118
-
119
- shapes.splice(j, 1);
120
- }
121
-
122
- }
123
- hatchStyle = clsUtility.Hatch_BackwardDiagonal;
124
- hatchSpacing = Math.trunc(hatchSpacing * 1.25);
125
- break;
126
- }
127
-
128
- default: {
129
- if (hatchStyle <= 0) {
130
-
131
- return;
132
- }
133
-
134
- break;
135
- }
136
-
137
- }
138
- //get the index of the shape with the same fillstyle
139
- let n: int = shapes.length;
140
- //for(j=0;j<shapes.length;j++)
141
- for (j = 0; j < n; j++) {
142
- shape2 = shapes[j] as Shape2;
143
- hatch2 = shape2.getFillStyle();
144
- if (hatch2 === hatchStyle) {
145
- index = j;
146
- break;
147
- }
148
- }
149
- n = shapes.length;
150
- //for(int k=0;k<shapes.length;k++)
151
- for (let k: int = 0; k < n; k++) {
152
- //the outline should always be the 0th shape for areas
153
- let shape: ShapeInfo;
154
- if (lineType === TacticalLines.RANGE_FAN || lineType === TacticalLines.RANGE_FAN_SECTOR || lineType === TacticalLines.RADAR_SEARCH) {
155
- shape = shapes[k];
156
- shape2 = shapes[k] as Shape2;
157
- hatchStyle = shape2.getFillStyle();
158
- }
159
- else {
160
-
161
- shape = shapes[index];
162
- }
163
-
164
-
165
- if (hatchStyle < clsUtility.Hatch_ForwardDiagonal) {
166
- //Hatch_ForwardDiagonal is the 0th hatch element
167
- continue;
168
- }
169
-
170
-
171
- if (tg.get_UseHatchFill()) {
172
- let hatchImg = PatternFillRenderer.MakeHatchPatternFill(hatchStyle, hatchSpacing, hatchLineThickness as int, hatchColor);
173
- shape.setPatternFillImage(hatchImg);
174
- }
175
- else {
176
- if (hatchStyle !== clsUtility.Hatch_Cross) {
177
- let shape3: Shape2 = clsUtility.buildHatchArea(tg, shape, hatchStyle, hatchSpacing);
178
- //shape.setStroke(new BasicStroke(1));
179
- shape3.setStroke(new BasicStroke(hatchLineThickness));
180
- shape3.setLineColor(hatchColor);
181
- shapes.push(shape3);
182
- }
183
- else //cross hatch
184
- {
185
- let shapeBk: Shape2 = clsUtility.buildHatchArea(tg, shape, clsUtility.Hatch_BackwardDiagonal, hatchSpacing);
186
- let shapeFwd: Shape2 = clsUtility.buildHatchArea(tg, shape, clsUtility.Hatch_ForwardDiagonal, hatchSpacing);
187
- //shapeBk.setStroke(new BasicStroke(1));
188
- shapeBk.setStroke(new BasicStroke(hatchLineThickness));
189
- shapeBk.setLineColor(hatchColor);
190
- shapes.push(shapeBk);
191
- //shapeFwd.setStroke(new BasicStroke(1));
192
- shapeFwd.setStroke(new BasicStroke(hatchLineThickness));
193
- shapeFwd.setLineColor(hatchColor);
194
- shapes.push(shapeFwd);
195
- }
196
- }
197
-
198
- if (lineType !== TacticalLines.RANGE_FAN && lineType !== TacticalLines.RANGE_FAN_SECTOR && lineType !== TacticalLines.RADAR_SEARCH) {
199
-
200
- break;
201
- }
202
-
203
- }
204
- } catch (exc) {
205
- if (exc instanceof Error) {
206
- ErrorLogger.LogException(clsUtility._className, "addHatchFills",
207
- new RendererException("Failed inside addHatchFills", exc));
208
- } else {
209
- throw exc;
210
- }
211
- }
212
- }
213
-
214
- /**
215
- * Build Hatch fill. Does not use texture paint or shader.
216
- * @param tg
217
- * @param shape
218
- * @param hatchStyle
219
- * @return
220
- */
221
- static buildHatchArea(tg: TGLight, shape: ShapeInfo, hatchStyle: int, spacing: double): Shape2 {
222
- let hatchLineShape: Shape2;
223
- try {
224
- hatchLineShape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
225
- let hatchLineArea: Area;
226
- let rect: Rectangle = shape.getBounds();
227
- let x0: double = rect.getX();
228
- let y0: double = rect.getY();
229
- let width: double = rect.getWidth();
230
- let height: double = rect.getHeight();
231
- //we need a square
232
- if (width > height) {
233
-
234
- height = width;
235
- }
236
-
237
- else {
238
-
239
- width = height;
240
- }
241
-
242
-
243
- //diagnostic
244
- if (tg.get_UseHatchFill()) {
245
- // hatchLineShape.moveTo(new POINT2(x0,y0));
246
- // hatchLineShape.lineTo(new POINT2(x0+width,y0));
247
- // hatchLineShape.lineTo(new POINT2(x0+width,y0+width));
248
- // hatchLineShape.lineTo(new POINT2(x0,y0+width));
249
- hatchLineShape.setFillStyle(hatchStyle);
250
- // hatchLineShape.lineTo(new POINT2(x0,y0));
251
- // Area shapeArea=new Area(shape.getShape());
252
- // hatchLineArea=new Area(hatchLineShape.getShape());
253
- // //intersect the hatch lines with the original shape area to get the fill
254
- // hatchLineArea.intersect(shapeArea);
255
- // hatchLineShape.setShape(hatchLineArea);
256
- hatchLineShape.setShape(lineutility.createStrokedShape(shape.getShape()));
257
- return hatchLineShape;
258
- }
259
- //end section
260
-
261
- width *= 2;
262
- height *= 2;
263
- //the next two values should be equal
264
- let horizLimit: int = 0;
265
- let vertLimit: int = 0;
266
- let j: int = 0;
267
- let vertPts: Array<POINT2> = new Array();
268
- let horizPts: Array<POINT2> = new Array();
269
- let vertPt: POINT2;
270
- let horizPt: POINT2;
271
- if (hatchStyle === clsUtility.Hatch_BackwardDiagonal) {
272
- horizLimit = Math.trunc(width / spacing);
273
- vertLimit = Math.trunc(height / spacing);
274
- for (j = 0; j < vertLimit; j++) {
275
- vertPt = new POINT2(x0, y0 + spacing * j);
276
- vertPts.push(vertPt);
277
- }
278
- for (j = 0; j < horizLimit; j++) {
279
- horizPt = new POINT2(x0 + spacing * j, y0);
280
- horizPts.push(horizPt);
281
- }
282
-
283
- hatchLineShape.moveTo(new POINT2(x0 - spacing / 2, y0 - spacing / 2));
284
- hatchLineShape.lineTo(new POINT2(x0, y0));
285
- for (j = 0; j < vertLimit; j++) {
286
- if (j % 2 === 0) {
287
- hatchLineShape.lineTo(vertPts[j]);
288
- hatchLineShape.lineTo(horizPts[j]);
289
- }
290
- else {
291
- hatchLineShape.lineTo(horizPts[j]);
292
- hatchLineShape.lineTo(vertPts[j]);
293
- }
294
- }
295
- //go outside the bottom right corner to complete a valid area
296
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing / 2, y0 + height + spacing / 2));
297
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing, y0 + height + spacing / 2));
298
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing, y0 - spacing / 2));
299
- hatchLineShape.lineTo(new POINT2(x0 - spacing / 2, y0 - spacing / 2));
300
- }
301
- if (hatchStyle === clsUtility.Hatch_ForwardDiagonal) {
302
- horizLimit = Math.trunc(width / spacing);
303
- vertLimit = Math.trunc(height / spacing);
304
- width /= 2;
305
- for (j = 0; j < vertLimit; j++) {
306
- vertPt = new POINT2(x0 + width, y0 + spacing * j);
307
- vertPts.push(vertPt);
308
- }
309
- for (j = 0; j < horizLimit; j++) {
310
- horizPt = new POINT2(x0 + width - spacing * j, y0);
311
- horizPts.push(horizPt);
312
- }
313
-
314
- hatchLineShape.moveTo(new POINT2(x0 + width + spacing / 2, y0 - spacing / 2));
315
- hatchLineShape.lineTo(new POINT2(x0, y0));
316
- for (j = 0; j < vertLimit; j++) {
317
- if (j % 2 === 0) {
318
- hatchLineShape.lineTo(vertPts[j]);
319
- hatchLineShape.lineTo(horizPts[j]);
320
- }
321
- else {
322
- hatchLineShape.lineTo(horizPts[j]);
323
- hatchLineShape.lineTo(vertPts[j]);
324
- }
325
- }
326
- //go outside the bottom left corner to complete a valid area
327
- hatchLineShape.lineTo(new POINT2(x0 - spacing / 2, y0 + height + spacing / 2));
328
- hatchLineShape.lineTo(new POINT2(x0 - spacing, y0 + height + spacing / 2));
329
- hatchLineShape.lineTo(new POINT2(x0 - spacing, y0 - spacing / 2));
330
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing / 2, y0 - spacing / 2));
331
- }
332
- if (hatchStyle === clsUtility.Hatch_Vertical) {
333
- horizLimit = Math.trunc(width / (spacing / 2));
334
- vertLimit = Math.trunc(height / (spacing / 2));
335
- for (j = 0; j < horizLimit; j++) {
336
- if (j % 2 === 0) {
337
- vertPt = new POINT2(x0 + spacing / 2 * j, y0);
338
- vertPts.push(vertPt);
339
- vertPt = new POINT2(x0 + spacing / 2 * j, y0 + height);
340
- vertPts.push(vertPt);
341
- }
342
- else {
343
- vertPt = new POINT2(x0 + spacing / 2 * j, y0 + height);
344
- vertPts.push(vertPt);
345
- vertPt = new POINT2(x0 + spacing / 2 * j, y0);
346
- vertPts.push(vertPt);
347
- }
348
- }
349
- hatchLineShape.moveTo(new POINT2(x0 - spacing / 2, y0 - spacing / 2));
350
- hatchLineShape.lineTo(new POINT2(x0, y0));
351
- for (j = 0; j < vertLimit - 1; j++) {
352
- hatchLineShape.lineTo(vertPts[j]);
353
- }
354
- //go outside the bottom right corner to complete a valid area
355
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing / 2, y0 + height + spacing / 2));
356
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing, y0 + height + spacing / 2));
357
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing, y0 - spacing / 2));
358
- hatchLineShape.lineTo(new POINT2(x0 - spacing / 2, y0 - spacing / 2));
359
- }
360
- if (hatchStyle === clsUtility.Hatch_Horizontal) {
361
- horizLimit = Math.trunc(width / (spacing / 2));
362
- vertLimit = Math.trunc(height / (spacing / 2));
363
- for (j = 0; j < vertLimit; j++) {
364
- if (j % 2 === 0) {
365
- horizPt = new POINT2(x0, y0 + spacing / 2 * j);
366
- horizPts.push(horizPt);
367
- horizPt = new POINT2(x0 + width, y0 + spacing / 2 * j);
368
- horizPts.push(horizPt);
369
- }
370
- else {
371
- horizPt = new POINT2(x0 + width, y0 + spacing / 2 * j);
372
- horizPts.push(horizPt);
373
- horizPt = new POINT2(x0, y0 + spacing / 2 * j);
374
- horizPts.push(horizPt);
375
- }
376
- }
377
- hatchLineShape.moveTo(new POINT2(x0 - spacing / 2, y0 - spacing / 2));
378
- hatchLineShape.lineTo(new POINT2(x0, y0));
379
- for (j = 0; j < vertLimit - 1; j++) {
380
- hatchLineShape.lineTo(horizPts[j]);
381
- }
382
- //go outside the bottom left corner to complete a valid area
383
- hatchLineShape.lineTo(new POINT2(x0 - spacing / 2, y0 + height + spacing / 2));
384
- hatchLineShape.lineTo(new POINT2(x0 - spacing, y0 + height + spacing / 2));
385
- hatchLineShape.lineTo(new POINT2(x0 - spacing, y0 - spacing / 2));
386
- hatchLineShape.lineTo(new POINT2(x0 + width + spacing / 2, y0 - spacing / 2));
387
- }
388
-
389
- let shapeArea: Area = new Area(shape.getShape());
390
- hatchLineArea = new Area(hatchLineShape.getShape());
391
- //intersect the hatch lines with the original shape area to get the fill
392
- hatchLineArea.intersect(shapeArea);
393
- hatchLineShape.setShape(hatchLineArea);
394
- //return null;
395
- } catch (exc) {
396
- if (exc instanceof Error) {
397
- ErrorLogger.LogException(clsUtility._className, "buildHatchArea",
398
- new RendererException("Failed inside buildHatchArea", exc));
399
- } else {
400
- throw exc;
401
- }
402
- }
403
- return hatchLineShape;
404
- }
405
-
406
- protected static POINT2ToPoint(pt2: POINT2): Point {
407
- let pt: Point = new Point();
408
- pt.x = pt2.x as int;
409
- pt.y = pt2.y as int;
410
- return pt;
411
- }
412
- protected static PointToPOINT2(pt: Point): POINT2 {
413
- let pt2: POINT2 = new POINT2(pt.x, pt.y);
414
- return pt2;
415
- }
416
- protected static POINT2ToPoint2D(pt2: POINT2): Point2D {
417
- let pt2d: Point2D = new Point2D(pt2.x, pt2.y);
418
- return pt2d;
419
- }
420
- static Points2DToPOINT2(pts2d: Array<Point2D>): Array<POINT2> {
421
- let pts: Array<POINT2> = new Array();
422
- let pt: POINT2;
423
- let n: int = pts2d.length;
424
- //for(int j=0;j<pts2d.length;j++)
425
- for (let j: int = 0; j < n; j++) {
426
- pt = new POINT2(pts2d[j].getX(), pts2d[j].getY());
427
- pts.push(pt);
428
- }
429
- return pts;
430
- }
431
- static Point2DToPOINT2(pt2d: Point2D): POINT2 {
432
- let pt2: POINT2 = new POINT2(pt2d.getX(), pt2d.getY());
433
- return pt2;
434
- }
435
- /**
436
- * @deprecated
437
- * @param tg
438
- * @return
439
- */
440
- protected static addModifiersBeforeClipping(tg: TGLight): boolean {
441
- let result: boolean = false;
442
- let linetype: int = tg.get_LineType();
443
- switch (linetype) {
444
- case TacticalLines.TORPEDO:
445
- case TacticalLines.OPTICAL:
446
- case TacticalLines.ELECTRO:
447
- case TacticalLines.BEARING_EW:
448
- case TacticalLines.ACOUSTIC:
449
- case TacticalLines.ACOUSTIC_AMB:
450
- case TacticalLines.BEARING:
451
- case TacticalLines.BEARING_J:
452
- case TacticalLines.BEARING_RDF:
453
- case TacticalLines.MSR:
454
- case TacticalLines.MSR_ONEWAY:
455
- case TacticalLines.MSR_TWOWAY:
456
- case TacticalLines.MSR_ALT:
457
- case TacticalLines.ASR:
458
- case TacticalLines.ASR_ONEWAY:
459
- case TacticalLines.ASR_TWOWAY:
460
- case TacticalLines.ASR_ALT:
461
- case TacticalLines.ROUTE:
462
- case TacticalLines.ROUTE_ONEWAY:
463
- case TacticalLines.ROUTE_ALT:
464
- case TacticalLines.HCONVOY:
465
- case TacticalLines.CONVOY:
466
- case TacticalLines.MFP:
467
- case TacticalLines.RFL:
468
- case TacticalLines.NFL:
469
- case TacticalLines.CFL:
470
- case TacticalLines.TRIP:
471
- case TacticalLines.FSCL:
472
- case TacticalLines.BCL_REVD:
473
- case TacticalLines.BCL:
474
- case TacticalLines.ICL:
475
- case TacticalLines.IFF_OFF:
476
- case TacticalLines.IFF_ON:
477
- case TacticalLines.GENERIC_LINE:
478
- case TacticalLines.FPF:
479
- case TacticalLines.LINTGT:
480
- case TacticalLines.LINTGTS:
481
- case TacticalLines.MSDZ:
482
- case TacticalLines.GAP:
483
- case TacticalLines.IL:
484
- case TacticalLines.DIRATKAIR:
485
- case TacticalLines.PDF:
486
- case TacticalLines.AC:
487
- case TacticalLines.SAAFR:
488
- case TacticalLines.LLTR:
489
- case TacticalLines.SC:
490
- case TacticalLines.MRR:
491
- case TacticalLines.SL:
492
- case TacticalLines.TC:
493
- case TacticalLines.BOUNDARY:
494
- case TacticalLines.WDRAWUP:
495
- case TacticalLines.WITHDRAW:
496
- case TacticalLines.RETIRE:
497
- case TacticalLines.FPOL:
498
- case TacticalLines.RPOL:
499
- case TacticalLines.RIP:
500
- case TacticalLines.DELAY:
501
- case TacticalLines.CATK:
502
- case TacticalLines.CATKBYFIRE:
503
- case TacticalLines.SCREEN:
504
- case TacticalLines.COVER:
505
- case TacticalLines.GUARD:
506
- case TacticalLines.FLOT:
507
- case TacticalLines.LC:
508
- case TacticalLines.PL:
509
- case TacticalLines.FEBA:
510
- case TacticalLines.LL:
511
- case TacticalLines.EWL:
512
- case TacticalLines.FCL:
513
- case TacticalLines.HOLD:
514
- case TacticalLines.BRDGHD:
515
- case TacticalLines.HOLD_GE:
516
- case TacticalLines.BRDGHD_GE:
517
- case TacticalLines.LOA:
518
- case TacticalLines.LOD:
519
- case TacticalLines.LDLC:
520
- case TacticalLines.PLD:
521
- case TacticalLines.RELEASE:
522
- case TacticalLines.HOL:
523
- case TacticalLines.BHL: {
524
- result = true;
525
- break;
526
- }
527
-
528
- default: {
529
- break;
530
- }
531
-
532
- }
533
- if (clsUtilityJTR.isClosedPolygon(linetype) === true) {
534
-
535
- result = true;
536
- }
537
-
538
- return result;
539
- }
540
-
541
- /**
542
- * @deprecated
543
- */
544
- protected static FilterPoints(tg: TGLight): void {
545
- try {
546
- let lineType: int = tg.get_LineType();
547
- let minSpikeDistance: double = 0;
548
- switch (lineType) {
549
- //case TacticalLines.LC:
550
- case TacticalLines.ATDITCH:
551
- case TacticalLines.ATDITCHC:
552
- case TacticalLines.ATDITCHM:
553
- case TacticalLines.FLOT:
554
- case TacticalLines.FORT_REVD:
555
- case TacticalLines.FORT:
556
- case TacticalLines.FORTL:
557
- case TacticalLines.STRONG: {
558
- minSpikeDistance = 25;
559
- break;
560
- }
561
-
562
- case TacticalLines.LC:
563
- case TacticalLines.OBSAREA:
564
- case TacticalLines.OBSFAREA:
565
- case TacticalLines.ENCIRCLE:
566
- case TacticalLines.ZONE:
567
- case TacticalLines.LINE:
568
- case TacticalLines.ATWALL:
569
- case TacticalLines.UNSP:
570
- case TacticalLines.SFENCE:
571
- case TacticalLines.DFENCE:
572
- case TacticalLines.DOUBLEA:
573
- case TacticalLines.LWFENCE:
574
- case TacticalLines.HWFENCE:
575
- case TacticalLines.SINGLEC:
576
- case TacticalLines.DOUBLEC:
577
- case TacticalLines.TRIPLE: {
578
- minSpikeDistance = 35;
579
- break;
580
- }
581
-
582
- case TacticalLines.UCF:
583
- case TacticalLines.CF:
584
- case TacticalLines.CFG:
585
- case TacticalLines.CFY: {
586
- minSpikeDistance = 60;
587
- break;
588
- }
589
-
590
- case TacticalLines.SF:
591
- case TacticalLines.USF:
592
- case TacticalLines.OCCLUDED:
593
- case TacticalLines.UOF: {
594
- minSpikeDistance = 60;//was 120
595
- break;
596
- }
597
-
598
- case TacticalLines.SFG:
599
- case TacticalLines.SFY: {
600
- minSpikeDistance = 60;//was 180
601
- break;
602
- }
603
-
604
- case TacticalLines.WFY:
605
- case TacticalLines.WFG:
606
- case TacticalLines.OFY: {
607
- minSpikeDistance = 60;//was 120
608
- break;
609
- }
610
-
611
- case TacticalLines.WF:
612
- case TacticalLines.UWF: {
613
- minSpikeDistance = 40;
614
- break;
615
- }
616
-
617
-
618
- case TacticalLines.RIDGE:
619
- case TacticalLines.ICE_EDGE_RADAR: //METOCs
620
- case TacticalLines.ICE_OPENINGS_FROZEN:
621
- case TacticalLines.CRACKS_SPECIFIC_LOCATION: {
622
- minSpikeDistance = 35;
623
- break;
624
- }
625
-
626
- default: {
627
- return;
628
- }
629
-
630
- }
631
- let j: int = 0;
632
- let dist: double = 0;
633
- let pts: Array<POINT2> = new Array();
634
- let ptsGeo: Array<POINT2> = new Array();
635
- pts.push(tg.Pixels[0]);
636
- ptsGeo.push(tg.LatLongs[0]);
637
- let lastGoodPt: POINT2 = tg.Pixels[0];
638
- let currentPt: POINT2;
639
- let currentPtGeo: POINT2;
640
- let foundGoodPt: boolean = false;
641
- let n: int = tg.Pixels.length;
642
- //for(j=1;j<tg.Pixels.length;j++)
643
- for (j = 1; j < n; j++) {
644
- //we can not filter out the original end points
645
- currentPt = tg.Pixels[j];
646
- currentPtGeo = tg.LatLongs[j];
647
- if (currentPt.style === -1) {
648
- lastGoodPt = currentPt;
649
- pts.push(currentPt);
650
- ptsGeo.push(currentPtGeo);
651
- foundGoodPt = true;
652
- currentPt.style = 0;
653
- continue;
654
- }
655
- dist = lineutility.CalcDistanceDouble(lastGoodPt, currentPt);
656
- switch (lineType) {
657
- case TacticalLines.LC: {
658
- if (dist > minSpikeDistance) {
659
- lastGoodPt = currentPt;
660
- pts.push(currentPt);
661
- ptsGeo.push(currentPtGeo);
662
- foundGoodPt = true;
663
- }
664
- else { //the last point is no good
665
- //replace the last good point with the last point
666
- if (j === tg.Pixels.length - 1) {
667
- pts[pts.length - 1] = currentPt;
668
- ptsGeo[ptsGeo.length - 1] = currentPtGeo;
669
- }
670
- }
671
- break;
672
- }
673
-
674
- default: {
675
- if (dist > minSpikeDistance || j === tg.Pixels.length - 1) {
676
- lastGoodPt = currentPt;
677
- pts.push(currentPt);
678
- ptsGeo.push(currentPtGeo);
679
- foundGoodPt = true;
680
- }
681
- break;
682
- }
683
-
684
- }
685
- }
686
- if (foundGoodPt === true) {
687
- tg.Pixels = pts;
688
- tg.LatLongs = ptsGeo;
689
- }
690
- } catch (exc) {
691
- if (exc instanceof Error) {
692
- ErrorLogger.LogException("clsUtility", "FilterPoints",
693
- new RendererException("Failed inside FilterPoints", exc));
694
-
695
- } else {
696
- throw exc;
697
- }
698
- }
699
- }
700
-
701
- public static PixelsToLatLong(pts: Array<POINT2>, converter: IPointConversion): Array<POINT2> {
702
- let j: int = 0;
703
- let pt: POINT2;
704
- let ptGeo: POINT2;
705
- let ptsGeo: Array<POINT2> = new Array();
706
- let n: int = pts.length;
707
- //for(j=0;j<pts.length;j++)
708
- for (j = 0; j < n; j++) {
709
- pt = pts[j];
710
- ptGeo = clsUtility.PointPixelsToLatLong(pt, converter);
711
- ptsGeo.push(ptGeo);
712
- }
713
- return ptsGeo;
714
- }
715
-
716
- static LatLongToPixels(pts: Array<POINT2>, converter: IPointConversion): Array<POINT2> {
717
- let j: int = 0;
718
- let pt: POINT2;
719
- let ptPixels: POINT2;
720
- let ptsPixels: Array<POINT2> = new Array();
721
- let n: int = pts.length;
722
- //for(j=0;j<pts.length;j++)
723
- for (j = 0; j < n; j++) {
724
- pt = pts[j];
725
- ptPixels = clsUtility.PointLatLongToPixels(pt, converter);
726
- ptsPixels.push(ptPixels);
727
- }
728
- return ptsPixels;
729
- }
730
-
731
- private static PointLatLongToPixels(ptLatLong: POINT2, converter: IPointConversion): POINT2 {
732
- let pt2: POINT2 = new POINT2();
733
- let pt2d: Point2D = clsUtility.POINT2ToPoint2D(ptLatLong);
734
- pt2d = converter.GeoToPixels(pt2d);
735
- pt2 = clsUtility.Point2DToPOINT2(pt2d);
736
- pt2.style = ptLatLong.style;
737
- return pt2;
738
- }
739
-
740
- static FilterAXADPoints(tg: TGLight, converter: IPointConversion): void {
741
- try {
742
- let lineType: int = tg.get_LineType();
743
- switch (lineType) {
744
- case TacticalLines.CATK:
745
- case TacticalLines.CATKBYFIRE:
746
- case TacticalLines.AIRAOA:
747
- case TacticalLines.AAAAA:
748
- case TacticalLines.SPT:
749
- case TacticalLines.MAIN: {
750
- break;
751
- }
752
-
753
- default: {
754
- return;
755
- }
756
-
757
- }
758
- let j: int = 0;
759
- let pts: Array<POINT2> = new Array();
760
- let ptsGeo: Array<POINT2> = new Array();
761
- let pt0: POINT2 = tg.Pixels[0];
762
- let pt1: POINT2 = tg.Pixels[1];
763
-
764
- let pt: Point2D = new Point2D(pt1.x, pt1.y);
765
- let pt1Geo2d: Point2D = converter.PixelsToGeo(pt);
766
-
767
- let pt1geo: POINT2 = new POINT2(pt1Geo2d.getX(), pt1Geo2d.getY());
768
- let ptj: POINT2;
769
- let ptjGeo: POINT2;
770
- let controlPt: POINT2 = tg.Pixels[tg.Pixels.length - 1]; //the control point
771
- let pt0Relative: POINT2 = lineutility.PointRelativeToLine(pt0, pt1, pt0, controlPt);
772
- let relativeDist: double = lineutility.CalcDistanceDouble(pt0Relative, controlPt);
773
- relativeDist += 5;
774
- let pt0pt1dist: double = lineutility.CalcDistanceDouble(pt0, pt1);
775
- let foundGoodPoint: boolean = false;
776
- if (relativeDist > pt0pt1dist) {
777
- //first point is too close, begin rebuilding the arrays
778
- pts.push(pt0);
779
- pt = new Point2D(pt0.x, pt0.y);
780
- pt1Geo2d = converter.PixelsToGeo(pt);
781
-
782
- pt1geo = new POINT2(pt1Geo2d.getX(), pt1Geo2d.getY());
783
- ptsGeo.push(pt1geo);
784
- //create a good first point and add it to the array
785
- pt1 = lineutility.ExtendAlongLineDouble(pt0, pt1, relativeDist);
786
- pts.push(pt1);
787
-
788
- pt = new Point2D(pt1.x, pt1.y);
789
- pt1Geo2d = converter.PixelsToGeo(pt);
790
- pt1geo = new POINT2(pt1Geo2d.getX(), pt1Geo2d.getY());
791
- ptsGeo.push(pt1geo);
792
- }
793
- else {
794
- //the first point is good, there is no need to do anything
795
- foundGoodPoint = true;
796
- pts = tg.Pixels;
797
- ptsGeo = tg.LatLongs;
798
- }
799
-
800
- //do not add mores points to the array until we find at least one good point
801
- let n: int = tg.Pixels.length;
802
- if (foundGoodPoint === false) {
803
- //for(j=2;j<tg.Pixels.length-1;j++)
804
- for (j = 2; j < n - 1; j++) {
805
- ptj = tg.Pixels[j];
806
- ptjGeo = tg.LatLongs[j];
807
- if (foundGoodPoint) {
808
- //then stuff the remainder of the arrays with the original points
809
- pts.push(ptj);
810
- ptsGeo.push(ptjGeo);
811
- }
812
- else //no good points yet
813
- {
814
- //calculate the distance and continue if it is no good
815
- pt0pt1dist = lineutility.CalcDistanceDouble(pt0, ptj);
816
- if (relativeDist > pt0pt1dist) {
817
-
818
- continue;
819
- }
820
-
821
- else {
822
- //found a good point
823
- pts.push(ptj);
824
- ptsGeo.push(ptjGeo);
825
- //set the boolean so that it will stuff the array with the rest of the points
826
- foundGoodPoint = true;
827
- }
828
- }
829
- }
830
- //finally add the control point to the arrays and set the arrays
831
- pts.push(controlPt);
832
- //pt1Geo2d=converter.convertPixelsToLonLat(controlPt.x, controlPt.y);
833
- pt = new Point2D(controlPt.x, controlPt.y);
834
- pt1Geo2d = converter.PixelsToGeo(pt);
835
-
836
- pt1geo = new POINT2(pt1Geo2d.getX(), pt1Geo2d.getY());
837
- ptsGeo.push(pt1geo);
838
- } //end if foundGoodPoint is false
839
-
840
- //add all the successive points which are far enough apart
841
- let lastGoodPt: POINT2 = pts[1];
842
- let currentPt: POINT2;
843
- let currentPtGeo: POINT2;
844
- let dist: double = 0;
845
- tg.Pixels = new Array();
846
- tg.LatLongs = new Array();
847
- for (j = 0; j < 2; j++) {
848
- tg.Pixels.push(pts[j]);
849
- tg.LatLongs.push(ptsGeo[j]);
850
- }
851
- n = pts.length;
852
- //for(j=2;j<pts.length-1;j++)
853
- for (j = 2; j < n - 1; j++) {
854
- currentPt = pts[j];
855
- currentPtGeo = ptsGeo[j];
856
- dist = lineutility.CalcDistanceDouble(currentPt, lastGoodPt);
857
- if (dist > 5) {
858
- lastGoodPt = currentPt;
859
- tg.Pixels.push(currentPt);
860
- tg.LatLongs.push(currentPtGeo);
861
- }
862
- }
863
- //add the control point
864
- tg.Pixels.push(pts[pts.length - 1]);
865
- tg.LatLongs.push(ptsGeo[ptsGeo.length - 1]);
866
- } catch (exc) {
867
- if (exc instanceof Error) {
868
- ErrorLogger.LogException("clsUtility", "FilterAXADPoints",
869
- new RendererException("Failed inside FilterAXADPoints", exc));
870
-
871
- } else {
872
- throw exc;
873
- }
874
- }
875
- }
876
- /**
877
- *
878
- * @param tg
879
- */
880
- static RemoveDuplicatePoints(tg: TGLight): void {
881
- try {
882
- //do not remove autoshape duplicate points
883
- // if(isAutoshape(tg))
884
- // return;
885
- switch (tg.get_LineType()) {
886
- case TacticalLines.SC:
887
- case TacticalLines.MRR:
888
- case TacticalLines.SL:
889
- case TacticalLines.TC:
890
- case TacticalLines.LLTR:
891
- case TacticalLines.AC:
892
- case TacticalLines.SAAFR: {
893
- break;
894
- }
895
-
896
- default: {
897
- if (clsUtilityJTR.isAutoshape(tg)) {
898
- return;
899
- }
900
-
901
- }
902
-
903
- }
904
-
905
- //we assume tg.H to have colors if it is comma delimited.
906
- //only exit if colors are not set
907
- switch (tg.get_LineType()) //preserve segment data
908
- {
909
- case TacticalLines.CATK:
910
- case TacticalLines.AIRAOA:
911
- case TacticalLines.AAAAA:
912
- case TacticalLines.SPT:
913
- case TacticalLines.MAIN:
914
- case TacticalLines.CATKBYFIRE: { //80
915
- return;
916
- }
917
-
918
- case TacticalLines.BOUNDARY:
919
- case TacticalLines.MSR:
920
- case TacticalLines.ASR:
921
- case TacticalLines.ROUTE: {
922
- let strH: string = tg.get_H();
923
- if (strH != null && strH.length > 0) {
924
- let strs: string[] = strH.split(",");
925
- if (strs.length > 1) {
926
-
927
- return;
928
- }
929
-
930
- }
931
- break;
932
- }
933
-
934
- default: {
935
- break;
936
- }
937
-
938
- }
939
- let linetype: int = tg.get_LineType();
940
- if (clsUtilityJTR.IsChange1Area(linetype)) {
941
- return;
942
- }
943
-
944
-
945
- let ptCurrent: POINT2;
946
- let ptLast: POINT2;
947
- let isClosedPolygon: boolean = clsUtilityJTR.isClosedPolygon(tg.get_LineType());
948
- let minSize: int = 2;
949
- if (isClosedPolygon) {
950
- minSize = 3;
951
- }
952
-
953
- for (let j: int = 1; j < tg.Pixels.length; j++) {
954
- ptLast = new POINT2(tg.Pixels[j - 1]);
955
- ptCurrent = new POINT2(tg.Pixels[j]);
956
- //if(ptCurrent.x==ptLast.x && ptCurrent.y==ptLast.y)
957
- if (Math.abs(ptCurrent.x - ptLast.x) < 0.5 && Math.abs(ptCurrent.y - ptLast.y) < 0.5) {
958
- if (tg.Pixels.length > minSize) {
959
- tg.Pixels.splice(j, 1);
960
- tg.LatLongs.splice(j, 1);
961
- j = 1;
962
- }
963
- }
964
- }
965
- } catch (exc) {
966
- if (exc instanceof Error) {
967
- ErrorLogger.LogException("clsUtility", "RemoveDuplicatePoints",
968
- new RendererException("Failed inside RemoveDuplicatePoints", exc));
969
-
970
- } else {
971
- throw exc;
972
- }
973
- }
974
- }
975
- static PointPixelsToLatLong(ptPixels: POINT2, converter: IPointConversion): POINT2 {
976
- let pt2: POINT2 = new POINT2();
977
- try {
978
- //Point pt=POINT2ToPoint(ptPixels);
979
- let pt: Point2D = new Point2D(ptPixels.x, ptPixels.y);
980
- let pt2d: Point2D = converter.PixelsToGeo(pt);
981
- pt2 = clsUtility.Point2DToPOINT2(pt2d);
982
- pt2.style = ptPixels.style;
983
-
984
- } catch (exc) {
985
- if (exc instanceof Error) {
986
- ErrorLogger.LogException("clsUtility", "PointPixelsToLatLong",
987
- new RendererException("Could not convert point to geo", exc));
988
- } else {
989
- throw exc;
990
- }
991
- }
992
- return pt2;
993
- }
994
-
995
- static getMBR(clipBounds: Array<Point2D>): Rectangle2D {
996
- let rect: Rectangle2D;
997
- try {
998
- let j: int = 0;
999
- let pt: Point2D;
1000
- let xmax: double = clipBounds[0].getX();
1001
- let xmin: double = xmax;
1002
- let ymax: double = clipBounds[0].getY();
1003
- let ymin: double = ymax;
1004
- let n: int = clipBounds.length;
1005
- //for(j=0;j<clipBounds.length;j++)
1006
- for (j = 0; j < n; j++) {
1007
- pt = clipBounds[j];
1008
- if (pt.getX() < xmin) {
1009
-
1010
- xmin = pt.getX();
1011
- }
1012
-
1013
- if (pt.getX() > xmax) {
1014
-
1015
- xmax = pt.getX();
1016
- }
1017
-
1018
- if (pt.getY() <= ymin) {
1019
-
1020
- ymin = pt.getY();
1021
- }
1022
-
1023
- if (pt.getY() > ymax) {
1024
-
1025
- ymax = pt.getY();
1026
- }
1027
-
1028
- }
1029
- rect = new Rectangle2D(xmin, ymin, xmax - xmin, ymax - ymin);
1030
- } catch (exc) {
1031
- if (exc instanceof Error) {
1032
- ErrorLogger.LogException(clsUtility._className, "AddBoundaryPointsForLines",
1033
- new RendererException("Failed inside AddBoundaryPointsForLines", exc));
1034
- } else {
1035
- throw exc;
1036
- }
1037
- }
1038
- return rect;
1039
- }
1040
-
1041
- static GetMBR(shapes: Array<Shape2>,
1042
- ptUl: POINT2,
1043
- ptUr: POINT2,
1044
- ptLr: POINT2,
1045
- ptLl: POINT2): void {
1046
- try {
1047
- let firstPoint: POINT2 = shapes[0].getPoints()[0];
1048
- ptUl.x = firstPoint.x;
1049
- ptUl.y = firstPoint.y;
1050
- ptUr.x = firstPoint.x;
1051
- ptUr.y = firstPoint.y;
1052
- ptLl.x = firstPoint.x;
1053
- ptLl.y = firstPoint.y;
1054
- ptLr.x = firstPoint.x;
1055
- ptLr.y = firstPoint.y;
1056
- for (let shape of shapes) {
1057
- let points: Array<POINT2> = shape.getPoints();
1058
- for (let j: int = 0; j < points.length; j++) {
1059
- let x: double = points[j].x;
1060
- let y: double = points[j].y;
1061
- if (x < ptLl.x) {
1062
- ptLl.x = x;
1063
- ptUl.x = x;
1064
- }
1065
- if (x > ptLr.x) {
1066
- ptLr.x = x;
1067
- ptUr.x = x;
1068
- }
1069
- if (y > ptLl.y) {
1070
- ptLl.y = y;
1071
- ptLr.y = y;
1072
- }
1073
- if (y < ptUl.y) {
1074
- ptUl.y = y;
1075
- ptUr.y = y;
1076
- }
1077
- }
1078
- }
1079
-
1080
- } catch (exc) {
1081
- if (exc instanceof Error) {
1082
- ErrorLogger.LogException(clsUtility._className, "GetMBR",
1083
- new RendererException("Failed inside GetMBR", exc));
1084
- } else {
1085
- throw exc;
1086
- }
1087
- }
1088
- }
1089
- }