@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,871 +0,0 @@
1
- import { type int, type double } from "../../c5isr/graphics2d/BasicTypes";
2
-
3
- import { lineutility } from "../JavaLineArray/lineutility"
4
- import { POINT2 } from "../JavaLineArray/POINT2"
5
- import { Shape2 } from "../JavaLineArray/Shape2"
6
- import { TacticalLines } from "../JavaLineArray/TacticalLines"
7
- import { TGLight } from "../JavaTacticalRenderer/TGLight"
8
- import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
9
- import { RendererException } from "../renderer/utilities/RendererException"
10
- import { clsUtility } from "../JavaTacticalRenderer/clsUtility"
11
- import { clsUtilityCPOF } from "../RenderMultipoints/clsUtilityCPOF"
12
- import { clsUtilityGE } from "../RenderMultipoints/clsUtilityGE"
13
- import { Point2D } from "../graphics2d/Point2D";
14
- import { Polygon } from "../graphics2d/Polygon";
15
- import { Line2D } from "../graphics2d/Line2D";
16
-
17
-
18
- /**
19
- * Class to clip polygons
20
- *
21
- */
22
- export class clsClipQuad {
23
- private static readonly _className: string = "clsClipQuad";
24
- /**
25
- * Use the new version which takes an array for polygon clip bounds instead of rectangle
26
- * @param polygon
27
- * @param clipBounds
28
- * @return
29
- */
30
- private static AddBoundaryPointsForLines(polygon: Array<Point2D>,
31
- clipBounds: Array<Point2D>): int {
32
- let result: int = 0;
33
- try {
34
- let pt02d: Point2D = polygon[0];
35
- let ptLast2d: Point2D = polygon[(polygon.length - 1)];
36
- let pt0: POINT2 = new POINT2(pt02d.getX(), pt02d.getY());
37
- let ptLast: POINT2 = new POINT2(ptLast2d.getX(), ptLast2d.getY());
38
- let nearestPt: Point2D = new Point2D();
39
- let clipArray: Polygon = new Polygon();
40
- let j: int = 0;
41
- let minDist: double = Number.MAX_VALUE;
42
- let dist: double = 0;
43
- let sidePt: POINT2 = new POINT2();
44
- let addToFront: boolean = false;
45
- let addToEnd: boolean = false;
46
- //int n=clipBounds.length;
47
- //for(j=0;j<clipBounds.length;j++)
48
- for (j = 0; j < clipBounds.length; j++) //was n
49
- {
50
- clipArray.addPoint(clipBounds[j].getX() as int, clipBounds[j].getY() as int);
51
- }
52
-
53
- let totalX: double = 0;
54
- let totalY: double = 0;
55
- let counter: int = 0;
56
- //for(j=0;j<clipBounds.length-1;j++)
57
- for (j = 0; j < clipBounds.length - 1; j++) //was n-1
58
- {
59
- totalX += clipBounds[j].getX();
60
- totalY += clipBounds[j].getY();
61
- counter++;
62
- }
63
- //if clipBounds is not closed add the jth point
64
- if (clipBounds[0].getX() !== clipBounds[j].getX() ||
65
- clipBounds[0].getY() !== clipBounds[j].getY()) {
66
- totalX += clipBounds[j].getX();
67
- totalY += clipBounds[j].getY();
68
- counter++;
69
- }
70
- let avgX: double = totalX / counter;
71
- let avgY: double = totalY / counter;
72
- let ptCenter: POINT2 = new POINT2(avgX, avgY);
73
- let ptNear: POINT2;
74
- //first point outside the clip bounds
75
- if (clipArray.contains(pt02d) === false) {
76
- //add nearest segment midpoint to the front
77
- //for(j=0;j<clipBounds.length;j++)
78
- for (j = 0; j < clipBounds.length; j++) //was n
79
- {
80
- sidePt.x = clipBounds[j].getX();
81
- sidePt.y = clipBounds[j].getY();
82
- dist = lineutility.CalcDistanceDouble(pt0, sidePt);
83
- if (dist < minDist) {
84
- minDist = dist;
85
- //minDistIndex=j;
86
- nearestPt.setLocation(sidePt.x, sidePt.y);
87
- }
88
- }
89
- //move nearestPt in a bit to not get clipped
90
- ptNear = new POINT2(nearestPt.getX(), nearestPt.getY());
91
- ptNear = lineutility.ExtendAlongLineDouble(ptNear, ptCenter, 2);
92
- nearestPt.setLocation(ptNear.x, ptNear.y);
93
- polygon.splice(0, 0, nearestPt);
94
- addToFront = true;
95
- }
96
- //re-initialize variables
97
- nearestPt = new Point2D();
98
- minDist = Number.MAX_VALUE;
99
- //last point outside the clip bounds
100
- if (clipArray.contains(ptLast2d) === false) {
101
- //add nearest segment midpoint to the front
102
- //for(j=0;j<clipBounds.length;j++)
103
- for (j = 0; j < clipBounds.length; j++) //was n
104
- {
105
- sidePt.x = clipBounds[j].getX();
106
- sidePt.y = clipBounds[j].getY();
107
- dist = lineutility.CalcDistanceDouble(ptLast, sidePt);
108
- if (dist < minDist) {
109
- minDist = dist;
110
- //minDistIndex=j;
111
- nearestPt.setLocation(sidePt.x, sidePt.y);
112
- }
113
- }
114
- //move nearestPt in a bit to not get clipped
115
- ptNear = new POINT2(nearestPt.getX(), nearestPt.getY());
116
- ptNear = lineutility.ExtendAlongLineDouble(ptNear, ptCenter, 2);
117
- nearestPt.setLocation(ptNear.x, ptNear.y);
118
- polygon.push(nearestPt);
119
- addToEnd = true;
120
- }
121
- if (addToFront === false && addToEnd === false) {
122
- result = 0;
123
- }
124
- else {
125
- if (addToFront === true && addToEnd === false) {
126
- result = 1;
127
- }
128
- else {
129
- if (addToFront === false && addToEnd === true) {
130
- result = 2;
131
- }
132
- else {
133
- if (addToFront === true && addToEnd === true) {
134
- result = 3;
135
- }
136
- }
137
-
138
- }
139
-
140
- }
141
-
142
- } catch (exc) {
143
- if (exc instanceof Error) {
144
- ErrorLogger.LogException(clsClipQuad._className, "AddBoundaryPointsForLines",
145
- new RendererException("Failed inside AddBoundaryPointsForLines", exc));
146
- } else {
147
- throw exc;
148
- }
149
- }
150
- return result;
151
- }
152
- private static CalcTrueIntersectDouble(m1: double,
153
- b1: double,
154
- m2: double,
155
- b2: double,
156
- bolVertical1: int,
157
- bolVertical2: int,
158
- X1: double, //x intercept if line1 is vertical
159
- X2: double): Point2D {
160
- let ptIntersect: Point2D = new Point2D(X1, X2);
161
- try {
162
- let x: double = 0;
163
- let y: double = 0;
164
-
165
- if (bolVertical1 === 0 && bolVertical2 === 0) {
166
- //both lines vertical
167
- return ptIntersect;
168
- }
169
-
170
- //the following 3 if blocks are the only ways to get an intersection
171
- if (bolVertical1 === 0 && bolVertical2 === 1) //line1 vertical, line2 not
172
- {
173
- ptIntersect.setLocation(X1, m2 * X1 + b2);
174
- return ptIntersect;
175
- }
176
- if (bolVertical1 === 1 && bolVertical2 === 0) //line2 vertical, line1 not
177
- {
178
- ptIntersect.setLocation(X2, m1 * X2 + b1);
179
- return ptIntersect;
180
- }
181
- //if either of the lines is vertical function has already returned
182
- //so both m1 and m2 should be valid
183
- //should always be using this ocase because the lines are neither vertical
184
- //or horizontal and are perpendicular
185
- if (m1 !== m2) {
186
- x = (b2 - b1) / (m1 - m2); //cannot blow up
187
- y = (m1 * x + b1);
188
- ptIntersect.setLocation(x, y);
189
- return ptIntersect;
190
- }
191
- } catch (exc) {
192
- if (exc instanceof Error) {
193
- ErrorLogger.LogException(clsClipQuad._className, "CalcTrueIntersectDouble",
194
- new RendererException("Failed inside CalcTrueIntersectDouble", exc));
195
- } else {
196
- throw exc;
197
- }
198
- }
199
- return ptIntersect;
200
- }
201
- /**
202
- * Gets theoretical intersection of an edge with the line connecting previous and current points.
203
- * @param previous
204
- * @param current
205
- * @param currentEdge the current edge of the clip area, assumed to not be vertical
206
- * @return
207
- */
208
- private static intersectPoint2(previous: Point2D,
209
- current: Point2D,
210
- currentEdge: Line2D): Point2D {
211
-
212
- let ptIntersect: Point2D;
213
- try {
214
- let ll: Point2D = currentEdge.getP1();
215
- let ul: Point2D = currentEdge.getP2();
216
-
217
- //no vertical client segments
218
- //if(current.getX()==previous.getX())
219
- if (Math.abs(current.getX() - previous.getX()) < 1) {
220
-
221
- current.setLocation(current.getX() + 1, current.getY());
222
- }
223
-
224
-
225
- let m1: double = (ul.getY() - ll.getY()) / (ul.getX() - ll.getX());
226
- let m2: double = (current.getY() - previous.getY()) / (current.getX() - previous.getX());
227
- let b1: double = ul.getY() - m1 * ul.getX();
228
- let b2: double = current.getY() - m2 * current.getX();
229
- ptIntersect = clsClipQuad.CalcTrueIntersectDouble(m1, b1, m2, b2, 1, 1, 0, 0);
230
- } catch (exc) {
231
- if (exc instanceof Error) {
232
- ErrorLogger.LogException(clsClipQuad._className, "intersectPoint2",
233
- new RendererException("Failed inside intersectPoint2", exc));
234
- } else {
235
- throw exc;
236
- }
237
- }
238
- return ptIntersect;
239
- }
240
-
241
- /**
242
- * clips array of pts against a side of the clip bounds polygon
243
- * assumes clipBounds has no vertical or horizontal segments
244
- * @param pts array of points to clip against the clip bounds
245
- * @param index starting index of clipBounds for the side to clip against
246
- * @param clipBounds a quadrilateral or a polygon array that is the clipping area
247
- * @return the clipped array of points
248
- */
249
- private static clipSide(tg: TGLight, pts: Array<Point2D>,
250
- index: int,
251
- clipBounds: Array<Point2D>): Array<Point2D> {
252
- let ptsResult: Array<Point2D>;
253
- try {
254
- let pt1: Point2D = new Point2D(clipBounds[index].getX(), clipBounds[index].getY());//first point of clip side
255
- let pt2: Point2D = new Point2D(clipBounds[index + 1].getX(), clipBounds[index + 1].getY());//last point of clip side
256
- let clipBoundsPoint: Point2D;//some point in the clipbounds not on the side
257
- let ptClipBoundsIntersect: Point2D;//some point in the clipbounds not on the side
258
- let m1: double = 0;
259
- let m2: double = 0;
260
- let b1: double = 0;
261
- let b2: double = 0;
262
- let b3: double = 0;
263
- let b4: double = 0;
264
- let ptPreviousIntersect: Point2D;
265
- let ptCurrentIntersect: Point2D;
266
- let j: int = 0;
267
- let clipBoundsQuadrant: int = -1;
268
- let previousQuadrant: int = -1;
269
- let currentQuadrant: int = -1; //quadrants relative to side
270
- let current: Point2D;
271
- let previous: Point2D;
272
- let intersectPt: Point2D;
273
- let edge: Line2D;
274
- ptsResult = new Array();
275
- //set some point in the array which is not in the side
276
- //this point will be used to define which side of the clipping side the rest of the clipbounds points are on
277
- //then it can be used to figure out whether a given point is to be clipped
278
- //for this scheme to work it needs to be a convex clipping area
279
- if (index === 0) {
280
- clipBoundsPoint = new Point2D(clipBounds[index + 2].getX(), clipBounds[index + 2].getY());
281
- }
282
- else {
283
- if (index > 1) {
284
- clipBoundsPoint = new Point2D(clipBounds[index - 2].getX(), clipBounds[index - 2].getY());
285
- }
286
- else {
287
- if (index === 1) {
288
- clipBoundsPoint = new Point2D(clipBounds[0].getX(), clipBounds[0].getY());
289
- }
290
- }
291
-
292
- }
293
-
294
-
295
- //no vertical segments
296
- //if(pt2.getX()==pt1.getX())
297
- if (Math.abs(pt2.getX() - pt1.getX()) < 1) {
298
-
299
- pt2.setLocation(pt2.getX() + 1, pt2.getY());
300
- }
301
-
302
- //if(pt2.getY()==pt1.getY())
303
- if (Math.abs(pt2.getY() - pt1.getY()) < 1) {
304
-
305
- pt2.setLocation(pt2.getX(), pt2.getY() + 1);
306
- }
307
-
308
-
309
- for (j = 0; j < pts.length; j++) {
310
- current = pts[j];
311
- if (j === 0) {
312
- previous = pts[pts.length - 1];
313
- }
314
- else {
315
- previous = pts[j - 1];
316
- }
317
-
318
- m1 = (pt2.getY() - pt1.getY()) / (pt2.getX() - pt1.getX());
319
- m2 = -1 / m1; //the slope of the line perpendicular to m1,b1
320
- b1 = pt2.getY() - m1 * pt2.getX();
321
- b2 = previous.getY() - m2 * previous.getX();
322
- b3 = current.getY() - m2 * current.getX();
323
- b4 = clipBoundsPoint.getY() - m2 * clipBoundsPoint.getX();
324
- ptPreviousIntersect = clsClipQuad.CalcTrueIntersectDouble(m1, b1, m2, b2, 1, 1, 0, 0);
325
- ptCurrentIntersect = clsClipQuad.CalcTrueIntersectDouble(m1, b1, m2, b3, 1, 1, 0, 0);
326
- ptClipBoundsIntersect = clsClipQuad.CalcTrueIntersectDouble(m1, b1, m2, b4, 1, 1, 0, 0);
327
- clipBoundsQuadrant = lineutility.GetQuadrantDouble(clipBoundsPoint.getX(), clipBoundsPoint.getY(), ptClipBoundsIntersect.getX(), ptClipBoundsIntersect.getY());
328
- previousQuadrant = lineutility.GetQuadrantDouble(previous.getX(), previous.getY(), ptPreviousIntersect.getX(), ptPreviousIntersect.getY());
329
- currentQuadrant = lineutility.GetQuadrantDouble(current.getX(), current.getY(), ptCurrentIntersect.getX(), ptCurrentIntersect.getY());
330
-
331
- //case: both inside
332
- if (previousQuadrant === clipBoundsQuadrant && currentQuadrant === clipBoundsQuadrant) {
333
-
334
- ptsResult.push(current);
335
- }
336
-
337
- else {
338
- if (previousQuadrant === clipBoundsQuadrant && currentQuadrant !== clipBoundsQuadrant)//previous inside, current outside
339
- {
340
- edge = new Line2D(pt1, pt2);
341
- intersectPt = clsClipQuad.intersectPoint2(previous, current, edge);
342
- if (intersectPt != null) {
343
- ptsResult.push(intersectPt);
344
- }
345
- tg.set_WasClipped(true);
346
- }
347
- else {
348
- if (previousQuadrant !== clipBoundsQuadrant && currentQuadrant === clipBoundsQuadrant)//current inside, previous outside
349
- {
350
- edge = new Line2D(pt1, pt2);
351
- intersectPt = clsClipQuad.intersectPoint2(previous, current, edge);
352
- if (intersectPt != null) {
353
- ptsResult.push(intersectPt);
354
- }
355
- ptsResult.push(current);
356
- tg.set_WasClipped(true);
357
- }
358
- else {
359
- if (previousQuadrant !== clipBoundsQuadrant && currentQuadrant !== clipBoundsQuadrant) {
360
-
361
- continue;
362
- }
363
-
364
- }
365
-
366
- }
367
-
368
- }
369
-
370
- }//end for j=0 to pts.length-1
371
- } catch (exc) {
372
- if (exc instanceof Error) {
373
- ErrorLogger.LogException(clsClipQuad._className, "clipSide",
374
- new RendererException("Failed inside clipSide", exc));
375
- } else {
376
- throw exc;
377
- }
378
- }
379
- return ptsResult;
380
- }
381
- /**
382
- * for pre-clipped lines which also require fill but need the processed points
383
- * to create the fill. This function is called after the clip, so the fill
384
- * does not get clipped.
385
- * @param tg
386
- * @param shapes
387
- */
388
- protected static addAbatisFill(tg: TGLight,
389
- shapes: Array<Shape2>): void {
390
- try {
391
- if (tg.Pixels == null ||
392
- tg.Pixels.length < 2 ||
393
- tg.get_FillColor() == null ||
394
- tg.get_FillColor().getAlpha() < 2 ||
395
- shapes == null) {
396
-
397
- return;
398
- }
399
-
400
-
401
- let j: int = 0;
402
- let n: int = tg.Pixels.length;
403
- let shape: Shape2;
404
- let tg2: TGLight;
405
- switch (tg.get_LineType()) {
406
- case TacticalLines.MSDZ: {
407
- let dist0: double = 0;
408
- let dist1: double = 0;
409
- let dist2: double = 0;
410
- shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
411
- shape.setFillColor(tg.get_FillColor());
412
- if (tg.Pixels != null && tg.Pixels.length >= 300) {
413
- dist0 = Math.abs(tg.Pixels[0].x - tg.Pixels[50].x);
414
- dist1 = Math.abs(tg.Pixels[100].x - tg.Pixels[150].x);
415
- dist2 = Math.abs(tg.Pixels[200].x - tg.Pixels[250].x);
416
- let start: int = -1;
417
- let end: int = -1;
418
- if (dist0 >= dist1 && dist0 >= dist2) {
419
- start = 0;
420
- end = 99;
421
- }
422
- else {
423
- if (dist1 >= dist0 && dist1 >= dist2) {
424
- start = 100;
425
- end = 199;
426
- }
427
- else {
428
- start = 200;
429
- end = 299;
430
- }
431
- }
432
-
433
- shape.moveTo(tg.Pixels[start]);
434
- for (j = start; j <= end; j++) {
435
-
436
- shape.lineTo(tg.Pixels[j]);
437
- }
438
-
439
-
440
- //shapes.add(0,shape);
441
- }
442
- break;
443
- }
444
-
445
- case TacticalLines.ABATIS: {
446
- shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
447
- shape.setFillColor(tg.get_FillColor());
448
- tg2 = new TGLight();
449
- tg2.set_LineType(TacticalLines.GENERAL);
450
- tg2.Pixels = new Array();
451
- if (tg.Pixels != null && tg.Pixels.length > 2) {
452
- tg2.Pixels.push(tg.Pixels[n - 3]);
453
- tg2.Pixels.push(tg.Pixels[n - 2]);
454
- tg2.Pixels.push(tg.Pixels[n - 1]);
455
- tg2.Pixels.push(tg.Pixels[n - 3]);
456
-
457
- shape.moveTo(tg2.Pixels[0]);
458
- for (j = 1; j < tg2.Pixels.length; j++) {
459
-
460
- shape.lineTo(tg2.Pixels[j]);
461
- }
462
-
463
-
464
- //shapes.push(shape);
465
- }
466
- break;
467
- }
468
-
469
- default: {
470
- return;
471
- }
472
-
473
- }//end switch
474
- if (shapes != null) {
475
-
476
- shapes.splice(0, 0, shape);
477
- }
478
-
479
- } catch (exc) {
480
- if (exc instanceof Error) {
481
- ErrorLogger.LogException(clsClipQuad._className, "addAbatisFill",
482
- new RendererException("Failed inside addAbatisFill", exc));
483
- } else {
484
- throw exc;
485
- }
486
- }
487
- }
488
-
489
- /**
490
- * for lines with glyphs the fill must be handled (clipped) as a separate shape.
491
- * this function needs to be called before the clipping is done to the line
492
- * @param tg
493
- * @param clipBounds
494
- * @return
495
- */
496
- static LinesWithFill(tg: TGLight,
497
- clipBounds: Array<Point2D>): Array<Shape2> | null {
498
- let shapes: Array<Shape2>;
499
- try {
500
- if (tg.get_FillColor() == null || tg.get_FillColor().getAlpha() <= 1 ||
501
- tg.Pixels == null || tg.Pixels.length === 0) {
502
-
503
- return shapes;
504
- }
505
-
506
-
507
- switch (tg.get_LineType()) {
508
- case TacticalLines.ABATIS:
509
- case TacticalLines.SPT:
510
- case TacticalLines.MAIN:
511
- case TacticalLines.AAAAA:
512
- case TacticalLines.AIRAOA:
513
- case TacticalLines.CATK:
514
- case TacticalLines.CATKBYFIRE:
515
- case TacticalLines.CORDONSEARCH:
516
- case TacticalLines.CORDONKNOCK:
517
- case TacticalLines.SECURE:
518
- case TacticalLines.OCCUPY:
519
- case TacticalLines.RETAIN:
520
- case TacticalLines.ISOLATE:
521
- case TacticalLines.CONVOY:
522
- case TacticalLines.HCONVOY: {
523
- return shapes;
524
- }
525
-
526
- case TacticalLines.PAA_RECTANGULAR:
527
- case TacticalLines.RECTANGULAR_TARGET: {
528
- return null;
529
- }
530
-
531
- case TacticalLines.OBSFAREA:
532
- case TacticalLines.OBSAREA:
533
- case TacticalLines.STRONG:
534
- case TacticalLines.ZONE:
535
- case TacticalLines.FORT_REVD:
536
- case TacticalLines.FORT:
537
- case TacticalLines.ENCIRCLE:
538
- case TacticalLines.ATDITCHC:
539
- case TacticalLines.ATDITCHM: {
540
- return clsClipQuad.fillDMA(tg, clipBounds);
541
- }
542
-
543
- default: {
544
- break;
545
- }
546
-
547
- }
548
- if (clsUtility.LinesWithFill(tg.get_LineType()) === false) {
549
-
550
- return shapes;
551
- }
552
-
553
-
554
- shapes = new Array();
555
- //undo any fillcolor that might have been set for the existing shape
556
- //because we are divorcing fill from the line
557
- let shape: Shape2;
558
-
559
- //create a generic area tg from the pixels and clip it
560
- let tg2: TGLight = new TGLight();
561
- tg2.set_LineType(TacticalLines.GENERAL);
562
- tg2.Pixels = new Array();
563
- tg2.Pixels.push(...tg.Pixels);
564
- clsClipQuad.closeAreaTG(tg2);
565
- //tg2.Pixels.push(tg.Pixels[0]);
566
- if (clipBounds != null) {
567
-
568
- clsClipQuad.ClipPolygon(tg2, clipBounds);
569
- }
570
-
571
-
572
-
573
- if (tg2.Pixels == null || tg2.Pixels.length === 0) {
574
-
575
- return null;
576
- }
577
-
578
-
579
- let j: int = 0;
580
- shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
581
- shape.setFillColor(tg.get_FillColor());
582
-
583
- shape.moveTo(tg2.Pixels[0]);
584
- for (j = 1; j < tg2.Pixels.length; j++) {
585
-
586
- shape.lineTo(tg2.Pixels[j]);
587
- }
588
-
589
-
590
- if (tg.get_FillColor() != null || tg.get_FillColor().getAlpha() > 1) {
591
- shapes.push(shape);
592
- }
593
- else {
594
-
595
- return null;
596
- }
597
-
598
- } catch (exc) {
599
- if (exc instanceof Error) {
600
- ErrorLogger.LogException(clsClipQuad._className, "LinesWithFill",
601
- new RendererException("Failed inside LinesWithFill", exc));
602
- } else {
603
- throw exc;
604
- }
605
- }
606
- return shapes;
607
- }
608
- /**
609
- * closes an area
610
- * @param tg
611
- */
612
- private static closeAreaTG(tg: TGLight): void {
613
- try {
614
- if (tg.Pixels == null || tg.Pixels.length === 0) {
615
-
616
- return;
617
- }
618
-
619
-
620
- let pt0: POINT2 = tg.Pixels[0];
621
- let ptn: POINT2 = tg.Pixels[tg.Pixels.length - 1];
622
- if (pt0.x !== ptn.x || pt0.y !== ptn.y) {
623
-
624
- tg.Pixels.push(pt0);
625
- }
626
-
627
-
628
- } catch (exc) {
629
- if (exc instanceof Error) {
630
- ErrorLogger.LogException(clsClipQuad._className, "closeAreaTG",
631
- new RendererException("Failed inside closeAreaTG", exc));
632
- } else {
633
- throw exc;
634
- }
635
- }
636
- }
637
- /**
638
- * DMA, DMAF fill must be handled separately because of the feint
639
- * @param tg
640
- * @param clipBounds
641
- * @return
642
- */
643
- protected static fillDMA(tg: TGLight,
644
- clipBounds: Array<Point2D>): Array<Shape2> {
645
- let shapes: Array<Shape2> = new Array();
646
- try {
647
- switch (tg.get_LineType()) {
648
- case TacticalLines.OBSFAREA:
649
- case TacticalLines.OBSAREA:
650
- case TacticalLines.STRONG:
651
- case TacticalLines.ZONE:
652
- case TacticalLines.FORT_REVD:
653
- case TacticalLines.FORT:
654
- case TacticalLines.ENCIRCLE:
655
- case TacticalLines.ATDITCHC:
656
- case TacticalLines.ATDITCHM: {
657
- break;
658
- }
659
-
660
- default: {
661
- return shapes;
662
- }
663
-
664
- }
665
- let shape: Shape2;
666
-
667
- //create a generic area tg from the pixels and clip it
668
- let j: int = 0;
669
- let tg2: TGLight = new TGLight();
670
- tg2.set_LineType(TacticalLines.GENERAL);
671
- tg2.Pixels = new Array();
672
- //to get the original pixels size
673
- let n: int = 0;
674
- n = tg.Pixels.length;
675
-
676
- for (j = 0; j < n; j++) {
677
-
678
- tg2.Pixels.push(tg.Pixels[j]);
679
- }
680
-
681
-
682
- clsClipQuad.closeAreaTG(tg2);
683
-
684
- if (clipBounds != null) {
685
-
686
- clsClipQuad.ClipPolygon(tg2, clipBounds);
687
- }
688
-
689
-
690
- if (tg2.Pixels == null || tg2.Pixels.length === 0) {
691
-
692
- return shapes;
693
- }
694
-
695
-
696
- shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
697
- shape.setFillColor(tg.get_FillColor());
698
-
699
- shape.moveTo(tg2.Pixels[0]);
700
- //original pixels do not include feint
701
- for (j = 1; j < tg2.Pixels.length; j++) {
702
-
703
- shape.lineTo(tg2.Pixels[j]);
704
- }
705
-
706
-
707
- shapes.push(shape);
708
- } catch (exc) {
709
- if (exc instanceof Error) {
710
- ErrorLogger.LogException(clsClipQuad._className, "fillDMA",
711
- new RendererException("Failed inside fillDMA", exc));
712
- } else {
713
- throw exc;
714
- }
715
- }
716
- return shapes;
717
- }
718
- // private static Boolean isClosed(ArrayList<POINT2>pts)
719
- // {
720
- // boolean closed=false;
721
- // POINT2 pt0=pts[0];
722
- // POINT2 ptLast=pts[pts.length-1];
723
- // if(pt0.x==ptLast.x && pt0.y==ptLast.y)
724
- // closed=true;
725
- // return closed;
726
- // }
727
- /**
728
- *
729
- * @param tg
730
- * @param clipBounds polygon representing clipping area
731
- * @return
732
- */
733
- static ClipPolygon(tg: TGLight,
734
- clipBounds: Array<Point2D>): Array<Point2D> {
735
- let poly: Array<Point2D> = new Array();
736
- try {
737
- //diagnostic
738
- let isClosed: boolean = clsUtility.isClosedPolygon(tg.get_LineType());
739
- //Boolean isClosed = isClosed(tg.Pixels);
740
- //M. Deutch commented one line 12-27-12
741
- //clipBounds=clsUtilityGE.expandPolygon(clipBounds, 20);
742
- clipBounds = clsUtilityGE.expandPolygon(clipBounds, 20);
743
- //int n=clipBounds.length;
744
- let polygon: Array<Point2D> = clsUtilityCPOF.POINT2toPoint2D(tg.Pixels);
745
-
746
- let j: int = 0;
747
- let hashMap: Map<string, Point2D> = new Map<string, Point2D>();
748
- //int hashCode=0;
749
- for (j = 0; j < polygon.length; j++) {
750
-
751
- hashMap.set(j.toString(), polygon[j]);
752
- }
753
-
754
-
755
- //close the clipbounds if necessary
756
- let clipBoundsPtStart: Point2D = clipBounds[0];
757
- let clipBoundsPtEnd: Point2D = clipBounds[clipBounds.length - 1];
758
- if (clipBoundsPtStart.getX() !== clipBoundsPtEnd.getX() ||
759
- clipBoundsPtStart.getY() !== clipBoundsPtEnd.getY()) {
760
-
761
- clipBounds.push(clipBoundsPtStart);
762
- }
763
-
764
-
765
- let addedLinePoints: int = 0;
766
- if (isClosed) {
767
-
768
- polygon.splice(polygon.length - 1, 1);
769
- }
770
-
771
- else {
772
- addedLinePoints = clsClipQuad.AddBoundaryPointsForLines(polygon, clipBounds);
773
- }
774
-
775
- //for(j=0;j<clipBounds.length-1;j++)
776
- for (j = 0; j < clipBounds.length - 1; j++) {
777
- if (j === 0) {
778
-
779
- poly = clsClipQuad.clipSide(tg, polygon, j, clipBounds);
780
- }
781
-
782
- else {
783
-
784
- poly = clsClipQuad.clipSide(tg, poly, j, clipBounds);
785
- }
786
-
787
- }
788
-
789
-
790
- if (isClosed) {
791
- if (poly.length > 0) {
792
- poly.push(poly[0]);
793
- }
794
- }
795
- else {
796
- switch (addedLinePoints) {
797
- case 0: { //no points were added, do nothing
798
- break;
799
- }
800
-
801
- case 1: { //point was added to the front to make algorithm work, remove segment
802
- if (poly.length > 0) {
803
- poly.splice(0, 1);
804
- }
805
- if (poly.length > 0) {
806
- poly.splice(0, 1);
807
- }
808
- break;
809
- }
810
-
811
- case 2: { //point was added to the end to make algorithm work, remove segment
812
- if (poly.length > 0) {
813
- poly.splice(poly.length - 1, 1);
814
- }
815
- if (poly.length > 0) {
816
- poly.splice(poly.length - 1, 1);
817
- }
818
- break;
819
- }
820
-
821
- case 3: { //point was added to the front and end to make algorithm work, remove segments
822
- if (poly.length > 0) {
823
- poly.splice(0, 1);
824
- }
825
- if (poly.length > 0) {
826
- poly.splice(0, 1);
827
- }
828
- if (poly.length > 0) {
829
- poly.splice(poly.length - 1, 1);
830
- }
831
- if (poly.length > 0) {
832
- poly.splice(poly.length - 1, 1);
833
- }
834
- break;
835
- }
836
-
837
-
838
- default:
839
-
840
- }
841
- }
842
-
843
- if (isClosed === true) {
844
- if (poly.length > 2) {
845
- tg.Pixels = clsUtilityCPOF.Point2DtoPOINT2Mapped(poly, hashMap);
846
- }
847
- else {
848
- tg.Pixels = new Array();
849
- }
850
-
851
- }
852
- else {
853
- if (poly.length > 1) {
854
- tg.Pixels = clsUtilityCPOF.Point2DtoPOINT2Mapped(poly, hashMap);
855
- }
856
- else {
857
- tg.Pixels = new Array();
858
- }
859
- }
860
-
861
- } catch (exc) {
862
- if (exc instanceof Error) {
863
- ErrorLogger.LogException(clsClipQuad._className, "ClipPolygon",
864
- new RendererException("Failed inside ClipPolygon", exc));
865
- } else {
866
- throw exc;
867
- }
868
- }
869
- return poly;
870
- }
871
- }