@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,137 +0,0 @@
1
- import { type int } from "../../graphics2d/BasicTypes";
2
- import { Point } from "../../graphics2d/Point"
3
- import { Point2D } from "../../graphics2d/Point2D"
4
- import { Rectangle2D } from "../../graphics2d/Rectangle2D"
5
- import { SymbolDimensionInfo } from "../../renderer/utilities/SymbolDimensionInfo"
6
-
7
-
8
- export class SVGSymbolInfo implements SymbolDimensionInfo {
9
-
10
- private _svg: string;
11
- private _svgDataURI: string;
12
-
13
- private _anchorX: int = 0;
14
- private _anchorY: int = 0;
15
- private _symbolBounds: Rectangle2D;
16
- private _bounds: Rectangle2D;
17
-
18
- public constructor(svg: string, anchorPoint: Point2D, symbolBounds: Rectangle2D, svgBounds: Rectangle2D) {
19
- this._svg = svg;
20
- this._anchorX = anchorPoint.getX() as int;
21
- this._anchorY = anchorPoint.getY() as int;
22
- this._symbolBounds = symbolBounds;
23
- this._bounds = svgBounds;
24
- }
25
-
26
- // https://web.dev/articles/base64-encoding
27
- // From https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem.
28
- private bytesToBase64(bytes)
29
- {
30
- const binString = String.fromCodePoint(...bytes);
31
- return btoa(binString);
32
- }
33
-
34
- private escapeChars(text:string):string
35
- {
36
- /*
37
- Character XML encoding XML entity
38
- \& \& \&\#38
39
- \' \' \&\#30
40
- \" \" \&\#34
41
- \< \&lt; \&\#60
42
- \> \&gt; \&\#62 //*/
43
-
44
- let temp = text;
45
-
46
- /*temp = temp.replace(/\n/g,"");
47
- temp = temp.replace(/</g,"%3C");
48
- temp = temp.replace(/>/g,"%3E");//*/
49
-
50
- temp = temp.replace(/\n/g,"");
51
- temp = temp.replace(/%/g,"%25");
52
- temp = temp.replace(/#/g,"%23");//# to %23 for FF
53
- temp = temp.replace(/"/g,"%22"); //" to %22 for EDGE
54
- temp = temp.replace(/</g,"%3C");
55
- temp = temp.replace(/=/g,"%3D")
56
- temp = temp.replace(/>/g,"%3E");
57
- temp = temp.replace(/\//g,"%2F");
58
- temp = temp.replace(/\\/g,"%5C");
59
- temp = temp.replace(/\[/g,"%5B");
60
- temp = temp.replace(/\]/g,"%5D");
61
- temp = temp.replace(/\^/g,"%5E");
62
- temp = temp.replace(/\`/g,"%60");
63
- temp = temp.replace(/\~/g,"%7E");
64
- //temp = temp.replace(/\!/g,"%33");
65
- temp = temp.replace(/\?/g,"%3F");
66
- temp = temp.replace(/:/g,"%3A");
67
- temp = temp.replace(/;/g,"%3B");
68
- temp = temp.replace(/\@/g,"%40");
69
- //temp = temp.replace(/\&/g,"%26");//&amp;
70
- //temp = temp.replace(/\&/g,"&amp;");//&amp;//done in SVGTextInfo.toSVGElement AND Shape2SVG.ConvertForGroup
71
- temp = temp.replace(/\{/g,"%7B");
72
- temp = temp.replace(/\|/g,"%7C");
73
- temp = temp.replace(/\}/g,"%7D");//*/
74
-
75
- return temp;
76
- }
77
-
78
- public getSVGDataURI(): string {
79
- if (this._svgDataURI == null)
80
- {
81
- //works with special characters but not in base64. Which should be fine.
82
- //let temp:string = "data:image/svg+xml," + this.escapeChars(this._svg);
83
-
84
- // https://web.dev/articles/base64-encoding
85
- // From https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem.
86
- //works with base64
87
- let temp:string = "data:image/svg+xml;base64," + btoa(String.fromCodePoint(...new TextEncoder().encode(this._svg)))
88
-
89
- this._svgDataURI = temp;
90
- }
91
- return this._svgDataURI;
92
- }
93
-
94
- public getSVG(): string { return this._svg; }
95
-
96
- /**
97
- * The x value the image should be centered on or the "anchor point".
98
- * @return
99
- */
100
- public getSymbolCenterX(): int {
101
- return this._anchorX;
102
- }
103
-
104
- /**
105
- * The y value the image should be centered on or the "anchor point".
106
- * @return
107
- */
108
- public getSymbolCenterY(): int {
109
- return this._anchorY;
110
- }
111
-
112
- /**
113
- * The point the image should be centered on or the "anchor point".
114
- * @return
115
- */
116
- public getSymbolCenterPoint(): Point2D {
117
- return new Point2D(this._anchorX, this._anchorY);
118
- }
119
-
120
- /**
121
- * minimum bounding rectangle for the core symbol. Does
122
- * not include modifiers, display or otherwise.
123
- * @return
124
- */
125
- public getSymbolBounds(): Rectangle2D {
126
- return this._symbolBounds;
127
- }
128
-
129
- /**
130
- * Dimension of the entire image.
131
- * @return
132
- */
133
-
134
- public getImageBounds(): Rectangle2D {
135
- return new Rectangle2D(this._bounds.getX(), this._bounds.getY(), this._bounds.getWidth(), this._bounds.getHeight());
136
- }
137
- }
@@ -1,438 +0,0 @@
1
- import { type double, type int } from "../../graphics2d/BasicTypes";
2
-
3
- import { Font } from "../../graphics2d/Font"
4
- import { Point2D } from "../../graphics2d/Point2D"
5
- import { Rectangle2D } from "../../graphics2d/Rectangle2D"
6
- import { RendererSettings } from "./RendererSettings"
7
- import { ShapeUtilities } from "./ShapeUtilities";
8
- import { RectUtilities } from "./RectUtilities";
9
- import { Canvas, CanvasRenderingContext2D, createCanvas } from 'canvas';
10
-
11
- /**
12
- *
13
- *
14
- */
15
- export class SVGTextInfo {
16
- protected _text: string;
17
- protected _font: string;
18
- protected _fontName: string;
19
- protected _fontSize: number = 0;
20
- protected _fontStyle: string;
21
- protected _location: Point2D;
22
- protected _bounds: Rectangle2D;
23
- protected _descent: double = 0;
24
- protected _aboveBaseHeight: double = 0;
25
- private justification: string = "start";
26
- private angle: number = 0;
27
- private alignmentBaseline: string = "alphabetic"
28
-
29
- private isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
30
- private isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
31
- private OSCDefined = typeof OffscreenCanvasRenderingContext2D !== 'undefined';//web workers fail isBrowser test
32
-
33
- public constructor(text: string, position: Point2D, font: Font, justification: string, angle: number);
34
- public constructor(text: string, x: int, y: int, font: Font, context: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D | null);
35
- public constructor(text: string, x: int, y: int, font: string, context: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D | null);
36
- public constructor(text: string, x: int, y: int, fontName: string, fontSize:number, fontStyle:string, context: OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D | null);
37
- public constructor(...args: unknown[])
38
- {
39
- let ctx:OffscreenCanvasRenderingContext2D | CanvasRenderingContext2D;
40
- let tm:TextMetrics | any;
41
- let top:number;
42
- let left:number;
43
- let width:number;
44
- let height:number;
45
- switch (args.length)
46
- {
47
- case 5:
48
- {
49
- if (args[1] instanceof Point2D) {
50
- const [text, position, font, justification, angle] = args as [string, Point2D, Font, string, number];
51
- let osc:any;//OffscreenCanvas | Canvas;
52
- if(this.OSCDefined)
53
- {
54
- osc = new OffscreenCanvas(10, 10);
55
- }
56
- else
57
- {
58
- osc = createCanvas(10,10);
59
- }
60
- ctx = osc.getContext("2d");
61
- ctx.font = font.toString();
62
- this._font = font.toString();
63
- this._fontName = font.getName();
64
- this._fontSize = font.getSize();
65
- this._fontStyle = font.getTypeString();
66
- this._text = text;
67
- tm = ctx.measureText(text);
68
-
69
- if(this.OSCDefined)
70
- top = position.y - (tm.fontBoundingBoxAscent + tm.fontBoundingBoxDescent) / 2;
71
- else
72
- {
73
- top = position.y - (tm.emHeightAscent + tm.emHeightDescent) / 2;
74
- }
75
- left = position.x;
76
- this._location = new Point2D(position.x, position.y);
77
- this.justification = justification
78
- this.angle = angle
79
- this.alignmentBaseline = "middle"
80
- } else {
81
- const [text, x, y, font,context] = args as [string, number,number, any, OffscreenCanvasRenderingContext2D | any | null];
82
-
83
- if(context == null)
84
- {
85
- let osc:any;//OffscreenCanvas | Canvas;
86
- if(this.OSCDefined)
87
- {
88
- osc = new OffscreenCanvas(10,10);
89
- }
90
- else
91
- osc = createCanvas(10,10);
92
-
93
- ctx = osc.getContext("2d");
94
- }
95
- else
96
- {
97
- ctx = context;
98
- }
99
- if(typeof font === 'string')
100
- {
101
- ctx.font = font;
102
- //Parse font string
103
- let temp:string[] = font.split(' ');
104
- this._fontStyle = temp[0];
105
- this._fontSize = parseInt(temp[1].replace("px",""));
106
- for(let i = 2; i < temp.length; i++)
107
- {
108
- if(i===2)
109
- this._fontName = temp[i];
110
- else
111
- this._fontName += " " + temp[i];
112
- }
113
- }
114
- else if(font instanceof Font)
115
- {
116
- ctx.font = font.toString();
117
- this._fontName = font.getName();
118
- this._fontSize = font.getSize();
119
- this._fontStyle = font.getTypeString();
120
- }
121
-
122
- this._text = text;
123
- tm = ctx.measureText(text);
124
-
125
- if(tm.fontBoundingBoxAscent)
126
- top = y - tm.fontBoundingBoxAscent;
127
- else
128
- {
129
- top = y - tm.emHeightAscent;
130
- }
131
- left = x;
132
- this._location = new Point2D(x, y);
133
- }
134
- break;
135
- }
136
- case 7:
137
- {
138
- const [text, x, y, fontName, fontSize, fontStyle, context] = args as [string, number, number, string, number, string, OffscreenCanvasRenderingContext2D | any | null];
139
- if (arguments.length === 7)
140
- {
141
-
142
- if(context == null)
143
- {
144
- let osc:any;//OffscreenCanvas | Canvas;
145
- if(this.OSCDefined)
146
- {
147
- osc = new OffscreenCanvas(10,10);
148
- }
149
- else
150
- {
151
- osc = createCanvas(10,10);
152
- }
153
- ctx = osc.getContext("2d");
154
-
155
- this._font = fontStyle + " " + fontSize + "px " + fontName;
156
- ctx.font = this._font
157
- }
158
- else
159
- {
160
- ctx = context;
161
- }
162
- this._fontStyle = fontStyle;
163
- this._fontSize = fontSize;
164
- this._fontName = fontName;
165
- tm = ctx.measureText(text);
166
-
167
- if(tm.fontBoundingBoxAscent)
168
- top = y - tm.fontBoundingBoxAscent;
169
- else
170
- {
171
- top = y - tm.emHeightAscent;
172
- }
173
- left = x;
174
- this._location = new Point2D(x, y);
175
- }
176
- break;
177
- }
178
- }
179
-
180
- width = tm.width;
181
- width = tm.actualBoundingBoxRight + tm.actualBoundingBoxLeft;
182
- if(this.OSCDefined)
183
- height = tm.fontBoundingBoxDescent + tm.fontBoundingBoxAscent;
184
- else
185
- {
186
- height = tm.emHeightDescent + tm.emHeightAscent;
187
- }
188
- if (this.justification == "middle")
189
- left -= width / 2;
190
- else if (this.justification == "end")
191
- left -= width;
192
-
193
- this._bounds = new Rectangle2D(left, top, width, height);
194
-
195
- RectUtilities.grow(this._bounds,1);
196
-
197
- if (this.angle != 0)
198
- this._bounds = SVGTextInfo.getRotatedRectangleBounds(this._bounds, this.getLocation(), this.angle, this.justification);
199
-
200
- if(this.OSCDefined)
201
- {
202
- this._descent = tm.fontBoundingBoxDescent;
203
- this._aboveBaseHeight = tm.fontBoundingBoxAscent;
204
- }
205
- else
206
- {
207
- this._descent = tm.emHeightDescent;
208
- this._aboveBaseHeight = tm.emHeightAscent;
209
- }
210
-
211
- /*console.log(this._text);
212
- console.log(this._bounds);
213
- console.log(tm);//*/
214
- }
215
-
216
- public setLocation(x: int, y: int): void {
217
-
218
- this._bounds.setRect(x, y - this._aboveBaseHeight, this._bounds.getWidth(), this._bounds.getHeight());
219
- RectUtilities.grow(this._bounds,1);
220
- this._location.setLocation(x, y);
221
- }
222
-
223
- public getLocation(): Point2D {
224
- return this._location;
225
- }
226
-
227
- public shift(x: int, y: int): void {
228
- ShapeUtilities.offset(this._bounds, x, y);
229
- ShapeUtilities.offset(this._location, x, y);
230
- }
231
-
232
- public getText(): string {
233
- return this._text;
234
- }
235
-
236
- /**
237
- * includes the descent
238
- * @returns
239
- */
240
- public getTextBounds(): Rectangle2D {
241
- return this._bounds;
242
- }
243
-
244
-
245
- public getTextOutlineBounds(): Rectangle2D {
246
- let RS: RendererSettings = RendererSettings.getInstance();
247
- let outlineOffset: int = RS.getTextOutlineWidth();
248
- let bounds: Rectangle2D = this._bounds.clone() as Rectangle2D;
249
-
250
- if (outlineOffset > 0) {
251
- if (RS.getTextBackgroundMethod() === RendererSettings.TextBackgroundMethod_OUTLINE) {
252
-
253
- ShapeUtilities.grow(bounds, outlineOffset / 2);
254
- }
255
-
256
- else {
257
-
258
- ShapeUtilities.grow(bounds, outlineOffset);
259
- }
260
-
261
- }
262
-
263
- return bounds;
264
- }
265
-
266
- public getDescent(): double {
267
- return this._descent;
268
- }
269
-
270
- /**
271
- *
272
- * @param textColor hex color string
273
- * @param outlineColor hex color string or null if no outline
274
- * @param outlineWidth number value for outline width
275
- * @param justification "start", "middle", or "end"
276
- * @param svgFormat 0 - untouched, 1 - replace speacial characters with escape codes, 2 use encodeURIComponent (expensive)
277
- * @returns
278
- */
279
- public toSVGElement(textColor:string, outlineColor:string | null, outlineWidth:number=0, justification: string=this.justification, svgFormat:number=0):string
280
- {
281
- let fill:string = textColor;
282
- let stroke:string | null = outlineColor;
283
- let strokeWidth:number = outlineWidth;
284
- var format = 0;
285
- if(svgFormat)
286
- {
287
- format = svgFormat;
288
- }
289
-
290
- let x:number = this._location.getX();
291
- let y:number = this._location.getY();
292
-
293
- var se: string;
294
- if (this.angle == 0)
295
- se = '<text x="' + x + '" y="' + y + '"';
296
- else
297
- se += '<text transform="translate(' + x + ',' + y + ') rotate(' + this.angle + ')"'
298
- se += ' font-family="' + this._fontName + '"';
299
- se += ' font-size="' + this._fontSize + 'px"';
300
- se += ' font-weight="' + this._fontStyle + '"';
301
- se += ' alignment-baseline="' + this.alignmentBaseline +'"';
302
- se += ' stroke-miterlimit="3"';
303
- se += ' text-anchor="' + justification + '"';
304
-
305
- /*if(this._angle)
306
- {
307
- se += ' transform="rotate(' + this._angle + ' ' + this._location.getX() + ' ' + this._location.getY() + ')"';
308
- }//*/
309
-
310
- var seStroke = null,
311
- seFill = null;
312
-
313
- var text = this._text;
314
- //catch special characters that break SVGs as base64 dataURIs
315
- if(format === 1)
316
- {
317
- //got codes from: http://www.theukwebdesigncompany.com/articles/entity-escape-characters.php
318
- //and https://unicodelookup.com (use HTML code)
319
- text = text.replace(/\&/g,"&amp;");
320
- text = text.replace(/\</g,"&lt;");
321
- text = text.replace(/\</g,"&gt;");
322
- //text = text.replace(/\u2022/g,"&#x2022;");//echelon and ellipses dot
323
- //text = text.replace(/\u25CF/g,"&#x2022;");//echelon and ellipses dot (black circle)
324
- text = text.replace(/\u2022|\u25CF/g,"&#x2022;");//echelon and ellipses dot (black circle)
325
- text = text.replace(/\u00D8/g,"&#216;");//Ø
326
- text = text.replace(/\u00B0/g,"&#176;");//°
327
- text = text.replace(/\u00B1/g,"&#x00B1;");//"RD" reinforce/reduced ±
328
- }
329
- else if(format === 2)
330
- {
331
- text = encodeURIComponent(text);
332
- /*text = text.replace(/\&/g,"%24");
333
- text = text.replace(/\</g,"%3C");
334
- text = text.replace(/\</g,"%3E");
335
- text = text.replace(/\u2022|\u25CF/g,"%95");//echelon and ellipses dot (black circle)
336
- text = text.replace(/\u00B1/g,"%C2%B1");//"RD" reinforce/reduced +- symbol//*/
337
- }
338
-
339
- if(stroke != null && strokeWidth > 0)
340
- {
341
- if(format === 2)
342
- seStroke = se + ' stroke="' + stroke.replace(/#/g,"%23") + '"';
343
- else
344
- seStroke = se + ' stroke="' + stroke + '"';
345
- /*else
346
- seStroke = se + ' stroke="' + stroke.replace(/#/g,"&#35;") + '"';*/
347
-
348
- if(strokeWidth)
349
- seStroke += ' stroke-width="' + (strokeWidth + 2) + '"';
350
- seStroke += ' fill="none"';
351
- seStroke += '>';
352
- seStroke += text;
353
- seStroke += '</text>';
354
- }
355
-
356
- if(fill != null)
357
- {
358
- if(format === 2)
359
- seFill = se + ' fill="' + fill.replace(/#/g,"%23") + '"';
360
- else
361
- seFill = se + ' fill="' + fill + '"';
362
- /*else
363
- seFill = se + ' fill="' + fill.replace(/#/g,"%23") + '"';*/
364
- seFill += '>';
365
- seFill += text;
366
- seFill += '</text>';
367
- }
368
-
369
- if(stroke && fill)
370
- se = seStroke + seFill;
371
- else if(fill)
372
- se = seFill;
373
- else
374
- se = "";
375
- return se;
376
- }
377
-
378
- /**
379
- * @param {Rectangle2D} rectangle
380
- * @returns {Rectangle2D}
381
- */
382
- static getRotatedRectangleBounds(rectangle: Rectangle2D, pivotPt: Point2D, angle: number, justification: string="middle"): Rectangle2D {
383
- const textWidth = rectangle.getWidth()
384
-
385
- if (justification == "start")
386
- rectangle.x -= textWidth / 2;
387
- else if (justification == "end")
388
- rectangle.x += textWidth / 2;
389
-
390
- let ptTL = new Point2D(rectangle.getMinX(), rectangle.getMinY())
391
- let ptTR = new Point2D(rectangle.getMaxX(), rectangle.getMinY())
392
- let ptBL = new Point2D(rectangle.getMinX(), rectangle.getMaxY())
393
- let ptBR = new Point2D(rectangle.getMaxX(), rectangle.getMaxY())
394
-
395
- SVGTextInfo.rotatePoint(ptTL, pivotPt, angle)
396
- SVGTextInfo.rotatePoint(ptTR, pivotPt, angle)
397
- SVGTextInfo.rotatePoint(ptBL, pivotPt, angle)
398
- SVGTextInfo.rotatePoint(ptBR, pivotPt, angle)
399
-
400
- rectangle = new Rectangle2D(ptTL.x, ptTL.y, 0, 0)
401
- rectangle.add(ptTR.x, ptTR.y)
402
- rectangle.add(ptBL.x, ptBL.y)
403
- rectangle.add(ptBR.x, ptBR.y)
404
-
405
- if (justification == "start") {
406
- const s = Math.sin(angle * 2 * Math.PI / 360);
407
- const c = Math.cos(angle * 2 * Math.PI / 360);
408
- rectangle.x += textWidth / 2 * c;
409
- rectangle.y += textWidth / 2 * s;
410
- } else if (justification == "end") {
411
- const s = Math.sin(angle * 2 * Math.PI / 360);
412
- const c = Math.cos(angle * 2 * Math.PI / 360);
413
- rectangle.x -= textWidth / 2 * c;
414
- rectangle.y -= textWidth / 2 * s;
415
- }
416
-
417
- return rectangle;
418
- }
419
-
420
- /**
421
- * @param {Point2D} pt Point to rotate
422
- * @param {Point2D} pivotPt Point to rotate around
423
- * @param {number} angle angle in degrees
424
- */
425
- static rotatePoint(pt: Point2D, pivotPt: Point2D, angle: number): void {
426
- const s = Math.sin(- angle * 2 * Math.PI / 360);
427
- const c = Math.cos(- angle * 2 * Math.PI / 360);
428
-
429
- pt.x -= pivotPt.x;
430
- pt.y -= pivotPt.y;
431
-
432
- let xnew = pt.x * c - pt.y * s;
433
- let ynew = pt.x * s + pt.y * c;
434
-
435
- pt.x = xnew + pivotPt.x;
436
- pt.y = ynew + pivotPt.y;
437
- }
438
- }
@@ -1,19 +0,0 @@
1
- export class SettingsChangedEvent /*extends java.lang.Throwable*/ {
2
-
3
- public static readonly EventType_CacheSizeChanged: string = "CACHE_CHANGED";
4
- public static readonly EventType_CacheToggled: string = "CACHE_TOGGLED";
5
- public static readonly EventType_FontChanged: string = "FONT_CHANGED";
6
-
7
-
8
- private _EventType: string;
9
- public constructor(eventType: string) {
10
- if (eventType != null && eventType !== "") {
11
- this._EventType = eventType;
12
- }
13
- }
14
-
15
- public getEventType(): string {
16
- return this._EventType;
17
- }
18
-
19
- }
@@ -1,10 +0,0 @@
1
-
2
- import { SettingsChangedEvent } from "../../renderer/utilities/SettingsChangedEvent"
3
-
4
- export interface SettingsChangedEventListener {
5
-
6
- onSettingsChanged(sce: SettingsChangedEvent): void;
7
-
8
- }
9
-
10
-
@@ -1,5 +0,0 @@
1
-
2
-
3
- export interface SettingsEventListener {
4
- SettingsEventChanged(type: string): void;
5
- }