@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,120 +0,0 @@
1
- import { Point2D } from "../../graphics2d/Point2D";
2
-
3
- export class Point{
4
- public x = 0;
5
- public y = 0;
6
-
7
- /**
8
- *
9
- * @param x
10
- * @param y
11
- */
12
- constructor(x:number,y:number)
13
- {
14
- this.x = x;
15
- this.y = y;
16
- };
17
- /**
18
- * Returns a string representing one of the shape types
19
- * from "armyc2.c2sd.renderer.so.ShapeTypes"
20
- * @returns {String}
21
- */
22
- public getShapeType():string
23
- {
24
- return "POINT";//armyc2.c2sd.renderer.so.ShapeTypes.POINT;
25
- };
26
- /**
27
- *
28
- * @returns {Number}
29
- */
30
- public getX():number
31
- {
32
- return this.x;
33
- };
34
- /**
35
- *
36
- * @returns {Number}
37
- */
38
- public getY():number
39
- {
40
- return this.y;
41
- };
42
- /**
43
- * Reset the x & y of this point object.
44
- * @param {Number} x
45
- * @param {Number} y
46
- * @returns {void}
47
- */
48
- public setLocation(x:number,y:number): void
49
- {
50
- this.x = x;
51
- this.y = y;
52
- };
53
- /**
54
- * move x & y by specified amounts.
55
- * @param {Number} x shift x point by this value
56
- * @param {Number} y shift y point by this value
57
- * @returns {void}
58
- */
59
- public shift(x:number,y:number): void
60
- {
61
- this.x += x;
62
- this.y += y;
63
- };
64
- /**
65
- * @returns {String} like "{x:#,y:#}"
66
- */
67
- public toStringFormatted(): string
68
- {
69
- return "{x:" + this.x + ", y:" + this.y + "}";
70
- };
71
- /**
72
- * Makes a copy of this point object.
73
- * @returns {armyc2.c2sd.renderer.so.Point} Copy of original point.
74
- */
75
- public clone():Point
76
- {
77
- return new Point(this.x,this.y);
78
- };
79
- /**
80
- * @param {CanvasRenderingContext2D} context object from html5 canvas
81
- * @returns {void}
82
- */
83
- public setPath(context:CanvasRenderingContext2D): void
84
- {
85
- let x = this.x;
86
- let y = this.y;
87
-
88
- //context.beginPath();
89
- context.moveTo(x, y);
90
- context.lineTo(x + 1,y);
91
- context.lineTo(x + 1,y + 1);
92
- context.lineTo(x,y + 1);
93
- context.closePath();
94
-
95
- };
96
- /**
97
- * @param {context} context object from html5 canvas
98
- * @returns {void}
99
- */
100
- public stroke(context:CanvasRenderingContext2D): void{
101
- context.beginPath();
102
- this.setPath(context);
103
- context.stroke();
104
- };
105
- /**
106
- * @param {context} context object from html5 canvas
107
- * @returns {void}
108
- */
109
- public fill(context:CanvasRenderingContext2D): void{
110
- context.beginPath();
111
- this.setPath(context);
112
- context.fill();
113
- };
114
-
115
- public toPoint2D()
116
- {
117
- return new Point2D(this.x,this.y);
118
- }
119
-
120
- }
@@ -1,431 +0,0 @@
1
- import { Rectangle2D } from "../../graphics2d/Rectangle2D";
2
- import { Point } from "./point";
3
- import { ShapeTypes } from "./types";
4
-
5
- export class Rectangle
6
- {
7
-
8
- private x:number;
9
- private y:number;
10
- private width:number;
11
- private height:number;
12
- private bottom:number;
13
- private right:number;
14
-
15
- public static readonly OUT_LEFT = 1;
16
- public static readonly OUT_TOP = 2;
17
- public static readonly OUT_RIGHT = 4;
18
- public static readonly OUT_BOTTOM = 8;
19
-
20
- constructor(x:number,y:number,width:number,height:number)
21
- {
22
- this.x = x,
23
- this.y = y,
24
- this.width = width,
25
- this.height = height,
26
- this.bottom = y + height,
27
- this.right = x + width;
28
- }
29
- // <editor-fold defaultstate="collapsed" desc="Public Property Functions">
30
-
31
- public getShapeType():string
32
- {
33
- return ShapeTypes.RECTANGLE;
34
- }
35
-
36
- public getBounds():Rectangle
37
- {
38
- return new Rectangle(this.x-1,
39
- this.y-1,
40
- this.width+2,
41
- this.height+2);
42
- };
43
-
44
- public toRectangle2D():Rectangle2D
45
- {
46
- return new Rectangle2D(this.x,
47
- this.y,
48
- this.width,
49
- this.height);
50
- }
51
-
52
- public getX():number
53
- {
54
- return this.x;
55
- };
56
-
57
- public getY():number{
58
- return this.y;
59
- };
60
-
61
- public getWidth():number{
62
- return this.width;
63
- };
64
-
65
- public getHeight():number{
66
- return this.height;
67
- };
68
-
69
- public getBottom():number{
70
- return this.bottom;
71
- };
72
-
73
- public getRight():number{
74
- return this.right;
75
- };
76
-
77
- public getCenterX():number{
78
- return this.x + (this.width/2);
79
- };
80
- /**
81
- *
82
- * @returns {Number}
83
- */
84
- public getCenterY(){
85
- return this.y + (this.height/2);
86
- };
87
-
88
- /**
89
- * setLocation x,y (top,left) while maintaining the width and height.
90
- * @param x
91
- * @param y
92
- */
93
- public setLocation(x:number,y:number):void{
94
- this.x = x;
95
- this.y = y;
96
- this.bottom = y + this.height;
97
- this.right = x + this.width;
98
- };
99
-
100
- public isEmpty():boolean
101
- {
102
- return (this.width <= 0.0) || (this.height <= 0.0);
103
- };
104
-
105
- // </editor-fold>
106
-
107
- // <editor-fold defaultstate="collapsed" desc="Public Utility Functions">
108
-
109
- public shift(x:number,y:number):void
110
- {
111
- this.x += x;
112
- this.y += y;
113
- this.right += x;
114
- this.bottom +=y;
115
- //height & width shouldn't change in a full shift of the rectangle.
116
- //this.height = this.bottom - this.y;
117
- //this.width = this.right - this.x;
118
- };
119
- /**
120
- * moves top,left points leaving bottom,right intact.
121
- * adjusts the height & width values as necessary
122
- * @param x
123
- * @param y
124
- */
125
- public shiftTL(x:number,y:number):void{
126
- this.x += x;
127
- this.y += y;
128
- this.height = this.bottom - this.y;
129
- this.width = this.right - this.x;
130
- };
131
- /**
132
- * moves bottom,right points leaving top,left intact.
133
- * adjusts the height & width values as necessary
134
- * @param {type} x the amount to move the right point by
135
- * @param {type} y the amount to move the bottom point by
136
- * @returns {_L7.Anonym$0.Rectangle.shiftTL}
137
- */
138
- public shiftBR(x:number,y:number):void{
139
- this.right += x;
140
- this.bottom += y;
141
- this.height = this.bottom - this.y;
142
- this.width = this.right - this.x;
143
- };
144
-
145
- /**
146
- * Grow the rectangle by this many pixels in every direction
147
- * @param pixel
148
- */
149
- public grow (pixel:number){
150
- this.shiftTL(-pixel,-pixel);
151
- this.shiftBR(pixel,pixel);
152
- };
153
-
154
- /**
155
- * Will merge the bounds of two rectangle.
156
- * @param rect
157
- */
158
- public union(rect:Rectangle){
159
- if(rect)
160
- {
161
- if(rect.y < this.y)
162
- this.y = rect.y;
163
- if(rect.x < this.x)
164
- this.x = rect.x;
165
- if(rect.bottom > this.bottom)
166
- this.bottom = rect.bottom;
167
- if(rect.right > this.right)
168
- this.right = rect.right;
169
- this.width = this.right - this.x;
170
- this.height = this.bottom - this.y;
171
- }
172
-
173
- }
174
-
175
- public unionPoint(point:Point){
176
- if(point)
177
- {
178
- if(point.y < this.y)
179
- this.y = point.y;
180
- if(point.x < this.x)
181
- this.x = point.x;
182
- if(point.y > this.bottom)
183
- this.bottom = point.y;
184
- if(point.x > this.right)
185
- this.right = point.x;
186
- this.width = this.right - this.x;
187
- this.height = this.bottom - this.y;
188
- }
189
-
190
- };
191
-
192
- /**
193
- * if 2 values passed in, they are assumed to be the x,y of a point.
194
- * if 4 values passed in, they are assumed to be the x,y,w,h values
195
- * of a Rectangle.
196
- * @param x
197
- * @param y
198
- * @param w
199
- * @param h
200
- * @returns
201
- */
202
- public contains(x:number,y:number,w?:number,h?:number)
203
- {
204
- if(x && y && w && h)
205
- {
206
- if (this.isEmpty() || w <= 0 || h <= 0) {
207
- return false;
208
- }
209
- var x0 = this.getX(),
210
- y0 = this.getY();
211
- return (x >= x0 &&
212
- y >= y0 &&
213
- (x + w) <= x0 + this.getWidth() &&
214
- (y + h) <= y0 + this.getHeight());
215
- }
216
- else if(x && y)
217
- {
218
- var x0 = this.getX(),
219
- y0 = this.getY();
220
- return (x >= x0 &&
221
- y >= y0 &&
222
- x < x0 + this.getWidth() &&
223
- y < y0 + this.getHeight());
224
- }
225
- else
226
- return false;
227
- };
228
-
229
- /**
230
- *
231
- * @param point
232
- * @returns
233
- */
234
- public containsPoint(point:Point):boolean
235
- {
236
- if(point)
237
- {
238
- var x = point.getX();
239
- var y = point.getY();
240
- var x0 = this.getX(),
241
- y0 = this.getY();
242
- return (x >= x0 &&
243
- y >= y0 &&
244
- x < x0 + this.getWidth() &&
245
- y < y0 + this.getHeight());
246
- }
247
- else
248
- return false;
249
- };
250
-
251
- public containsRectangle(rect:Rectangle):boolean
252
- {
253
- if(rect)
254
- {
255
- var x = rect.getX();
256
- var y = rect.getY();
257
- var w = rect.getWidth();
258
- var h = rect.getHeight();
259
- if (this.isEmpty() || w <= 0 || h <= 0)
260
- {
261
- return false;
262
- }
263
- var x0 = this.getX(),
264
- y0 = this.getY();
265
- return (x >= x0 &&
266
- y >= y0 &&
267
- (x + w) <= x0 + this.getWidth() &&
268
- (y + h) <= y0 + this.getHeight());
269
- }
270
- else
271
- return false;
272
- };
273
-
274
- /**
275
- * Ported from Java
276
- */
277
- private outcode(x:number, y:number)
278
- {
279
- var out = 0;
280
- if (this.width <= 0) {
281
- out |= Rectangle.OUT_LEFT | Rectangle.OUT_RIGHT;
282
- } else if (x < this.x) {
283
- out |= Rectangle.OUT_LEFT;
284
- } else if (x > this.x + this.width) {
285
- out |= Rectangle.OUT_RIGHT;
286
- }
287
- if (this.height <= 0) {
288
- out |= Rectangle.OUT_TOP | Rectangle.OUT_BOTTOM;
289
- } else if (y < this.y) {
290
- out |= Rectangle.OUT_TOP;
291
- } else if (y > this.y + this.height) {
292
- out |= Rectangle.OUT_BOTTOM;
293
- }
294
- return out;
295
- };
296
-
297
- /**
298
- * Tests if the specified line segment intersects the interior of this
299
- * <code>Rectangle</code>. Ported from java.
300
- *
301
- * @param x1 the X coordinate of the start point of the specified
302
- * line segment
303
- * @param y1 the Y coordinate of the start point of the specified
304
- * line segment
305
- * @param x2 the X coordinate of the end point of the specified
306
- * line segment
307
- * @param y2 the Y coordinate of the end point of the specified
308
- * line segment
309
- * @return <code>true</code> if the specified line segment intersects
310
- * the interior of this <code>Rectangle</code>; <code>false</code>
311
- * otherwise.
312
- */
313
- public intersectsLine(x1: number, y1: number, x2: number, y2: number):boolean
314
- {
315
- let out1: number = 0;
316
- let out2: number = 0;
317
- if ((out2 = this.outcode(x2, y2)) === 0) {
318
- return true;
319
- }
320
- while ((out1 = this.outcode(x1, y1)) !== 0) {
321
- if ((out1 & out2) !== 0) {
322
- return false;
323
- }
324
- if ((out1 & (Rectangle.OUT_LEFT | Rectangle.OUT_RIGHT)) !== 0) {
325
- var x = this.getX();
326
- if ((out1 & Rectangle.OUT_RIGHT) !== 0) {
327
- x += this.getWidth();
328
- }
329
- y1 = y1 + (x - x1) * (y2 - y1) / (x2 - x1);
330
- x1 = x;
331
- } else {
332
- var y = this.getY();
333
- if ((out1 & Rectangle.OUT_BOTTOM) !== 0) {
334
- y += this.getHeight();
335
- }
336
- x1 = x1 + (y - y1) * (x2 - x1) / (y2 - y1);
337
- y1 = y;
338
- }
339
- }
340
- return true;
341
- };
342
-
343
- // </editor-fold>
344
-
345
- public setPath(context:OffscreenCanvasRenderingContext2D | any)
346
- {
347
- var x = this.getX(),
348
- y = this.getY(),
349
- w = this.getWidth(),
350
- h = this.getHeight();
351
-
352
- //context.beginPath();
353
- context.moveTo(x, y);
354
- context.lineTo(x + w,y);
355
- context.lineTo(x + w,y + h);
356
- context.lineTo(x,y + h);
357
- context.closePath();
358
-
359
- };
360
- public stroke(context:OffscreenCanvasRenderingContext2D){
361
- context.strokeRect(this.getX(),this.getY(),this.getWidth(),this.getHeight());
362
- };
363
- public fill(context:OffscreenCanvasRenderingContext2D){
364
- context.fillRect(this.getX(),this.getY(),this.getWidth(),this.getHeight());
365
- };
366
- public clone():Rectangle{
367
- return new Rectangle(this.x,this.y,this.width,this.height);
368
- };
369
-
370
- /**
371
- * ported from java
372
- */
373
- public intersects(r:Rectangle):boolean
374
- {
375
- if(r)
376
- {
377
- var tw = this.width;
378
- var th = this.height;
379
- var rw = r.width;
380
- var rh = r.height;
381
- if (rw <= 0 || rh <= 0 || tw <= 0 || th <= 0) {
382
- return false;
383
- }
384
- var tx = this.x;
385
- var ty = this.y;
386
- var rx = r.x;
387
- var ry = r.y;
388
- rw += rx;
389
- rh += ry;
390
- tw += tx;
391
- th += ty;
392
- // overflow || intersect
393
- return ((rw < rx || rw > tx) &&
394
- (rh < ry || rh > ty) &&
395
- (tw < tx || tw > rx) &&
396
- (th < ty || th > ry));
397
- }
398
- else
399
- return false;
400
-
401
- };//*/
402
-
403
- /**
404
- *
405
- * @param stroke named color or value of rgb(#,#,#)
406
- * @param strokeWidth width of line in # of pixels
407
- * @param fill named color or value of rgb(#,#,#)
408
- * @returns
409
- */
410
- public toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null):string
411
- {
412
- var line = '<rect x="' + this.x + '" y="' + this.y;
413
- line += '" width="' + this.width + '" height="' + this.height + '"';
414
-
415
- if(strokeWidth)
416
- line += ' stroke-width="' + strokeWidth + '"';
417
- else if(stroke)
418
- line += ' stroke-width="2"';
419
-
420
- if(stroke)
421
- line += ' stroke="' + stroke + '"';
422
-
423
- if(fill)
424
- line += ' fill="' + fill + '"';
425
- else
426
- line += ' fill="none"';
427
-
428
- line += '/>';
429
- return line;
430
- }
431
- }
@@ -1,99 +0,0 @@
1
- import { Rectangle } from "./rectangle";
2
-
3
- export class RoundedRectangle
4
- {
5
- private radius:number;
6
- private rectangle:Rectangle
7
-
8
- constructor(x,y,w,h,radius)
9
- {
10
-
11
- this.radius = radius;
12
-
13
- this.rectangle = new Rectangle(x,y,w,h);
14
-
15
- }
16
-
17
- /**
18
- *
19
- */
20
- getShapeType():string{
21
- return "ROUNDED_RECTANGLE";//ShapeTypes.ROUNDED_RECTANGLE;
22
- };
23
-
24
- /**
25
- *
26
- */
27
- getBounds():Rectangle
28
- {
29
- return new Rectangle(this.rectangle.getX()-1,
30
- this.rectangle.getY()-1,
31
- this.rectangle.getWidth()+2,
32
- this.rectangle.getHeight()+2);
33
- };
34
-
35
- shift(x:number,y:number)
36
- {
37
- this.rectangle.shift(x,y);
38
- };
39
-
40
- setPath(context:CanvasRenderingContext2D){
41
- var x = this.rectangle.getX(),
42
- y = this.rectangle.getY(),
43
- w = this.rectangle.getWidth(),
44
- h = this.rectangle.getHeight();
45
- if(w < (2 * this.radius))
46
- this.radius = w/2;
47
- if(h < (2 * this.radius))
48
- this.radius = h/2;
49
- var r = this.radius;
50
-
51
- //context.beginPath();
52
- context.moveTo(x + r, y);
53
- context.lineTo(x + w -r,y);
54
- context.arcTo(x + w, y, x + w, y+r, r);
55
- context.lineTo(x + w,y + h - r);
56
- context.arcTo(x + w, y+h, x+w-r, y + h, r);
57
- context.lineTo(x + r,y + h);
58
- context.arcTo(x, y+h, x, y+h-r, r);
59
- context.lineTo(x,y + r);
60
- context.arcTo(x, y, x + r, y, r);
61
-
62
- };
63
-
64
- stroke(context:CanvasRenderingContext2D){
65
- context.beginPath();
66
- this.setPath(context);
67
- context.stroke();
68
- };
69
-
70
- fill(context:CanvasRenderingContext2D){
71
- context.beginPath();
72
- this.setPath(context);
73
- context.fill();
74
- };
75
-
76
- toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null):string
77
- {
78
- var line = '<rect x="' + this.rectangle.getX() + '" y="' + this.rectangle.getY();
79
- line += '" rx="' + this.radius + '" ry="' + this.radius;
80
- line += '" width="' + this.rectangle.getWidth() + '" height="' + this.rectangle.getHeight() + '"';
81
-
82
- if(strokeWidth)
83
- line += ' stroke-width="' + strokeWidth + '"';
84
- else if(stroke)
85
- line += ' stroke-width="2"';
86
-
87
- if(stroke)
88
- line += ' stroke="' + stroke + '"';
89
-
90
- if(fill)
91
- line += ' fill="' + fill + '"';
92
- else
93
- line += ' fill="none"';
94
-
95
- line += '/>';
96
- return line;
97
- }
98
-
99
- }
@@ -1,25 +0,0 @@
1
- export class ShapeTypes{
2
- public static readonly RECTANGLE = "RECTANGLE";
3
- public static readonly POINT = "POINT";
4
- public static readonly ELLIPSE = "ELLIPSE";
5
- public static readonly ROUNDED_RECTANGLE = "ROUNDED_RECTANGLE";
6
- public static readonly LINE = "LINE";
7
- public static readonly BCURVE = "BCURVE";
8
- public static readonly ARC = "ARC";
9
- public static readonly PATH = "PATH";
10
- }
11
-
12
- export class ActionTypes{
13
- public static readonly ACTION_MOVE_TO = 0;
14
- public static readonly ACTION_LINE_TO = 1;
15
- public static readonly ACTION_CURVE_TO = 2;//cubic bezier cirve
16
- public static readonly ACTION_QUAD_TO = 3;//quadratic bezier curve
17
- public static readonly ACTION_ARC_TO = 4;
18
- public static readonly ACTION_ARC = 5;
19
- public static readonly ACTION_DASHED_LINE_TO = 6;
20
- }
21
-
22
-
23
-
24
-
25
-