@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,141 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* To change this template, choose Tools | Templates
|
|
3
|
-
* and open the template in the editor.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { type int, type double } from "../graphics2d/BasicTypes";
|
|
8
|
-
|
|
9
|
-
import { AffineTransform } from "../graphics2d/AffineTransform"
|
|
10
|
-
import { Rectangle2D } from "../graphics2d/Rectangle2D"
|
|
11
|
-
import { POINT2 } from "../JavaLineArray/POINT2"
|
|
12
|
-
//import { IPathIterator } from "../graphics2d/IPathIterator"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
export class PathIterator {
|
|
21
|
-
public static readonly SEG_CLOSE: int = 4;
|
|
22
|
-
public static readonly SEG_CUBICTO: int = 3;
|
|
23
|
-
public static readonly SEG_LINETO: int = 1;
|
|
24
|
-
public static readonly SEG_MOVETO: int = 0;
|
|
25
|
-
public static readonly SEG_QUADTO: int = 2;
|
|
26
|
-
public static readonly WIND_EVEN_ODD: int = 0;
|
|
27
|
-
public static readonly WIND_NON_ZERO: int = 1;
|
|
28
|
-
private _currentSeg: int = 0;
|
|
29
|
-
private _pts: Array<POINT2>;
|
|
30
|
-
public constructor(tx: AffineTransform | null) {
|
|
31
|
-
|
|
32
|
-
this._currentSeg = 0;
|
|
33
|
-
this._pts = new Array();
|
|
34
|
-
}
|
|
35
|
-
public getPoints(): Array<POINT2> {
|
|
36
|
-
return this._pts;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public currentSegment(coords: number[]): int {
|
|
40
|
-
let type: int = this._pts[this._currentSeg].style;
|
|
41
|
-
if (type === PathIterator.SEG_LINETO || type === PathIterator.SEG_MOVETO) {
|
|
42
|
-
coords[0] = this._pts[this._currentSeg].x;
|
|
43
|
-
coords[1] = this._pts[this._currentSeg].y;
|
|
44
|
-
} else if (type === PathIterator.SEG_CUBICTO) {
|
|
45
|
-
coords[0] = this._pts[this._currentSeg].x;
|
|
46
|
-
coords[1] = this._pts[this._currentSeg].y;
|
|
47
|
-
this._currentSeg++;
|
|
48
|
-
coords[2] = this._pts[this._currentSeg].x;
|
|
49
|
-
coords[3] = this._pts[this._currentSeg].y;
|
|
50
|
-
this._currentSeg++;
|
|
51
|
-
coords[4] = this._pts[this._currentSeg].x;
|
|
52
|
-
coords[5] = this._pts[this._currentSeg].y;
|
|
53
|
-
} else if (type === PathIterator.SEG_QUADTO) {
|
|
54
|
-
coords[0] = this._pts[this._currentSeg].x;
|
|
55
|
-
coords[1] = this._pts[this._currentSeg].y;
|
|
56
|
-
this._currentSeg++;
|
|
57
|
-
coords[2] = this._pts[this._currentSeg].x;
|
|
58
|
-
coords[3] = this._pts[this._currentSeg].y;
|
|
59
|
-
}
|
|
60
|
-
return type;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public getWindingRule(): int {
|
|
64
|
-
return 1;
|
|
65
|
-
}
|
|
66
|
-
public isDone(): boolean {
|
|
67
|
-
if (this._currentSeg === this._pts.length) {
|
|
68
|
-
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
public next(): void {
|
|
76
|
-
this._currentSeg++;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
//public methods to collect the poins and the moves
|
|
80
|
-
//GeneralPath must call this whenever its getPathIterator method is called to reset the iterator
|
|
81
|
-
public reset(): void {
|
|
82
|
-
this._currentSeg = 0;
|
|
83
|
-
}
|
|
84
|
-
public moveTo(x: double, y: double): void {
|
|
85
|
-
this._pts.push(new POINT2(x, y, PathIterator.SEG_MOVETO));
|
|
86
|
-
}
|
|
87
|
-
public lineTo(x: double, y: double): void {
|
|
88
|
-
this._pts.push(new POINT2(x, y, PathIterator.SEG_LINETO));
|
|
89
|
-
}
|
|
90
|
-
public cubicTo(x1: double, y1: double, x2: double, y2: double, x3: double, y3: double): void {
|
|
91
|
-
this._pts.push(new POINT2(x1, y1, PathIterator.SEG_CUBICTO));
|
|
92
|
-
this._pts.push(new POINT2(x2, y2, PathIterator.SEG_CUBICTO));
|
|
93
|
-
this._pts.push(new POINT2(x3, y3, PathIterator.SEG_CUBICTO));
|
|
94
|
-
}
|
|
95
|
-
public curveTo(x1: double, y1: double, x2: double, y2: double, x3: double, y3: double): void {
|
|
96
|
-
this._pts.push(new POINT2(x1, y1, PathIterator.SEG_CUBICTO));
|
|
97
|
-
this._pts.push(new POINT2(x2, y2, PathIterator.SEG_CUBICTO));
|
|
98
|
-
this._pts.push(new POINT2(x3, y3, PathIterator.SEG_CUBICTO));
|
|
99
|
-
}
|
|
100
|
-
public quadTo(x1: double, y1: double, x2: double, y2: double): void {
|
|
101
|
-
this._pts.push(new POINT2(x1, y1, PathIterator.SEG_QUADTO));
|
|
102
|
-
this._pts.push(new POINT2(x2, y2, PathIterator.SEG_QUADTO));
|
|
103
|
-
}
|
|
104
|
-
public getBounds(): Rectangle2D {
|
|
105
|
-
let j: int = 0;
|
|
106
|
-
let left: double = this._pts[0].x;
|
|
107
|
-
let right: double = this._pts[0].x;
|
|
108
|
-
let top: double = this._pts[0].y;
|
|
109
|
-
let bottom: double = this._pts[0].y;
|
|
110
|
-
let n: int = this._pts.length;
|
|
111
|
-
//for(j=1;j<_pts.length;j++)
|
|
112
|
-
for (j = 1; j < n; j++) {
|
|
113
|
-
if (this._pts[j].x < left) {
|
|
114
|
-
|
|
115
|
-
left = this._pts[j].x;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (this._pts[j].x > right) {
|
|
119
|
-
|
|
120
|
-
right = this._pts[j].x;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this._pts[j].y < top) {
|
|
124
|
-
|
|
125
|
-
top = this._pts[j].y;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (this._pts[j].y > bottom) {
|
|
129
|
-
|
|
130
|
-
bottom = this._pts[j].y;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
let rect: Rectangle2D = new Rectangle2D(left, top, right - left, bottom - top);
|
|
135
|
-
return rect;
|
|
136
|
-
}
|
|
137
|
-
public setPathIterator(pts: Array<POINT2>): void {
|
|
138
|
-
this.reset();
|
|
139
|
-
this._pts = pts;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Point2D } from "./Point2D";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export class Point {
|
|
8
|
-
public x: number = 0;
|
|
9
|
-
public y: number = 0;
|
|
10
|
-
public constructor();
|
|
11
|
-
public constructor(x1: number, y1: number);
|
|
12
|
-
public constructor(...args: unknown[]) {
|
|
13
|
-
switch (args.length) {
|
|
14
|
-
case 0: {
|
|
15
|
-
this.setLocation(0, 0)
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
case 2: {
|
|
20
|
-
const [x1, y1] = args as [number, number];
|
|
21
|
-
this.setLocation(x1, y1)
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
default: {
|
|
26
|
-
throw Error(`Invalid number of arguments`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public getX(): number {
|
|
32
|
-
return this.x;
|
|
33
|
-
}
|
|
34
|
-
public getY(): number {
|
|
35
|
-
return this.y;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public setLocation(x1: number, y1: number): void {
|
|
39
|
-
this.x = Math.trunc(x1);
|
|
40
|
-
this.y = Math.trunc(y1);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Returns a string representing one of the shape types
|
|
44
|
-
* from "armyc2.c2sd.renderer.so.ShapeTypes"
|
|
45
|
-
* @returns {String}
|
|
46
|
-
*/
|
|
47
|
-
public getShapeType(): string {
|
|
48
|
-
return "POINT";//armyc2.c2sd.renderer.so.ShapeTypes.POINT;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* move x & y by specified amounts.
|
|
53
|
-
* @param {Number} x shift x point by this value
|
|
54
|
-
* @param {Number} y shift y point by this value
|
|
55
|
-
* @returns {void}
|
|
56
|
-
*/
|
|
57
|
-
public shift(x: number, y: number): void {
|
|
58
|
-
this.x += x;
|
|
59
|
-
this.y += y;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* @returns {String} like "{x:#,y:#}"
|
|
63
|
-
*/
|
|
64
|
-
public toStringFormatted(): string {
|
|
65
|
-
return "{x:" + this.x + ", y:" + this.y + "}";
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Makes a copy of this point object.
|
|
69
|
-
* @returns {armyc2.c2sd.renderer.so.Point} Copy of original point.
|
|
70
|
-
*/
|
|
71
|
-
public clone(): Point {
|
|
72
|
-
return new Point(this.x, this.y);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
public toPoint2D(): Point2D {
|
|
76
|
-
return new Point2D(this.x, this.y);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @param {OffscreenCanvasRenderingContext2D} context object from html5 canvas
|
|
80
|
-
* @returns {void}
|
|
81
|
-
*/
|
|
82
|
-
public setPath(context: OffscreenCanvasRenderingContext2D): void {
|
|
83
|
-
let x = this.x;
|
|
84
|
-
let y = this.y;
|
|
85
|
-
|
|
86
|
-
//context.beginPath();
|
|
87
|
-
context.moveTo(x, y);
|
|
88
|
-
context.lineTo(x + 1, y);
|
|
89
|
-
context.lineTo(x + 1, y + 1);
|
|
90
|
-
context.lineTo(x, y + 1);
|
|
91
|
-
context.closePath();
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* @param {context} context object from html5 canvas
|
|
96
|
-
* @returns {void}
|
|
97
|
-
*/
|
|
98
|
-
public stroke(context: OffscreenCanvasRenderingContext2D): void {
|
|
99
|
-
context.beginPath();
|
|
100
|
-
this.setPath(context);
|
|
101
|
-
context.stroke();
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* @param {context} context object from html5 canvas
|
|
105
|
-
* @returns {void}
|
|
106
|
-
*/
|
|
107
|
-
public fill(context: OffscreenCanvasRenderingContext2D): void {
|
|
108
|
-
context.beginPath();
|
|
109
|
-
this.setPath(context);
|
|
110
|
-
context.fill();
|
|
111
|
-
};
|
|
112
|
-
}
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* To change this template, choose Tools | Templates
|
|
3
|
-
* and open the template in the editor.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { type double } from "./BasicTypes";
|
|
8
|
-
|
|
9
|
-
import { POINT2 } from "../JavaLineArray/POINT2"
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The <code>Point2D</code> class defines a point representing a location in
|
|
13
|
-
*
|
|
14
|
-
* <p>
|
|
15
|
-
* This class is only the abstract superclass for all objects that store a 2D
|
|
16
|
-
* coordinate. The actual storage representation of the coordinates is left to
|
|
17
|
-
* the subclass.
|
|
18
|
-
*
|
|
19
|
-
* @author Jim Graham
|
|
20
|
-
* @since 1.2
|
|
21
|
-
*/
|
|
22
|
-
export class Point2D {
|
|
23
|
-
/**
|
|
24
|
-
* The X coordinate of this <code>Point2D</code>.
|
|
25
|
-
*
|
|
26
|
-
* @since 1.2
|
|
27
|
-
*/
|
|
28
|
-
public x: double = 0;
|
|
29
|
-
/**
|
|
30
|
-
* The Y coordinate of this <code>Point2D</code>.
|
|
31
|
-
*
|
|
32
|
-
* @since 1.2
|
|
33
|
-
*/
|
|
34
|
-
public y: double = 0;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Constructs and initializes a <code>Point2D</code> with coordinates
|
|
38
|
-
* (0, 0).
|
|
39
|
-
*
|
|
40
|
-
* @since 1.2
|
|
41
|
-
*/
|
|
42
|
-
public constructor();
|
|
43
|
-
/**
|
|
44
|
-
* add the constructor
|
|
45
|
-
* @param pt
|
|
46
|
-
*/
|
|
47
|
-
public constructor(pt: POINT2);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Constructs and initializes a <code>Point2D</code> with the specified
|
|
51
|
-
* coordinates.
|
|
52
|
-
*
|
|
53
|
-
* @param x
|
|
54
|
-
* the X coordinate of the newly constructed
|
|
55
|
-
* <code>Point2D</code>
|
|
56
|
-
* @param y
|
|
57
|
-
* the Y coordinate of the newly constructed
|
|
58
|
-
* <code>Point2D</code>
|
|
59
|
-
* @since 1.2
|
|
60
|
-
*/
|
|
61
|
-
public constructor(x: double, y: double);
|
|
62
|
-
public constructor(...args: unknown[]) {
|
|
63
|
-
switch (args.length) {
|
|
64
|
-
case 0: {
|
|
65
|
-
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
case 1: {
|
|
70
|
-
const [pt] = args as [POINT2];
|
|
71
|
-
|
|
72
|
-
this.x = pt.x;
|
|
73
|
-
this.y = pt.y;
|
|
74
|
-
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
case 2: {
|
|
79
|
-
const [x, y] = args as [double, double];
|
|
80
|
-
|
|
81
|
-
this.x = x;
|
|
82
|
-
this.y = y;
|
|
83
|
-
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
default: {
|
|
88
|
-
throw Error(`Invalid number of arguments`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* {@inheritDoc}
|
|
95
|
-
*
|
|
96
|
-
* @since 1.2
|
|
97
|
-
*/
|
|
98
|
-
public getX(): double {
|
|
99
|
-
return this.x;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* {@inheritDoc}
|
|
104
|
-
*
|
|
105
|
-
* @since 1.2
|
|
106
|
-
*/
|
|
107
|
-
public getY(): double {
|
|
108
|
-
return this.y;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Returns a <code>String</code> that represents the value of this
|
|
113
|
-
* <code>Point2D</code>.
|
|
114
|
-
*
|
|
115
|
-
* @return a string representation of this <code>Point2D</code>.
|
|
116
|
-
* @since 1.2
|
|
117
|
-
*/
|
|
118
|
-
public toString(): string {
|
|
119
|
-
return "Point2D[" + this.x + ", " + this.y + "]";
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public clone(): Point2D
|
|
123
|
-
{
|
|
124
|
-
return new Point2D(this.getX(),this.getY());
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/*
|
|
128
|
-
* JDK 1.6 serialVersionUID
|
|
129
|
-
*/
|
|
130
|
-
private static readonly serialVersionUID: number = 0;//long = 6150783262733311327n;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Sets the location of this <code>Point2D</code> to the same coordinates as
|
|
134
|
-
* the specified <code>Point2D</code> object.
|
|
135
|
-
*
|
|
136
|
-
* @param p
|
|
137
|
-
* the specified <code>Point2D</code> to which to set this
|
|
138
|
-
* <code>Point2D</code>
|
|
139
|
-
* @since 1.2
|
|
140
|
-
*/
|
|
141
|
-
public setLocation(p: Point2D): void;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Sets the location of this <code>Point2D</code> to the specified
|
|
145
|
-
* <code>double</code> coordinates.
|
|
146
|
-
*
|
|
147
|
-
* @param x
|
|
148
|
-
* the new X coordinate of this {Point2D}
|
|
149
|
-
* @param y
|
|
150
|
-
* the new Y coordinate of this {Point2D}
|
|
151
|
-
* @since 1.2
|
|
152
|
-
*/
|
|
153
|
-
public setLocation(x: double, y: double): void;
|
|
154
|
-
public setLocation(...args: unknown[]): void {
|
|
155
|
-
switch (args.length) {
|
|
156
|
-
case 1: {
|
|
157
|
-
const [p] = args as [Point2D];
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.setLocation(p.getX(), p.getY());
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
case 2: {
|
|
167
|
-
const [x, y] = args as [double, double];
|
|
168
|
-
this.x = x;
|
|
169
|
-
this.y = y;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
default: {
|
|
176
|
-
throw Error(`Invalid number of arguments`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Returns the square of the distance between two points.
|
|
184
|
-
*
|
|
185
|
-
* @param x1
|
|
186
|
-
* the X coordinate of the first specified point
|
|
187
|
-
* @param y1
|
|
188
|
-
* the Y coordinate of the first specified point
|
|
189
|
-
* @param x2
|
|
190
|
-
* the X coordinate of the second specified point
|
|
191
|
-
* @param y2
|
|
192
|
-
* the Y coordinate of the second specified point
|
|
193
|
-
* @return the square of the distance between the two sets of specified
|
|
194
|
-
* coordinates.
|
|
195
|
-
* @since 1.2
|
|
196
|
-
*/
|
|
197
|
-
public static distanceSq(x1: double, y1: double, x2: double, y2: double): double {
|
|
198
|
-
x1 -= x2;
|
|
199
|
-
y1 -= y2;
|
|
200
|
-
return (x1 * x1 + y1 * y1);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Returns the distance between two points.
|
|
205
|
-
*
|
|
206
|
-
* @param x1
|
|
207
|
-
* the X coordinate of the first specified point
|
|
208
|
-
* @param y1
|
|
209
|
-
* the Y coordinate of the first specified point
|
|
210
|
-
* @param x2
|
|
211
|
-
* the X coordinate of the second specified point
|
|
212
|
-
* @param y2
|
|
213
|
-
* the Y coordinate of the second specified point
|
|
214
|
-
* @return the distance between the two sets of specified coordinates.
|
|
215
|
-
* @since 1.2
|
|
216
|
-
*/
|
|
217
|
-
public static distance(x1: double, y1: double, x2: double, y2: double): double {
|
|
218
|
-
x1 -= x2;
|
|
219
|
-
y1 -= y2;
|
|
220
|
-
return Math.sqrt(x1 * x1 + y1 * y1);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Returns the distance from this <code>Point2D</code> to
|
|
225
|
-
* a specified point.
|
|
226
|
-
*
|
|
227
|
-
* @param px the X coordinate of the specified point to be measured
|
|
228
|
-
* against this <code>Point2D</code>
|
|
229
|
-
* @param py the Y coordinate of the specified point to be measured
|
|
230
|
-
* against this <code>Point2D</code>
|
|
231
|
-
* @return the distance between this <code>Point2D</code>
|
|
232
|
-
* and a specified point.
|
|
233
|
-
* @since 1.2
|
|
234
|
-
*/
|
|
235
|
-
public distance(px: double, py: double) {
|
|
236
|
-
px -= this.getX();
|
|
237
|
-
py -= this.getY();
|
|
238
|
-
return Math.sqrt(px * px + py * py);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Determines whether or not two points are equal. Two instances of
|
|
243
|
-
* <code>Point2D</code> are equal if the values of their <code>x</code> and
|
|
244
|
-
* <code>y</code> member fields, representing their position in the
|
|
245
|
-
* coordinate space, are the same.
|
|
246
|
-
*
|
|
247
|
-
* @param obj
|
|
248
|
-
* an object to be compared with this <code>Point2D</code>
|
|
249
|
-
* @return <code>true</code> if the object to be compared is an instance of
|
|
250
|
-
* <code>Point2D</code> and has the same values; <code>false</code>
|
|
251
|
-
* otherwise.
|
|
252
|
-
* @since 1.2
|
|
253
|
-
*/
|
|
254
|
-
public equals(obj: Point2D): boolean {
|
|
255
|
-
if (obj instanceof Point2D) {
|
|
256
|
-
let p2d: Point2D = obj as Point2D;
|
|
257
|
-
return (this.getX() === p2d.getX()) && (this.getY() === p2d.getY());
|
|
258
|
-
}
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
}
|