@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.
- 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
- package/package.json +15 -39
- package/buildNode.bat +0 -2
- package/buildWeb.bat +0 -2
- package/dist/LICENSE +0 -201
- package/dist/README.md +0 -57
- package/dist/package.json +0 -16
- package/index.ts +0 -169
- package/package.bak +0 -50
- package/package.node.json +0 -43
- package/package.pack.json +0 -19
- package/package.packWeb.json +0 -16
- package/package.web.json +0 -40
- package/src/main/ts/android/graphics/Bitmap.ts +0 -7
- package/src/main/ts/android/graphics/Paint.ts +0 -26
- package/src/main/ts/android/graphics/Path.ts +0 -78
- package/src/main/ts/android/graphics/PointF.ts +0 -14
- package/src/main/ts/android/graphics/Rect.ts +0 -18
- package/src/main/ts/android/graphics/RectF.ts +0 -50
- package/src/main/ts/android/graphics/Region.ts +0 -36
- package/src/main/ts/android/graphics/Typeface.ts +0 -11
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +0 -99
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +0 -34
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +0 -193
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +0 -2971
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +0 -4008
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +0 -93
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +0 -89
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +0 -515
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +0 -5403
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +0 -1084
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +0 -2173
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +0 -4934
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +0 -7
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +0 -5601
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +0 -14
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +0 -648
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +0 -647
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +0 -2994
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +0 -2663
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +0 -669
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +0 -971
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +0 -871
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +0 -3507
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +0 -500
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +0 -1089
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +0 -2656
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +0 -1419
- package/src/main/ts/armyc2/c5isr/data/genc.json +0 -1407
- package/src/main/ts/armyc2/c5isr/data/msd.json +0 -17311
- package/src/main/ts/armyc2/c5isr/data/mse.json +0 -18500
- package/src/main/ts/armyc2/c5isr/data/svgd.json +0 -31214
- package/src/main/ts/armyc2/c5isr/data/svge.json +0 -30558
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +0 -10
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +0 -437
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +0 -429
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +0 -7
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +0 -35
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +0 -111
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +0 -29
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +0 -18
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +0 -211
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +0 -80
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +0 -33
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +0 -16
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +0 -726
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +0 -141
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +0 -112
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +0 -261
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +0 -391
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +0 -567
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +0 -445
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +0 -31
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +0 -18
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +0 -45
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +0 -25
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +0 -15
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +0 -22
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +0 -269
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +0 -9882
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +0 -146
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +0 -1265
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +0 -64
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +0 -95
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +0 -93
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +0 -114
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +0 -555
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +0 -62
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +0 -120
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +0 -431
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +0 -99
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +0 -25
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +0 -203
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +0 -104
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +0 -481
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +0 -40
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +0 -1323
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +0 -51
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +0 -736
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +0 -106
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +0 -84
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +0 -87
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +0 -34
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +0 -324
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +0 -127
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +0 -18
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +0 -111
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +0 -219
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +0 -1008
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +0 -882
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +0 -380
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +0 -797
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +0 -1699
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +0 -178
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +0 -45
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +0 -126
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +0 -118
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +0 -11
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +0 -1201
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +0 -591
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +0 -29
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +0 -753
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +0 -137
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +0 -438
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +0 -19
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +0 -10
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +0 -5
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +0 -404
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +0 -525
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +0 -55
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +0 -36
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +0 -1055
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +0 -2085
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +0 -157
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +0 -86
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +0 -3798
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +0 -412
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +0 -124
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +0 -26
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +0 -677
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +0 -484
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +0 -62
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +0 -46
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +0 -51
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +0 -31
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +0 -71
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +0 -200
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +0 -55
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +0 -68
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +0 -103
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +0 -90
- package/test/ExportSPImages.js +0 -692
- package/test/MPWW.html +0 -556
- package/test/MPWorker.js +0 -318
- package/test/SPWorker.js +0 -233
- package/test/SVGWW.html +0 -363
- package/test/singlePointTester3.html +0 -751
- package/tsconfig.json +0 -54
- package/typedoc.json +0 -30
- package/updateVersion.js +0 -21
- package/webpack.config.js +0 -34
- package/webpackn.config.js +0 -28
- package/webpackr.config.js +0 -47
- package/webpackw.config.js +0 -23
- /package/{dist/C5Ren.d.ts → C5Ren.d.ts} +0 -0
- /package/{dist/C5Ren.js → C5Ren.js} +0 -0
- /package/{dist/C5Ren.js.map → C5Ren.js.map} +0 -0
- /package/{dist/manifest.json → manifest.json} +0 -0
|
@@ -1,404 +0,0 @@
|
|
|
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,"<");
|
|
72
|
-
text = text.replace(/\</g,">");
|
|
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,"#") + '"';*/
|
|
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,"&");
|
|
195
|
-
text = text.replace(/\</g,"<");
|
|
196
|
-
text = text.replace(/\</g,">");
|
|
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,"#") + '"';*/
|
|
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
|
-
}
|