@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,555 +0,0 @@
1
- import { PathIterator } from "./pathiterator";
2
- import { Point } from "./point";
3
- import { Rectangle } from "./rectangle";
4
- import { ActionTypes, ShapeTypes } from "./types";
5
-
6
- export class Path
7
- {
8
- private _actions:Array<Array<any>> = [];
9
- private _dashArray:string|null = null;
10
- private _startPoint:Point|null=null;
11
- private _endPoint:Point|null=null;
12
- private _lastMoveTo:Point|null = null;
13
- private _rectangle:Rectangle|null = null;
14
- private _method:String|null = null;//stroke,fill,fillPattern
15
-
16
- /**
17
- * @return {ShapeTypes} ShapeTypes.Path
18
- */
19
- getShapeType()
20
- {
21
- return ShapeTypes.PATH;
22
- }
23
-
24
- setLineDash(dashArray:string)
25
- {
26
- this._dashArray = dashArray;
27
- }
28
-
29
-
30
- getBounds():Rectangle
31
- {
32
- if(this._rectangle)
33
- {
34
- return new Rectangle(this._rectangle.getX(),
35
- this._rectangle.getY(),
36
- this._rectangle.getWidth(),
37
- this._rectangle.getHeight());
38
- }
39
- else
40
- {
41
- return null;
42
- }
43
- };
44
-
45
- shift(x:number,y:number)
46
- {
47
- var size = this._actions.length;
48
- var temp = null;
49
- this._rectangle.shift(x,y);
50
-
51
- for(var i=0; i<size;i++)
52
- {
53
- temp = this._actions[i];
54
- if(temp[0]===ActionTypes.ACTION_MOVE_TO)
55
- {
56
- temp[1] = temp[1] + x;
57
- temp[2] = temp[2] + y;
58
- }
59
- else if(temp[0]===ActionTypes.ACTION_LINE_TO)
60
- {
61
- temp[1] = temp[1] + x;
62
- temp[2] = temp[2] + y;
63
- }
64
- else if(temp[0]===ActionTypes.ACTION_CURVE_TO)
65
- {
66
- temp[1] = temp[1] + x;
67
- temp[2] = temp[2] + y;
68
- temp[3] = temp[3] + x;
69
- temp[4] = temp[4] + y;
70
- temp[5] = temp[5] + x;
71
- temp[6] = temp[6] + y;
72
- }
73
- else if(temp[0]===ActionTypes.ACTION_QUAD_TO)
74
- {
75
- temp[1] = temp[1] + x;
76
- temp[2] = temp[2] + y;
77
- temp[3] = temp[3] + x;
78
- temp[4] = temp[4] + y;
79
- }
80
- else if(temp[0]===ActionTypes.ACTION_ARC_TO)
81
- {
82
- temp[1] = temp[1] + x;
83
- temp[2] = temp[2] + y;
84
- temp[3] = temp[3] + x;
85
- temp[4] = temp[4] + y;
86
- }
87
- else if(temp[0]===ActionTypes.ACTION_ARC)
88
- {
89
- temp[1] = temp[1] + x;
90
- temp[2] = temp[2] + y;
91
- }
92
- }
93
- this._startPoint.shift(x,y);
94
- this._endPoint.shift(x,y);
95
- this._lastMoveTo.shift(x,y);
96
- }
97
-
98
- /**
99
- * The number of this._actions on the path
100
- */
101
- getLength()
102
- {
103
- this._actions.length;
104
- };
105
-
106
- /**
107
- * Adds a point to the path by moving to the specified coordinates specified
108
- * @param x
109
- * @param y
110
- */
111
- moveTo(x:number,y:number)
112
- {
113
-
114
- if(this._actions.length === 0)
115
- {
116
- this._rectangle = new Rectangle(x,y,1,1);
117
- this._startPoint = new Point(x,y);
118
- this._endPoint = new Point(x,y);
119
- //curr_startPoint = new armyc2.c2sd.renderer.Point(x,y);
120
- //curr_endPoint = new armyc2.c2sd.renderer.Point(x,y);
121
- }
122
- this._rectangle.unionPoint(new Point(x,y));
123
- this._actions.push([ActionTypes.ACTION_MOVE_TO,x,y]);
124
- this._lastMoveTo = new Point(x,y);
125
- this._endPoint = new Point(x,y);
126
- };
127
- /**
128
- * Adds a point to the path by drawing a straight line from the current
129
- * coordinates to the new specified coordinates specified
130
- * @param x
131
- * @param y
132
- */
133
- lineTo(x:number,y:number){
134
-
135
- if(this._actions.length === 0)
136
- {
137
- this.moveTo(0,0);
138
- }
139
- this._actions.push([ActionTypes.ACTION_LINE_TO,x,y]);
140
- this._rectangle.unionPoint(new Point(x,y));
141
- this._endPoint = new Point(x,y);
142
- };
143
-
144
- /**
145
- * Adds a point to the path by drawing a straight line from the current
146
- * coordinates to the new specified coordinates specified
147
- * @param x
148
- * @param y
149
- * @param pattern
150
- */
151
- dashedLineTo(x:number,y:number,pattern:Array<number>){
152
-
153
- if(this._actions.length === 0)
154
- {
155
- this.moveTo(0,0);
156
- }
157
- var start = this.getCurrentPoint();
158
- this._actions.push([ActionTypes.ACTION_DASHED_LINE_TO,start.getX(),start.getY(), x, y, pattern]);
159
- this._rectangle.unionPoint(new Point(x,y));
160
- this._endPoint = new Point(x,y);
161
- };
162
-
163
- /**
164
- * Adds a curved segment, defined by three new points, to the path by
165
- * drawing a Bézier curve that intersects both the current coordinates
166
- * and the specified coordinates (x,y), using the specified points
167
- * (cp1x,xp1y) and (cp2x,cp2y) as Bézier control points.
168
- * @param cp1x
169
- * @param cp1y
170
- * @param cp2x
171
- * @param cp2y
172
- * @param x
173
- * @param y
174
- */
175
- bezierCurveTo(cp1x:number, cp1y:number, cp2x:number, cp2y:number,x:number,y:number){
176
-
177
- if(this._actions.length === 0)
178
- {
179
- this.moveTo(0,0);
180
- }
181
- this._actions.push([ActionTypes.ACTION_CURVE_TO,cp1x,cp1y,cp2x,cp2y,x,y]);
182
- this._rectangle.unionPoint(new Point(cp1x,cp1y));
183
- this._rectangle.unionPoint(new Point(cp2x,cp2y));
184
- this._rectangle.unionPoint(new Point(x,y));
185
- this._endPoint = new Point(x,y);
186
- };
187
- /**
188
- * Adds a curved segment, defined by two new points, to the path by
189
- * drawing a Quadratic curve that intersects both the current
190
- * coordinates and the specified coordinates (x,y), using the
191
- * specified point (cpx,cpy) as a quadratic parametric control point.
192
- * @param cpx
193
- * @param cpy
194
- * @param x
195
- * @param y
196
- * @returns
197
- */
198
- quadraticCurveTo(cpx:number,cpy:number,x:number,y:number){
199
-
200
- if(this._actions.length === 0)
201
- {
202
- this.moveTo(0,0);
203
- }
204
- this._actions.push([ActionTypes.ACTION_QUAD_TO,cpx,cpy,x,y]);
205
- this._rectangle.unionPoint(new Point(cpx,cpy));
206
- this._rectangle.unionPoint(new Point(x,y));
207
- this._endPoint = new Point(x,y);
208
- };
209
- /**
210
- * The arcTo() method creates an arc/curve between two tangents on the canvas.
211
- * @param x1 The x-coordinate of the beginning of the arc
212
- * @param y1 The y-coordinate of the beginning of the arc
213
- * @param x2 The x-coordinate of the end of the arc
214
- * @param y2 The y-coordinate of the end of the arc
215
- * @param r The radius of the arc
216
- * @returns
217
- */
218
- arcTo(x1:number,y1:number,x2:number,y2:number,r:number){
219
-
220
- if(this._actions.length === 0)
221
- {
222
- this.moveTo(0,0);
223
- }
224
- this._actions.push([ActionTypes.ACTION_ARC_TO,x1,y1,x2,y2]);
225
- this._rectangle.unionPoint(new Point(x1,y1));
226
- this._rectangle.unionPoint(new Point(x2,y2));
227
- this._endPoint = new Point(x2,y2);
228
- };
229
- /**
230
- * The arc() method creates an arc/curve
231
- * (use to create circles. or parts of circles).
232
- * @param x The x-coordinate of the center of the circle
233
- * @param y The y-coordinate of the center of the circle
234
- * @param r The radius of the circle
235
- * @param sAngle The starting angle, in degrees
236
- * (0 is at the 3 -'clock position of the arc's circle)
237
- * @param eAngle The ending angle, in degrees
238
- * @param counterclockwise Optional. Specifies wheter the drawing
239
- * should be counterclockwise or clockwise. False=clockwise,
240
- * true=counter-clockwise;
241
- * @returns
242
- */
243
- arc(x:number,y:number,r:number,sAngle:number,eAngle:number,counterclockwise:boolean){
244
-
245
-
246
-
247
- if(counterclockwise !== true)
248
- {
249
- counterclockwise = false;
250
- }
251
-
252
- //degrees to radians
253
- var sa = sAngle * (Math.PI / 180),
254
- ea = eAngle * (Math.PI / 180);
255
-
256
-
257
- if(this._startPoint===null)
258
- {
259
- var sX = r * Math.cos(sa) + x;
260
- var sY = r * Math.sin(sa) + y;
261
- this._startPoint = new Point(sX,sY);
262
- this._rectangle = new Rectangle(sX,sY,1,1);
263
- }
264
-
265
-
266
- this._actions.push([ActionTypes.ACTION_ARC,x,y,r,sa,ea,counterclockwise]);
267
- this._rectangle.union(new Rectangle(x-r,y-r,r*2,r*2));
268
-
269
- var newX = r * Math.cos(ea) + x;
270
- var newY = r * Math.sin(ea) + y;
271
- this._endPoint = new Point(newX,newY);
272
- this.moveTo(newX,newY);
273
-
274
- };
275
- /**
276
- * Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo.
277
- * @return
278
- */
279
- closePath(){
280
- this.lineTo(this._lastMoveTo.getX(),this._lastMoveTo.getY());
281
- this._endPoint = this._lastMoveTo.clone();
282
- };
283
- /**
284
- * @return Point
285
- */
286
- getCurrentPoint()
287
- {
288
- return this._endPoint.clone();
289
- };
290
- /**
291
- * @return PathIterator
292
- */
293
- getPathIterator()
294
- {
295
- return new PathIterator(this._actions);
296
- };
297
- /**
298
- * Apply the path to the passed context (doesn't draw)
299
- * @param context
300
- * @return
301
- */
302
- private setPath(context:OffscreenCanvasRenderingContext2D | any){
303
-
304
- //context.beginPath();
305
- var size = this._actions.length;
306
- var temp = null;
307
-
308
- for(var i=0; i<size;i++)
309
- {
310
- temp = this._actions[i];
311
-
312
-
313
- if(temp[0]===ActionTypes.ACTION_MOVE_TO)
314
- {
315
- //context.moveTo(temp[1],temp[2]);
316
-
317
- if(i === 0 || this._method !== "fillPattern")
318
- {
319
- context.moveTo(temp[1],temp[2]);
320
- }
321
- else//no moves in a fill shape except maybe for the first one
322
- {
323
- context.lineTo(temp[1],temp[2]);
324
- }//*/
325
- }
326
- else if(temp[0]===ActionTypes.ACTION_LINE_TO)
327
- {
328
- context.lineTo(temp[1],temp[2]);
329
- }
330
- else if(temp[0]===ActionTypes.ACTION_DASHED_LINE_TO)
331
- {
332
- if(this._method === "stroke")
333
- {
334
- context.lineTo(temp[3],temp[4]);
335
-
336
- //function prototype exists in shape utilities class but there doesn't seem to be a need
337
- //since setLineDash exists.
338
- //context.dashedLineTo(temp[1],temp[2],temp[3],temp[4],temp[5]);
339
- }
340
- else //you don't dash a fill shape
341
- {
342
- context.lineTo(temp[3],temp[4]);
343
- }
344
- }
345
- else if(temp[0]===ActionTypes.ACTION_CURVE_TO)
346
- {
347
- context.bezierCurveTo(temp[1],temp[2],temp[3],temp[4],temp[5],temp[6]);
348
- }
349
- else if(temp[0]===ActionTypes.ACTION_QUAD_TO)
350
- {
351
- context.quadraticCurveTo(temp[1],temp[2],temp[3],temp[4]);
352
- }
353
- else if(temp[0]===ActionTypes.ACTION_ARC_TO)
354
- {
355
- context.arcTo(temp[1],temp[2],temp[3],temp[4],temp[5]);
356
- }
357
- else if(temp[0]===ActionTypes.ACTION_ARC)
358
- {
359
- context.arc(temp[1],temp[2],temp[3],temp[4],temp[5],temp[6]);
360
- }//*/
361
- }
362
-
363
- };
364
- /**
365
- * Draws the path to the passed context
366
- * @param context
367
- * @return
368
- */
369
- stroke(context:OffscreenCanvasRenderingContext2D){
370
- this._method = "stroke";
371
- if(this._dashArray)
372
- {
373
- let temp:Array<string> = this._dashArray.split(" ");
374
- let temp2:Array<number> = new Array();
375
-
376
- for(let i:number = 0; i < temp.length; i++)
377
- {
378
- temp2[i] = parseInt(temp[i]);
379
- }
380
-
381
- context.setLineDash(temp2);
382
- }
383
- context.beginPath();
384
- this.setPath(context);
385
- context.stroke();
386
- context.setLineDash([]);
387
- };
388
- /**
389
- * Fills the path on the passed context
390
- * @param context
391
- * @return
392
- */
393
- fill(context:OffscreenCanvasRenderingContext2D){
394
- this._method = "fill";
395
- context.beginPath();
396
- this.setPath(context);
397
- context.fill();
398
- };
399
-
400
- fillPattern(context:OffscreenCanvasRenderingContext2D,fillPattern:CanvasImageSource){
401
- this._method = "fillPattern";
402
- context.beginPath();
403
- this.setPath(context);
404
- let pattern:CanvasPattern = context.createPattern(fillPattern, "repeat");
405
- context.fillStyle = pattern;
406
- context.fill();
407
- };
408
-
409
- /**
410
- * Arc and ArcTo do not covert currently
411
- */
412
- toSVGElement(stroke:string | null, strokeWidth:number, fill:string | null, strokeOpacity:number=1, fillOpacity:number=1, lineCap: string | null = null, svgFormat:number=0)
413
- {
414
- var format = 1;
415
- if(svgFormat)
416
- {
417
- format = svgFormat;
418
- }
419
-
420
- //context.beginPath();
421
- var size = this._actions.length;
422
- var temp = null;
423
- var path = "";
424
-
425
- for(var i=0; i<size;i++)
426
- {
427
- temp = this._actions[i];
428
-
429
- /*if(path !== "")
430
- path += " ";*/
431
-
432
- if(temp[0]===ActionTypes.ACTION_LINE_TO)
433
- {
434
- path += "L" + temp[1] + " " + temp[2];
435
- //context.lineTo(temp[1],temp[2]);
436
- }
437
- else if(temp[0]===ActionTypes.ACTION_MOVE_TO)
438
- {
439
- //context.moveTo(temp[1],temp[2]);
440
-
441
- if(i === 0 || this._method !== "fillPattern")
442
- {
443
- path += "M" + temp[1] + " " + temp[2];
444
- //context.moveTo(temp[1],temp[2]);
445
- }
446
- else//no moves in a fill shape except maybe for the first one
447
- {
448
- path += "L" + temp[1] + " " + temp[2];
449
- //context.lineTo(temp[1],temp[2]);
450
- }//*/
451
- }
452
- else if(temp[0]===ActionTypes.ACTION_DASHED_LINE_TO)
453
- {
454
- path += "L" + temp[3] + " " + temp[4];
455
- /*if(this._method === "stroke")
456
- {
457
- context.dashedLineTo(temp[1],temp[2],temp[3],temp[4],temp[5]);
458
- }
459
- else //you don't dash a fill shape
460
- {
461
- context.lineTo(temp[3],temp[4]);
462
- }//*/
463
- }
464
- else if(temp[0]===ActionTypes.ACTION_CURVE_TO)
465
- {
466
- //C100 100 250 100 250 200
467
- path += "C" + temp[1] + " " + temp[2] + " " + temp[3] + " " + temp[4] + " " + temp[5] + " " + temp[6];
468
- //context.bezierCurveTo(temp[1],temp[2],temp[3],temp[4],temp[5],temp[6]);
469
- }
470
- else if(temp[0]===ActionTypes.ACTION_QUAD_TO)
471
- {
472
- path += "Q" + temp[1] + " " + temp[2] + " " + temp[3] + " " + temp[4];
473
- //context.quadraticCurveTo(temp[1],temp[2],temp[3],temp[4]);
474
- }
475
- else if(temp[0]===ActionTypes.ACTION_ARC_TO)
476
- {
477
- //path += "C" + temp[1] + " " + temp[2] + " " + temp[3] + " " + temp[4] + " " + temp[5];
478
- //context.arcTo(temp[1],temp[2],temp[3],temp[4],temp[5]);
479
- }
480
- else if(temp[0]===ActionTypes.ACTION_ARC)
481
- {
482
- //context.arc(temp[1],temp[2],temp[3],temp[4],temp[5],temp[6]);
483
- }//*/
484
- }
485
- //TODO: generate path svg element
486
- var line = '<path d="' + path + '"';
487
-
488
- if(stroke)
489
- {
490
- //line += ' stroke="' + stroke + '"';
491
- if(format === 2)
492
- line += ' stroke="' + stroke.replace(/#/g,"%23") + '"';//.replace(/#/g,"%23")
493
- else
494
- line += ' stroke="' + stroke + '"';
495
- /*else
496
- line += ' stroke="' + stroke.replace(/#/g,"&#35;") + '"';*/
497
-
498
- if(strokeWidth)
499
- line += ' stroke-width="' + strokeWidth + '"';
500
- else
501
- line += ' stroke-width="2"';
502
-
503
- if(strokeOpacity !== 1.0)
504
- {
505
- //stroke-opacity="0.4"
506
- line += ' stroke-opacity="' + strokeOpacity + '"';
507
- }
508
-
509
- if(lineCap != null &&
510
- (lineCap.toLowerCase()==="butt" ||
511
- lineCap.toLowerCase()==="round" ||
512
- lineCap.toLowerCase()==="square"))
513
- {
514
- line += ' stroke-linecap="' + lineCap + '"';
515
- }
516
- else
517
- line += ' stroke-linecap="round"';
518
- }
519
-
520
- if(this._dashArray != null)
521
- line += ' stroke-dasharray="' + this._dashArray + '"';
522
-
523
- if(fill)
524
- {
525
- if(fill.indexOf("url") === 0)
526
- {
527
- line += ' fill="url(#fillPattern)"';
528
- //line += ' fill="url(&#35;fillPattern)"';
529
- }
530
- else
531
- {
532
- //line += ' fill="' + fill + '"';
533
- if(format === 2)
534
- line += ' fill="' + fill.replace(/#/g,"%23") + '"';//text = text.replace(/\</g,"&gt;");
535
- else
536
- line += ' fill="' + fill + '"';//text = text.replace(/\</g,"&gt;");
537
- /*else
538
- line += ' fill="' + fill.replace(/#/g,"&#35;") + '"';//text = text.replace(/\</g,"&gt;");*/
539
-
540
- if(fillOpacity !== 1.0)
541
- {
542
- //fill-opacity="0.4"
543
- line += ' fill-opacity="' + fillOpacity + '"';
544
- }
545
- }
546
-
547
- }
548
- else
549
- line += ' fill="none"';
550
-
551
- line += ' />';
552
- return line;
553
-
554
- }
555
- }
@@ -1,62 +0,0 @@
1
- export class PathIterator
2
- {
3
-
4
- //private vars
5
- private arrActions:Array<Array<any>> = [];
6
- private size:number = 0;
7
- private index:number = 0;
8
-
9
- constructor(actions:Array<any>)
10
- {
11
- this.arrActions = actions;
12
- this.size = actions.length;
13
- }
14
- //constructor code
15
-
16
-
17
- //private functions
18
-
19
- //public vars/functions
20
- /**
21
- * Tests if the iteration is complete.
22
- *
23
- */
24
- isDone(): boolean
25
- {
26
- if(this.index === this.size)
27
- return true;
28
- return false;
29
- };
30
- /**
31
- * Moves the iterator to the next segment of the path forwards
32
- * along the primary direction of traversal as long as there are
33
- * more points in that direction.
34
- */
35
- next()
36
- {
37
- this.index++;
38
- };
39
- /**
40
- * Returns the coordinates and type of the current path segment in
41
- * the iteration.
42
- * The return value is the path-segment type:
43
- * MOVE_TO, LINE_TO, QUAD_TO, CURVE_TO, or CLOSE.
44
- * A float array of length 6 must be passed in and can be used to
45
- * store the coordinates of the point(s).
46
- * Each point is stored as a pair of float x,y coordinates.
47
- * MOVE_TO and LINE_TO types returns one point,
48
- * QUAD_TO returns two points,
49
- * CURVE_TO returns 3 points.
50
- * ARC_TO
51
- * ARC
52
- * CLOSE will never get returned as it is replace with LINE_TO.
53
- * @return the path-segment where the first index is the segment type.
54
- * @see ActionTypes
55
- */
56
- currentSegment()
57
- {
58
- return this.arrActions[this.index];
59
- }
60
-
61
-
62
- }