@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,404 @@
1
+ import { type int } from "../../graphics2d/BasicTypes";
2
+
3
+ import { Font } from "../../graphics2d/Font"
4
+ import { FontRenderContext } from "../../graphics2d/FontRenderContext"
5
+ import { PathIterator } from "../../graphics2d/PathIterator"
6
+ import { IPathIterator } from "../../graphics2d/IPathIterator"
7
+ import { Point2D } from "../../graphics2d/Point2D"
8
+ import { Rectangle2D } from "../../graphics2d/Rectangle2D"
9
+ import { Shape } from "../../graphics2d/Shape"
10
+ import { RendererSettings } from "../../renderer/utilities/RendererSettings"
11
+ import { TextInfo } from "../../renderer/utilities/TextInfo"
12
+
13
+
14
+ export class Shape2SVG {
15
+
16
+ /**
17
+ *
18
+ * @param shape like {@link Shape}
19
+ * @param stroke like "#000000
20
+ * @param fill like "#0000FF" or "none"
21
+ * @param strokeWidth "#"
22
+ * @param strokeOpacity "1.0"
23
+ * @param fillOpacity "1.0"
24
+ * @param dashArray "4 1 2 3"
25
+ * @return
26
+ */
27
+ //public static Convert(shape: Shape, stroke: string, fill: string, strokeWidth: string, strokeOpacity: string, fillOpacity: string, dashArray: string): string;
28
+ public static Convert(textInfo: TextInfo, stroke: string, fill: string, strokeWidth: string, strokeOpacity: string, fillOpacity: string, dashArray: string): string;
29
+ public static Convert(text: string, x: int, y: int, font: Font, frc: FontRenderContext, stroke: string, fill: string, strokeWidth: string, strokeOpacity: string, fillOpacity: string, dashArray: string): string;
30
+ public static Convert(...args: unknown[]): string | null {
31
+ switch (args.length) {
32
+ /*case 7: {
33
+ const [shape, stroke, fill, strokeWidth, strokeOpacity, fillOpacity, dashArray] = args as [Shape, string, string, string, string, string, string];
34
+
35
+
36
+ if (shape instanceof Path2D) {
37
+
38
+ return Shape2SVG.convertPath(shape as Path2D, stroke, fill, strokeWidth, strokeOpacity, fillOpacity, dashArray);
39
+ }
40
+
41
+ else {
42
+ if (shape instanceof Rectangle2D) {
43
+
44
+ return Shape2SVG.convertRect(shape as Rectangle2D, stroke, fill, strokeWidth, strokeOpacity, fillOpacity, dashArray);
45
+ }
46
+
47
+ else {
48
+
49
+ return null;
50
+ }
51
+
52
+ }
53
+
54
+
55
+
56
+ break;
57
+ }//*/
58
+
59
+ case 7: {
60
+ const [textInfo, stroke, fill, strokeWidth, strokeOpacity, fillOpacity, dashArray] = args as [TextInfo, string, string, string, string, string, string];
61
+
62
+ let res: string = "";
63
+ if (textInfo != null) {
64
+ let name: string = RendererSettings.getInstance().getLabelFont().getName() + ", sans-serif";//"SansSerif";
65
+ let size: string = RendererSettings.getInstance().getLabelFont().getSize().toString();
66
+ let weight: string;
67
+ let anchor: string;//"start";
68
+ let text: string = textInfo.getText();
69
+
70
+ text = text.replace(/\&/g,"&");
71
+ text = text.replace(/\</g,"&lt;");
72
+ text = text.replace(/\</g,"&gt;");
73
+
74
+ let location: Point2D = new Point2D(textInfo.getLocation().getX(), textInfo.getLocation().getY());
75
+
76
+ if (textInfo.getLocation().getX() < 0) {
77
+ if (textInfo.getLocation().getX() + textInfo.getTextBounds().getWidth() > 0) {
78
+ anchor = "middle";
79
+ location.setLocation(textInfo.getTextBounds().getCenterX(), location.getY());
80
+ }
81
+ else {
82
+ anchor = "end";
83
+ location.setLocation(textInfo.getTextBounds().getMaxX(), location.getY());
84
+ }
85
+ }
86
+
87
+ if (RendererSettings.getInstance().getLabelFont().isBold()) {
88
+
89
+ weight = "bold";
90
+ }
91
+
92
+
93
+ res += "<text x=\"" + location.getX() + "\" y=\"" + location.getY() + "\"";
94
+
95
+ if (anchor != null) {
96
+
97
+ res += " text-anchor=\"" + anchor + "\"";
98
+ }
99
+
100
+ res += " font-family=\"" + name + '"';
101
+ res += " font-size=\"" + size + "px\"";
102
+ if (weight != null) {
103
+
104
+ res += " font-weight=\"" + weight + "\"";
105
+ }
106
+
107
+ res += " alignment-baseline=\"alphabetic\"";//
108
+ res += " stroke-miterlimit=\"3\"";
109
+
110
+ //sb.append(" text-anchor=\"" + anchor + "\"");//always start for single points and default SVG behavior
111
+
112
+ /*if(this._angle)
113
+ {
114
+ se += ' transform="rotate(' + this._angle + ' ' + this._anchor.getX() + ' ' + this._anchor.getY() + ')"';
115
+ }*/
116
+
117
+ let seStroke: string = "";
118
+ let seFill: string = "";
119
+
120
+ if (stroke != null) {
121
+ seStroke = res.toString();
122
+
123
+ seStroke += " stroke=\"" + stroke + "\"";
124
+ /*else
125
+ seStroke = se + ' stroke="' + stroke.replace(/#/g,"&#35;") + '"';*/
126
+
127
+ if (strokeWidth != null) {
128
+
129
+ seStroke += " stroke-width=\"" + strokeWidth + "\"";
130
+ }
131
+
132
+ seStroke += " fill=\"none\"";
133
+ seStroke += ">";
134
+ seStroke += text;
135
+ seStroke += "</text>";
136
+ }
137
+
138
+ if (fill != null) {
139
+ seFill = res.toString();
140
+
141
+ seFill += " fill=\"" + fill + "\"";
142
+ seFill += ">";
143
+ seFill += text;
144
+ seFill += "</text>";
145
+ }
146
+
147
+ res = "";
148
+ if (stroke != null && fill != null) {
149
+ res += seStroke + "\n" + seFill + ("\n");
150
+ } else if (fill != null) {
151
+ res += seFill;
152
+ } else {
153
+ return null;
154
+ }
155
+
156
+ return res;
157
+ }
158
+ return null;
159
+ }
160
+
161
+ case 11: {
162
+ const [text, x, y, font, frc, stroke, fill, strokeWidth, strokeOpacity, fillOpacity, dashArray] = args as [string, int, int, Font, OffscreenCanvasRenderingContext2D, string, string, string, string, string, string];
163
+
164
+
165
+ //(String text, int x, int y, Font font, FontRenderContext frc)
166
+ let textInfo: TextInfo = new TextInfo(text, x, y, font, frc);
167
+ return Shape2SVG.Convert(textInfo, stroke, fill, strokeWidth, strokeOpacity, fillOpacity, dashArray);
168
+ }
169
+
170
+ default: {
171
+ throw Error(`Invalid number of arguments`);
172
+ }
173
+ }
174
+ }
175
+
176
+
177
+ /**
178
+ * Assumes common font properties will be defined in the group.
179
+ * @param textInfo
180
+ * @param stroke
181
+ * @param fill
182
+ * @param strokeWidth
183
+ * @param strokeOpacity
184
+ * @param fillOpacity
185
+ * @param dashArray
186
+ * @return
187
+ */
188
+ public static ConvertForGroup(textInfo: TextInfo, stroke: string, fill: string, strokeWidth: string, strokeOpacity: string, fillOpacity: string, dashArray: string): string | null {
189
+ let res: string = "";
190
+ if (textInfo != null) {
191
+ let anchor: string;//"start";
192
+ let text: string = textInfo.getText();
193
+
194
+ text = text.replace(/\&/g,"&amp;");
195
+ text = text.replace(/\</g,"&lt;");
196
+ text = text.replace(/\</g,"&gt;");
197
+
198
+ let location: Point2D = new Point2D(textInfo.getLocation().getX(), textInfo.getLocation().getY());
199
+
200
+ if (textInfo.getLocation().getX() < 0) {
201
+ if (textInfo.getLocation().getX() + textInfo.getTextBounds().getWidth() > 0) {
202
+ anchor = "middle";
203
+ location.setLocation(textInfo.getTextBounds().getCenterX(), location.getY());
204
+ } else {
205
+ anchor = "end";
206
+ location.setLocation(textInfo.getTextBounds().getMaxX(), location.getY());
207
+ }
208
+ }
209
+
210
+
211
+
212
+ res += "<text x=\"" + location.getX() + "\" y=\"" + location.getY() + "\"";
213
+
214
+ if (anchor != null) {
215
+ res += " text-anchor=\"" + anchor + "\"";
216
+ }
217
+
218
+
219
+ //sb.append(" text-anchor=\"" + anchor + "\"");//always start for single points and default SVG behavior
220
+
221
+ /*if(this._angle)
222
+ {
223
+ se += ' transform="rotate(' + this._angle + ' ' + this._anchor.getX() + ' ' + this._anchor.getY() + ')"';
224
+ }*/
225
+
226
+ let seStroke: string = "";
227
+ let seFill: string = "";
228
+
229
+ if (stroke != null) {
230
+ seStroke = res.toString();
231
+
232
+ seStroke += " stroke=\"" + stroke + "\"";
233
+ /*else
234
+ seStroke = se + ' stroke="' + stroke.replace(/#/g,"&#35;") + '"';*/
235
+
236
+ if (strokeWidth != null) {
237
+ seStroke += " stroke-width=\"" + strokeWidth + "\"";
238
+ }
239
+
240
+ seStroke += " fill=\"none\"";
241
+ seStroke += ">";
242
+ seStroke += text;
243
+ seStroke += "</text>";
244
+ }
245
+
246
+ if (fill != null) {
247
+ seFill = res.toString();
248
+
249
+
250
+ seFill += " fill=\"" + fill + "\"";
251
+ seFill += ">";
252
+ seFill += text;
253
+ seFill += "</text>";
254
+ }
255
+
256
+ res = "";
257
+ if (stroke != null && fill != null) {
258
+ res += seStroke + "\n" + seFill + "\n";
259
+ } else if (fill != null) {
260
+ res += seFill;
261
+ } else {
262
+
263
+ return null;
264
+ }
265
+
266
+ return res;
267
+ }
268
+ return null;
269
+ }
270
+
271
+ public static makeBase64Safe(svg: string): string | null {
272
+ if (svg != null) {
273
+ //Base64 encoding
274
+ //return new String(Base64.getEncoder().encode(svg.getBytes()));
275
+ //URL-safe Base64 encoding
276
+ return btoa(svg);
277
+ }
278
+ else {
279
+ return null;
280
+ }
281
+
282
+ }
283
+
284
+
285
+ /**
286
+ *
287
+ * @param path2D like {@link Path2D}
288
+ * @param stroke like "#000000
289
+ * @param fill like "#0000FF" or "none"
290
+ * @param strokeWidth "#"
291
+ * @param strokeOpacity "1.0"
292
+ * @param fillOpacity "1.0"
293
+ * @param dashArray "4 1 2 3"
294
+ * @return
295
+ */
296
+ private static convertPath(path2D: Path2D, stroke: string, fill: string, strokeWidth: string, strokeOpacity: string, fillOpacity: string, dashArray: string): string
297
+ {
298
+ return null;
299
+ /*
300
+ let coords: number[] = new Array<number>(6);
301
+ let path: string = "";
302
+ let line: string = "";
303
+ let moveTo: Point2D;
304
+ let windingRule: int = IPathIterator.WIND_EVEN_ODD;
305
+ let format: int = 1;
306
+
307
+ let pitr: PathIterator = path2D.getPathIterator(null);
308
+ windingRule = pitr.getWindingRule();
309
+ do {
310
+ let type: int = pitr.currentSegment(coords);
311
+ if (type === IPathIterator.SEG_LINETO) {
312
+ path += "L" + coords[0] + " " + coords[1];
313
+ } else if (type === IPathIterator.SEG_MOVETO) {
314
+ path += "M" + coords[0] + " " + coords[1];
315
+ } else if (type === IPathIterator.SEG_QUADTO) {
316
+ path += "Q" + coords[0] + " " + coords[1] + " " + coords[2] + " " + coords[3];
317
+ } else if (type === IPathIterator.SEG_CUBICTO) {
318
+ path += "C" + coords[0] + " " + coords[1] + " " + coords[2] + " " + coords[3] + " " + coords[4] + " " + coords[5];
319
+ } else if (type === IPathIterator.SEG_CLOSE) {
320
+ path += "Z";
321
+ }
322
+
323
+ pitr.next();
324
+ } while (!pitr.isDone());
325
+
326
+ line += "<path d=\"" + path + "\"";
327
+
328
+ if (stroke != null) {
329
+ if (format === 2) {
330
+ line += " stroke=\"" + stroke.replace("#", "%23") + "\"";
331
+ } else {
332
+ line += " stroke=\"" + stroke + "\"";
333
+ }
334
+
335
+
336
+ if (strokeWidth != null) {
337
+ line += " stroke-width=\"" + strokeWidth + "\"";
338
+ } else {
339
+
340
+ line += " stroke-width=\"2\"";
341
+ }
342
+
343
+
344
+ if (strokeOpacity != null && strokeOpacity !== "1.0") {
345
+ line += " stroke-opacity=\"" + strokeOpacity + "\"";
346
+ }
347
+
348
+ //sbLine.append(" stroke-linecap=\"round\"");
349
+
350
+ if (dashArray != null) {
351
+ line += " stroke-dasharray=\"" + dashArray + "\"";
352
+ }
353
+
354
+
355
+ if (fill != null) {
356
+ if (format === 2) {
357
+ line += " fill=\"" + fill.replace("#", "%23") + "\"";
358
+ } else {
359
+ line += " fill=\"" + fill + "\"";
360
+ }
361
+
362
+ if (fillOpacity != null && fillOpacity !== "1.0") {
363
+ line += " fill-opacity=\"" + fillOpacity + "\"";
364
+ }
365
+ }
366
+ else {
367
+ line += " fill=\"none\"";
368
+ }
369
+
370
+ line += " />";
371
+ }
372
+ return line;//*/
373
+ }
374
+
375
+ private static convertRect(rect: Rectangle2D, stroke: string, fill: string, strokeWidth: string, strokeOpacity: string, fillOpacity: string, dashArray: string): string | null {
376
+ let res: string = "";
377
+ if (rect != null && rect.isEmpty() !== true) {
378
+ res += "<rect x=\"" + rect.getX() + "\" y=\"" + rect.getY();
379
+ res += "\" width=\"" + rect.getWidth() + "\" height=\"" + rect.getHeight() + "\"";
380
+
381
+ if (stroke != null) {
382
+ res += " stroke=\"" + stroke + "\"";
383
+
384
+ if (strokeWidth != null) {
385
+ res += " stroke-width=\"" + strokeWidth + "\"";
386
+ } else {
387
+ res += " stroke-width=\"2\"";
388
+ }
389
+ }
390
+
391
+ if (fill != null) {
392
+ res += " fill=\"" + fill + "\"";
393
+ } else {
394
+ res += " fill=\"none\"";
395
+ }
396
+
397
+ res += "/>";
398
+ return res;
399
+ }
400
+ else {
401
+ return null;
402
+ }
403
+ }
404
+ }