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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/{dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz → armyc2.c5isr.renderer-mil-sym-ts-web-2.2.1.tgz} +0 -0
  2. package/package.json +15 -39
  3. package/buildNode.bat +0 -2
  4. package/buildWeb.bat +0 -2
  5. package/dist/LICENSE +0 -201
  6. package/dist/README.md +0 -57
  7. package/dist/package.json +0 -16
  8. package/index.ts +0 -169
  9. package/package.bak +0 -50
  10. package/package.node.json +0 -43
  11. package/package.pack.json +0 -19
  12. package/package.packWeb.json +0 -16
  13. package/package.web.json +0 -40
  14. package/src/main/ts/android/graphics/Bitmap.ts +0 -7
  15. package/src/main/ts/android/graphics/Paint.ts +0 -26
  16. package/src/main/ts/android/graphics/Path.ts +0 -78
  17. package/src/main/ts/android/graphics/PointF.ts +0 -14
  18. package/src/main/ts/android/graphics/Rect.ts +0 -18
  19. package/src/main/ts/android/graphics/RectF.ts +0 -50
  20. package/src/main/ts/android/graphics/Region.ts +0 -36
  21. package/src/main/ts/android/graphics/Typeface.ts +0 -11
  22. package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +0 -99
  23. package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +0 -34
  24. package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +0 -193
  25. package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +0 -2971
  26. package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +0 -4008
  27. package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +0 -93
  28. package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +0 -89
  29. package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +0 -515
  30. package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +0 -5403
  31. package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +0 -1084
  32. package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +0 -2173
  33. package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +0 -4934
  34. package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +0 -7
  35. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +0 -5601
  36. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +0 -14
  37. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +0 -648
  38. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +0 -647
  39. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +0 -2994
  40. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +0 -2663
  41. package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +0 -669
  42. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +0 -971
  43. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +0 -871
  44. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +0 -3507
  45. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +0 -500
  46. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +0 -1089
  47. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +0 -2656
  48. package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +0 -1419
  49. package/src/main/ts/armyc2/c5isr/data/genc.json +0 -1407
  50. package/src/main/ts/armyc2/c5isr/data/msd.json +0 -17311
  51. package/src/main/ts/armyc2/c5isr/data/mse.json +0 -18500
  52. package/src/main/ts/armyc2/c5isr/data/svgd.json +0 -31214
  53. package/src/main/ts/armyc2/c5isr/data/svge.json +0 -30558
  54. package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +0 -10
  55. package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +0 -437
  56. package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +0 -429
  57. package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +0 -7
  58. package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +0 -35
  59. package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +0 -111
  60. package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +0 -29
  61. package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +0 -18
  62. package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +0 -211
  63. package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +0 -80
  64. package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +0 -33
  65. package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +0 -16
  66. package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +0 -726
  67. package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +0 -141
  68. package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +0 -112
  69. package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +0 -261
  70. package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +0 -391
  71. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +0 -567
  72. package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +0 -445
  73. package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +0 -31
  74. package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +0 -18
  75. package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +0 -45
  76. package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +0 -25
  77. package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +0 -15
  78. package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +0 -22
  79. package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +0 -269
  80. package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +0 -9882
  81. package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +0 -146
  82. package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +0 -1265
  83. package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +0 -64
  84. package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +0 -95
  85. package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +0 -93
  86. package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +0 -114
  87. package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +0 -555
  88. package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +0 -62
  89. package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +0 -120
  90. package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +0 -431
  91. package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +0 -99
  92. package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +0 -25
  93. package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +0 -203
  94. package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +0 -104
  95. package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +0 -481
  96. package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +0 -40
  97. package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +0 -1323
  98. package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +0 -51
  99. package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +0 -736
  100. package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +0 -106
  101. package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +0 -84
  102. package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +0 -87
  103. package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +0 -34
  104. package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +0 -324
  105. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +0 -127
  106. package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +0 -18
  107. package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +0 -111
  108. package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +0 -219
  109. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +0 -1008
  110. package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +0 -882
  111. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +0 -380
  112. package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +0 -797
  113. package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +0 -1699
  114. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +0 -178
  115. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +0 -45
  116. package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +0 -126
  117. package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +0 -118
  118. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +0 -11
  119. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +0 -1201
  120. package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +0 -591
  121. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +0 -29
  122. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +0 -753
  123. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +0 -137
  124. package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +0 -438
  125. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +0 -19
  126. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +0 -10
  127. package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +0 -5
  128. package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +0 -404
  129. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +0 -525
  130. package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +0 -55
  131. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +0 -36
  132. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +0 -1055
  133. package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +0 -2085
  134. package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +0 -157
  135. package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +0 -86
  136. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +0 -3798
  137. package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +0 -412
  138. package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +0 -124
  139. package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +0 -26
  140. package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +0 -677
  141. package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +0 -484
  142. package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +0 -62
  143. package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +0 -46
  144. package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +0 -51
  145. package/src/main/ts/org/gavaghan/geodesy/Angle.ts +0 -31
  146. package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +0 -71
  147. package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +0 -200
  148. package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +0 -55
  149. package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +0 -68
  150. package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +0 -103
  151. package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +0 -90
  152. package/test/ExportSPImages.js +0 -692
  153. package/test/MPWW.html +0 -556
  154. package/test/MPWorker.js +0 -318
  155. package/test/SPWorker.js +0 -233
  156. package/test/SVGWW.html +0 -363
  157. package/test/singlePointTester3.html +0 -751
  158. package/tsconfig.json +0 -54
  159. package/typedoc.json +0 -30
  160. package/updateVersion.js +0 -21
  161. package/webpack.config.js +0 -34
  162. package/webpackn.config.js +0 -28
  163. package/webpackr.config.js +0 -47
  164. package/webpackw.config.js +0 -23
  165. /package/{dist/C5Ren.d.ts → C5Ren.d.ts} +0 -0
  166. /package/{dist/C5Ren.js → C5Ren.js} +0 -0
  167. /package/{dist/C5Ren.js.map → C5Ren.js.map} +0 -0
  168. /package/{dist/manifest.json → manifest.json} +0 -0
