@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,2173 @@
1
+ import { type int, type double} from "../graphics2d/BasicTypes";
2
+
3
+ import { arraysupport } from "../JavaLineArray/arraysupport"
4
+ import { lineutility } from "../JavaLineArray/lineutility"
5
+ import { POINT2 } from "../JavaLineArray/POINT2"
6
+ import { ref } from "../JavaLineArray/ref"
7
+ import { TacticalLines } from "../JavaLineArray/TacticalLines"
8
+ import { TGLight } from "../JavaTacticalRenderer/TGLight"
9
+ import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
10
+ import { RendererException } from "../renderer/utilities/RendererException"
11
+
12
+ /**
13
+ * A class for calculating flot ellipses. Some functions use the same array for the client points
14
+ * and the return points. The caller allocates a size large enough to hold the return points.
15
+ *
16
+ *
17
+ */
18
+ export class flot {
19
+ private static readonly _className: string = "flot";
20
+ static GetAnchorageFlotSegment(vbPoints: number[],
21
+ x1: int,
22
+ y1: int,
23
+ x2: int,
24
+ y2: int,
25
+ segment: int,
26
+ floatDiameter: double,
27
+ points: number[],
28
+ bFlip: ref<number[]>,
29
+ lDirection: ref<number[]>,
30
+ lLastDirection: ref<number[]>): int {
31
+ let lSegCounter: int = 0;
32
+ try {
33
+ let j: int = 0;
34
+ let dDistance: double = 0;
35
+ let nNumSegs: int = 0;
36
+ let m: int = 0;
37
+ let lLocx: int = 0;
38
+ let lLocy: int = 0;
39
+ let dAngle: double = 0;
40
+ let arcPoints: number[] = new Array<number>(30);
41
+ let dRemainder: double = 0;
42
+ let dNum: double = 0;
43
+ let dDen: double = 0;
44
+
45
+ if (segment === 0 && vbPoints[0] >= vbPoints[2]) {
46
+ bFlip.value[0] = 1;//TRUE;
47
+ }
48
+ if (segment === 0 && vbPoints[0] < vbPoints[2]) {
49
+ bFlip.value[0] = 0;//FALSE;
50
+ }
51
+
52
+ dNum = vbPoints[2 * segment + 3] - vbPoints[2 * segment + 1];
53
+ dDen = vbPoints[2 * segment + 2] - vbPoints[2 * segment];
54
+
55
+ //for some reason this did not blow up before I put the if/else
56
+ //instead it would assign pi/2 to dAngle when dDen=0
57
+ if (dDen === 0) {
58
+ dAngle = Math.PI / 2;
59
+ } else {
60
+ dAngle = Math.abs(Math.atan(dNum / dDen));
61
+ }
62
+
63
+ //convert to degrees
64
+ dAngle = (180 / Math.PI) * dAngle;
65
+
66
+ if (vbPoints[2 * segment + 0] <= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] >= vbPoints[2 * segment + 3]) {
67
+ dAngle = 90 - dAngle;
68
+ } else {
69
+ if (vbPoints[2 * segment + 0] <= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] <= vbPoints[2 * segment + 3]) {
70
+ dAngle = dAngle + 90;
71
+ } else {
72
+ if (vbPoints[2 * segment + 0] >= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] <= vbPoints[2 * segment + 3]) {
73
+ dAngle = 270 - dAngle;
74
+ } else {
75
+ if (vbPoints[2 * segment + 0] >= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] >= vbPoints[2 * segment + 3]) {
76
+ dAngle = 270 + dAngle;
77
+ }
78
+ }
79
+
80
+ }
81
+
82
+ }
83
+
84
+
85
+ dDistance = lineutility.CalcDistance2(x1, y1, x2, y2);
86
+
87
+ nNumSegs = Math.trunc(dDistance / floatDiameter);
88
+ if (nNumSegs % 2 === 0) {
89
+ nNumSegs -= 1;
90
+ }
91
+
92
+ dRemainder = nNumSegs * floatDiameter - dDistance;
93
+ dDistance = dDistance + dRemainder;
94
+
95
+ //calculate the default dAngle here
96
+ //also establish the lDirection
97
+ if (vbPoints[2 * segment] >= vbPoints[2 * segment + 2]) {
98
+ dAngle = dAngle + 90;
99
+ lDirection.value[0] = 1;
100
+ } else {
101
+ dAngle = dAngle - 90;
102
+ lDirection.value[0] = 0;
103
+ }
104
+
105
+ if (segment > 0 && lDirection.value[0] !== lLastDirection.value[0]) {
106
+ //'toggle bflip if the lDirection changes
107
+ if (bFlip.value[0] === 1) {
108
+ bFlip.value[0] = 0;
109
+ } else {
110
+ bFlip.value[0] = 1;
111
+ }
112
+ }
113
+
114
+ //'flip the segment if necessary
115
+ if (bFlip.value[0] === 1) {
116
+ dAngle = dAngle + 180;
117
+ }
118
+
119
+ //for( m = 0; m< nNumSegs;m++)
120
+ for (m = 0; m < nNumSegs; m += 2) //get evry other flot only for anchorage
121
+ {
122
+ lLocx = Math.trunc(x1 + (m + 0.5) * (x2 - x1) * floatDiameter / dDistance);
123
+ lLocy = Math.trunc(y1 + (m + 0.5) * (y2 - y1) * floatDiameter / dDistance);
124
+
125
+ flot.CalcAnglePoints(lLocx, lLocy, dAngle, arcPoints, dDistance / (nNumSegs as double * 2));
126
+
127
+ for (j = 0; j < 30; j++) {
128
+ points[lSegCounter] = arcPoints[j];
129
+ lSegCounter++;
130
+ }
131
+ }
132
+
133
+ //save last lDirection
134
+ lLastDirection.value[0] = lDirection.value[0];
135
+ } catch (exc) {
136
+ if (exc instanceof Error) {
137
+ ErrorLogger.LogException(flot._className, "GetAnchorageFlotSegment",
138
+ new RendererException("Failed inside GetAnchorageFlotSegment", exc));
139
+ } else {
140
+ throw exc;
141
+ }
142
+ }
143
+ return lSegCounter;
144
+ }
145
+
146
+ static GetAnchorageCountDouble(vbPoints: POINT2[], floatDiameter: double, numPts: int): int {
147
+ let lTotalpts: int = 0;
148
+ try {
149
+ //declarations
150
+ let j: int = 0;
151
+ let lNumSegs: int = 0;
152
+ let dDistance: double = 0;
153
+ let vbPoints2: POINT2[];
154
+ //end declarations
155
+
156
+ vbPoints2 = new Array<POINT2>(numPts);
157
+ for (j = 0; j < numPts; j++) {
158
+ vbPoints2[j] = new POINT2(vbPoints[j]);
159
+ }
160
+ for (j = 0; j < numPts - 1; j++) {
161
+ dDistance = lineutility.CalcDistanceDouble(vbPoints2[j], vbPoints2[j + 1]);
162
+ lNumSegs = Math.trunc(dDistance / floatDiameter);
163
+ if (lNumSegs > 0) {
164
+ lTotalpts += lNumSegs * 12; //10 points per flot + 2 end points for line
165
+ } else {
166
+ lTotalpts += 1;
167
+ }
168
+ }
169
+ lTotalpts += 1;
170
+
171
+ } catch (exc) {
172
+ if (exc instanceof Error) {
173
+ ErrorLogger.LogException(flot._className, "GetAnchorageCountDouble",
174
+ new RendererException("Failed inside GetAnchorageCountDouble", exc));
175
+ } else {
176
+ throw exc;
177
+ }
178
+ }
179
+ return (lTotalpts);
180
+ }
181
+ static GetFlotCount2Double(tg: TGLight, vbPoints: POINT2[], numPts: int): int {
182
+ let lTotalpts: int = 0;
183
+ try {
184
+ let j: int = 0;
185
+ let lNumSegs: int = 0;
186
+ let dDistance: double = 0;
187
+ let dIncrement: double = 0;
188
+ let nFactor: int = 10;
189
+
190
+ switch (tg.get_LineType()) {
191
+ case TacticalLines.WF:
192
+ case TacticalLines.UWF: {
193
+ dIncrement = arraysupport.getScaledSize(40, tg.get_LineThickness(), tg.get_patternScale());
194
+ break;
195
+ }
196
+
197
+ case TacticalLines.WFG: {
198
+ dIncrement = arraysupport.getScaledSize(60, tg.get_LineThickness(), tg.get_patternScale());
199
+ nFactor = 17;
200
+ break;
201
+ }
202
+
203
+ case TacticalLines.WFY: {
204
+ dIncrement = arraysupport.getScaledSize(60, tg.get_LineThickness(), tg.get_patternScale());
205
+ nFactor = 20;
206
+ break;
207
+ }
208
+
209
+ default: {
210
+ dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale());
211
+ break;
212
+ }
213
+
214
+ }
215
+
216
+ for (j = 0; j < numPts - 1; j++) {
217
+ dDistance = lineutility.CalcDistanceDouble(vbPoints[j], vbPoints[j + 1]);
218
+ lNumSegs = Math.trunc(dDistance / dIncrement); //flot diameter is 20
219
+ lTotalpts = lTotalpts + lNumSegs * nFactor; //10 points per flot
220
+ switch (tg.get_LineType()) {
221
+ case TacticalLines.WFG:
222
+ case TacticalLines.WFY: {
223
+ if (lNumSegs === 0) {
224
+ lTotalpts += 2; //add 2 points for the line segment
225
+ }
226
+ break;
227
+ }
228
+
229
+ default: {
230
+ break;
231
+ }
232
+
233
+ }
234
+
235
+ }
236
+ } catch (exc) {
237
+ if (exc instanceof Error) {
238
+ ErrorLogger.LogException(flot._className, "GetFlotCount2Double",
239
+ new RendererException("Failed inside GetFlotCount2Double", exc));
240
+ } else {
241
+ throw exc;
242
+ }
243
+ }
244
+ return lTotalpts;
245
+ }
246
+
247
+ static GetFlot2Double(tg: TGLight, vbPoints2: POINT2[], numPts: int): int {
248
+ let lFlotCounter: int = 0;
249
+ try {
250
+ let lineType: int = tg.get_LineType();
251
+ let j: int = 0;
252
+ let k: int = 0;
253
+ let l: int = 0;
254
+ let x1: int = 0;
255
+ let y1: int = 0;
256
+ let x2: int = 0;
257
+ let y2: int = 0;
258
+ let z2: int = 0;
259
+ let numSegPts: int = -1;
260
+ let z: int = 0;
261
+ let lFlotCount: int = 0;
262
+ let lNumSegs: int = 0;
263
+ let dDistance: double = 0;
264
+ let vbPoints: number[];
265
+ let points: number[];
266
+ let dIncrement: double = 0;
267
+ let style10Points: POINT2[];
268
+ let style10Counter: int = 0;
269
+ let pt0: POINT2 = new POINT2();
270
+ let pt1: POINT2 = new POINT2();
271
+ let pt2: POINT2 = new POINT2();
272
+ let crossPt1: POINT2 = new POINT2();
273
+ let crossPt2: POINT2 = new POINT2();
274
+ let bFlip: ref<number[]> = new ref();
275
+ let lDirection: ref<number[]> = new ref();
276
+ let lLastDirection: ref<number[]> = new ref();
277
+
278
+ bFlip.value = new Array<number>(1);
279
+ lDirection.value = new Array<number>(1);
280
+ lLastDirection.value = new Array<number>(1);
281
+ bFlip.value[0] = -1;
282
+ lDirection.value[0] = -1;
283
+ lLastDirection.value[0] = -1;
284
+ lFlotCount = flot.GetFlotCount2Double(tg, vbPoints2, numPts);
285
+ if (lFlotCount <= 0) {
286
+ return 0;
287
+ }
288
+
289
+ style10Points = new Array<POINT2>(lFlotCount);
290
+ lineutility.InitializePOINT2Array(style10Points);
291
+ vbPoints = new Array<number>(2 * numPts);
292
+ switch (lineType) {
293
+ case TacticalLines.WF:
294
+ case TacticalLines.UWF: {
295
+ dIncrement = arraysupport.getScaledSize(40, tg.get_LineThickness(), tg.get_patternScale());
296
+ break;
297
+ }
298
+
299
+ case TacticalLines.WFG:
300
+ case TacticalLines.WFY: {
301
+ dIncrement = arraysupport.getScaledSize(60, tg.get_LineThickness(), tg.get_patternScale());
302
+ break;
303
+ }
304
+
305
+ default: {
306
+ dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale());
307
+ break;
308
+ }
309
+
310
+ }
311
+ for (j = 0; j < numPts; j++) {
312
+ vbPoints[k] = vbPoints2[j].x as int;
313
+ k++;
314
+ vbPoints[k] = vbPoints2[j].y as int;
315
+ k++;
316
+ }
317
+ k = 0;
318
+ //assume caller has dimensioned flotppoints
319
+ j = 0;
320
+ //every lSegment has 2 points
321
+ for (l = 0; l < numPts - 1; l++) {
322
+ dDistance = lineutility.CalcDistance2(vbPoints[2 * l], vbPoints[2 * l + 1], vbPoints[2 * l + 2], vbPoints[2 * l + 3]);
323
+ lNumSegs = Math.trunc(dDistance / dIncrement);
324
+ if (lNumSegs > 0) {
325
+ points = new Array<number>(lNumSegs * 30);
326
+ numSegPts = flot.GetFlotSegment2(tg, vbPoints, l, points, bFlip, lDirection, lLastDirection);
327
+ for (j = 0; j < numSegPts; j++) {
328
+ x1 = points[k];
329
+ y1 = points[k + 1];
330
+ z = points[k + 2];
331
+ pt0.x = x1;
332
+ pt0.y = y1;
333
+ pt0.style = z;
334
+ if (j < numSegPts - 1) { //used by WFZ, WFY only
335
+ x2 = points[k + 3];
336
+ y2 = points[k + 4];
337
+ z2 = points[k + 5];
338
+ pt1.x = x2;
339
+ pt1.y = y2;
340
+ pt1.style = z2;
341
+ }
342
+ k += 3;
343
+ if (lFlotCounter < lFlotCount) {
344
+ vbPoints2[lFlotCounter].x = x1;
345
+ vbPoints2[lFlotCounter].y = y1;
346
+ switch (lineType) {
347
+ case TacticalLines.WF:
348
+ case TacticalLines.WFG:
349
+ case TacticalLines.WFY: {
350
+ if ((lFlotCounter + 1) % 10 === 0) {
351
+ vbPoints2[lFlotCounter].style = 10;
352
+ //style10Points are used by WFG and WFY for the mid-segment features
353
+ if (j < numSegPts - 1) {
354
+ style10Points[style10Counter] = new POINT2(vbPoints2[lFlotCounter]);
355
+ style10Points[style10Counter].style = 0;
356
+ style10Counter++;
357
+ if (j < numSegPts - 2) {
358
+ if (lineType === TacticalLines.WFG) {
359
+ pt2 = new POINT2(style10Points[style10Counter - 1]);
360
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(10, tg.get_LineThickness(), tg.get_patternScale()), 5);
361
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale()), 20);
362
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(30, tg.get_LineThickness(), tg.get_patternScale()), 0);
363
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(70, tg.get_LineThickness(), tg.get_patternScale()), 5);
364
+ }
365
+ if (lineType === TacticalLines.WFY) {
366
+ pt2 = new POINT2(style10Points[style10Counter - 1]);
367
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(10, tg.get_LineThickness(), tg.get_patternScale()), 5); //pt before 1st break
368
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(15, tg.get_LineThickness(), tg.get_patternScale()), 0); //1st pt after 1st break;
369
+ crossPt1 = lineutility.ExtendDirectedLine(style10Points[style10Counter - 1], pt1, style10Points[style10Counter - 1], 3, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 0);
370
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(25, tg.get_LineThickness(), tg.get_patternScale()), 5); //2nd point after 1st break;
371
+ crossPt2 = lineutility.ExtendDirectedLine(style10Points[style10Counter - 1], pt1, style10Points[style10Counter - 1], 2, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 5);
372
+ style10Points[style10Counter++] = new POINT2(crossPt1);
373
+ style10Points[style10Counter++] = new POINT2(crossPt2);
374
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(30, tg.get_LineThickness(), tg.get_patternScale()), 0); //1st pt after 2nd break
375
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(60, tg.get_LineThickness(), tg.get_patternScale()), 5); //2nd pt after 2nd break
376
+ }
377
+ }
378
+ } else {
379
+ pt2.x = vbPoints[2 * l];
380
+ pt2.y = vbPoints[2 * l + 1];
381
+ pt2.style = 0;
382
+ style10Points[style10Counter++] = new POINT2(pt2);
383
+ style10Points[style10Counter++] = lineutility.ExtendAlongLineDouble(pt2, pt1, arraysupport.getScaledSize(40, tg.get_LineThickness(), tg.get_patternScale()), 5);
384
+
385
+ pt2.x = vbPoints[2 * l + 2];
386
+ pt2.y = vbPoints[2 * l + 3];
387
+ pt2.style = 5;
388
+ style10Points[style10Counter] = new POINT2(vbPoints2[lFlotCounter]);
389
+ style10Points[style10Counter++].style = 0;
390
+ style10Points[style10Counter++] = new POINT2(pt2);
391
+ }
392
+ } else {
393
+ vbPoints2[lFlotCounter].style = 9;
394
+ }
395
+ break;
396
+ }
397
+
398
+ default: {
399
+ vbPoints2[lFlotCounter].style = 0;
400
+ break;
401
+ }
402
+
403
+ }
404
+ lFlotCounter++;
405
+ }
406
+ }
407
+ switch (lineType) {
408
+ case TacticalLines.WF:
409
+ case TacticalLines.WFG:
410
+ case TacticalLines.WFY: {
411
+ vbPoints2[lFlotCounter - 1].style = 10;
412
+ break;
413
+ }
414
+
415
+ default: {
416
+ vbPoints2[lFlotCounter - 1].style = 5;
417
+ break;
418
+ }
419
+
420
+ }
421
+ k = 0;
422
+ }//end if numsegs>0
423
+ else {
424
+ style10Points[style10Counter].x = vbPoints[2 * l];
425
+ style10Points[style10Counter].y = vbPoints[2 * l + 1];
426
+ style10Points[style10Counter++].style = 0;
427
+ style10Points[style10Counter].x = vbPoints[2 * l + 2];
428
+ style10Points[style10Counter].y = vbPoints[2 * l + 3];
429
+ style10Points[style10Counter++].style = 5;
430
+ }
431
+ }
432
+
433
+
434
+ //some do not need additional processing
435
+ switch (lineType) {
436
+ case TacticalLines.WFG:
437
+ case TacticalLines.WFY: {
438
+ break;
439
+ }
440
+
441
+ default: {
442
+ return lFlotCounter;
443
+ }
444
+
445
+ }
446
+ for (j = 0; j < style10Counter; j++) {
447
+ vbPoints2[lFlotCounter++] = new POINT2(style10Points[j]);
448
+ }
449
+
450
+ } catch (exc) {
451
+ if (exc instanceof Error) {
452
+ ErrorLogger.LogException(flot._className, "GetFlot2Double",
453
+ new RendererException("Failed inside GetFlot2Double", exc));
454
+ } else {
455
+ throw exc;
456
+ }
457
+ }
458
+ return lFlotCounter;
459
+ }
460
+
461
+ private static GetFlotSegment2(tg: TGLight,
462
+ vbPoints: number[],
463
+ segment: int,
464
+ points: number[],
465
+ bFlip: ref<number[]>,
466
+ lDirection: ref<number[]>,
467
+ lLastDirection: ref<number[]>): int {
468
+ let nNumSegs: int = 0;
469
+ try {
470
+ let lineType: int = tg.get_LineType();
471
+ let j: int = 0;
472
+ let dDistance: double = 0;
473
+ let m: int = 0;
474
+ let lLocx: int = 0;
475
+ let lLocy: int = 0;
476
+ let lSegCounter: int = 0;
477
+ let dAngle: double = 0;
478
+ let arcpoints: number[] = new Array<number>(30);
479
+ let dRemainder: double = 0;
480
+ let dNum: double = 0;
481
+ let dDen: double = 0;
482
+ let dIncrement: double = 0;
483
+ //end declarations
484
+
485
+ switch (lineType) {
486
+ case TacticalLines.WF:
487
+ case TacticalLines.UWF: {
488
+ dIncrement = arraysupport.getScaledSize(40, tg.get_LineThickness(), tg.get_patternScale());
489
+ break;
490
+ }
491
+
492
+ case TacticalLines.WFG:
493
+ case TacticalLines.WFY: {
494
+ dIncrement = arraysupport.getScaledSize(60, tg.get_LineThickness(), tg.get_patternScale());
495
+ break;
496
+ }
497
+
498
+ case TacticalLines.OCCLUDED:
499
+ case TacticalLines.UOF: {
500
+ dIncrement = arraysupport.getScaledSize(50, tg.get_LineThickness(), tg.get_patternScale());
501
+ break;
502
+ }
503
+
504
+ case TacticalLines.SF:
505
+ case TacticalLines.USF:
506
+ case TacticalLines.SFG:
507
+ case TacticalLines.SFY: {
508
+ dIncrement = arraysupport.getScaledSize(80, tg.get_LineThickness(), tg.get_patternScale());
509
+ break;
510
+ }
511
+
512
+ case TacticalLines.OFY: {
513
+ dIncrement = arraysupport.getScaledSize(80, tg.get_LineThickness(), tg.get_patternScale());
514
+ break;
515
+ }
516
+
517
+ default: {
518
+ dIncrement = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale());
519
+ break;
520
+ }
521
+
522
+ }
523
+
524
+ lSegCounter = 0;
525
+ if (segment === 0 && vbPoints[0] >= vbPoints[2]) {
526
+ if (lineType !== TacticalLines.SF &&
527
+ lineType !== TacticalLines.USF &&
528
+ lineType !== TacticalLines.SFG &&
529
+ lineType !== TacticalLines.SFY) {
530
+ bFlip.value[0] = 1;//TRUE;
531
+ }
532
+ else {
533
+ bFlip.value[0] = 0;
534
+ }
535
+ }
536
+ if (segment === 0 && vbPoints[0] < vbPoints[2]) {
537
+ if (lineType !== TacticalLines.SF &&
538
+ lineType !== TacticalLines.USF &&
539
+ lineType !== TacticalLines.SFG &&
540
+ lineType !== TacticalLines.SFY) {
541
+ bFlip.value[0] = 0;//FALSE;
542
+ } else {
543
+ bFlip.value[0] = 1;
544
+ }
545
+ }
546
+
547
+ dNum = vbPoints[2 * segment + 3] - vbPoints[2 * segment + 1];
548
+ dDen = vbPoints[2 * segment + 2] - vbPoints[2 * segment];
549
+
550
+ if (dDen === 0) {
551
+ dAngle = Math.PI / 2;
552
+ } else {
553
+ dAngle = Math.abs(Math.atan(dNum / dDen));
554
+ }
555
+
556
+ dAngle = (180 / Math.PI) * dAngle;
557
+
558
+ if (vbPoints[2 * segment + 0] <= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] >= vbPoints[2 * segment + 3]) {
559
+ dAngle = 90 - dAngle;
560
+ } else {
561
+ if (vbPoints[2 * segment + 0] <= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] <= vbPoints[2 * segment + 3]) {
562
+ dAngle = dAngle + 90;
563
+ } else {
564
+ if (vbPoints[2 * segment + 0] >= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] <= vbPoints[2 * segment + 3]) {
565
+ dAngle = 270 - dAngle;
566
+ } else {
567
+ if (vbPoints[2 * segment + 0] >= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] >= vbPoints[2 * segment + 3]) {
568
+ dAngle = 270 + dAngle;
569
+ }
570
+ }
571
+
572
+ }
573
+
574
+ }
575
+
576
+
577
+
578
+ dDistance = lineutility.CalcDistance2(vbPoints[2 * segment], vbPoints[2 * segment + 1], vbPoints[2 * segment + 2], vbPoints[2 * segment + 3]);
579
+
580
+ nNumSegs = Math.trunc(dDistance / dIncrement);
581
+ dRemainder = nNumSegs * dIncrement - dDistance;
582
+ dDistance = dDistance + dRemainder;
583
+
584
+ //calculate the default dAngle here
585
+ //also establish the lDirection
586
+ if (vbPoints[2 * segment] >= vbPoints[2 * segment + 2]) {
587
+ dAngle = dAngle + 90;
588
+ lDirection.value[0] = 1;
589
+ } else {
590
+ dAngle = dAngle - 90;
591
+ lDirection.value[0] = 0;
592
+ }
593
+
594
+
595
+ if (segment > 0 && lDirection.value[0] !== lLastDirection.value[0]) {
596
+ //toggle bflip if the lDirection changes
597
+ if (bFlip.value[0] === 1) {
598
+ bFlip.value[0] = 0;
599
+ } else {
600
+ bFlip.value[0] = 1;
601
+ }
602
+ }
603
+
604
+ //flip the segment if necessary
605
+ if (bFlip.value[0] === 1) {
606
+ dAngle = dAngle + 180;
607
+ }
608
+
609
+ for (m = 0; m < nNumSegs; m++) {
610
+ lLocx = Math.trunc(vbPoints[2 * segment] + (m + 0.5) * (vbPoints[2 * segment + 2] - vbPoints[2 * segment]) * dIncrement / dDistance);
611
+ lLocy = Math.trunc(vbPoints[2 * segment + 1] + (m + 0.5) * (vbPoints[2 * segment + 3] - vbPoints[2 * segment + 1]) * dIncrement / dDistance);
612
+
613
+ flot.CalcAnglePoints(lLocx, lLocy, dAngle, arcpoints, arraysupport.getScaledSize(10, tg.get_LineThickness(), tg.get_patternScale()));
614
+
615
+ for (j = 0; j < 30; j++) {
616
+ points[lSegCounter] = arcpoints[j];
617
+ lSegCounter = lSegCounter + 1;
618
+ }
619
+ }
620
+
621
+ //save last lDirection
622
+ lLastDirection.value[0] = lDirection.value[0];
623
+ } catch (exc) {
624
+ if (exc instanceof Error) {
625
+ ErrorLogger.LogException(flot._className, "GetFlotSegment2",
626
+ new RendererException("Failed inside GetFlotSegment2", exc));
627
+ } else {
628
+ throw exc;
629
+ }
630
+ }
631
+ return nNumSegs * 10;
632
+ }
633
+ static GetOFYCountDouble(pLinePoints: POINT2[], interval: double, numPts: int): int {
634
+ let lTotalpts: int = 0;
635
+ try {
636
+ let j: int = 0;
637
+ let lNumSegs: int = 0;
638
+ let lNumFlots: int = 0;
639
+ let lNumSpikes: int = 0;
640
+ let dDistance: double = 0;
641
+ let nFactor: int = 7;
642
+
643
+ //for each segment
644
+ for (j = 0; j < numPts - 1; j++) {
645
+ dDistance = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
646
+ lNumSegs = Math.trunc(dDistance / interval); //flot + spike = 60 pixels
647
+ lNumFlots = lNumSegs;
648
+ lNumSpikes = lNumSegs;
649
+ if (lNumFlots < 1) {
650
+ lNumFlots = 1;
651
+ }
652
+ if (lNumSpikes < 1) {
653
+ lNumSpikes = 1;
654
+ }
655
+ lTotalpts += lNumFlots * 18; //10 points per flot + 8 per line segment,
656
+ lTotalpts += lNumSpikes * nFactor; //3 points per spike
657
+ }
658
+ if (lTotalpts < (nFactor + 15) * numPts) {
659
+ lTotalpts = 25 * numPts;
660
+ }
661
+
662
+ } catch (exc) {
663
+ if (exc instanceof Error) {
664
+ ErrorLogger.LogException(flot._className, "GetOFYCountDoulbe",
665
+ new RendererException("Failed inside GetOFYCountDouble", exc));
666
+ } else {
667
+ throw exc;
668
+ }
669
+ }
670
+ return lTotalpts;
671
+ }
672
+
673
+ static GetOccludedPointsDouble(tg: TGLight,
674
+ pLinePoints: POINT2[],
675
+ numPts: int): int {
676
+ let nTotalCounter: int = 0;
677
+ try {
678
+ let lineType: int = tg.get_LineType();
679
+ let j: int = 0;
680
+ let k: int = 0;
681
+ let lNumSegs: int = 0;
682
+ let l: int = 0;
683
+ let lNumFlots: int = 0;
684
+ let lNumSpikes: int = 0;
685
+ let dDistance: double = 0;
686
+ let m: ref<number[]> = new ref();
687
+ let lTotalPoints: int = 0;
688
+ let points: number[];
689
+ let pSpikePoints: POINT2[];
690
+ let pt0: POINT2 = new POINT2();
691
+ let tempPoint: POINT2 = new POINT2();
692
+ let pFlotPoints: POINT2[];
693
+ let dSpikeSize: double = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale());
694
+ let dIncrement: double = arraysupport.getScaledSize(50, tg.get_LineThickness(), tg.get_patternScale());
695
+ let vbPoints: number[];
696
+ let nFlotCounter: int = 0;
697
+ let nSpikeCounter: int = 0;
698
+ let flots: number[];
699
+ let sumOfFlots: int = 0;
700
+ let segmentLength: double = 0;
701
+ let spikeLength: double = 0;
702
+ let bolTooLong: int = 0;
703
+ let d1: double = 0;
704
+ let d2: double = 0;
705
+ let bolVertical: int = 0;
706
+ let bFlip: ref<number[]> = new ref();
707
+ let lDirection: ref<number[]> = new ref();
708
+ let lLastDirection: ref<number[]> = new ref();
709
+
710
+ m.value = new Array<number>(1);
711
+ bFlip.value = new Array<number>(1);
712
+ lDirection.value = new Array<number>(1);
713
+ lLastDirection.value = new Array<number>(1);
714
+ bFlip.value[0] = -1;
715
+ lDirection.value[0] = -1;
716
+ lLastDirection.value[0] = -1;
717
+ lTotalPoints = flot.GetOccludedCountDouble(pLinePoints, numPts);
718
+
719
+ vbPoints = new Array<number>(numPts * 2);
720
+
721
+ pSpikePoints = new Array<POINT2>(3 * lTotalPoints / 13);
722
+ pFlotPoints = new Array<POINT2>(10 * lTotalPoints / 13);
723
+ let n: int = pSpikePoints.length;
724
+ //for (j = 0; j < pSpikePoints.length; j++)
725
+ for (j = 0; j < n; j++) {
726
+ pSpikePoints[j] = new POINT2(pLinePoints[0]);
727
+ pSpikePoints[j].style = 5;
728
+ }
729
+ n = pFlotPoints.length;
730
+ //for (j = 0; j < pFlotPoints.length; j++)
731
+ for (j = 0; j < n; j++) {
732
+ pFlotPoints[j] = new POINT2(pLinePoints[0]);
733
+ pFlotPoints[j].style = 5;
734
+ }
735
+ flots = new Array<number>(numPts + 1);
736
+ //the vbPoints long array gets used by GetFlotSegment
737
+ //and is based on the original points
738
+ for (j = 0; j < numPts; j++) {
739
+ vbPoints[k] = pLinePoints[j].x as int;
740
+ k++;
741
+ vbPoints[k] = pLinePoints[j].y as int;
742
+ k++;
743
+ }
744
+ k = 0;
745
+ //initialize flots
746
+ flots[0] = 0;
747
+ for (j = 0; j < numPts; j++) {
748
+ flots[j + 1] = 0;
749
+ }
750
+
751
+ for (j = 0; j < numPts - 1; j++) {
752
+ bolVertical = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m);
753
+ m.value[0] = -m.value[0]; //reverse the direction
754
+ dDistance = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
755
+ lNumSegs = Math.trunc(dDistance / dIncrement); //flot(20) + spike(20) = 60 pixels
756
+ lNumFlots = lNumSegs;
757
+ lNumSpikes = lNumSegs;
758
+ flots[j + 1] = lNumSegs;
759
+
760
+ //get the flot segments for this line segment
761
+ //flot segments are 30 pixels wide with the flots in the middle, 20 pixels wide
762
+ k = 0;
763
+ if (lNumFlots > 0) {
764
+ points = new Array<number>(lNumFlots * 30);
765
+ flot.GetFlotSegment2(tg, vbPoints, j, points, bFlip, lDirection, lLastDirection);
766
+ for (l = 0; l < lNumFlots * 10; l++) {
767
+ pFlotPoints[nFlotCounter].x = points[k];
768
+ pFlotPoints[nFlotCounter].y = points[k + 1];
769
+ pFlotPoints[nFlotCounter].style = 9;
770
+ //straighten out the flots
771
+ if ((nFlotCounter) % 10 === 0) {
772
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pFlotPoints[nFlotCounter]);
773
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pFlotPoints[nFlotCounter]);
774
+ if (d2 > d1) {
775
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j + 1], pLinePoints[j], -d1);
776
+ }
777
+ else {
778
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j], pLinePoints[j + 1], -d2);
779
+ }
780
+ pFlotPoints[nFlotCounter].style = 9;
781
+ if (lineType === TacticalLines.UOF) {
782
+ pFlotPoints[nFlotCounter].style = 0;
783
+ }
784
+ }
785
+
786
+ if ((nFlotCounter + 1) % 10 === 0) {
787
+ if (lineType === TacticalLines.OCCLUDED ||
788
+ lineType === TacticalLines.UOF) {
789
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pFlotPoints[nFlotCounter - 9]);
790
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pFlotPoints[nFlotCounter - 9]);
791
+ if (d2 > d1) {
792
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j + 1], pLinePoints[j], -d1 - dSpikeSize);
793
+ } else {
794
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j], pLinePoints[j + 1], -d2 + dSpikeSize);
795
+ }
796
+ if (lineType === TacticalLines.OCCLUDED) {
797
+ pFlotPoints[nFlotCounter].style = 10;
798
+ }
799
+ if (lineType === TacticalLines.UOF) {
800
+ pFlotPoints[nFlotCounter].style = 5;
801
+ }
802
+ }
803
+ if (lineType === TacticalLines.SF) {
804
+ pFlotPoints[nFlotCounter].style = 23; //red fill
805
+ }
806
+ }
807
+ k += 3;
808
+ nFlotCounter++;
809
+ }
810
+ points = null;
811
+ }
812
+
813
+ //for each spike in the line segment
814
+ //spikes segments are 30 pixels wide with the spikes in the middle, 20 pixels wide
815
+ segmentLength = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
816
+ for (k = 0; k < lNumSpikes - 1; k++) //get the spike
817
+ {
818
+ //the first spike base point
819
+ //has to be based on the preceding flot
820
+ //if the distance goes past the end of the line segment then set the point to the
821
+ //end of the line segment
822
+ bolTooLong = 0;
823
+ sumOfFlots = 0;
824
+ for (l = 0; l <= j; l++) {
825
+ sumOfFlots += flots[l];
826
+ }
827
+
828
+ //for the greatest accuracy
829
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pFlotPoints[sumOfFlots * 10 + 10 * k]);
830
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pFlotPoints[sumOfFlots * 10 + 10 * k]);
831
+ switch (lineType) {
832
+ case TacticalLines.OCCLUDED:
833
+ case TacticalLines.UOF: {
834
+ if (d2 > d1) {
835
+ tempPoint = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -d1 - dIncrement / 2, 0);
836
+ } else {
837
+ tempPoint = lineutility.ExtendLine2Double(pLinePoints[j], pLinePoints[j + 1], -d2 + dIncrement / 2, 0);
838
+ }
839
+ break;
840
+ }
841
+
842
+ case TacticalLines.SF: {
843
+ if (d2 > d1) {
844
+ tempPoint = lineutility.ExtendLine2Double(pLinePoints[j + 1], pLinePoints[j], -d1 - dIncrement / 8, 0);
845
+ } else {
846
+ tempPoint = lineutility.ExtendLine2Double(pLinePoints[j], pLinePoints[j + 1], -d2 + dIncrement / 8, 0);
847
+ }
848
+ break;
849
+ }
850
+
851
+ default: {
852
+ break;
853
+ }
854
+
855
+ }
856
+ spikeLength = lineutility.CalcDistanceDouble(pLinePoints[j], tempPoint);
857
+ if (spikeLength + dSpikeSize < segmentLength) {
858
+ pSpikePoints[nSpikeCounter] = new POINT2(tempPoint);
859
+ } else {
860
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
861
+ bolTooLong = 1;
862
+ }
863
+
864
+ pSpikePoints[nSpikeCounter].style = 9;
865
+ nSpikeCounter++;
866
+
867
+ //extend half the spike size from the last point
868
+ //do this for the accuracy of the spike point base
869
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pSpikePoints[nSpikeCounter - 1]);
870
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pSpikePoints[nSpikeCounter - 1]);
871
+ if (d1 > d2) {
872
+ pt0 = lineutility.ExtendLineDouble(pLinePoints[j], pSpikePoints[nSpikeCounter - 1], dSpikeSize / 2);
873
+ } else {
874
+ pt0 = lineutility.ExtendLineDouble(pLinePoints[j + 1], pSpikePoints[nSpikeCounter - 1], -dSpikeSize / 2);
875
+ }
876
+ //the spike end (perpendicular) point
877
+ if (bolTooLong === 0) {
878
+ if (bolVertical !== 0) //segment is not vertical
879
+ {
880
+ if (pLinePoints[j].x < pLinePoints[j + 1].x) {
881
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 2, dSpikeSize); //extennd above the line
882
+ } else {
883
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 3, dSpikeSize); //extend below the line
884
+ }
885
+ pSpikePoints[nSpikeCounter].style = 0;
886
+ nSpikeCounter++;
887
+ } else //vertical segment
888
+ {
889
+ if (pLinePoints[j].y > pLinePoints[j + 1].y) {
890
+ pSpikePoints[nSpikeCounter].x = pt0.x - dSpikeSize;
891
+ } else {
892
+ pSpikePoints[nSpikeCounter].x = pt0.x + dSpikeSize;
893
+ }
894
+
895
+ pSpikePoints[nSpikeCounter].y = pt0.y;
896
+ nSpikeCounter++;
897
+ }
898
+ } else //too long
899
+ {
900
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
901
+ nSpikeCounter++;
902
+ }
903
+ pSpikePoints[nSpikeCounter - 1].style = 9;
904
+
905
+ //the second spike base point. this is the third spike point
906
+ if (bolTooLong === 0) {
907
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pSpikePoints[nSpikeCounter - 2]);
908
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pSpikePoints[nSpikeCounter - 2]);
909
+ if (d1 > d2) {
910
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nSpikeCounter - 2], dSpikeSize, 0);
911
+ } else {
912
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pSpikePoints[nSpikeCounter - 2], -dSpikeSize, 0);
913
+ }
914
+ if (lineType === TacticalLines.OCCLUDED) {
915
+ pSpikePoints[nSpikeCounter].style = 10;
916
+ }
917
+ if (lineType === TacticalLines.UOF) {
918
+ pSpikePoints[nSpikeCounter].style = 5;
919
+ }
920
+ if (lineType === TacticalLines.SF) {
921
+ pSpikePoints[nSpikeCounter].style = 24;
922
+ }
923
+ } else {
924
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
925
+ pSpikePoints[nSpikeCounter].style = 5;
926
+ }
927
+ nSpikeCounter++;
928
+ }//for k= 0 to numSpikes-1
929
+ if (nSpikeCounter === 0) {
930
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j]);
931
+ pSpikePoints[nSpikeCounter].style = 5;
932
+ nSpikeCounter++;
933
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
934
+ pSpikePoints[nSpikeCounter].style = 5;
935
+ nSpikeCounter++;
936
+ //added 6-1-05 M. Deutch
937
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
938
+ pSpikePoints[nSpikeCounter].style = 5;
939
+ nSpikeCounter++;
940
+ } else {
941
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
942
+ pSpikePoints[nSpikeCounter].style = 5;
943
+ pSpikePoints[nSpikeCounter + 1] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
944
+ pSpikePoints[nSpikeCounter + 1].style = 5;
945
+ pSpikePoints[nSpikeCounter + 2] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
946
+ pSpikePoints[nSpikeCounter + 2].style = 5;
947
+ nSpikeCounter += 3;
948
+ }
949
+ }
950
+
951
+ for (j = 0; j < pLinePoints.length; j++) {
952
+ pLinePoints[j] = new POINT2(pSpikePoints[0]);
953
+ pLinePoints[j].style = 5;
954
+ }
955
+ //load the spike points into the array
956
+ nFlotCounter = 0;
957
+ nSpikeCounter = 0;
958
+ for (j = 0; j < lTotalPoints / 13; j++) {
959
+ //get the flots
960
+ for (k = 0; k < 10; k++) {
961
+ pLinePoints[nTotalCounter] = new POINT2(pFlotPoints[j * 10 + k]);
962
+ nTotalCounter++;
963
+ nFlotCounter++;
964
+ }
965
+ //get the spikes
966
+ for (k = 0; k < 3; k++) {
967
+ pLinePoints[nTotalCounter] = new POINT2(pSpikePoints[j * 3 + k]);
968
+ nTotalCounter++;
969
+ nSpikeCounter++;
970
+ }
971
+ }
972
+ n = pLinePoints.length;
973
+ for (j = nTotalCounter; j < n; j++) {
974
+ pLinePoints[j] = new POINT2(pLinePoints[nTotalCounter - 1]);
975
+ }
976
+ } catch (exc) {
977
+ if (exc instanceof Error) {
978
+ ErrorLogger.LogException(flot._className, "GetOccludedPointsDouble",
979
+ new RendererException("Failed inside GetOccludedPointsDouble", exc));
980
+ } else {
981
+ throw exc;
982
+ }
983
+ }
984
+ return nTotalCounter;
985
+ }
986
+
987
+ static GetOccludedCountDouble(pLinePoints: POINT2[], numPts: int): int {
988
+ let lTotalpts: int = 0;
989
+ try {
990
+ let j: int = 0;
991
+ let lNumSegs: int = 0;
992
+ let lNumFlots: int = 0;
993
+ let lNumSpikes: int = 0;
994
+ let dDistance: double = 0;
995
+
996
+ //for each segment
997
+ for (j = 0; j < numPts - 1; j++) {
998
+ dDistance = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
999
+ lNumSegs = Math.trunc(dDistance / 50); //flot + spike = 60 pixels
1000
+ lNumFlots = lNumSegs;
1001
+ lNumSpikes = lNumSegs;
1002
+ if (lNumFlots < 1) {
1003
+ lNumFlots = 1;
1004
+ }
1005
+ if (lNumSpikes < 1) {
1006
+ lNumSpikes = 1;
1007
+ }
1008
+ lTotalpts += lNumFlots * 10; //10 points per flot,
1009
+ lTotalpts += lNumSpikes * 3; //3 points per spike
1010
+ }
1011
+ if (lTotalpts < 13 * numPts) {
1012
+ lTotalpts = 13 * numPts;
1013
+ }
1014
+
1015
+ if (lTotalpts < numPts) {
1016
+ lTotalpts = numPts;
1017
+ }
1018
+
1019
+ } catch (exc) {
1020
+ if (exc instanceof Error) {
1021
+ ErrorLogger.LogException(flot._className, "GetOccludedCountDouble",
1022
+ new RendererException("Failed inside GetOccludedCountDouble", exc));
1023
+ } else {
1024
+ throw exc;
1025
+ }
1026
+ }
1027
+ return lTotalpts;
1028
+ }
1029
+
1030
+ private static CalcNewPoint(locx: int,
1031
+ locY: int,
1032
+ angle: double,
1033
+ point: number[],
1034
+ dist: double): int {
1035
+ try {
1036
+ let m: double = 0;
1037
+ let deltaX: double = 0;
1038
+ let deltaY: double = 0;
1039
+ let dx: double = 0;
1040
+ let dy: double = 0;
1041
+ let nQuadrant: int = -1;
1042
+
1043
+ if (angle < 0) {
1044
+ angle = angle + 360;
1045
+ }
1046
+
1047
+ if (angle > 360) {
1048
+ angle = angle - 360;
1049
+ }
1050
+
1051
+ if (0 <= angle && angle <= 90) {
1052
+ nQuadrant = 0;
1053
+ angle = 90 - angle;
1054
+ angle = Math.abs(angle) * (Math.PI / 180);
1055
+ }
1056
+
1057
+ if (90 < angle && angle <= 180) {
1058
+ nQuadrant = 1;
1059
+ angle = angle - 90;
1060
+ angle = Math.abs(angle) * (Math.PI / 180);
1061
+ }
1062
+
1063
+ if (180 < angle && angle <= 270) {
1064
+ nQuadrant = 2;
1065
+ angle = 270 - angle;
1066
+ angle = Math.abs(angle) * (Math.PI / 180);
1067
+ }
1068
+
1069
+ if (270 < angle && angle <= 360) {
1070
+ nQuadrant = 3;
1071
+ angle = angle - 270;
1072
+ angle = Math.abs(angle) * (Math.PI / 180);
1073
+ }
1074
+
1075
+ m = Math.abs(Math.tan(angle));
1076
+ deltaX = Math.abs(dist / Math.sqrt(1 + m * m));
1077
+ deltaY = Math.abs(m * deltaX);
1078
+
1079
+ switch (nQuadrant) {
1080
+ case 0: {
1081
+ dx = locx + deltaX;
1082
+ dy = locY - deltaY;
1083
+ break;
1084
+ }
1085
+
1086
+ case 1: {
1087
+ dx = locx + deltaX;
1088
+ dy = locY + deltaY;
1089
+ break;
1090
+ }
1091
+
1092
+ case 2: {
1093
+ dx = locx - deltaX;
1094
+ dy = locY + deltaY;
1095
+ break;
1096
+ }
1097
+
1098
+ case 3: {
1099
+ dx = locx - deltaX;
1100
+ dy = locY - deltaY;
1101
+ break;
1102
+ }
1103
+
1104
+ default: {
1105
+ break;
1106
+ }
1107
+
1108
+ }
1109
+
1110
+ point[0] = dx as int;
1111
+ point[1] = dy as int;
1112
+
1113
+ } catch (exc) {
1114
+ if (exc instanceof Error) {
1115
+ ErrorLogger.LogException(flot._className, "CalcNewPoint",
1116
+ new RendererException("Failed inside CalcNewPoint", exc));
1117
+ } else {
1118
+ throw exc;
1119
+ }
1120
+ }
1121
+ return 1;
1122
+ }
1123
+ /**
1124
+ * Calculates points for a flot segment. Assumes the caller allocated the points array
1125
+ * @param vbPoints the client points
1126
+ * @param segment the segment index
1127
+ * @param points the returned points
1128
+ * @return the number of points
1129
+ */
1130
+ private static GetFlotSegment(vbPoints: number[],
1131
+ segment: int,
1132
+ points: number[] | null,
1133
+ flotDiameter: double,
1134
+ bFlip: ref<number[]>,
1135
+ lDirection: ref<number[]>,
1136
+ lLastDirection: ref<number[]>): int {
1137
+ let nNumSegs: int = 0;
1138
+ try {
1139
+ let j: int = 0;
1140
+ let dDistance: double = 0;
1141
+ let m: int = 0;
1142
+ let lLocx: int = 0;
1143
+ let lLocy: int = 0;
1144
+ let lSegCounter: int = 0;
1145
+ let dAngle: double = 0;
1146
+ let arcPoints: number[] = new Array<number>(30);
1147
+ let dRemainder: double = 0;
1148
+ let dNum: double = 0;
1149
+ let dDen: double = 0;
1150
+ //end declarations
1151
+ lSegCounter = 0;
1152
+ if (segment === 0 && vbPoints[0] >= vbPoints[2]) {
1153
+ bFlip.value[0] = 1;//TRUE;
1154
+ }
1155
+ if (segment === 0 && vbPoints[0] < vbPoints[2]) {
1156
+ bFlip.value[0] = 0;//FALSE;
1157
+ }
1158
+
1159
+ dNum = vbPoints[2 * segment + 3] - vbPoints[2 * segment + 1];
1160
+ dDen = vbPoints[2 * segment + 2] - vbPoints[2 * segment];
1161
+
1162
+ //for some reason this did not blow up before I put the if/else
1163
+ //instead it would assign pi/2 to dAngle when dDen=0
1164
+ if (dDen === 0) {
1165
+ dAngle = Math.PI / 2;
1166
+
1167
+ } else {
1168
+ dAngle = Math.abs(Math.atan(dNum / dDen));
1169
+
1170
+ //convert to degrees
1171
+
1172
+ }
1173
+ dAngle = (180 / Math.PI) * dAngle;
1174
+
1175
+ if (vbPoints[2 * segment + 0] <= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] >= vbPoints[2 * segment + 3]) {
1176
+ dAngle = 90 - dAngle;
1177
+ } else {
1178
+ if (vbPoints[2 * segment + 0] <= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] <= vbPoints[2 * segment + 3]) {
1179
+ dAngle = dAngle + 90;
1180
+ } else {
1181
+ if (vbPoints[2 * segment + 0] >= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] <= vbPoints[2 * segment + 3]) {
1182
+ dAngle = 270 - dAngle;
1183
+ } else {
1184
+ if (vbPoints[2 * segment + 0] >= vbPoints[2 * segment + 2] && vbPoints[2 * segment + 1] >= vbPoints[2 * segment + 3]) {
1185
+ dAngle = 270 + dAngle;
1186
+ }
1187
+ }
1188
+
1189
+ }
1190
+
1191
+ }
1192
+
1193
+
1194
+ dDistance = lineutility.CalcDistance2(vbPoints[2 * segment], vbPoints[2 * segment + 1], vbPoints[2 * segment + 2], vbPoints[2 * segment + 3]);
1195
+
1196
+ nNumSegs = Math.trunc(dDistance / flotDiameter);
1197
+
1198
+ dRemainder = nNumSegs * flotDiameter - dDistance;
1199
+ dDistance = dDistance + dRemainder;
1200
+
1201
+ //calculate the default dAngle here
1202
+ //also establish the lDirection
1203
+ if (vbPoints[2 * segment] >= vbPoints[2 * segment + 2]) {
1204
+ dAngle = dAngle + 90;
1205
+ lDirection.value[0] = 1;
1206
+ } else {
1207
+ dAngle = dAngle - 90;
1208
+ lDirection.value[0] = 0;
1209
+ }
1210
+
1211
+ if (segment > 0 && lDirection.value[0] !== lLastDirection.value[0]) {
1212
+ //'toggle bflip if the lDirection changes
1213
+ if (bFlip.value[0] === 1) {
1214
+ bFlip.value[0] = 0;
1215
+
1216
+ } else {
1217
+ bFlip.value[0] = 1;
1218
+
1219
+ }
1220
+ }
1221
+
1222
+ //'flip the segment if necessary
1223
+ if (bFlip.value[0] === 1) {
1224
+ dAngle = dAngle + 180;
1225
+
1226
+
1227
+ }
1228
+ for (m = 0; m < nNumSegs; m++) {
1229
+ lLocx = Math.trunc(vbPoints[2 * segment] + (m + 0.5) * (vbPoints[2 * segment + 2] - vbPoints[2 * segment]) * flotDiameter / dDistance);
1230
+ lLocy = Math.trunc(vbPoints[2 * segment + 1] + (m + 0.5) * (vbPoints[2 * segment + 3] - vbPoints[2 * segment + 1]) * flotDiameter / dDistance);
1231
+
1232
+ flot.CalcAnglePoints(lLocx, lLocy, dAngle, arcPoints, dDistance / (nNumSegs * 2));
1233
+
1234
+ //9-12-12
1235
+ //points were set to null by the caller if the segment distance was too short
1236
+ //in which case GetflotSegment still must be called to set bFlip, lDirection, lLastDirection
1237
+ if (points != null) {
1238
+ for (j = 0; j < 30; j++) {
1239
+ points[lSegCounter] = arcPoints[j];
1240
+ lSegCounter = lSegCounter + 1;
1241
+ }
1242
+ }
1243
+ }
1244
+
1245
+ //save last lDirection
1246
+ lLastDirection.value[0] = lDirection.value[0];
1247
+ } catch (exc) {
1248
+ if (exc instanceof Error) {
1249
+ ErrorLogger.LogException(flot._className, "GetFlotSegment",
1250
+ new RendererException("Failed inside GetFlotSegment", exc));
1251
+ } else {
1252
+ throw exc;
1253
+ }
1254
+ }
1255
+ return nNumSegs * 10;
1256
+ }
1257
+ /**
1258
+ * Calculates the points for FLOT, LC
1259
+ * @param vbPoints2 OUT the clinet points also used for the return points
1260
+ * @param numPts
1261
+ * @return
1262
+ */
1263
+ static GetFlotDouble(vbPoints2: POINT2[], flotDiameter: double, numPts: int): int {
1264
+ let lFlotCounter: int = 0;
1265
+ try {
1266
+ let bFlip: ref<number[]> = new ref(); bFlip.value = new Array<number>(1); bFlip.value[0] = -1; //-1
1267
+ let lDirection: ref<number[]> = new ref(); lDirection.value = new Array<number>(1); lDirection.value[0] = -1;//-1;
1268
+ let lLastDirection: ref<number[]> = new ref(); lLastDirection.value = new Array<number>(1); lLastDirection.value[0] = -1;//-1;
1269
+ let j: int = 0;
1270
+ let k: int = 0;
1271
+ let l: int = 0;
1272
+ let m: int = 0;
1273
+ let x1: int = 0;
1274
+ let y1: int = 0;
1275
+ let numSegPts: int = -1;
1276
+ let z: int = 0;
1277
+ let lFlotCount: int = 0;
1278
+ let lNumSegs: int = 0;
1279
+ let dDistance: double = 0;
1280
+ let vbPoints: number[];
1281
+ let points: number[] | null;
1282
+
1283
+ lFlotCount = flot.GetFlotCountDouble(vbPoints2, flotDiameter, numPts);
1284
+
1285
+ vbPoints = new Array<number>(2 * numPts);
1286
+ //lineutility.BoundPoints(ref vbPoints2,numPts,ref segments);
1287
+ //BoundPoints returns a segments array of booleans
1288
+ //which determines whether each segment should be drawn
1289
+
1290
+ for (j = 0; j < numPts; j++) {
1291
+ vbPoints[k] = vbPoints2[j].x as int;
1292
+ k++;
1293
+ vbPoints[k] = vbPoints2[j].y as int;
1294
+ k++;
1295
+ }
1296
+ k = 0;
1297
+ //assume caller has dimensioned flotpoints
1298
+
1299
+ //every lSegment has 2 points
1300
+ for (l = 0; l < numPts - 1; l++) {
1301
+ dDistance = lineutility.CalcDistance2(vbPoints[m], vbPoints[m + 1], vbPoints[m + 2], vbPoints[m + 3]);
1302
+ m += 2;
1303
+ lNumSegs = Math.trunc(dDistance / flotDiameter);
1304
+ if (lNumSegs > 0) {
1305
+ points = new Array<number>(lNumSegs * 30);
1306
+ numSegPts = flot.GetFlotSegment(vbPoints, l, points, flotDiameter, bFlip, lDirection, lLastDirection);
1307
+ for (j = 0; j < numSegPts; j++) {
1308
+ x1 = points[k];
1309
+ y1 = points[k + 1];
1310
+ z = points[k + 2];
1311
+ k = k + 3;
1312
+ if (lFlotCounter < lFlotCount) {
1313
+ vbPoints2[lFlotCounter].x = x1;
1314
+ vbPoints2[lFlotCounter].y = y1;
1315
+ lFlotCounter++;
1316
+ }
1317
+ }
1318
+ k = 0;
1319
+ points = null;
1320
+ }
1321
+ else {
1322
+ ///added section 9-12-12
1323
+ //these points are not used but bFlip, lDirection, lLastDirection
1324
+ //must be maintained between segments
1325
+ points = null;
1326
+ numSegPts = flot.GetFlotSegment(vbPoints, l, points, flotDiameter, bFlip, lDirection, lLastDirection);
1327
+ //end section
1328
+ if (lFlotCounter < lFlotCount) {
1329
+ vbPoints2[lFlotCounter].x = vbPoints[2 * l];
1330
+ vbPoints2[lFlotCounter].y = vbPoints[2 * l + 1];
1331
+ lFlotCounter++;
1332
+ }
1333
+ }
1334
+ }
1335
+ let n: int = vbPoints2.length;
1336
+ for (j = lFlotCounter - 1; j < n; j++) {
1337
+ vbPoints2[j].style = 5;
1338
+ }
1339
+ } catch (exc) {
1340
+ if (exc instanceof Error) {
1341
+ ErrorLogger.LogException(flot._className, "GetFlotDouble",
1342
+ new RendererException("Failed inside GetFlotDouble", exc));
1343
+ } else {
1344
+ throw exc;
1345
+ }
1346
+ }
1347
+ return lFlotCounter;
1348
+ }
1349
+
1350
+ private static CalcAnglePoints(locx: int,
1351
+ locY: int,
1352
+ angle: double,
1353
+ points: number[],
1354
+ dist: double): int {
1355
+ try {
1356
+ let j: int = 0;
1357
+ let k: int = 0;
1358
+ let lTemp: number[] = new Array<number>(2);
1359
+
1360
+ for (j = 0; j < 10; j++) {
1361
+ flot.CalcNewPoint(locx, locY, angle - 90 + 20 * j, lTemp, dist);
1362
+ points[k] = lTemp[0];
1363
+ points[k + 1] = lTemp[1];
1364
+
1365
+ k += 3;
1366
+ }
1367
+ } catch (exc) {
1368
+ if (exc instanceof Error) {
1369
+ ErrorLogger.LogException(flot._className, "CalcAnglePoints",
1370
+ new RendererException("Failed inside CalcAnglePoints", exc));
1371
+ } else {
1372
+ throw exc;
1373
+ }
1374
+ }
1375
+ return 1;
1376
+ }
1377
+ /**
1378
+ * Calculates the number of points required for a flot
1379
+ * @param vbPoints the clinet points
1380
+ * @param numPts the number of client points
1381
+ * @return the number of points required
1382
+ */
1383
+ static GetFlotCountDouble(vbPoints: POINT2[], flotDiameter: double, numPts: int): int {
1384
+ let lTotalpts: int = 0;
1385
+ try {
1386
+ let j: int = 0;
1387
+ let lNumSegs: int = 0;
1388
+ let dDistance: double = 0;
1389
+ let vbPoints2: POINT2[];
1390
+
1391
+ vbPoints2 = new Array<POINT2>(numPts);
1392
+ for (j = 0; j < numPts; j++) {
1393
+ vbPoints2[j] = vbPoints[j];
1394
+ }
1395
+ for (j = 0; j < numPts - 1; j++) {
1396
+ dDistance = lineutility.CalcDistanceDouble(vbPoints2[j], vbPoints2[j + 1]);
1397
+ lNumSegs = Math.trunc(dDistance / flotDiameter);
1398
+ if (lNumSegs > 0) {
1399
+ lTotalpts += lNumSegs * 10; //10 points per flot
1400
+ } else {
1401
+ lTotalpts += 1;
1402
+ }
1403
+ }
1404
+ lTotalpts += 1;
1405
+
1406
+ } catch (exc) {
1407
+ if (exc instanceof Error) {
1408
+ ErrorLogger.LogException(flot._className, "GetFlotCountDouble",
1409
+ new RendererException("Failed inside GetFlotCountDouble", exc));
1410
+ } else {
1411
+ throw exc;
1412
+ }
1413
+ }
1414
+ return (lTotalpts);
1415
+ }
1416
+
1417
+ static GetOFYPointsDouble(tg: TGLight,
1418
+ pLinePoints: POINT2[],
1419
+ numPts: int): int {
1420
+ let nTotalCounter: int = 0;
1421
+ try {
1422
+ let j: int = 0;
1423
+ let k: int = 0;
1424
+ let lNumSegs: int = 0;
1425
+ let l: int = 0;
1426
+ let lNumFlots: int = 0;
1427
+ let lNumSpikes: int = 0;
1428
+ let dDistance: double = 0;
1429
+ let m: ref<number[]> = new ref();
1430
+ let lTotalPoints: int = 0;
1431
+ let points: number[];
1432
+ let pSpikePoints: POINT2[];
1433
+ let pt0: POINT2 = new POINT2();
1434
+ let tempPoint: POINT2 = new POINT2();
1435
+ let pFlotPoints: POINT2[];
1436
+ let pSegmentPoints: POINT2[];
1437
+ let dSpikeSize: double = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale());
1438
+ let dIncrement: double = arraysupport.getScaledSize(80, tg.get_LineThickness(), tg.get_patternScale()); //was 70
1439
+ let vbPoints: number[];
1440
+ let nFlotCounter: int = 0;
1441
+ let nSpikeCounter: int = 0;
1442
+ let nSegmentCounter: int = 0;
1443
+ let flots: number[];
1444
+ let segmentLength: double = 0;
1445
+ let spikeLength: double = 0;
1446
+ let bolTooLong: int = 0;
1447
+ let d1: double = 0;
1448
+ let d2: double = 0;
1449
+ let bolVertical: int = 0;
1450
+ let pFlotStart: POINT2[];
1451
+ let pFlotEnd: POINT2[];
1452
+ let pSpikeStart: POINT2[];
1453
+ let pSpikeEnd: POINT2[];
1454
+ let nSpikeEndCounter: int = 0;
1455
+ let nFlotEndCounter: int = 0;
1456
+ let bFlip: ref<number[]> = new ref();
1457
+ let lDirection: ref<number[]> = new ref();
1458
+ let lLastDirection: ref<number[]> = new ref();
1459
+
1460
+ m.value = new Array<number>(1);
1461
+ bFlip.value = new Array<number>(1);
1462
+ lDirection.value = new Array<number>(1);
1463
+ lLastDirection.value = new Array<number>(1);
1464
+ lTotalPoints = flot.GetOFYCountDouble(pLinePoints, dIncrement, numPts);
1465
+
1466
+ vbPoints = new Array<number>(numPts * 2);
1467
+
1468
+ pSpikePoints = new Array<POINT2>(lTotalPoints);
1469
+ pFlotPoints = new Array<POINT2>(lTotalPoints);
1470
+ pSegmentPoints = new Array<POINT2>(lTotalPoints);
1471
+ let n: int = pSpikePoints.length;
1472
+ //for (j = 0; j < pSpikePoints.length; j++)
1473
+ for (j = 0; j < n; j++) {
1474
+ pSpikePoints[j] = new POINT2(pLinePoints[0]);
1475
+ pSpikePoints[j].style = 5;
1476
+ }
1477
+ n = pFlotPoints.length;
1478
+ //for (j = 0; j < pFlotPoints.length; j++)
1479
+ for (j = 0; j < n; j++) {
1480
+ pFlotPoints[j] = new POINT2(pLinePoints[0]);
1481
+ pFlotPoints[j].style = 5;
1482
+ }
1483
+ lineutility.InitializePOINT2Array(pSegmentPoints);
1484
+
1485
+ flots = new Array<number>(numPts + 1);
1486
+ //the vbPoints long array gets used by GetFlotSegment
1487
+ //and is based on the original points
1488
+ for (j = 0; j < numPts; j++) {
1489
+ vbPoints[k] = pLinePoints[j].x as int;
1490
+ k++;
1491
+ vbPoints[k] = pLinePoints[j].y as int;
1492
+ k++;
1493
+ }
1494
+ k = 0;
1495
+ //initialize flots
1496
+ flots[0] = 0;
1497
+ for (j = 0; j < numPts; j++) {
1498
+ flots[j + 1] = 0;
1499
+ }
1500
+
1501
+ for (j = 0; j < numPts - 1; j++) {
1502
+ //initialize spike end counter and flot end counter for each segment
1503
+ nSpikeEndCounter = 0;
1504
+ nFlotEndCounter = 0;
1505
+ bolVertical = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m);
1506
+ m.value[0] = -m.value[0]; //reverse the direction
1507
+ dDistance = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
1508
+ lNumSegs = Math.trunc(dDistance / dIncrement); //flot(20) + spike(20) = 60 pixels
1509
+ lNumFlots = lNumSegs;
1510
+ lNumSpikes = lNumSegs;
1511
+ flots[j + 1] = lNumSegs;
1512
+
1513
+ //get the flot segments for this line segment
1514
+ //flot segments are 30 pixels wide with the flots in the middle, 20 pixels wide
1515
+ k = 0;
1516
+ if (lNumFlots > 0) {
1517
+ points = new Array<number>(lNumFlots * 30);
1518
+ pFlotStart = new Array<POINT2>(lNumFlots);
1519
+ pFlotEnd = new Array<POINT2>(lNumFlots);
1520
+ flot.GetFlotSegment2(tg, vbPoints, j, points, bFlip, lDirection, lLastDirection);
1521
+ for (l = 0; l < lNumFlots * 10; l++) {
1522
+ pFlotPoints[nFlotCounter].x = points[k];
1523
+ pFlotPoints[nFlotCounter].y = points[k + 1];
1524
+ pFlotPoints[nFlotCounter].style = 9;
1525
+ //straighten out the flots
1526
+ if ((nFlotCounter) % 10 === 0) {
1527
+ pFlotStart[Math.trunc(l / 10)] = new POINT2(pFlotPoints[nFlotCounter]);
1528
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pFlotPoints[nFlotCounter]);
1529
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pFlotPoints[nFlotCounter]);
1530
+ if (d2 > d1) {
1531
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j + 1], pLinePoints[j], -d1);
1532
+ } else {
1533
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j], pLinePoints[j + 1], -d2);
1534
+ }
1535
+ pFlotPoints[nFlotCounter].style = 9;
1536
+ }
1537
+ if ((nFlotCounter + 1) % 10 === 0) {
1538
+ pFlotEnd[Math.trunc(l / 10)] = new POINT2(pFlotPoints[nFlotCounter]);
1539
+ nFlotEndCounter++;
1540
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pFlotPoints[nFlotCounter - 9]);
1541
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pFlotPoints[nFlotCounter - 9]);
1542
+ if (d2 > d1) {
1543
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j + 1], pLinePoints[j], -d1 - dSpikeSize);
1544
+ } else {
1545
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j], pLinePoints[j + 1], -d2 + dSpikeSize);
1546
+ }
1547
+
1548
+ pFlotPoints[nFlotCounter].style = 10;
1549
+ }
1550
+ k += 3;
1551
+ nFlotCounter++;
1552
+ }
1553
+ points = null;
1554
+ }// end if num flots>0
1555
+ else //segment too short
1556
+ {
1557
+ pSegmentPoints[nSegmentCounter] = new POINT2(pLinePoints[j]);
1558
+ pSegmentPoints[nSegmentCounter++].style = 0;
1559
+ pSegmentPoints[nSegmentCounter] = new POINT2(pLinePoints[j + 1]);
1560
+ pSegmentPoints[nSegmentCounter++].style = 5;
1561
+ }
1562
+
1563
+ //for each spike in the line segment
1564
+ //spikes segments are 30 pixels wide with the spikes in the middle, 20 pixels wide
1565
+ segmentLength = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
1566
+ pSpikeStart = new Array<POINT2>(lNumSpikes);
1567
+ pSpikeEnd = new Array<POINT2>(lNumSpikes);
1568
+ for (k = 0; k < lNumSpikes - 1; k++) //get the spike
1569
+ {
1570
+ //the first spike base point
1571
+ //has to be based on the preceding flot
1572
+ //if the distance goes past the end of the line segment then set the point to the
1573
+ //end of the line segment
1574
+ bolTooLong = 0;
1575
+
1576
+ //for the greatest accuracy
1577
+ d1 = lineutility.CalcDistanceDouble(pFlotEnd[k], pFlotEnd[k + 1]);
1578
+ d1 = d1 / 2 - dSpikeSize;
1579
+ tempPoint = lineutility.ExtendAlongLineDouble(pFlotEnd[k], pLinePoints[j + 1], d1, 0);
1580
+ spikeLength = lineutility.CalcDistanceDouble(pLinePoints[j], tempPoint);
1581
+ if (spikeLength + dSpikeSize < segmentLength) {
1582
+ pSpikePoints[nSpikeCounter] = new POINT2(tempPoint);
1583
+ pSpikeStart[k] = new POINT2(tempPoint);
1584
+ } else {
1585
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1586
+ bolTooLong = 1;
1587
+ }
1588
+
1589
+ pSpikePoints[nSpikeCounter].style = 9;
1590
+ nSpikeCounter++;
1591
+
1592
+ pt0 = lineutility.ExtendAlongLineDouble(pSpikePoints[nSpikeCounter - 1], pLinePoints[j + 1], dSpikeSize / 2);
1593
+
1594
+ //the spike end (perpendicular) point
1595
+ if (bolTooLong === 0) {
1596
+ if (bolVertical !== 0) //segment is not vertical
1597
+ {
1598
+ if (pLinePoints[j].x < pLinePoints[j + 1].x) {
1599
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 2, dSpikeSize); //extennd above the line
1600
+ } else {
1601
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 3, dSpikeSize); //extend below the line
1602
+ }
1603
+ pSpikePoints[nSpikeCounter].style = 0;
1604
+ nSpikeCounter++;
1605
+ } else //vertical segment
1606
+ {
1607
+ if (pLinePoints[j].y > pLinePoints[j + 1].y) {
1608
+ pSpikePoints[nSpikeCounter].x = pt0.x - dSpikeSize;
1609
+ } else {
1610
+ pSpikePoints[nSpikeCounter].x = pt0.x + dSpikeSize;
1611
+ }
1612
+
1613
+ pSpikePoints[nSpikeCounter].y = pt0.y;
1614
+ nSpikeCounter++;
1615
+ }
1616
+ } else //too long
1617
+ {
1618
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1619
+ nSpikeCounter++;
1620
+ }
1621
+ pSpikePoints[nSpikeCounter - 1].style = 9;
1622
+
1623
+ //the second spike base point. this is the third spike point
1624
+ if (bolTooLong === 0) {
1625
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pSpikePoints[nSpikeCounter - 2]);
1626
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pSpikePoints[nSpikeCounter - 2]);
1627
+ if (d1 > d2) {
1628
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendLine2Double(pLinePoints[j], pSpikePoints[nSpikeCounter - 2], dSpikeSize, 0);
1629
+ } else {
1630
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendLine2Double(pLinePoints[j + 1], pSpikePoints[nSpikeCounter - 2], -dSpikeSize, 0);
1631
+ }
1632
+
1633
+ pSpikeEnd[k] = new POINT2(pSpikePoints[nSpikeCounter]);
1634
+ nSpikeEndCounter++;
1635
+ pSpikePoints[nSpikeCounter].style = 10;
1636
+ } else {
1637
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1638
+ pSpikePoints[nSpikeCounter].style = 5;
1639
+ }
1640
+ nSpikeCounter++;
1641
+ }//end for k= 0 to numSpikes-1
1642
+ //if there are no spikes
1643
+ if (nSpikeEndCounter === 0 && nFlotEndCounter === 1) {
1644
+ pSegmentPoints[nSegmentCounter] = new POINT2(pLinePoints[j]);
1645
+ pSegmentPoints[nSegmentCounter++].style = 0;
1646
+ pSegmentPoints[nSegmentCounter] = new POINT2(pFlotStart[0]);
1647
+ pSegmentPoints[nSegmentCounter++].style = 5;
1648
+
1649
+ pSegmentPoints[nSegmentCounter] = new POINT2(pLinePoints[j + 1]);
1650
+ pSegmentPoints[nSegmentCounter++].style = 0;
1651
+ pSegmentPoints[nSegmentCounter] = new POINT2(pFlotEnd[0]);
1652
+ pSegmentPoints[nSegmentCounter++].style = 5;
1653
+ }
1654
+ //put a loop here for the segment points
1655
+ for (l = 0; l < nSpikeEndCounter; l++) {
1656
+ if (l === 0) {
1657
+ pSegmentPoints[nSegmentCounter] = new POINT2(pLinePoints[j]);
1658
+ pSegmentPoints[nSegmentCounter++].style = 0;
1659
+ pSegmentPoints[nSegmentCounter] = new POINT2(pFlotStart[0]);
1660
+ pSegmentPoints[nSegmentCounter++].style = 5;
1661
+ }
1662
+ if (l === nSpikeEndCounter - 1) //the last spike
1663
+ {
1664
+ pSegmentPoints[nSegmentCounter] = new POINT2(pLinePoints[j + 1]);
1665
+ pSegmentPoints[nSegmentCounter++].style = 0;
1666
+ pSegmentPoints[nSegmentCounter] = new POINT2(pFlotEnd[l + 1]);
1667
+ pSegmentPoints[nSegmentCounter++].style = 5;
1668
+ }
1669
+ //put the cross point segments between the flots and spikes
1670
+ //segment before the spike is just a line
1671
+ pSegmentPoints[nSegmentCounter] = new POINT2(pSpikeEnd[l]);
1672
+ pSegmentPoints[nSegmentCounter++].style = 0;
1673
+ pSegmentPoints[nSegmentCounter] = new POINT2(pFlotStart[l + 1]);
1674
+ pSegmentPoints[nSegmentCounter++].style = 5;
1675
+
1676
+ //the cross points
1677
+ d1 = lineutility.CalcDistanceDouble(pSpikeStart[l], pFlotEnd[l]);
1678
+ pSegmentPoints[nSegmentCounter++] = lineutility.ExtendAlongLineDouble(pSpikeStart[l], pLinePoints[j], d1 / 3, 0);
1679
+ pSegmentPoints[nSegmentCounter++] = lineutility.ExtendAlongLineDouble(pSpikeStart[l], pLinePoints[j], 2 * d1 / 3, 5);
1680
+ tempPoint = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pSegmentPoints[nSegmentCounter - 2], 2, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 0);
1681
+ pSegmentPoints[nSegmentCounter++] = new POINT2(tempPoint);
1682
+ tempPoint = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pSegmentPoints[nSegmentCounter - 2], 3, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 5);
1683
+ pSegmentPoints[nSegmentCounter++] = new POINT2(tempPoint);
1684
+ }
1685
+ if (nSpikeCounter === 0) {
1686
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j]);
1687
+ pSpikePoints[nSpikeCounter].style = 5;
1688
+ nSpikeCounter++;
1689
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1690
+ pSpikePoints[nSpikeCounter].style = 5;
1691
+ nSpikeCounter++;
1692
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1693
+ pSpikePoints[nSpikeCounter].style = 5;
1694
+ nSpikeCounter++;
1695
+ } else {
1696
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
1697
+ pSpikePoints[nSpikeCounter].style = 5;
1698
+ pSpikePoints[nSpikeCounter + 1] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
1699
+ pSpikePoints[nSpikeCounter + 1].style = 5;
1700
+ pSpikePoints[nSpikeCounter + 2] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
1701
+ pSpikePoints[nSpikeCounter + 2].style = 5;
1702
+ nSpikeCounter += 3;
1703
+ }
1704
+ }
1705
+
1706
+ //load the spike points into the array
1707
+ nTotalCounter = 0;
1708
+ for (j = 0; j < nFlotCounter; j++) {
1709
+ pLinePoints[nTotalCounter++] = new POINT2(pFlotPoints[j]);
1710
+ }
1711
+ for (j = 0; j < nSpikeCounter; j++) {
1712
+ pLinePoints[nTotalCounter++] = new POINT2(pSpikePoints[j]);
1713
+ }
1714
+ for (j = 0; j < nSegmentCounter; j++) {
1715
+ pLinePoints[nTotalCounter++] = new POINT2(pSegmentPoints[j]);
1716
+ }
1717
+ n = pLinePoints.length;
1718
+ //for (j = nTotalCounter; j < pLinePoints.length; j++)
1719
+ for (j = nTotalCounter; j < n; j++) {
1720
+ pLinePoints[j] = new POINT2(pLinePoints[nTotalCounter - 1]);
1721
+ }
1722
+ } catch (exc) {
1723
+ if (exc instanceof Error) {
1724
+ ErrorLogger.LogException(flot._className, "GetOFYPointsDouble",
1725
+ new RendererException("Failed inside GetOFYPointsDouble", exc));
1726
+ } else {
1727
+ throw exc;
1728
+ }
1729
+ }
1730
+ return nTotalCounter;
1731
+ }
1732
+ static GetSFPointsDouble(tg: TGLight,
1733
+ pLinePoints: POINT2[],
1734
+ numPts: int): int {
1735
+ let nTotalCounter: int = 0;
1736
+ try {
1737
+ let lineType: int = tg.get_LineType();
1738
+ let lTotalPoints: int = 0;
1739
+ let j: int = 0;
1740
+ let k: int = 0;
1741
+ let lNumSegs: int = 0;
1742
+ let l: int = 0;
1743
+ let lNumFlots: int = 0;
1744
+ let lNumSpikes: int = 0;
1745
+ let dDistance: double = 0;
1746
+ let m: ref<number[]> = new ref();
1747
+ let points: number[];
1748
+ let pSpikePoints: POINT2[];
1749
+ let pt0: POINT2 = new POINT2();
1750
+ let tempPoint: POINT2 = new POINT2();
1751
+ let pFlotPoints: POINT2[];
1752
+ let dSpikeSize: double = arraysupport.getScaledSize(20, tg.get_LineThickness(), tg.get_patternScale());
1753
+ let dIncrement: double = arraysupport.getScaledSize(80, tg.get_LineThickness(), tg.get_patternScale());
1754
+ let vbPoints: number[];
1755
+ let nFlotCounter: int = 0;
1756
+ let nSpikeCounter: int = 0;
1757
+ let nSegCounter: int = 0;
1758
+ let flots: number[];
1759
+ //int sumOfFlots = 0;
1760
+ let segmentLength: double = 0;
1761
+ let spikeLength: double = 0;
1762
+ let bolTooLong: int = 0;
1763
+ let d1: double = 0;
1764
+ let d2: double = 0;
1765
+ let bolVertical: int = 0;
1766
+ let pFlotStart: POINT2[];
1767
+ let pFlotEnd: POINT2[];
1768
+ let pSpikeStart: POINT2[];
1769
+ let pSpikeEnd: POINT2[];
1770
+ let pSegPoints: POINT2[];
1771
+ let bFlip: ref<number[]> = new ref();
1772
+ let lDirection: ref<number[]> = new ref();
1773
+ let lLastDirection: ref<number[]> = new ref();
1774
+
1775
+ lTotalPoints = flot.GetSFCountDouble(pLinePoints, numPts);
1776
+ m.value = new Array<number>(1);
1777
+ lDirection.value = new Array<number>(1);
1778
+ lDirection.value[0] = -1;
1779
+ lLastDirection.value = new Array<number>(1);
1780
+ lLastDirection.value[0] = -1;
1781
+ bFlip.value = new Array<number>(1);
1782
+ bFlip.value[0] = -1;
1783
+
1784
+ vbPoints = new Array<number>(numPts * 2);
1785
+ pSpikePoints = new Array<POINT2>(lTotalPoints);
1786
+ pFlotPoints = new Array<POINT2>(lTotalPoints);
1787
+ let n: int = pSpikePoints.length;
1788
+ //for (j = 0; j < pSpikePoints.length; j++)
1789
+ for (j = 0; j < n; j++) {
1790
+ pSpikePoints[j] = new POINT2(pLinePoints[0]);
1791
+ pSpikePoints[j].style = 5;
1792
+ }
1793
+ n = pFlotPoints.length;
1794
+ //for (j = 0; j < pFlotPoints.length; j++)
1795
+ for (j = 0; j < n; j++) {
1796
+ pFlotPoints[j] = new POINT2(pLinePoints[0]);
1797
+ pFlotPoints[j].style = 5;
1798
+ }
1799
+ pSegPoints = new Array<POINT2>(4 * (numPts - 1));
1800
+ lineutility.InitializePOINT2Array(pSegPoints);
1801
+
1802
+ flots = new Array<number>(numPts + 1);
1803
+ //the vbPoints long array gets used by GetFlotSegment
1804
+ //and is based on the original points
1805
+ //for(j=0;j<numPts;j++)
1806
+ for (j = 0; j < numPts; j++) {
1807
+ vbPoints[k] = pLinePoints[j].x as int;
1808
+ k++;
1809
+ vbPoints[k] = pLinePoints[j].y as int;
1810
+ k++;
1811
+ }
1812
+ k = 0;
1813
+ //initialize flots
1814
+ flots[0] = 0;
1815
+ for (j = 0; j < numPts; j++) {
1816
+ flots[j + 1] = 0;
1817
+ }
1818
+
1819
+ for (j = 0; j < numPts - 1; j++) {
1820
+ bolVertical = lineutility.CalcTrueSlopeDouble(pLinePoints[j], pLinePoints[j + 1], m);
1821
+ m.value[0] = -m.value[0]; //reverse the direction
1822
+ dDistance = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
1823
+ lNumSegs = Math.trunc(dDistance / dIncrement);
1824
+ lNumFlots = lNumSegs;
1825
+ lNumSpikes = lNumSegs;
1826
+ flots[j + 1] = lNumSegs;
1827
+
1828
+ //get the flot segments for this line segment
1829
+ //flot segments are 30 pixels wide with the flots in the middle, 20 pixels wide
1830
+ k = 0;
1831
+ if (lNumFlots > 0) {
1832
+ points = new Array<number>(lNumFlots * 30);
1833
+ pFlotStart = new Array<POINT2>(lNumFlots);
1834
+ lineutility.InitializePOINT2Array(pFlotStart);
1835
+ pFlotEnd = new Array<POINT2>(lNumFlots);
1836
+ lineutility.InitializePOINT2Array(pFlotEnd);
1837
+ flot.GetFlotSegment2(tg, vbPoints, j, points, bFlip, lDirection, lLastDirection);
1838
+ for (l = 0; l < lNumFlots * 10; l++) {
1839
+ pFlotPoints[nFlotCounter].x = points[k];
1840
+ pFlotPoints[nFlotCounter].y = points[k + 1];
1841
+
1842
+ if (lineType === TacticalLines.USF || lineType === TacticalLines.SF) {
1843
+ pFlotPoints[nFlotCounter].style = 19;
1844
+ } else {
1845
+ pFlotPoints[nFlotCounter].style = 9;
1846
+ }
1847
+
1848
+ //straighten out the flots
1849
+ if ((nFlotCounter) % 10 === 0) {
1850
+ pFlotStart[Math.trunc(l / 10)] = pFlotPoints[nFlotCounter];
1851
+ d1 = lineutility.CalcDistanceDouble(pLinePoints[j], pFlotPoints[nFlotCounter]);
1852
+ d2 = lineutility.CalcDistanceDouble(pLinePoints[j + 1], pFlotPoints[nFlotCounter]);
1853
+ if (d2 > d1) {
1854
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j + 1], pLinePoints[j], -d1);
1855
+ } else {
1856
+ pFlotPoints[nFlotCounter] = lineutility.ExtendLineDouble(pLinePoints[j], pLinePoints[j + 1], -d2);
1857
+ }
1858
+
1859
+ if (lineType === TacticalLines.USF || lineType === TacticalLines.SF) {
1860
+ pFlotPoints[nFlotCounter].style = 19;
1861
+ } else {
1862
+ pFlotPoints[nFlotCounter].style = 9;
1863
+ }
1864
+ }
1865
+
1866
+ if ((nFlotCounter + 1) % 10 === 0) {
1867
+ if (lineType === TacticalLines.USF || lineType === TacticalLines.SF) {
1868
+ pFlotPoints[nFlotCounter].style = 5; //end of flot
1869
+ } else {
1870
+ pFlotPoints[nFlotCounter].style = 23; //red fill
1871
+ }
1872
+ pFlotEnd[Math.trunc(l / 10)] = new POINT2(pFlotPoints[nFlotCounter]);
1873
+ }
1874
+ if (l === 0) {
1875
+ pSegPoints[nSegCounter] = new POINT2(pLinePoints[j]);
1876
+ pSegPoints[nSegCounter++].style = 19;
1877
+ pSegPoints[nSegCounter] = new POINT2(pFlotStart[l]);
1878
+ pSegPoints[nSegCounter++].style = 5;
1879
+ }
1880
+ if (l === lNumFlots * 10 - 1) {
1881
+ pSegPoints[nSegCounter] = new POINT2(pLinePoints[j + 1]);
1882
+ pSegPoints[nSegCounter++].style = 19;
1883
+ pSegPoints[nSegCounter] = new POINT2(pFlotStart[Math.trunc(l / 10)]);
1884
+ pSegPoints[nSegCounter++].style = 5;
1885
+ }
1886
+ k += 3;
1887
+ nFlotCounter++;
1888
+ }
1889
+ points = null;
1890
+ }//end if num flots>0
1891
+ else //segment too short
1892
+ {
1893
+ pSegPoints[nSegCounter] = new POINT2(pLinePoints[j]);
1894
+ pSegPoints[nSegCounter++].style = 0;
1895
+ pSegPoints[nSegCounter] = new POINT2(pLinePoints[j + 1]);
1896
+ pSegPoints[nSegCounter++].style = 5;
1897
+ }
1898
+
1899
+ //for each spike in the line segment
1900
+ //spikes segments are 30 pixels wide with the spikes in the middle, 20 pixels wide
1901
+ segmentLength = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
1902
+ pSpikeStart = new Array<POINT2>(lNumSpikes);
1903
+ lineutility.InitializePOINT2Array(pSpikeStart);
1904
+ pSpikeEnd = new Array<POINT2>(lNumSpikes);
1905
+ lineutility.InitializePOINT2Array(pSpikeEnd);
1906
+ for (k = 0; k < lNumSpikes - 1; k++) //get the spike
1907
+ {
1908
+ //the first spike base point
1909
+ //has to be based on the preceding flot
1910
+ //if the distance goes past the end of the line segment then set the point to the
1911
+ //end of the line segment
1912
+ bolTooLong = 0;
1913
+
1914
+ d1 = lineutility.CalcDistanceDouble(pFlotStart[k], pFlotStart[k + 1]);
1915
+ d1 = d1 / 2 - dSpikeSize;
1916
+ tempPoint = lineutility.ExtendAlongLineDouble(pFlotStart[k], pLinePoints[j + 1], d1, 0);
1917
+
1918
+ spikeLength = lineutility.CalcDistanceDouble(pLinePoints[j], tempPoint);
1919
+ if (spikeLength + dSpikeSize < segmentLength) {
1920
+ pSpikePoints[nSpikeCounter] = new POINT2(tempPoint);
1921
+ pSpikeStart[k] = new POINT2(tempPoint);
1922
+ } else {
1923
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1924
+ bolTooLong = 1;
1925
+ }
1926
+
1927
+ if (lineType === TacticalLines.USF || lineType === TacticalLines.SF) {
1928
+ pSpikePoints[nSpikeCounter].style = 25;
1929
+ } else {
1930
+ pSpikePoints[nSpikeCounter].style = 9;
1931
+ }
1932
+
1933
+ nSpikeCounter++;
1934
+
1935
+ pt0 = lineutility.ExtendAlongLineDouble(pSpikePoints[nSpikeCounter - 1], pLinePoints[j + 1], dSpikeSize / 2);
1936
+ //the spike end (perpendicular) point
1937
+ if (bolTooLong === 0) {
1938
+ if (bolVertical !== 0) //segment is not vertical
1939
+ {
1940
+ if (pLinePoints[j].x < pLinePoints[j + 1].x) {
1941
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 2, dSpikeSize); //extennd above the line
1942
+ } else {
1943
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendDirectedLine(pLinePoints[j], pLinePoints[j + 1], pt0, 3, dSpikeSize); //extend below the line
1944
+ }
1945
+ pSpikePoints[nSpikeCounter].style = 0;
1946
+ //pSpikeEnd[k]=pSpikePoints[nSpikeCounter];
1947
+ nSpikeCounter++;
1948
+ } else //vertical segment
1949
+ {
1950
+ if (pLinePoints[j].y > pLinePoints[j + 1].y) {
1951
+ pSpikePoints[nSpikeCounter].x = pt0.x - dSpikeSize;
1952
+ } else {
1953
+ pSpikePoints[nSpikeCounter].x = pt0.x + dSpikeSize;
1954
+ }
1955
+
1956
+ pSpikePoints[nSpikeCounter].y = pt0.y;
1957
+ nSpikeCounter++;
1958
+ }
1959
+ } else //too long
1960
+ {
1961
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1962
+ nSpikeCounter++;
1963
+ }
1964
+
1965
+ if (lineType === TacticalLines.USF || lineType === TacticalLines.SF) {
1966
+ pSpikePoints[nSpikeCounter - 1].style = 25;
1967
+ } else {
1968
+ pSpikePoints[nSpikeCounter - 1].style = 9;
1969
+ }
1970
+
1971
+ //the second spike base point. this is the third spike point
1972
+ if (bolTooLong === 0) {
1973
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendAlongLineDouble(pSpikePoints[nSpikeCounter - 2], pLinePoints[j + 1], dSpikeSize);
1974
+
1975
+ if (lineType === TacticalLines.USF || lineType === TacticalLines.SF) {
1976
+ pSpikePoints[nSpikeCounter].style = 5;
1977
+ } else {
1978
+ pSpikePoints[nSpikeCounter].style = 24;
1979
+ }
1980
+
1981
+ pSpikeEnd[k] = new POINT2(pSpikePoints[nSpikeCounter]);
1982
+ } else {
1983
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
1984
+ pSpikePoints[nSpikeCounter].style = 5;
1985
+ }
1986
+ nSpikeCounter++;
1987
+ //the segment feature points, for SF they are just lines
1988
+ if (lineType === TacticalLines.SF ||
1989
+ lineType === TacticalLines.USF) {
1990
+ d1 = lineutility.CalcDistanceDouble(pFlotStart[k], pSpikeStart[k]);
1991
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotStart[k]);
1992
+ pSpikePoints[nSpikeCounter++].style = 19;
1993
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pFlotStart[k], pLinePoints[j + 1], d1 / 2, 5);
1994
+
1995
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotEnd[k]);
1996
+ pSpikePoints[nSpikeCounter++].style = 19;
1997
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pFlotEnd[k], pLinePoints[j], d1 / 2, 5);
1998
+
1999
+ if (k === lNumSpikes - 2) {
2000
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotStart[k + 1]);
2001
+ pSpikePoints[nSpikeCounter++].style = 19;
2002
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pFlotStart[k + 1], pLinePoints[j + 1], d1 / 2, 5);
2003
+
2004
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotEnd[k + 1]);
2005
+ pSpikePoints[nSpikeCounter++].style = 19;
2006
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pFlotEnd[k + 1], pLinePoints[j], d1 / 2, 5);
2007
+
2008
+ }
2009
+
2010
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikeStart[k]);
2011
+ pSpikePoints[nSpikeCounter++].style = 25;
2012
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pSpikeStart[k], pLinePoints[j], d1 / 2, 5);
2013
+
2014
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikeEnd[k]);
2015
+ pSpikePoints[nSpikeCounter++].style = 25;
2016
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pSpikeEnd[k], pLinePoints[j + 1], d1 / 2, 5);
2017
+
2018
+ if (lineType === TacticalLines.USF) {
2019
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotEnd[k]);
2020
+ pSpikePoints[nSpikeCounter++].style = 19;
2021
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotStart[k]);
2022
+ pSpikePoints[nSpikeCounter++].style = 5;
2023
+
2024
+ if (k === lNumSpikes - 2) {
2025
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotEnd[k + 1]);
2026
+ pSpikePoints[nSpikeCounter++].style = 19;
2027
+ pSpikePoints[nSpikeCounter] = new POINT2(pFlotStart[k + 1]);
2028
+ pSpikePoints[nSpikeCounter++].style = 5;
2029
+ }
2030
+
2031
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikeEnd[k]);
2032
+ pSpikePoints[nSpikeCounter++].style = 25;
2033
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikeStart[k]);
2034
+ pSpikePoints[nSpikeCounter++].style = 5;
2035
+ }
2036
+ }
2037
+ if (lineType === TacticalLines.SFG) {
2038
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pSpikeStart[k], pLinePoints[j], dSpikeSize / 2, 22);
2039
+ pSpikePoints[nSpikeCounter++] = lineutility.ExtendAlongLineDouble(pSpikeEnd[k], pLinePoints[j + 1], dSpikeSize / 2, 20);
2040
+ }
2041
+ if (lineType === TacticalLines.SFY) {
2042
+
2043
+ d1 = lineutility.CalcDistanceDouble(pFlotStart[k], pSpikeStart[k]);
2044
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendAlongLineDouble(pSpikeStart[k], pLinePoints[j], d1 / 4); //was dSpikeSize/4
2045
+ pSpikePoints[nSpikeCounter].style = 25; //blue
2046
+ pSpikePoints[nSpikeCounter + 1] = lineutility.ExtendAlongLineDouble(pSpikeStart[k], pLinePoints[j], d1 / 2); //was dSpikeSize/2
2047
+ pSpikePoints[nSpikeCounter + 1].style = 5; //end of blue part
2048
+ pSpikePoints[nSpikeCounter + 2] = lineutility.ExtendAlongLineDouble(pSpikeStart[k], pLinePoints[j], d1 / 2); //was dSpikeSize/2
2049
+ pSpikePoints[nSpikeCounter + 2].style = 19; //red
2050
+ pSpikePoints[nSpikeCounter + 3] = lineutility.ExtendAlongLineDouble(pSpikeStart[k], pLinePoints[j], 3 * d1 / 4); //was 1.5*dSpikeSize/2
2051
+ pSpikePoints[nSpikeCounter + 3].style = 5; //end of red part
2052
+ //the cross points
2053
+ pSpikePoints[nSpikeCounter + 4] = lineutility.ExtendDirectedLine(pSpikePoints[nSpikeCounter], pLinePoints[j], pSpikePoints[nSpikeCounter], 2, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 25);
2054
+ pSpikePoints[nSpikeCounter + 5] = lineutility.ExtendDirectedLine(pSpikePoints[nSpikeCounter + 3], pLinePoints[j], pSpikePoints[nSpikeCounter + 3], 3, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 5);
2055
+ nSpikeCounter += 6;
2056
+
2057
+ d1 = lineutility.CalcDistanceDouble(pFlotEnd[k + 1], pSpikeEnd[k]);
2058
+ pSpikePoints[nSpikeCounter] = lineutility.ExtendAlongLineDouble(pSpikeEnd[k], pLinePoints[j + 1], d1 / 4);
2059
+ pSpikePoints[nSpikeCounter].style = 25;
2060
+ pSpikePoints[nSpikeCounter + 1] = lineutility.ExtendAlongLineDouble(pSpikeEnd[k], pLinePoints[j + 1], d1 / 2);
2061
+ pSpikePoints[nSpikeCounter + 1].style = 5;
2062
+ pSpikePoints[nSpikeCounter + 2] = lineutility.ExtendAlongLineDouble(pSpikeEnd[k], pLinePoints[j + 1], d1 / 2);
2063
+ pSpikePoints[nSpikeCounter + 2].style = 19;
2064
+ pSpikePoints[nSpikeCounter + 3] = lineutility.ExtendAlongLineDouble(pSpikeEnd[k], pLinePoints[j + 1], 3 * d1 / 4);
2065
+ pSpikePoints[nSpikeCounter + 3].style = 5;
2066
+ //the cross points
2067
+ pSpikePoints[nSpikeCounter + 4] = lineutility.ExtendDirectedLine(pSpikePoints[nSpikeCounter], pLinePoints[j + 1], pSpikePoints[nSpikeCounter], 3, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 19);
2068
+ pSpikePoints[nSpikeCounter + 5] = lineutility.ExtendDirectedLine(pSpikePoints[nSpikeCounter + 3], pLinePoints[j + 1], pSpikePoints[nSpikeCounter + 3], 2, arraysupport.getScaledSize(5, tg.get_LineThickness(), tg.get_patternScale()), 5);
2069
+ nSpikeCounter += 6;
2070
+
2071
+ }
2072
+ }//for k= 0 to numSpikes-1
2073
+ if (nSpikeCounter === 0) {
2074
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j]);
2075
+ pSpikePoints[nSpikeCounter].style = 5;
2076
+ nSpikeCounter++;
2077
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
2078
+ pSpikePoints[nSpikeCounter].style = 5;
2079
+ nSpikeCounter++;
2080
+ //added 6-1-05 M. Deutch
2081
+ pSpikePoints[nSpikeCounter] = new POINT2(pLinePoints[j + 1]);
2082
+ pSpikePoints[nSpikeCounter].style = 5;
2083
+ nSpikeCounter++;
2084
+ } else {
2085
+ pSpikePoints[nSpikeCounter] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
2086
+ pSpikePoints[nSpikeCounter].style = 5;
2087
+ pSpikePoints[nSpikeCounter + 1] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
2088
+ pSpikePoints[nSpikeCounter + 1].style = 5;
2089
+ pSpikePoints[nSpikeCounter + 2] = new POINT2(pSpikePoints[nSpikeCounter - 1]);
2090
+ pSpikePoints[nSpikeCounter + 2].style = 5;
2091
+ nSpikeCounter += 3;
2092
+ }
2093
+ }
2094
+ n = pLinePoints.length;
2095
+ //for (j = 0; j < pLinePoints.length; j++)
2096
+ for (j = 0; j < n; j++) {
2097
+ pLinePoints[j] = new POINT2(pSpikePoints[0]);
2098
+ pLinePoints[j].style = 5;
2099
+ }
2100
+ //load the spike points into the array
2101
+ nTotalCounter = 0;
2102
+ for (j = 0; j < nFlotCounter; j++) {
2103
+ pLinePoints[nTotalCounter++] = new POINT2(pFlotPoints[j]);
2104
+ }
2105
+ for (j = 0; j < nSpikeCounter; j++) {
2106
+ pLinePoints[nTotalCounter++] = new POINT2(pSpikePoints[j]);
2107
+ }
2108
+ for (j = 0; j < nSegCounter; j++) {
2109
+ pLinePoints[nTotalCounter++] = new POINT2(pSegPoints[j]);
2110
+ }
2111
+ n = pLinePoints.length;
2112
+ //for (j = nTotalCounter; j < pLinePoints.length; j++)
2113
+ for (j = nTotalCounter; j < n; j++) {
2114
+ pLinePoints[j] = new POINT2(pLinePoints[nTotalCounter - 1]);
2115
+ }
2116
+
2117
+ } catch (exc) {
2118
+ if (exc instanceof Error) {
2119
+ ErrorLogger.LogException(flot._className, "GetSFPointsDouble",
2120
+ new RendererException("Failed inside GetSFPointsDouble", exc));
2121
+ } else {
2122
+ throw exc;
2123
+ }
2124
+ }
2125
+ return nTotalCounter;
2126
+ }
2127
+
2128
+ static GetSFCountDouble(pLinePoints: POINT2[], numPts: int): int {
2129
+ let lTotalpts: int = 0;
2130
+ try {
2131
+ let j: int = 0;
2132
+ let lNumSegs: int = 0;
2133
+ let lNumFlots: int = 0;
2134
+ let lNumSpikes: int = 0;
2135
+ let dDistance: double = 0;
2136
+ //end declarations
2137
+
2138
+ //for each segment
2139
+ for (j = 0; j < numPts - 1; j++) {
2140
+ dDistance = lineutility.CalcDistanceDouble(pLinePoints[j], pLinePoints[j + 1]);
2141
+ lNumSegs = Math.trunc(dDistance / 80);
2142
+ lNumFlots = lNumSegs;
2143
+ lNumSpikes = lNumSegs;
2144
+ if (lNumFlots < 1) {
2145
+ lNumFlots = 1;
2146
+ }
2147
+ if (lNumSpikes < 1) {
2148
+ lNumSpikes = 1;
2149
+ }
2150
+ lTotalpts += lNumFlots * 10; //10 points per flot,
2151
+ lTotalpts += lNumSpikes * 3; //3 points per spike
2152
+ lTotalpts += lNumSegs * 16; // points for line features
2153
+ lTotalpts += numPts * 4;
2154
+ }
2155
+ if (lTotalpts < 25 * numPts) {
2156
+ lTotalpts = 25 * numPts;
2157
+ }
2158
+
2159
+ if (lTotalpts < numPts) {
2160
+ lTotalpts = numPts;
2161
+ }
2162
+
2163
+ } catch (exc) {
2164
+ if (exc instanceof Error) {
2165
+ ErrorLogger.LogException(flot._className, "GetSFCountDouble",
2166
+ new RendererException("Failed inside GetSFCountDouble", exc));
2167
+ } else {
2168
+ throw exc;
2169
+ }
2170
+ }
2171
+ return lTotalpts;
2172
+ }
2173
+ }