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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +57 -0
  3. package/buildNode.bat +2 -0
  4. package/buildWeb.bat +2 -0
  5. package/dist/C5Ren.d.ts +6970 -0
  6. package/dist/C5Ren.js +2 -0
  7. package/dist/C5Ren.js.map +1 -0
  8. package/dist/LICENSE +201 -0
  9. package/dist/README.md +57 -0
  10. package/dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz +0 -0
  11. package/dist/manifest.json +4 -0
  12. package/dist/package.json +16 -0
  13. package/index.ts +169 -0
  14. package/package.bak +50 -0
  15. package/package.json +40 -0
  16. package/package.node.json +43 -0
  17. package/package.pack.json +19 -0
  18. package/package.packWeb.json +16 -0
  19. package/package.web.json +40 -0
  20. package/src/main/ts/android/graphics/Bitmap.ts +7 -0
  21. package/src/main/ts/android/graphics/Paint.ts +26 -0
  22. package/src/main/ts/android/graphics/Path.ts +78 -0
  23. package/src/main/ts/android/graphics/PointF.ts +14 -0
  24. package/src/main/ts/android/graphics/Rect.ts +18 -0
  25. package/src/main/ts/android/graphics/RectF.ts +50 -0
  26. package/src/main/ts/android/graphics/Region.ts +36 -0
  27. package/src/main/ts/android/graphics/Typeface.ts +11 -0
  28. package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +99 -0
  29. package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +34 -0
  30. package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +193 -0
  31. package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +2971 -0
  32. package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +4008 -0
  33. package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +93 -0
  34. package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +89 -0
  35. package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +515 -0
  36. package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +5403 -0
  37. package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +1084 -0
  38. package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +2173 -0
  39. package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +4934 -0
  40. package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +7 -0
  41. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +5601 -0
  42. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +14 -0
  43. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +648 -0
  44. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +647 -0
  45. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +2994 -0
  46. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +2663 -0
  47. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +669 -0
  48. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +971 -0
  49. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +871 -0
  50. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +3507 -0
  51. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +500 -0
  52. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +1089 -0
  53. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +2656 -0
  54. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +1419 -0
  55. package/src/main/ts/armyc2/c5isr/data/genc.json +1407 -0
  56. package/src/main/ts/armyc2/c5isr/data/msd.json +17311 -0
  57. package/src/main/ts/armyc2/c5isr/data/mse.json +18500 -0
  58. package/src/main/ts/armyc2/c5isr/data/svgd.json +31214 -0
  59. package/src/main/ts/armyc2/c5isr/data/svge.json +30558 -0
  60. package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +10 -0
  61. package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +437 -0
  62. package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +429 -0
  63. package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +7 -0
  64. package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +35 -0
  65. package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +111 -0
  66. package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +29 -0
  67. package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +18 -0
  68. package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +211 -0
  69. package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +80 -0
  70. package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +33 -0
  71. package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +16 -0
  72. package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +726 -0
  73. package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +141 -0
  74. package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +112 -0
  75. package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +261 -0
  76. package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +391 -0
  77. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +567 -0
  78. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +445 -0
  79. package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +31 -0
  80. package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +18 -0
  81. package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +45 -0
  82. package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +25 -0
  83. package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +15 -0
  84. package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +22 -0
  85. package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +269 -0
  86. package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +9882 -0
  87. package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +146 -0
  88. package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +1265 -0
  89. package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +64 -0
  90. package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +95 -0
  91. package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +93 -0
  92. package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +114 -0
  93. package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +555 -0
  94. package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +62 -0
  95. package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +120 -0
  96. package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +431 -0
  97. package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +99 -0
  98. package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +25 -0
  99. package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +203 -0
  100. package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +104 -0
  101. package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +481 -0
  102. package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +40 -0
  103. package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +1323 -0
  104. package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +51 -0
  105. package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +736 -0
  106. package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +106 -0
  107. package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +84 -0
  108. package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +87 -0
  109. package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +34 -0
  110. package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +324 -0
  111. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +127 -0
  112. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +18 -0
  113. package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +111 -0
  114. package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +219 -0
  115. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +1008 -0
  116. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +882 -0
  117. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +380 -0
  118. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +797 -0
  119. package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +1699 -0
  120. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +178 -0
  121. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +45 -0
  122. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +126 -0
  123. package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +118 -0
  124. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +11 -0
  125. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +1201 -0
  126. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +591 -0
  127. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +29 -0
  128. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +753 -0
  129. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +137 -0
  130. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +438 -0
  131. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +19 -0
  132. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +10 -0
  133. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +5 -0
  134. package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +404 -0
  135. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +525 -0
  136. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +55 -0
  137. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +36 -0
  138. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +1055 -0
  139. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +2085 -0
  140. package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +157 -0
  141. package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +86 -0
  142. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +3798 -0
  143. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +412 -0
  144. package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +124 -0
  145. package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +26 -0
  146. package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +677 -0
  147. package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +484 -0
  148. package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +62 -0
  149. package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +46 -0
  150. package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +51 -0
  151. package/src/main/ts/org/gavaghan/geodesy/Angle.ts +31 -0
  152. package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +71 -0
  153. package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +200 -0
  154. package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +55 -0
  155. package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +68 -0
  156. package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +103 -0
  157. package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +90 -0
  158. package/test/ExportSPImages.js +692 -0
  159. package/test/MPWW.html +556 -0
  160. package/test/MPWorker.js +318 -0
  161. package/test/SPWorker.js +233 -0
  162. package/test/SVGWW.html +363 -0
  163. package/test/singlePointTester3.html +751 -0
  164. package/tsconfig.json +54 -0
  165. package/typedoc.json +30 -0
  166. package/updateVersion.js +21 -0
  167. package/webpack.config.js +34 -0
  168. package/webpackn.config.js +28 -0
  169. package/webpackr.config.js +47 -0
  170. package/webpackw.config.js +23 -0
