@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.
- package/LICENSE +201 -0
- package/README.md +57 -0
- package/buildNode.bat +2 -0
- package/buildWeb.bat +2 -0
- package/dist/C5Ren.d.ts +6970 -0
- package/dist/C5Ren.js +2 -0
- package/dist/C5Ren.js.map +1 -0
- package/dist/LICENSE +201 -0
- package/dist/README.md +57 -0
- package/dist/armyc2.c5isr.renderer-mil-sym-ts-web-2.2.0.tgz +0 -0
- package/dist/manifest.json +4 -0
- package/dist/package.json +16 -0
- package/index.ts +169 -0
- package/package.bak +50 -0
- package/package.json +40 -0
- package/package.node.json +43 -0
- package/package.pack.json +19 -0
- package/package.packWeb.json +16 -0
- package/package.web.json +40 -0
- package/src/main/ts/android/graphics/Bitmap.ts +7 -0
- package/src/main/ts/android/graphics/Paint.ts +26 -0
- package/src/main/ts/android/graphics/Path.ts +78 -0
- package/src/main/ts/android/graphics/PointF.ts +14 -0
- package/src/main/ts/android/graphics/Rect.ts +18 -0
- package/src/main/ts/android/graphics/RectF.ts +50 -0
- package/src/main/ts/android/graphics/Region.ts +36 -0
- package/src/main/ts/android/graphics/Typeface.ts +11 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/BasicShapes.ts +99 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CChannelPoints2.ts +34 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/CELineArray.ts +193 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Channels.ts +2971 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/DISMSupport.ts +4008 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/POINT2.ts +93 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/Shape2.ts +89 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/TacticalLines.ts +515 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/arraysupport.ts +5403 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/countsupport.ts +1084 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/flot.ts +2173 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/lineutility.ts +4934 -0
- package/src/main/ts/armyc2/c5isr/JavaLineArray/ref.ts +7 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/Modifier2.ts +5601 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/P1.ts +14 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/TGLight.ts +648 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsChannelUtility.ts +647 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsMETOC.ts +2994 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/clsUtility.ts +2663 -0
- package/src/main/ts/armyc2/c5isr/JavaTacticalRenderer/mdlGeodesic.ts +669 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipPolygon2.ts +971 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsClipQuad.ts +871 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer.ts +3507 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsRenderer2.ts +500 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtility.ts +1089 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityCPOF.ts +2656 -0
- package/src/main/ts/armyc2/c5isr/RenderMultipoints/clsUtilityGE.ts +1419 -0
- package/src/main/ts/armyc2/c5isr/data/genc.json +1407 -0
- package/src/main/ts/armyc2/c5isr/data/msd.json +17311 -0
- package/src/main/ts/armyc2/c5isr/data/mse.json +18500 -0
- package/src/main/ts/armyc2/c5isr/data/svgd.json +31214 -0
- package/src/main/ts/armyc2/c5isr/data/svge.json +30558 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/AffineTransform.ts +10 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Area.ts +437 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicStroke.ts +429 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BasicTypes.ts +7 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/BufferedImage.ts +35 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Font.ts +111 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontMetrics.ts +29 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/FontRenderContext.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/GeneralPath.ts +211 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Graphics2D.ts +80 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/IPathIterator.ts +33 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/ImageIO.ts +16 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Line2D.ts +726 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/PathIterator.ts +141 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point.ts +112 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Point2D.ts +261 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Polygon.ts +391 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle.ts +567 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Rectangle2D.ts +445 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Shape.ts +31 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/Stroke.ts +18 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TextLayout.ts +45 -0
- package/src/main/ts/armyc2/c5isr/graphics2d/TexturePaint.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/IIconRenderer.ts +15 -0
- package/src/main/ts/armyc2/c5isr/renderer/IconRenderer.ts +22 -0
- package/src/main/ts/armyc2/c5isr/renderer/MilStdIconRenderer.ts +269 -0
- package/src/main/ts/armyc2/c5isr/renderer/ModifierRenderer.ts +9882 -0
- package/src/main/ts/armyc2/c5isr/renderer/PatternFillRenderer.ts +146 -0
- package/src/main/ts/armyc2/c5isr/renderer/SinglePointSVGRenderer.ts +1265 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/arc.ts +64 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/bcurve.ts +95 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/ellipse.ts +93 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/line.ts +114 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/path.ts +555 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/pathiterator.ts +62 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/point.ts +120 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/rectangle.ts +431 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/roundedrectangle.ts +99 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/types.ts +25 -0
- package/src/main/ts/armyc2/c5isr/renderer/shapes/utilities.ts +203 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/AffiliationColors.ts +104 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Color.ts +481 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DistanceUnit.ts +40 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/DrawRules.ts +1323 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/EntityCode.ts +51 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ErrorLogger.ts +736 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GENCLookup.ts +106 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/GeoPixelConversion3D.ts +84 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IMultiPointRenderer.ts +87 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/IPointConversion.ts +34 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ImageInfo.ts +324 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUCache.ts +127 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LRUEntry.ts +18 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/LogLevel.ts +111 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MODrawRules.ts +219 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSInfo.ts +1008 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MSLookup.ts +882 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdAttributes.ts +380 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/MilStdSymbol.ts +797 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Modifiers.ts +1699 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversion.ts +178 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConversionDummy.ts +45 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/PointConverter3D.ts +126 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RectUtilities.ts +118 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererException.ts +11 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererSettings.ts +1201 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/RendererUtilities.ts +591 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGInfo.ts +29 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGLookup.ts +753 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGSymbolInfo.ts +137 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SVGTextInfo.ts +438 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEvent.ts +19 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsChangedEventListener.ts +10 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SettingsEventListener.ts +5 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/Shape2SVG.ts +404 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeInfo.ts +525 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/ShapeUtilities.ts +55 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolDimensionInfo.ts +36 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolID.ts +1055 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/SymbolUtilities.ts +2085 -0
- package/src/main/ts/armyc2/c5isr/renderer/utilities/TextInfo.ts +157 -0
- package/src/main/ts/armyc2/c5isr/web/render/GeoPixelConversion.ts +86 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandler.ts +3798 -0
- package/src/main/ts/armyc2/c5isr/web/render/MultiPointHandlerSVG.ts +412 -0
- package/src/main/ts/armyc2/c5isr/web/render/PointConverter.ts +124 -0
- package/src/main/ts/armyc2/c5isr/web/render/SymbolModifiers.ts +26 -0
- package/src/main/ts/armyc2/c5isr/web/render/WebRenderer.ts +677 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/JavaRendererUtilities.ts +484 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/LineInfo.ts +62 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/SymbolInfo.ts +46 -0
- package/src/main/ts/armyc2/c5isr/web/render/utilities/TextInfo.ts +51 -0
- package/src/main/ts/org/gavaghan/geodesy/Angle.ts +31 -0
- package/src/main/ts/org/gavaghan/geodesy/Ellipsoid.ts +71 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCalculator.ts +200 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticCurve.ts +55 -0
- package/src/main/ts/org/gavaghan/geodesy/GeodeticMeasurement.ts +68 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalCoordinates.ts +103 -0
- package/src/main/ts/org/gavaghan/geodesy/GlobalPosition.ts +90 -0
- package/test/ExportSPImages.js +692 -0
- package/test/MPWW.html +556 -0
- package/test/MPWorker.js +318 -0
- package/test/SPWorker.js +233 -0
- package/test/SVGWW.html +363 -0
- package/test/singlePointTester3.html +751 -0
- package/tsconfig.json +54 -0
- package/typedoc.json +30 -0
- package/updateVersion.js +21 -0
- package/webpack.config.js +34 -0
- package/webpackn.config.js +28 -0
- package/webpackr.config.js +47 -0
- package/webpackw.config.js +23 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type double, type int } from "../graphics2d/BasicTypes";
|
|
7
|
+
|
|
8
|
+
import { Line2D } from "../graphics2d/Line2D"
|
|
9
|
+
import { Point2D } from "../graphics2d/Point2D"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export class Rectangle2D {
|
|
16
|
+
public x: double = 0;
|
|
17
|
+
public y: double = 0;
|
|
18
|
+
public width: double = 0;
|
|
19
|
+
public height: double = 0;
|
|
20
|
+
|
|
21
|
+
public add(newx: double, newy: double): void {
|
|
22
|
+
const x1 = Math.min(this.getMinX(), newx);
|
|
23
|
+
const x2 = Math.max(this.getMaxX(), newx);
|
|
24
|
+
const y1 = Math.min(this.getMinY(), newy);
|
|
25
|
+
const y2 = Math.max(this.getMaxY(), newy);
|
|
26
|
+
this.setRect(x1, y1, x2 - x1, y2 - y1);
|
|
27
|
+
}
|
|
28
|
+
public createIntersection(r: Rectangle2D): Rectangle2D | null {
|
|
29
|
+
if (r.x > this.x + this.width) {
|
|
30
|
+
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (r.x + r.width < this.x) {
|
|
35
|
+
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (r.y > this.y + this.height) {
|
|
40
|
+
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (r.y + r.height < this.y) {
|
|
45
|
+
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (r.contains(this)) {
|
|
50
|
+
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (this.contains(r)) {
|
|
55
|
+
|
|
56
|
+
return r;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
//if it gets to this point we have a normal intersection
|
|
61
|
+
let x1: double = 0;
|
|
62
|
+
let y1: double = 0;
|
|
63
|
+
let x2: double = 0;
|
|
64
|
+
let y2: double = 0;
|
|
65
|
+
if (this.x < r.x) {
|
|
66
|
+
x1 = r.x;
|
|
67
|
+
x2 = this.x + this.width;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
x1 = this.x;
|
|
71
|
+
x2 = r.x + r.width;
|
|
72
|
+
}
|
|
73
|
+
if (this.y < r.y) {
|
|
74
|
+
y1 = r.y;
|
|
75
|
+
y2 = this.y + this.height;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
y1 = this.y;
|
|
79
|
+
y2 = r.y + r.height;
|
|
80
|
+
}
|
|
81
|
+
return new Rectangle2D(x1, y1, x2 - x1, y2 - y1);
|
|
82
|
+
}
|
|
83
|
+
public createUnion(r: Rectangle2D): Rectangle2D
|
|
84
|
+
{
|
|
85
|
+
let temp:Rectangle2D = this.clone();
|
|
86
|
+
temp.union(r);
|
|
87
|
+
return temp;
|
|
88
|
+
}
|
|
89
|
+
public getX(): double {
|
|
90
|
+
return this.x;
|
|
91
|
+
}
|
|
92
|
+
public getY(): double {
|
|
93
|
+
return this.y;
|
|
94
|
+
}
|
|
95
|
+
public getCenterX(): double {
|
|
96
|
+
return (this.x + this.width) / 2;
|
|
97
|
+
}
|
|
98
|
+
public getCenterY(): double {
|
|
99
|
+
return (this.y + this.height) / 2;
|
|
100
|
+
}
|
|
101
|
+
public getMinX(): double {
|
|
102
|
+
return this.x;
|
|
103
|
+
}
|
|
104
|
+
public getMinY(): double {
|
|
105
|
+
return this.y;
|
|
106
|
+
}
|
|
107
|
+
public getMaxX(): double {
|
|
108
|
+
return this.x + this.width;
|
|
109
|
+
}
|
|
110
|
+
public getMaxY(): double {
|
|
111
|
+
return this.y + this.height;
|
|
112
|
+
}
|
|
113
|
+
public getHeight(): double {
|
|
114
|
+
return this.height;
|
|
115
|
+
}
|
|
116
|
+
public getWidth(): double {
|
|
117
|
+
return this.width;
|
|
118
|
+
}
|
|
119
|
+
public contains(rect: Rectangle2D): boolean;
|
|
120
|
+
public contains(pt: Point2D): boolean;
|
|
121
|
+
public contains(x1: double, y1: double): boolean;
|
|
122
|
+
public contains(x: int, y: int, width: int, height: int): boolean;
|
|
123
|
+
public contains(...args: unknown[]): boolean {
|
|
124
|
+
switch (args.length) {
|
|
125
|
+
case 1: {
|
|
126
|
+
if (args[0] instanceof Rectangle2D) {
|
|
127
|
+
const [rect] = args as [Rectangle2D];
|
|
128
|
+
|
|
129
|
+
let x1: double = rect.getX();
|
|
130
|
+
let y1: double = rect.getY();
|
|
131
|
+
if (this.contains(x1, y1)) {
|
|
132
|
+
x1 += rect.getWidth();
|
|
133
|
+
y1 += rect.getHeight();
|
|
134
|
+
if (this.contains(x1, y1)) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
} else {
|
|
140
|
+
const [pt] = args as [Point2D];
|
|
141
|
+
|
|
142
|
+
if (this.x <= pt.getX() && pt.getX() <= this.x + this.width) {
|
|
143
|
+
|
|
144
|
+
if (this.y <= pt.getY() && pt.getY() <= this.y + this.height) {
|
|
145
|
+
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
case 2: {
|
|
154
|
+
const [x1, y1] = args as [double, double];
|
|
155
|
+
|
|
156
|
+
if (this.x <= x1 && x1 <= this.x + this.width &&
|
|
157
|
+
this.y <= y1 && y1 <= this.y + this.height) {
|
|
158
|
+
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
else {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
case 4: {
|
|
168
|
+
const [x, y, width, height] = args as [int, int, int, int];
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
let x1: double = x;
|
|
172
|
+
let y1: double = y;
|
|
173
|
+
if (this.contains(x1, y1)) {
|
|
174
|
+
x1 += width;
|
|
175
|
+
y1 += height;
|
|
176
|
+
if (this.contains(x1, y1)) {
|
|
177
|
+
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
default: {
|
|
186
|
+
throw Error(`Invalid number of arguments`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
public intersects(rect: Rectangle2D): boolean;
|
|
192
|
+
public intersects(x1: int, y1: int, width1: int, height1: int): boolean;
|
|
193
|
+
public intersects(...args: unknown[]): boolean {
|
|
194
|
+
switch (args.length) {
|
|
195
|
+
case 1: {
|
|
196
|
+
const [rect] = args as [Rectangle2D];
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
if (this.x + this.width < rect.x) {
|
|
200
|
+
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (this.x > rect.x + rect.width) {
|
|
205
|
+
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (this.y + this.height < rect.y) {
|
|
210
|
+
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (this.y > rect.y + rect.height) {
|
|
215
|
+
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return true;
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
case 4: {
|
|
227
|
+
const [x1, y1, width1, height1] = args as [int, int, int, int];
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
if (this.x + this.width < x1) {
|
|
231
|
+
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (this.x > x1 + width1) {
|
|
236
|
+
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (this.y + this.height < y1) {
|
|
241
|
+
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (this.y > y1 + height1) {
|
|
246
|
+
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
return true;
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
default: {
|
|
258
|
+
throw Error(`Invalid number of arguments`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public intersectsLine(line: Line2D): boolean {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
public isEmpty(): boolean {
|
|
267
|
+
if (this.width === 0 && this.height === 0) {
|
|
268
|
+
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
else {
|
|
273
|
+
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
public setRect(r: Rectangle2D): void;
|
|
279
|
+
public setRect(x1: double, y1: double, width1: double, height1: double): void;
|
|
280
|
+
public setRect(...args: unknown[]): void {
|
|
281
|
+
switch (args.length) {
|
|
282
|
+
case 1: {
|
|
283
|
+
const [r] = args as [Rectangle2D];
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
this.x = r.getX();
|
|
287
|
+
this.y = r.getY();
|
|
288
|
+
this.width = r.getWidth();
|
|
289
|
+
this.height = r.getHeight();
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
case 4: {
|
|
296
|
+
const [x1, y1, width1, height1] = args as [double, double, double, double];
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
this.x = x1;
|
|
300
|
+
this.y = y1;
|
|
301
|
+
this.width = width1;
|
|
302
|
+
this.height = height1;
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
default: {
|
|
309
|
+
throw Error(`Invalid number of arguments`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
public grow(size: int);
|
|
315
|
+
public grow(h: int, v: int);
|
|
316
|
+
public grow(...args: unknown[]) {
|
|
317
|
+
switch (args.length) {
|
|
318
|
+
case 1:
|
|
319
|
+
{
|
|
320
|
+
const [size] = args as [int];
|
|
321
|
+
this.x = this.x - size;
|
|
322
|
+
this.y = this.y - size;
|
|
323
|
+
this.width = this.width + (2 * size);
|
|
324
|
+
this.height = this.height + (2 * size);
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case 2:
|
|
328
|
+
{
|
|
329
|
+
const [h, v] = args as [int, int];
|
|
330
|
+
this.x = this.x - h;
|
|
331
|
+
this.y = this.y - v;
|
|
332
|
+
this.width = this.width + (2 * h);
|
|
333
|
+
this.height = this.height + (2 * v);
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
public stroke(context: OffscreenCanvasRenderingContext2D) {
|
|
340
|
+
context.strokeRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
|
341
|
+
};
|
|
342
|
+
public fill(context: OffscreenCanvasRenderingContext2D) {
|
|
343
|
+
context.fillRect(this.getX(), this.getY(), this.getWidth(), this.getHeight());
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
public clone(): Rectangle2D {
|
|
347
|
+
return new Rectangle2D(this.x, this.y, this.width, this.height);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Will merge the bounds of two rectangle.
|
|
352
|
+
* @param rect
|
|
353
|
+
*/
|
|
354
|
+
public union(rect: Rectangle2D) {
|
|
355
|
+
let thisBR: Point2D = new Point2D(this.x + this.width, this.y + this.height);
|
|
356
|
+
let rectBR: Point2D = new Point2D(rect.x + rect.width, rect.y + rect.height);
|
|
357
|
+
let x:number;
|
|
358
|
+
let y:number;
|
|
359
|
+
let bottom:number;
|
|
360
|
+
let right:number;
|
|
361
|
+
if (rect) {
|
|
362
|
+
if (rect.y < this.y)
|
|
363
|
+
y = rect.y;
|
|
364
|
+
else
|
|
365
|
+
y = this.y;
|
|
366
|
+
if (rect.x < this.x)
|
|
367
|
+
x = rect.x;
|
|
368
|
+
else
|
|
369
|
+
x = this.x;
|
|
370
|
+
if (rectBR.getY() > thisBR.getY())
|
|
371
|
+
bottom = rectBR.getY();
|
|
372
|
+
else
|
|
373
|
+
bottom = thisBR.getY();
|
|
374
|
+
if (rectBR.getX() > thisBR.getX())
|
|
375
|
+
right = rectBR.getX();
|
|
376
|
+
else
|
|
377
|
+
right = thisBR.getX();
|
|
378
|
+
|
|
379
|
+
this.setRect(x,y,right-x, bottom-y);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
public constructor();
|
|
385
|
+
public constructor(x1: double, y1: double, width1: double, height1: double);
|
|
386
|
+
public constructor(...args: unknown[]) {
|
|
387
|
+
switch (args.length) {
|
|
388
|
+
case 0: {
|
|
389
|
+
|
|
390
|
+
this.x = 0;
|
|
391
|
+
this.y = 0;
|
|
392
|
+
this.width = 0;
|
|
393
|
+
this.height = 0;
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
case 4: {
|
|
400
|
+
const [x1, y1, width1, height1] = args as [double, double, double, double];
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
this.x = x1;
|
|
404
|
+
this.y = y1;
|
|
405
|
+
this.width = width1;
|
|
406
|
+
this.height = height1;
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
default: {
|
|
413
|
+
throw Error(`Invalid number of arguments`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
*
|
|
420
|
+
* @param stroke named color or hex color
|
|
421
|
+
* @param strokeWidth width of line in # of pixels
|
|
422
|
+
* @param fill named color or hex color
|
|
423
|
+
* @returns
|
|
424
|
+
*/
|
|
425
|
+
public toSVGElement(stroke: string | null, strokeWidth: number, fill: string | null): string {
|
|
426
|
+
var line = '<rect x="' + this.x + '" y="' + this.y;
|
|
427
|
+
line += '" width="' + this.width + '" height="' + this.height + '"';
|
|
428
|
+
|
|
429
|
+
if (strokeWidth)
|
|
430
|
+
line += ' stroke-width="' + strokeWidth + '"';
|
|
431
|
+
else if (stroke)
|
|
432
|
+
line += ' stroke-width="2"';
|
|
433
|
+
|
|
434
|
+
if (stroke)
|
|
435
|
+
line += ' stroke="' + stroke + '"';
|
|
436
|
+
|
|
437
|
+
if (fill)
|
|
438
|
+
line += ' fill="' + fill + '"';
|
|
439
|
+
else
|
|
440
|
+
line += ' fill="none"';
|
|
441
|
+
|
|
442
|
+
line += '/>';
|
|
443
|
+
return line;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type int, type double } from "../graphics2d/BasicTypes";
|
|
7
|
+
|
|
8
|
+
import { AffineTransform } from "../graphics2d/AffineTransform"
|
|
9
|
+
import { PathIterator } from "../graphics2d/PathIterator"
|
|
10
|
+
import { Point2D } from "../graphics2d/Point2D"
|
|
11
|
+
|
|
12
|
+
import { Rectangle } from "../graphics2d/Rectangle"
|
|
13
|
+
import { Rectangle2D } from "../graphics2d/Rectangle2D"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export interface Shape {
|
|
23
|
+
contains(x: int, y: int): boolean;
|
|
24
|
+
contains(x: int, y: int, width: int, height: int): boolean;
|
|
25
|
+
contains(pt: Point2D): boolean;
|
|
26
|
+
getBounds2D(): Rectangle2D;
|
|
27
|
+
getBounds(): Rectangle;
|
|
28
|
+
intersects(x: double, y: double, w: double, h: double): boolean;
|
|
29
|
+
intersects(rect: Rectangle2D): boolean;
|
|
30
|
+
getPathIterator(at: AffineTransform | null): PathIterator;
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { Shape } from "../graphics2d/Shape"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
//import android.graphics.drawable.shapes.Shape;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export interface Stroke {
|
|
17
|
+
createStrokedShape(s: Shape): Shape;
|
|
18
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type float, type int } from "../graphics2d/BasicTypes";
|
|
7
|
+
|
|
8
|
+
import { AffineTransform } from "../graphics2d/AffineTransform"
|
|
9
|
+
import { Font } from "../graphics2d/Font"
|
|
10
|
+
import { FontRenderContext } from "../graphics2d/FontRenderContext"
|
|
11
|
+
import { GeneralPath } from "../graphics2d/GeneralPath"
|
|
12
|
+
import { Rectangle } from "../graphics2d/Rectangle"
|
|
13
|
+
import { Shape } from "../graphics2d/Shape"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
//import android.graphics.drawable.shapes.Shape;
|
|
17
|
+
//import android.graphics.drawable.shapes.PathShape;
|
|
18
|
+
//import android.graphics.Path;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export class TextLayout {
|
|
24
|
+
protected _font: Font;
|
|
25
|
+
protected _str: string = "";
|
|
26
|
+
public constructor(s: string, font: Font, frc: FontRenderContext) {
|
|
27
|
+
|
|
28
|
+
this._font = font;
|
|
29
|
+
this._str = s;
|
|
30
|
+
//return;
|
|
31
|
+
}
|
|
32
|
+
public getOutline(tx: AffineTransform | null): Shape {
|
|
33
|
+
return new GeneralPath();
|
|
34
|
+
}
|
|
35
|
+
//used by ShapeInfo
|
|
36
|
+
public getPixelBounds(frc: FontRenderContext, x: float, y: float): null {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
public getBounds(): Rectangle {
|
|
40
|
+
let width: int = this._font.getSize() / 2 * this._str.length;
|
|
41
|
+
let height: int = this._font.getSize();
|
|
42
|
+
let rect: Rectangle = new Rectangle(0, 0, width, height);
|
|
43
|
+
return rect;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { Graphics2D } from "../graphics2d/Graphics2D"
|
|
8
|
+
import { Rectangle2D } from "../graphics2d/Rectangle2D"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
//import android.graphics.RectF;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
17
|
+
export class TexturePaint {
|
|
18
|
+
private _rect: Rectangle2D | null;
|
|
19
|
+
private _g2d: Graphics2D;
|
|
20
|
+
private _bi: ImageBitmap;
|
|
21
|
+
public constructor(bi: ImageBitmap, rect: Rectangle2D | null) {
|
|
22
|
+
this._rect = rect;
|
|
23
|
+
this._bi = bi;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ImageInfo } from "../renderer/utilities/ImageInfo"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
export interface IIconRenderer {
|
|
8
|
+
|
|
9
|
+
CanRender(symbolID: string, modifiers: Map<string, string>): boolean;
|
|
10
|
+
|
|
11
|
+
RenderIcon(symbolID: string, modifiers: Map<string, string>): ImageInfo;
|
|
12
|
+
|
|
13
|
+
getRendererID(): string;
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IIconRenderer } from "../renderer/IIconRenderer"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* this class managers all other iconRenderers
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
export class IconRenderer {
|
|
8
|
+
|
|
9
|
+
public constructor() {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public addRenderer(renderer: IIconRenderer): void {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public CanRender(symbolID: string, modifiers: Map<string, string>, rendererID: string): null {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public RenderIcon(symbolID: string, modifiers: Map<string, string>, rendererID: string): null {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|