@@ -1,567 +0,0 @@
1
- /*
2
- * To change this template, choose Tools | Templates
3
- * and open the template in the editor.
4
- */
5
-
6
- import { type int, type double } from "../graphics2d/BasicTypes";
7
-
8
- import { AffineTransform } from "../graphics2d/AffineTransform"
9
- import { Point2D } from "../graphics2d/Point2D"
10
- import { Rectangle2D } from "../graphics2d/Rectangle2D"
11
- import { Shape } from "../graphics2d/Shape"
12
- import { Point } from "./Point";
13
- import { RectUtilities } from "../renderer/utilities/RectUtilities";
14
-
15
- /**
16
- *
17
- *
18
- */
19
- export class Rectangle implements Shape {
20
- public static readonly OUT_LEFT = 1;
21
- public static readonly OUT_TOP = 2;
22
- public static readonly OUT_RIGHT = 4;
23
- public static readonly OUT_BOTTOM = 8;
24
- public x: int = 0;
25
- public y: int = 0;
26
- public width: int = 0;
27
- public height: int = 0;
28
- public constructor();
29
- public constructor(x1: int, y1: int, width1: int, height1: int);
30
- public constructor(...args: unknown[]) {
31
-
32
- switch (args.length) {
33
- case 0: {
34
-
35
- this.x = 0;
36
- this.y = 0;
37
- this.width = 0;
38
- this.height = 0;
39
-
40
- break;
41
- }
42
-
43
- case 4: {
44
- const [x1, y1, width1, height1] = args as [int, int, int, int];
45
-
46
- this.x = x1;
47
- this.y = y1;
48
- this.width = width1;
49
- this.height = height1;
50
-
51
- break;
52
- }
53
-
54
- default: {
55
- throw Error(`Invalid number of arguments`);
56
- }
57
- }
58
- }
59
-
60
- public getShapeType():string
61
- {
62
- return "RECTANGLE";
63
- }
64
- public getBounds(): Rectangle {
65
- return new Rectangle(Math.trunc(this.x),Math.trunc(this.y),Math.trunc(this.width),Math.trunc(this.height));
66
- }
67
- public getPathIterator(at: AffineTransform): null {
68
- return null;
69
- }
70
- public intersects(rect: Rectangle2D): boolean;
71
- public intersects(x1: double, y1: double, width1: double, height1: double): boolean;
72
- public intersects(...args: unknown[]): boolean {
73
- switch (args.length) {
74
- case 1: {
75
- const [rect] = args as [Rectangle2D];
76
-
77
-
78
- if (this.x + this.width < rect.x) {
79
-
80
- return false;
81
- }
82
-
83
- if (this.x > rect.x + rect.width) {
84
-
85
- return false;
86
- }
87
-
88
- if (this.y + this.height < rect.y) {
89
-
90
- return false;
91
- }
92
-
93
- if (this.y > rect.y + rect.height) {
94
-
95
- return false;
96
- }
97
-
98
-
99
- return true;
100
-
101
-
102
- break;
103
- }
104
-
105
- case 4: {
106
- const [x1, y1, width1, height1] = args as [double, double, double, double];
107
-
108
-
109
- if (this.x + this.width < x1) {
110
-
111
- return false;
112
- }
113
-
114
- if (this.x > x1 + width1) {
115
-
116
- return false;
117
- }
118
-
119
- if (this.y + this.height < y1) {
120
-
121
- return false;
122
- }
123
-
124
- if (this.y > y1 + height1) {
125
-
126
- return false;
127
- }
128
-
129
-
130
- return true;
131
-
132
-
133
- break;
134
- }
135
-
136
- default: {
137
- throw Error(`Invalid number of arguments`);
138
- }
139
- }
140
- }
141
-
142
- public contains(pt: Point2D): boolean;
143
- public contains(x1: int, y1: int): boolean;
144
- public contains(x1: int, y1: int, width1: int, height1: int): boolean;
145
- public contains(...args: unknown[]): boolean {
146
- switch (args.length) {
147
- case 1: {
148
- const [pt] = args as [Point2D];
149
-
150
-
151
- if (this.x <= pt.getX() && pt.getX() <= this.x + this.width &&
152
- this.y <= pt.getY() && pt.getY() <= this.y + this.height) {
153
-
154
- return true;
155
- }
156
-
157
- else {
158
- return false;
159
- }
160
-
161
-
162
-
163
- break;
164
- }
165
-
166
- case 2: {
167
- const [x1, y1] = args as [int, int];
168
-
169
-
170
- if (this.x <= x1 && x1 <= this.x + this.width &&
171
- this.y <= y1 && y1 <= this.y + this.height) {
172
-
173
- return true;
174
- }
175
-
176
- else {
177
- return false;
178
- }
179
-
180
-
181
-
182
- break;
183
- }
184
-
185
- case 4: {
186
- const [x1, y1, width1, height1] = args as [int, int, int, int];
187
-
188
-
189
- if (this.contains(x1, y1) && this.contains(x1 + width1, y1 + height1)) {
190
-
191
- return true;
192
- }
193
-
194
- else {
195
- return false;
196
- }
197
-
198
-
199
-
200
- break;
201
- }
202
-
203
- default: {
204
- throw Error(`Invalid number of arguments`);
205
- }
206
- }
207
- }
208
-
209
- public getBounds2D(): Rectangle2D {
210
- return new Rectangle2D(this.x, this.y, this.width, this.height);
211
- }
212
- public getX(): double {
213
- return this.x;
214
- }
215
- public getY(): int {
216
- return this.y;
217
- }
218
- public getMinX(): int {
219
- return this.x;
220
- }
221
- public getMinY(): int {
222
- return this.y;
223
- }
224
- public getMaxX(): int {
225
- return this.x + this.width;
226
- }
227
- public getMaxY(): int {
228
- return this.y + this.height;
229
- }
230
- public getHeight(): int {
231
- return this.height;
232
- }
233
- public getWidth(): int {
234
- return this.width;
235
- }
236
- getBottom():number{
237
- return this.y + this.height;
238
- };
239
-
240
- getRight():number{
241
- return this.x + this.width;
242
- };
243
-
244
- getCenterX():number{
245
- return this.x + (this.width/2);
246
- };
247
- /**
248
- *
249
- * @returns {Number}
250
- */
251
- getCenterY(){
252
- return this.y + (this.height/2);
253
- };
254
-
255
- public grow(h: int, v: int): void {
256
- this.x = this.x - h;
257
- this.y = this.y - v;
258
- this.width = this.width + (2*h);
259
- this.height = this.height + (2*v);
260
- }
261
- public setRect(rect: Rectangle): void {
262
- this.x = rect.x;
263
- this.y = rect.y;
264
- this.width = rect.width;
265
- this.height = rect.height;
266
- }
267
- /**
268
- * setLocation x,y (top,left) while maintaining the width and height.
269
- * @param x
270
- * @param y
271
- */
272
- public setLocation(x:number,y:number):void{
273
- this.x = x;
274
- this.y = y;
275
- };
276
- public isEmpty():boolean
277
- {
278
- return (this.width <= 0.0) || (this.height <= 0.0);
279
- };
280
-
281
- public shift(x:number,y:number):void
282
- {
283
- this.x += x;
284
- this.y += y;
285
- //height & width shouldn't change in a full shift of the rectangle.
286
- //this.height = this.bottom - this.y;
287
- //this.width = this.right - this.x;
288
- };
289
- /**
290
- * moves top,left points leaving bottom,right intact.
291
- * adjusts the height & width values as necessary
292
- * @param x
293
- * @param y
294
- */
295
- public shiftTL(x:number,y:number):void{
296
- let br:Point2D = new Point2D(this.x + this.width, this.y + this.height);
297
-
298
- this.x += x;
299
- this.y += y;
300
-
301
- this.height = br.getY() - this.y;
302
- this.width = br.getX() - this.x;
303
- };
304
- /**
305
- * moves bottom,right points leaving top,left intact.
306
- * adjusts the height & width values as necessary
307
- * @param {type} x the amount to move the right point by
308
- * @param {type} y the amount to move the bottom point by
309
- * @returns {_L7.Anonym$0.Rectangle.shiftTL}
310
- */
311
- public shiftBR(x:number,y:number):void{
312
- this.width += x;
313
- this.height += y;
314
- if(this.width < 0)
315
- this.width = 0;
316
- if(this.height < 0)
317
- this.height = 0;
318
- };
319
-
320
- /**
321
- * Will merge the bounds of two rectangle.
322
- * @param rect
323
- */
324
- public union(rect:Rectangle)
325
- {
326
- let br1:Point2D = new Point2D(this.x + this.width, this.y + this.height);
327
- let br2:Point2D = new Point2D(rect.x + rect.width, rect.y + rect.height);
328
- if(rect)
329
- {
330
- if(rect.y < this.y)
331
- this.y = rect.y;
332
- if(rect.x < this.x)
333
- this.x = rect.x;
334
- if(br2.getY() > br1.getY())
335
- this.height = br2.getY() - br1.getY();
336
- if(br2.getX() > br1.getX())
337
- this.width = br2.getX() - br1.getX();
338
- }
339
-
340
- }
341
-
342
- public unionPoint(point:Point){
343
- if(point)
344
- {
345
- let tl:Point = new Point(this.x,this.y);
346
- let br:Point = new Point(this.x + this.width, this.y + this.height);
347
-
348
- if(point.y < tl.y)
349
- tl.y = point.y;
350
- if(point.x < tl.x)
351
- tl.x = point.x;
352
- if(point.y > br.y)
353
- br.y = point.y;
354
- if(point.x > br.x)
355
- br.x = point.x;
356
- this.x = tl.x;
357
- this.y = tl.y;
358
- this.width = br.x - this.x;
359
- this.height = br.y - this.y;
360
- }
361
-
362
- };
363
-
364
- /**
365
- *
366
- * @param point
367
- * @returns
368
- */
369
- public containsPoint(point:Point):boolean
370
- {
371
- if(point)
372
- {
373
- var x = point.getX();
374
- var y = point.getY();
375
- var x0 = this.getX(),
376
- y0 = this.getY();
377
- return (x >= x0 &&
378
- y >= y0 &&
379
- x < x0 + this.getWidth() &&
380
- y < y0 + this.getHeight());
381
- }
382
- else
383
- return false;
384
- };
385
-
386
- public containsRectangle(rect:Rectangle):boolean
387
- {
388
- if(rect)
389
- {
390
- var x = rect.getX();
391
- var y = rect.getY();
392
- var w = rect.getWidth();
393
- var h = rect.getHeight();
394
- if (this.isEmpty() || w <= 0 || h <= 0)
395
- {
396
- return false;
397
- }
398
- var x0 = this.getX(),
399
- y0 = this.getY();
400
- return (x >= x0 &&
401
- y >= y0 &&
402
- (x + w) <= x0 + this.getWidth() &&
403
- (y + h) <= y0 + this.getHeight());
404
- }
405
- else
406
- return false;
407
- };
408
-
409
- /**
410
- * Ported from Java
411
- */
412
- private outcode(x:number, y:number)
413
- {
414
- var out = 0;
415
- if (this.width <= 0) {
416
- out |= Rectangle.OUT_LEFT | Rectangle.OUT_RIGHT;
417
- } else if (x < this.x) {
418
- out |= Rectangle.OUT_LEFT;
419
- } else if (x > this.x + this.width) {
420
- out |= Rectangle.OUT_RIGHT;
421
- }
422
- if (this.height <= 0) {
423
- out |= Rectangle.OUT_TOP | Rectangle.OUT_BOTTOM;
424
- } else if (y < this.y) {
425
- out |= Rectangle.OUT_TOP;
426
- } else if (y > this.y + this.height) {
427
- out |= Rectangle.OUT_BOTTOM;
428
- }
429
- return out;
430
- };
431
-
432
- /**
433
- * Tests if the specified line segment intersects the interior of this
434
- * <code>Rectangle</code>. Ported from java.
435
- *
436
- * @param x1 the X coordinate of the start point of the specified
437
- * line segment
438
- * @param y1 the Y coordinate of the start point of the specified
439
- * line segment
440
- * @param x2 the X coordinate of the end point of the specified
441
- * line segment
442
- * @param y2 the Y coordinate of the end point of the specified
443
- * line segment
444
- * @return <code>true</code> if the specified line segment intersects
445
- * the interior of this <code>Rectangle</code>; <code>false</code>
446
- * otherwise.
447
- */
448
- public intersectsLine(x1: number, y1: number, x2: number, y2: number):boolean
449
- {
450
- let out1: number = 0;
451
- let out2: number = 0;
452
- if ((out2 = this.outcode(x2, y2)) === 0) {
453
- return true;
454
- }
455
- while ((out1 = this.outcode(x1, y1)) !== 0) {
456
- if ((out1 & out2) !== 0) {
457
- return false;
458
- }
459
- if ((out1 & (Rectangle.OUT_LEFT | Rectangle.OUT_RIGHT)) !== 0) {
460
- var x = this.getX();
461
- if ((out1 & Rectangle.OUT_RIGHT) !== 0) {
462
- x += this.getWidth();
463
- }
464
- y1 = y1 + (x - x1) * (y2 - y1) / (x2 - x1);
465
- x1 = x;
466
- } else {
467
- var y = this.getY();
468
- if ((out1 & Rectangle.OUT_BOTTOM) !== 0) {
469
- y += this.getHeight();
470
- }
471
- x1 = x1 + (y - y1) * (x2 - x1) / (y2 - y1);
472
- y1 = y;
473
- }
474
- }
475
- return true;
476
- };
477
-
478
- // </editor-fold>
479
-
480
- public setPath(context:OffscreenCanvasRenderingContext2D)
481
- {
482
- var x = this.getX(),
483
- y = this.getY(),
484
- w = this.getWidth(),
485
- h = this.getHeight();
486
-
487
- //context.beginPath();
488
- context.moveTo(x, y);
489
- context.lineTo(x + w,y);
490
- context.lineTo(x + w,y + h);
491
- context.lineTo(x,y + h);
492
- context.closePath();
493
-
494
- };
495
- public stroke(context:OffscreenCanvasRenderingContext2D){
496
- context.strokeRect(this.getX(),this.getY(),this.getWidth(),this.getHeight());
497
- };
498
- public fill(context:OffscreenCanvasRenderingContext2D){
499
- context.fillRect(this.getX(),this.getY(),this.getWidth(),this.getHeight());
500
- };
501
- public clone():Rectangle{
502
- return new Rectangle(this.x,this.y,this.width,this.height);
503
- };
504
-
505
- /**
506
- * ported from java
507
- */
508
- /*intersects(r:Rectangle):boolean
509
- {
510
- if(r)
511
- {
512
- var tw = this.width;
513
- var th = this.height;
514
- var rw = r.width;
515
- var rh = r.height;
516
- if (rw <= 0 || rh <= 0 || tw <= 0 || th <= 0) {
517
- return false;
518
- }
519
- var tx = this.x;
520
- var ty = this.y;
521
- var rx = r.x;
522
- var ry = r.y;
523
- rw += rx;
524
- rh += ry;
525
- tw += tx;
526
- th += ty;
527
- // overflow || intersect
528
- return ((rw < rx || rw > tx) &&
529
- (rh < ry || rh > ty) &&
530
- (tw < tx || tw > rx) &&
531
- (th < ty || th > ry));
532
- }
533
- else
534
- return false;
535
-
536
- };//*/
537
-
538
- /**
539
- *
540
- * @param stroke named color or value of rgb(#,#,#)
541
- * @param strokeWidth width of line in # of pixels
542
- * @param fill named color or value of rgb(#,#,#)
543
- * @returns
544
- */
545
- public toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null):string
546
- {
547
- var line = '<rect x="' + this.x + '" y="' + this.y;
548
- line += '" width="' + this.width + '" height="' + this.height + '"';
549
-
550
- if(strokeWidth)
551
- line += ' stroke-width="' + strokeWidth + '"';
552
- else if(stroke)
553
- line += ' stroke-width="2"';
554
-
555
- if(stroke)
556
- line += ' stroke="' + stroke + '"';
557
-
558
- if(fill)
559
- line += ' fill="' + fill + '"';
560
- else
561
- line += ' fill="none"';
562
-
563
- line += '/>';
564
- return line;
565
- }
566
-
567
- }