@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,2971 @@
1
+ /*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+
7
+ //import java.awt.Color;
8
+
9
+ import { type double, type int, type long } from "../graphics2d/BasicTypes";
10
+
11
+
12
+
13
+ import { arraysupport } from "../JavaLineArray/arraysupport"
14
+ import { CChannelPoints2 } from "../JavaLineArray/CChannelPoints2"
15
+ import { flot } from "../JavaLineArray/flot"
16
+ import { lineutility } from "../JavaLineArray/lineutility"
17
+ import { POINT2 } from "../JavaLineArray/POINT2"
18
+ import { ref } from "../JavaLineArray/ref"
19
+ import { Shape2 } from "../JavaLineArray/Shape2"
20
+ import { TacticalLines } from "../JavaLineArray/TacticalLines"
21
+
22
+ import { TGLight } from "../JavaTacticalRenderer/TGLight"
23
+
24
+ import { Color } from "../renderer/utilities/Color"
25
+ import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
26
+
27
+ import { RendererException } from "../renderer/utilities/RendererException"
28
+ import { RendererSettings } from "../renderer/utilities/RendererSettings"
29
+
30
+
31
+ /**
32
+ * CELineArray Channels class calculates the channel points
33
+ *
34
+ */
35
+ export class Channels {
36
+ private static readonly maxLength: double = 100;//max arrow size
37
+ private static readonly minLength: double = 5; //max arrow size
38
+ private static readonly _className: string = "Channels";
39
+ private static _client: string = "";
40
+ public static setClient(value: string): void {
41
+ Channels._client = value;
42
+ }
43
+ // private static String _affiliation="";
44
+ // public static void setAffiliation(String value)
45
+ // {
46
+ // _affiliation=value;
47
+ // }
48
+ private static _shiftLines: boolean = true;
49
+ // public static void setShiftLines(boolean value)
50
+ // {
51
+ // _shiftLines=value;
52
+ // }
53
+ public static getShiftLines(): boolean {
54
+ return Channels._shiftLines;
55
+ }
56
+ private static ConnectArrayTrueDouble(nWidth: int,
57
+ nCounter: int,
58
+ pLinePoints: POINT2[],
59
+ pResultChannelPoints: CChannelPoints2[]): CChannelPoints2[] {
60
+ try {
61
+ //declarations
62
+ let nPointCounter: int = 0;
63
+ let nDiff1X: double = 0;
64
+ let
65
+ nDiff2X: double = 0;
66
+ let
67
+ nDiff1Y: double = 0;
68
+ let
69
+ nDiff2Y: double = 0;
70
+ let nLast: int = 0;
71
+ let lOrient: int = 0;
72
+ let LinePoint1: POINT2 = new POINT2(pLinePoints[0]);
73
+ let
74
+ LinePoint2: POINT2 = new POINT2(pLinePoints[0]);
75
+ let
76
+ LinePoint3: POINT2 = new POINT2(pLinePoints[0]);
77
+
78
+ //POINT2 EndPoint1=new POINT2(pLinePoints[0]);
79
+ //POINT2 EndPoint2=new POINT2(pLinePoints[0]);
80
+ let ResultChannelPoint: CChannelPoints2 = new CChannelPoints2();
81
+ //end declarations
82
+
83
+ //must establish nLast before we get the first channel end point
84
+ //put first GetEndPoint into the pResultChannelPoints array
85
+ LinePoint1 = new POINT2(pLinePoints[0]);
86
+ LinePoint2 = new POINT2(pLinePoints[1]);
87
+ nDiff1X = LinePoint2.x - LinePoint1.x;
88
+ nDiff1Y = LinePoint2.y - LinePoint1.y;
89
+ if (nDiff1X === 0) {
90
+ if (nDiff1Y > 0) {
91
+
92
+ nLast = 6;
93
+ }
94
+
95
+ if (nDiff1Y < 0) {
96
+
97
+ nLast = 4;
98
+ }
99
+
100
+ }
101
+ if (nDiff1Y === 0) {
102
+ if (nDiff1X > 0) {
103
+
104
+ nLast = 0;
105
+ }
106
+
107
+ if (nDiff1X < 0) {
108
+
109
+ nLast = 2;
110
+ }
111
+
112
+ }
113
+ if (nDiff1X < 0 && nDiff1Y > 0) {
114
+
115
+ nLast = 3;
116
+ }
117
+
118
+ if (nDiff1X > 0 && nDiff1Y > 0) {
119
+
120
+ nLast = 0;
121
+ }
122
+
123
+ if (nDiff1X < 0 && nDiff1Y < 0) {
124
+
125
+ nLast = 3;
126
+ }
127
+
128
+ if (nDiff1X > 0 && nDiff1Y < 0) {
129
+
130
+ nLast = 0;
131
+ }
132
+
133
+
134
+ ResultChannelPoint = Channels.GetTrueEndPointDouble(nWidth, pLinePoints[0], pLinePoints[1], nLast);
135
+ pResultChannelPoints[0] = new CChannelPoints2(ResultChannelPoint);
136
+ //initialize nLast depending on the first 1 or 2 segments
137
+
138
+ //stuff the array
139
+ //nLast needs to indicate if the last segment2 had line1 above or below it
140
+ for (nPointCounter = 1; nPointCounter < nCounter; nPointCounter++) {
141
+ LinePoint1 = new POINT2(pLinePoints[nPointCounter - 1]);
142
+ LinePoint2 = new POINT2(pLinePoints[nPointCounter]);
143
+ LinePoint3 = new POINT2(pLinePoints[nPointCounter + 1]);
144
+ nDiff1X = LinePoint2.x - LinePoint1.x;
145
+ nDiff2X = LinePoint3.x - LinePoint2.x;
146
+ nDiff1Y = LinePoint2.y - LinePoint1.y;
147
+ nDiff2Y = LinePoint3.y - LinePoint2.y;
148
+
149
+ //determine nLast to use in the next iteration
150
+ //nLast=0: last segment2 was left to right and line1 above it
151
+ //nLast=1: last segment2 was left to right and line1 below it
152
+ //nLast=2: last segment2 was right to left and line1 above it
153
+ //nLast=3: last segment2 was right to left and line1 below it
154
+ //nLast=4: last segment2 was vertical upward and line1 above (to the left of it)
155
+ //nLast=5: last segment2 was vertical upward and line1 below (to the right of it)
156
+ //nLast=6: last segment2 was vertical downward and line1 above (to the left of it)
157
+ //nLast=7: last segment2 was vertical downward and line1 below (to the right of it)
158
+ if (nDiff1X > 0 && nDiff2X > 0) //pt1------pt2------pt3
159
+ {
160
+ switch (nLast) {
161
+ case 0:
162
+ case 3:
163
+ case 4:
164
+ case 7: {
165
+ lOrient = 0; //above & above
166
+ break;
167
+ }
168
+
169
+ case 1:
170
+ case 2:
171
+ case 5:
172
+ case 6: {
173
+ lOrient = 3; //below & below
174
+ break;
175
+ }
176
+
177
+ default: {
178
+ break;
179
+ }
180
+
181
+ }
182
+ }
183
+
184
+ // pt1-----pt2 or pt3
185
+ // | |
186
+ // | |
187
+ // | |
188
+ // pt3 pt1-----pt2
189
+ if (nDiff1X > 0 && nDiff2X === 0) {
190
+ switch (nLast) {
191
+ case 0:
192
+ case 3:
193
+ case 4:
194
+ case 7: {
195
+ if (nDiff2Y > 0) {
196
+
197
+ lOrient = 1;
198
+ }
199
+ //above & below
200
+ if (nDiff2Y < 0) {
201
+
202
+ lOrient = 0;
203
+ }
204
+ //above & above
205
+ break;
206
+ }
207
+
208
+ case 1:
209
+ case 2:
210
+ case 5:
211
+ case 6: {
212
+ if (nDiff2Y > 0) {
213
+
214
+ lOrient = 2;
215
+ }
216
+
217
+ if (nDiff2Y < 0) {
218
+
219
+ lOrient = 3;
220
+ }
221
+
222
+ break;
223
+ }
224
+
225
+ default: {
226
+ break;
227
+ }
228
+
229
+ }
230
+ }
231
+
232
+ // pt2-----pt1 or pt3
233
+ // | |
234
+ // | |
235
+ // | |
236
+ // pt3 pt2-----pt1
237
+ if (nDiff1X < 0 && nDiff2X === 0) {
238
+ switch (nLast) {
239
+ case 0:
240
+ case 3:
241
+ case 4:
242
+ case 7: {
243
+ if (nDiff2Y > 0) {
244
+
245
+ lOrient = 3;
246
+ }
247
+
248
+ if (nDiff2Y < 0) {
249
+
250
+ lOrient = 2;
251
+ }
252
+
253
+ break;
254
+ }
255
+
256
+ case 1:
257
+ case 2:
258
+ case 5:
259
+ case 6: {
260
+ if (nDiff2Y > 0) {
261
+
262
+ lOrient = 0;
263
+ }
264
+
265
+ if (nDiff2Y < 0) {
266
+
267
+ lOrient = 1;
268
+ }
269
+
270
+ break;
271
+ }
272
+
273
+ default: {
274
+ break;
275
+ }
276
+
277
+ }
278
+ }
279
+
280
+ // pt2-----pt3 or pt1
281
+ // | |
282
+ // | |
283
+ // | |
284
+ // pt1 pt2-----pt3
285
+ if (nDiff1X === 0 && nDiff2X > 0) {
286
+ switch (nLast) {
287
+ case 0:
288
+ case 3:
289
+ case 4:
290
+ case 7: {
291
+ if (nDiff1Y > 0) {
292
+
293
+ lOrient = 2;
294
+ }
295
+
296
+ if (nDiff1Y < 0) {
297
+
298
+ lOrient = 0;
299
+ }
300
+
301
+ break;
302
+ }
303
+
304
+ case 1:
305
+ case 2:
306
+ case 5:
307
+ case 6: {
308
+ if (nDiff1Y > 0) {
309
+
310
+ lOrient = 1;
311
+ }
312
+
313
+ if (nDiff1Y < 0) {
314
+
315
+ lOrient = 3;
316
+ }
317
+
318
+ break;
319
+ }
320
+
321
+ default: {
322
+ break;
323
+ }
324
+
325
+ }
326
+ }
327
+
328
+ // pt3-----pt2 or pt1
329
+ // | |
330
+ // | |
331
+ // | |
332
+ // pt1 pt3-----pt2
333
+ if (nDiff1X === 0 && nDiff2X < 0) {
334
+ switch (nLast) {
335
+ case 0:
336
+ case 3:
337
+ case 4:
338
+ case 7: {
339
+ if (nDiff1Y > 0) {
340
+
341
+ lOrient = 3;
342
+ }
343
+
344
+ if (nDiff1Y < 0) {
345
+
346
+ lOrient = 1;
347
+ }
348
+
349
+ break;
350
+ }
351
+
352
+ case 1:
353
+ case 2:
354
+ case 5:
355
+ case 6: {
356
+ if (nDiff1Y > 0) {
357
+
358
+ lOrient = 0;
359
+ }
360
+
361
+ if (nDiff1Y < 0) {
362
+
363
+ lOrient = 2;
364
+ }
365
+
366
+ break;
367
+ }
368
+
369
+ default: {
370
+ break;
371
+ }
372
+
373
+ }
374
+ }
375
+
376
+
377
+ if (nDiff1X < 0 && nDiff2X < 0) //pt3-----pt2------pt1
378
+ {
379
+ switch (nLast) {
380
+ case 0:
381
+ case 3:
382
+ case 4:
383
+ case 7: {
384
+ lOrient = 3; //below & below
385
+ break;
386
+ }
387
+
388
+ case 1:
389
+ case 2:
390
+ case 5:
391
+ case 6: {
392
+ lOrient = 0; //above & above
393
+ break;
394
+ }
395
+
396
+ default: {
397
+ break;
398
+ }
399
+
400
+ }
401
+ }
402
+
403
+ // pt1\
404
+ // \
405
+ // \pt2
406
+ // /
407
+ // /
408
+ // pt3/
409
+ if (nDiff1X > 0 && nDiff2X < 0) {
410
+ switch (nLast) {
411
+ case 0:
412
+ case 3:
413
+ case 4:
414
+ case 7: {
415
+ lOrient = 1; //above & below
416
+ break;
417
+ }
418
+
419
+ case 1:
420
+ case 2:
421
+ case 5:
422
+ case 6: {
423
+ lOrient = 2; //below & above
424
+ break;
425
+ }
426
+
427
+ default: {
428
+ break;
429
+ }
430
+
431
+ }
432
+ }
433
+
434
+ // pt1
435
+ // /
436
+ // /
437
+ // pt2/
438
+ // \
439
+ // \
440
+ // \pt3
441
+ if (nDiff1X < 0 && nDiff2X > 0) {
442
+ switch (nLast) {
443
+ case 0:
444
+ case 3:
445
+ case 4:
446
+ case 7: {
447
+ lOrient = 2; //below & above
448
+ break;
449
+ }
450
+
451
+ case 1:
452
+ case 2:
453
+ case 5:
454
+ case 6: {
455
+ lOrient = 1; //above & below
456
+ break;
457
+ }
458
+
459
+ default: {
460
+ break;
461
+ }
462
+
463
+ } //end switch(nLast)
464
+ } //end if
465
+
466
+
467
+ // pt1 or pt3
468
+ // | |
469
+ // | |
470
+ // pt2 pt2
471
+ // | |
472
+ // | |
473
+ // pt3 pt1
474
+ if (nDiff1X === 0 && nDiff2X === 0) {
475
+ switch (nLast) {
476
+ case 4: {
477
+ if (nDiff2Y < 0) {
478
+
479
+ lOrient = 0;
480
+ }
481
+
482
+ break;
483
+ }
484
+
485
+ case 6: {
486
+ if (nDiff2Y > 0) {
487
+
488
+ lOrient = 0;
489
+ }
490
+
491
+ break;
492
+ }
493
+
494
+ case 5: {
495
+ if (nDiff2Y < 0) {
496
+
497
+ lOrient = 3;
498
+ }
499
+
500
+ break;
501
+ }
502
+
503
+ case 7: {
504
+ if (nDiff2Y > 0) {
505
+
506
+ lOrient = 3;
507
+ }
508
+
509
+ break;
510
+ }
511
+
512
+ default: {
513
+ break;
514
+ }
515
+
516
+ }
517
+ }
518
+
519
+ //get the channel points based on the desired orientation
520
+ pResultChannelPoints[nPointCounter] = Channels.ConnectTrueDouble2(nWidth, LinePoint1,
521
+ LinePoint2, LinePoint3, lOrient);
522
+
523
+ //2nd segment vertical
524
+ if (nDiff2X === 0) {
525
+ switch (lOrient) {
526
+ case 0: {
527
+ if (nDiff2Y > 0) {
528
+ nLast = 6;
529
+ }
530
+ if (nDiff2Y < 0) {
531
+ nLast = 4;
532
+ }
533
+ break;
534
+ }
535
+
536
+ case 1: {
537
+ if (nDiff2Y > 0) {
538
+ nLast = 7;
539
+ }
540
+ if (nDiff2Y < 0) {
541
+ nLast = 5;
542
+ }
543
+ break;
544
+ }
545
+
546
+ case 2: {
547
+ if (nDiff2Y > 0) {
548
+ nLast = 6;
549
+ }
550
+ if (nDiff2Y < 0) {
551
+ nLast = 4;
552
+ }
553
+ break;
554
+ }
555
+
556
+ case 3: {
557
+ if (nDiff2Y > 0) {
558
+ nLast = 7;
559
+ }
560
+ if (nDiff2Y < 0) {
561
+ nLast = 5;
562
+ }
563
+ break;
564
+ }
565
+
566
+ default: {
567
+ break;
568
+ }
569
+
570
+ }
571
+ }
572
+ //pt2--------pt3
573
+ if (nDiff2X > 0) {
574
+ switch (lOrient) {
575
+ case 0: { //above & above
576
+ nLast = 0;
577
+ break;
578
+ }
579
+
580
+ case 1: { //above & below
581
+ nLast = 1;
582
+ break;
583
+ }
584
+
585
+ case 2: { //below & above
586
+ nLast = 0;
587
+ break;
588
+ }
589
+
590
+ case 3: { //below & below
591
+ nLast = 1;
592
+ break;
593
+ }
594
+
595
+ default: {
596
+ break;
597
+ }
598
+
599
+ }
600
+ //break;
601
+ }
602
+ //pt3--------pt2
603
+ if (nDiff2X < 0) {
604
+ switch (lOrient) {
605
+ case 0: { //above & above
606
+ nLast = 2;
607
+ break;
608
+ }
609
+
610
+ case 1: { //above & below
611
+ nLast = 3;
612
+ break;
613
+ }
614
+
615
+ case 2: { //below & above
616
+ nLast = 2;
617
+ break;
618
+ }
619
+
620
+ case 3: { //below & below
621
+ nLast = 3;
622
+ break;
623
+ }
624
+
625
+ default: {
626
+ break;
627
+ }
628
+
629
+ }
630
+ }
631
+ } //end for
632
+
633
+ ResultChannelPoint = Channels.GetTrueEndPointDouble(nWidth, pLinePoints[nCounter],
634
+ pLinePoints[nCounter - 1], nLast);
635
+
636
+ pResultChannelPoints[nCounter] = new CChannelPoints2(ResultChannelPoint);
637
+ } catch (exc) {
638
+ if (exc instanceof Error) {
639
+ //console.log(e.message);
640
+ ErrorLogger.LogException(Channels._className, "ConnectArrayTrueDouble",
641
+ new RendererException("Failed inside ConnectArrayTrueDouble", exc));
642
+ } else {
643
+ throw exc;
644
+ }
645
+ }
646
+ return pResultChannelPoints;
647
+ }
648
+ private static GetChannel2Double(nChannelWidth: int,
649
+ vblCounter: int,
650
+ pLinePoints: POINT2[],
651
+ pResultChannelPoints: CChannelPoints2[]): CChannelPoints2[] {
652
+ try {
653
+ pResultChannelPoints = Channels.ConnectArrayTrueDouble(Math.trunc(nChannelWidth / 2), Math.trunc(vblCounter) - 1,
654
+ pLinePoints, pResultChannelPoints);
655
+
656
+ } catch (exc) {
657
+ if (exc instanceof Error) {
658
+ ErrorLogger.LogException(Channels._className, "GetChannel2Double",
659
+ new RendererException("Failed inside GetChannel2Double", exc));
660
+ } else {
661
+ throw exc;
662
+ }
663
+ }
664
+ return pResultChannelPoints;
665
+ }
666
+
667
+ private static GetLowerChannelLineDouble(pChannelPoints: CChannelPoints2[],
668
+ vblCounter: int,
669
+ pResultLinePoints: POINT2[]): POINT2[] {
670
+ try {
671
+ let j: int = 0;
672
+
673
+ for (j = 0; j < vblCounter; j++) {
674
+ pResultLinePoints[j] = new POINT2(pChannelPoints[j].m_Line1);
675
+ }
676
+
677
+ } catch (exc) {
678
+ if (exc instanceof Error) {
679
+ ErrorLogger.LogException(Channels._className, "GetLowerChannelLineDouble",
680
+ new RendererException("GetLowerChannelLineDouble", exc));
681
+ } else {
682
+ throw exc;
683
+ }
684
+ }
685
+ return pResultLinePoints;
686
+ }
687
+ private static GetUpperChannelLineDouble(pChannelPoints: CChannelPoints2[],
688
+ vblCounter: int,
689
+ pResultLinePoints: POINT2[]): POINT2[] {
690
+ try {
691
+ let j: int = 0;
692
+ for (j = 0; j < vblCounter; j++) {
693
+ pResultLinePoints[j] = new POINT2(pChannelPoints[j].m_Line2);
694
+ }
695
+
696
+ } catch (exc) {
697
+ if (exc instanceof Error) {
698
+ ErrorLogger.LogException(Channels._className, "GetUpperChannelLineDouble",
699
+ new RendererException("Failed inside GetUpperChannelLineDouble", exc));
700
+ } else {
701
+ throw exc;
702
+ }
703
+ }
704
+ return pResultLinePoints;
705
+ }
706
+ private static FenceType(linetype: int): int {
707
+ let bolResult: int = 0;
708
+ try {
709
+ switch (linetype) {
710
+ case TacticalLines.TRIPLE:
711
+ case TacticalLines.DOUBLEC:
712
+ case TacticalLines.SINGLEC:
713
+ case TacticalLines.HWFENCE:
714
+ case TacticalLines.LWFENCE:
715
+ case TacticalLines.UNSP:
716
+ case TacticalLines.DOUBLEA:
717
+ case TacticalLines.SFENCE:
718
+ case TacticalLines.DFENCE: {
719
+ bolResult = 1;
720
+ break;
721
+ }
722
+
723
+ default: {
724
+ bolResult = 0;
725
+ break;
726
+ }
727
+
728
+ }
729
+ } catch (exc) {
730
+ if (exc instanceof Error) {
731
+ ErrorLogger.LogException(Channels._className, "FenceType",
732
+ new RendererException("Failed inside FenceType " + linetype.toString(), exc));
733
+ } else {
734
+ throw exc;
735
+ }
736
+ }
737
+ return bolResult;
738
+ }
739
+ /**
740
+ * Calculates the point count for the concertina wire and fence channels.
741
+ *
742
+ * @param pLinePoints client points
743
+ * @param vblCounter the client point count
744
+ * @param linetype the line type
745
+ *
746
+ * @return the number of points required to render the symbol
747
+ */
748
+ static GetTripleCountDouble(pLinePoints: POINT2[],
749
+ vblCounter: int,
750
+ linetype: int): int {
751
+ let lTotal: int = 0;
752
+ try {
753
+ //declarations
754
+ let j: int = 0;
755
+ let lHowManyThisSegment: int = 0;
756
+ let d: double = 0;
757
+ //end declarations
758
+
759
+ for (j = 0; j < vblCounter - 1; j++) {
760
+ d = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
761
+ if (d <= 10) {
762
+ lHowManyThisSegment = 0;
763
+ } else {
764
+ lHowManyThisSegment = Math.trunc((d - 10) / 10);
765
+ }
766
+
767
+ lTotal += lHowManyThisSegment;
768
+ }
769
+
770
+ switch (linetype) {
771
+ case TacticalLines.SINGLEC:
772
+ case TacticalLines.DOUBLEC:
773
+ case TacticalLines.TRIPLE: {
774
+ lTotal = 6 * vblCounter + 37 * lTotal; //was 2*vblCounter+37*lTotal
775
+ break;
776
+ }
777
+
778
+ case TacticalLines.HWFENCE:
779
+ case TacticalLines.LWFENCE:
780
+ case TacticalLines.UNSP:
781
+ case TacticalLines.DOUBLEA:
782
+ case TacticalLines.SFENCE:
783
+ case TacticalLines.DFENCE: {
784
+ lTotal = 4 * vblCounter + 4 * lTotal;
785
+ break;
786
+ }
787
+
788
+ case TacticalLines.BBS_LINE: {
789
+ lTotal = 2 * vblCounter + 1;
790
+ break;
791
+ }
792
+
793
+ default: {
794
+ lTotal = 2 * vblCounter;
795
+ break;
796
+ }
797
+
798
+ }
799
+ } catch (exc) {
800
+ if (exc instanceof Error) {
801
+ ErrorLogger.LogException(Channels._className, "GetTripleCountDouble",
802
+ new RendererException("Failed inside GetTripleCountDouble " + linetype.toString(), exc));
803
+ } else {
804
+ throw exc;
805
+ }
806
+ }
807
+ return lTotal;
808
+ }
809
+
810
+ protected static CoordIL2Double(nPrinter: int,
811
+ pLinePoints: POINT2[],
812
+ nUpperLower: int,
813
+ vblCounter: int,
814
+ linetype: int,
815
+ vblChannelWidth: int): POINT2[] {
816
+ let pLinePoints2: POINT2[] = new Array<POINT2>(vblCounter);
817
+ try {
818
+ //declarations
819
+ let j: int = 0;
820
+ let channelWidth: int = 20;
821
+ let pNewLinePoints: POINT2[] = new Array<POINT2>(vblCounter);
822
+ let pChannelPoints: CChannelPoints2[] = new Array<CChannelPoints2>(vblCounter);
823
+ //end declarations
824
+
825
+ lineutility.InitializePOINT2Array(pLinePoints2);
826
+ for (j = 0; j < vblCounter; j++) {
827
+ pNewLinePoints[j] = new POINT2(pLinePoints[j]);
828
+ }
829
+
830
+ channelWidth = vblChannelWidth;
831
+
832
+ if (linetype !== TacticalLines.LC) {
833
+ channelWidth /= 2;
834
+ }
835
+
836
+ pChannelPoints = Channels.GetChannel2Double(channelWidth * nPrinter,
837
+ vblCounter,
838
+ pNewLinePoints,
839
+ pChannelPoints);
840
+
841
+ if (nUpperLower === 1) {
842
+ pNewLinePoints = Channels.GetUpperChannelLineDouble(pChannelPoints,
843
+ vblCounter,
844
+ pNewLinePoints);
845
+
846
+ for (j = 0; j < vblCounter; j++) {
847
+ pLinePoints2[j] = new POINT2(pNewLinePoints[j]);
848
+ }
849
+ }
850
+
851
+ if (nUpperLower === 0) {
852
+ pNewLinePoints = Channels.GetLowerChannelLineDouble(pChannelPoints,
853
+ vblCounter,
854
+ pNewLinePoints);
855
+
856
+ for (j = 0; j < vblCounter; j++) {
857
+ pLinePoints2[j] = new POINT2(pNewLinePoints[j]);
858
+ }
859
+ }
860
+ } catch (exc) {
861
+ if (exc instanceof Error) {
862
+ ErrorLogger.LogException(Channels._className, "CoordIL2Double",
863
+ new RendererException("Failed inside CoordIL2Double", exc));
864
+ } else {
865
+ throw exc;
866
+ }
867
+ }
868
+ return pLinePoints2;
869
+ }
870
+
871
+ /**
872
+ * gets the axis of advance arrowhead
873
+ * @param dPrinter
874
+ * @param pLowerLinePoints
875
+ * @param lLowerCounter
876
+ * @param pUpperLinePoints
877
+ * @param lUpperCounter
878
+ * @param ArrowLinePoint
879
+ * @param pLinePoints
880
+ * @param vbiDrawThis
881
+ * @param dOffsetFactor
882
+ */
883
+ private static GetAXADDouble(dPrinter: double,
884
+ pLowerLinePoints: POINT2[],
885
+ lLowerCounter: int,
886
+ pUpperLinePoints: POINT2[],
887
+ lUpperCounter: int,
888
+ ArrowLinePoint: POINT2,
889
+ pLinePoints: POINT2[],
890
+ vbiDrawThis: int,
891
+ dOffsetFactor: double): void {
892
+ try {
893
+ let j: int = 0;
894
+ let
895
+ lCounter: int = lLowerCounter + lUpperCounter + 8;
896
+ let x: double = 0;
897
+ let y: double = 0;
898
+ let OuterTipLinePoint: POINT2 = new POINT2(pUpperLinePoints[0]);
899
+ let
900
+ InnerTipLinePoint: POINT2 = new POINT2(pUpperLinePoints[0]);
901
+ let
902
+ EndLinePoint: POINT2 = new POINT2(pUpperLinePoints[0]);
903
+ let
904
+ TempLinePoint: POINT2 = new POINT2(pUpperLinePoints[0]);
905
+ let pt0: POINT2 = new POINT2();
906
+ let pt1: POINT2 = new POINT2();
907
+ //double dOffsetFactor = 10;
908
+ //end declarations
909
+
910
+ //10-19-12
911
+ //we must do this for catkbyfire because the rotary arrow tip now has to match the
912
+ //anchor point, i.e. the rotary feature can no longer stick out past the anchor point
913
+ //45 pixels shift here matches the 45 pixels shift for catkbyfire found in
914
+ //lineutility.adjustCATKBYFIREControlPoint as called by clsChannelUtility.DrawChannel
915
+ let origArrowPt: POINT2 = new POINT2(ArrowLinePoint);
916
+ let ptUpper0: POINT2 = new POINT2(pUpperLinePoints[lUpperCounter - 1]);
917
+ let ptLower0: POINT2 = new POINT2(pLowerLinePoints[lLowerCounter - 1]);
918
+ let dist: double = lineutility.CalcDistanceDouble(pLowerLinePoints[lLowerCounter - 1], pLowerLinePoints[lLowerCounter - 2]);
919
+ if (vbiDrawThis === TacticalLines.CATKBYFIRE) {
920
+ if (dist > 45) {
921
+ let midPt: POINT2 = lineutility.MidPointDouble(pLowerLinePoints[lLowerCounter - 2], pUpperLinePoints[lUpperCounter - 2], 0);
922
+ ArrowLinePoint = lineutility.ExtendAlongLineDouble(ArrowLinePoint, midPt, 45);
923
+ pLowerLinePoints[lLowerCounter - 1] = lineutility.ExtendAlongLineDouble(pLowerLinePoints[lLowerCounter - 1], pLowerLinePoints[lLowerCounter - 2], 45);//will be 45 if Oculus adjusts control point
924
+ pUpperLinePoints[lUpperCounter - 1] = lineutility.ExtendAlongLineDouble(pUpperLinePoints[lUpperCounter - 1], pUpperLinePoints[lUpperCounter - 2], 45);//will be 45 if Oculus adjusts control point
925
+ }
926
+ }
927
+ //end section
928
+
929
+ for (j = 0; j < lLowerCounter; j++) {
930
+ pLinePoints[j] = new POINT2(pLowerLinePoints[j]);
931
+ }
932
+
933
+ pLinePoints[lLowerCounter - 1].style = 5;
934
+
935
+ for (j = 0; j < lUpperCounter; j++) {
936
+ pLinePoints[lLowerCounter + j] = new POINT2(pUpperLinePoints[j]);
937
+ }
938
+
939
+ for (j = lCounter - 8; j < lCounter; j++) //initializations
940
+ {
941
+ pLinePoints[j] = new POINT2(pUpperLinePoints[0]);
942
+ }
943
+
944
+ EndLinePoint.x = Math.trunc((pLowerLinePoints[lLowerCounter - 1].x +
945
+ pUpperLinePoints[lUpperCounter - 1].x) as double / 2);
946
+
947
+ EndLinePoint.y = Math.trunc((pLowerLinePoints[lLowerCounter - 1].y +
948
+ pUpperLinePoints[lUpperCounter - 1].y) as double / 2);
949
+
950
+
951
+ x = (pLowerLinePoints[lLowerCounter - 1].x - pUpperLinePoints[lUpperCounter - 1].x) as double;
952
+ y = (pLowerLinePoints[lLowerCounter - 1].y - pUpperLinePoints[lUpperCounter - 1].y) as double;
953
+ x = x * x;
954
+ y = y * y;
955
+ //nBase = (int) Math.sqrt(x + y);
956
+
957
+ //nBase *= (int) dPrinter;
958
+
959
+ OuterTipLinePoint = new POINT2(ArrowLinePoint);
960
+ InnerTipLinePoint = lineutility.GetOffsetPointDouble(EndLinePoint, OuterTipLinePoint, - Math.trunc(dOffsetFactor * dPrinter));
961
+ pLinePoints[lCounter - 9].style = 5;
962
+ pLinePoints[lCounter - 8] = new POINT2(OuterTipLinePoint);
963
+
964
+ pt0.x = pUpperLinePoints[lUpperCounter - 1].x;
965
+ pt0.y = pUpperLinePoints[lUpperCounter - 1].y;
966
+ pt1.x = pLowerLinePoints[lLowerCounter - 1].x;
967
+ pt1.y = pLowerLinePoints[lLowerCounter - 1].y;
968
+ TempLinePoint = lineutility.GetOffsetPointDouble(pt0, pt1, Math.trunc(dOffsetFactor * dPrinter));
969
+
970
+ pLinePoints[lCounter - 7] = new POINT2(TempLinePoint);
971
+ pLinePoints[lCounter - 6] = new POINT2(pLowerLinePoints[lLowerCounter - 1]);
972
+ pLinePoints[lCounter - 5] = new POINT2(InnerTipLinePoint);
973
+ pLinePoints[lCounter - 4] = new POINT2(pUpperLinePoints[lUpperCounter - 1]);
974
+
975
+ pt0.x = pLowerLinePoints[lLowerCounter - 1].x;
976
+ pt0.y = pLowerLinePoints[lLowerCounter - 1].y;
977
+ pt1.x = pUpperLinePoints[lUpperCounter - 1].x;
978
+ pt1.y = pUpperLinePoints[lUpperCounter - 1].y;
979
+ TempLinePoint = lineutility.GetOffsetPointDouble(pt0, pt1, Math.trunc(dOffsetFactor * dPrinter));
980
+
981
+ pLinePoints[lCounter - 3] = new POINT2(TempLinePoint);
982
+ pLinePoints[lCounter - 2] = new POINT2(OuterTipLinePoint);
983
+ pLinePoints[lCounter - 1] = new POINT2(OuterTipLinePoint);
984
+ pLinePoints[lCounter - 1].style = 5;
985
+
986
+ switch (vbiDrawThis) {
987
+ case TacticalLines.SPT_STRAIGHT:
988
+ case TacticalLines.SPT:
989
+ case TacticalLines.AAAAA:
990
+ case TacticalLines.AIRAOA:
991
+ case TacticalLines.CATK:
992
+ case TacticalLines.CATKBYFIRE: {
993
+ pLinePoints[lCounter - 6].style = 5;
994
+ pLinePoints[lCounter - 5].style = 5;
995
+ break;
996
+ }
997
+
998
+ default: {
999
+ break;
1000
+ }
1001
+
1002
+ }
1003
+
1004
+ //10-19-12
1005
+ //reset the original points after the hack for catkbyfire
1006
+ if (vbiDrawThis === TacticalLines.CATKBYFIRE && dist > 45) {
1007
+ pUpperLinePoints[lUpperCounter - 1].x = ptUpper0.x;
1008
+ pUpperLinePoints[lUpperCounter - 1].y = ptUpper0.y;
1009
+ pLowerLinePoints[lLowerCounter - 1].x = ptLower0.x;
1010
+ pLowerLinePoints[lLowerCounter - 1].y = ptLower0.y;
1011
+ ArrowLinePoint.x = origArrowPt.x;
1012
+ ArrowLinePoint.y = origArrowPt.y;
1013
+ }
1014
+ //end section
1015
+ } catch (exc) {
1016
+ if (exc instanceof Error) {
1017
+ ErrorLogger.LogException(Channels._className, "GetAXADDouble",
1018
+ new RendererException("Failed inside GetAXADDouble " + vbiDrawThis.toString(), exc));
1019
+ } else {
1020
+ throw exc;
1021
+ }
1022
+ }
1023
+ }
1024
+ /**
1025
+ * Calculates a channel line and is called once each time for lower and upper channel lines.
1026
+ *
1027
+ * @param nPrinter always 1
1028
+ * @param pLinePoints client points
1029
+ * @param nUpperLower 0 for lower channel line, 1 for upper channel line
1030
+ * @param vblCounter the client point count
1031
+ * @param vbiDrawThis the line type
1032
+ * @param vblChannelWidth the channel width
1033
+ *
1034
+ * @return the channel line array as POINT2
1035
+ */
1036
+ static GetChannelArray2Double(nPrinter: int,
1037
+ pLinePoints: POINT2[],
1038
+ nUpperLower: int,
1039
+ vblCounter: int,
1040
+ vbiDrawThis: int,
1041
+ vblChannelWidth: int): POINT2[] {
1042
+ try {
1043
+ //get the upper or lower channel array for the specified channel type
1044
+ switch (vbiDrawThis) {
1045
+ case TacticalLines.LC:
1046
+ case TacticalLines.AIRAOA:
1047
+ case TacticalLines.AAAAA:
1048
+ case TacticalLines.CATK:
1049
+ case TacticalLines.CATKBYFIRE:
1050
+ case TacticalLines.MAIN:
1051
+ case TacticalLines.MAIN_STRAIGHT:
1052
+ case TacticalLines.SPT:
1053
+ case TacticalLines.SPT_STRAIGHT:
1054
+ case TacticalLines.TRIPLE:
1055
+ case TacticalLines.DOUBLEC:
1056
+ case TacticalLines.SINGLEC:
1057
+ case TacticalLines.HWFENCE:
1058
+ case TacticalLines.BBS_LINE:
1059
+ case TacticalLines.LWFENCE:
1060
+ case TacticalLines.DOUBLEA:
1061
+ case TacticalLines.UNSP:
1062
+ case TacticalLines.SFENCE:
1063
+ case TacticalLines.DFENCE:
1064
+ case TacticalLines.CHANNEL:
1065
+ case TacticalLines.CHANNEL_FLARED:
1066
+ case TacticalLines.CHANNEL_DASHED: {
1067
+ pLinePoints = Channels.CoordIL2Double(nPrinter, pLinePoints, nUpperLower, vblCounter, vbiDrawThis, vblChannelWidth);
1068
+ break;
1069
+ }
1070
+
1071
+ default: {
1072
+ //do nothing if it's not a channel type
1073
+ break;
1074
+ }
1075
+
1076
+ } //end switch
1077
+
1078
+ } catch (exc) {
1079
+ if (exc instanceof Error) {
1080
+ ErrorLogger.LogException(Channels._className, "GetChannelArray2Double",
1081
+ new RendererException("Failed inside GetChannelArray2Double " + vbiDrawThis.toString(), exc));
1082
+ } else {
1083
+ throw exc;
1084
+ }
1085
+ }
1086
+ return pLinePoints;
1087
+ }
1088
+
1089
+ private static GetTrueEndPointDouble(nWidth: int,
1090
+ EndLinePoint: POINT2,
1091
+ NextLinePoint: POINT2,
1092
+ lLast: int): CChannelPoints2 {
1093
+ let cAnswers: CChannelPoints2 = new CChannelPoints2();
1094
+ try {
1095
+ //declarations
1096
+ let LinePoint1: POINT2 = new POINT2();
1097
+ let LinePoint2: POINT2 = new POINT2();
1098
+ let m: double = 0;
1099
+ let
1100
+ b: double = 0;
1101
+ let
1102
+ bPerpendicular: double = 0;
1103
+ let
1104
+ Upperb: double = 0;
1105
+ let
1106
+ Lowerb: double = 0;
1107
+ let
1108
+ dWidth: double = nWidth as double;
1109
+ let bolVertical: int = 0;
1110
+ let pdResult: ref<number[]> = new ref();// double[6];
1111
+ //end declarations
1112
+
1113
+ bolVertical = lineutility.CalcTrueLinesDouble(nWidth, EndLinePoint, NextLinePoint, pdResult);
1114
+ m = pdResult.value[0];
1115
+ b = pdResult.value[1];
1116
+ Upperb = pdResult.value[3];
1117
+ Lowerb = pdResult.value[5];
1118
+
1119
+ if (bolVertical === 0) //lines are vertical
1120
+ {
1121
+ switch (lLast) {
1122
+ case 4:
1123
+ case 6: {
1124
+ cAnswers.m_Line1.x = EndLinePoint.x - dWidth;
1125
+ cAnswers.m_Line1.y = EndLinePoint.y;
1126
+ cAnswers.m_Line2.x = EndLinePoint.x + dWidth;
1127
+ cAnswers.m_Line2.y = EndLinePoint.y;
1128
+ break;
1129
+ }
1130
+
1131
+ case 5:
1132
+ case 7: {
1133
+ cAnswers.m_Line1.x = EndLinePoint.x + dWidth;
1134
+ cAnswers.m_Line1.y = EndLinePoint.y;
1135
+ cAnswers.m_Line2.x = EndLinePoint.x - dWidth;
1136
+ cAnswers.m_Line2.y = EndLinePoint.y;
1137
+ break;
1138
+ }
1139
+
1140
+ default: { //cases 0-3 should not occur if line is vertical
1141
+ break;
1142
+ }
1143
+
1144
+ }
1145
+ }
1146
+
1147
+ if (m === 0) {
1148
+ switch (lLast) {
1149
+ case 0: //line1 is above segment2
1150
+ case 2: {
1151
+ cAnswers.m_Line1.x = EndLinePoint.x;
1152
+ cAnswers.m_Line1.y = EndLinePoint.y - dWidth;
1153
+ cAnswers.m_Line2.x = EndLinePoint.x;
1154
+ cAnswers.m_Line2.y = EndLinePoint.y + dWidth;
1155
+ break;
1156
+ }
1157
+
1158
+ case 1: //line1 is above segment2
1159
+ case 3: {
1160
+ cAnswers.m_Line1.x = EndLinePoint.x;
1161
+ cAnswers.m_Line1.y = EndLinePoint.y + dWidth;
1162
+ cAnswers.m_Line2.x = EndLinePoint.x;
1163
+ cAnswers.m_Line2.y = EndLinePoint.y - dWidth;
1164
+ break;
1165
+ }
1166
+
1167
+ default: { //cases 4-7 should not be passed since line not vertical
1168
+ break;
1169
+ }
1170
+
1171
+ }
1172
+ }
1173
+
1174
+ //remaining cases, line is neither vertical nor horizontal
1175
+ if (bolVertical !== 0 && m !== 0) //lines are neither vertical nor horizontal
1176
+ {
1177
+ bPerpendicular = EndLinePoint.y + EndLinePoint.x / m;
1178
+ LinePoint1 = lineutility.CalcTrueIntersectDouble2(m, Upperb, -1 / m, bPerpendicular, 1, 1, 0, 0);
1179
+ LinePoint2 = lineutility.CalcTrueIntersectDouble2(m, Lowerb, -1 / m, bPerpendicular, 1, 1, 0, 0);
1180
+
1181
+ switch (lLast) {
1182
+ case 0: //line1 is above segment2
1183
+ case 2: {
1184
+ if (LinePoint1.y < LinePoint2.y) {
1185
+ cAnswers.m_Line1 = LinePoint1;
1186
+ cAnswers.m_Line2 = LinePoint2;
1187
+ }
1188
+ else {
1189
+ cAnswers.m_Line1 = LinePoint2;
1190
+ cAnswers.m_Line2 = LinePoint1;
1191
+ }
1192
+ break;
1193
+ }
1194
+
1195
+ case 1: //line1 is below segment2
1196
+ case 3: {
1197
+ if (LinePoint1.y > LinePoint2.y) {
1198
+ cAnswers.m_Line1 = LinePoint1;
1199
+ cAnswers.m_Line2 = LinePoint2;
1200
+ }
1201
+ else {
1202
+ cAnswers.m_Line1 = LinePoint2;
1203
+ cAnswers.m_Line2 = LinePoint1;
1204
+ }
1205
+ break;
1206
+ }
1207
+
1208
+ default: { //cases1-4 should not occur since line is not vertical
1209
+ break;
1210
+ }
1211
+
1212
+ }
1213
+ }
1214
+ } catch (exc) {
1215
+ if (exc instanceof Error) {
1216
+ ErrorLogger.LogException(Channels._className, "GetTrueEndPointDouble",
1217
+ new RendererException("Failed inside GetTrueEndPointDouble", exc));
1218
+ } else {
1219
+ throw exc;
1220
+ }
1221
+ }
1222
+ return cAnswers;
1223
+ }
1224
+ private static ConnectTrueDouble2(nWidth: int,
1225
+ LinePoint1: POINT2,
1226
+ LinePoint2: POINT2,
1227
+ LinePoint3: POINT2,
1228
+ lOrient: int): CChannelPoints2 {
1229
+ let pAnswerLinePoints: CChannelPoints2 = new CChannelPoints2();
1230
+ try {
1231
+ //declarations
1232
+ let m1: double = 0;
1233
+ let
1234
+ b1: double = 0;
1235
+ let
1236
+ m2: double = 0;
1237
+ let
1238
+ b2: double = 0;
1239
+ let
1240
+ Lowerb1: double = 0;
1241
+ let
1242
+ Upperb1: double = 0;
1243
+ let
1244
+ Lowerb2: double = 0;
1245
+ let
1246
+ Upperb2: double = 0;
1247
+ let
1248
+ dWidth: double = nWidth as double;
1249
+
1250
+ let pdResult: ref<number[]> = new ref();//double[6];
1251
+ //pdResult.value=new double[6];
1252
+ //POINT2 AnswerLinePoint=new POINT2();
1253
+ let bolVerticalSlope1: int = 0;
1254
+ let bolVerticalSlope2: int = 0;
1255
+ let x: ref<number[]> = new ref();
1256
+ let y: ref<number[]> = new ref();
1257
+ //end declarations
1258
+
1259
+ //Call CalcLines function for first two points (LinePoint1, LinePoint2)
1260
+ //and put parameters into the proper variables
1261
+ bolVerticalSlope1 = lineutility.CalcTrueLinesDouble(nWidth, LinePoint1, LinePoint2, pdResult);
1262
+ if (bolVerticalSlope1 !== 0) //line is not vertical
1263
+ {
1264
+ m1 = pdResult.value[0];
1265
+ b1 = pdResult.value[1];
1266
+ Upperb1 = pdResult.value[5];
1267
+ Lowerb1 = pdResult.value[3];
1268
+ }
1269
+
1270
+ //Call CalcLines function for next two points (LinePoint2, LinePoint3)
1271
+ bolVerticalSlope2 = lineutility.CalcTrueLinesDouble(nWidth, LinePoint2, LinePoint3, pdResult);
1272
+ if (bolVerticalSlope2 !== 0) //line is not vertical
1273
+ {
1274
+ m2 = pdResult.value[0];
1275
+ b2 = pdResult.value[1];
1276
+ Upperb2 = pdResult.value[5];
1277
+ Lowerb2 = pdResult.value[3];
1278
+ }
1279
+
1280
+ //must alter dWidth from the standard if bolVerticalSlope is 0.
1281
+ switch (lOrient) {
1282
+ case 0: {
1283
+ //line1 is above segment1 and above segment2
1284
+ //use 0 for the orientation for Line 1
1285
+ lineutility.CalcTrueIntersectDouble(m1, Upperb1, m2, Upperb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 0, x, y);
1286
+ pAnswerLinePoints.m_Line1.x = x.value[0];
1287
+ pAnswerLinePoints.m_Line1.y = y.value[0];
1288
+ //line 2 point: line2 is below segment1 and below segment2
1289
+ //use 3 for the orientation for Line 2
1290
+ lineutility.CalcTrueIntersectDouble(m1, Lowerb1, m2, Lowerb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 3, x, y);
1291
+ pAnswerLinePoints.m_Line2.x = x.value[0];
1292
+ pAnswerLinePoints.m_Line2.y = y.value[0];
1293
+ break;
1294
+ }
1295
+
1296
+ case 1: {
1297
+ //line1 is above segment1 and below segment2
1298
+ //use 1 for the orientation for Line 1
1299
+ lineutility.CalcTrueIntersectDouble(m1, Upperb1, m2, Lowerb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 1, x, y);
1300
+ pAnswerLinePoints.m_Line1.x = x.value[0];
1301
+ pAnswerLinePoints.m_Line1.y = y.value[0];
1302
+ //line2 is below segment1 and above segment2
1303
+ //use 2 for the orientation for Line 2
1304
+ lineutility.CalcTrueIntersectDouble(m1, Lowerb1, m2, Upperb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 2, x, y);
1305
+ pAnswerLinePoints.m_Line2.x = x.value[0];
1306
+ pAnswerLinePoints.m_Line2.y = y.value[0];
1307
+ break;
1308
+ }
1309
+
1310
+ case 2: {
1311
+ //line1 is below segment1 and above segment2
1312
+ //use 2 for the orientation for Line 1
1313
+ lineutility.CalcTrueIntersectDouble(m1, Lowerb1, m2, Upperb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 2, x, y);
1314
+ pAnswerLinePoints.m_Line1.x = x.value[0];
1315
+ pAnswerLinePoints.m_Line1.y = y.value[0];
1316
+ //line2 is above segment1 and below segment2
1317
+ //use 1 for the orientation for Line 1
1318
+ lineutility.CalcTrueIntersectDouble(m1, Upperb1, m2, Lowerb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 1, x, y);
1319
+ pAnswerLinePoints.m_Line2.x = x.value[0];
1320
+ pAnswerLinePoints.m_Line2.y = y.value[0];
1321
+ break;
1322
+ }
1323
+
1324
+ case 3: {
1325
+ //line1 is below segment1 and below segment2
1326
+ //use 3 for the orientation for Line 1
1327
+ lineutility.CalcTrueIntersectDouble(m1, Lowerb1, m2, Lowerb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 3, x, y);
1328
+ pAnswerLinePoints.m_Line1.x = x.value[0];
1329
+ pAnswerLinePoints.m_Line1.y = y.value[0];
1330
+ //line2 is above segment1 and above segment2
1331
+ //use 0 for the orientation for Line 2
1332
+ lineutility.CalcTrueIntersectDouble(m1, Upperb1, m2, Upperb2, LinePoint2, bolVerticalSlope1, bolVerticalSlope2, dWidth, 0, x, y);
1333
+ pAnswerLinePoints.m_Line2.x = x.value[0];
1334
+ pAnswerLinePoints.m_Line2.y = y.value[0];
1335
+ break;
1336
+ }
1337
+
1338
+ default: {
1339
+ break;
1340
+ }
1341
+
1342
+ }
1343
+ } catch (exc) {
1344
+ if (exc instanceof Error) {
1345
+ ErrorLogger.LogException(Channels._className, "ConnectTrueDouble2",
1346
+ new RendererException("Failed inside ConnectTrueDouble2", exc));
1347
+ } else {
1348
+ throw exc;
1349
+ }
1350
+ }
1351
+ return pAnswerLinePoints;
1352
+ }
1353
+ /*
1354
+ * Shift CounterAttack By Fire to not extend past the first point
1355
+ * @param vbiDrawThis
1356
+ * @param lpsaUpperVBPoints
1357
+ * @param vblLowerCounter
1358
+ * @param lpsaLowerVBPoints
1359
+ * @param vblUpperCounter
1360
+ */
1361
+ // private static void shiftCATKBYFIREPoints(int vbiDrawThis,
1362
+ // double[] lpsaUpperVBPoints,
1363
+ // int vblLowerCounter,
1364
+ // double[] lpsaLowerVBPoints,
1365
+ // int vblUpperCounter)
1366
+ // {
1367
+ // try
1368
+ // {
1369
+ // if(vbiDrawThis != TacticalLines.CATKBYFIRE)
1370
+ // return;
1371
+ //
1372
+ // POINT2 nextToLastPoint=new POINT2(lpsaUpperVBPoints[vblUpperCounter-4],lpsaUpperVBPoints[vblUpperCounter-3]);
1373
+ // POINT2 lastPoint=new POINT2(lpsaUpperVBPoints[vblUpperCounter-2],lpsaUpperVBPoints[vblUpperCounter-1]);
1374
+ // double dist=lineutility.CalcDistanceDouble(lastPoint, nextToLastPoint);
1375
+ //
1376
+ // if(dist<45)
1377
+ // {
1378
+ // nextToLastPoint=lineutility.ExtendAlongLineDouble(lastPoint,nextToLastPoint,45+2*dist);
1379
+ // lastPoint=lineutility.ExtendLineDouble(nextToLastPoint,lastPoint, -45);
1380
+ // lpsaUpperVBPoints[vblUpperCounter-4]=nextToLastPoint.x;
1381
+ // lpsaUpperVBPoints[vblUpperCounter-3]=nextToLastPoint.y;
1382
+ // lpsaLowerVBPoints[vblLowerCounter-4]=nextToLastPoint.x;
1383
+ // lpsaLowerVBPoints[vblLowerCounter-3]=nextToLastPoint.y;
1384
+ // }
1385
+ // //lastPoint=lineutility.ExtendAlongLineDouble(lastPoint, nextToLastPoint, 45);
1386
+ // else
1387
+ // lastPoint=lineutility.ExtendLineDouble(nextToLastPoint,lastPoint, -45);
1388
+ //
1389
+ // lpsaUpperVBPoints[vblUpperCounter-2]=lastPoint.x;
1390
+ // lpsaUpperVBPoints[vblUpperCounter-1]=lastPoint.y;
1391
+ // lpsaLowerVBPoints[vblLowerCounter-2]=lastPoint.x;
1392
+ // lpsaLowerVBPoints[vblLowerCounter-1]=lastPoint.y;
1393
+ // }
1394
+ // catch(Exception exc)
1395
+ // {
1396
+ // ErrorLogger.LogException(_className ,"ShiftCATKBYFIREPoints",
1397
+ // new RendererException("Failed inside ShiftCATKBYFIREPoints", exc));
1398
+ // }
1399
+ // }
1400
+ /*
1401
+ * tester function to shift counterattack by fire point back to account for
1402
+ * aligning the rotary arrow tip with the anchor point. the feature used to extend past
1403
+ * the anchor so the control point was shove forward. Intended to be called by the tester.
1404
+ * note: this function is not used by the CPOF client, it is for tester use only
1405
+ * @param linetype line type
1406
+ * @param pLinePoints
1407
+ * @param shift amount to shift back the existing control point
1408
+ */
1409
+ // public static void shiftCATKBYFIREControlPoint(
1410
+ // int linetype,
1411
+ // ArrayList<POINT2>pLinePoints,
1412
+ // double shift)
1413
+ // {
1414
+ // try
1415
+ // {
1416
+ // if(linetype != TacticalLines.CATKBYFIRE)
1417
+ // return;
1418
+ // int controlPtIndex=pLinePoints.length-1;
1419
+ // POINT2 pt0=pLinePoints[0];
1420
+ // POINT2 pt1=pLinePoints[1];
1421
+ // double dist=lineutility.CalcDistanceDouble(pLinePoints[0], pLinePoints[1]);
1422
+ // if(dist<=45)
1423
+ // return;
1424
+ // POINT2 controlPt=pLinePoints[controlPtIndex];
1425
+ // //pt3 is the point on parallel line which contains the control point and corresponds to,
1426
+ // //i.e. is perpendicular to, pt0.
1427
+ // POINT2 pt3=lineutility.PointRelativeToLine(pt0, pt1, pt0, controlPt);
1428
+ // //pt4 will be the shifted control point
1429
+ // POINT2 pt4=lineutility.ExtendLineDouble(pt3, controlPt, shift);
1430
+ // //set the control point as the new shifted control point
1431
+ // pLinePoints.set(controlPtIndex, pt4);
1432
+ // }
1433
+ // catch(Exception exc)
1434
+ // {
1435
+ // ErrorLogger.LogException(_className ,"shiftCATKBYFIREControlPoint",
1436
+ // new RendererException("Failed inside shiftCATKBYFIREControlPoint", exc));
1437
+ // }
1438
+ // }
1439
+ /**
1440
+ * Calculates the channel points
1441
+ * @param lpsaUpperVBPoints the client points as 2-tuples
1442
+ * @param lpsaLowerVBPoints the client points as 2 tuples
1443
+ * @param resultVBPoints the result points as 3-tuples x,y,linestyle
1444
+ * @param vblUpperCounter the number of client 2-tuples
1445
+ * @param vblLowerCounter the number of client 2-tuples
1446
+ * @param vblChannelWidth the channel width in pixels
1447
+ * @param useptr the distance in pixels from the arrow tip to the back of the arrowhead
1448
+ * @param shapes the ShapeInfo array, each object contains the GeneralPath
1449
+ * @return
1450
+ */
1451
+ public static GetChannel1Double(tg: TGLight,
1452
+ lpsaUpperVBPoints: number[],
1453
+ lpsaLowerVBPoints: number[],
1454
+ resultVBPoints: number[],
1455
+ vblUpperCounter: int,
1456
+ vblLowerCounter: int,
1457
+ vblChannelWidth: int,
1458
+ useptr: int,
1459
+ shapes: Array<Shape2>): int {
1460
+ let lResult: int = -1;
1461
+ try {
1462
+ let vbiDrawThis: int = tg.get_LineType();
1463
+ let k: int = 0;
1464
+ let vblCounter: int = 0;
1465
+ let nPrinter: int = 1;
1466
+ let
1467
+ nArrowSize: int = 40 * nPrinter;
1468
+ let
1469
+ max: int = 0;
1470
+ let dist: double = 0;
1471
+ let remainder: double = 0;
1472
+ let vblUpperCounter2: int = vblUpperCounter;
1473
+ let vblLowerCounter2: int = vblLowerCounter;
1474
+ let nReverseUpper: int = 0;
1475
+ let lUpperFlotCount: int = 0;
1476
+ let lLowerFlotCount: int = 0;
1477
+ let nLowerCounter: int = 0;
1478
+ let lUpperCounter: int = 0;
1479
+ let lResultCounter: int = 0;
1480
+ let XCounter: int = 0;
1481
+ let j: int = 0;
1482
+ let lHowManyThisSegment: int = 0;
1483
+ let l: int = 0;
1484
+ let t: int = 0;
1485
+ let pi: double = Math.PI;
1486
+ let dAngle: double = 0;
1487
+ let d: double = 0;
1488
+ let a: double = 13;//13;
1489
+ let b: double = 6; //6;
1490
+ let dFactor: double = 0;
1491
+ let lEllipseCounter: int = 0;
1492
+ //double arrowOffsetFactor = 10;
1493
+ let arrowOffsetFactor: double = vblChannelWidth / 4; //diagnostic was 10
1494
+ let pLowerLinePoints: POINT2[] = new Array<POINT2>(vblLowerCounter);
1495
+ let
1496
+ pUpperLinePoints: POINT2[] = new Array<POINT2>(vblUpperCounter);
1497
+ let
1498
+ pArrowLinePoints: POINT2[] = new Array<POINT2>(1);
1499
+ let
1500
+ pLinePoints: POINT2[];
1501
+ let
1502
+ pUpperFlotPoints: POINT2[];
1503
+ let pLowerFlotPoints: POINT2[];
1504
+ let pOriginalLinePoints: POINT2[];
1505
+ let pOriginalLinePoints2: POINT2[];
1506
+ lineutility.InitializePOINT2Array(pLowerLinePoints);
1507
+ lineutility.InitializePOINT2Array(pUpperLinePoints);
1508
+ lineutility.InitializePOINT2Array(pArrowLinePoints);
1509
+
1510
+ let pt1: POINT2 = new POINT2();
1511
+ let pt2: POINT2 = new POINT2();
1512
+ let pt3: POINT2 = new POINT2();
1513
+ let pt4: POINT2 = new POINT2();
1514
+ let midPt1: POINT2 = new POINT2();
1515
+ let midPt2: POINT2 = new POINT2();
1516
+ let pt0: POINT2 = new POINT2();
1517
+ let arrowPts: POINT2[] = new Array<POINT2>(3);
1518
+ //POINT2 startLinePoint = new POINT2();
1519
+ let XPoints: POINT2[] = new Array<POINT2>(4);
1520
+ let pEllipsePoints2: POINT2[] = new Array<POINT2>(37);
1521
+ lineutility.InitializePOINT2Array(XPoints);
1522
+ lineutility.InitializePOINT2Array(pEllipsePoints2);
1523
+
1524
+ //POINT2 endLinePoint = new POINT2();
1525
+ let temp1LinePoint: POINT2 = new POINT2();
1526
+ let ptCenter: POINT2 = new POINT2(pLowerLinePoints[0]);
1527
+ let
1528
+ temp2LinePoint: POINT2 = new POINT2();
1529
+ let lastPoint: POINT2 = new POINT2();
1530
+ let nextToLastPoint: POINT2 = new POINT2(); //used by CATKBYFIRE
1531
+ //end declarations
1532
+
1533
+ //initializations
1534
+ if (vblChannelWidth < 5 && vbiDrawThis != TacticalLines.BBS_LINE) {
1535
+ vblChannelWidth = 5;
1536
+ }
1537
+
1538
+ if (vblLowerCounter < 2 || vblUpperCounter < 2) {
1539
+ return -1;
1540
+ }
1541
+
1542
+ //shiftCATKBYFIREPoints(vbiDrawThis,lpsaUpperVBPoints,lpsaUpperVBPoints.length,lpsaLowerVBPoints,lpsaLowerVBPoints.length);
1543
+ //load client points
1544
+ for (k = 0; k < vblLowerCounter; k++) {
1545
+ pLowerLinePoints[k].x = lpsaLowerVBPoints[nLowerCounter];
1546
+ nLowerCounter++;
1547
+ pLowerLinePoints[k].y = lpsaLowerVBPoints[nLowerCounter];
1548
+ nLowerCounter++;
1549
+ if (k === vblLowerCounter - 2) {
1550
+ nextToLastPoint.x = pLowerLinePoints[k].x;
1551
+ nextToLastPoint.y = pLowerLinePoints[k].y;
1552
+ }
1553
+ if (k === vblLowerCounter - 1) {
1554
+ lastPoint.x = pLowerLinePoints[k].x;
1555
+ lastPoint.y = pLowerLinePoints[k].y;
1556
+ }
1557
+ pLowerLinePoints[k].style = 0;
1558
+ }
1559
+ nLowerCounter = 0;
1560
+
1561
+ let lastSegmentLength: double = lineutility.CalcDistanceDouble(lastPoint, nextToLastPoint);
1562
+
1563
+ for (k = 0; k < vblUpperCounter; k++) {
1564
+ pUpperLinePoints[k].x = lpsaUpperVBPoints[lUpperCounter];
1565
+ lUpperCounter++;
1566
+ pUpperLinePoints[k].y = lpsaUpperVBPoints[lUpperCounter];
1567
+ lUpperCounter++;
1568
+ pUpperLinePoints[k].style = 0;
1569
+ }
1570
+ lUpperCounter = 0;
1571
+ pArrowLinePoints[0] = new POINT2(pUpperLinePoints[vblUpperCounter - 1]);
1572
+ //end load client points
1573
+
1574
+ pt0 = new POINT2(pLowerLinePoints[0]);
1575
+ //diagnostic 1-7-13
1576
+ let shiftLines: boolean = Channels._shiftLines;
1577
+ switch (vbiDrawThis) {
1578
+ case TacticalLines.LC:
1579
+ case TacticalLines.UNSP:
1580
+ case TacticalLines.LWFENCE:
1581
+ case TacticalLines.HWFENCE:
1582
+ case TacticalLines.SINGLEC:
1583
+ case TacticalLines.DOUBLEC:
1584
+ case TacticalLines.TRIPLE: {
1585
+ break;
1586
+ }
1587
+
1588
+ default: {
1589
+ shiftLines = false;
1590
+ break;
1591
+ }
1592
+
1593
+ }
1594
+ //end section
1595
+
1596
+ switch (vbiDrawThis) {
1597
+ case TacticalLines.CATK:
1598
+ case TacticalLines.AIRAOA:
1599
+ case TacticalLines.AAAAA:
1600
+ case TacticalLines.SPT:
1601
+ case TacticalLines.SPT_STRAIGHT:
1602
+ case TacticalLines.MAIN:
1603
+ case TacticalLines.MAIN_STRAIGHT:
1604
+ case TacticalLines.CATKBYFIRE: { //80
1605
+ dist = useptr as double;
1606
+
1607
+ nArrowSize = Math.trunc(Math.sqrt(dist * dist + vblChannelWidth / 2 * vblChannelWidth / 2));
1608
+ //nArrowSize = (int) Math.sqrt(dist * dist + vblChannelWidth * vblChannelWidth);
1609
+ //lineutility.WriteFile(Integer.toString(nArrowSize));
1610
+
1611
+ pUpperLinePoints[vblUpperCounter - 1] = lineutility.ExtendAlongLineDouble(pUpperLinePoints[vblUpperCounter - 1], pUpperLinePoints[vblUpperCounter - 2], dist);
1612
+ pLowerLinePoints[vblLowerCounter - 1] = lineutility.ExtendAlongLineDouble(pLowerLinePoints[vblLowerCounter - 1], pLowerLinePoints[vblLowerCounter - 2], dist);
1613
+ break;
1614
+ }
1615
+
1616
+ default: {
1617
+ break;
1618
+ }
1619
+
1620
+ }
1621
+ //end section
1622
+
1623
+ temp1LinePoint = new POINT2(pLowerLinePoints[0]);
1624
+ temp2LinePoint = new POINT2(pUpperLinePoints[0]);
1625
+
1626
+ //get the channel array
1627
+ switch (vbiDrawThis) {
1628
+ case TacticalLines.MAIN:
1629
+ case TacticalLines.MAIN_STRAIGHT:
1630
+ case TacticalLines.SPT:
1631
+ case TacticalLines.SPT_STRAIGHT:
1632
+ case TacticalLines.CATK:
1633
+ case TacticalLines.CATKBYFIRE:
1634
+ case TacticalLines.TRIPLE:
1635
+ case TacticalLines.DOUBLEC:
1636
+ case TacticalLines.SINGLEC:
1637
+ case TacticalLines.HWFENCE:
1638
+ case TacticalLines.BBS_LINE:
1639
+ case TacticalLines.LWFENCE:
1640
+ case TacticalLines.UNSP:
1641
+ case TacticalLines.DOUBLEA:
1642
+ case TacticalLines.DFENCE:
1643
+ case TacticalLines.SFENCE:
1644
+ case TacticalLines.CHANNEL:
1645
+ case TacticalLines.CHANNEL_FLARED:
1646
+ case TacticalLines.CHANNEL_DASHED: {
1647
+ vblCounter = Channels.GetTripleCountDouble(pUpperLinePoints, vblUpperCounter, vbiDrawThis);
1648
+ //save the original line points for later
1649
+ pOriginalLinePoints = new Array<POINT2>(vblUpperCounter);
1650
+ for (k = 0; k < vblUpperCounter; k++) {
1651
+ pOriginalLinePoints[k] = new POINT2(pUpperLinePoints[k]);
1652
+ }
1653
+ pOriginalLinePoints2 = new Array<POINT2>(vblUpperCounter);
1654
+ for (k = 0; k < vblUpperCounter; k++) {
1655
+ pOriginalLinePoints2[k] = new POINT2(pUpperLinePoints[k]);
1656
+ }
1657
+ //bound the points
1658
+ switch (vbiDrawThis) {
1659
+ case TacticalLines.TRIPLE:
1660
+ case TacticalLines.DOUBLEC:
1661
+ case TacticalLines.SINGLEC:
1662
+ case TacticalLines.HWFENCE:
1663
+ case TacticalLines.BBS_LINE:
1664
+ case TacticalLines.LWFENCE:
1665
+ case TacticalLines.UNSP:
1666
+ case TacticalLines.DOUBLEA:
1667
+ case TacticalLines.DFENCE:
1668
+ case TacticalLines.SFENCE: {
1669
+ pLowerLinePoints = new Array<POINT2>(vblLowerCounter);
1670
+ for (k = 0; k < vblLowerCounter2; k++) {
1671
+ pLowerLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1672
+ }
1673
+
1674
+ pUpperLinePoints = new Array<POINT2>(vblUpperCounter);
1675
+ for (k = 0; k < vblUpperCounter2; k++) {
1676
+ pUpperLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1677
+ }
1678
+ pOriginalLinePoints = new Array<POINT2>(vblUpperCounter);
1679
+ for (k = 0; k < vblUpperCounter2; k++) {
1680
+ pOriginalLinePoints[k] = new POINT2(pOriginalLinePoints2[k]);
1681
+ }
1682
+ break;
1683
+ }
1684
+
1685
+ default: {
1686
+ //do not bound the points
1687
+ break;
1688
+ }
1689
+
1690
+ }
1691
+ lineutility.moveSingleCPixels(vbiDrawThis, pUpperLinePoints);
1692
+ lineutility.moveSingleCPixels(vbiDrawThis, pLowerLinePoints);
1693
+ lineutility.MoveChannelPixels(pUpperLinePoints);
1694
+ lineutility.MoveChannelPixels(pLowerLinePoints);
1695
+
1696
+ //diagnostic 1-7-13
1697
+ //if(_shiftLines && vbiDrawThis != TacticalLines.DOUBLEC)
1698
+ if (shiftLines) {
1699
+
1700
+ vblChannelWidth *= 2;
1701
+ }
1702
+
1703
+ //end section
1704
+
1705
+ pUpperLinePoints = Channels.GetChannelArray2Double(nPrinter, pUpperLinePoints, 1, vblUpperCounter, vbiDrawThis, vblChannelWidth);
1706
+ pLowerLinePoints = Channels.GetChannelArray2Double(nPrinter, pLowerLinePoints, 0, vblLowerCounter, vbiDrawThis, vblChannelWidth);
1707
+
1708
+ //diagnostic 1-7-13
1709
+ if (shiftLines) {
1710
+ //if(vbiDrawThis != TacticalLines.SINGLEC && vbiDrawThis != TacticalLines.DOUBLEC)
1711
+ // pUpperLinePoints=pOriginalLinePoints;
1712
+ if (vbiDrawThis === TacticalLines.SINGLEC) {
1713
+
1714
+ pLowerLinePoints = pOriginalLinePoints;
1715
+ }
1716
+
1717
+ else {
1718
+ if (vbiDrawThis === TacticalLines.DOUBLEC) {
1719
+ for (j = 0; j < pUpperLinePoints.length; j++) {
1720
+ pUpperLinePoints[j] = lineutility.MidPointDouble(pLowerLinePoints[j], pOriginalLinePoints[j], 0);
1721
+ }
1722
+ //pOriginalLinePoints=pLowerLinePoints.clone();
1723
+ }
1724
+ else {
1725
+ if (vbiDrawThis === TacticalLines.TRIPLE) {
1726
+
1727
+ pUpperLinePoints = pOriginalLinePoints;
1728
+ }
1729
+
1730
+ else {
1731
+
1732
+ pUpperLinePoints = pOriginalLinePoints;
1733
+ }
1734
+
1735
+ }
1736
+
1737
+ }
1738
+
1739
+ }
1740
+ break;
1741
+ }
1742
+
1743
+ case TacticalLines.LC: {
1744
+ if (shiftLines) {
1745
+ pOriginalLinePoints = new Array<POINT2>(vblUpperCounter);
1746
+ for (k = 0; k < vblUpperCounter; k++) {
1747
+ pOriginalLinePoints[k] = new POINT2(pUpperLinePoints[k]);
1748
+ }
1749
+ vblChannelWidth *= 2;
1750
+ }
1751
+
1752
+ pUpperLinePoints = Channels.GetChannelArray2Double(nPrinter, pUpperLinePoints, 1, vblUpperCounter, vbiDrawThis, vblChannelWidth);
1753
+ pLowerLinePoints = Channels.GetChannelArray2Double(nPrinter, pLowerLinePoints, 0, vblLowerCounter, vbiDrawThis, vblChannelWidth);
1754
+
1755
+ if (shiftLines) {
1756
+ pUpperLinePoints = pOriginalLinePoints;
1757
+ }
1758
+
1759
+ if ((pUpperLinePoints[0].x > pUpperLinePoints[1].x) && (pUpperLinePoints[0].y !== pUpperLinePoints[1].y)) {
1760
+ nReverseUpper = 1;
1761
+ lineutility.ReversePointsDouble2(pLowerLinePoints, vblLowerCounter);
1762
+ } else {
1763
+ if ((pUpperLinePoints[0].x > pUpperLinePoints[1].x) && (pUpperLinePoints[0].y === pUpperLinePoints[1].y)) {
1764
+ nReverseUpper = 0;
1765
+ lineutility.ReversePointsDouble2(pUpperLinePoints, vblUpperCounter);
1766
+ } else {
1767
+ if (pUpperLinePoints[0].x < pUpperLinePoints[1].x) {
1768
+ nReverseUpper = 1;
1769
+ lineutility.ReversePointsDouble2(pLowerLinePoints, vblLowerCounter);
1770
+ } else {
1771
+ if ((pUpperLinePoints[0].y > pUpperLinePoints[1].y) && (pUpperLinePoints[0].x === pUpperLinePoints[1].x)) {
1772
+ nReverseUpper = 1;
1773
+ lineutility.ReversePointsDouble2(pLowerLinePoints, vblLowerCounter);
1774
+ } else {
1775
+ if ((pUpperLinePoints[0].y < pUpperLinePoints[1].y) && (pUpperLinePoints[0].x === pUpperLinePoints[1].x)) {
1776
+ nReverseUpper = 0;
1777
+ lineutility.ReversePointsDouble2(pUpperLinePoints, vblUpperCounter);
1778
+ }
1779
+ }
1780
+
1781
+ }
1782
+
1783
+ }
1784
+
1785
+ }
1786
+
1787
+ break;
1788
+ }
1789
+
1790
+ case TacticalLines.AAAAA:
1791
+ case TacticalLines.AIRAOA: {
1792
+ pOriginalLinePoints = new Array<POINT2>(vblUpperCounter);
1793
+ for (k = 0; k < vblUpperCounter; k++) {
1794
+ pOriginalLinePoints[k] = new POINT2(pUpperLinePoints[k]);
1795
+ }
1796
+ pUpperLinePoints = Channels.GetChannelArray2Double(nPrinter, pUpperLinePoints, 1, vblUpperCounter, vbiDrawThis, vblChannelWidth);
1797
+ pLowerLinePoints = Channels.GetChannelArray2Double(nPrinter, pLowerLinePoints, 0, vblLowerCounter, vbiDrawThis, vblChannelWidth);
1798
+
1799
+
1800
+ //end section
1801
+ //only allow the lines to cross if there is enough room
1802
+ //if (lastSegmentLength > vblChannelWidth / 2)
1803
+ //{
1804
+ temp1LinePoint = new POINT2(pLowerLinePoints[vblLowerCounter - 1]);
1805
+ temp2LinePoint = new POINT2(pUpperLinePoints[vblUpperCounter - 1]);
1806
+ pLowerLinePoints[vblLowerCounter - 1] = new POINT2(temp2LinePoint);
1807
+ pUpperLinePoints[vblUpperCounter - 1] = new POINT2(temp1LinePoint);
1808
+ //}
1809
+ break;
1810
+ }
1811
+
1812
+ default: {
1813
+ break;
1814
+ }
1815
+
1816
+ } //end get channel array
1817
+ //load channel array into pLinePoints
1818
+ switch (vbiDrawThis) {
1819
+ case TacticalLines.LC: {
1820
+ lUpperFlotCount = flot.GetFlotCountDouble(pUpperLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale()), vblUpperCounter);
1821
+ lLowerFlotCount = flot.GetFlotCountDouble(pLowerLinePoints, arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale()), vblLowerCounter);
1822
+ if (lUpperFlotCount <= 0 || lLowerFlotCount <= 0) {
1823
+ return 0;
1824
+ }
1825
+ //vblCounter = lUpperFlotCount + lLowerFlotCount;
1826
+
1827
+ max = vblUpperCounter;
1828
+ if (max < lUpperFlotCount) {
1829
+ max = lUpperFlotCount;
1830
+ }
1831
+ pUpperFlotPoints = new Array<POINT2>(max);
1832
+ lineutility.InitializePOINT2Array(pUpperFlotPoints);
1833
+ max = vblLowerCounter;
1834
+ if (max < lLowerFlotCount) {
1835
+ max = lLowerFlotCount;
1836
+ }
1837
+ pLowerFlotPoints = new Array<POINT2>(max);
1838
+ lineutility.InitializePOINT2Array(pLowerFlotPoints);
1839
+ for (k = 0; k < vblUpperCounter; k++) {
1840
+ pUpperFlotPoints[k] = new POINT2(pUpperLinePoints[k]);
1841
+ }
1842
+ for (k = 0; k < vblLowerCounter; k++) {
1843
+ pLowerFlotPoints[k] = new POINT2(pLowerLinePoints[k]);
1844
+ }
1845
+
1846
+ lUpperFlotCount = flot.GetFlotDouble(pUpperFlotPoints, arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale()), vblUpperCounter); //6/24/04
1847
+ lLowerFlotCount = flot.GetFlotDouble(pLowerFlotPoints, arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale()), vblLowerCounter); //6/24/04
1848
+ pLinePoints = new Array<POINT2>(lUpperFlotCount + lLowerFlotCount);
1849
+ lineutility.InitializePOINT2Array(pLinePoints);
1850
+
1851
+ vblCounter = lLowerFlotCount + lUpperFlotCount;
1852
+
1853
+ if (nReverseUpper === 1) {
1854
+ for (k = 0; k < lUpperFlotCount; k++) {
1855
+ pLinePoints[k] = new POINT2(pUpperFlotPoints[k]);
1856
+ pLinePoints[k].style = 25; //was 26
1857
+ }
1858
+ //added one line M. Deutch 4-22-02
1859
+ if (lUpperFlotCount > 0) {
1860
+ pLinePoints[lUpperFlotCount - 1].style = 5;
1861
+ }
1862
+ for (k = 0; k < lLowerFlotCount; k++) {
1863
+ pLinePoints[k + lUpperFlotCount] = new POINT2(pLowerFlotPoints[k]);
1864
+ pLinePoints[k + lUpperFlotCount].style = 26; //was 0
1865
+ }
1866
+ if (lUpperFlotCount + lLowerFlotCount > 0) {
1867
+ pLinePoints[lUpperFlotCount + lLowerFlotCount - 1].style = 5;
1868
+ }
1869
+ }
1870
+ if (nReverseUpper === 0) {
1871
+ for (k = 0; k < lUpperFlotCount; k++) {
1872
+ pLinePoints[k] = new POINT2(pUpperFlotPoints[k]);
1873
+ pLinePoints[k].style = 26; //was 0
1874
+ }
1875
+ if (lUpperFlotCount > 0) {
1876
+
1877
+ pLinePoints[lUpperFlotCount - 1].style = 5;
1878
+ }
1879
+
1880
+
1881
+ for (k = 0; k < lLowerFlotCount; k++) {
1882
+ pLinePoints[k + lUpperFlotCount] = new POINT2(pLowerFlotPoints[k]);
1883
+ pLinePoints[k + lUpperFlotCount].style = 25; //was 26
1884
+ }
1885
+ if (lUpperFlotCount + lLowerFlotCount > 0) {
1886
+
1887
+ pLinePoints[lUpperFlotCount + lLowerFlotCount - 1].style = 5;
1888
+ }
1889
+
1890
+ }
1891
+ break;
1892
+ }
1893
+
1894
+ case TacticalLines.TRIPLE:
1895
+ case TacticalLines.DOUBLEC:
1896
+ case TacticalLines.SINGLEC:
1897
+ case TacticalLines.HWFENCE:
1898
+ case TacticalLines.LWFENCE:
1899
+ case TacticalLines.UNSP:
1900
+ case TacticalLines.DOUBLEA:
1901
+ case TacticalLines.SFENCE:
1902
+ case TacticalLines.DFENCE:
1903
+ case TacticalLines.CHANNEL:
1904
+ case TacticalLines.CHANNEL_FLARED:
1905
+ case TacticalLines.CHANNEL_DASHED: {
1906
+ //load the channel points
1907
+ pLinePoints = new Array<POINT2>(vblCounter);
1908
+ lineutility.InitializePOINT2Array(pLinePoints);
1909
+ //initialize points
1910
+ for (j = 0; j < pLinePoints.length; j++) {
1911
+ pLinePoints[j].x = lpsaUpperVBPoints[0];
1912
+ pLinePoints[j].y = lpsaUpperVBPoints[1];
1913
+ }
1914
+ switch (vbiDrawThis) {
1915
+ case TacticalLines.TRIPLE:
1916
+ case TacticalLines.HWFENCE:
1917
+ case TacticalLines.CHANNEL:
1918
+ case TacticalLines.CHANNEL_FLARED:
1919
+ case TacticalLines.CHANNEL_DASHED:
1920
+ case TacticalLines.SINGLEC: { //added 7-10-07
1921
+ for (k = 0; k < vblLowerCounter; k++) {
1922
+ pLinePoints[k] = new POINT2(pLowerLinePoints[k]); //don't shift here
1923
+ }
1924
+ break;
1925
+ }
1926
+
1927
+ case TacticalLines.DOUBLEC: {
1928
+ if (pOriginalLinePoints[0].x < pOriginalLinePoints[1].x) {
1929
+ for (k = 0; k < vblLowerCounter; k++) {
1930
+ pLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1931
+ }
1932
+ }
1933
+ else {
1934
+ for (k = 0; k < vblLowerCounter; k++) {
1935
+ pLinePoints[k] = new POINT2(pUpperLinePoints[k]);
1936
+ }
1937
+ }
1938
+ break;
1939
+ }
1940
+
1941
+
1942
+ case TacticalLines.LWFENCE: {
1943
+ for (k = 0; k < vblLowerCounter; k++) {
1944
+ pLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1945
+ pLinePoints[k].style = 5;
1946
+ }
1947
+ break;
1948
+ }
1949
+
1950
+ case TacticalLines.UNSP: {
1951
+ for (k = 0; k < vblLowerCounter; k++) {
1952
+ pLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1953
+ pLinePoints[k].style = 5;
1954
+ }
1955
+ break;
1956
+ }
1957
+
1958
+ case TacticalLines.DOUBLEA: {
1959
+ for (k = 0; k < vblLowerCounter; k++) {
1960
+ pLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1961
+ }
1962
+ break;
1963
+ }
1964
+
1965
+ default: {
1966
+ for (k = 0; k < vblLowerCounter; k++) {
1967
+ pLinePoints[k] = new POINT2(pOriginalLinePoints[k]);
1968
+ }
1969
+ break;
1970
+ }
1971
+
1972
+ }
1973
+ pLinePoints[vblLowerCounter - 1].style = 5;
1974
+
1975
+ switch (vbiDrawThis) {
1976
+ case TacticalLines.TRIPLE:
1977
+ case TacticalLines.HWFENCE:
1978
+ case TacticalLines.CHANNEL:
1979
+ case TacticalLines.CHANNEL_FLARED:
1980
+ case TacticalLines.CHANNEL_DASHED: {
1981
+ for (k = 0; k < vblUpperCounter; k++) {
1982
+ pLinePoints[vblLowerCounter + k] = new POINT2(pUpperLinePoints[k]);
1983
+ }
1984
+ break;
1985
+ }
1986
+
1987
+ case TacticalLines.DOUBLEC: {
1988
+ if (pOriginalLinePoints[0].x < pOriginalLinePoints[1].x) {
1989
+ for (k = 0; k < vblUpperCounter; k++) {
1990
+ pLinePoints[vblLowerCounter + k] = new POINT2(pUpperLinePoints[k]);
1991
+ }
1992
+ }
1993
+ else {
1994
+ for (k = 0; k < vblUpperCounter; k++) {
1995
+ pLinePoints[vblLowerCounter + k] = new POINT2(pOriginalLinePoints[k]);
1996
+ }
1997
+ }
1998
+ break;
1999
+ }
2000
+
2001
+ case TacticalLines.SINGLEC: {
2002
+ for (k = 0; k < vblUpperCounter; k++) {
2003
+ //pLinePoints[vblLowerCounter + k] = pOriginalLinePoints[k]; //revised 7-10-07
2004
+ pLinePoints[vblLowerCounter + k] = new POINT2(pLowerLinePoints[k]);
2005
+ }
2006
+ break;
2007
+ }
2008
+
2009
+ case TacticalLines.LWFENCE: {
2010
+ //remove block to make channel line aoways below the X
2011
+ for (k = 0; k < vblUpperCounter; k++) {
2012
+ pLinePoints[vblLowerCounter + k] = new POINT2(pUpperLinePoints[k]);
2013
+ }
2014
+ break;
2015
+ }
2016
+
2017
+ case TacticalLines.UNSP: {
2018
+ for (k = 0; k < vblUpperCounter; k++) {
2019
+ pLinePoints[vblLowerCounter + k] = new POINT2(pOriginalLinePoints[k]);
2020
+ pLinePoints[vblLowerCounter + k].style = 5;
2021
+ }
2022
+ break;
2023
+ }
2024
+
2025
+ case TacticalLines.DOUBLEA: {
2026
+ for (k = 0; k < vblUpperCounter; k++) {
2027
+ pLinePoints[vblLowerCounter + k] = new POINT2(pOriginalLinePoints[k]);
2028
+ }
2029
+ break;
2030
+ }
2031
+
2032
+ default: {
2033
+ for (k = 0; k < vblUpperCounter; k++) {
2034
+ pLinePoints[vblLowerCounter + k] = new POINT2(pOriginalLinePoints[k]);
2035
+ }
2036
+ break;
2037
+ }
2038
+
2039
+ }
2040
+
2041
+ pLinePoints[vblLowerCounter + vblUpperCounter - 1].style = 5;
2042
+
2043
+ lEllipseCounter = vblLowerCounter + vblUpperCounter;
2044
+ //following section only for lines with repeating features, e.g. DOUBLEA
2045
+ //if(segments!=null &&
2046
+ if (vbiDrawThis != TacticalLines.BBS_LINE &&
2047
+ vbiDrawThis !== TacticalLines.CHANNEL &&
2048
+ vbiDrawThis !== TacticalLines.CHANNEL_DASHED &&
2049
+ vbiDrawThis !== TacticalLines.CHANNEL_FLARED &&
2050
+ vbiDrawThis !== TacticalLines.SPT_STRAIGHT &&
2051
+ vbiDrawThis !== TacticalLines.MAIN_STRAIGHT) {
2052
+ let xSize: int = 0;
2053
+ if (shiftLines) {
2054
+
2055
+ xSize = vblChannelWidth / 8;
2056
+ }
2057
+
2058
+ else {
2059
+
2060
+ xSize = vblChannelWidth / 4;
2061
+ }
2062
+
2063
+ for (j = 0; j < vblUpperCounter - 1; j++) {
2064
+ let dIncrement: double = xSize + arraysupport.getScaledSize(2, tg.get_LineThickness() / 2, tg.get_patternScale());
2065
+ d = lineutility.CalcDistanceDouble(pOriginalLinePoints[j], pOriginalLinePoints[j + 1]);
2066
+ lHowManyThisSegment = Math.trunc(d / dIncrement);
2067
+ remainder = d - dIncrement * lHowManyThisSegment;
2068
+ dAngle = lineutility.CalcSegmentAngleDouble(pOriginalLinePoints[j], pOriginalLinePoints[j + 1]);
2069
+ dAngle = dAngle + pi / 2;
2070
+ for (k = 0; k < lHowManyThisSegment; k++) {
2071
+
2072
+ if (vbiDrawThis === TacticalLines.SFENCE) {
2073
+ if (k % 4 === 0) {
2074
+
2075
+ continue;
2076
+ }
2077
+
2078
+ }
2079
+ else {
2080
+ if (k % 2 === 0) {
2081
+
2082
+ continue;
2083
+ }
2084
+
2085
+ }
2086
+
2087
+ let f: double = k;
2088
+ f *= (1 + remainder / d);
2089
+
2090
+ //diagnostic 1-7-13
2091
+ //note: for shiftLines upper line points were set to original line points ealier
2092
+ //ptCenter.x = pOriginalLinePoints[j].x + (int) ((double) (f) * ((double) pOriginalLinePoints[j + 1].x - (double) pOriginalLinePoints[j].x) / (double) lHowManyThisSegment);
2093
+ //ptCenter.y = pOriginalLinePoints[j].y + (int) ((double) (f) * ((double) pOriginalLinePoints[j + 1].y - (double) pOriginalLinePoints[j].y) / (double) lHowManyThisSegment);
2094
+ if (shiftLines === true && vbiDrawThis === TacticalLines.DOUBLEC) {
2095
+ ptCenter.x = pUpperLinePoints[j].x + Math.trunc((f) as double * (pUpperLinePoints[j + 1].x as double - pUpperLinePoints[j].x as double) / lHowManyThisSegment as double);
2096
+ ptCenter.y = pUpperLinePoints[j].y + Math.trunc((f) as double * (pUpperLinePoints[j + 1].y as double - pUpperLinePoints[j].y as double) / lHowManyThisSegment as double);
2097
+ }
2098
+ else {
2099
+ if (shiftLines === false) {
2100
+ ptCenter.x = pOriginalLinePoints[j].x + Math.trunc((f) as double * (pOriginalLinePoints[j + 1].x as double - pOriginalLinePoints[j].x as double) / lHowManyThisSegment as double);
2101
+ ptCenter.y = pOriginalLinePoints[j].y + Math.trunc((f) as double * (pOriginalLinePoints[j + 1].y as double - pOriginalLinePoints[j].y as double) / lHowManyThisSegment as double);
2102
+ }
2103
+ else {
2104
+ ptCenter.x = pUpperLinePoints[j].x + Math.trunc((f) as double * (pUpperLinePoints[j + 1].x as double - pUpperLinePoints[j].x as double) / lHowManyThisSegment as double);
2105
+ ptCenter.y = pUpperLinePoints[j].y + Math.trunc((f) as double * (pUpperLinePoints[j + 1].y as double - pUpperLinePoints[j].y as double) / lHowManyThisSegment as double);
2106
+ let ptCenter2: POINT2 = new POINT2();
2107
+ ptCenter2.x = pLowerLinePoints[j].x + Math.trunc((f) as double * (pLowerLinePoints[j + 1].x as double - pLowerLinePoints[j].x as double) / lHowManyThisSegment as double);
2108
+ ptCenter2.y = pLowerLinePoints[j].y + Math.trunc((f) as double * (pLowerLinePoints[j + 1].y as double - pLowerLinePoints[j].y as double) / lHowManyThisSegment as double);
2109
+ ptCenter = lineutility.MidPointDouble(ptCenter, ptCenter2, 0);
2110
+ }
2111
+ }
2112
+
2113
+ //end section
2114
+
2115
+ switch (vbiDrawThis) {
2116
+ case TacticalLines.SINGLEC:
2117
+ case TacticalLines.DOUBLEC:
2118
+ case TacticalLines.TRIPLE: {
2119
+ for (l = 1; l < 37; l++) {
2120
+ dFactor = (10 * l as double) * pi / 180;
2121
+ pEllipsePoints2[l - 1].x = ptCenter.x + xSize * Math.cos(dFactor);
2122
+ pEllipsePoints2[l - 1].y = ptCenter.y + xSize / 2 * Math.sin(dFactor);
2123
+ pEllipsePoints2[l - 1].style = 0;
2124
+ }
2125
+ lineutility.RotateGeometryDouble(pEllipsePoints2, 36, dAngle * 180 / pi);
2126
+ pEllipsePoints2[36] = new POINT2(pEllipsePoints2[35]);
2127
+ pEllipsePoints2[36].style = 5;
2128
+ for (l = 0; l < 37; l++) {
2129
+ pLinePoints[lEllipseCounter] = new POINT2(pEllipsePoints2[l]);
2130
+ lEllipseCounter++;
2131
+ }
2132
+ break;
2133
+ }
2134
+
2135
+ case TacticalLines.HWFENCE:
2136
+ case TacticalLines.LWFENCE:
2137
+ case TacticalLines.DOUBLEA:
2138
+ case TacticalLines.UNSP:
2139
+ case TacticalLines.SFENCE:
2140
+ case TacticalLines.DFENCE: {
2141
+ XPoints[0].x = ptCenter.x - xSize;//was 4
2142
+ XPoints[0].y = ptCenter.y - xSize;
2143
+ XPoints[0].style = 0;
2144
+ XPoints[1].x = ptCenter.x + xSize;
2145
+ XPoints[1].y = ptCenter.y + xSize;
2146
+ XPoints[1].style = 5;
2147
+ XPoints[2].x = ptCenter.x - xSize;
2148
+ XPoints[2].y = ptCenter.y + xSize;
2149
+ XPoints[2].style = 0;
2150
+ XPoints[3].x = ptCenter.x + xSize;
2151
+ XPoints[3].y = ptCenter.y - xSize;
2152
+ XPoints[3].style = 5;
2153
+ XCounter++;
2154
+ lineutility.RotateGeometryDouble(XPoints, 4, Math.trunc(dAngle * 180 / pi));
2155
+ for (l = 0; l < 4; l++) {
2156
+ pLinePoints[lEllipseCounter] = new POINT2(XPoints[l]);
2157
+ switch (vbiDrawThis) {
2158
+ case TacticalLines.SFENCE: {
2159
+ if (XCounter === 2 || XCounter === 3 || XCounter === 4 || XCounter === 5) {
2160
+ pLinePoints[lEllipseCounter].style = 5;
2161
+ }
2162
+ break;
2163
+ }
2164
+
2165
+ case TacticalLines.DFENCE: {
2166
+ if (XCounter === 3 || XCounter === 4 || XCounter === 5) { //was 2,3 OR 4
2167
+ pLinePoints[lEllipseCounter].style = 5;
2168
+ }
2169
+ break;
2170
+ }
2171
+
2172
+ default: {
2173
+ break;
2174
+ }
2175
+
2176
+ }
2177
+ lEllipseCounter++;
2178
+ }
2179
+ if (XCounter === 5) {
2180
+ XCounter = 0;
2181
+ }
2182
+ break;
2183
+ }
2184
+
2185
+ default: {
2186
+ break;
2187
+ }
2188
+
2189
+ }
2190
+ }//end how many this segment loop
2191
+ if (lHowManyThisSegment === 0) {
2192
+ if (pLinePoints.length > lEllipseCounter) {
2193
+ pLinePoints[lEllipseCounter] = new POINT2(pOriginalLinePoints[j]);
2194
+ lEllipseCounter++;
2195
+ pLinePoints[lEllipseCounter] = new POINT2(pOriginalLinePoints[j + 1]);
2196
+ pLinePoints[lEllipseCounter].style = 5;
2197
+ lEllipseCounter++;
2198
+ }
2199
+ }
2200
+ }
2201
+ pLinePoints = lineutility.ResizeArray(pLinePoints, lEllipseCounter);
2202
+ vblCounter = pLinePoints.length; //added 11-2-09 M. Deutch
2203
+ }
2204
+
2205
+ //if none of the segments were long enough to have features
2206
+ //then make the style solid
2207
+ if (Channels.FenceType(vbiDrawThis) === 1) {
2208
+ if (lEllipseCounter <= vblLowerCounter + vblUpperCounter) {
2209
+ for (k = 0; k < vblLowerCounter + vblUpperCounter; k++) {
2210
+ if (pLinePoints[k].style !== 5) {
2211
+ //added 2-8-13
2212
+ pLinePoints[k].style = 0;
2213
+ }
2214
+
2215
+ }
2216
+ }
2217
+ else {
2218
+ for (k = lEllipseCounter - 1; k < pLinePoints.length; k++) {
2219
+ pLinePoints[k].style = 5;
2220
+ }
2221
+ }
2222
+ }
2223
+ break;
2224
+ }
2225
+
2226
+ case TacticalLines.BBS_LINE: {
2227
+ pLinePoints = new POINT2[vblLowerCounter + vblUpperCounter + 1];
2228
+ for (j = 0; j < vblLowerCounter; j++)
2229
+ pLinePoints[j] = pLowerLinePoints[j];
2230
+ for (j = 0; j < vblUpperCounter; j++)
2231
+ pLinePoints[j + vblLowerCounter] = pUpperLinePoints[vblUpperCounter - 1 - j];
2232
+ pLinePoints[pLinePoints.length - 1] = pLinePoints[0];
2233
+ break;
2234
+ }
2235
+
2236
+ case TacticalLines.SPT:
2237
+ case TacticalLines.SPT_STRAIGHT:
2238
+ case TacticalLines.CATK:
2239
+ case TacticalLines.CATKBYFIRE:
2240
+ case TacticalLines.AIRAOA:
2241
+ case TacticalLines.AAAAA:
2242
+ case TacticalLines.MAIN:
2243
+ case TacticalLines.MAIN_STRAIGHT: {
2244
+ if (vbiDrawThis !== TacticalLines.CATKBYFIRE) {
2245
+ vblCounter = vblLowerCounter + vblUpperCounter + 8;
2246
+ } else {
2247
+ vblCounter = vblLowerCounter + vblUpperCounter + 17;
2248
+ }
2249
+ //diagnostic
2250
+ if (vbiDrawThis === TacticalLines.AAAAA) {
2251
+ vblCounter = vblLowerCounter + vblUpperCounter + 19;
2252
+ }
2253
+
2254
+ pLinePoints = new Array<POINT2>(vblCounter);
2255
+ lineutility.InitializePOINT2Array(pLinePoints);
2256
+ //initialize points
2257
+ for (j = 0; j < pLinePoints.length; j++) {
2258
+ pLinePoints[j].x = lpsaUpperVBPoints[0];
2259
+ pLinePoints[j].y = lpsaUpperVBPoints[1];
2260
+ }
2261
+
2262
+ if (vbiDrawThis !== TacticalLines.CATK &&
2263
+ vbiDrawThis !== TacticalLines.CATKBYFIRE) {
2264
+ for (k = 0; k < vblCounter; k++) {
2265
+ pLinePoints[k].style = 0;
2266
+ }
2267
+ }
2268
+ Channels.GetAXADDouble(nPrinter, pLowerLinePoints,
2269
+ vblLowerCounter, pUpperLinePoints,
2270
+ vblUpperCounter, pArrowLinePoints[0],
2271
+ pLinePoints, vbiDrawThis, arrowOffsetFactor);
2272
+
2273
+ if (vbiDrawThis === TacticalLines.CATK ||
2274
+ vbiDrawThis === TacticalLines.CATKBYFIRE) {
2275
+ for (k = 0; k < vblCounter; k++) {
2276
+ if (pLinePoints[k].style !== 5) {
2277
+ pLinePoints[k].style = 1;
2278
+ }
2279
+ }
2280
+ }
2281
+
2282
+ //get the rotary symbol for AAAAA
2283
+ if (vbiDrawThis === TacticalLines.AAAAA) {
2284
+ let rotaryTooShort: boolean = false;
2285
+ let mUpper: ref<number[]> = new ref();
2286
+ let mLower: ref<number[]> = new ref();
2287
+ let bolVerticalUpper: int = 0;
2288
+ let bolVerticalLower: int = 0;
2289
+ let bUpper: double = 0;
2290
+ let bLower: double = 0;
2291
+
2292
+ pt0 = new POINT2(pLowerLinePoints[vblLowerCounter - 2]);
2293
+ pt1 = new POINT2(pLowerLinePoints[vblLowerCounter - 1]);
2294
+ let dist1: double = lineutility.CalcDistanceDouble(pt0, pt1);
2295
+
2296
+ bolVerticalLower = lineutility.CalcTrueSlopeDouble(pt0, pt1, mLower);
2297
+ bLower = pt0.y - mLower.value[0] * pt0.x;
2298
+
2299
+ pt0 = new POINT2(pUpperLinePoints[vblUpperCounter - 2]);
2300
+ pt1 = new POINT2(pUpperLinePoints[vblUpperCounter - 1]);
2301
+ bolVerticalUpper = lineutility.CalcTrueSlopeDouble(pt0, pt1, mUpper);
2302
+ bUpper = pt0.y - mUpper.value[0] * pt0.x;
2303
+ let dist2: double = lineutility.CalcDistanceDouble(pt0, pt1);
2304
+
2305
+ //if (dist1 > vblChannelWidth && dist2 > vblChannelWidth)
2306
+ //{
2307
+ midPt1 = lineutility.CalcTrueIntersectDouble2(mLower.value[0], bLower, mUpper.value[0], bUpper, bolVerticalLower, bolVerticalUpper, pt0.x, pt0.y);
2308
+
2309
+ //both sides of the channel need to be long enough
2310
+ //or the rotary sides will not work, but we still
2311
+ //include the arrow by using a simpler midpoint
2312
+ if (dist1 <= vblChannelWidth || dist2 <= vblChannelWidth) {
2313
+ rotaryTooShort = true;
2314
+ midPt1 = lineutility.MidPointDouble(pt0, pt1, 0);
2315
+ }
2316
+
2317
+ a = lineutility.CalcDistanceDouble(pt0, pt1);
2318
+ b = 30;
2319
+ if (a < 90) {
2320
+ b = a / 3;
2321
+ }
2322
+
2323
+ pt3 = new POINT2(pOriginalLinePoints[vblUpperCounter - 2]);
2324
+ pt4 = new POINT2(pOriginalLinePoints[vblUpperCounter - 1]);
2325
+ d = vblChannelWidth / 4;
2326
+ let DPIScaleFactor: double = RendererSettings.getInstance().getDeviceDPI() / 96.0;
2327
+ if (d > Channels.maxLength * DPIScaleFactor) {
2328
+ d = Channels.maxLength * DPIScaleFactor;
2329
+ }
2330
+ if (d < Channels.minLength * DPIScaleFactor) {
2331
+ d = Channels.minLength * DPIScaleFactor;
2332
+ }
2333
+
2334
+ //for non-vertical lines extend above or below the line
2335
+ if (pt3.x !== pt4.x) {
2336
+ //extend below the line
2337
+ pt0 = lineutility.ExtendDirectedLine(pt3, pt4, midPt1, 3, 2 * d);
2338
+ pLinePoints[vblLowerCounter + vblUpperCounter + 8] = pt0;
2339
+ pLinePoints[vblLowerCounter + vblUpperCounter + 8].style = 0;
2340
+ //extend above the line
2341
+ pt1 = lineutility.ExtendDirectedLine(pt3, pt4, midPt1, 2, 2 * d);
2342
+ pLinePoints[vblLowerCounter + vblUpperCounter + 9] = pt1;
2343
+ pLinePoints[vblLowerCounter + vblUpperCounter + 9].style = 5;
2344
+ }
2345
+ else //for vertical lines arrow points to the left
2346
+ {
2347
+ //extend right of the line
2348
+ pt0 = lineutility.ExtendDirectedLine(pt3, pt4, midPt1, 1, 2 * d);
2349
+ pLinePoints[vblLowerCounter + vblUpperCounter + 8] = pt0;
2350
+ pLinePoints[vblLowerCounter + vblUpperCounter + 8].style = 0;
2351
+ //extend left of the line
2352
+ pt1 = lineutility.ExtendDirectedLine(pt3, pt4, midPt1, 0, 2 * d);
2353
+ pLinePoints[vblLowerCounter + vblUpperCounter + 9] = pt1;
2354
+ pLinePoints[vblLowerCounter + vblUpperCounter + 9].style = 5;
2355
+ midPt1 = lineutility.MidPointDouble(pt0, pt1, 0);
2356
+ }
2357
+ //get the rotary symbol arrow
2358
+ lineutility.GetArrowHead4Double(pt0, pt1, d as int, d as int, arrowPts, 0);
2359
+
2360
+ for (k = 0; k < 3; k++) {
2361
+ pLinePoints[vblLowerCounter + vblUpperCounter + 10 + k] = arrowPts[k];
2362
+ }
2363
+
2364
+ pLinePoints[vblLowerCounter + vblUpperCounter + 12].style = 5;
2365
+
2366
+ //get the base points
2367
+ pt3 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, pt0, d / 2, 0);
2368
+ pt4 = lineutility.ExtendTrueLinePerpDouble(pt0, pt1, pt0, -d / 2, 0);
2369
+
2370
+ pLinePoints[vblLowerCounter + vblUpperCounter + 13] = pt3;
2371
+ pLinePoints[vblLowerCounter + vblUpperCounter + 14] = pt4;
2372
+
2373
+ //the side lines
2374
+ //first point
2375
+ pLinePoints[vblLowerCounter + vblUpperCounter + 14].style = 5;
2376
+ pt0 = new POINT2(pLowerLinePoints[vblLowerCounter - 2]);
2377
+ pt1 = new POINT2(pLowerLinePoints[vblLowerCounter - 1]);
2378
+ pt3 = lineutility.ExtendLine2Double(pt0, midPt1, b, 0); //line distance from midpt, a was 30
2379
+ pLinePoints[vblLowerCounter + vblUpperCounter + 15] = new POINT2(pt3);
2380
+
2381
+ //second point
2382
+ pt0 = new POINT2(pUpperLinePoints[vblLowerCounter - 2]);
2383
+ pt1 = new POINT2(pUpperLinePoints[vblLowerCounter - 1]);
2384
+ pt3 = lineutility.ExtendLine2Double(pt0, midPt1, b, 5); //line distance from midpt, a was 30
2385
+ pLinePoints[vblLowerCounter + vblUpperCounter + 16] = new POINT2(pt3);
2386
+
2387
+ //third point
2388
+ pt0 = new POINT2(pLowerLinePoints[vblLowerCounter - 2]);
2389
+ pt1 = new POINT2(pLowerLinePoints[vblLowerCounter - 1]);
2390
+ pt3 = lineutility.ExtendLine2Double(pt1, midPt1, b, 0); //line distance from midpt, a was 30
2391
+ pLinePoints[vblLowerCounter + vblUpperCounter + 17] = new POINT2(pt3);
2392
+
2393
+ //fourth point
2394
+ pt0 = new POINT2(pUpperLinePoints[vblLowerCounter - 2]);
2395
+ pt1 = new POINT2(pUpperLinePoints[vblLowerCounter - 1]);
2396
+ pt3 = lineutility.ExtendLine2Double(pt1, midPt1, b, 5); //line distance from midpt, a was 30
2397
+ pLinePoints[vblLowerCounter + vblUpperCounter + 18] = new POINT2(pt3);
2398
+ //}
2399
+ //else
2400
+ //{ //if last segment too short then don't draw the rotary features
2401
+ //if last segment too short then no side points
2402
+ if (rotaryTooShort) {
2403
+ for (l = vblLowerCounter + vblUpperCounter + 14; l < vblLowerCounter + vblLowerCounter + 19; l++) {
2404
+ pLinePoints[l].style = 5;
2405
+ }
2406
+ }
2407
+ //}
2408
+ }//end if (vbiDrawThis == (long) TacticalLines.AAAAA)
2409
+
2410
+ let dFeature: double = 0;
2411
+ let dist2: double = 0;
2412
+ if (vbiDrawThis === TacticalLines.CATKBYFIRE) { //dist is the distance to the back of the arrowhead
2413
+ //10-19-12
2414
+ //this line is part of the new requirement that the rotary feature must align
2415
+ //with the anchor point, it can no longer stick out beond the anchor point
2416
+ //so the points have to be shifted by 45 pixels.
2417
+
2418
+ //dist-=45;
2419
+ //end section
2420
+ dist2 = lineutility.CalcDistanceDouble(nextToLastPoint, lastPoint);
2421
+ if (dist2 > 45) {
2422
+
2423
+ dist -= 45;
2424
+ }
2425
+
2426
+ if (dist2 > 20) { //was 20+dist
2427
+ pt1 = lineutility.ExtendLineDouble(pUpperLinePoints[vblUpperCounter - 2], pUpperLinePoints[vblUpperCounter - 1], 5 + dist);//distance from tip to back of rotary
2428
+ pt2 = lineutility.ExtendLineDouble(pLowerLinePoints[vblLowerCounter - 2], pLowerLinePoints[vblLowerCounter - 1], 5 + dist);//distance from tip to back of rotary
2429
+ }
2430
+ else {
2431
+ pt1 = lineutility.ExtendLineDouble(pUpperLinePoints[vblUpperCounter - 2], pUpperLinePoints[vblUpperCounter - 1], -50);//was -40
2432
+ pt2 = lineutility.ExtendLineDouble(pLowerLinePoints[vblLowerCounter - 2], pLowerLinePoints[vblLowerCounter - 1], -50);//was -40
2433
+ }
2434
+ //was dist
2435
+ pt3 = lineutility.ExtendLine2Double(pt2, pt1, 10 + Math.abs(dist / 2), 18); //vert height of rotary from horiz segment was dist/2.5
2436
+ pt4 = lineutility.ExtendLine2Double(pt1, pt2, 10 + Math.abs(dist / 2), 5); //vert height of rotary from horiz segment was dist/2.5
2437
+ midPt1 = lineutility.MidPointDouble(pt1, pt2, 17);
2438
+ pLinePoints[vblCounter - 9] = new POINT2(pt3);
2439
+ pLinePoints[vblCounter - 6] = new POINT2(pt4);
2440
+
2441
+ if (dist2 > 20) { //was 30+dist
2442
+ pt1 = lineutility.ExtendLineDouble(pUpperLinePoints[vblUpperCounter - 2], pUpperLinePoints[vblUpperCounter - 1], 15 + dist);//distance from tip to back of rotary
2443
+ pt2 = lineutility.ExtendLineDouble(pLowerLinePoints[vblLowerCounter - 2], pLowerLinePoints[vblLowerCounter - 1], 15 + dist);//distance from tip to back of rotary
2444
+ } else {
2445
+ pt1 = lineutility.ExtendLineDouble(pUpperLinePoints[vblUpperCounter - 2], pUpperLinePoints[vblUpperCounter - 1], -50);//was -50
2446
+ pt2 = lineutility.ExtendLineDouble(pLowerLinePoints[vblLowerCounter - 2], pLowerLinePoints[vblLowerCounter - 1], -50);//was -50
2447
+ }
2448
+
2449
+ pt3 = lineutility.ExtendLine2Double(pt2, pt1, Math.abs(dist / 2), 18);//vert height of rotary from horiz segment was dist/2.5
2450
+ pt4 = lineutility.ExtendLine2Double(pt1, pt2, Math.abs(dist / 2), 18);//vert height of rotary from horiz segment was dist/2.5
2451
+
2452
+ midPt2 = lineutility.MidPointDouble(pt1, pt2, 18);
2453
+ pLinePoints[vblCounter - 8] = new POINT2(pt3);
2454
+ pLinePoints[vblCounter - 7] = new POINT2(pt4);
2455
+ pLinePoints[vblCounter - 5] = new POINT2(midPt2);
2456
+ if (midPt1.x === midPt2.x && midPt1.y === midPt2.y) //last segment too short
2457
+ {
2458
+ //diagnostic 2-27-13
2459
+ if (Channels._client.startsWith("cpof")) {
2460
+
2461
+ dFeature = 30;
2462
+ }
2463
+
2464
+ else {
2465
+
2466
+ dFeature = 15;
2467
+ }
2468
+
2469
+
2470
+
2471
+ midPt1 = lineutility.ExtendLine2Double(nextToLastPoint, pArrowLinePoints[0], 10, 17);
2472
+ //pt1 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt1, midPt1, 30, 18);
2473
+ //pt2 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt1, midPt1, -30, 5);
2474
+ pt1 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt1, midPt1, dFeature, 18);
2475
+ pt2 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt1, midPt1, -dFeature, 5);
2476
+ //end section
2477
+ pLinePoints[vblCounter - 9] = new POINT2(pt1);
2478
+ pLinePoints[vblCounter - 6] = new POINT2(pt2);
2479
+
2480
+ if (Channels._client.startsWith("cpof")) {
2481
+
2482
+ midPt2 = lineutility.ExtendLine2Double(nextToLastPoint, pArrowLinePoints[0], 20, 17);
2483
+ }
2484
+
2485
+ else {
2486
+ if (dist2 > 30) {
2487
+
2488
+ midPt2 = lineutility.ExtendLine2Double(nextToLastPoint, pArrowLinePoints[0], 20, 17);
2489
+ }
2490
+
2491
+ else {
2492
+
2493
+ midPt2 = lineutility.ExtendLine2Double(nextToLastPoint, pArrowLinePoints[0], dFeature, 17);
2494
+ }
2495
+
2496
+ }
2497
+ //end section
2498
+
2499
+ //diagnostic 2-27-13
2500
+ //pt1 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt2, midPt2, 20, 18);
2501
+ //pt2 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt2, midPt2, -20, 18);
2502
+ dFeature -= 10;
2503
+ pt1 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt2, midPt2, dFeature, 18);
2504
+ pt2 = lineutility.ExtendTrueLinePerpDouble(lastPoint, midPt2, midPt2, -dFeature, 18);
2505
+ pLinePoints[vblCounter - 8] = new POINT2(pt1);
2506
+ pLinePoints[vblCounter - 7] = new POINT2(pt2);
2507
+ pLinePoints[vblCounter - 5] = new POINT2(midPt2);
2508
+ }
2509
+ if (Channels._client.startsWith("cpof")) {
2510
+
2511
+ dFeature = 30;
2512
+ }
2513
+
2514
+ else {
2515
+ if (dist2 > 30) {
2516
+
2517
+ dFeature = 30;
2518
+ }
2519
+
2520
+ else {
2521
+ if (dist2 > 20) {
2522
+
2523
+ dFeature = 10;
2524
+ }
2525
+
2526
+ else {
2527
+
2528
+ dFeature = 10;
2529
+ }
2530
+
2531
+ }
2532
+
2533
+ }
2534
+
2535
+ pt1 = lineutility.ExtendLine2Double(midPt1, midPt2, dFeature, dFeature as int); //30, then 5
2536
+ pLinePoints[vblCounter - 4] = new POINT2(pt1);
2537
+ lineutility.GetArrowHead4Double(midPt2, pt1, Math.trunc(dFeature / 2), Math.trunc(dFeature / 2), arrowPts, 18);//15,15
2538
+ //end section
2539
+ for (k = 0; k < 3; k++) {
2540
+ pLinePoints[vblCounter - k - 1] = new POINT2(arrowPts[k]);
2541
+ pLinePoints[vblCounter - k - 1].style = 18;
2542
+ }
2543
+ }
2544
+ break;
2545
+ }
2546
+
2547
+ default: {
2548
+ break;
2549
+ }
2550
+
2551
+ } //end load channel array ino pLinePoints
2552
+ if (vbiDrawThis === TacticalLines.CHANNEL_DASHED) {
2553
+ for (k = 0; k < vblCounter; k++) {
2554
+ if (pLinePoints[k].style !== 5) {
2555
+ pLinePoints[k].style = 18;
2556
+ }
2557
+ }
2558
+ }
2559
+
2560
+ //if shapes is null it is not a CPOF client
2561
+ if (shapes == null) {
2562
+ //load result points because client is using points, not shapes
2563
+ for (j = 0; j < pLinePoints.length; j++) {
2564
+ resultVBPoints[3 * j] = pLinePoints[j].x;
2565
+ resultVBPoints[3 * j + 1] = pLinePoints[j].y;
2566
+ resultVBPoints[3 * j + 2] = pLinePoints[j].style as double;
2567
+ }
2568
+ return pLinePoints.length;
2569
+ }
2570
+
2571
+ //the shapes
2572
+ let shape: Shape2 | null = null;
2573
+ //Shape2 outline=null;
2574
+ let beginLine: boolean = true;
2575
+ let beginPath: boolean = true;
2576
+
2577
+ for (k = 0; k < vblCounter; k++) {
2578
+ //use shapes instead of pixels
2579
+
2580
+ if (shape == null) {
2581
+ shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
2582
+ }
2583
+
2584
+ switch (vbiDrawThis) {
2585
+ case TacticalLines.CATK:
2586
+ case TacticalLines.CATKBYFIRE: {
2587
+ shape.set_Style(1);
2588
+ break;
2589
+ }
2590
+
2591
+
2592
+ default:
2593
+
2594
+ }
2595
+
2596
+ switch (vbiDrawThis) {
2597
+ case TacticalLines.LC: {
2598
+ if (beginPath === false) {
2599
+ if (k > 0) { //if the linestyle is changes on the next point then this point is end of the current path
2600
+ //because it's changing between friendly and enemy ellipses
2601
+ if (pLinePoints[k].style === 5) {
2602
+ //add the last point to the current path
2603
+ shape.lineTo(pLinePoints[k]);
2604
+ //add the shape
2605
+ if (shape != null && shape.getShape() != null) {
2606
+ shapes.push(shape);
2607
+ }
2608
+
2609
+ beginPath = true;
2610
+ }
2611
+ else //continue the current path
2612
+ {
2613
+ shape.lineTo(pLinePoints[k]);
2614
+ }
2615
+ }
2616
+ else //k=0
2617
+ {
2618
+ shape.moveTo(pLinePoints[k]);
2619
+ }
2620
+ }
2621
+ else //start a new path
2622
+ {
2623
+ shape = new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
2624
+ shape.moveTo(pLinePoints[k]);
2625
+ shape.set_Style(pLinePoints[k].style);
2626
+ //assume friendly
2627
+ if (pLinePoints[k].style === 25) {
2628
+
2629
+ shape.setLineColor(Color.RED);
2630
+ }
2631
+
2632
+
2633
+ beginPath = false;
2634
+ }
2635
+ //if(k==vblCounter-1) //LC should have 2 shapes
2636
+ // if(shape !=null && shape.get_Shape() != null)
2637
+ // shapes.push(shape);
2638
+ break;
2639
+ }
2640
+
2641
+ case TacticalLines.CATK: //same as default except these have doubled 5's
2642
+ case TacticalLines.CATKBYFIRE:
2643
+ case TacticalLines.AAAAA:
2644
+ case TacticalLines.SPT:
2645
+ case TacticalLines.SPT_STRAIGHT:
2646
+ case TacticalLines.AIRAOA: {
2647
+ if (beginLine) {
2648
+ if (k > 0) //doubled points with linestyle=5
2649
+ {
2650
+ if (pLinePoints[k].style === 5 && pLinePoints[k - 1].style === 5 && k !== vblCounter - 1) {
2651
+
2652
+ continue;
2653
+ }
2654
+
2655
+ }
2656
+
2657
+ shape.moveTo(pLinePoints[k]);
2658
+ beginLine = false;
2659
+ }
2660
+ else {
2661
+ shape.lineTo(pLinePoints[k]);
2662
+ if (pLinePoints[k].style === 5) {
2663
+ beginLine = true;
2664
+ //unless there are doubled points with style=5
2665
+ }
2666
+ }
2667
+ if (k === vblCounter - 1) //non-LC should only have one shape
2668
+ {
2669
+ if (shape != null && shape.getShape() != null) {
2670
+ shapes.push(shape);
2671
+ }
2672
+ }
2673
+ break;
2674
+ }
2675
+
2676
+ case TacticalLines.UNSP:
2677
+ case TacticalLines.SFENCE:
2678
+ case TacticalLines.DFENCE:
2679
+ case TacticalLines.LWFENCE:
2680
+ case TacticalLines.HWFENCE: {
2681
+ if (k === 0) {
2682
+ shape.moveTo(pLinePoints[k]);
2683
+ if (pLinePoints[k].style === 5) {
2684
+ continue;
2685
+ }
2686
+ }
2687
+ if (k > 0 && k < vblCounter - 1) {
2688
+ if (pLinePoints[k - 1].style === 5) {
2689
+
2690
+ shape.moveTo(pLinePoints[k]);
2691
+ }
2692
+
2693
+ else {
2694
+ if (pLinePoints[k - 1].style === 0) {
2695
+
2696
+ shape.lineTo(pLinePoints[k]);
2697
+ }
2698
+
2699
+ }
2700
+
2701
+
2702
+ if (pLinePoints[k].style === 5) {
2703
+
2704
+ shape.moveTo(pLinePoints[k]);
2705
+ }
2706
+
2707
+
2708
+ if (k === vblCounter - 2 && pLinePoints[k].style === 0) {
2709
+ shape.moveTo(pLinePoints[k]);
2710
+ shape.lineTo(pLinePoints[k + 1]);
2711
+ }
2712
+ }
2713
+
2714
+ if (k === vblCounter - 1) //non-LC should only have one shape
2715
+ {
2716
+ if (shape != null && shape.getShape() != null) {
2717
+
2718
+ shapes.push(shape);
2719
+ }
2720
+
2721
+ }
2722
+ break;
2723
+ }
2724
+
2725
+ default: {
2726
+ if (beginLine) {
2727
+ if (k === 0) {
2728
+
2729
+ shape.set_Style(pLinePoints[k].style);
2730
+ }
2731
+
2732
+
2733
+ shape.moveTo(pLinePoints[k]);
2734
+ beginLine = false;
2735
+ }
2736
+ else {
2737
+ shape.lineTo(pLinePoints[k]);
2738
+ if (pLinePoints[k].style === 5) {
2739
+ beginLine = true;
2740
+ //unless there are doubled points with style=5
2741
+ }
2742
+ }
2743
+ if (k === vblCounter - 1) //non-LC should only have one shape
2744
+ {
2745
+ if (shape != null && shape.getShape() != null) {
2746
+
2747
+ shapes.push(shape);
2748
+ }
2749
+
2750
+ }
2751
+ break;
2752
+ }
2753
+
2754
+ }//end switch
2755
+ } //end for
2756
+ //a requirement was added to enable fill for the axis of advance line types
2757
+ let fillShapes: Array<Shape2> = Channels.getAXADFillShapes(vbiDrawThis, pLinePoints);
2758
+ if (fillShapes != null && fillShapes.length > 0) {
2759
+ shapes.unshift(...fillShapes); // shapes.addAll(0,fillShapes);
2760
+ }
2761
+
2762
+ //diagnostic
2763
+ if(vbiDrawThis==TacticalLines.BBS_LINE)
2764
+ {
2765
+ //shapes.remove(1);
2766
+ shape=new Shape2(Shape2.SHAPE_TYPE_POLYLINE);
2767
+ shape.moveTo(pOriginalLinePoints[0]);
2768
+ for(j=1;j<pOriginalLinePoints.length;j++)
2769
+ shape.lineTo(pOriginalLinePoints[j]);
2770
+ shapes.push(shape);
2771
+ }
2772
+ //end section
2773
+
2774
+ lResult = lResultCounter;
2775
+ //FillPoints(pLinePoints,pLinePoints.length);
2776
+ } catch (exc) {
2777
+ if (exc instanceof Error) {
2778
+ ErrorLogger.LogException(Channels._className, "GetChannel1Double",
2779
+ new RendererException("Failed inside GetChannel1Double " + tg.get_LineType().toString(), exc));
2780
+ } else {
2781
+ throw exc;
2782
+ }
2783
+ }
2784
+ return lResult;
2785
+ }
2786
+ /**
2787
+ * They decided that axis of advance must enable fill
2788
+ * @param lineType
2789
+ * @param pLinePoints
2790
+ * @return
2791
+ */
2792
+ private static getAXADFillShapes(lineType: int, pLinePoints: POINT2[]): Array<Shape2> {
2793
+ let shapes: Array<Shape2>;
2794
+ try {
2795
+ let newPts: Array<POINT2> = new Array();
2796
+ let j: int = 0;
2797
+ let shape: Shape2;
2798
+ let n: int = pLinePoints.length;
2799
+ let t: int = 0;
2800
+ switch (lineType) {
2801
+ case TacticalLines.BBS_LINE: {
2802
+ shape=new Shape2(Shape2.SHAPE_TYPE_FILL);
2803
+ shape.moveTo(pLinePoints[0]);
2804
+ //for(j=1;j<pLinePoints.length;j++)
2805
+ for(j=1;j<n;j++)
2806
+ {
2807
+ shape.lineTo(pLinePoints[j]);
2808
+ }
2809
+ break;
2810
+ }
2811
+
2812
+ case TacticalLines.CHANNEL:
2813
+ case TacticalLines.CHANNEL_FLARED:
2814
+ case TacticalLines.CHANNEL_DASHED: {
2815
+ for (j = 0; j < n / 2; j++) {
2816
+ newPts.push(pLinePoints[j]);
2817
+ }
2818
+ for (j = n - 1; j >= n / 2; j--) {
2819
+ newPts.push(pLinePoints[j]);
2820
+ }
2821
+ shape = new Shape2(Shape2.SHAPE_TYPE_FILL);
2822
+ shape.moveTo(newPts[0]);
2823
+ let t: int = newPts.length;
2824
+ //for(j=1;j<newPts.length;j++)
2825
+ for (j = 1; j < t; j++) {
2826
+ shape.lineTo(newPts[j]);
2827
+ }
2828
+ break;
2829
+ }
2830
+
2831
+ case TacticalLines.AIRAOA:
2832
+ case TacticalLines.SPT:
2833
+ case TacticalLines.CATK:
2834
+ case TacticalLines.SPT_STRAIGHT: {
2835
+ //add the upper (lower) channel points
2836
+ //for(j=0;j<(pLinePoints.length-8)/2;j++)
2837
+ for (j = 0; j < (n - 8) / 2; j++) {
2838
+ newPts.push(pLinePoints[j]);
2839
+ }
2840
+ //add the arrow outline
2841
+ newPts.push(pLinePoints[n - 6]);;;
2842
+ newPts.push(pLinePoints[n - 7]);;
2843
+ newPts.push(pLinePoints[n - 8]);;
2844
+ newPts.push(pLinePoints[n - 3]);
2845
+ newPts.push(pLinePoints[n - 4]);
2846
+ //add the upper (lower) channel points
2847
+ for (j = n - 9; j >= (n - 8) / 2; j--) {
2848
+ newPts.push(pLinePoints[j]);
2849
+ }
2850
+ //newPts.push(pLinePoints[0]);
2851
+ shape = new Shape2(Shape2.SHAPE_TYPE_FILL);
2852
+ //shape.moveTo(newPts[0].x,newPts[0].y);
2853
+ shape.moveTo(newPts[0]);
2854
+ t = newPts.length;
2855
+ //for(j=1;j<newPts.length;j++)
2856
+ for (j = 1; j < t; j++) {
2857
+ shape.lineTo(newPts[j]);
2858
+ }
2859
+ break;
2860
+ }
2861
+
2862
+ case TacticalLines.MAIN_STRAIGHT:
2863
+ case TacticalLines.MAIN: {
2864
+ //for(j=0;j<(pLinePoints.length-8)/2;j++)
2865
+ for (j = 0; j < (n - 8) / 2; j++) {
2866
+ newPts.push(pLinePoints[j]);
2867
+ }
2868
+ //add the arrow outline
2869
+ newPts.push(pLinePoints[n - 6]);
2870
+ newPts.push(pLinePoints[n - 5]);
2871
+ for (j = n - 9; j >= (n - 8) / 2; j--) {
2872
+ newPts.push(pLinePoints[j]);
2873
+ }
2874
+ shape = new Shape2(Shape2.SHAPE_TYPE_FILL);
2875
+ shape.moveTo(newPts[0]);
2876
+ t = newPts.length;
2877
+ //for(j=1;j<newPts.length;j++)
2878
+ for (j = 1; j < t; j++) {
2879
+ shape.lineTo(newPts[j]);
2880
+ }
2881
+ break;
2882
+ }
2883
+
2884
+ case TacticalLines.AAAAA: {
2885
+ //for(j=0;j<(pLinePoints.length-19)/2;j++)
2886
+ for (j = 0; j < (n - 19) / 2; j++) {
2887
+ newPts.push(pLinePoints[j]);
2888
+ }
2889
+ //add the arrow outline
2890
+ newPts.push(pLinePoints[n - 17]);
2891
+ newPts.push(pLinePoints[n - 18]);;
2892
+ newPts.push(pLinePoints[n - 19]);
2893
+ newPts.push(pLinePoints[n - 14]);;
2894
+ newPts.push(pLinePoints[n - 15]);
2895
+
2896
+ for (j = n - 20; j >= (n - 19) / 2; j--) {
2897
+ newPts.push(pLinePoints[j]);
2898
+ }
2899
+ shape = new Shape2(Shape2.SHAPE_TYPE_FILL);
2900
+ shape.moveTo(newPts[0]);
2901
+ t = newPts.length;
2902
+ //for(j=1;j<newPts.length;j++)
2903
+ for (j = 1; j < t; j++) {
2904
+ shape.lineTo(newPts[j]);
2905
+ }
2906
+ break;
2907
+ }
2908
+
2909
+ case TacticalLines.CATKBYFIRE: {
2910
+ //for(j=0;j<(pLinePoints.length-17)/2;j++)
2911
+ for (j = 0; j < (n - 17) / 2; j++) {
2912
+ newPts.push(pLinePoints[j]);
2913
+ }
2914
+ //add the arrow outline
2915
+ newPts.push(pLinePoints[n - 15]);
2916
+ newPts.push(pLinePoints[n - 16]);
2917
+ newPts.push(pLinePoints[n - 17]);
2918
+ newPts.push(pLinePoints[n - 12]);
2919
+ newPts.push(pLinePoints[n - 13]);
2920
+ for (j = n - 18; j >= (n - 17) / 2; j--) {
2921
+ newPts.push(pLinePoints[j]);
2922
+ }
2923
+ shape = new Shape2(Shape2.SHAPE_TYPE_FILL);
2924
+ shape.moveTo(newPts[0]);
2925
+ t = newPts.length;
2926
+ //for(j=1;j<newPts.length;j++)
2927
+ for (j = 1; j < t; j++) {
2928
+ shape.lineTo(newPts[j]);
2929
+ }
2930
+ break;
2931
+ }
2932
+
2933
+ default: {
2934
+ break;
2935
+ }
2936
+
2937
+ }
2938
+ if (shape != null) {
2939
+ shapes = new Array();
2940
+ shape.setLineColor(null);
2941
+ shapes.push(shape);
2942
+ }
2943
+ } catch (exc) {
2944
+ if (exc instanceof Error) {
2945
+ ErrorLogger.LogException(Channels._className, "getAXADfillShapes",
2946
+ new RendererException("Failed inside getAXADFillShapes", exc));
2947
+ } else {
2948
+ throw exc;
2949
+ }
2950
+ }
2951
+ return shapes;
2952
+ }
2953
+ /*
2954
+ * sets shape2 properties to those of shape1
2955
+ * @param shape1
2956
+ * @param shape2
2957
+ */
2958
+ // private static void SetShapeProperties(Shape2 shape1, Shape2 shape2)
2959
+ // {
2960
+ // try
2961
+ // {
2962
+ // shape2.setLineColor(shape1.getLineColor());
2963
+ // shape2.setStroke(shape1.getStroke());
2964
+ // shape2.setFillColor(shape1.getFillColor());
2965
+ // }
2966
+ // catch (Exception exc) {
2967
+ // ErrorLogger.LogException(_className ,"GetChannel1Double",
2968
+ // new RendererException("Failed inside SetShapeProperties", exc));
2969
+ // }
2970
+ // }
2971
+ }