@@ -0,0 +1,4008 @@
1
+ import { type int, type double } from "../graphics2d/BasicTypes";
2
+
3
+ import { BasicStroke } from "../graphics2d/BasicStroke"
4
+ import { Rectangle2D } from "../graphics2d/Rectangle2D"
5
+ import { CELineArray } from "../JavaLineArray/CELineArray"
6
+ import { lineutility } from "../JavaLineArray/lineutility"
7
+ import { POINT2 } from "../JavaLineArray/POINT2"
8
+ import { ref } from "../JavaLineArray/ref"
9
+ import { Shape2 } from "../JavaLineArray/Shape2"
10
+ import { TacticalLines } from "../JavaLineArray/TacticalLines"
11
+ import { TGLight } from "../JavaTacticalRenderer/TGLight"
12
+ import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
13
+ import { RendererException } from "../renderer/utilities/RendererException"
14
+ import { RendererSettings } from "../renderer/utilities/RendererSettings"
15
+ import { clsUtility } from "../JavaTacticalRenderer/clsUtility";
16
+
17
+
18
+ /**
19
+ * A class which imported many of the C++ functions from Trident
20
+ * Systems Dismounted Intelligence Situational Awareness System (DISM) for
21
+ * rendering Mil-Standard-2525 tactical lines. This class does not get instantiated
22
+ * Much of the code is still the original DISM code.
23
+ *
24
+ */
25
+ export class DISMSupport {
26
+ private static readonly LEFT_SIDE: int = 0;
27
+ private static readonly RIGHT_SIDE: int = 1;
28
+ private static readonly COLINEAR: int = 2;
29
+
30
+ private static readonly CONST_PI: double = Math.PI;
31
+ private static readonly maxLength: double = 100;
32
+ private static readonly minLength: double = 2.5; //was 5
33
+ private static readonly _className: string = "DISMSupport";
34
+
35
+ // protected static void setMinLength(double mLength)
36
+ // {
37
+ // minLength=mLength;
38
+ // }
39
+ private static GetTGFontSize(iLength: double): double {
40
+ let result: double = -1;
41
+ try {
42
+ if (iLength < 20) {
43
+
44
+ result = 0;
45
+ }
46
+
47
+ else {
48
+ if (iLength < 50) {
49
+
50
+ result = 1;
51
+ }
52
+
53
+ else {
54
+ if (iLength > 250) {
55
+
56
+ result = 3;
57
+ }
58
+
59
+ else {
60
+
61
+ result = 2;
62
+ }
63
+
64
+ }
65
+
66
+ }
67
+
68
+ } catch (exc) {
69
+ if (exc instanceof Error) {
70
+ ErrorLogger.LogException(DISMSupport._className, "GetTGFontSize",
71
+ new RendererException("Failed inside GetTGFontSize", exc));
72
+ } else {
73
+ throw exc;
74
+ }
75
+ }
76
+ return result;
77
+ }
78
+ private static ArcApproximationDouble(left: double, top: double, right: double, bottom: double,
79
+ startx: double, starty: double, endx: double, endy: double, lpoints: POINT2[]): void {
80
+
81
+ try {
82
+ let dstartx: double = startx;
83
+ let dstarty: double = starty;
84
+ let dendx: double = endx;
85
+ let dendy: double = endy;
86
+ let a: double = 0;
87
+ let b: double = 0;
88
+ let ctrX: double = 0;
89
+ let ctrY: double = 0;
90
+ let x1: double = 0;
91
+ let y1: double = 0;
92
+ let x2: double = 0;
93
+ let y2: double = 0;
94
+ let startAngle: double = 0;
95
+ let endAngle: double = 0;
96
+ let angleIncrement: double = 0;
97
+ let t: double = 0;
98
+
99
+ let i: int = 0;
100
+ if (left > right) {
101
+ let temp: double = left;
102
+ left = right;
103
+ right = temp;
104
+ }
105
+ if (top > bottom) {
106
+ let temp: double = top;
107
+ top = bottom;
108
+ bottom = temp;
109
+ }
110
+
111
+ a = (right - left) / 2.0;
112
+ b = (bottom - top) / 2.0;
113
+ ctrX = left + a;
114
+ ctrY = top + b;
115
+
116
+ x1 = dstartx - ctrX;
117
+ x2 = dendx - ctrX;
118
+ y1 = ctrY - dstarty;
119
+ y2 = ctrY - dendy;
120
+
121
+ if (y1 === 0) {
122
+ if (x1 > 0) {
123
+ startAngle = 0;
124
+ }
125
+
126
+ else {
127
+ startAngle = DISMSupport.CONST_PI;
128
+ }
129
+
130
+ }
131
+ else {
132
+ if (x1 === 0) {
133
+ if (y1 > 0) {
134
+ startAngle = DISMSupport.CONST_PI * 0.5;
135
+ }
136
+
137
+ else {
138
+ startAngle = DISMSupport.CONST_PI * -0.5;
139
+ }
140
+
141
+ }
142
+ else {
143
+ startAngle = Math.atan2(y1, x1);
144
+ }
145
+
146
+ }
147
+
148
+
149
+ if (y2 === 0) {
150
+ if (x2 > 0) {
151
+ endAngle = 0;
152
+ }
153
+
154
+ else {
155
+ endAngle = DISMSupport.CONST_PI;
156
+ }
157
+
158
+ }
159
+ else {
160
+ if (x2 === 0) {
161
+ if (y2 > 0) {
162
+ endAngle = DISMSupport.CONST_PI * 0.5;
163
+ }
164
+
165
+ else {
166
+ endAngle = DISMSupport.CONST_PI * -0.5;
167
+ }
168
+
169
+ }
170
+ else {
171
+ endAngle = Math.atan2(y2, x2);
172
+ }
173
+
174
+ }
175
+
176
+
177
+ if (endAngle <= startAngle) {
178
+ endAngle += 2 * DISMSupport.CONST_PI;
179
+ }
180
+
181
+ angleIncrement = (endAngle - startAngle) / 16.0;
182
+
183
+ for (t = startAngle; i < 17; t += angleIncrement, i++) {
184
+ lpoints[i].x = ctrX + a * Math.cos(t);
185
+ lpoints[i].y = ctrY - b * Math.sin(t);
186
+ }
187
+ return;
188
+ } catch (exc) {
189
+ if (exc instanceof Error) {
190
+ ErrorLogger.LogException(DISMSupport._className, "ArcApproximationDouble",
191
+ new RendererException("Failed inside ArcApproximationDouble", exc));
192
+ } else {
193
+ throw exc;
194
+ }
195
+ }
196
+ }
197
+ private static DrawOpenRectangleDouble(points: POINT2[], pointsCorner: POINT2[], resultpts: POINT2[]): void {
198
+ try {
199
+ // draw open-ended rectangle
200
+ let point_mid: POINT2 = new POINT2();
201
+ let j: int = 0;
202
+ // POINT1 pts[4];
203
+ point_mid.x = (points[0].x + points[1].x) / 2;
204
+ point_mid.y = (points[0].y + points[1].y) / 2;
205
+ pointsCorner[0].x = points[0].x - point_mid.x + points[2].x;
206
+ pointsCorner[0].y = points[0].y - point_mid.y + points[2].y;
207
+ pointsCorner[1].x = points[1].x - point_mid.x + points[2].x;
208
+ pointsCorner[1].y = points[1].y - point_mid.y + points[2].y;
209
+ resultpts[0] = new POINT2(points[1]);
210
+ resultpts[1] = new POINT2(pointsCorner[1]);
211
+ resultpts[2] = new POINT2(pointsCorner[0]);
212
+ resultpts[3] = new POINT2(points[0]);
213
+ for (j = 0; j < 4; j++) {
214
+ resultpts[j].style = 0;
215
+ }
216
+ resultpts[3].style = 5;
217
+
218
+ } catch (exc) {
219
+ if (exc instanceof Error) {
220
+ ErrorLogger.LogException(DISMSupport._className, "DrawOpenRectangleDouble",
221
+ new RendererException("Failed inside DrawOpenRectangleDouble", exc));
222
+ } else {
223
+ throw exc;
224
+ }
225
+ }
226
+ return;
227
+ }
228
+ private static DetermineDirectionDouble(points: POINT2[]): int {
229
+ let result: int = 0;
230
+ try {
231
+ let dP0P1M: double = 0;
232
+ let iP0P1B: double = 0;
233
+ if (points[0].x === points[1].x) {
234
+ if (points[2].x < points[0].x) {
235
+ return 1;
236
+ } else {
237
+ return 0;
238
+ }
239
+ } else {
240
+ // dP0P1M = slope of line between Point0 and Point1
241
+ dP0P1M = (points[0].y - points[1].y) as double / (points[0].x - points[1].x) as double;
242
+ // iP0P1B = b component of y=mx+b equation of line
243
+ iP0P1B = (points[0].y - dP0P1M * points[0].x);
244
+ if (((points[2].y - iP0P1B) / dP0P1M) > points[2].x) {
245
+ return 1;
246
+ } else {
247
+ return 0;
248
+ }
249
+ }
250
+ } catch (exc) {
251
+ if (exc instanceof Error) {
252
+ ErrorLogger.LogException(DISMSupport._className, "DetermineDirectionDouble",
253
+ new RendererException("Failed inside DetermineDirectionDouble", exc));
254
+ } else {
255
+ throw exc;
256
+ }
257
+ }
258
+ return result;
259
+ }
260
+ private static CalcEndpieceDeltasDouble(points: POINT2[], piDeltaX: ref<number[]>, piDeltaY: ref<number[]>,
261
+ dAngleDelta: double
262
+ ): void {
263
+ try {
264
+ // find midpoint between point0 and point1
265
+ let pntMid: POINT2 = new POINT2();
266
+ let iDiagEOL_length: double = 0;
267
+ let dAngle1: double = 0;
268
+
269
+ pntMid.x = (points[0].x + points[1].x) / 2;
270
+ pntMid.y = (points[0].y + points[1].y) / 2;
271
+ // iDiagEOL_length = length of the diagonal on end of line from line out to endpoint
272
+ iDiagEOL_length = ((Math.sqrt // height of graphic
273
+ (
274
+ (points[1].x - points[0].x) * (points[1].x - points[0].x) +
275
+ (points[1].y - points[0].y) * (points[1].y - points[0].y)) +
276
+ Math.sqrt // length of graphic
277
+ (
278
+ (points[2].x - pntMid.x) * (points[2].x - pntMid.x) +
279
+ (points[2].y - pntMid.y) * (points[2].y - pntMid.y))) / 20);
280
+
281
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
282
+ if (iDiagEOL_length as double > DISMSupport.maxLength / 5 * DPIScaleFactor) {
283
+ iDiagEOL_length = DISMSupport.maxLength / 5 * DPIScaleFactor;
284
+ }
285
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
286
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
287
+ }
288
+
289
+ // dAngle1 = angle used to calculate the end-piece deltas
290
+ dAngle1 = Math.atan2(points[2].y - pntMid.y, points[2].x - pntMid.x) + dAngleDelta;
291
+ // dAngle1 = atan2(points[2].y - pntMid.y, points[2].x - pntMid.x) + dAngleDelta;
292
+ piDeltaX.value = new Array<number>(1);
293
+ piDeltaY.value = new Array<number>(1);
294
+ piDeltaX.value[0] = (iDiagEOL_length * Math.cos(dAngle1));
295
+ piDeltaY.value[0] = (iDiagEOL_length * Math.sin(dAngle1));
296
+ return;
297
+ } catch (exc) {
298
+ if (exc instanceof Error) {
299
+ ErrorLogger.LogException(DISMSupport._className, "CalcEndpieceDeltasDouble",
300
+ new RendererException("Failed inside CalcEndpieceDeltasDouble", exc));
301
+ } else {
302
+ throw exc;
303
+ }
304
+ }
305
+ }
306
+ /**
307
+ * Calculates the points for DELAY, WITHDRAW, WDRAWUP, RETIRE
308
+ *
309
+ * @param points OUT - the client points, also used for the returned points.
310
+ */
311
+ static GetDelayGraphicEtcDouble(points: POINT2[]): int {
312
+ let counter: int = 0;
313
+ try {
314
+ let pts: POINT2[] = new Array<POINT2>(2);
315
+ let savepoints: POINT2[] = new Array<POINT2>(3);
316
+ let iLength: double = 0;
317
+ let iRadius: double = 0;
318
+ let iDiagEOL_length: double = 0;
319
+ let dAngle1: double = 0;
320
+ let iDeltaX1: double = 0;
321
+ let iDeltaY1: double = 0;
322
+ let iDeltaX2: double = 0;
323
+ let iDeltaY2: double = 0;
324
+ let ptArcCenter: POINT2 = new POINT2();
325
+ let arcpoints: POINT2[] = new Array<POINT2>(17);
326
+ let deltapoints: POINT2[] = new Array<POINT2>(4);
327
+ let j: int = 0;
328
+
329
+ for (j = 0; j < 3; j++) {
330
+ savepoints[j] = new POINT2(points[j]);
331
+ }
332
+
333
+ lineutility.InitializePOINT2Array(pts);
334
+ lineutility.InitializePOINT2Array(arcpoints);
335
+ lineutility.InitializePOINT2Array(deltapoints);
336
+
337
+ points[counter] = new POINT2(savepoints[0]);
338
+ points[counter].style = 14;
339
+ counter++;
340
+ points[counter] = new POINT2(savepoints[1]);
341
+ points[counter].style = 5;
342
+ counter++;
343
+
344
+ iLength = Math.sqrt((savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
345
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y));
346
+ iRadius = Math.sqrt((savepoints[2].x - savepoints[1].x) * (savepoints[2].x - savepoints[1].x) +
347
+ (savepoints[2].y - savepoints[1].y) * (savepoints[2].y - savepoints[1].y)) / 2;
348
+ iDiagEOL_length = (iLength + iRadius * 2) / 20;
349
+
350
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
351
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
352
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
353
+ }
354
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) { //was minLength
355
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
356
+ }
357
+
358
+ dAngle1 = Math.atan2(points[1].y - points[0].y, points[1].x - points[0].x);
359
+
360
+ iDeltaX1 = (iDiagEOL_length * Math.cos(dAngle1 - DISMSupport.CONST_PI / 4));
361
+ iDeltaY1 = (iDiagEOL_length * Math.sin(dAngle1 - DISMSupport.CONST_PI / 4));
362
+ iDeltaX2 = (iDiagEOL_length * Math.cos(dAngle1 + DISMSupport.CONST_PI / 4));
363
+ iDeltaY2 = (iDiagEOL_length * Math.sin(dAngle1 + DISMSupport.CONST_PI / 4));
364
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
365
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints);
366
+
367
+
368
+ for (j = 0; j < 4; j++) {
369
+ points[counter] = new POINT2(deltapoints[j]);
370
+ counter++;
371
+ }
372
+ // draw the semicircle
373
+ ptArcCenter.x = (savepoints[1].x + savepoints[2].x) / 2;
374
+ ptArcCenter.y = (savepoints[1].y + savepoints[2].y) / 2;
375
+
376
+
377
+ let reverseArc: boolean = DISMSupport.ReverseDelayArc(savepoints);
378
+ if (reverseArc === false) {
379
+ DISMSupport.ArcApproximationDouble((ptArcCenter.x - iRadius), (ptArcCenter.y - iRadius),
380
+ (ptArcCenter.x + iRadius), (ptArcCenter.y + iRadius),
381
+ savepoints[1].x, savepoints[1].y, savepoints[2].x, savepoints[2].y, arcpoints);
382
+ } else {
383
+ DISMSupport.ArcApproximationDouble((ptArcCenter.x - iRadius), (ptArcCenter.y - iRadius),
384
+ (ptArcCenter.x + iRadius), (ptArcCenter.y + iRadius),
385
+ savepoints[2].x, savepoints[2].y, savepoints[1].x, savepoints[1].y, arcpoints);
386
+ }
387
+
388
+ for (j = 0; j < 17; j++) {
389
+ points[counter] = new POINT2(arcpoints[j]);
390
+ points[counter].style = 0;
391
+ counter++;
392
+ }
393
+
394
+ } catch (exc) {
395
+ if (exc instanceof Error) {
396
+ ErrorLogger.LogException(DISMSupport._className, "GetDelayGraphicEtcDouble",
397
+ new RendererException("Failed inside GetDelayGraphicEtcDouble", exc));
398
+ } else {
399
+ throw exc;
400
+ }
401
+ }
402
+ return counter;
403
+ }
404
+ /**
405
+ * Calculates the points for SCREEN, COVER, GUARD, SARA.
406
+ *
407
+ * @param points OUT - the client points, also used for the returned points.
408
+ * @param lineType the line type.
409
+ */
410
+ static GetDISMCoverDouble(points: POINT2[],
411
+ lineType: int): int {
412
+ let counter: int = 0;
413
+ try {
414
+ let pt0: POINT2 = new POINT2(points[0]);
415
+ let pt1: POINT2 = new POINT2(points[1]);
416
+ let pt2: POINT2 = new POINT2(points[2]);
417
+ let pt3: POINT2 = new POINT2();
418
+ let pt4: POINT2 = new POINT2();
419
+
420
+ lineutility.LineRelativeToLine(pt1, pt2, pt0, pt3, pt4);
421
+ //now we have the pt3-pt4 line which pt0 is on
422
+ //get the corresponding point back on the original line
423
+ lineutility.LineRelativeToLine(pt3, pt0, pt1, pt2, pt4);
424
+ let quadrant: int = lineutility.GetQuadrantDouble(pt0, pt4);
425
+
426
+ pt1 = new POINT2(points[1]);
427
+ pt2 = new POINT2(points[2]);
428
+ let sign: int = 0;
429
+ if (pt1.x < pt2.x && (quadrant === 1 || quadrant === 4)) {
430
+
431
+ sign = -1;
432
+ }
433
+
434
+ else {
435
+ if (pt1.x > pt2.x && (quadrant === 2 || quadrant === 3)) {
436
+
437
+ sign = -1;
438
+ }
439
+
440
+ else {
441
+
442
+ sign = 1;
443
+ }
444
+
445
+ }
446
+
447
+
448
+ let initialPt: POINT2 = new POINT2(points[0]);
449
+ initialPt.style = 0;
450
+ let endPt0: POINT2 = new POINT2(points[1]);
451
+ endPt0.style = 0;
452
+ let endPt1: POINT2 = new POINT2(points[2]);
453
+ endPt1.style = 0;
454
+
455
+ // Get length of each line from initial point
456
+ let length1: double = lineutility.CalcDistanceDouble(initialPt, endPt0);
457
+ let length2: double = lineutility.CalcDistanceDouble(initialPt, endPt1);
458
+ length1 = Math.min(length1, length2);
459
+
460
+ if (DISMSupport.GetTGFontSize(length1) > 0) {
461
+ let delta: double = length1 / 15;
462
+
463
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
464
+ if (delta > DISMSupport.maxLength * DPIScaleFactor) {
465
+ delta = DISMSupport.maxLength * DPIScaleFactor;
466
+ }
467
+ if (delta < DISMSupport.minLength * DPIScaleFactor) {
468
+ delta = DISMSupport.minLength * DPIScaleFactor;
469
+ }
470
+
471
+ let ptsJaggyLine: POINT2[] = new Array<POINT2>(4);
472
+ lineutility.InitializePOINT2Array(ptsJaggyLine);
473
+
474
+ // Draw jaggy line 1
475
+ let angle0: double = Math.atan2(initialPt.y - endPt0.y, initialPt.x - endPt0.x);
476
+ let deltaX0a: double = Math.cos(angle0 + sign * DISMSupport.CONST_PI / 4) * delta;
477
+ let deltaY0a: double = Math.sin(angle0 + sign * DISMSupport.CONST_PI / 4) * delta;
478
+ ptsJaggyLine[0] = new POINT2(initialPt);
479
+ if (lineType !== TacticalLines.SARA) {
480
+ ptsJaggyLine[0].x -= 30 * Math.cos(angle0); //was 20
481
+ ptsJaggyLine[0].y -= 30 * Math.sin(angle0);
482
+ }
483
+ let midPt0: POINT2 = lineutility.MidPointDouble(ptsJaggyLine[0], endPt0, 0);
484
+ ptsJaggyLine[1].x = midPt0.x - deltaX0a;
485
+ ptsJaggyLine[1].y = midPt0.y - deltaY0a;
486
+ ptsJaggyLine[2].x = midPt0.x + deltaX0a;
487
+ ptsJaggyLine[2].y = midPt0.y + deltaY0a;
488
+ ptsJaggyLine[3] = new POINT2(endPt0);
489
+ for (let j: int = 0; j < 4; j++) {
490
+ points[counter] = new POINT2(ptsJaggyLine[j]);
491
+ counter++;
492
+ }
493
+ points[counter - 1].style = 5;
494
+
495
+ // Draw Arrow 1
496
+ let deltaX0b: double = Math.cos(angle0 - sign * DISMSupport.CONST_PI / 4) * delta;
497
+ let deltaY0b: double = Math.sin(angle0 - sign * DISMSupport.CONST_PI / 4) * delta;
498
+ ptsJaggyLine[0].x = ptsJaggyLine[3].x + deltaX0a;
499
+ ptsJaggyLine[0].y = ptsJaggyLine[3].y + deltaY0a;
500
+ ptsJaggyLine[1] = new POINT2(ptsJaggyLine[3]);
501
+ ptsJaggyLine[2].x = ptsJaggyLine[3].x + deltaX0b;
502
+ ptsJaggyLine[2].y = ptsJaggyLine[3].y + deltaY0b;
503
+ for (let j: int = 0; j < 3; j++) {
504
+ points[counter] = new POINT2(ptsJaggyLine[j]);
505
+ points[counter].style = 0;
506
+ if (lineType === TacticalLines.SARA) {
507
+ points[counter].style = 9;
508
+ }
509
+
510
+ counter++;
511
+ }
512
+ points[counter - 1].style = 5;
513
+ if (lineType === TacticalLines.SARA) {
514
+ points[counter - 1].style = 9;
515
+ points[counter] = new POINT2(points[counter - 3]);
516
+ points[counter].style = 10;
517
+ counter++;
518
+ }
519
+
520
+ // Draw jaggy line 2
521
+ let angle1: double = Math.atan2(initialPt.y - endPt1.y, initialPt.x - endPt1.x);
522
+ let deltaX1a: double = Math.cos(angle1 - sign * DISMSupport.CONST_PI / 4) * delta;
523
+ let deltaY1a: double = Math.sin(angle1 - sign * DISMSupport.CONST_PI / 4) * delta;
524
+ ptsJaggyLine[0] = new POINT2(initialPt);
525
+ if (lineType !== TacticalLines.SARA) {
526
+ ptsJaggyLine[0].x -= 30 * Math.cos(angle1); //was 20
527
+ ptsJaggyLine[0].y -= 30 * Math.sin(angle1);
528
+ }
529
+ let midPt1: POINT2 = lineutility.MidPointDouble(ptsJaggyLine[0], endPt1, 0);
530
+ ptsJaggyLine[1].x = midPt1.x - deltaX1a;
531
+ ptsJaggyLine[1].y = midPt1.y - deltaY1a;
532
+ ptsJaggyLine[2].x = midPt1.x + deltaX1a;
533
+ ptsJaggyLine[2].y = midPt1.y + deltaY1a;
534
+ ptsJaggyLine[3] = new POINT2(endPt1);
535
+ for (let j: int = 0; j < 4; j++) {
536
+ points[counter] = new POINT2(ptsJaggyLine[j]);
537
+ counter++;
538
+ }
539
+ points[counter - 1].style = 5;
540
+
541
+ // Draw Arrow 2
542
+ let deltaX1b: double = Math.cos(angle1 + sign * DISMSupport.CONST_PI / 4) * delta;
543
+ let deltaY1b: double = Math.sin(angle1 + sign * DISMSupport.CONST_PI / 4) * delta;
544
+ ptsJaggyLine[0].x = ptsJaggyLine[3].x + deltaX1a;
545
+ ptsJaggyLine[0].y = ptsJaggyLine[3].y + deltaY1a;
546
+ ptsJaggyLine[1] = new POINT2(ptsJaggyLine[3]);
547
+ ptsJaggyLine[2].x = ptsJaggyLine[3].x + deltaX1b;
548
+ ptsJaggyLine[2].y = ptsJaggyLine[3].y + deltaY1b;
549
+ for (let j: int = 0; j < 3; j++) {
550
+ points[counter] = new POINT2(ptsJaggyLine[j]);
551
+ points[counter].style = 0;
552
+ if (lineType === TacticalLines.SARA) {
553
+
554
+ points[counter].style = 9;
555
+ }
556
+
557
+
558
+ counter++;
559
+ }
560
+ points[counter - 1].style = 5;
561
+ if (lineType === TacticalLines.SARA) {
562
+ points[counter - 1].style = 9;
563
+ points[counter] = new POINT2(points[counter - 3]);
564
+ points[counter].style = 10;
565
+ counter++;
566
+ }
567
+ } else {
568
+ points[0] = new POINT2(initialPt);
569
+ points[0].style = 0;
570
+ points[1] = new POINT2(endPt0);
571
+ points[1].style = 5;
572
+ points[2] = new POINT2(initialPt);
573
+ points[2].style = 0;
574
+ points[3] = new POINT2(endPt1);
575
+ return 4;
576
+ }
577
+ } catch (exc) {
578
+ if (exc instanceof Error) {
579
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMcoverDouble",
580
+ new RendererException("Failed inside GetDISMCoverDouble", exc));
581
+ } else {
582
+ throw exc;
583
+ }
584
+ }
585
+ return counter;
586
+ }
587
+ /**
588
+ * rev C uses 4
589
+ * @param points
590
+ * @param linetype
591
+ * @return
592
+ */
593
+ static GetDISMCoverDoubleRevC(points: POINT2[],
594
+ linetype: int,
595
+ vblSaveCounter: int): int {
596
+ let counter: int = 0;
597
+ try {
598
+ // switch points[1] and points[2] if they are backwards
599
+ let dAngle0: double = 0;
600
+ let dDeltaX0: double = 0;
601
+ let dDeltaY0: double = 0;
602
+ let dDeltaX1: double = 0;
603
+ let dDeltaY1: double = 0;
604
+ let iLengthPt0Pt1: double = 0;
605
+ let iLengthPt0Pt2: double = 0;
606
+ let iDelta: double = 0;
607
+ let j: int = 0;
608
+ let t: int = 1;
609
+ let iFontSize: double = 0;
610
+ let iLetterOffset: double = 0;
611
+ let savepoints: POINT2[] = new Array<POINT2>(3);
612
+ let pts: POINT2[] = new Array<POINT2>(2);
613
+ let ptsJaggyLine: POINT2[] = new Array<POINT2>(4);
614
+ //float scale = 1;
615
+ let goLeftThenRight: boolean = false;
616
+ let sign: int = 1;
617
+
618
+ //rev C with 4 points
619
+ let origPoints: POINT2[];
620
+ if (vblSaveCounter === 4) {
621
+ origPoints = new Array<POINT2>(4);
622
+ for (j = 0; j < vblSaveCounter; j++) {
623
+
624
+ origPoints[j] = new POINT2(points[j]);
625
+ }
626
+
627
+
628
+ //reorder points
629
+ points[1] = origPoints[0];
630
+ points[2] = origPoints[3];
631
+ points[0].x = (origPoints[1].x + origPoints[2].x) / 2;
632
+ points[0].y = (origPoints[1].y + origPoints[2].y) / 2;
633
+ }
634
+
635
+ //added section for jaggy line orientation M. Deutch 6-24-11
636
+ let pt0: POINT2 = new POINT2(points[0]);
637
+ let pt1: POINT2 = new POINT2(points[1]);
638
+ let pt2: POINT2 = new POINT2(points[2]);
639
+ let pt3: POINT2 = new POINT2();
640
+ let pt4: POINT2 = new POINT2();
641
+
642
+ lineutility.LineRelativeToLine(pt1, pt2, pt0, pt3, pt4);
643
+ //now we have the pt3-pt4 line which pt0 is on
644
+ //get the corresponding point back on the original line
645
+ lineutility.LineRelativeToLine(pt3, pt0, pt1, pt2, pt4);
646
+ let quadrant: int = lineutility.GetQuadrantDouble(pt0, pt4);
647
+
648
+ pt1 = new POINT2(points[1]);
649
+ pt2 = new POINT2(points[2]);
650
+ if (pt1.x < pt2.x && quadrant === 1) {
651
+
652
+ sign = -1;
653
+ }
654
+
655
+ else {
656
+ if (pt1.x > pt2.x && quadrant === 2) {
657
+
658
+ sign = -1;
659
+ }
660
+
661
+ else {
662
+ if (pt1.x > pt2.x && quadrant === 3) {
663
+
664
+ sign = -1;
665
+ }
666
+
667
+ else {
668
+ if (pt1.x < pt2.x && quadrant === 4) {
669
+
670
+ sign = -1;
671
+ }
672
+
673
+ }
674
+
675
+ }
676
+
677
+ }
678
+
679
+ if (linetype === TacticalLines.SARA) {
680
+
681
+ t = 0;
682
+ }
683
+
684
+
685
+ if (points[1].x <= points[2].x) {
686
+
687
+ goLeftThenRight = true;
688
+ }
689
+
690
+
691
+ //save the points in the correct order
692
+ for (j = 0; j < 3; j++) {
693
+ savepoints[j] = new POINT2(points[j]);
694
+ savepoints[j].style = 0;
695
+ }
696
+
697
+ lineutility.InitializePOINT2Array(pts);
698
+ lineutility.InitializePOINT2Array(ptsJaggyLine);
699
+
700
+ iLengthPt0Pt1 = Math.sqrt((savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
701
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y));
702
+ iLengthPt0Pt2 = Math.sqrt((savepoints[2].x - savepoints[0].x) * (savepoints[2].x - savepoints[0].x) +
703
+ (savepoints[2].y - savepoints[0].y) * (savepoints[2].y - savepoints[0].y));
704
+
705
+ if (iLengthPt0Pt1 > iLengthPt0Pt2) {
706
+ iLengthPt0Pt1 = iLengthPt0Pt2;
707
+ }
708
+ iFontSize = DISMSupport.GetTGFontSize(iLengthPt0Pt1);
709
+ if (iFontSize > 0) {
710
+ iDelta = iLengthPt0Pt1 / 15;//was 15
711
+
712
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
713
+ if (iDelta > DISMSupport.maxLength * DPIScaleFactor) {
714
+ iDelta = DISMSupport.maxLength * DPIScaleFactor;
715
+ }
716
+ if (iDelta < DISMSupport.minLength * DPIScaleFactor) {
717
+ iDelta = DISMSupport.minLength * DPIScaleFactor;
718
+ }
719
+
720
+ // left side: draw letter in from the jaggy line
721
+ if (vblSaveCounter < 4)//rev b
722
+ {
723
+ if (goLeftThenRight) {
724
+
725
+ savepoints[0].x -= 30 * t;
726
+ }
727
+ //was 20
728
+ else {
729
+
730
+ savepoints[0].x += 30 * t;
731
+ }
732
+ //was 20
733
+
734
+ iLetterOffset = 0;
735
+ ptsJaggyLine[0].x = savepoints[0].x - iLetterOffset * 2;//was -
736
+ ptsJaggyLine[0].y = savepoints[0].y;
737
+ ptsJaggyLine[0].x -= iLetterOffset;
738
+ dAngle0 = Math.atan2(ptsJaggyLine[0].y - savepoints[1].y, ptsJaggyLine[0].x - savepoints[1].x);
739
+ pts[0].x = (ptsJaggyLine[0].x + savepoints[1].x) / 2;
740
+ pts[0].y = (ptsJaggyLine[0].y + savepoints[1].y) / 2;
741
+ dDeltaX0 = Math.cos(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
742
+ dDeltaY0 = Math.sin(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
743
+ ptsJaggyLine[1].x = pts[0].x - dDeltaX0; //was -
744
+ ptsJaggyLine[1].y = pts[0].y - dDeltaY0; //was -
745
+ ptsJaggyLine[2].x = pts[0].x + dDeltaX0; //was +
746
+ ptsJaggyLine[2].y = pts[0].y + dDeltaY0; //was +
747
+ ptsJaggyLine[3] = new POINT2(savepoints[1]);
748
+ for (j = 0; j < 4; j++) {
749
+ points[counter] = new POINT2(ptsJaggyLine[j]);
750
+ counter++;
751
+ }
752
+ points[counter - 1].style = 5;
753
+ }//end rev b
754
+ else //rev c
755
+ {
756
+ ptsJaggyLine[0] = new POINT2(origPoints[1]);
757
+ dAngle0 = Math.atan2(ptsJaggyLine[0].y - origPoints[0].y, ptsJaggyLine[0].x - origPoints[0].x);
758
+ pts[0].x = (ptsJaggyLine[0].x + origPoints[0].x) / 2;
759
+ pts[0].y = (ptsJaggyLine[0].y + origPoints[0].y) / 2;
760
+ dDeltaX0 = Math.cos(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
761
+ dDeltaY0 = Math.sin(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
762
+ ptsJaggyLine[1].x = pts[0].x - dDeltaX0; //was -
763
+ ptsJaggyLine[1].y = pts[0].y - dDeltaY0; //was -
764
+ ptsJaggyLine[2].x = pts[0].x + dDeltaX0; //was +
765
+ ptsJaggyLine[2].y = pts[0].y + dDeltaY0; //was +
766
+ //ptsJaggyLine[3] = new POINT2(savepoints[1]);
767
+ ptsJaggyLine[3] = new POINT2(origPoints[0]);
768
+ for (j = 0; j < 4; j++) {
769
+ points[counter] = new POINT2(ptsJaggyLine[j]);
770
+ counter++;
771
+ }
772
+ points[counter - 1].style = 5;
773
+ }//end rev c
774
+
775
+ // draw arrow at end of line
776
+ dDeltaX1 = Math.cos(dAngle0 - sign * DISMSupport.CONST_PI / 4) * iDelta; //was -
777
+ dDeltaY1 = Math.sin(dAngle0 - sign * DISMSupport.CONST_PI / 4) * iDelta; //was -
778
+ if (vblSaveCounter < 4) {
779
+ ptsJaggyLine[0].x = savepoints[1].x + dDeltaX0; //was +
780
+ ptsJaggyLine[0].y = savepoints[1].y + dDeltaY0; //was +
781
+ }
782
+ else {
783
+ ptsJaggyLine[0].x = origPoints[0].x + dDeltaX0; //was +
784
+ ptsJaggyLine[0].y = origPoints[0].y + dDeltaY0; //was +
785
+ }
786
+ if (vblSaveCounter < 4) {
787
+
788
+ ptsJaggyLine[1] = new POINT2(savepoints[1]);
789
+ }
790
+
791
+ else {
792
+
793
+ ptsJaggyLine[1] = new POINT2(origPoints[0]);
794
+ }
795
+
796
+
797
+ if (vblSaveCounter < 4) {
798
+ ptsJaggyLine[2].x = savepoints[1].x + dDeltaX1; //was +
799
+ ptsJaggyLine[2].y = savepoints[1].y + dDeltaY1; //was +
800
+ }
801
+ else {
802
+ ptsJaggyLine[2].x = origPoints[0].x + dDeltaX1; //was +
803
+ ptsJaggyLine[2].y = origPoints[0].y + dDeltaY1; //was +
804
+ }
805
+ for (j = 0; j < 3; j++) {
806
+ points[counter] = new POINT2(ptsJaggyLine[j]);
807
+ points[counter].style = 0;
808
+ if (linetype === TacticalLines.SARA) {
809
+ points[counter].style = 9;
810
+ }
811
+
812
+ counter++;
813
+ }
814
+
815
+ points[counter - 1].style = 5;
816
+ if (linetype === TacticalLines.SARA) {
817
+ points[counter - 1].style = 9;
818
+ points[counter] = new POINT2(points[counter - 3]);
819
+ points[counter].style = 10;
820
+ counter++;
821
+ }
822
+
823
+ // right side: draw letter and jaggy line
824
+ if (vblSaveCounter < 4) //rev b
825
+ {
826
+ if (goLeftThenRight) {
827
+
828
+ savepoints[0].x += 60 * t;
829
+ }
830
+ //was 40
831
+ else {
832
+
833
+ savepoints[0].x -= 60 * t;
834
+ }
835
+ //wass 40
836
+
837
+ ptsJaggyLine[0].x = savepoints[0].x + iLetterOffset * 2;
838
+ ptsJaggyLine[0].y = savepoints[0].y;
839
+ ptsJaggyLine[0].x += iLetterOffset;
840
+ dAngle0 = Math.atan2(ptsJaggyLine[0].y - savepoints[2].y, ptsJaggyLine[0].x - savepoints[2].x);
841
+ pts[0].x = (ptsJaggyLine[0].x + savepoints[2].x) / 2;
842
+ pts[0].y = (ptsJaggyLine[0].y + savepoints[2].y) / 2;
843
+ dDeltaX0 = Math.cos(dAngle0 - sign * DISMSupport.CONST_PI / 4) * iDelta; //was -
844
+ dDeltaY0 = Math.sin(dAngle0 - sign * DISMSupport.CONST_PI / 4) * iDelta; //was -
845
+ ptsJaggyLine[1].x = pts[0].x - dDeltaX0; //was -
846
+ ptsJaggyLine[1].y = pts[0].y - dDeltaY0; //was -
847
+ ptsJaggyLine[2].x = pts[0].x + dDeltaX0; //was +
848
+ ptsJaggyLine[2].y = pts[0].y + dDeltaY0; //was +
849
+ ptsJaggyLine[3] = new POINT2(savepoints[2]);
850
+ for (j = 0; j < 4; j++) {
851
+ points[counter] = new POINT2(ptsJaggyLine[j]);
852
+ counter++;
853
+ }
854
+ points[counter - 1].style = 5;
855
+ // draw arrow at end of line
856
+ dDeltaX1 = Math.cos(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
857
+ dDeltaY1 = Math.sin(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
858
+ ptsJaggyLine[0].x = savepoints[2].x + dDeltaX0;
859
+ ptsJaggyLine[0].y = savepoints[2].y + dDeltaY0;
860
+ ptsJaggyLine[1] = savepoints[2];
861
+ ptsJaggyLine[2].x = savepoints[2].x + dDeltaX1;
862
+ ptsJaggyLine[2].y = savepoints[2].y + dDeltaY1;
863
+ }//end rev b
864
+ else //rev c
865
+ {
866
+ ptsJaggyLine[0] = new POINT2(origPoints[2]);
867
+ dAngle0 = Math.atan2(ptsJaggyLine[0].y - origPoints[3].y, ptsJaggyLine[0].x - origPoints[3].x);
868
+ pts[0].x = (ptsJaggyLine[0].x + origPoints[3].x) / 2;
869
+ pts[0].y = (ptsJaggyLine[0].y + origPoints[3].y) / 2;
870
+ dDeltaX0 = Math.cos(dAngle0 - sign * DISMSupport.CONST_PI / 4) * iDelta; //was -
871
+ dDeltaY0 = Math.sin(dAngle0 - sign * DISMSupport.CONST_PI / 4) * iDelta; //was -
872
+ ptsJaggyLine[1].x = pts[0].x - dDeltaX0; //was -
873
+ ptsJaggyLine[1].y = pts[0].y - dDeltaY0; //was -
874
+ ptsJaggyLine[2].x = pts[0].x + dDeltaX0; //was +
875
+ ptsJaggyLine[2].y = pts[0].y + dDeltaY0; //was +
876
+ //ptsJaggyLine[3] = new POINT2(savepoints[2]);
877
+ ptsJaggyLine[3] = new POINT2(origPoints[3]);
878
+ for (j = 0; j < 4; j++) {
879
+ points[counter] = new POINT2(ptsJaggyLine[j]);
880
+ counter++;
881
+ }
882
+ points[counter - 1].style = 5;
883
+ // draw arrow at end of line
884
+ dDeltaX1 = Math.cos(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
885
+ dDeltaY1 = Math.sin(dAngle0 + sign * DISMSupport.CONST_PI / 4) * iDelta; //was +
886
+ ptsJaggyLine[0].x = origPoints[3].x + dDeltaX0;
887
+ ptsJaggyLine[0].y = origPoints[3].y + dDeltaY0;
888
+ ptsJaggyLine[1] = new POINT2(origPoints[3]);
889
+ ptsJaggyLine[2].x = origPoints[3].x + dDeltaX1;
890
+ ptsJaggyLine[2].y = origPoints[3].y + dDeltaY1;
891
+ }//end rev c
892
+
893
+ for (j = 0; j < 3; j++) {
894
+ points[counter] = new POINT2(ptsJaggyLine[j]);
895
+ points[counter].style = 0;
896
+ if (linetype === TacticalLines.SARA) {
897
+
898
+ points[counter].style = 9;
899
+ }
900
+
901
+
902
+ counter++;
903
+ }
904
+ points[counter - 1].style = 5;
905
+ if (linetype === TacticalLines.SARA) {
906
+ points[counter - 1].style = 9;
907
+ points[counter] = new POINT2(points[counter - 3]);
908
+ points[counter].style = 10;
909
+ counter++;
910
+ }
911
+ }
912
+ else {
913
+ points[0] = new POINT2(savepoints[0]);
914
+ points[0].style = 0;
915
+ points[1] = new POINT2(savepoints[1]);
916
+ points[1].style = 5;
917
+ points[2] = new POINT2(savepoints[0]);
918
+ points[2].style = 0;
919
+ points[3] = new POINT2(savepoints[2]);
920
+ return 4;
921
+ }
922
+ } catch (exc) {
923
+ if (exc instanceof Error) {
924
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMcoverDoubleRevC",
925
+ new RendererException("Failed inside GetDISMCoverDoubleRevc", exc));
926
+ } else {
927
+ throw exc;
928
+ }
929
+ }
930
+ return counter;
931
+ }
932
+ /**
933
+ * Calculates the points for BYPASS
934
+ *
935
+ * @param points OUT - the client points, also used for the returned points.
936
+ * @param linetype the line type.
937
+ */
938
+ static GetDISMBypassDouble(points: POINT2[],
939
+ linetype: int): int {
940
+ let counter: int = 0;
941
+ try {
942
+ let j: int = 0;
943
+ let pointsCorner: POINT2[] = new Array<POINT2>(2);
944
+ let rectpts: POINT2[] = new Array<POINT2>(4);
945
+ let savepoints: POINT2[] = new Array<POINT2>(3);
946
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
947
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
948
+ let iDeltaX: ref<number[]> = new ref();
949
+ let iDeltaY: ref<number[]> = new ref();
950
+ let bPointsRight: int = 0;
951
+
952
+ for (j = 0; j < 3; j++) {
953
+ savepoints[j] = new POINT2(points[j]);
954
+ }
955
+
956
+ lineutility.InitializePOINT2Array(pointsCorner);
957
+ lineutility.InitializePOINT2Array(rectpts);
958
+ lineutility.InitializePOINT2Array(deltapoints1);
959
+ lineutility.InitializePOINT2Array(deltapoints2);
960
+
961
+ DISMSupport.DrawOpenRectangleDouble(savepoints, pointsCorner, rectpts);
962
+ for (j = 0; j < 4; j++) {
963
+ points[counter] = rectpts[j];
964
+ counter++;
965
+ }
966
+
967
+ bPointsRight = DISMSupport.DetermineDirectionDouble(savepoints);
968
+
969
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX, iDeltaY, DISMSupport.CONST_PI / 4);
970
+
971
+ if ((savepoints[0].y - savepoints[1].y) < 0) {// Point0 is higher than Point1
972
+ if (bPointsRight !== 0) {// figure opens to the right
973
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
974
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
975
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
976
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
977
+ } else {// figure opens to the left
978
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
979
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
980
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
981
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
982
+ }
983
+ } else {// Point0 is lower than Point1
984
+ if (bPointsRight !== 0) {// figure opens to the right
985
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
986
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
987
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
988
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
989
+ } else {// figure opens to the left
990
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
991
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
992
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
993
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
994
+ }
995
+ }
996
+
997
+ for (j = 0; j < 4; j++) {
998
+ points[counter] = new POINT2(deltapoints1[j]);
999
+ counter++;
1000
+ }
1001
+ for (j = 0; j < 4; j++) {
1002
+ points[counter] = new POINT2(deltapoints2[j]);
1003
+ counter++;
1004
+ }
1005
+ } catch (exc) {
1006
+ if (exc instanceof Error) {
1007
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMBypassDouble",
1008
+ new RendererException("Failed inside GetDISMBypassDouble", exc));
1009
+ } else {
1010
+ throw exc;
1011
+ }
1012
+ }
1013
+ return counter;
1014
+ }
1015
+ /**
1016
+ * Calculates the points for BREACH.
1017
+ *
1018
+ * @param points OUT - the client points, also used for the returned points.
1019
+ * @param linetype the line type.
1020
+ */
1021
+ static GetDISMBreachDouble(points: POINT2[], linetype: int): int {
1022
+ let counter: int = 0;
1023
+ try {
1024
+ let pointsCorner: POINT2[] = new Array<POINT2>(2);
1025
+ let rectpts: POINT2[] = new Array<POINT2>(4);
1026
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
1027
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
1028
+ let iDeltaX: ref<number[]> = new ref();
1029
+ let iDeltaY: ref<number[]> = new ref();
1030
+ let bPointsRight: int = 0;
1031
+ let j: int = 0;
1032
+ let savepoints: POINT2[] = new Array<POINT2>(3);
1033
+
1034
+ for (j = 0; j < 3; j++) {
1035
+ savepoints[j] = new POINT2(points[j]);
1036
+ }
1037
+
1038
+ lineutility.InitializePOINT2Array(pointsCorner);
1039
+ lineutility.InitializePOINT2Array(rectpts);
1040
+ lineutility.InitializePOINT2Array(deltapoints1);
1041
+ lineutility.InitializePOINT2Array(deltapoints2);
1042
+
1043
+ DISMSupport.DrawOpenRectangleDouble(savepoints, pointsCorner, rectpts);
1044
+ for (j = 0; j < 4; j++) {
1045
+ points[counter] = new POINT2(rectpts[j]);
1046
+ counter++;
1047
+ }
1048
+
1049
+ bPointsRight = DISMSupport.DetermineDirectionDouble(savepoints);
1050
+
1051
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX, iDeltaY, DISMSupport.CONST_PI / 4);
1052
+
1053
+ if ((savepoints[0].y - savepoints[1].y) < 0) {// Point0 is higher than Point1
1054
+ if (bPointsRight !== 0) {// figure opens to the right
1055
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1056
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints1);
1057
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1058
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints2);
1059
+ } else {// figure opens to the left
1060
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1061
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints1);
1062
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1063
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints2);
1064
+ }
1065
+ } else {// Point0 is lower than Point1
1066
+ if (bPointsRight !== 0) {// figure opens to the right
1067
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1068
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints1);
1069
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1070
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints2);
1071
+ } else {// figure opens to the left
1072
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1073
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints1);
1074
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1075
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints2);
1076
+ }
1077
+ }
1078
+ for (j = 0; j < 4; j++) {
1079
+ points[counter] = new POINT2(deltapoints1[j]);
1080
+ counter++;
1081
+ }
1082
+ for (j = 0; j < 4; j++) {
1083
+ points[counter] = new POINT2(deltapoints2[j]);
1084
+ counter++;
1085
+ }
1086
+ } catch (exc) {
1087
+ if (exc instanceof Error) {
1088
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMBreachDouble",
1089
+ new RendererException("Failed inside GetDISMBreachDouble", exc));
1090
+ } else {
1091
+ throw exc;
1092
+ }
1093
+ }
1094
+ return counter;
1095
+ }
1096
+ /**
1097
+ * Calculates the points for CANALIZE
1098
+ *
1099
+ * @param points - OUT - the client points, also used for the returned points.
1100
+ * @param linetype the line type.
1101
+ */
1102
+ static GetDISMCanalizeDouble(points: POINT2[], linetype: int): int {
1103
+ let counter: int = 0;
1104
+ try {
1105
+ let pointsCorner: POINT2[] = new Array<POINT2>(2);
1106
+ let rectpts: POINT2[] = new Array<POINT2>(4);
1107
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
1108
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
1109
+ let j: int = 0;
1110
+ let iDeltaX: ref<number[]> = new ref();
1111
+ let iDeltaY: ref<number[]> = new ref();
1112
+ let bPointsRight: int = 0;
1113
+ let savepoints: POINT2[] = new Array<POINT2>(3);
1114
+
1115
+ for (j = 0; j < 3; j++) {
1116
+ savepoints[j] = new POINT2(points[j]);
1117
+ }
1118
+
1119
+ lineutility.InitializePOINT2Array(pointsCorner);
1120
+ lineutility.InitializePOINT2Array(rectpts);
1121
+ lineutility.InitializePOINT2Array(deltapoints1);
1122
+ lineutility.InitializePOINT2Array(deltapoints2);
1123
+
1124
+ DISMSupport.DrawOpenRectangleDouble(savepoints, pointsCorner, rectpts);
1125
+
1126
+ for (j = 0; j < 4; j++) {
1127
+ points[counter] = new POINT2(rectpts[j]);
1128
+ counter++;
1129
+ }
1130
+
1131
+ bPointsRight = DISMSupport.DetermineDirectionDouble(savepoints);
1132
+
1133
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX, iDeltaY, DISMSupport.CONST_PI / 4);
1134
+
1135
+ if ((savepoints[0].y - savepoints[1].y) < 0) {// Point0 is higher than Point1
1136
+ if (bPointsRight !== 0) {// figure opens to the right
1137
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1138
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints1);
1139
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1140
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints2);
1141
+ } else {// figure opens to the left
1142
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1143
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints1);
1144
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1145
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints2);
1146
+ }
1147
+ } else {// Point0 is lower than Point1
1148
+ if (bPointsRight !== 0) {// figure opens to the right
1149
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1150
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints1);
1151
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1152
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints2);
1153
+ } else {// figure opens to the left
1154
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
1155
+ iDeltaX.value[0], iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], deltapoints1);
1156
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
1157
+ iDeltaY.value[0], -iDeltaX.value[0], -iDeltaY.value[0], iDeltaX.value[0], deltapoints2);
1158
+ }
1159
+ }
1160
+
1161
+ for (j = 0; j < 4; j++) {
1162
+ points[counter] = new POINT2(deltapoints1[j]);
1163
+ counter++;
1164
+ }
1165
+ for (j = 0; j < 4; j++) {
1166
+ points[counter] = new POINT2(deltapoints2[j]);
1167
+ counter++;
1168
+ }
1169
+ } catch (exc) {
1170
+ if (exc instanceof Error) {
1171
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMCanalizeDouble",
1172
+ new RendererException("Failed inside GetDISMCanalizeDouble", exc));
1173
+ } else {
1174
+ throw exc;
1175
+ }
1176
+ }
1177
+ return counter;
1178
+ }
1179
+
1180
+ /**
1181
+ * Gets shape for Feint, decoy, or dummy indicator. Does not check if tactical graphic should have indicator
1182
+ * @param tg used to get line color and stroke
1183
+ * @param ptA bottom left point of triangle
1184
+ * @param ptC bottom right point of triangle
1185
+ * @return Dummy indicator shape
1186
+ */
1187
+ public static getFDIShape(tg: TGLight, ptA: POINT2, ptC: POINT2): Shape2;
1188
+
1189
+ /**
1190
+ * Gets shape for Feint, decoy, or dummy indicator for symbols with arrowhead. Does not check if tactical graphic should have indicator
1191
+ * Extends each point outside arrow as necessary
1192
+ * @param tg used to get line color and stroke
1193
+ * @param ptA bottom left point of arrow
1194
+ * @param ptB arrow point
1195
+ * @param ptC bottom right point of arrow
1196
+ * @return Dummy indicator shape
1197
+ */
1198
+ public static getFDIShape(tg: TGLight, ptA: POINT2, ptB: POINT2, ptC: POINT2): Shape2;
1199
+ public static getFDIShape(...args: unknown[]): Shape2 | null {
1200
+ switch (args.length) {
1201
+ case 3: {
1202
+ const [tg, ptA, ptC] = args as [TGLight, POINT2, POINT2];
1203
+
1204
+
1205
+ try {
1206
+ let midPt: POINT2 = lineutility.MidPointDouble(ptA, ptC, 0);
1207
+ let len: double = lineutility.CalcDistanceDouble(ptA, midPt);
1208
+ let ptB: POINT2 = lineutility.ExtendDirectedLine(ptA, ptC, midPt, lineutility.extend_above, len);
1209
+ let shape: Shape2 = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
1210
+ shape.moveTo(ptA);
1211
+ shape.lineTo(ptB);
1212
+ shape.lineTo(ptC);
1213
+ shape.set_Style(1);
1214
+ shape.setLineColor(tg.get_LineColor());
1215
+
1216
+ let stroke: BasicStroke = clsUtility.getLineStroke(tg.get_LineThickness(), shape.get_Style(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
1217
+ shape.setStroke(stroke);
1218
+ return shape;
1219
+ } catch (exc) {
1220
+ if (exc instanceof Error) {
1221
+ ErrorLogger.LogException(DISMSupport._className, "getFDIShape",
1222
+ new RendererException("Failed inside getFDIShape", exc));
1223
+ } else {
1224
+ throw exc;
1225
+ }
1226
+ }
1227
+ return null;
1228
+
1229
+
1230
+ break;
1231
+ }
1232
+
1233
+ case 4: {
1234
+ let [tg, ptA, ptB, ptC] = args as [TGLight, POINT2, POINT2, POINT2];
1235
+
1236
+
1237
+ try {
1238
+ // Extend ptA and ptC .25w
1239
+ let w: double = lineutility.CalcDistanceDouble(ptA, ptC) * 0.25;
1240
+ if (w < tg.get_LineThickness() * 1.5) {
1241
+ // lineThickness * 1.5 is minimum distance between arrow and dummy modifier
1242
+ w = tg.get_LineThickness() * 1.5;
1243
+ }
1244
+ ptC = lineutility.ExtendLineDouble(ptA, ptC, w);
1245
+ ptA = lineutility.ExtendLineDouble(ptC, ptA, w);
1246
+
1247
+ // Extend ptB .5w
1248
+ let midPt: POINT2 = lineutility.MidPointDouble(ptA, ptC, 0);
1249
+ w = lineutility.CalcDistanceDouble(midPt, ptB) * 0.5;
1250
+ if (w < tg.get_LineThickness() * 1.5) {
1251
+ // lineThickness * 1.5 is minimum distance between arrow and dummy modifier
1252
+ w = tg.get_LineThickness() * 1.5;
1253
+ }
1254
+ ptB = lineutility.ExtendLineDouble(midPt, ptB, w);
1255
+
1256
+ let shape: Shape2 = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
1257
+ shape.moveTo(ptA);
1258
+ shape.lineTo(ptB);
1259
+ shape.lineTo(ptC);
1260
+ shape.set_Style(1);
1261
+ shape.setLineColor(tg.get_LineColor());
1262
+
1263
+ let stroke: BasicStroke = clsUtility.getLineStroke(tg.get_LineThickness(), shape.get_Style(), BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
1264
+ shape.setStroke(stroke);
1265
+ return shape;
1266
+ } catch (exc) {
1267
+ if (exc instanceof Error) {
1268
+ ErrorLogger.LogException(DISMSupport._className, "getFDIShape",
1269
+ new RendererException("Failed inside getFDIShape", exc));
1270
+ } else {
1271
+ throw exc;
1272
+ }
1273
+ }
1274
+ return null;
1275
+
1276
+
1277
+ break;
1278
+ }
1279
+
1280
+ default: {
1281
+ throw Error(`Invalid number of arguments`);
1282
+ }
1283
+ }
1284
+ }
1285
+
1286
+
1287
+ /**
1288
+ * Calculates the points for DISRUPT
1289
+ *
1290
+ * @param points OUT - the client points, also used for the returned points.
1291
+ * @param linetype the line type.
1292
+ */
1293
+ static GetDISMDisruptDouble(points: POINT2[], linetype: int): int {
1294
+ let counter: int = 0;
1295
+ try {
1296
+ let pts: POINT2[] = new Array<POINT2>(2);
1297
+ let ptsArrow: POINT2[] = new Array<POINT2>(3);
1298
+ let ptCenter: POINT2 = new POINT2();
1299
+ let j: int = 0;
1300
+ let savepoints: POINT2[] = new Array<POINT2>(3);
1301
+ let dAngle1: double = 0;
1302
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
1303
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
1304
+ let deltapoints3: POINT2[] = new Array<POINT2>(4);
1305
+ let iDiagEOL_length: double = 0;
1306
+ let iDeltaX1: double = 0;
1307
+ let iDeltaY1: double = 0;
1308
+ let iDeltaX2: double = 0;
1309
+ let iDeltaY2: double = 0;
1310
+
1311
+ for (j = 0; j < 3; j++) {
1312
+ savepoints[j] = new POINT2(points[j]);
1313
+ }
1314
+
1315
+ lineutility.InitializePOINT2Array(pts);
1316
+ lineutility.InitializePOINT2Array(ptsArrow);
1317
+ lineutility.InitializePOINT2Array(deltapoints1);
1318
+ lineutility.InitializePOINT2Array(deltapoints2);
1319
+ lineutility.InitializePOINT2Array(deltapoints3);
1320
+
1321
+ // DrawLine(destination, mask, color, points, 2, 2);
1322
+ points[counter] = new POINT2(savepoints[0]);
1323
+ points[counter].style = 0;
1324
+ counter++;
1325
+ points[counter] = new POINT2(savepoints[1]);
1326
+ points[counter].style = 5;
1327
+ counter++;
1328
+ // pts[0] = points[1];
1329
+ // pts[1] = points[2];
1330
+ // DrawLine(destination, mask, color, pts, 2, 2);
1331
+ points[counter] = new POINT2(savepoints[1]);
1332
+ points[counter].style = 0;
1333
+ counter++;
1334
+ points[counter] = new POINT2(savepoints[2]);
1335
+ points[counter].style = 5;
1336
+ counter++;
1337
+
1338
+ ptCenter.x = (savepoints[0].x + savepoints[1].x) / 2;
1339
+ ptCenter.y = (savepoints[0].y + savepoints[1].y) / 2;
1340
+ ptsArrow[0] = new POINT2(savepoints[2]);
1341
+ ptsArrow[1].x = ptCenter.x + (savepoints[2].x - savepoints[1].x) * 4 / 5;
1342
+ ptsArrow[1].y = ptCenter.y + (savepoints[2].y - savepoints[1].y) * 4 / 5;
1343
+ ptsArrow[2].x = savepoints[0].x + (savepoints[2].x - savepoints[1].x) * 3 / 5;
1344
+ ptsArrow[2].y = savepoints[0].y + (savepoints[2].y - savepoints[1].y) * 3 / 5;
1345
+
1346
+ pts[0].x = ptCenter.x - (savepoints[2].x - savepoints[1].x) / 5;
1347
+ pts[0].y = ptCenter.y - (savepoints[2].y - savepoints[1].y) / 5;
1348
+ pts[1] = new POINT2(ptsArrow[1]);
1349
+ // DrawLine(destination, mask, color, pts, 2, 2);
1350
+ points[counter] = new POINT2(pts[0]);
1351
+ points[counter].style = 0;
1352
+ counter++;
1353
+ points[counter] = new POINT2(pts[1]);
1354
+ points[counter].style = 5;
1355
+ counter++;
1356
+
1357
+ pts[0] = new POINT2(savepoints[0]);
1358
+ pts[1] = new POINT2(ptsArrow[2]);
1359
+ // DrawLine(destination, mask, color, pts, 2, 2);
1360
+ points[counter] = new POINT2(pts[0]);
1361
+ points[counter].style = 0;
1362
+ counter++;
1363
+ points[counter] = new POINT2(pts[1]);
1364
+ points[counter].style = 5;
1365
+ counter++;
1366
+
1367
+ // the following code is very similar to CalcEndpieceDeltas
1368
+ iDiagEOL_length = ((Math.sqrt // height of graphic
1369
+ (
1370
+ (savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
1371
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y)) +
1372
+ Math.sqrt // length of graphic
1373
+ (
1374
+ (savepoints[2].x - savepoints[1].x) * (savepoints[2].x - savepoints[1].x) +
1375
+ (savepoints[2].y - savepoints[1].y) * (savepoints[2].y - savepoints[1].y))) / 15);
1376
+
1377
+ //M. Deutch 8-18-04
1378
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
1379
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
1380
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
1381
+ }
1382
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {//was minLength
1383
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor; //was minLength
1384
+ }
1385
+
1386
+ // dAngle1 = angle used to calculate the end-piece deltas
1387
+ dAngle1 = Math.atan2(savepoints[1].y - savepoints[2].y, savepoints[1].x - savepoints[2].x);
1388
+ // dAngle1 = atan2(savepoints[1].y - savepoints[2].y, savepoints[1].x - savepoints[2].x);
1389
+ iDeltaX1 = (iDiagEOL_length * Math.cos(dAngle1 - DISMSupport.CONST_PI / 6));
1390
+ iDeltaY1 = (iDiagEOL_length * Math.sin(dAngle1 - DISMSupport.CONST_PI / 6));
1391
+ iDeltaX2 = (iDiagEOL_length * Math.cos(dAngle1 + DISMSupport.CONST_PI / 6));
1392
+ iDeltaY2 = (iDiagEOL_length * Math.sin(dAngle1 + DISMSupport.CONST_PI / 6));
1393
+
1394
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[0],
1395
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints1);
1396
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[1],
1397
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints2);
1398
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[2],
1399
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints3);
1400
+ for (j = 0; j < 4; j++) {
1401
+ points[counter] = new POINT2(deltapoints1[j]);
1402
+ counter++;
1403
+ }
1404
+ for (j = 0; j < 4; j++) {
1405
+ points[counter] = new POINT2(deltapoints2[j]);
1406
+ counter++;
1407
+ }
1408
+ for (j = 0; j < 4; j++) {
1409
+ points[counter] = new POINT2(deltapoints3[j]);
1410
+ counter++;
1411
+ }
1412
+ } catch (exc) {
1413
+ if (exc instanceof Error) {
1414
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMDisruptDouble",
1415
+ new RendererException("Failed inside GetDISMDisruptDouble", exc));
1416
+ } else {
1417
+ throw exc;
1418
+ }
1419
+ }
1420
+ return counter;
1421
+ }
1422
+ /**
1423
+ * Calculates the points for CONTAIN
1424
+ *
1425
+ * @param points OUT - the client points, also used for the returned points.
1426
+ * @param linetype the line type.
1427
+ */
1428
+ static GetDISMContainDouble(points: POINT2[], linetype: int): int {
1429
+ let counter: int = 0;
1430
+ try {
1431
+ let pts: POINT2[] = new Array<POINT2>(3);
1432
+ let ptCenter: POINT2 = new POINT2();
1433
+ let ptPerp: POINT2 = new POINT2(); // point used to draw perpendicular line
1434
+ let iPerpLength: double = 0;
1435
+ let j: int = 0;
1436
+ let dAngle1: double = 0;
1437
+ let d: double = 0;
1438
+ let dCosAngle1: double = 0;
1439
+ let dSinAngle1: double = 0;
1440
+ let iRadius: double = 0;
1441
+ let iDiagEOL_length: double = 0;
1442
+ let dAngle2: double = 0;
1443
+ let dDeltaX1: double = 0;
1444
+ let dDeltaY1: double = 0;
1445
+ let dDeltaX2: double = 0;
1446
+ let dDeltaY2: double = 0;
1447
+ let savepoints: POINT2[] = new Array<POINT2>(3);
1448
+ let arcpoints: POINT2[] = new Array<POINT2>(17);
1449
+
1450
+ for (j = 0; j < 3; j++) {
1451
+ savepoints[j] = new POINT2(points[j]);
1452
+ }
1453
+
1454
+ lineutility.InitializePOINT2Array(pts);
1455
+ lineutility.InitializePOINT2Array(arcpoints);
1456
+
1457
+ ptCenter.x = (savepoints[0].x + savepoints[1].x) / 2;
1458
+ ptCenter.y = (savepoints[0].y + savepoints[1].y) / 2;
1459
+
1460
+ //added section M. Deutch 8-10-06
1461
+ //reverse points 0 and 1 if necessary to ensure arc
1462
+ //has correct orientation
1463
+ let m: ref<number[]> = new ref();
1464
+ let ptRelative: POINT2 = lineutility.PointRelativeToLine(savepoints[0], savepoints[1], savepoints[2]);
1465
+
1466
+ lineutility.CalcTrueSlopeDouble2(savepoints[0], savepoints[1], m);
1467
+ if (m.value[0] !== 0) {
1468
+ if (savepoints[0].y > savepoints[1].y) {
1469
+ if (ptRelative.x > ptCenter.x) {
1470
+ lineutility.Reverse2Points(savepoints[0], savepoints[1]);
1471
+ }
1472
+ }
1473
+ if (savepoints[0].y < savepoints[1].y) {
1474
+ if (ptRelative.x < ptCenter.x) {
1475
+ lineutility.Reverse2Points(savepoints[0], savepoints[1]);
1476
+ }
1477
+ }
1478
+ } else {
1479
+ if (savepoints[0].x < savepoints[1].x) {
1480
+ if (ptRelative.y > ptCenter.y) {
1481
+ lineutility.Reverse2Points(savepoints[0], savepoints[1]);
1482
+ }
1483
+ }
1484
+ if (savepoints[0].x > savepoints[1].x) {
1485
+ if (ptRelative.y < ptCenter.y) {
1486
+ lineutility.Reverse2Points(savepoints[0], savepoints[1]);
1487
+ }
1488
+ }
1489
+ }
1490
+ //end section
1491
+
1492
+ iPerpLength = Math.sqrt((ptCenter.x - savepoints[2].x) * (ptCenter.x - savepoints[2].x) + (ptCenter.y - savepoints[2].y) * (ptCenter.y - savepoints[2].y));
1493
+ if (iPerpLength < 1) {
1494
+ iPerpLength = 1;
1495
+ }
1496
+
1497
+ dAngle1 = Math.atan2(savepoints[0].y - savepoints[1].y, savepoints[0].x - savepoints[1].x);
1498
+ dCosAngle1 = Math.cos(dAngle1 + DISMSupport.CONST_PI / 2);
1499
+ dSinAngle1 = Math.sin(dAngle1 + DISMSupport.CONST_PI / 2);
1500
+
1501
+ ptPerp.x = ptCenter.x + dCosAngle1 * iPerpLength;
1502
+ ptPerp.y = ptCenter.y + dSinAngle1 * iPerpLength;
1503
+
1504
+ pts[0] = new POINT2(ptCenter);
1505
+
1506
+ pts[1] = new POINT2(savepoints[2]);
1507
+
1508
+ points[counter] = new POINT2(pts[0]);
1509
+ points[counter].style = 14;
1510
+ counter++;
1511
+ points[counter] = new POINT2(pts[1]);
1512
+ points[counter].style = 5;
1513
+ counter++;
1514
+
1515
+ // draw arrowhead
1516
+ iRadius = Math.sqrt((ptCenter.x - savepoints[0].x) * (ptCenter.x - savepoints[0].x) + (ptCenter.y - savepoints[0].y) * (ptCenter.y - savepoints[0].y));
1517
+ iDiagEOL_length = (iPerpLength + iRadius) / 20;
1518
+
1519
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
1520
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
1521
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
1522
+ }
1523
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
1524
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
1525
+ }
1526
+
1527
+ dAngle2 = Math.atan2(ptPerp.y - ptCenter.y, ptPerp.x - ptCenter.x);
1528
+ dDeltaX1 = Math.cos(dAngle2 + DISMSupport.CONST_PI / 4);
1529
+ dDeltaY1 = Math.sin(dAngle2 + DISMSupport.CONST_PI / 4);
1530
+ dDeltaX2 = Math.cos(dAngle2 - DISMSupport.CONST_PI / 4);
1531
+ dDeltaY2 = Math.sin(dAngle2 - DISMSupport.CONST_PI / 4);
1532
+ pts[0].x = ptCenter.x + dDeltaX1 * iDiagEOL_length;
1533
+ pts[0].y = ptCenter.y + dDeltaY1 * iDiagEOL_length;
1534
+ pts[1] = new POINT2(ptCenter);
1535
+ pts[2].x = ptCenter.x + dDeltaX2 * iDiagEOL_length;
1536
+ pts[2].y = ptCenter.y + dDeltaY2 * iDiagEOL_length;
1537
+ //end section
1538
+ for (j = 0; j < 3; j++) {
1539
+ points[counter] = new POINT2(pts[j]);
1540
+ points[counter].style = 0;
1541
+ counter++;
1542
+ }
1543
+ points[counter - 1].style = 5;
1544
+
1545
+ // draw arc
1546
+ DISMSupport.ArcApproximationDouble(ptCenter.x - iRadius, ptCenter.y - iRadius,
1547
+ ptCenter.x + iRadius, ptCenter.y + iRadius,
1548
+ savepoints[0].x, savepoints[0].y, savepoints[1].x, savepoints[1].y, arcpoints);
1549
+
1550
+ for (j = 0; j < 17; j++) {
1551
+ points[counter] = new POINT2(arcpoints[j]);
1552
+ points[counter].style = 0;
1553
+ counter++;
1554
+ }
1555
+ points[counter - 1].style = 5;
1556
+
1557
+ // draw spokes inside arc
1558
+ pts[0] = new POINT2(savepoints[0]);
1559
+ pts[1].x = (pts[0].x + ptCenter.x) / 2;
1560
+ pts[1].y = (pts[0].y + ptCenter.y) / 2;
1561
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1562
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1563
+ {
1564
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1565
+ }
1566
+
1567
+ points[counter] = new POINT2(pts[0]);
1568
+ points[counter].style = 0;
1569
+ counter++;
1570
+ points[counter] = new POINT2(pts[1]);
1571
+ points[counter].style = 5;
1572
+ counter++;
1573
+
1574
+ pts[0] = new POINT2(savepoints[1]);
1575
+ pts[1].x = (pts[0].x + ptCenter.x) / 2;
1576
+ pts[1].y = (pts[0].y + ptCenter.y) / 2;
1577
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1578
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1579
+ {
1580
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1581
+ }
1582
+ // DrawLine(destination, mask, color, pts, 2, 2);
1583
+
1584
+ points[counter] = new POINT2(pts[0]);
1585
+ points[counter].style = 0;
1586
+ counter++;
1587
+ points[counter] = new POINT2(pts[1]);
1588
+ points[counter].style = 5;
1589
+ counter++;
1590
+
1591
+ pts[0].x = ptCenter.x - (ptPerp.x - ptCenter.x) * iRadius / iPerpLength;
1592
+ pts[0].y = ptCenter.y - (ptPerp.y - ptCenter.y) * iRadius / iPerpLength;
1593
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1594
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1595
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1596
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1597
+ {
1598
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1599
+ }
1600
+
1601
+ points[counter] = new POINT2(pts[0]);
1602
+ points[counter].style = 0;
1603
+ counter++;
1604
+ points[counter] = new POINT2(pts[1]);
1605
+ points[counter].style = 5;
1606
+ counter++;
1607
+
1608
+ pts[0].x = ptCenter.x - dDeltaX1 * iRadius;
1609
+ pts[0].y = ptCenter.y - dDeltaY1 * iRadius;
1610
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1611
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1612
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1613
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1614
+ {
1615
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1616
+ }
1617
+
1618
+ points[counter] = new POINT2(pts[0]);
1619
+ points[counter].style = 0;
1620
+ counter++;
1621
+ points[counter] = new POINT2(pts[1]);
1622
+ points[counter].style = 5;
1623
+ counter++;
1624
+
1625
+ pts[0].x = ptCenter.x - dDeltaX2 * iRadius;
1626
+ pts[0].y = ptCenter.y - dDeltaY2 * iRadius;
1627
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1628
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1629
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1630
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1631
+ {
1632
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1633
+ }
1634
+
1635
+ points[counter] = new POINT2(pts[0]);
1636
+ points[counter].style = 0;
1637
+ counter++;
1638
+ points[counter] = new POINT2(pts[1]);
1639
+ points[counter].style = 5;
1640
+ counter++;
1641
+
1642
+ dDeltaX1 = Math.cos(dAngle2 + DISMSupport.CONST_PI / 8);
1643
+ dDeltaY1 = Math.sin(dAngle2 + DISMSupport.CONST_PI / 8);
1644
+ dDeltaX2 = Math.cos(dAngle2 - DISMSupport.CONST_PI / 8);
1645
+ dDeltaY2 = Math.sin(dAngle2 - DISMSupport.CONST_PI / 8);
1646
+ pts[0].x = ptCenter.x - dDeltaX1 * iRadius;
1647
+ pts[0].y = ptCenter.y - dDeltaY1 * iRadius;
1648
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1649
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1650
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1651
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1652
+ {
1653
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1654
+ }
1655
+
1656
+ points[counter] = new POINT2(pts[0]);
1657
+ points[counter].style = 0;
1658
+ counter++;
1659
+ points[counter] = new POINT2(pts[1]);
1660
+ points[counter].style = 5;
1661
+ counter++;
1662
+
1663
+ pts[0].x = ptCenter.x - dDeltaX2 * iRadius;
1664
+ pts[0].y = ptCenter.y - dDeltaY2 * iRadius;
1665
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1666
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1667
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1668
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1669
+ {
1670
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1671
+ }
1672
+
1673
+ points[counter] = new POINT2(pts[0]);
1674
+ points[counter].style = 0;
1675
+ counter++;
1676
+ points[counter] = new POINT2(pts[1]);
1677
+ points[counter].style = 5;
1678
+ counter++;
1679
+
1680
+ dDeltaX1 = Math.cos(dAngle2 + 3 * DISMSupport.CONST_PI / 8);
1681
+ dDeltaY1 = Math.sin(dAngle2 + 3 * DISMSupport.CONST_PI / 8);
1682
+ dDeltaX2 = Math.cos(dAngle2 - 3 * DISMSupport.CONST_PI / 8);
1683
+ dDeltaY2 = Math.sin(dAngle2 - 3 * DISMSupport.CONST_PI / 8);
1684
+ pts[0].x = ptCenter.x - dDeltaX1 * iRadius;
1685
+ pts[0].y = ptCenter.y - dDeltaY1 * iRadius;
1686
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1687
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1688
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1689
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1690
+ {
1691
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1692
+ }
1693
+
1694
+ points[counter] = new POINT2(pts[0]);
1695
+ points[counter].style = 0;
1696
+ counter++;
1697
+ points[counter] = new POINT2(pts[1]);
1698
+ points[counter].style = 5;
1699
+ counter++;
1700
+
1701
+ pts[0].x = ptCenter.x - dDeltaX2 * iRadius;
1702
+ pts[0].y = ptCenter.y - dDeltaY2 * iRadius;
1703
+ pts[1].x = (ptCenter.x + pts[0].x) / 2;
1704
+ pts[1].y = (ptCenter.y + pts[0].y) / 2;
1705
+ d = lineutility.CalcDistanceDouble(pts[0], pts[1]);
1706
+ if (d > DISMSupport.maxLength * DPIScaleFactor) //shorten the spoke
1707
+ {
1708
+ pts[1] = lineutility.ExtendLineDouble(pts[1], pts[0], -DISMSupport.maxLength * DPIScaleFactor);
1709
+ }
1710
+
1711
+ points[counter] = new POINT2(pts[0]);
1712
+ points[counter].style = 0;
1713
+ counter++;
1714
+ points[counter] = new POINT2(pts[1]);
1715
+ points[counter].style = 5;
1716
+ counter++;
1717
+
1718
+ } catch (exc) {
1719
+ if (exc instanceof Error) {
1720
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMContainDouble",
1721
+ new RendererException("Failed inside GetDISMContainDouble", exc));
1722
+ } else {
1723
+ throw exc;
1724
+ }
1725
+ }
1726
+ return counter;
1727
+ }
1728
+ /**
1729
+ * Calculates the points for FIX, MNFLDFIX
1730
+ *
1731
+ * @param points OUT - the client points, also used for the returned points.
1732
+ * @param linetype the line type.
1733
+ */
1734
+ static GetDISMFixDouble(points: POINT2[], linetype: int, clipBounds: Rectangle2D | null): int {
1735
+ let counter: int = 0;
1736
+ try {
1737
+ let pts: POINT2[] = new Array<POINT2>(3);
1738
+ let savepoints: POINT2[] | null = new Array<POINT2>(2);
1739
+ let dAngle1: double = 0;
1740
+ let dLength: double = 0;
1741
+ let dJaggyHalfAmp: double = 0;
1742
+ let dJaggyHalfPeriod: double = 0;
1743
+ let dDeltaXOut: double = 0;
1744
+ let dDeltaYOut: double = 0;
1745
+ let dDeltaXAlong: double = 0;
1746
+ let dDeltaYAlong: double = 0;
1747
+ let iNumJaggies: int = 0;
1748
+ let i: int = 0;
1749
+ let j: int = 0;
1750
+
1751
+ for (j = 0; j < 2; j++) {
1752
+ savepoints[j] = new POINT2(points[j]);
1753
+ }
1754
+
1755
+ let drawJaggies: boolean = true;
1756
+ if (clipBounds != null) {
1757
+ let ul: POINT2 = new POINT2(clipBounds.getMinX(), clipBounds.getMinY());
1758
+ let lr: POINT2 = new POINT2(clipBounds.getMaxX(), clipBounds.getMaxY());
1759
+ savepoints = lineutility.BoundOneSegment(savepoints[0], savepoints[1], ul, lr);
1760
+ }
1761
+ if (savepoints == null) {
1762
+ savepoints = new Array<POINT2>(2);
1763
+ for (j = 0; j < 2; j++) {
1764
+ savepoints[j] = new POINT2(points[j]);
1765
+ }
1766
+ drawJaggies = false;
1767
+ }
1768
+
1769
+ lineutility.InitializePOINT2Array(pts);
1770
+ //reverse the points
1771
+
1772
+ dAngle1 = Math.atan2(savepoints[0].y - savepoints[1].y, savepoints[0].x - savepoints[1].x);
1773
+ dLength = Math.sqrt((savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
1774
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y));
1775
+ //arraysupport tries to set jaggylength before the points get bounded
1776
+ dJaggyHalfAmp = dLength / 15; // half the amplitude of the "jaggy function"
1777
+
1778
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
1779
+ if (dJaggyHalfAmp > DISMSupport.maxLength * DPIScaleFactor) {
1780
+ dJaggyHalfAmp = DISMSupport.maxLength * DPIScaleFactor;
1781
+ }
1782
+ if (dJaggyHalfAmp < DISMSupport.minLength * DPIScaleFactor) {
1783
+ dJaggyHalfAmp = DISMSupport.minLength * DPIScaleFactor;
1784
+ }
1785
+
1786
+ dJaggyHalfPeriod = dJaggyHalfAmp / 1.5; // half the period of the "jaggy function"
1787
+ dDeltaXOut = Math.cos(dAngle1 + DISMSupport.CONST_PI / 2) * dJaggyHalfAmp; // X-delta out from the center line
1788
+ dDeltaYOut = Math.sin(dAngle1 + DISMSupport.CONST_PI / 2) * dJaggyHalfAmp; // Y-delta out from the center line
1789
+ dDeltaXAlong = Math.cos(dAngle1) * dJaggyHalfPeriod; // X-delta along the center line
1790
+ dDeltaYAlong = Math.sin(dAngle1) * dJaggyHalfPeriod; // Y-delta along the center line
1791
+ iNumJaggies = Math.trunc(dLength / dJaggyHalfPeriod) - 3;
1792
+ i = 2;
1793
+ pts[0] = new POINT2(savepoints[1]);
1794
+ pts[1].x = savepoints[1].x + dDeltaXAlong * 1.5;
1795
+ pts[1].y = savepoints[1].y + dDeltaYAlong * 1.5;
1796
+ //DrawLine(destination, mask, color, pts, 2, 2);
1797
+ points[counter] = new POINT2(pts[0]);
1798
+ points[counter].style = 0;
1799
+ counter++;
1800
+ points[counter] = new POINT2(pts[1]);
1801
+ points[counter].style = 5;
1802
+ counter++;
1803
+
1804
+ pts[0].x = savepoints[1].x + dDeltaXOut + dDeltaXAlong * i;
1805
+ pts[0].y = savepoints[1].y + dDeltaYOut + dDeltaYAlong * i;
1806
+ i++;
1807
+ points[counter] = new POINT2(pts[0]);
1808
+ points[counter].style = 0;
1809
+ counter++;
1810
+ points[counter] = new POINT2(pts[1]);
1811
+ points[counter].style = 5;
1812
+ counter++;
1813
+
1814
+ if (drawJaggies) {
1815
+
1816
+ while (i <= iNumJaggies) {
1817
+ pts[1].x = savepoints[1].x - dDeltaXOut + dDeltaXAlong * i;
1818
+ pts[1].y = savepoints[1].y - dDeltaYOut + dDeltaYAlong * i;
1819
+ i++;
1820
+ pts[2].x = savepoints[1].x + dDeltaXOut + dDeltaXAlong * i;
1821
+ pts[2].y = savepoints[1].y + dDeltaYOut + dDeltaYAlong * i;
1822
+ i++;
1823
+ for (j = 0; j < 3; j++) {
1824
+ points[counter] = new POINT2(pts[j]);
1825
+ points[counter].style = 0;
1826
+ counter++;
1827
+ }
1828
+ points[counter - 1].style = 5;
1829
+ pts[0] = new POINT2(pts[2]);
1830
+ }
1831
+ }
1832
+
1833
+
1834
+ pts[1] = new POINT2(pts[0]);
1835
+ pts[0].x = savepoints[1].x + dDeltaXAlong * i;
1836
+ pts[0].y = savepoints[1].y + dDeltaYAlong * i;
1837
+ points[counter] = new POINT2(pts[0]);
1838
+ points[counter].style = 0;
1839
+ counter++;
1840
+ points[counter] = new POINT2(pts[1]);
1841
+ points[counter].style = 5;
1842
+ counter++;
1843
+
1844
+ pts[1] = new POINT2(savepoints[0]);
1845
+ //DrawLine(destination, mask, color, pts, 2, 2);
1846
+ points[counter] = new POINT2(pts[0]);
1847
+ points[counter].style = 0;
1848
+ counter++;
1849
+ points[counter] = new POINT2(pts[1]);
1850
+ points[counter].style = 5;
1851
+ counter++;
1852
+
1853
+ // draw arrowhead
1854
+ pts[0].x = savepoints[0].x + dDeltaXOut / 1.5 - dDeltaXAlong;
1855
+ pts[0].y = savepoints[0].y + dDeltaYOut / 1.5 - dDeltaYAlong;
1856
+ pts[2].x = savepoints[0].x - dDeltaXOut / 1.5 - dDeltaXAlong;
1857
+ pts[2].y = savepoints[0].y - dDeltaYOut / 1.5 - dDeltaYAlong;
1858
+ for (j = 0; j < 3; j++) {
1859
+ points[counter] = new POINT2(pts[j]);
1860
+ if (linetype === TacticalLines.MNFLDFIX) {
1861
+ points[counter].style = 9;
1862
+ } else {
1863
+ points[counter].style = 0;
1864
+ }
1865
+ counter++;
1866
+ }
1867
+ if (linetype === TacticalLines.MNFLDFIX) {
1868
+ points[counter - 1].style = 10;
1869
+ } else {
1870
+ points[counter - 1].style = 5;
1871
+ }
1872
+
1873
+ } catch (exc) {
1874
+ if (exc instanceof Error) {
1875
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMFixDouble",
1876
+ new RendererException("Failed inside GetDISMFixDouble", exc));
1877
+ } else {
1878
+ throw exc;
1879
+ }
1880
+ }
1881
+ return counter;
1882
+ }
1883
+ /**
1884
+ * Calculates the points for CLEAR.
1885
+ *
1886
+ * @param points OUT - the client points, also used for the returned points.
1887
+ * @param linetype the line type.
1888
+ */
1889
+ static GetDISMClearDouble(points: POINT2[], linetype: int): int {
1890
+ let counter: int = 0;
1891
+ try {
1892
+ let savepoints: POINT2[] = new Array<POINT2>(3);
1893
+ let j: int = 0;
1894
+ let pts: POINT2[] = new Array<POINT2>(2);
1895
+ let ptsArrow: POINT2[] = new Array<POINT2>(3);
1896
+ let ctrX: double = ((points[0].x + points[1].x) / 2);
1897
+ let ctrY: double = ((points[0].y + points[1].y) / 2);
1898
+ let iDeltaX1: ref<number[]> = new ref();
1899
+ let iDeltaY1: ref<number[]> = new ref();
1900
+ let iDeltaX2: ref<number[]> = new ref();
1901
+ let iDeltaY2: ref<number[]> = new ref();
1902
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
1903
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
1904
+ let deltapoints3: POINT2[] = new Array<POINT2>(4);
1905
+
1906
+ for (j = 0; j < 3; j++) {
1907
+ savepoints[j] = new POINT2(points[j]);
1908
+ }
1909
+
1910
+ lineutility.InitializePOINT2Array(pts);
1911
+ lineutility.InitializePOINT2Array(ptsArrow);
1912
+ lineutility.InitializePOINT2Array(deltapoints1);
1913
+ lineutility.InitializePOINT2Array(deltapoints2);
1914
+ lineutility.InitializePOINT2Array(deltapoints3);
1915
+
1916
+ //DrawLine(destination, mask, color, points, 2, 2);
1917
+ points[counter] = new POINT2(savepoints[0]);
1918
+ points[counter].style = 0;
1919
+ counter++;
1920
+ points[counter] = new POINT2(savepoints[1]);
1921
+ points[counter].style = 5;
1922
+ counter++;
1923
+
1924
+ pts[0].x = ctrX;
1925
+ pts[0].y = ctrY;
1926
+ pts[1] = new POINT2(savepoints[2]);
1927
+ ptsArrow[0] = new POINT2(pts[0]);
1928
+ //DrawLine(destination, mask, color, pts, 2, 2);
1929
+ points[counter] = new POINT2(pts[0]);
1930
+ points[counter].style = 0;
1931
+ counter++;
1932
+ points[counter] = new POINT2(pts[1]);
1933
+ points[counter].style = 5;
1934
+ counter++;
1935
+
1936
+ pts[0].x = (savepoints[0].x + ctrX) / 2;
1937
+ pts[0].y = (savepoints[0].y + ctrY) / 2;
1938
+ pts[1].x = savepoints[2].x + savepoints[0].x - pts[0].x;
1939
+ pts[1].y = savepoints[2].y + savepoints[0].y - pts[0].y;
1940
+ ptsArrow[1] = new POINT2(pts[0]);
1941
+ //DrawLine(destination, mask, color, pts, 2, 2);
1942
+ points[counter] = new POINT2(pts[0]);
1943
+ points[counter].style = 0;
1944
+ counter++;
1945
+ points[counter] = new POINT2(pts[1]);
1946
+ points[counter].style = 5;
1947
+ counter++;
1948
+
1949
+ pts[0].x = (savepoints[1].x + ctrX) / 2;
1950
+ pts[0].y = (savepoints[1].y + ctrY) / 2;
1951
+ pts[1].x = savepoints[2].x + savepoints[1].x - pts[0].x;
1952
+ pts[1].y = savepoints[2].y + savepoints[1].y - pts[0].y;
1953
+ ptsArrow[2] = new POINT2(pts[0]);
1954
+ points[counter] = new POINT2(pts[0]);
1955
+ points[counter].style = 0;
1956
+ counter++;
1957
+ points[counter] = new POINT2(pts[1]);
1958
+ points[counter].style = 5;
1959
+ counter++;
1960
+
1961
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX1, iDeltaY1, DISMSupport.CONST_PI / 6);
1962
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX2, iDeltaY2, -DISMSupport.CONST_PI / 6);
1963
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[0],
1964
+ iDeltaX1.value[0], iDeltaY1.value[0], iDeltaX2.value[0], iDeltaY2.value[0], deltapoints1);
1965
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[1],
1966
+ iDeltaX1.value[0], iDeltaY1.value[0], iDeltaX2.value[0], iDeltaY2.value[0], deltapoints2);
1967
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[2],
1968
+ iDeltaX1.value[0], iDeltaY1.value[0], iDeltaX2.value[0], iDeltaY2.value[0], deltapoints3);
1969
+ for (j = 0; j < 4; j++) {
1970
+ points[counter] = new POINT2(deltapoints1[j]);
1971
+ counter++;
1972
+ }
1973
+ for (j = 0; j < 4; j++) {
1974
+ points[counter] = new POINT2(deltapoints2[j]);
1975
+ counter++;
1976
+ }
1977
+ for (j = 0; j < 4; j++) {
1978
+ points[counter] = new POINT2(deltapoints3[j]);
1979
+ counter++;
1980
+ }
1981
+ } catch (exc) {
1982
+ if (exc instanceof Error) {
1983
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMClearDouble",
1984
+ new RendererException("Failed inside GetDISMClearDouble", exc));
1985
+ } else {
1986
+ throw exc;
1987
+ }
1988
+ }
1989
+ return counter;
1990
+ }
1991
+ private static IsSeizeArcReversed(pPoints: POINT2[]): boolean {
1992
+ try {
1993
+ let dAngle1: double = Math.atan2(pPoints[0].y - pPoints[1].y, pPoints[0].x - pPoints[1].x);
1994
+ let dDeltaX1: double = Math.cos(dAngle1 + DISMSupport.CONST_PI / 4);
1995
+ let dDeltaY1: double = Math.sin(dAngle1 + DISMSupport.CONST_PI / 4);
1996
+ let dDeltaX2: double = Math.cos(dAngle1 - DISMSupport.CONST_PI / 4);
1997
+ let dDeltaY2: double = Math.sin(dAngle1 - DISMSupport.CONST_PI / 4);
1998
+
1999
+ let dChordLength: double = Math.sqrt((pPoints[1].x - pPoints[0].x) * (pPoints[1].x - pPoints[0].x) +
2000
+ (pPoints[1].y - pPoints[0].y) * (pPoints[1].y - pPoints[0].y));
2001
+ let dArcRadius: double = dChordLength / 1.414213562373; // sqrt(2) == 1.414213562373
2002
+ let ptArcCenter: POINT2 = new POINT2();
2003
+
2004
+ //get the default center
2005
+ ptArcCenter.x = pPoints[0].x - dDeltaX1 * dArcRadius;
2006
+ ptArcCenter.y = pPoints[0].y - dDeltaY1 * dArcRadius;
2007
+ let d: double = lineutility.CalcDistanceDouble(ptArcCenter, pPoints[2]);
2008
+
2009
+ //get the alternate center if the arc is reversed
2010
+ let ptArcCenterReversed: POINT2 = new POINT2();
2011
+ ptArcCenterReversed.x = pPoints[0].x - dDeltaX2 * dArcRadius;
2012
+ ptArcCenterReversed.y = pPoints[0].y - dDeltaY2 * dArcRadius;
2013
+ let dReversed: double = lineutility.CalcDistanceDouble(ptArcCenterReversed, pPoints[2]);
2014
+
2015
+ if (dReversed > d) {
2016
+ return true;
2017
+ } else {
2018
+ return false;
2019
+ }
2020
+ } catch (exc) {
2021
+ if (exc instanceof Error) {
2022
+ ErrorLogger.LogException(DISMSupport._className, "IsSeizeArcReversed",
2023
+ new RendererException("Failed inside IsSeizeArcReversed", exc));
2024
+ } else {
2025
+ throw exc;
2026
+ }
2027
+ }
2028
+ return false;
2029
+ }
2030
+ /**
2031
+ * Calculates the points for SEIZE
2032
+ *
2033
+ * @param points OUT - the client points, also used for the returned points.
2034
+ * @param linetype the line type.
2035
+ */
2036
+ static GetDISMSeizeDouble(points: POINT2[],
2037
+ linetype: int,
2038
+ radius: double): int {
2039
+ let counter: int = 0;
2040
+ try {
2041
+ let ptArcCenter: POINT2 = new POINT2();
2042
+ let ptArcStart: POINT2 = new POINT2();
2043
+ let savepoints: POINT2[] = new Array<POINT2>(3);
2044
+ let scale: double = 0.9;
2045
+ let iCircleRadius: double = (25 * scale);
2046
+ let arcpoints: POINT2[] = new Array<POINT2>(17);
2047
+ let pts: POINT2[] = new Array<POINT2>(3);
2048
+ let dAngle1: double = 0;
2049
+ let dDeltaX1: double = 0;
2050
+ let dDeltaY1: double = 0;
2051
+ let dDeltaX2: double = 0;
2052
+ let dDeltaY2: double = 0;
2053
+ let dChordLength: double = 0;
2054
+ let dArcRadius: double = 0;
2055
+ let j: int = 0;
2056
+ let dDeltaX3: double = 0;
2057
+ let dDeltaY3: double = 0;
2058
+ let iDiagEOL_length: double = 0;
2059
+ let factor: double = 1;
2060
+
2061
+ if (radius > 0) {
2062
+
2063
+ iCircleRadius = radius;
2064
+ }
2065
+
2066
+
2067
+
2068
+ for (j = 0; j < 3; j++) {
2069
+ savepoints[j] = new POINT2(points[j]);
2070
+ }
2071
+
2072
+ //if radius is 0 then it is rev B
2073
+ let client: string = CELineArray.getClient();
2074
+ if (!client.startsWith("cpof") && radius === 0) {
2075
+ dArcRadius = lineutility.CalcDistanceDouble(savepoints[0], savepoints[1]);
2076
+ if (iCircleRadius > dArcRadius / 2) {
2077
+
2078
+ iCircleRadius = dArcRadius / 2;
2079
+ }
2080
+
2081
+ }
2082
+
2083
+ lineutility.InitializePOINT2Array(pts);
2084
+ lineutility.InitializePOINT2Array(arcpoints);
2085
+ // draw circle
2086
+ DISMSupport.ArcApproximationDouble(savepoints[0].x - iCircleRadius, savepoints[0].y - iCircleRadius,
2087
+ savepoints[0].x + iCircleRadius, savepoints[0].y + iCircleRadius,
2088
+ savepoints[0].x, savepoints[0].y, savepoints[0].x, savepoints[0].y, arcpoints);
2089
+ for (j = 0; j < 17; j++) {
2090
+ points[counter] = new POINT2(arcpoints[j]);
2091
+ points[counter].style = 0;
2092
+ counter++;
2093
+ }
2094
+ points[counter - 1].style = 5;
2095
+
2096
+ // draw arc
2097
+ dAngle1 = Math.atan2(savepoints[0].y - savepoints[1].y, savepoints[0].x - savepoints[1].x);
2098
+ dDeltaX1 = Math.cos(dAngle1 + DISMSupport.CONST_PI / 4);
2099
+ dDeltaY1 = Math.sin(dAngle1 + DISMSupport.CONST_PI / 4);
2100
+ dDeltaX2 = Math.cos(dAngle1 - DISMSupport.CONST_PI / 4);
2101
+ dDeltaY2 = Math.sin(dAngle1 - DISMSupport.CONST_PI / 4);
2102
+
2103
+ let isArcReversed: boolean = DISMSupport.IsSeizeArcReversed(savepoints);
2104
+
2105
+ if (isArcReversed === false) {
2106
+ ptArcStart.x = savepoints[0].x - dDeltaX2 * iCircleRadius;
2107
+ ptArcStart.y = savepoints[0].y - dDeltaY2 * iCircleRadius;
2108
+ dChordLength = Math.sqrt((savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
2109
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y));
2110
+ dArcRadius = dChordLength / 1.414213562373; // sqrt(2) == 1.414213562373
2111
+ ptArcCenter.x = savepoints[0].x - dDeltaX1 * dArcRadius;
2112
+ ptArcCenter.y = savepoints[0].y - dDeltaY1 * dArcRadius;
2113
+
2114
+ DISMSupport.ArcApproximationDouble((ptArcCenter.x - dArcRadius), (ptArcCenter.y - dArcRadius),
2115
+ (ptArcCenter.x + dArcRadius), (ptArcCenter.y + dArcRadius),
2116
+ savepoints[1].x, savepoints[1].y, ptArcStart.x, ptArcStart.y, arcpoints);
2117
+ } else //arc is reversed
2118
+ {
2119
+ ptArcStart.x = savepoints[0].x - dDeltaX1 * iCircleRadius;
2120
+ ptArcStart.y = savepoints[0].y - dDeltaY1 * iCircleRadius;
2121
+ dChordLength = Math.sqrt((savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
2122
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y));
2123
+ dArcRadius = dChordLength / 1.414213562373; // sqrt(2) == 1.414213562373
2124
+ ptArcCenter.x = savepoints[0].x - dDeltaX2 * dArcRadius;
2125
+ ptArcCenter.y = savepoints[0].y - dDeltaY2 * dArcRadius;
2126
+ DISMSupport.ArcApproximationDouble((ptArcCenter.x - dArcRadius), (ptArcCenter.y - dArcRadius),
2127
+ (ptArcCenter.x + dArcRadius), (ptArcCenter.y + dArcRadius),
2128
+ ptArcStart.x, ptArcStart.y, savepoints[1].x, savepoints[1].y, arcpoints);
2129
+ }
2130
+
2131
+ for (j = 0; j < 17; j++) {
2132
+ points[counter] = new POINT2(arcpoints[j]);
2133
+ points[counter].style = 0;
2134
+ counter++;
2135
+ }
2136
+ points[counter - 1].style = 5;
2137
+
2138
+ // draw arrow
2139
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2140
+ if (dChordLength / 8 > DISMSupport.maxLength * DPIScaleFactor) {
2141
+ factor = dChordLength / (8 * DISMSupport.maxLength * DPIScaleFactor);
2142
+ }
2143
+ if (factor === 0) {
2144
+ factor = 1;
2145
+ }
2146
+
2147
+
2148
+ if (isArcReversed === false) {
2149
+ pts[0].x = savepoints[1].x - (savepoints[1].x - savepoints[0].x) / (8 * factor);
2150
+ pts[0].y = savepoints[1].y - (savepoints[1].y - savepoints[0].y) / (8 * factor);
2151
+ pts[1] = new POINT2(savepoints[1]);
2152
+ dDeltaX3 = Math.cos(dAngle1 + DISMSupport.CONST_PI / 2);
2153
+ dDeltaY3 = Math.sin(dAngle1 + DISMSupport.CONST_PI / 2);
2154
+ iDiagEOL_length = (dChordLength / 8);
2155
+ pts[2].x = savepoints[1].x + dDeltaX3 * iDiagEOL_length / factor;
2156
+ pts[2].y = savepoints[1].y + dDeltaY3 * iDiagEOL_length / factor;
2157
+ } //DrawLine(destination, mask, color, pts, 3, 2);
2158
+ //diagnostic arc reversed
2159
+ else {
2160
+ pts[0].x = savepoints[1].x - (savepoints[1].x - savepoints[0].x) / (8 * factor);
2161
+ pts[0].y = savepoints[1].y - (savepoints[1].y - savepoints[0].y) / (8 * factor);
2162
+ pts[1] = new POINT2(savepoints[1]);
2163
+ dDeltaX3 = Math.cos(dAngle1 - DISMSupport.CONST_PI / 2);
2164
+ dDeltaY3 = Math.sin(dAngle1 - DISMSupport.CONST_PI / 2);
2165
+ iDiagEOL_length = (dChordLength / 8);
2166
+ pts[2].x = savepoints[1].x + dDeltaX3 * iDiagEOL_length / factor;
2167
+ pts[2].y = savepoints[1].y + dDeltaY3 * iDiagEOL_length / factor;
2168
+ }
2169
+ //end diagnostic
2170
+
2171
+
2172
+ //diagnostic
2173
+ //end diagnostic
2174
+
2175
+ for (j = 0; j < 3; j++) {
2176
+ points[counter] = new POINT2(pts[j]);
2177
+ points[counter].style = 0;
2178
+ counter++;
2179
+ }
2180
+ points[counter - 1].style = 5;
2181
+ } catch (exc) {
2182
+ if (exc instanceof Error) {
2183
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMSeizeDouble",
2184
+ new RendererException("Failed inside GetDISMSeizeDouble", exc));
2185
+ } else {
2186
+ throw exc;
2187
+ }
2188
+ }
2189
+ return counter;
2190
+ }
2191
+ /**
2192
+ * Used twice for RIP to determine if the points are clockwise.
2193
+ * @param x1
2194
+ * @param y1
2195
+ * @param x2
2196
+ * @param y2
2197
+ * @param px
2198
+ * @param py
2199
+ * @return RIGHT_SIDE if 3 points are clockwise
2200
+ */
2201
+ private static side(x1: double, y1: double, x2: double, y2: double, px: double, py: double): int {
2202
+ let dx1: double = 0;
2203
+ let dx2: double = 0;
2204
+ let dy1: double = 0;
2205
+ let dy2: double = 0;
2206
+ try {
2207
+ let o: double = 0;
2208
+
2209
+ dx1 = x2 - x1;
2210
+ dy1 = y2 - y1;
2211
+ dx2 = px - x1;
2212
+ dy2 = py - y1;
2213
+ o = (dx1 * dy2) - (dy1 * dx2);
2214
+ if (o > 0.0) {
2215
+ return (DISMSupport.LEFT_SIDE);
2216
+ }
2217
+ if (o < 0.0) {
2218
+ return (DISMSupport.RIGHT_SIDE);
2219
+ }
2220
+ } catch (exc) {
2221
+ if (exc instanceof Error) {
2222
+ ErrorLogger.LogException(DISMSupport._className, "side",
2223
+ new RendererException("Failed inside side", exc));
2224
+ } else {
2225
+ throw exc;
2226
+ }
2227
+ }
2228
+ return (DISMSupport.COLINEAR);
2229
+ }
2230
+
2231
+ /**
2232
+ * Calculates the points for RIP
2233
+ *
2234
+ * @param points OUT - the client points, also used for the returned points.
2235
+ * @param linetype the line type
2236
+ */
2237
+ static GetDISMRIPDouble(points: POINT2[], linetype: int): int {
2238
+ let counter: int = 0;
2239
+ try {
2240
+ // draw the straight lines
2241
+ let pts: POINT2[] = new Array<POINT2>(2);
2242
+ let savepoints: POINT2[] = new Array<POINT2>(4);
2243
+ let j: int = 0;
2244
+ let iLengthPt0Pt1: double = 0;
2245
+ let iDiagEOL_length: double = 0;
2246
+ let dAngle1: double = 0;
2247
+ let iDeltaX1: double = 0;
2248
+ let iDeltaY1: double = 0;
2249
+ let iDeltaX2: double = 0;
2250
+ let iDeltaY2: double = 0;
2251
+ let iLengthPt2Pt3: double = 0;
2252
+ let iRadius: double = 0;
2253
+ let deltapoints: POINT2[] = new Array<POINT2>(4);
2254
+ let arcpoints: POINT2[] = new Array<POINT2>(17);
2255
+ let ptArcCenter: POINT2 = new POINT2();
2256
+
2257
+ let clockwise: boolean = false;
2258
+ let side01: int = DISMSupport.side(points[0].x, points[0].y, points[1].x, points[1].y, points[2].x, points[2].y);
2259
+ let side12: int = DISMSupport.side(points[1].x, points[1].y, points[2].x, points[2].y, points[3].x, points[3].y);
2260
+ if (side01 === DISMSupport.RIGHT_SIDE && side12 === DISMSupport.RIGHT_SIDE) {
2261
+
2262
+ clockwise = true;
2263
+ }
2264
+
2265
+ else {
2266
+ if (side01 === DISMSupport.RIGHT_SIDE && side12 === DISMSupport.COLINEAR) {
2267
+
2268
+ clockwise = true;
2269
+ }
2270
+
2271
+ else {
2272
+ if (side01 === DISMSupport.COLINEAR && side12 === DISMSupport.RIGHT_SIDE) {
2273
+
2274
+ clockwise = true;
2275
+ }
2276
+
2277
+ }
2278
+
2279
+ }
2280
+
2281
+
2282
+ for (j = 0; j < 4; j++) {
2283
+ savepoints[j] = new POINT2(points[j]);
2284
+ }
2285
+
2286
+ lineutility.InitializePOINT2Array(pts);
2287
+ lineutility.InitializePOINT2Array(deltapoints);
2288
+ lineutility.InitializePOINT2Array(arcpoints);
2289
+
2290
+ points[counter] = new POINT2(savepoints[0]);
2291
+ points[counter].style = 0;
2292
+ counter++;
2293
+ points[counter] = new POINT2(savepoints[1]);
2294
+ points[counter].style = 5;
2295
+ counter++;
2296
+
2297
+ pts[0] = new POINT2(savepoints[2]);
2298
+ pts[1] = new POINT2(savepoints[3]);
2299
+ points[counter] = new POINT2(pts[0]);
2300
+ points[counter].style = 0;
2301
+ counter++;
2302
+ points[counter] = new POINT2(pts[1]);
2303
+ points[counter].style = 5;
2304
+ counter++;
2305
+
2306
+ // draw the arrowhead on line between savepoints 0 and 1
2307
+ pts[0] = new POINT2(savepoints[0]);
2308
+ pts[1] = new POINT2(savepoints[1]);
2309
+ iLengthPt0Pt1 = Math.sqrt((pts[1].x - pts[0].x) * (pts[1].x - pts[0].x) +
2310
+ (pts[1].y - pts[0].y) * (pts[1].y - pts[0].y));
2311
+ iDiagEOL_length = iLengthPt0Pt1 / 8;
2312
+
2313
+ //M. Deutch 8-19-04
2314
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2315
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
2316
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
2317
+ }
2318
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
2319
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
2320
+ }
2321
+
2322
+ dAngle1 = Math.atan2(pts[1].y - pts[0].y, pts[1].x - pts[0].x);
2323
+ iDeltaX1 = (iDiagEOL_length * Math.cos(dAngle1 - DISMSupport.CONST_PI / 4));
2324
+ iDeltaY1 = (iDiagEOL_length * Math.sin(dAngle1 - DISMSupport.CONST_PI / 4));
2325
+ iDeltaX2 = (iDiagEOL_length * Math.cos(dAngle1 + DISMSupport.CONST_PI / 4));
2326
+ iDeltaY2 = (iDiagEOL_length * Math.sin(dAngle1 + DISMSupport.CONST_PI / 4));
2327
+ DISMSupport.DrawEndpieceDeltasDouble(pts[0],
2328
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints);
2329
+ for (j = 0; j < 4; j++) {
2330
+ points[counter] = new POINT2(deltapoints[j]);
2331
+ points[counter].style = 0;
2332
+ counter++;
2333
+ }
2334
+ points[counter - 3].style = 5;
2335
+ points[counter - 1].style = 5;
2336
+ // draw the arrowhead on line between savepoints 2 and 3
2337
+ pts[0] = new POINT2(savepoints[2]);
2338
+ pts[1] = new POINT2(savepoints[3]);
2339
+ iLengthPt2Pt3 = Math.sqrt((pts[1].x - pts[0].x) * (pts[1].x - pts[0].x) +
2340
+ (pts[1].y - pts[0].y) * (pts[1].y - pts[0].y));
2341
+ iDiagEOL_length = iLengthPt2Pt3 / 8;
2342
+
2343
+ //M. Deutch 8-19-04
2344
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
2345
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
2346
+ }
2347
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
2348
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
2349
+ }
2350
+
2351
+ dAngle1 = Math.atan2(pts[1].y - pts[0].y, pts[1].x - pts[0].x);
2352
+ iDeltaX1 = (iDiagEOL_length * Math.cos(dAngle1 - DISMSupport.CONST_PI / 4));
2353
+ iDeltaY1 = (iDiagEOL_length * Math.sin(dAngle1 - DISMSupport.CONST_PI / 4));
2354
+ iDeltaX2 = (iDiagEOL_length * Math.cos(dAngle1 + DISMSupport.CONST_PI / 4));
2355
+ iDeltaY2 = (iDiagEOL_length * Math.sin(dAngle1 + DISMSupport.CONST_PI / 4));
2356
+ DISMSupport.DrawEndpieceDeltasDouble(pts[0],
2357
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints);
2358
+ for (j = 0; j < 4; j++) {
2359
+ points[counter] = new POINT2(deltapoints[j]);
2360
+ points[counter].style = 0;
2361
+ counter++;
2362
+ }
2363
+ points[counter - 3].style = 5;
2364
+ points[counter - 1].style = 5;
2365
+
2366
+ // draw the semicircle
2367
+ iRadius = (Math.sqrt((savepoints[2].x - savepoints[1].x) * (savepoints[2].x - savepoints[1].x) +
2368
+ (savepoints[2].y - savepoints[1].y) * (savepoints[2].y - savepoints[1].y)) / 2);
2369
+ ptArcCenter.x = (savepoints[1].x + savepoints[2].x) / 2;
2370
+ ptArcCenter.y = (savepoints[1].y + savepoints[2].y) / 2;
2371
+
2372
+ if (clockwise === false) {
2373
+ DISMSupport.ArcApproximationDouble((ptArcCenter.x - iRadius), (ptArcCenter.y - iRadius),
2374
+ (ptArcCenter.x + iRadius), (ptArcCenter.y + iRadius),
2375
+ savepoints[2].x, savepoints[2].y, savepoints[1].x, savepoints[1].y, arcpoints);
2376
+ }
2377
+ else {
2378
+ DISMSupport.ArcApproximationDouble((ptArcCenter.x - iRadius), (ptArcCenter.y - iRadius),
2379
+ (ptArcCenter.x + iRadius), (ptArcCenter.y + iRadius),
2380
+ savepoints[1].x, savepoints[1].y, savepoints[2].x, savepoints[2].y, arcpoints);
2381
+ }
2382
+ for (j = 0; j < 17; j++) {
2383
+ points[counter] = new POINT2(arcpoints[j]);
2384
+ points[counter].style = 0;
2385
+ counter++;
2386
+ }
2387
+ points[counter - 1].style = 5;
2388
+ } catch (exc) {
2389
+ if (exc instanceof Error) {
2390
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMRIPDouble",
2391
+ new RendererException("Failed inside GetDISMRIPDouble", exc));
2392
+ } else {
2393
+ throw exc;
2394
+ }
2395
+ }
2396
+ return counter;
2397
+ }
2398
+ /**
2399
+ * Calculates the points for BYDIF
2400
+ *
2401
+ * @param points OUT - the client points, also used for the returned points.
2402
+ * @param linetype the line type.
2403
+ */
2404
+ static GetDISMByDifDouble(points: POINT2[],
2405
+ linetype: int,
2406
+ clipBounds: Rectangle2D | null): int {
2407
+ let counter: int = 0;
2408
+ try {
2409
+ let pointsCorner: POINT2[] = new Array<POINT2>(2);
2410
+ let rectpts: POINT2[] = new Array<POINT2>(4);
2411
+ let savepoints: POINT2[] = new Array<POINT2>(3);
2412
+ let savepoints2: POINT2[] | null = new Array<POINT2>(2);
2413
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
2414
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
2415
+ let pts: POINT2[] = new Array<POINT2>(3);
2416
+ //POINT2 pt0 = new POINT2();
2417
+ //POINT2 pt1 = new POINT2();
2418
+ let iDeltaX: ref<number[]> = new ref();
2419
+ let iDeltaY: ref<number[]> = new ref();
2420
+ let bPointsRight: int = 0;
2421
+ let dAngle1: double = 0;
2422
+ let dLength: double = 0;
2423
+ let dJaggyHalfAmp: double = 0;
2424
+ let dJaggyHalfPeriod: double = 0;
2425
+ let dDeltaXOut: double = 0;
2426
+ let dDeltaYOut: double = 0;
2427
+ let dDeltaXAlong: double = 0;
2428
+ let dDeltaYAlong: double = 0;
2429
+ let iNumJaggies: int = 0;
2430
+ let i: int = 0;
2431
+ let j: int = 0;
2432
+ //int pointcounter = 0;
2433
+ //int[] segments = null;
2434
+ //end declarations
2435
+ //lineutility.WriteFile("made it this far");
2436
+ //ok to here
2437
+
2438
+ for (j = 0; j < 3; j++) {
2439
+ savepoints[j] = new POINT2(points[j]);
2440
+ }
2441
+
2442
+ lineutility.InitializePOINT2Array(pointsCorner);
2443
+ lineutility.InitializePOINT2Array(rectpts);
2444
+ lineutility.InitializePOINT2Array(pts);
2445
+ lineutility.InitializePOINT2Array(deltapoints1);
2446
+ lineutility.InitializePOINT2Array(deltapoints2);
2447
+
2448
+ DISMSupport.DrawOpenRectangleDouble(savepoints, pointsCorner, rectpts);
2449
+ //save the back side for use by the jagged line
2450
+ savepoints2[0] = new POINT2(rectpts[1]);
2451
+ savepoints2[1] = new POINT2(rectpts[2]);
2452
+
2453
+ //diagnostic these hard coded because JavalineArray does not know the bounds
2454
+ if (clipBounds != null) {
2455
+ let ul: POINT2 = new POINT2(clipBounds.getMinX(), clipBounds.getMinY());
2456
+ let lr: POINT2 = new POINT2(clipBounds.getMaxX(), clipBounds.getMaxY());
2457
+ savepoints2 = lineutility.BoundOneSegment(savepoints2[0], savepoints2[1], ul, lr);
2458
+ }
2459
+ let drawJaggies: boolean = true;
2460
+ if (savepoints2 == null) {
2461
+ savepoints2 = new Array<POINT2>(2);
2462
+ savepoints2[0] = new POINT2(rectpts[1]);
2463
+ savepoints2[1] = new POINT2(rectpts[2]);
2464
+ drawJaggies = false;
2465
+ }
2466
+ for (j = 0; j < 4; j++) {
2467
+ points[counter] = new POINT2(rectpts[j]);
2468
+ points[counter].style = 0;
2469
+ counter++;
2470
+ }
2471
+ points[1].style = 5;
2472
+ points[counter - 1].style = 5;
2473
+
2474
+ dAngle1 = Math.atan2(savepoints2[0].y - savepoints2[1].y, savepoints2[0].x - savepoints2[1].x);
2475
+ dLength = Math.sqrt((savepoints2[1].x - savepoints2[0].x) * (savepoints2[1].x - savepoints2[0].x) +
2476
+ (savepoints2[1].y - savepoints2[0].y) * (savepoints2[1].y - savepoints2[0].y));
2477
+ dJaggyHalfAmp = dLength / 15; // half the amplitude of the "jaggy function"
2478
+
2479
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2480
+ if (dJaggyHalfAmp > DISMSupport.maxLength * DPIScaleFactor) {
2481
+ dJaggyHalfAmp = DISMSupport.maxLength * DPIScaleFactor;
2482
+ }
2483
+ if (dJaggyHalfAmp < DISMSupport.minLength * DPIScaleFactor) {
2484
+ dJaggyHalfAmp = DISMSupport.minLength * DPIScaleFactor;
2485
+ }
2486
+
2487
+ dJaggyHalfPeriod = dJaggyHalfAmp / 1.5; // half the period of the "jaggy function"
2488
+ dDeltaXOut = Math.cos(dAngle1 + DISMSupport.CONST_PI / 2) * dJaggyHalfAmp; // X-delta out from the center line
2489
+ dDeltaYOut = Math.sin(dAngle1 + DISMSupport.CONST_PI / 2) * dJaggyHalfAmp; // Y-delta out from the center line
2490
+ dDeltaXAlong = Math.cos(dAngle1) * dJaggyHalfPeriod; // X-delta along the center line
2491
+ dDeltaYAlong = Math.sin(dAngle1) * dJaggyHalfPeriod; // Y-delta along the center line
2492
+
2493
+ iNumJaggies = Math.trunc(dLength / dJaggyHalfPeriod) - 3;
2494
+ i = 2;
2495
+ pts[0] = new POINT2(savepoints2[1]);
2496
+ pts[1].x = savepoints2[1].x + dDeltaXAlong * 1.5;
2497
+ pts[1].y = savepoints2[1].y + dDeltaYAlong * 1.5;
2498
+ points[counter] = new POINT2(pts[0]);
2499
+ points[counter].style = 0;
2500
+ counter++;
2501
+ points[counter] = new POINT2(pts[1]);
2502
+ points[counter].style = 5;
2503
+ counter++;
2504
+
2505
+ pts[0].x = savepoints2[1].x + dDeltaXOut + dDeltaXAlong * i;
2506
+ pts[0].y = savepoints2[1].y + dDeltaYOut + dDeltaYAlong * i;
2507
+ i++;
2508
+ points[counter] = new POINT2(pts[0]);
2509
+ points[counter].style = 0;
2510
+ counter++;
2511
+ points[counter] = new POINT2(pts[1]);
2512
+ points[counter].style = 5;
2513
+ counter++;
2514
+
2515
+ if (drawJaggies) {
2516
+ //diagnostic
2517
+ while (i <= iNumJaggies) {
2518
+ pts[1].x = savepoints2[1].x - dDeltaXOut + dDeltaXAlong * i;
2519
+ pts[1].y = savepoints2[1].y - dDeltaYOut + dDeltaYAlong * i;
2520
+ i++;
2521
+ pts[2].x = savepoints2[1].x + dDeltaXOut + dDeltaXAlong * i;
2522
+ pts[2].y = savepoints2[1].y + dDeltaYOut + dDeltaYAlong * i;
2523
+ i++;
2524
+ for (j = 0; j < 3; j++) {
2525
+ points[counter] = new POINT2(pts[j]);
2526
+ points[counter].style = 0;
2527
+ counter++;
2528
+ }
2529
+ points[counter - 1].style = 5;
2530
+ pts[0] = new POINT2(pts[2]);
2531
+ }
2532
+ }
2533
+
2534
+
2535
+
2536
+ pts[1] = new POINT2(pts[0]);
2537
+ pts[0].x = savepoints2[1].x + dDeltaXAlong * i;
2538
+ pts[0].y = savepoints2[1].y + dDeltaYAlong * i;
2539
+ //DrawLine(destination, mask, color, pts, 2, 2);
2540
+ points[counter] = new POINT2(pts[0]);
2541
+ points[counter].style = 0;
2542
+ counter++;
2543
+ points[counter] = new POINT2(pts[1]);
2544
+ points[counter].style = 5;
2545
+ counter++;
2546
+
2547
+ pts[1] = new POINT2(savepoints2[0]);
2548
+ //DrawLine(destination, mask, color, pts, 2, 2);
2549
+ points[counter] = new POINT2(pts[0]);
2550
+ points[counter].style = 0;
2551
+ counter++;
2552
+ points[counter] = new POINT2(pts[1]);
2553
+ points[counter].style = 5;
2554
+ counter++;
2555
+
2556
+ bPointsRight = DISMSupport.DetermineDirectionDouble(savepoints);
2557
+
2558
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX, iDeltaY, DISMSupport.CONST_PI / 4);
2559
+
2560
+ if ((savepoints[0].y - savepoints[1].y) < 0) {// Point0 is higher than Point1
2561
+ if (bPointsRight !== 0) {// figure opens to the right
2562
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2563
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
2564
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2565
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
2566
+ } else {// figure opens to the left
2567
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2568
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
2569
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2570
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
2571
+ }
2572
+ } else {// Point0 is lower than Point1
2573
+ if (bPointsRight !== 0) {// figure opens to the right
2574
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2575
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
2576
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2577
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
2578
+ } else {// figure opens to the left
2579
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2580
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
2581
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2582
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
2583
+ }
2584
+ }
2585
+ points[counter] = new POINT2(deltapoints1[1]);
2586
+ points[counter].style = 9;
2587
+ counter++;
2588
+ points[counter] = new POINT2(deltapoints1[0]);
2589
+ points[counter].style = 9;
2590
+ counter++;
2591
+ points[counter] = new POINT2(deltapoints1[3]);
2592
+ points[counter].style = 9;
2593
+ counter++;
2594
+ points[counter] = new POINT2(deltapoints1[3]);
2595
+ points[counter].style = 10;
2596
+ counter++;
2597
+
2598
+ points[counter] = new POINT2(deltapoints2[1]);
2599
+ points[counter].style = 9;
2600
+ counter++;
2601
+ points[counter] = new POINT2(deltapoints2[0]);
2602
+ points[counter].style = 9;
2603
+ counter++;
2604
+ points[counter] = new POINT2(deltapoints2[3]);
2605
+ points[counter].style = 9;
2606
+ counter++;
2607
+ points[counter] = new POINT2(deltapoints2[3]);
2608
+ points[counter].style = 10;
2609
+ counter++;
2610
+
2611
+ } catch (exc) {
2612
+ if (exc instanceof Error) {
2613
+ //lineutility.WriteFile(exc.message);
2614
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMByDifDouble",
2615
+ new RendererException("Failed inside GetDISMByDifDouble", exc));
2616
+ } else {
2617
+ throw exc;
2618
+ }
2619
+ }
2620
+ return counter;
2621
+ }
2622
+ /**
2623
+ * Calculates the points for PENETRATE
2624
+ *
2625
+ * @param points OUT - the client points, also used for the returned points.
2626
+ * @param linetype the line type.
2627
+ */
2628
+ static GetDISMPenetrateDouble(points: POINT2[], linetype: int): void {
2629
+ try {
2630
+ let arrowpts: POINT2[] = new Array<POINT2>(3);
2631
+ let midpt: POINT2 = new POINT2();
2632
+ let savepoints: POINT2[] = new Array<POINT2>(3);
2633
+ let j: int = 0;
2634
+ let d: double = 0;
2635
+
2636
+ for (j = 0; j < 3; j++) {
2637
+ savepoints[j] = new POINT2(points[j]);
2638
+ }
2639
+ lineutility.InitializePOINT2Array(arrowpts);
2640
+
2641
+ points[0].x = savepoints[0].x;
2642
+ points[0].y = savepoints[0].y;
2643
+ points[0].style = 0;
2644
+ points[1].x = savepoints[1].x;
2645
+ points[1].y = savepoints[1].y;
2646
+ points[1].style = 5;
2647
+
2648
+ midpt = lineutility.MidPointDouble(savepoints[0], savepoints[1], 0);
2649
+
2650
+ points[2] = new POINT2(savepoints[2]);
2651
+
2652
+ points[3] = new POINT2(midpt);
2653
+ points[3].style = 5;
2654
+ d = lineutility.MBRDistance(savepoints, 3);
2655
+
2656
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2657
+ if (d / 5 > DISMSupport.maxLength * DPIScaleFactor) {
2658
+ d = 5 * DISMSupport.maxLength * DPIScaleFactor;
2659
+ }
2660
+ if (d / 5 < DISMSupport.minLength * DPIScaleFactor) {
2661
+ d = 5 * DISMSupport.minLength * DPIScaleFactor;
2662
+ }
2663
+ let client: string = CELineArray.getClient();
2664
+ if (client === "cpof3d" || client === "cpof2d") {
2665
+ if (d < 400 * DPIScaleFactor) {
2666
+
2667
+ d = 400 * DPIScaleFactor;
2668
+ }
2669
+
2670
+ }
2671
+ else {
2672
+ if (d < 150 * DPIScaleFactor) {
2673
+
2674
+ d = 150 * DPIScaleFactor;
2675
+ }
2676
+
2677
+ }
2678
+ if (d > 600 * DPIScaleFactor) {
2679
+
2680
+ d = 600 * DPIScaleFactor;
2681
+ }
2682
+
2683
+
2684
+ lineutility.GetArrowHead4Double(points[2], points[3], Math.trunc(d / 20), Math.trunc(d / 20), arrowpts, 0);
2685
+ for (j = 0; j < 3; j++) {
2686
+ points[4 + j] = new POINT2(arrowpts[j]);
2687
+ }
2688
+
2689
+ } catch (exc) {
2690
+ if (exc instanceof Error) {
2691
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMPenetrateDouble",
2692
+ new RendererException("Failed inside GetDISMPenetrateDouble", exc));
2693
+ } else {
2694
+ throw exc;
2695
+ }
2696
+ }
2697
+ }
2698
+ /**
2699
+ * Calculates the points for BYIMP
2700
+ *
2701
+ * @param points OUT - the client points, also used for the returned points.
2702
+ * @param linetype the line type.
2703
+ */
2704
+ static GetDISMByImpDouble(points: POINT2[],
2705
+ linetype: int): int {
2706
+ let counter: int = 0;
2707
+ try {
2708
+ let j: int = 0;
2709
+ let pointsCorner: POINT2[] = new Array<POINT2>(2);
2710
+ let rectpts: POINT2[] = new Array<POINT2>(4);
2711
+ let savepoints: POINT2[] = new Array<POINT2>(3);
2712
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
2713
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
2714
+ let midpt: POINT2 = new POINT2();
2715
+ let pts: POINT2[] = new Array<POINT2>(6);
2716
+ let ptRelative: POINT2 = new POINT2();
2717
+ let iDeltaX: ref<number[]> = new ref();
2718
+ let iDeltaY: ref<number[]> = new ref();
2719
+ let bPointsRight: int = 0;
2720
+ let dMBR: double = lineutility.MBRDistance(points, 3);
2721
+ //end declarations
2722
+
2723
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2724
+ if (dMBR > 40 * DISMSupport.maxLength * DPIScaleFactor) {
2725
+ dMBR = 40 * DISMSupport.maxLength * DPIScaleFactor;
2726
+ }
2727
+ if (dMBR < 5 * DISMSupport.minLength * DPIScaleFactor) {
2728
+ dMBR = 5 * DISMSupport.minLength * DPIScaleFactor;
2729
+ }
2730
+ if (dMBR > 250 * DPIScaleFactor) {
2731
+
2732
+ dMBR = 250 * DPIScaleFactor;
2733
+ }
2734
+
2735
+ if (dMBR / 15 > lineutility.CalcDistanceDouble(points[0], points[1])) {
2736
+
2737
+ // Don't let gap be wider than channel
2738
+ dMBR = 15 * lineutility.CalcDistanceDouble(points[0], points[1]);
2739
+ }
2740
+
2741
+
2742
+ for (j = 0; j < 3; j++) {
2743
+ savepoints[j] = new POINT2(points[j]);
2744
+ }
2745
+
2746
+ lineutility.InitializePOINT2Array(rectpts);
2747
+ lineutility.InitializePOINT2Array(deltapoints1);
2748
+ lineutility.InitializePOINT2Array(deltapoints2);
2749
+ lineutility.InitializePOINT2Array(pts);
2750
+ lineutility.InitializePOINT2Array(pointsCorner);
2751
+
2752
+ DISMSupport.DrawOpenRectangleDouble(savepoints, pointsCorner, rectpts);
2753
+
2754
+ points[counter] = new POINT2(rectpts[0]);
2755
+ points[counter].style = 0;
2756
+ counter++;
2757
+ points[counter] = new POINT2(rectpts[1]);
2758
+ points[counter].style = 0;
2759
+ counter++;
2760
+ midpt = lineutility.MidPointDouble(rectpts[1], rectpts[2], 0);
2761
+ pts[0] = lineutility.ExtendLine2Double(rectpts[1], midpt, -dMBR / 30, 5);
2762
+ pts[1] = lineutility.ExtendLine2Double(rectpts[1], midpt, dMBR / 30, 5);
2763
+ points[counter] = new POINT2(pts[0]);
2764
+ points[counter].style = 5;
2765
+ counter++;
2766
+
2767
+ ptRelative = lineutility.PointRelativeToLine(rectpts[0], rectpts[1], pts[0]);
2768
+ pts[2] = lineutility.ExtendLineDouble(ptRelative, pts[0], -dMBR / 30);
2769
+
2770
+ pts[3] = lineutility.ExtendLineDouble(ptRelative, pts[0], dMBR / 30);
2771
+
2772
+ points[counter] = new POINT2(pts[2]);
2773
+ points[counter].style = 0;
2774
+ counter++;
2775
+ points[counter] = new POINT2(pts[3]);
2776
+ points[counter].style = 5;
2777
+ counter++;
2778
+ ptRelative = lineutility.PointRelativeToLine(rectpts[2], rectpts[3], pts[1]);
2779
+ pts[4] = lineutility.ExtendLineDouble(ptRelative, pts[1], -dMBR / 30);
2780
+
2781
+ pts[5] = lineutility.ExtendLineDouble(ptRelative, pts[1], dMBR / 30);
2782
+ points[counter] = new POINT2(pts[4]);
2783
+ points[counter].style = 0;
2784
+ counter++;
2785
+ points[counter] = new POINT2(pts[5]);
2786
+ points[counter].style = 5;
2787
+ counter++;
2788
+ points[counter] = new POINT2(pts[1]);
2789
+ points[counter].style = 0;
2790
+ counter++;
2791
+ points[counter] = new POINT2(rectpts[2]);
2792
+ points[counter].style = 0;
2793
+ counter++;
2794
+ points[counter] = new POINT2(rectpts[3]);
2795
+ points[counter].style = 5;
2796
+ counter++;
2797
+
2798
+ bPointsRight = DISMSupport.DetermineDirectionDouble(savepoints);
2799
+
2800
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX, iDeltaY, DISMSupport.CONST_PI / 4);
2801
+
2802
+ if ((savepoints[0].y - savepoints[1].y) < 0) {// Point0 is higher than Point1
2803
+ if (bPointsRight !== 0) {// figure opens to the right
2804
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2805
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
2806
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2807
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
2808
+ } else {// figure opens to the left
2809
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2810
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
2811
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2812
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
2813
+ }
2814
+ } else {// Point0 is lower than Point1
2815
+ if (bPointsRight !== 0) {// figure opens to the right
2816
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2817
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
2818
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2819
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
2820
+ } else {// figure opens to the left
2821
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
2822
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
2823
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
2824
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
2825
+ }
2826
+ }
2827
+
2828
+ points[counter] = new POINT2(deltapoints1[1]);
2829
+ points[counter].style = 9;
2830
+ counter++;
2831
+ points[counter] = new POINT2(deltapoints1[0]);
2832
+ points[counter].style = 9;
2833
+ counter++;
2834
+ points[counter] = new POINT2(deltapoints1[3]);
2835
+ points[counter].style = 9;
2836
+ counter++;
2837
+ points[counter] = new POINT2(deltapoints1[3]);
2838
+ points[counter].style = 10;
2839
+ counter++;
2840
+
2841
+ points[counter] = new POINT2(deltapoints2[1]);
2842
+ points[counter].style = 9;
2843
+ counter++;
2844
+ points[counter] = new POINT2(deltapoints2[0]);
2845
+ points[counter].style = 9;
2846
+ counter++;
2847
+ points[counter] = new POINT2(deltapoints2[3]);
2848
+ points[counter].style = 9;
2849
+ counter++;
2850
+ points[counter] = new POINT2(deltapoints2[3]);
2851
+ points[counter].style = 10;
2852
+ counter++;
2853
+
2854
+ } catch (exc) {
2855
+ if (exc instanceof Error) {
2856
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMByImpDouble",
2857
+ new RendererException("Failed inside GetDISMByImpDouble", exc));
2858
+ } else {
2859
+ throw exc;
2860
+ }
2861
+ }
2862
+ return counter;
2863
+ }
2864
+ /**
2865
+ * Calculates the points for SPTBYFIRE
2866
+ *
2867
+ * @param points OUT - the client points, also used for the returned points.
2868
+ * @param linetype the line type.
2869
+ */
2870
+ static GetDISMSupportByFireDouble(points: POINT2[],
2871
+ linetype: int): int {
2872
+ let counter: int = 0;
2873
+ try {
2874
+ let pts: POINT2[] = new Array<POINT2>(3);
2875
+ let savepoints: POINT2[] = new Array<POINT2>(4);
2876
+ let j: int = 0;
2877
+ let iDiagEOL_length: double = 0;
2878
+ let dAngle1: double = 0;
2879
+ let iDeltaX1: double = 0;
2880
+ let iDeltaY1: double = 0;
2881
+ let iDeltaX2: double = 0;
2882
+ let iDeltaY2: double = 0;
2883
+
2884
+ for (j = 0; j < 4; j++) {
2885
+ savepoints[j] = new POINT2(points[j]);
2886
+ }
2887
+ DISMSupport.ReorderSptByFirePoints(savepoints);
2888
+
2889
+ lineutility.InitializePOINT2Array(pts);
2890
+ // draw line connecting points 1 & 2
2891
+ points[counter] = new POINT2(savepoints[0]);
2892
+ points[counter].style = 0;
2893
+ counter++;
2894
+ points[counter] = new POINT2(savepoints[1]);
2895
+ points[counter].style = 5;
2896
+ counter++;
2897
+
2898
+ // draw line connecting savepoints 1 & 3
2899
+ pts[0] = new POINT2(savepoints[0]);
2900
+ pts[1] = new POINT2(savepoints[2]);
2901
+ points[counter] = new POINT2(pts[0]);
2902
+ points[counter].style = 0;
2903
+ counter++;
2904
+ points[counter] = new POINT2(pts[1]);
2905
+ points[counter].style = 5;
2906
+ counter++;
2907
+
2908
+ // draw arrow at end of line
2909
+ iDiagEOL_length = (Math.sqrt(
2910
+ (savepoints[0].x - savepoints[1].x) * (savepoints[0].x - savepoints[1].x) +
2911
+ (savepoints[0].y - savepoints[1].y) * (savepoints[0].y - savepoints[1].y)) / 10);
2912
+
2913
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2914
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
2915
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
2916
+ }
2917
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
2918
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
2919
+ }
2920
+
2921
+ dAngle1 = Math.atan2(savepoints[0].y - savepoints[2].y, savepoints[0].x - savepoints[2].x);
2922
+ iDeltaX1 = (Math.cos(dAngle1 + DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2923
+ iDeltaY1 = (Math.sin(dAngle1 + DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2924
+ iDeltaX2 = (Math.cos(dAngle1 - DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2925
+ iDeltaY2 = (Math.sin(dAngle1 - DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2926
+ pts[0].x = savepoints[2].x + iDeltaX1;
2927
+ pts[0].y = savepoints[2].y + iDeltaY1;
2928
+ pts[1] = new POINT2(savepoints[2]);
2929
+ pts[2].x = savepoints[2].x + iDeltaX2;
2930
+ pts[2].y = savepoints[2].y + iDeltaY2;
2931
+ //DrawLine(destination, mask, color, pts, 3, 2);
2932
+ for (j = 0; j < 3; j++) {
2933
+ points[counter] = new POINT2(pts[j]);
2934
+ points[counter].style = 0;
2935
+ counter++;
2936
+ }
2937
+ points[counter - 1].style = 5;
2938
+
2939
+ // draw line connecting savepoints 2 & 4
2940
+ pts[0] = new POINT2(savepoints[1]);
2941
+ pts[1] = new POINT2(savepoints[3]);
2942
+ points[counter] = new POINT2(pts[0]);
2943
+ points[counter].style = 0;
2944
+ counter++;
2945
+ points[counter] = new POINT2(pts[1]);
2946
+ points[counter].style = 5;
2947
+ counter++;
2948
+
2949
+ // draw arrow at end of line
2950
+ dAngle1 = Math.atan2(savepoints[1].y - savepoints[3].y, savepoints[1].x - savepoints[3].x);
2951
+ iDeltaX1 = (Math.cos(dAngle1 + DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2952
+ iDeltaY1 = (Math.sin(dAngle1 + DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2953
+ iDeltaX2 = (Math.cos(dAngle1 - DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2954
+ iDeltaY2 = (Math.sin(dAngle1 - DISMSupport.CONST_PI / 6) * iDiagEOL_length);
2955
+ pts[0].x = savepoints[3].x + iDeltaX1;
2956
+ pts[0].y = savepoints[3].y + iDeltaY1;
2957
+ pts[1] = new POINT2(savepoints[3]);
2958
+ pts[2].x = savepoints[3].x + iDeltaX2;
2959
+ pts[2].y = savepoints[3].y + iDeltaY2;
2960
+ //DrawLine(destination, mask, color, pts, 3, 2);
2961
+ for (j = 0; j < 3; j++) {
2962
+ points[counter] = new POINT2(pts[j]);
2963
+ points[counter].style = 0;
2964
+ counter++;
2965
+ }
2966
+ points[counter - 1].style = 5;
2967
+
2968
+ // draw lines on the back of the graphic
2969
+ dAngle1 = Math.atan2(savepoints[1].y - savepoints[0].y, savepoints[1].x - savepoints[0].x);
2970
+ iDiagEOL_length *= 2;
2971
+ iDeltaX1 = (Math.cos(dAngle1 - DISMSupport.CONST_PI / 4) * iDiagEOL_length);
2972
+ iDeltaY1 = (Math.sin(dAngle1 - DISMSupport.CONST_PI / 4) * iDiagEOL_length);
2973
+ iDeltaX2 = (Math.cos(dAngle1 + DISMSupport.CONST_PI / 4) * iDiagEOL_length);
2974
+ iDeltaY2 = (Math.sin(dAngle1 + DISMSupport.CONST_PI / 4) * iDiagEOL_length);
2975
+ pts[0].x = savepoints[0].x - iDeltaX1;
2976
+ pts[0].y = savepoints[0].y - iDeltaY1;
2977
+ pts[1] = new POINT2(savepoints[0]);
2978
+ points[counter] = new POINT2(pts[0]);
2979
+ points[counter].style = 0;
2980
+ counter++;
2981
+ points[counter] = new POINT2(pts[1]);
2982
+ points[counter].style = 5;
2983
+ counter++;
2984
+
2985
+ pts[0].x = savepoints[1].x + iDeltaX2;
2986
+ pts[0].y = savepoints[1].y + iDeltaY2;
2987
+ pts[1] = new POINT2(savepoints[1]);
2988
+ points[counter] = new POINT2(pts[0]);
2989
+ points[counter].style = 0;
2990
+ counter++;
2991
+ points[counter] = new POINT2(pts[1]);
2992
+ points[counter].style = 5;
2993
+ counter++;
2994
+ } catch (exc) {
2995
+ if (exc instanceof Error) {
2996
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMSupportbyFireDouble",
2997
+ new RendererException("Failed inside GetDISMSupportByFireDouble", exc));
2998
+ } else {
2999
+ throw exc;
3000
+ }
3001
+ }
3002
+ return counter;
3003
+ }
3004
+
3005
+ private static ReorderAtkByFirePoints(points: POINT2[]): void {
3006
+ try {
3007
+ //assume the points were ordered correctly. then pt0 is above the line from pt1 to pt2
3008
+ let savepoints: POINT2[] = new Array<POINT2>(3);
3009
+ let ptAboveLine: POINT2 = new POINT2();
3010
+ let ptBelowLine: POINT2 = new POINT2();
3011
+ let ptLeftOfLine: POINT2 = new POINT2();
3012
+ let ptRightOfLine: POINT2 = new POINT2();
3013
+ let distToLine: double = 0;
3014
+ let distanceToPointAboveLine: double = 0;
3015
+ let distanceToPointBelowLine: double = 0;
3016
+ let distanceToPointLeftOfLine: double = 0;
3017
+ let distanceToPointRightOfLine: double = 0;
3018
+ for (let j: int = 0; j < 3; j++) {
3019
+ savepoints[j] = new POINT2(points[j]);
3020
+ }
3021
+
3022
+ if (Math.abs(savepoints[1].x - savepoints[2].x) > 2) {
3023
+ distToLine = lineutility.CalcDistanceToLineDouble(savepoints[1], savepoints[2], savepoints[0]);
3024
+ ptAboveLine = lineutility.ExtendDirectedLine(savepoints[1], savepoints[2], savepoints[2], 2, distToLine);
3025
+ ptBelowLine = lineutility.ExtendDirectedLine(savepoints[1], savepoints[2], savepoints[2], 3, distToLine);
3026
+ distanceToPointAboveLine = lineutility.CalcDistanceDouble(savepoints[0], ptAboveLine);
3027
+ distanceToPointBelowLine = lineutility.CalcDistanceDouble(savepoints[0], ptBelowLine);
3028
+ if (distanceToPointAboveLine < distanceToPointBelowLine) {
3029
+ //then pt2 - pt3 should be left to right
3030
+ if (savepoints[2].x < savepoints[1].x) {
3031
+ lineutility.Reverse2Points(savepoints[1], savepoints[2]);
3032
+ }
3033
+
3034
+
3035
+ } else {
3036
+ if (savepoints[2].x > savepoints[1].x) {
3037
+ lineutility.Reverse2Points(savepoints[1], savepoints[2]);
3038
+ }
3039
+
3040
+ }
3041
+ } else //the last 2 points form a vertical line
3042
+ {
3043
+ distToLine = lineutility.CalcDistanceToLineDouble(savepoints[1], savepoints[2], savepoints[0]);
3044
+ ptLeftOfLine = lineutility.ExtendDirectedLine(savepoints[1], savepoints[2], savepoints[2], 0, distToLine);
3045
+ ptRightOfLine = lineutility.ExtendDirectedLine(savepoints[1], savepoints[2], savepoints[2], 1, distToLine);
3046
+ distanceToPointLeftOfLine = lineutility.CalcDistanceDouble(savepoints[0], ptLeftOfLine);
3047
+ distanceToPointRightOfLine = lineutility.CalcDistanceDouble(savepoints[0], ptRightOfLine);
3048
+ if (distanceToPointRightOfLine < distanceToPointLeftOfLine) {
3049
+ if (savepoints[2].y < savepoints[1].y) {
3050
+ lineutility.Reverse2Points(savepoints[1], savepoints[2]);
3051
+ }
3052
+ } else {
3053
+ if (savepoints[2].y > savepoints[1].y) {
3054
+ lineutility.Reverse2Points(savepoints[1], savepoints[2]);
3055
+ }
3056
+ }
3057
+ }
3058
+ points[1].x = savepoints[1].x;
3059
+ points[1].y = savepoints[1].y;
3060
+ points[2].x = savepoints[2].x;
3061
+ points[2].y = savepoints[2].y;
3062
+ } catch (exc) {
3063
+ if (exc instanceof Error) {
3064
+ ErrorLogger.LogException(DISMSupport._className, "ReorderAtkByFirePoints",
3065
+ new RendererException("Failed inside GetDISMSupportByFireDouble", exc));
3066
+ } else {
3067
+ throw exc;
3068
+ }
3069
+ }
3070
+ }
3071
+ private static ReorderSptByFirePoints(points: POINT2[]): void {
3072
+ try {
3073
+ //assume the points were ordered correctly. then pt0 is above the line from pt1 to pt2
3074
+ let ptAboveLine: POINT2 = new POINT2();
3075
+ let ptBelowLine: POINT2 = new POINT2();
3076
+ let ptLeftOfLine: POINT2 = new POINT2();
3077
+ let ptRightOfLine: POINT2 = new POINT2();
3078
+ let distToLine: double = 0;
3079
+ let distanceToPointAboveLine: double = 0;
3080
+ let distanceToPointBelowLine: double = 0;
3081
+ let distanceToPointLeftOfLine: double = 0;
3082
+ let distanceToPointRightOfLine: double = 0;
3083
+
3084
+ let midpt: POINT2 = lineutility.MidPointDouble(points[0], points[1], 0);
3085
+ if (Math.abs(points[2].x - points[3].x) > 2) {
3086
+ distToLine = lineutility.CalcDistanceToLineDouble(points[1], points[2], midpt);
3087
+ ptAboveLine = lineutility.ExtendDirectedLine(points[1], points[2], points[2], 2, distToLine);
3088
+ ptBelowLine = lineutility.ExtendDirectedLine(points[1], points[2], points[2], 3, distToLine);
3089
+ distanceToPointAboveLine = lineutility.CalcDistanceDouble(points[0], ptAboveLine);
3090
+ distanceToPointBelowLine = lineutility.CalcDistanceDouble(points[0], ptBelowLine);
3091
+ if (distanceToPointAboveLine < distanceToPointBelowLine) {
3092
+ //then pt2 - pt3 should be left to right
3093
+ if (points[2].x < points[1].x) {
3094
+ lineutility.Reverse2Points(points[0], points[1]);
3095
+ lineutility.Reverse2Points(points[2], points[3]);
3096
+ }
3097
+ } else {
3098
+ if (points[2].x > points[1].x) {
3099
+ lineutility.Reverse2Points(points[0], points[1]);
3100
+ lineutility.Reverse2Points(points[2], points[3]);
3101
+ }
3102
+ }
3103
+ } else //the last 2 points form a vertical line
3104
+ {
3105
+ distToLine = lineutility.CalcDistanceToLineDouble(points[1], points[2], midpt);
3106
+ ptLeftOfLine = lineutility.ExtendDirectedLine(points[1], points[2], points[2], 0, distToLine);
3107
+ ptRightOfLine = lineutility.ExtendDirectedLine(points[1], points[2], points[2], 1, distToLine);
3108
+ distanceToPointLeftOfLine = lineutility.CalcDistanceDouble(points[0], ptLeftOfLine);
3109
+ distanceToPointRightOfLine = lineutility.CalcDistanceDouble(points[0], ptRightOfLine);
3110
+ if (distanceToPointLeftOfLine < distanceToPointRightOfLine) {
3111
+ //then pt2 - pt3 should be left to right
3112
+ if (points[2].y > points[1].y) {
3113
+ lineutility.Reverse2Points(points[0], points[1]);
3114
+ lineutility.Reverse2Points(points[2], points[3]);
3115
+ }
3116
+ } else {
3117
+ if (points[2].y < points[1].y) {
3118
+ lineutility.Reverse2Points(points[0], points[1]);
3119
+ lineutility.Reverse2Points(points[2], points[3]);
3120
+ }
3121
+ }
3122
+
3123
+ }
3124
+ } catch (exc) {
3125
+ if (exc instanceof Error) {
3126
+ ErrorLogger.LogException(DISMSupport._className, "ReorderSptByFire",
3127
+ new RendererException("Failed inside ReorderSptByFirePoints", exc));
3128
+ } else {
3129
+ throw exc;
3130
+ }
3131
+ }
3132
+ }
3133
+ /**
3134
+ * Calculates the points for ATKBYFIRE
3135
+ *
3136
+ * @param points OUT - the client points, also used for the returned points.
3137
+ * @param linetype the line type.
3138
+ */
3139
+ static GetDISMATKBYFIREDouble(points: POINT2[], linetype: int): int {
3140
+ let counter: int = 0;
3141
+ try {
3142
+ let pts: POINT2[] = new Array<POINT2>(3);
3143
+ let ptMid: POINT2 = new POINT2();
3144
+ let savepoints: POINT2[] = new Array<POINT2>(3);
3145
+ let j: int = 0;
3146
+ let iDiagEOL_length: double = 0;
3147
+ let dAngle1: double = 0;
3148
+ let iDeltaX1: double = 0;
3149
+ let iDeltaY1: double = 0;
3150
+ let iDeltaX2: double = 0;
3151
+ let iDeltaY2: double = 0;
3152
+
3153
+ for (j = 0; j < 3; j++) {
3154
+ savepoints[j] = new POINT2(points[j]);
3155
+ }
3156
+
3157
+ DISMSupport.ReorderAtkByFirePoints(savepoints);
3158
+
3159
+ lineutility.InitializePOINT2Array(pts);
3160
+ // draw line across back
3161
+ pts[0] = new POINT2(savepoints[1]);
3162
+ pts[1] = new POINT2(savepoints[2]);
3163
+ //DrawLine(destination, mask, color, pts, 2, 2);
3164
+ points[counter] = new POINT2(pts[0]);
3165
+ points[counter].style = 0;
3166
+ counter++;
3167
+ points[counter] = new POINT2(pts[1]);
3168
+ points[counter].style = 5;
3169
+ counter++;
3170
+
3171
+ // draw perpendicular line
3172
+ ptMid.x = (savepoints[1].x + savepoints[2].x) / 2;
3173
+ ptMid.y = (savepoints[1].y + savepoints[2].y) / 2;
3174
+ pts[0] = new POINT2(ptMid);
3175
+ pts[1] = new POINT2(savepoints[0]);
3176
+ //DrawLine(destination, mask, color, pts, 2, 2);
3177
+ points[counter] = new POINT2(pts[0]);
3178
+ points[counter].style = 0;
3179
+ counter++;
3180
+ points[counter] = new POINT2(pts[1]);
3181
+ points[counter].style = 5;
3182
+ counter++;
3183
+
3184
+ // draw arrowhead
3185
+ iDiagEOL_length = ((Math.sqrt // height of graphic
3186
+ (
3187
+ (savepoints[1].x - savepoints[2].x) * (savepoints[1].x - savepoints[2].x) +
3188
+ (savepoints[1].y - savepoints[2].y) * (savepoints[1].y - savepoints[2].y)) +
3189
+ Math.sqrt // length of graphic
3190
+ (
3191
+ (savepoints[0].x - ptMid.x) * (savepoints[0].x - ptMid.x) +
3192
+ (savepoints[0].y - ptMid.y) * (savepoints[0].y - ptMid.y))) / 20);
3193
+ //if(iDiagEOL_length<10)
3194
+ // iDiagEOL_length=10;
3195
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
3196
+ if (iDiagEOL_length > DISMSupport.maxLength / 5 * DPIScaleFactor) {
3197
+ iDiagEOL_length = DISMSupport.maxLength / 5 * DPIScaleFactor;
3198
+ }
3199
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
3200
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
3201
+ }
3202
+
3203
+ dAngle1 = Math.atan2(ptMid.y - savepoints[0].y, ptMid.x - savepoints[0].x);
3204
+ iDeltaX1 = (Math.cos(dAngle1 + DISMSupport.CONST_PI / 6) * iDiagEOL_length);
3205
+ iDeltaY1 = (Math.sin(dAngle1 + DISMSupport.CONST_PI / 6) * iDiagEOL_length);
3206
+ iDeltaX2 = (Math.cos(dAngle1 - DISMSupport.CONST_PI / 6) * iDiagEOL_length);
3207
+ iDeltaY2 = (Math.sin(dAngle1 - DISMSupport.CONST_PI / 6) * iDiagEOL_length);
3208
+ pts[0].x = savepoints[0].x + iDeltaX1;
3209
+ pts[0].y = savepoints[0].y + iDeltaY1;
3210
+ pts[1] = new POINT2(savepoints[0]);
3211
+ pts[2].x = savepoints[0].x + iDeltaX2;
3212
+ pts[2].y = savepoints[0].y + iDeltaY2;
3213
+ //DrawLine(destination, mask, color, pts, 3, 2);
3214
+ for (j = 0; j < 3; j++) {
3215
+ points[counter] = new POINT2(pts[j]);
3216
+ points[counter].style = 0;
3217
+ counter++;
3218
+ }
3219
+ points[counter - 1].style = 5;
3220
+
3221
+ // draw lines on the back of the graphic
3222
+ dAngle1 = Math.atan2(savepoints[1].y - savepoints[2].y, savepoints[1].x - savepoints[2].x);
3223
+ iDeltaX1 = (Math.cos(dAngle1 - DISMSupport.CONST_PI / 4) * iDiagEOL_length * 2);
3224
+ iDeltaY1 = (Math.sin(dAngle1 - DISMSupport.CONST_PI / 4) * iDiagEOL_length * 2);
3225
+ iDeltaX2 = (Math.cos(dAngle1 + DISMSupport.CONST_PI / 4) * iDiagEOL_length * 2);
3226
+ iDeltaY2 = (Math.sin(dAngle1 + DISMSupport.CONST_PI / 4) * iDiagEOL_length * 2);
3227
+
3228
+ pts[0].x = savepoints[1].x + iDeltaX1;
3229
+ pts[0].y = savepoints[1].y + iDeltaY1;
3230
+ pts[1] = new POINT2(savepoints[1]);
3231
+ //DrawLine(destination, mask, color, pts, 2, 2);
3232
+ points[counter] = new POINT2(pts[0]);
3233
+ points[counter].style = 0;
3234
+ counter++;
3235
+ points[counter] = new POINT2(pts[1]);
3236
+ points[counter].style = 5;
3237
+ counter++;
3238
+
3239
+ pts[0].x = savepoints[2].x - iDeltaX2;
3240
+ pts[0].y = savepoints[2].y - iDeltaY2;
3241
+ pts[1] = new POINT2(savepoints[2]);
3242
+ //DrawLine(destination, mask, color, pts, 2, 2);
3243
+ points[counter] = new POINT2(pts[0]);
3244
+ points[counter].style = 0;
3245
+ counter++;
3246
+ points[counter] = new POINT2(pts[1]);
3247
+ points[counter].style = 5;
3248
+ counter++;
3249
+ } catch (exc) {
3250
+ if (exc instanceof Error) {
3251
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMAtkByFireDouble",
3252
+ new RendererException("Failed inside GetDISMAtkByFireDouble", exc));
3253
+ } else {
3254
+ throw exc;
3255
+ }
3256
+ }
3257
+ return counter;
3258
+ }
3259
+ /**
3260
+ * Calculates the points for GAP
3261
+ *
3262
+ * @param points OUT - the client points, also used for the returned points.
3263
+ * @param linetype the line type.
3264
+ */
3265
+ static GetDISMGapDouble(points: POINT2[], linetype: int): int {
3266
+ try {
3267
+ let savepoints: POINT2[] = new Array<POINT2>(4);
3268
+ let pts: POINT2[] = new Array<POINT2>(2);
3269
+ let j: int = 0;
3270
+ let dMBR: double = lineutility.MBRDistance(points, 4);
3271
+ //end declarations
3272
+
3273
+ for (j = 0; j < 4; j++) {
3274
+ savepoints[j] = new POINT2(points[j]);
3275
+ }
3276
+
3277
+ lineutility.InitializePOINT2Array(pts);
3278
+ //M. Deutch 8-19-04
3279
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
3280
+ if (dMBR / 10 > DISMSupport.maxLength * DPIScaleFactor) {
3281
+ dMBR = 10 * DISMSupport.maxLength * DPIScaleFactor;
3282
+ }
3283
+ if (dMBR / 10 < DISMSupport.minLength * DPIScaleFactor) {
3284
+ dMBR = 10 * DISMSupport.minLength * DPIScaleFactor;
3285
+ }
3286
+
3287
+ points[0] = new POINT2(savepoints[0]);
3288
+ points[0].style = 0;
3289
+ points[1] = new POINT2(savepoints[1]);
3290
+ points[1].style = 5;
3291
+ points[2] = new POINT2(savepoints[2]);
3292
+ points[2].style = 0;
3293
+ points[3] = new POINT2(savepoints[3]);
3294
+ points[3].style = 5;
3295
+
3296
+ let dist: double = dMBR / 10;
3297
+ if (dist > 20 * DPIScaleFactor) {
3298
+
3299
+ dist = 20 * DPIScaleFactor;
3300
+ }
3301
+
3302
+ let dist2: double = dist;
3303
+
3304
+ //get the extension point
3305
+ pts[0] = lineutility.ExtendLineDouble(savepoints[1], savepoints[0], dist);
3306
+ pts[1] = lineutility.ExtendLineDouble(savepoints[2], savepoints[0], dist2);
3307
+ points[4] = new POINT2(points[0]);
3308
+ points[4].style = 0;
3309
+ points[5] = lineutility.MidPointDouble(pts[0], pts[1], 5);
3310
+ //get the extension point
3311
+ pts[0] = lineutility.ExtendLineDouble(savepoints[0], savepoints[1], dist);
3312
+ pts[1] = lineutility.ExtendLineDouble(savepoints[3], savepoints[1], dist2);
3313
+ points[6] = new POINT2(points[1]);
3314
+ points[6].style = 0;
3315
+ points[7] = lineutility.MidPointDouble(pts[0], pts[1], 5);
3316
+ //get the extension point
3317
+ pts[0] = lineutility.ExtendLineDouble(savepoints[0], savepoints[2], dist2);
3318
+ pts[1] = lineutility.ExtendLineDouble(savepoints[3], savepoints[2], dist);
3319
+ points[8] = new POINT2(points[2]);
3320
+ points[8].style = 0;
3321
+ points[9] = lineutility.MidPointDouble(pts[0], pts[1], 5);
3322
+ //get the extension point
3323
+ pts[0] = lineutility.ExtendLineDouble(savepoints[1], savepoints[3], dist2);
3324
+ pts[1] = lineutility.ExtendLineDouble(savepoints[2], savepoints[3], dist);
3325
+ points[10] = new POINT2(points[3]);
3326
+ points[10].style = 0;
3327
+ points[11] = lineutility.MidPointDouble(pts[0], pts[1], 5);
3328
+
3329
+ } catch (exc) {
3330
+ if (exc instanceof Error) {
3331
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMGapDouble",
3332
+ new RendererException("Failed inside GetDISMGapDouble", exc));
3333
+ } else {
3334
+ throw exc;
3335
+ }
3336
+ }
3337
+ return 12;
3338
+ }
3339
+ /**
3340
+ * Calculates the points for MNFLDDIS
3341
+ *
3342
+ * @param points - OUT - the client points, also used for the returned points.
3343
+ * @param linetype the line type.
3344
+ */
3345
+ static GetDISMMinefieldDisruptDouble(points: POINT2[], linetype: int): int {
3346
+ let counter: int = 0;
3347
+ try {
3348
+ let pts: POINT2[] = new Array<POINT2>(2);
3349
+ let ptsArrow: POINT2[] = new Array<POINT2>(3);
3350
+ let ptCenter: POINT2 = new POINT2();
3351
+ let j: int = 0;
3352
+ let savepoints: POINT2[] = new Array<POINT2>(3);
3353
+ let dAngle1: double = 0;
3354
+ let d: double = 0;
3355
+ let dist: double = 0;
3356
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
3357
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
3358
+ let deltapoints3: POINT2[] = new Array<POINT2>(4);
3359
+ let iDiagEOL_length: double = 0;
3360
+ let iDeltaX1: double = 0;
3361
+ let iDeltaY1: double = 0;
3362
+ let iDeltaX2: double = 0;
3363
+ let iDeltaY2: double = 0;
3364
+ let ptTail: POINT2 = new POINT2();
3365
+ //end declarations
3366
+
3367
+ for (j = 0; j < 3; j++) {
3368
+ savepoints[j] = new POINT2(points[j]);
3369
+ }
3370
+
3371
+ lineutility.InitializePOINT2Array(ptsArrow);
3372
+ lineutility.InitializePOINT2Array(deltapoints1);
3373
+ lineutility.InitializePOINT2Array(deltapoints2);
3374
+ lineutility.InitializePOINT2Array(deltapoints3);
3375
+ lineutility.InitializePOINT2Array(pts);
3376
+
3377
+ points[counter] = new POINT2(savepoints[0]);
3378
+ points[counter].style = 0;
3379
+ counter++;
3380
+ points[counter] = new POINT2(savepoints[1]);
3381
+ points[counter].style = 5;
3382
+ counter++;
3383
+
3384
+ ptCenter.x = (savepoints[0].x + savepoints[1].x) / 2;
3385
+ ptCenter.y = (savepoints[0].y + savepoints[1].y) / 2;
3386
+
3387
+ ptsArrow[0] = new POINT2(savepoints[2]);
3388
+ ptsArrow[1].x = ptCenter.x + (savepoints[2].x - savepoints[0].x) * 4 / 5;
3389
+ ptsArrow[1].y = ptCenter.y + (savepoints[2].y - savepoints[0].y) * 4 / 5;
3390
+ ptsArrow[2].x = savepoints[1].x + (savepoints[2].x - savepoints[0].x) * 3 / 5;
3391
+ ptsArrow[2].y = savepoints[1].y + (savepoints[2].y - savepoints[0].y) * 3 / 5;
3392
+
3393
+ points[counter] = new POINT2(savepoints[1]);
3394
+ points[counter].style = 0;
3395
+ counter++;
3396
+ points[counter] = new POINT2(ptsArrow[2]);
3397
+ points[counter].style = 5;
3398
+ counter++;
3399
+
3400
+ pts[1] = new POINT2(ptsArrow[1]);
3401
+
3402
+ //draw middle line
3403
+ points[counter] = new POINT2(ptCenter);
3404
+ points[counter].style = 0;
3405
+ counter++;
3406
+ points[counter] = new POINT2(pts[1]);
3407
+ points[counter].style = 5;
3408
+ counter++;
3409
+
3410
+ //draw tail
3411
+ dist = lineutility.CalcDistanceDouble(savepoints[2], savepoints[0]);
3412
+ d = dist;
3413
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
3414
+ if (d > 5 * DISMSupport.maxLength * DPIScaleFactor) {
3415
+ d = 5 * DISMSupport.maxLength * DPIScaleFactor;
3416
+ }
3417
+ if (d < 5 * DISMSupport.minLength * DPIScaleFactor) {
3418
+ d = 5 * DISMSupport.minLength * DPIScaleFactor;
3419
+ }
3420
+ ptTail = new POINT2(ptCenter);
3421
+ pts[0].x = ptTail.x - (savepoints[2].x - savepoints[0].x) / 5;
3422
+ pts[0].y = ptTail.y - (savepoints[2].y - savepoints[0].y) / 5;
3423
+ pts[0] = lineutility.ExtendLineDouble(pts[0], ptTail, -d / 5);
3424
+ points[counter] = new POINT2(ptTail);
3425
+ points[counter].style = 0;
3426
+ counter++;
3427
+ points[counter] = new POINT2(pts[0]);
3428
+ points[counter].style = 5;
3429
+ counter++;
3430
+
3431
+ pts[0] = new POINT2(savepoints[0]);
3432
+ pts[1] = new POINT2(ptsArrow[0]);
3433
+
3434
+ points[counter] = new POINT2(pts[0]);
3435
+ points[counter].style = 0;
3436
+ counter++;
3437
+ points[counter] = new POINT2(pts[1]);
3438
+ points[counter].style = 5;
3439
+ counter++;
3440
+
3441
+ // the following code is very similar to CalcEndpieceDeltas
3442
+ iDiagEOL_length = ((Math.sqrt // height of graphic
3443
+ (
3444
+ (savepoints[1].x - savepoints[0].x) * (savepoints[1].x - savepoints[0].x) +
3445
+ (savepoints[1].y - savepoints[0].y) * (savepoints[1].y - savepoints[0].y)) +
3446
+ Math.sqrt // length of graphic
3447
+ (
3448
+ (savepoints[2].x - savepoints[1].x) * (savepoints[2].x - savepoints[1].x) +
3449
+ (savepoints[2].y - savepoints[1].y) * (savepoints[2].y - savepoints[1].y))) / 15);
3450
+ // dAngle1 = angle used to calculate the end-piece deltas
3451
+
3452
+ if (iDiagEOL_length > DISMSupport.maxLength * DPIScaleFactor) {
3453
+ iDiagEOL_length = DISMSupport.maxLength * DPIScaleFactor;
3454
+ }
3455
+ if (iDiagEOL_length < DISMSupport.minLength * DPIScaleFactor) {
3456
+ iDiagEOL_length = DISMSupport.minLength * DPIScaleFactor;
3457
+ }
3458
+
3459
+ dAngle1 = Math.atan2(savepoints[0].y - savepoints[2].y, savepoints[0].x - savepoints[2].x);
3460
+ iDeltaX1 = (iDiagEOL_length * Math.cos(dAngle1 - DISMSupport.CONST_PI / 6));
3461
+ iDeltaY1 = (iDiagEOL_length * Math.sin(dAngle1 - DISMSupport.CONST_PI / 6));
3462
+ iDeltaX2 = (iDiagEOL_length * Math.cos(dAngle1 + DISMSupport.CONST_PI / 6));
3463
+ iDeltaY2 = (iDiagEOL_length * Math.sin(dAngle1 + DISMSupport.CONST_PI / 6));
3464
+
3465
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[0],
3466
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints1);
3467
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[1],
3468
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints2);
3469
+ DISMSupport.DrawEndpieceDeltasDouble(ptsArrow[2],
3470
+ iDeltaX1, iDeltaY1, iDeltaX2, iDeltaY2, deltapoints3);
3471
+ points[counter] = new POINT2(deltapoints1[1]);
3472
+ points[counter].style = 9;
3473
+ counter++;
3474
+ points[counter] = new POINT2(deltapoints1[0]);
3475
+ points[counter].style = 9;
3476
+ counter++;
3477
+ points[counter] = new POINT2(deltapoints1[3]);
3478
+ points[counter].style = 9;
3479
+ counter++;
3480
+ points[counter] = new POINT2(deltapoints1[3]);
3481
+ points[counter].style = 10;
3482
+ counter++;
3483
+
3484
+ points[counter] = new POINT2(deltapoints2[1]);
3485
+ points[counter].style = 9;
3486
+ counter++;
3487
+ points[counter] = new POINT2(deltapoints2[0]);
3488
+ points[counter].style = 9;
3489
+ counter++;
3490
+ points[counter] = new POINT2(deltapoints2[3]);
3491
+ points[counter].style = 9;
3492
+ counter++;
3493
+ points[counter] = new POINT2(deltapoints2[3]);
3494
+ points[counter].style = 10;
3495
+ counter++;
3496
+
3497
+ points[counter] = new POINT2(deltapoints3[1]);
3498
+ points[counter].style = 9;
3499
+ counter++;
3500
+ points[counter] = new POINT2(deltapoints3[0]);
3501
+ points[counter].style = 9;
3502
+ counter++;
3503
+ points[counter] = new POINT2(deltapoints3[3]);
3504
+ points[counter].style = 9;
3505
+ counter++;
3506
+ points[counter] = new POINT2(deltapoints3[3]);
3507
+ points[counter].style = 10;
3508
+ counter++;
3509
+
3510
+ } catch (exc) {
3511
+ if (exc instanceof Error) {
3512
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMMinefieldDisruptDouble",
3513
+ new RendererException("Failed inside GetDISMMinefieldDisruptDouble", exc));
3514
+ } else {
3515
+ throw exc;
3516
+ }
3517
+ }
3518
+ return counter;
3519
+ }
3520
+ /**
3521
+ * Calculates the points for LINTGT
3522
+ *
3523
+ * @param points - OUT - the client points, also used for the returned points.
3524
+ * @param linetype the line type.
3525
+ * @param vblCounter the number of points required to display the symbol
3526
+ */
3527
+ static GetDISMLinearTargetDouble(points: POINT2[], linetype: int, vblCounter: int): int {
3528
+ let counter: int = 0;
3529
+ try {
3530
+ let j: int = 0;
3531
+ let dMBR: double = lineutility.MBRDistance(points, vblCounter - 4);
3532
+ //end declarations
3533
+
3534
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
3535
+ if (dMBR / 20 > DISMSupport.maxLength * DPIScaleFactor) {
3536
+ dMBR = 20 * DISMSupport.maxLength * DPIScaleFactor;
3537
+ }
3538
+ if (dMBR / 20 < DISMSupport.minLength * DPIScaleFactor) {
3539
+ dMBR = 20 * DISMSupport.minLength * DPIScaleFactor;
3540
+ }
3541
+ if (dMBR < 150 * DPIScaleFactor) {
3542
+ dMBR = 150 * DPIScaleFactor;
3543
+ }
3544
+ if (dMBR > 250 * DPIScaleFactor) {
3545
+
3546
+ dMBR = 250 * DPIScaleFactor;
3547
+ }
3548
+
3549
+
3550
+ for (j = 0; j < vblCounter - 4; j++) {
3551
+ points[counter].style = 0;
3552
+ counter++;
3553
+ }
3554
+ //for(j=vblCounter-4;j<vblCounter;j++)
3555
+ // points[j]=new POINT2();
3556
+
3557
+ points[counter - 1].style = 5;
3558
+
3559
+ points[counter] = lineutility.ExtendTrueLinePerpDouble(points[0], points[1], points[0], dMBR / 20, 0);
3560
+ counter++;
3561
+ points[counter] = lineutility.ExtendTrueLinePerpDouble(points[0], points[1], points[0], -dMBR / 20, 5);
3562
+ counter++;
3563
+ points[counter] = lineutility.ExtendTrueLinePerpDouble(points[vblCounter - 5], points[vblCounter - 6], points[vblCounter - 5], dMBR / 20, 0);
3564
+ counter++;
3565
+ points[counter] = lineutility.ExtendTrueLinePerpDouble(points[vblCounter - 5], points[vblCounter - 6], points[vblCounter - 5], -dMBR / 20, 5);
3566
+ counter++;
3567
+ if (linetype === TacticalLines.FPF) {
3568
+ points[0].style = 6;
3569
+ }
3570
+ } catch (exc) {
3571
+ if (exc instanceof Error) {
3572
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMLinearTargetDouble",
3573
+ new RendererException("Failed inside GetDISMLinearTargetDouble", exc));
3574
+ } else {
3575
+ throw exc;
3576
+ }
3577
+ }
3578
+ return counter;
3579
+ }
3580
+ /**
3581
+ * Calculates the points for BLOCK, MNFLDBLK
3582
+ *
3583
+ * @param points - OUT - the client points, also used for the returned points.
3584
+ * @param linetype the line type.
3585
+ */
3586
+ static GetDISMBlockDouble2(points: POINT2[],
3587
+ linetype: int): void {
3588
+ try {
3589
+ let ptRelative: POINT2 = new POINT2(points[2]);
3590
+
3591
+ let midpt: POINT2 = lineutility.MidPointDouble(points[0], points[1], 0);
3592
+ let j: int = 0;
3593
+ points[0].style = 0;
3594
+ points[1].style = 5;
3595
+ points[2] = new POINT2(midpt);
3596
+ points[3] = new POINT2(ptRelative);
3597
+ if (linetype === TacticalLines.BLOCK) {
3598
+ points[2].style = 14;
3599
+ }
3600
+ if (linetype === TacticalLines.FPF) {
3601
+ points[2].style = 6;
3602
+ }
3603
+ } catch (exc) {
3604
+ if (exc instanceof Error) {
3605
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMBlockDouble2",
3606
+ new RendererException("Failed inside GetDISMBlockDouble2", exc));
3607
+ } else {
3608
+ throw exc;
3609
+ }
3610
+ }
3611
+ }
3612
+ /**
3613
+ * Calculates the points for PAA_RECTANGULAR.
3614
+ *
3615
+ * @param points - OUT - the client points, also used for the returned points.
3616
+ * @param linetype the line type.
3617
+ */
3618
+ protected static GetDISMPAADouble(points: POINT2[], linetype: int): void {
3619
+ try {
3620
+ let pt0: POINT2 = new POINT2(points[0]);
3621
+ let pt1: POINT2 = new POINT2(points[1]);
3622
+ let pt2: POINT2 = new POINT2();
3623
+ let pt3: POINT2 = new POINT2();
3624
+ let midpt: POINT2 = new POINT2();
3625
+ let d: double = lineutility.CalcDistanceDouble(pt0, pt1);
3626
+
3627
+ midpt = lineutility.MidPointDouble(pt0, pt1, 0);
3628
+ pt2 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, midpt, d / 2, 0);
3629
+ pt3 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, midpt, -d / 2, 0);
3630
+ d = lineutility.CalcDistanceDouble(pt0, pt2);
3631
+ points[0] = new POINT2(pt0);
3632
+ points[0].style = 14;
3633
+ points[1] = new POINT2(pt2);
3634
+ points[1].style = 14;
3635
+ points[2] = new POINT2(pt1);
3636
+ points[2].style = 14;
3637
+ points[3] = new POINT2(pt3);
3638
+ points[3].style = 14;
3639
+ points[4] = new POINT2(pt0);
3640
+ points[4].style = 5;
3641
+ } catch (exc) {
3642
+ if (exc instanceof Error) {
3643
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMPAADouble",
3644
+ new RendererException("Failed inside GetDISMPAADouble", exc));
3645
+ } else {
3646
+ throw exc;
3647
+ }
3648
+ }
3649
+ }
3650
+
3651
+ private static ReverseDelayArc(points: POINT2[]): boolean {
3652
+ let pt1: POINT2 = points[0];
3653
+ let pt2: POINT2 = points[1];
3654
+ let pt3: POINT2 = points[2];
3655
+
3656
+ let lineAngle: double = DISMSupport.getAngleBetweenPoints(pt1.x, pt1.y, pt2.x, pt2.y);
3657
+ let curveAngle: double = DISMSupport.getAngleBetweenPoints(pt2.x, pt2.y, pt3.x, pt3.y);
3658
+
3659
+ let upperBound: double = curveAngle + 180;
3660
+ return !DISMSupport.isInRange(curveAngle, upperBound, lineAngle);
3661
+ }
3662
+
3663
+ private static isInRange(min: double, max: double, targetAngle: double): boolean {
3664
+ targetAngle = DISMSupport.normalizeAngle(targetAngle);
3665
+ min = DISMSupport.normalizeAngle(min);
3666
+ max = DISMSupport.normalizeAngle(max);
3667
+
3668
+ if (min < max) {
3669
+ return min <= targetAngle && targetAngle <= max;
3670
+ }
3671
+ return min <= targetAngle || targetAngle <= max;
3672
+
3673
+ }
3674
+
3675
+ private static getAngleBetweenPoints(x1: double, y1: double, x2: double, y2: double): double {
3676
+ return Math.atan2(y2 - y1, x2 - x1) * 180.0 / Math.PI;
3677
+ }
3678
+
3679
+ /**
3680
+ * Returns an angle from 0 to 360
3681
+ *
3682
+ * @param angle the angle to normalize
3683
+ * @return an angle in range from 0 to 360
3684
+ */
3685
+ public static normalizeAngle(angle: double): double {
3686
+ return (3600000 + angle) % 360;
3687
+ }
3688
+
3689
+ private static DrawEndpieceDeltasDouble(point: POINT2,
3690
+ iDelta1: double,
3691
+ iDelta2: double,
3692
+ iDelta3: double,
3693
+ iDelta4: double,
3694
+ deltapoints: POINT2[]): void {
3695
+ try {
3696
+ deltapoints[0] = new POINT2(point);
3697
+ deltapoints[0].style = 0;
3698
+ deltapoints[1].x = point.x + iDelta1;
3699
+ deltapoints[1].y = point.y + iDelta2;
3700
+ deltapoints[1].style = 5;
3701
+ deltapoints[2] = new POINT2(point);
3702
+ deltapoints[2].style = 0;
3703
+ deltapoints[3].x = point.x + iDelta3;
3704
+ deltapoints[3].y = point.y + iDelta4;
3705
+ deltapoints[3].style = 5;
3706
+ } catch (exc) {
3707
+ if (exc instanceof Error) {
3708
+ ErrorLogger.LogException(DISMSupport._className, "DrawEndpieceDeltasDouble",
3709
+ new RendererException("Failed inside DrawEndpieceDeltasDouble", exc));
3710
+ } else {
3711
+ throw exc;
3712
+ }
3713
+ }
3714
+ }
3715
+ /**
3716
+ * Calculates the points for EASY
3717
+ *
3718
+ * @param points - OUT - the client points, also used for the returned points.
3719
+ * @param linetype the line type.
3720
+ */
3721
+ static GetDISMEasyDouble(points: POINT2[],
3722
+ linetype: int): int {
3723
+ let counter: int = 0;
3724
+ try {
3725
+ let j: int = 0;
3726
+ let pointsCorner: POINT2[] = new Array<POINT2>(2);
3727
+ let rectpts: POINT2[] = new Array<POINT2>(4);
3728
+ let savepoints: POINT2[] = new Array<POINT2>(3);
3729
+ let deltapoints1: POINT2[] = new Array<POINT2>(4);
3730
+ let deltapoints2: POINT2[] = new Array<POINT2>(4);
3731
+ let iDeltaX: ref<number[]> = new ref();
3732
+ let iDeltaY: ref<number[]> = new ref();
3733
+ let bPointsRight: int = 0;
3734
+ //end declarations
3735
+
3736
+ for (j = 0; j < 3; j++) {
3737
+ savepoints[j] = points[j];
3738
+ }
3739
+ lineutility.InitializePOINT2Array(pointsCorner);
3740
+ lineutility.InitializePOINT2Array(rectpts);
3741
+ lineutility.InitializePOINT2Array(deltapoints1);
3742
+ lineutility.InitializePOINT2Array(deltapoints2);
3743
+
3744
+ DISMSupport.DrawOpenRectangleDouble(savepoints, pointsCorner, rectpts);
3745
+ for (j = 0; j < 4; j++) {
3746
+ points[counter] = new POINT2(rectpts[j]);
3747
+ points[counter].style = 0;
3748
+ counter++;
3749
+ }
3750
+ points[counter - 1].style = 5;
3751
+
3752
+ bPointsRight = DISMSupport.DetermineDirectionDouble(savepoints);
3753
+
3754
+ DISMSupport.CalcEndpieceDeltasDouble(savepoints, iDeltaX, iDeltaY, DISMSupport.CONST_PI / 4);
3755
+
3756
+ if ((savepoints[0].y - savepoints[1].y) < 0) {// Point0 is higher than Point1
3757
+ if (bPointsRight !== 0) {// figure opens to the right
3758
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
3759
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
3760
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
3761
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
3762
+ } else {// figure opens to the left
3763
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
3764
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
3765
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
3766
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
3767
+ }
3768
+ } else {// Point0 is lower than Point1
3769
+ if (bPointsRight !== 0) {// figure opens to the right
3770
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
3771
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints1);
3772
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
3773
+ iDeltaY.value[0], -iDeltaX.value[0], iDeltaX.value[0], iDeltaY.value[0], deltapoints2);
3774
+ } else {// figure opens to the left
3775
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[0],
3776
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints1);
3777
+ DISMSupport.DrawEndpieceDeltasDouble(savepoints[1],
3778
+ iDeltaX.value[0], iDeltaY.value[0], iDeltaY.value[0], -iDeltaX.value[0], deltapoints2);
3779
+ }
3780
+ }
3781
+
3782
+ points[counter] = new POINT2(deltapoints1[1]);
3783
+ points[counter].style = 9;
3784
+ counter++;
3785
+ points[counter] = new POINT2(deltapoints1[0]);
3786
+ points[counter].style = 9;
3787
+ counter++;
3788
+ points[counter] = new POINT2(deltapoints1[3]);
3789
+ points[counter].style = 9;
3790
+ counter++;
3791
+ points[counter] = new POINT2(deltapoints1[3]);
3792
+ points[counter].style = 10;
3793
+ counter++;
3794
+
3795
+ points[counter] = new POINT2(deltapoints2[1]);
3796
+ points[counter].style = 9;
3797
+ counter++;
3798
+ points[counter] = new POINT2(deltapoints2[0]);
3799
+ points[counter].style = 9;
3800
+ counter++;
3801
+ points[counter] = new POINT2(deltapoints2[3]);
3802
+ points[counter].style = 9;
3803
+ counter++;
3804
+ points[counter] = new POINT2(deltapoints2[3]);
3805
+ points[counter].style = 10;
3806
+ counter++;
3807
+
3808
+ } catch (exc) {
3809
+ if (exc instanceof Error) {
3810
+ ErrorLogger.LogException(DISMSupport._className, "GetDISMEasyDouble",
3811
+ new RendererException("Failed inside GetDISMEasyDouble", exc));
3812
+ } else {
3813
+ throw exc;
3814
+ }
3815
+ }
3816
+ return counter;
3817
+ }
3818
+
3819
+ /**
3820
+ * Calculates the points for AMBUSH
3821
+ *
3822
+ * @param pLinePoints - OUT - the client points, also used for the returned points.
3823
+ */
3824
+ static AmbushPointsDouble(pLinePoints: POINT2[]): int {
3825
+ let counter: int = 0;
3826
+ try {
3827
+ let pts: POINT2[] = new Array<POINT2>(3);
3828
+ let savepoints: POINT2[] = new Array<POINT2>(3);
3829
+ // calculate midpoint
3830
+ let ptMid: POINT2 = new POINT2();
3831
+ let dRadius: double = 0;
3832
+ let d: double = 0;
3833
+ let dAngle1: double = 0;
3834
+ let dAngle1c: double = 0;
3835
+ let dAngle2c: double = 0;
3836
+ let dAngle12c: double = 0;
3837
+ let dAngle0: double = 0;
3838
+ let arcpoints: POINT2[] = new Array<POINT2>(17);
3839
+ let dAngleTic: double = 0;
3840
+ let dDeltaX1: double = 0;
3841
+ let dDeltaY1: double = 0;
3842
+ let dDeltaX2: double = 0;
3843
+ let dDeltaY2: double = 0;
3844
+ let ptCenter: POINT2 = new POINT2();
3845
+ let j: int = 0;
3846
+ let i: int = 0;
3847
+ let iArrowLength: double = 0;
3848
+
3849
+ for (j = 0; j < 3; j++) {
3850
+ savepoints[j] = new POINT2(pLinePoints[j]);
3851
+ }
3852
+
3853
+ //initialize the pOINT2 arrays
3854
+ lineutility.InitializePOINT2Array(arcpoints);
3855
+ lineutility.InitializePOINT2Array(pts);
3856
+
3857
+ ptMid.x = (savepoints[1].x + savepoints[2].x) / 2;
3858
+ ptMid.y = (savepoints[1].y + savepoints[2].y) / 2;
3859
+
3860
+ // calculate arc center
3861
+ dRadius = Math.sqrt((ptMid.x - savepoints[2].x) * (ptMid.x - savepoints[2].x) +
3862
+ (ptMid.y - savepoints[2].y) * (ptMid.y - savepoints[2].y));
3863
+
3864
+ // add section M. Deutch 8-25-05
3865
+ //consider the other possiblity for a center
3866
+ let dRadius2: double = Math.sqrt((ptMid.x - savepoints[1].x) * (ptMid.x - savepoints[1].x) +
3867
+ (ptMid.y - savepoints[1].y) * (ptMid.y - savepoints[1].y));
3868
+
3869
+ dAngle1 = Math.atan2(savepoints[1].y - savepoints[2].y, savepoints[1].x - savepoints[2].x);
3870
+ ptCenter.x = ptMid.x + Math.cos(dAngle1 - DISMSupport.CONST_PI / 2) * dRadius;
3871
+ ptCenter.y = ptMid.y + Math.sin(dAngle1 - DISMSupport.CONST_PI / 2) * dRadius;
3872
+
3873
+ //added section M. Deutch 8-25-05
3874
+ //consider the other possibility for a center if the points were reversed
3875
+ let dAngle2: double = Math.atan2(savepoints[2].y - savepoints[1].y, savepoints[2].x - savepoints[1].x);
3876
+ let ptCenter2: POINT2 = new POINT2();
3877
+ ptCenter2.x = ptMid.x + Math.cos(dAngle2 - DISMSupport.CONST_PI / 2) * dRadius;
3878
+ ptCenter2.y = ptMid.y + Math.sin(dAngle2 - DISMSupport.CONST_PI / 2) * dRadius;
3879
+ let dist: double = lineutility.CalcDistanceDouble(savepoints[0], ptCenter);
3880
+ let dist2: double = lineutility.CalcDistanceDouble(savepoints[0], ptCenter2);
3881
+ //if the distance to the new center is closer
3882
+ //then reverse the arc endpoints
3883
+ if (dist2 > dist) {
3884
+ //POINT2 ptTemp=new POINT2();
3885
+ let ptTemp: POINT2 = new POINT2(savepoints[1]);
3886
+ savepoints[1] = new POINT2(savepoints[2]);
3887
+ savepoints[2] = new POINT2(ptTemp);
3888
+ ptCenter = new POINT2(ptCenter2);
3889
+ dAngle1 = dAngle2;
3890
+ }
3891
+ //end section
3892
+
3893
+ dRadius = Math.sqrt((savepoints[1].x - ptCenter.x) * (savepoints[1].x - ptCenter.x) +
3894
+ (savepoints[1].y - ptCenter.y) * (savepoints[1].y - ptCenter.y));
3895
+
3896
+ // draw arc
3897
+ DISMSupport.ArcApproximationDouble((ptCenter.x - dRadius), (ptCenter.y - dRadius),
3898
+ (ptCenter.x + dRadius), (ptCenter.y + dRadius),
3899
+ savepoints[2].x, savepoints[2].y, savepoints[1].x, savepoints[1].y, arcpoints);
3900
+
3901
+ for (j = 0; j < 17; j++) {
3902
+ pLinePoints[counter] = new POINT2(arcpoints[j]);
3903
+ pLinePoints[counter].style = 0;
3904
+ counter++;
3905
+ }
3906
+ pLinePoints[counter - 1].style = 5;
3907
+
3908
+ // draw line out from arc to point 1
3909
+ pts[0] = new POINT2(savepoints[0]);
3910
+ dAngle1c = Math.atan2(ptCenter.y - savepoints[1].y, ptCenter.x - savepoints[1].x);
3911
+ dAngle2c = Math.atan2(ptCenter.y - savepoints[2].y, ptCenter.x - savepoints[2].x);
3912
+ dAngle12c = (dAngle1c + dAngle2c) / 2;
3913
+ if ((dAngle1c > 0) && (dAngle2c < 0)) {
3914
+ pts[1].x = ptCenter.x + Math.cos(dAngle12c) * dRadius;
3915
+ pts[1].y = ptCenter.y + Math.sin(dAngle12c) * dRadius;
3916
+ }
3917
+ else {
3918
+ pts[1].x = ptCenter.x - Math.cos(dAngle12c) * dRadius;
3919
+ pts[1].y = ptCenter.y - Math.sin(dAngle12c) * dRadius;
3920
+ }
3921
+ pLinePoints[counter] = new POINT2(pts[0]);
3922
+ pLinePoints[counter].style = 0; counter++;
3923
+ pLinePoints[counter] = new POINT2(pts[1]);
3924
+ pLinePoints[counter].style = 5; counter++;
3925
+
3926
+
3927
+ // draw arrowhead on end of line
3928
+ dAngle0 = Math.atan2(pts[1].y - savepoints[0].y, pts[1].x - savepoints[0].x);
3929
+ iArrowLength = (
3930
+ (
3931
+ Math.sqrt // height of graphic
3932
+ (
3933
+ (savepoints[1].x - savepoints[2].x) * (savepoints[1].x - savepoints[2].x) +
3934
+ (savepoints[1].y - savepoints[2].y) * (savepoints[1].y - savepoints[2].y)
3935
+ ) +
3936
+ Math.sqrt // length of graphic
3937
+ (
3938
+ (savepoints[0].x - ptMid.x) * (savepoints[0].x - ptMid.x) +
3939
+ (savepoints[0].y - ptMid.y) * (savepoints[0].y - ptMid.y)
3940
+ )
3941
+ ) / 20);
3942
+
3943
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
3944
+ if (iArrowLength > DISMSupport.maxLength * DPIScaleFactor) {
3945
+
3946
+ iArrowLength = DISMSupport.maxLength as int * DPIScaleFactor;
3947
+ }
3948
+
3949
+ if (iArrowLength < DISMSupport.minLength * DPIScaleFactor) {
3950
+
3951
+ iArrowLength = DISMSupport.minLength as int * DPIScaleFactor;
3952
+ }
3953
+
3954
+
3955
+ pts[0].x = savepoints[0].x + Math.cos(dAngle0 + DISMSupport.CONST_PI / 6) * iArrowLength;
3956
+ pts[0].y = savepoints[0].y + Math.sin(dAngle0 + DISMSupport.CONST_PI / 6) * iArrowLength;
3957
+ pts[1] = savepoints[0];
3958
+ pts[2].x = savepoints[0].x + Math.cos(dAngle0 - DISMSupport.CONST_PI / 6) * iArrowLength;
3959
+ pts[2].y = savepoints[0].y + Math.sin(dAngle0 - DISMSupport.CONST_PI / 6) * iArrowLength;
3960
+ for (j = 0; j < 3; j++) {
3961
+ pLinePoints[counter] = new POINT2(pts[j]);
3962
+ pLinePoints[counter].style = 0;
3963
+ counter++;
3964
+ }
3965
+ pLinePoints[counter - 1].style = 5;
3966
+
3967
+ // draw lines out from arc toward back of graphic
3968
+ d = dRadius / 3;
3969
+ if (d > DISMSupport.maxLength * DPIScaleFactor) {
3970
+
3971
+ d = DISMSupport.maxLength * DPIScaleFactor;
3972
+ }
3973
+
3974
+ if (d < DISMSupport.minLength * DPIScaleFactor) {
3975
+
3976
+ d = DISMSupport.minLength * DPIScaleFactor;
3977
+ }
3978
+
3979
+
3980
+ dAngleTic = DISMSupport.CONST_PI / 18; // angle in radians between tic-marks
3981
+ dDeltaX2 = Math.cos(dAngle1 + DISMSupport.CONST_PI / 2) * d;
3982
+ dDeltaY2 = Math.sin(dAngle1 + DISMSupport.CONST_PI / 2) * d;
3983
+ for (i = 0; i < 8; i++) {
3984
+ dAngle1c += dAngleTic;
3985
+ dDeltaX1 = Math.cos(dAngle1c) * dRadius;
3986
+ dDeltaY1 = Math.sin(dAngle1c) * dRadius;
3987
+ pts[0].x = ptCenter.x - dDeltaX1;
3988
+ pts[0].y = ptCenter.y - dDeltaY1;
3989
+ pLinePoints[counter] = new POINT2(pts[0]);
3990
+ pLinePoints[counter].style = 0;
3991
+ counter++;
3992
+ pts[1].x = pts[0].x - dDeltaX2;
3993
+ pts[1].y = pts[0].y - dDeltaY2;
3994
+ pLinePoints[counter] = new POINT2(pts[1]);
3995
+ pLinePoints[counter].style = 5;
3996
+ counter++;
3997
+ }
3998
+ } catch (exc) {
3999
+ if (exc instanceof Error) {
4000
+ ErrorLogger.LogException(DISMSupport._className, "AmbushPointsDouble",
4001
+ new RendererException("Failed inside AmbushPointsDouble", exc));
4002
+ } else {
4003
+ throw exc;
4004
+ }
4005
+ }
4006
+ return counter;
4007
+ }
4008
+ }