@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,525 @@
1
+ import { type int, type double } from "../../graphics2d/BasicTypes";
2
+
3
+ import { AffineTransform } from "../../graphics2d/AffineTransform"
4
+ import { BasicStroke } from "../../graphics2d/BasicStroke"
5
+ import { GeneralPath } from "../../graphics2d/GeneralPath"
6
+ import { Point } from "../../graphics2d/Point"
7
+ import { Point2D } from "../../graphics2d/Point2D"
8
+ import { Rectangle } from "../../graphics2d/Rectangle"
9
+ import { Shape } from "../../graphics2d/Shape"
10
+ import { TextLayout } from "../../graphics2d/TextLayout"
11
+ import { TexturePaint } from "../../graphics2d/TexturePaint"
12
+ import { Color } from "../../renderer/utilities/Color"
13
+ import { MilStdSymbol } from "../../renderer/utilities/MilStdSymbol"
14
+ import { SVGSymbolInfo } from "./SVGSymbolInfo";
15
+
16
+
17
+
18
+ /**
19
+ * Holds information on how to draw the pieces of a multipoint symbol.
20
+ * Can be retrieved from {@link MilStdSymbol#getSymbolShapes()} and
21
+ * {@link MilStdSymbol#getModifierShapes()} after {@link armyc2.c5isr.web.render.WebRenderer#RenderMultiPointAsMilStdSymbol(String, String, String, String, String, String, double, String, Map, Map)} is called.
22
+ */
23
+ export class ShapeInfo {
24
+
25
+
26
+ public static SHAPE_TYPE_POLYLINE: int = 0;
27
+ //public static int SHAPE_TYPE_POLYGON=1;
28
+ public static SHAPE_TYPE_FILL: int = 1;
29
+ public static SHAPE_TYPE_MODIFIER: int = 2;
30
+ public static SHAPE_TYPE_MODIFIER_FILL: int = 3;
31
+ public static SHAPE_TYPE_UNIT_FRAME: int = 4;
32
+ public static SHAPE_TYPE_UNIT_FILL: int = 5;
33
+ public static SHAPE_TYPE_UNIT_SYMBOL1: int = 6;
34
+ public static SHAPE_TYPE_UNIT_SYMBOL2: int = 7;
35
+ public static SHAPE_TYPE_UNIT_DISPLAY_MODIFIER: int = 8;
36
+ public static SHAPE_TYPE_UNIT_ECHELON: int = 9;
37
+ public static SHAPE_TYPE_UNIT_AFFILIATION_MODIFIER: int = 10;
38
+ public static SHAPE_TYPE_UNIT_HQ_STAFF: int = 11;
39
+ public static SHAPE_TYPE_TG_SP_FILL: int = 12;
40
+ public static SHAPE_TYPE_TG_SP_FRAME: int = 13;
41
+ public static SHAPE_TYPE_TG_Q_MODIFIER: int = 14;
42
+ public static SHAPE_TYPE_TG_SP_OUTLINE: int = 15;
43
+ public static SHAPE_TYPE_SINGLE_POINT_OUTLINE: int = 16;
44
+ public static SHAPE_TYPE_UNIT_OUTLINE: int = 17;
45
+ public static SHAPE_TYPE_UNIT_OPERATIONAL_CONDITION: int = 18;
46
+
47
+ public static justify_left: int = 0;
48
+ public static justify_center: int = 1;
49
+ public static justify_right: int = 2;
50
+
51
+
52
+ protected _Shape: Shape = null;
53
+ private stroke: BasicStroke = null;
54
+ private gp: GeneralPath = null;
55
+ private fillStyle: int = 0;
56
+ /**
57
+ * @deprecated
58
+ */
59
+ private texturePaint: TexturePaint | null = null;
60
+ private _ShapeType: int = -1;
61
+ private lineColor: Color | null = null;
62
+ private fillColor: Color | null = null;
63
+ private textBackgoundColor: Color = null;
64
+ // private affineTransform: AffineTransform;
65
+
66
+ //private _GlyphVector: GlyphVector;
67
+ private _TextLayout: TextLayout = null;
68
+ private _Position: Point2D = null;
69
+ private _ModifierString: string = null;
70
+ private _ModifierPosition: Point2D = null;
71
+
72
+ private _ModifierImageInfo: SVGSymbolInfo = null;
73
+ private _ModifierAngle: double = 0;
74
+ private _Tag: any = null;
75
+ /**
76
+ * @deprecated
77
+ */
78
+ private _shader: ImageBitmap = null;
79
+ private _patternFillInfo: SVGSymbolInfo = null;
80
+ private _justify: int = ShapeInfo.justify_left;
81
+ //for google earth
82
+ private _Polylines: Array<Array<Point2D>> = null;
83
+
84
+ //enum DrawMethod{Draw,Fill;}
85
+
86
+ //private Polygon poly=new Polygon();
87
+ constructor();
88
+
89
+ constructor(shape: Shape);
90
+
91
+ //constructor(glyphVector: GlyphVector, position: Point2D);
92
+
93
+ constructor(textLayout: TextLayout, position: Point2D);
94
+
95
+ /**
96
+ *
97
+ * @param shape
98
+ * @param shapeType
99
+ * ShapeInfo.SHAPE_TYPE_
100
+ */
101
+ constructor(shape: Shape, shapeType: int);
102
+ constructor(...args: unknown[]) {
103
+ switch (args.length) {
104
+ case 0: {
105
+ break;
106
+ }
107
+
108
+ case 1: {
109
+ const [shape] = args as [Shape];
110
+ this._Shape = shape;
111
+ break;
112
+ }
113
+
114
+ // case 2: {
115
+ // const [glyphVector, position] = args as [GlyphVector, Point2D];
116
+ // this._GlyphVector = glyphVector;
117
+ // this._Position = position;
118
+ // break;
119
+ // }
120
+
121
+ case 2: {
122
+ if (args[0] instanceof TextLayout) {
123
+ const [textLayout, position] = args as [TextLayout, Point2D];
124
+ this._TextLayout = textLayout;
125
+ this._Position = position;
126
+ } else {
127
+ const [shape, shapeType] = args as [Shape, int];
128
+ this._Shape = shape;
129
+ this._ShapeType = shapeType;
130
+ }
131
+ break;
132
+ }
133
+
134
+ default: {
135
+ throw Error(`Invalid number of arguments`);
136
+ }
137
+ }
138
+ }
139
+
140
+
141
+ public getShape(): Shape {
142
+ return this._Shape;
143
+ }
144
+
145
+ public setShape(value: Shape): void {
146
+ this._Shape = value;
147
+ // this._GlyphVector = null;
148
+ this._TextLayout = null;
149
+ }
150
+
151
+ // public getGlyphVector(): GlyphVector {
152
+ // return this._GlyphVector;
153
+ // }
154
+
155
+ //public setGlyphVector(value: GlyphVector, position: Point2D): void {
156
+ // this._GlyphVector = value;
157
+ // this._Position = position;
158
+ // this._Shape = null;
159
+ // this._TextLayout = null;
160
+ // }
161
+
162
+ public getTextLayout(): TextLayout {
163
+ return this._TextLayout;
164
+ }
165
+
166
+ public setTextLayout(value: TextLayout): void {
167
+ this._TextLayout = value;
168
+ // this._GlyphVector = null;
169
+ this._Shape = null;
170
+ }
171
+
172
+ //set this when returning text string.
173
+ public setModifierString(value: string): void {
174
+ this._ModifierString = value;
175
+ }
176
+
177
+ public getModifierString(): string {
178
+ return this._ModifierString;
179
+ }
180
+
181
+ //location to draw ModifierString.
182
+ public setModifierPosition(value: Point2D): void {
183
+ this._ModifierPosition = value;
184
+ }
185
+
186
+ public getModifierPosition(): Point2D {
187
+ return this._ModifierPosition;
188
+ }
189
+
190
+ //angle to draw ModifierString.
191
+ public setModifierAngle(value: double): void {
192
+ this._ModifierAngle = value;
193
+ }
194
+
195
+ public getModifierAngle(): double {
196
+ return this._ModifierAngle;
197
+ }
198
+
199
+ /**
200
+ *
201
+ * @deprecated use {@link setModifierPosition()}
202
+ */
203
+ public setModifierStringPosition(value: Point2D): void {
204
+ this.setModifierPosition(value);
205
+ }
206
+
207
+ /**
208
+ *
209
+ * @deprecated use {@link getModifierPosition()}
210
+ */
211
+ public getModifierStringPosition(): Point2D {
212
+ return this.getModifierPosition();
213
+ }
214
+
215
+ /**
216
+ *
217
+ * @deprecated use {@link setModifierAngle()}
218
+ */
219
+ public setModifierStringAngle(value: double): void {
220
+ this.setModifierAngle(value);
221
+ }
222
+
223
+ /**
224
+ *
225
+ * @deprecated use {@link getModifierAngle()}
226
+ */
227
+ public getModifierStringAngle(): double {
228
+ return this.getModifierAngle();
229
+ }
230
+
231
+ public setModifierImage(value: SVGSymbolInfo): void {
232
+ this._ModifierImageInfo = value;
233
+ }
234
+
235
+ public getModifierImage(): string {
236
+ if (this._ModifierImageInfo)
237
+ return this._ModifierImageInfo.getSVGDataURI();
238
+ else
239
+ return null;
240
+ }
241
+
242
+ public getModifierImageInfo(): SVGSymbolInfo {
243
+ return this._ModifierImageInfo;
244
+ }
245
+
246
+ /**
247
+ * Object that can be used to store anything.
248
+ * Will not be looked at when rendering.
249
+ * Null by default
250
+ * @param value
251
+ */
252
+ public setTag(value: any): void {
253
+ this._Tag = value;
254
+ }
255
+
256
+ /**
257
+ * Object that can be used to store anything.
258
+ * Will not be looked at when rendering.
259
+ * Null by default
260
+ * @return
261
+ */
262
+ public getTag(): any {
263
+ return this._Tag;
264
+ }
265
+
266
+
267
+ /*
268
+ * OLD
269
+ * @return
270
+ *//*
271
+ public Rectangle getBounds()
272
+ {
273
+ Rectangle temp = null;
274
+
275
+ if(_Shape != null)
276
+ return _Shape.getBounds();
277
+ else if(_GlyphVector != null)
278
+ return _GlyphVector.getPixelBounds(null, (float)_Position.getX(), (float)_Position.getY());
279
+ else if(_TextLayout != null && _Position != null)
280
+ {
281
+ temp = _TextLayout.getPixelBounds(null, (float)_Position.getX(), (float)_Position.getY());
282
+ return temp;
283
+ }
284
+ else if(_TextLayout != null)//for deutch multipoint labels
285
+ {
286
+ //in this case, user set position using affine tranformation.
287
+ temp = new Rectangle();
288
+ temp.setRect(_TextLayout.getBounds());
289
+ return temp;
290
+ }
291
+ else
292
+ return null;
293
+ }//*/
294
+
295
+ /**
296
+ * Gets bounds for the shapes. Incorporates AffineTransform if not null
297
+ * in the ShapeInfo object.
298
+ * @return
299
+ */
300
+ public getBounds(): Rectangle | null {
301
+ let temp: Rectangle;
302
+
303
+ if (this._Shape != null) {
304
+ temp = this._Shape.getBounds();
305
+ if (this._Shape instanceof GeneralPath) {
306
+ if (this._ShapeType === ShapeInfo.SHAPE_TYPE_UNIT_OUTLINE) {
307
+ if (this.lineColor != null && this.stroke != null) {
308
+ if (this.stroke != null && this.stroke.getLineWidth() > 2) {
309
+
310
+ temp.grow(this.stroke.getLineWidth() as int / 2, this.stroke.getLineWidth() as int / 2);
311
+ }
312
+
313
+ }
314
+ }
315
+ else {
316
+ //mobility and other drawn symbol decorations.
317
+ if (this.lineColor != null && this.stroke != null) {
318
+ if (this.stroke != null && this.stroke.getLineWidth() > 2) {
319
+
320
+ temp.grow(this.stroke.getLineWidth() as int - 1, this.stroke.getLineWidth() as int - 1);
321
+ }
322
+
323
+ }
324
+ }
325
+ }
326
+ }
327
+ else {
328
+ // if (this._GlyphVector != null) {
329
+ // temp = this._GlyphVector.getPixelBounds(null, this._Position.getX() as double, this._Position.getY() as double);
330
+ // }
331
+ //else {
332
+ if (this._TextLayout != null && this._Position != null) {
333
+ temp = this._TextLayout.getPixelBounds(null, this._Position.getX() as double, this._Position.getY() as double);
334
+
335
+ }
336
+ else {
337
+ if (this._TextLayout != null)//for deutch multipoint labels
338
+ {
339
+ temp = new Rectangle();
340
+ temp.setRect(this._TextLayout.getBounds());
341
+ //return temp;
342
+ }
343
+ else {
344
+
345
+ return null;
346
+ }
347
+
348
+ }
349
+
350
+ // }
351
+
352
+ }
353
+
354
+
355
+
356
+ // if (this.affineTransform != null) {
357
+ // //position set by affinetransform
358
+ // let sTemp: Shape = temp;
359
+ // sTemp = this.affineTransform.createTransformedShape(temp);
360
+ // temp = sTemp.getBounds();
361
+ // }
362
+
363
+ return temp;
364
+ }
365
+
366
+
367
+ /**
368
+ * needed to draw Glyphs and TextLayouts
369
+ * @param position
370
+ */
371
+ public setGlyphPosition(position: Point | Point2D): void {
372
+ if (position instanceof Point)
373
+ this._Position = new Point2D(position.x, position.y);
374
+ else
375
+ this._Position = position;
376
+ }
377
+
378
+
379
+ /**
380
+ * needed to draw Glyphs and TextLayouts
381
+ * @return
382
+ */
383
+ public getGlyphPosition(): Point2D {
384
+ return this._Position;
385
+ }
386
+
387
+ public setLineColor(value: Color | null): void {
388
+ this.lineColor = value;
389
+ }
390
+ public getLineColor(): Color {
391
+ return this.lineColor;
392
+ }
393
+
394
+ // /**
395
+ // *
396
+ // * @param value
397
+ // * @deprecated Use setStroke
398
+ // */
399
+ // public void setLineWidth(int value)
400
+ // {
401
+ // lineWidth=value;
402
+ // }
403
+ // /**
404
+ // * @deprecated Use getStroke
405
+ // * @return
406
+ // */
407
+ // public int getLineWidth()
408
+ // {
409
+ // return lineWidth;
410
+ // }
411
+
412
+ public setFillColor(value: Color | null): void {
413
+ this.fillColor = value;
414
+ }
415
+ public getFillColor(): Color | null {
416
+ return this.fillColor;
417
+ }
418
+
419
+ public setTextBackgroundColor(value: Color): void {
420
+ this.textBackgoundColor = value;
421
+ }
422
+ public getTextBackgroundColor(): Color {
423
+ return this.textBackgoundColor;
424
+ }
425
+
426
+ // public setAffineTransform(value: AffineTransform): void {
427
+ // this.affineTransform = value;
428
+ // }
429
+ // public getAffineTransform(): AffineTransform {
430
+ // return this.affineTransform;
431
+ // }
432
+
433
+
434
+ public getStroke(): BasicStroke {
435
+ return this.stroke;
436
+ }
437
+
438
+ /**
439
+ * @deprecated
440
+ */
441
+ public getTexturePaint(): TexturePaint | null {
442
+ return this.texturePaint;
443
+ }
444
+
445
+ /**
446
+ * @deprecated
447
+ */
448
+ public setTexturePaint(value: TexturePaint | null): void {
449
+ this.texturePaint = value;
450
+ }
451
+
452
+ public getFillStyle(): int {
453
+ return this.fillStyle;
454
+ }
455
+ public setFillStyle(value: int): void {
456
+ this.fillStyle = value;
457
+ }
458
+
459
+ public setStroke(s: BasicStroke): void {
460
+ this.stroke = s;
461
+ }
462
+
463
+ /**
464
+ * For Internal Renderer use
465
+ * @param value
466
+ * ShapeInfo.SHAPE_TYPE_
467
+ *
468
+ */
469
+ public setShapeType(value: int): void {
470
+ this._ShapeType = value;
471
+ }
472
+ /**
473
+ * For Internal Renderer use
474
+ * @return ShapeInfo.SHAPE_TYPE_
475
+ *
476
+ */
477
+ public getShapeType(): int {
478
+ return this._ShapeType;
479
+ }
480
+
481
+ public getPolylines(): Array<Array<Point2D>> {
482
+ return this._Polylines;
483
+ }
484
+
485
+ public setPolylines(value: Array<Array<Point2D>>): void {
486
+ this._Polylines = value;
487
+ }
488
+
489
+ /**
490
+ * @deprecated
491
+ */
492
+ public setShader(value: ImageBitmap): void {
493
+ this._shader = value;
494
+ }
495
+
496
+ /**
497
+ * @deprecated
498
+ */
499
+ public getShader(): ImageBitmap {
500
+ return this._shader;
501
+ }
502
+
503
+ public setPatternFillImage(img: SVGSymbolInfo): void {
504
+ this._patternFillInfo = img;
505
+ }
506
+
507
+ public getPatternFillImage(): string {
508
+ if (this._patternFillInfo)
509
+ return this._patternFillInfo.getSVGDataURI();
510
+ else
511
+ return null;
512
+ }
513
+
514
+ public getPatternFillImageInfo(): SVGSymbolInfo {
515
+ return this._patternFillInfo;
516
+ }
517
+
518
+ public getTextJustify(): int {
519
+ return this._justify;
520
+ }
521
+
522
+ public setTextJustify(value: int): void {
523
+ this._justify = value;
524
+ }
525
+ }
@@ -0,0 +1,55 @@
1
+ import { type int } from "../../graphics2d/BasicTypes";
2
+ import { AffineTransform } from "../../graphics2d/AffineTransform"
3
+ import { Point } from "../../graphics2d/Point"
4
+ import { Point2D } from "../../graphics2d/Point2D"
5
+ import { Rectangle2D } from "../../graphics2d/Rectangle2D"
6
+
7
+ import { Path } from "../shapes/path";
8
+
9
+ /**
10
+ *
11
+ *
12
+ */
13
+ export class ShapeUtilities {
14
+
15
+ public static grow(rect: Rectangle2D, size: int): void
16
+ {
17
+ rect.setRect(rect.getX() - size, rect.getY() - size, rect.getWidth() + (size * 2), rect.getHeight() + (size * 2));
18
+ }
19
+
20
+ public static offset(rect: Rectangle2D, offsetX: number, offsetY: number): void;
21
+
22
+ public static offset(point: Point2D, offsetX: number, offsetY: number): void;
23
+ public static offset(point: Point, offsetX: number, offsetY: number): void;
24
+
25
+ public static offset(path: Path2D, offsetX: number, offsetY: number): void;
26
+ public static offset(...args: unknown[]): void {
27
+
28
+ if(args.length === 3)
29
+ {
30
+ if(args[0] instanceof Rectangle2D)
31
+ {
32
+ const [rect, offsetX, offsetY] = args as [Rectangle2D, number, number];
33
+ rect.setRect(rect.getX() + offsetX, rect.getY() + offsetY, rect.getWidth(), rect.getHeight());
34
+ }
35
+ else if(args[0] instanceof Point2D)
36
+ {
37
+ const [point, offsetX, offsetY] = args as [Point2D, number, number];
38
+ point.setLocation(point.getX() + offsetX, point.getY() + offsetY);
39
+ }
40
+ else if(args[0] instanceof Point)
41
+ {
42
+ const [point, offsetX, offsetY] = args as [Point, number, number];
43
+ point.setLocation(point.getX() + offsetX, point.getY() + offsetY);
44
+ }
45
+ else if(args[0] instanceof Path)
46
+ {
47
+ console.log("ShapeUtilities.offset - Can't offset Path");
48
+ }
49
+ else if(args[0] instanceof Path2D)
50
+ {
51
+ console.log("ShapeUtilities.offset - Can't offset Path2D");
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,36 @@
1
+ import { Point2D } from "../../graphics2d/Point2D"
2
+ import { Rectangle2D } from "../../graphics2d/Rectangle2D"
3
+
4
+ export interface SymbolDimensionInfo {
5
+ /**
6
+ * The x value the image should be centered on or the "anchor point".
7
+ * @return {@link Integer}
8
+ */
9
+ getSymbolCenterX(): number;
10
+
11
+ /**
12
+ * The y value the image should be centered on or the "anchor point".
13
+ * @return {@link Integer}
14
+ */
15
+ getSymbolCenterY(): number;
16
+
17
+ /**
18
+ * The point the image should be centered on or the "anchor point".
19
+ * @return {@link Point2D}
20
+ */
21
+ getSymbolCenterPoint(): Point2D;
22
+
23
+ /**
24
+ * minimum bounding rectangle for the core symbol. Does
25
+ * not include modifiers, display or otherwise.
26
+ * @return {@link Rectangle2D}
27
+ */
28
+ getSymbolBounds(): Rectangle2D;
29
+
30
+ /**
31
+ * Dimension of the entire image.
32
+ * @return {@link Rectangle2D}
33
+ */
34
+
35
+ getImageBounds(): Rectangle2D;
36
+ }