@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,429 @@
|
|
|
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 float, type double } from "../graphics2d/BasicTypes";
|
|
8
|
+
|
|
9
|
+
import { GeneralPath } from "../graphics2d/GeneralPath"
|
|
10
|
+
import { Polygon } from "../graphics2d/Polygon"
|
|
11
|
+
import { Shape } from "../graphics2d/Shape"
|
|
12
|
+
import { Stroke } from "../graphics2d/Stroke"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import { arraysupport } from "../JavaLineArray/arraysupport"
|
|
16
|
+
import { lineutility } from "../JavaLineArray/lineutility"
|
|
17
|
+
import { POINT2 } from "../JavaLineArray/POINT2"
|
|
18
|
+
import { ref } from "../JavaLineArray/ref"
|
|
19
|
+
import { TacticalLines } from "../JavaLineArray/TacticalLines"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export class BasicStroke implements Stroke {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Joins path segments by extending their outside edges until they meet.
|
|
32
|
+
*/
|
|
33
|
+
public static readonly JOIN_MITER: int = 0;
|
|
34
|
+
/**
|
|
35
|
+
* Joins path segments by rounding off the corner at a radius of half the
|
|
36
|
+
* line width.
|
|
37
|
+
*/
|
|
38
|
+
public static readonly JOIN_ROUND: int = 1;
|
|
39
|
+
/**
|
|
40
|
+
* Joins path segments by connecting the outer corners of their wide
|
|
41
|
+
* outlines with a straight segment.
|
|
42
|
+
*/
|
|
43
|
+
public static readonly JOIN_BEVEL: int = 2;
|
|
44
|
+
/**
|
|
45
|
+
* Ends unclosed subpaths and dash segments with no added decoration.
|
|
46
|
+
*/
|
|
47
|
+
public static readonly CAP_BUTT: int = 0;
|
|
48
|
+
/**
|
|
49
|
+
* Ends unclosed subpaths and dash segments with a round decoration that has
|
|
50
|
+
* a radius equal to half of the width of the pen.
|
|
51
|
+
*/
|
|
52
|
+
public static readonly CAP_ROUND: int = 1;
|
|
53
|
+
/**
|
|
54
|
+
* Ends unclosed subpaths and dash segments with a square projection that
|
|
55
|
+
* extends beyond the end of the segment to a distance equal to half of the
|
|
56
|
+
* line width.
|
|
57
|
+
*/
|
|
58
|
+
public static readonly CAP_SQUARE: int = 2;
|
|
59
|
+
protected width: float;
|
|
60
|
+
protected join: int = 0;
|
|
61
|
+
protected cap: int = 0;
|
|
62
|
+
protected miterlimit: float;
|
|
63
|
+
protected dash: float[] | null;
|
|
64
|
+
protected dash_phase: float;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Constructs a new <code>BasicStroke</code> with defaults for all
|
|
68
|
+
* attributes. The default attributes are a solid line of width 1.0,
|
|
69
|
+
* CAP_SQUARE, JOIN_MITER, a miter limit of 10.0.
|
|
70
|
+
*/
|
|
71
|
+
public constructor();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Constructs a solid <code>BasicStroke</code> with the specified line width
|
|
75
|
+
* and with default values for the cap and join styles.
|
|
76
|
+
*
|
|
77
|
+
* @param width
|
|
78
|
+
* the width of the <code>BasicStroke</code>
|
|
79
|
+
* @throws IllegalArgumentException
|
|
80
|
+
* if <code>width</code> is negative
|
|
81
|
+
*/
|
|
82
|
+
public constructor(width: float);
|
|
83
|
+
|
|
84
|
+
public constructor(width: float, cap: int, join: int);
|
|
85
|
+
|
|
86
|
+
public constructor(width: float, cap: int, join: int, miterlimit: float);
|
|
87
|
+
|
|
88
|
+
public constructor(width: float, cap: int, join: int, miterlimit: float, dash: float[] | null, dash_phase: float);
|
|
89
|
+
|
|
90
|
+
public constructor(width: float = 1.0, cap: int = BasicStroke.CAP_SQUARE, join: int = BasicStroke.JOIN_MITER, miterlimit: float = 10, dash: float[] | null = null, dash_phase: float = 0) {
|
|
91
|
+
if (width < 0.0) {
|
|
92
|
+
throw Error("negative width");
|
|
93
|
+
}
|
|
94
|
+
if (cap !== BasicStroke.CAP_BUTT && cap !== BasicStroke.CAP_ROUND && cap !== BasicStroke.CAP_SQUARE) {
|
|
95
|
+
throw Error("illegal end cap value");
|
|
96
|
+
}
|
|
97
|
+
if (join === BasicStroke.JOIN_MITER) {
|
|
98
|
+
if (miterlimit < 1.0) {
|
|
99
|
+
throw Error("miter limit < 1");
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (join !== BasicStroke.JOIN_ROUND && join !== BasicStroke.JOIN_BEVEL) {
|
|
103
|
+
throw Error("illegal line join value");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (dash != null) {
|
|
108
|
+
if (dash_phase < 0.0) {
|
|
109
|
+
throw Error("negative dash phase");
|
|
110
|
+
}
|
|
111
|
+
let allzero: boolean = true;
|
|
112
|
+
let n: int = 0;
|
|
113
|
+
if (dash != null)
|
|
114
|
+
n = dash.length;
|
|
115
|
+
//for (int i = 0; i < dash.length; i++)
|
|
116
|
+
for (let i: int = 0; i < n; i++) {
|
|
117
|
+
let d: float = dash[i];
|
|
118
|
+
if (d > 0.0) {
|
|
119
|
+
allzero = false;
|
|
120
|
+
} else {
|
|
121
|
+
if (d < 0.0) {
|
|
122
|
+
throw Error("negative dash length");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
if (allzero) {
|
|
128
|
+
throw Error("dash lengths all zero");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
this.width = width;
|
|
132
|
+
this.cap = cap;
|
|
133
|
+
this.join = join;
|
|
134
|
+
this.miterlimit = miterlimit;
|
|
135
|
+
if (dash != null) {
|
|
136
|
+
//this.dash = dash.clone() as number[];
|
|
137
|
+
this.dash = dash.map((x) => x);//clones an array; https://www.freecodecamp.org/news/how-to-clone-an-array-in-javascript-1d3183468f6a/
|
|
138
|
+
}
|
|
139
|
+
this.dash_phase = dash_phase;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Returns a <code>Shape</code> whose interior defines the stroked outline
|
|
145
|
+
* of a specified <code>Shape</code>.
|
|
146
|
+
*
|
|
147
|
+
* @param s
|
|
148
|
+
* the <code>Shape</code> boundary be stroked
|
|
149
|
+
* @return the <code>Shape</code> of the stroked outline.
|
|
150
|
+
*/
|
|
151
|
+
public createStrokedShape(poly: Polygon): Shape {
|
|
152
|
+
let pts: Array<POINT2> = poly.getPathIterator(null).getPoints();
|
|
153
|
+
let j: int = 0;
|
|
154
|
+
let gp: GeneralPath = new GeneralPath();
|
|
155
|
+
let pt: POINT2;
|
|
156
|
+
let ptsx: POINT2[] = new Array<POINT2>(pts.length);
|
|
157
|
+
let n: int = pts.length;
|
|
158
|
+
//for(j=0;j<pts.length;j++)
|
|
159
|
+
for (j = 0; j < n; j++) {
|
|
160
|
+
pt = pts[j];
|
|
161
|
+
ptsx[j] = pt;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
pts = BasicStroke.GetInteriorPoints(ptsx, pts.length, TacticalLines.DEPTH_AREA, this.width);
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
//for(j=0;j<pts.length;j++)
|
|
168
|
+
for (j = 0; j < n; j++) {
|
|
169
|
+
pt = pts[j];
|
|
170
|
+
if (j === 0) {
|
|
171
|
+
|
|
172
|
+
gp.moveTo(pt.x, pt.y);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
else {
|
|
176
|
+
|
|
177
|
+
gp.lineTo(pt.x, pt.y);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
return gp;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
public getLineWidth(): float {
|
|
186
|
+
return this.width;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Returns the end cap style.
|
|
191
|
+
*
|
|
192
|
+
* @return the end cap style of this <code>BasicStroke</code> as one of the
|
|
193
|
+
* static <code>int</code> values that define possible end cap
|
|
194
|
+
* styles.
|
|
195
|
+
*/
|
|
196
|
+
public getEndCap(): int {
|
|
197
|
+
return this.cap;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public getLineJoin(): int {
|
|
201
|
+
return this.join;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns the limit of miter joins.
|
|
206
|
+
*
|
|
207
|
+
* @return the limit of miter joins of the <code>BasicStroke</code>.
|
|
208
|
+
*/
|
|
209
|
+
public getMiterLimit(): float {
|
|
210
|
+
return this.miterlimit;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Returns the array representing the lengths of the dash segments.
|
|
215
|
+
* Alternate entries in the array represent the user space lengths of the
|
|
216
|
+
* opaque and transparent segments of the dashes. As the pen moves along the
|
|
217
|
+
* outline of the <code>Shape</code> to be stroked, the user space distance
|
|
218
|
+
* that the pen travels is accumulated. The distance value is used to index
|
|
219
|
+
* into the dash array. The pen is opaque when its current cumulative
|
|
220
|
+
* distance maps to an even element of the dash array and transparent
|
|
221
|
+
* otherwise.
|
|
222
|
+
*
|
|
223
|
+
* @return the dash array.
|
|
224
|
+
*/
|
|
225
|
+
public getDashArray(): number[] | null {
|
|
226
|
+
if (this.dash == null) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
return this.dash.map((x) => x);//this.dash.clone() as number[];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
public getDashPhase(): float {
|
|
233
|
+
return this.dash_phase;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Returns the hashcode for this stroke.
|
|
238
|
+
*
|
|
239
|
+
* @return a hash code for this stroke.
|
|
240
|
+
*/
|
|
241
|
+
public hashCode(): int {
|
|
242
|
+
let hash: int = (this.width);
|
|
243
|
+
hash = hash * 31 + this.join;
|
|
244
|
+
hash = hash * 31 + this.cap;
|
|
245
|
+
hash = hash * 31 + (this.miterlimit);
|
|
246
|
+
if (this.dash != null) {
|
|
247
|
+
hash = hash * 31 + (this.dash_phase);
|
|
248
|
+
let n: int = this.dash.length;
|
|
249
|
+
//for (int i = 0; i < dash.length; i++)
|
|
250
|
+
for (let i: int = 0; i < n; i++) {
|
|
251
|
+
hash = hash * 31 + (this.dash[i]);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return hash;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public static GetInteriorPoints(pLinePoints: POINT2[],
|
|
258
|
+
vblCounter: int,
|
|
259
|
+
lineType: int,
|
|
260
|
+
dist: double): Array<POINT2> {
|
|
261
|
+
//var j:int=0;
|
|
262
|
+
let j: int = 0;
|
|
263
|
+
//var index:int=-1;
|
|
264
|
+
let index: int = -1;
|
|
265
|
+
//var pt0:POINT2,pt1:POINT2,pt2:POINT2;
|
|
266
|
+
let pt0: POINT2;
|
|
267
|
+
let pt1: POINT2;
|
|
268
|
+
let pt2: POINT2;
|
|
269
|
+
///var m01:refobj=new refobj(),m12:refobj=new refobj(); //slopes for lines pt0-pt1 and pt1-pt2
|
|
270
|
+
let m01: ref<number[]> = new ref();
|
|
271
|
+
let m12: ref<number[]> = new ref();
|
|
272
|
+
let m1: ref<number[]> = new ref();
|
|
273
|
+
let m2: ref<number[]> = new ref();
|
|
274
|
+
//var direction:int=-1;
|
|
275
|
+
let direction: int = -1;
|
|
276
|
+
//var array:Array=new Array();
|
|
277
|
+
//ArrayList<POINT2>array=new ArrayList();
|
|
278
|
+
//var intersectPt:POINT2=null;
|
|
279
|
+
let intersectPt: POINT2;
|
|
280
|
+
//var m1:refobj=new refobj(),m2:refobj=new refobj();
|
|
281
|
+
//var intersectPoints:Array=new Array();
|
|
282
|
+
let intersectPoints: Array<POINT2> = new Array();
|
|
283
|
+
//var b01:Number,b12:Number; //the y intercepts for the lines corresponding to m1,m2
|
|
284
|
+
let b01: double = 0;
|
|
285
|
+
let b12: double = 0;
|
|
286
|
+
//var dist:Number=10;
|
|
287
|
+
//double dist = 10;
|
|
288
|
+
//the first set of interior points
|
|
289
|
+
//this assumes the area is closed
|
|
290
|
+
for (j = 0; j < vblCounter; j++) {
|
|
291
|
+
|
|
292
|
+
if (j === 0 || j === vblCounter - 1) {
|
|
293
|
+
//pt0=new POINT2(pLinePoints[vblCounter-2]);
|
|
294
|
+
//pt1=new POINT2(pLinePoints[0]);
|
|
295
|
+
//pt2=new POINT2(pLinePoints[1]);
|
|
296
|
+
pt0 = pLinePoints[vblCounter - 2];
|
|
297
|
+
pt1 = pLinePoints[0];
|
|
298
|
+
pt2 = pLinePoints[1];
|
|
299
|
+
} else {
|
|
300
|
+
//pt0=new POINT2(pLinePoints[j-1]);
|
|
301
|
+
//pt1=new POINT2(pLinePoints[j]);
|
|
302
|
+
//pt2=new POINT2(pLinePoints[j+1]);
|
|
303
|
+
pt0 = pLinePoints[j - 1];
|
|
304
|
+
pt1 = pLinePoints[j];
|
|
305
|
+
pt2 = pLinePoints[j + 1];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
//the interiior points
|
|
309
|
+
//var pt00:POINT2,pt01:POINT2;
|
|
310
|
+
//var pt10:POINT2,pt11:POINT2;
|
|
311
|
+
let pt00: POINT2;
|
|
312
|
+
let pt01: POINT2;
|
|
313
|
+
let pt10: POINT2;
|
|
314
|
+
let pt11: POINT2;
|
|
315
|
+
|
|
316
|
+
index = j - 1;
|
|
317
|
+
if (index < 0) {
|
|
318
|
+
index = vblCounter - 1;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
direction = arraysupport.GetInsideOutsideDouble2(pt0, pt1, pLinePoints, vblCounter, index, lineType);
|
|
322
|
+
//reverse the directions since these are interior points
|
|
323
|
+
//pt00-pt01 will be the interior line inside line pt0-pt1
|
|
324
|
+
//pt00 is inside pt0, pt01 is inside pt1
|
|
325
|
+
switch (direction) {
|
|
326
|
+
case 0: {
|
|
327
|
+
//direction=1;
|
|
328
|
+
pt00 = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 1, dist);
|
|
329
|
+
pt01 = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 1, dist);
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
case 1: {
|
|
334
|
+
//direction=0;
|
|
335
|
+
pt00 = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 0, dist);
|
|
336
|
+
pt01 = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 0, dist);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
case 2: {
|
|
341
|
+
//direction=3;
|
|
342
|
+
pt00 = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 3, dist);
|
|
343
|
+
pt01 = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 3, dist);
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
case 3: {
|
|
348
|
+
//direction=2;
|
|
349
|
+
pt00 = lineutility.ExtendDirectedLine(pt0, pt1, pt0, 2, dist);
|
|
350
|
+
pt01 = lineutility.ExtendDirectedLine(pt0, pt1, pt1, 2, dist);
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
default:
|
|
356
|
+
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
//pt10-pt11 will be the interior line inside line pt1-pt2
|
|
360
|
+
//pt10 is inside pt1, pt11 is inside pt2
|
|
361
|
+
index = j;
|
|
362
|
+
if (j === vblCounter - 1) {
|
|
363
|
+
index = 0;
|
|
364
|
+
}
|
|
365
|
+
direction = arraysupport.GetInsideOutsideDouble2(pt1, pt2, pLinePoints, vblCounter, index, lineType);
|
|
366
|
+
//reverse the directions since these are interior points
|
|
367
|
+
switch (direction) {
|
|
368
|
+
case 0: {
|
|
369
|
+
//direction=1;
|
|
370
|
+
pt10 = lineutility.ExtendDirectedLine(pt1, pt2, pt1, 1, dist);
|
|
371
|
+
pt11 = lineutility.ExtendDirectedLine(pt1, pt2, pt2, 1, dist);
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
case 1: {
|
|
376
|
+
//direction=0;
|
|
377
|
+
pt10 = lineutility.ExtendDirectedLine(pt1, pt2, pt1, 0, dist);
|
|
378
|
+
pt11 = lineutility.ExtendDirectedLine(pt1, pt2, pt2, 0, dist);
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
case 2: {
|
|
383
|
+
//direction=3;
|
|
384
|
+
pt10 = lineutility.ExtendDirectedLine(pt1, pt2, pt1, 3, dist);
|
|
385
|
+
pt11 = lineutility.ExtendDirectedLine(pt1, pt2, pt2, 3, dist);
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
case 3: {
|
|
390
|
+
//direction=2;
|
|
391
|
+
pt10 = lineutility.ExtendDirectedLine(pt1, pt2, pt1, 2, dist);
|
|
392
|
+
pt11 = lineutility.ExtendDirectedLine(pt1, pt2, pt2, 2, dist);
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
default:
|
|
398
|
+
|
|
399
|
+
} //end switch
|
|
400
|
+
//intersectPt=new POINT2(null);
|
|
401
|
+
//get the intersection of pt01-p00 and pt10-pt11
|
|
402
|
+
//so it it is the interior intersection of pt0-pt1 and pt1-pt2
|
|
403
|
+
|
|
404
|
+
//first handle the case of vertical lines.
|
|
405
|
+
if (pt0.x === pt1.x && pt1.x === pt2.x) {
|
|
406
|
+
intersectPt = new POINT2(pt01);
|
|
407
|
+
intersectPoints.push(intersectPt);
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
//it's the same situation if the slopes are identical,
|
|
411
|
+
//simply use pt01 or pt10 since they already uniquely define the intesection
|
|
412
|
+
lineutility.CalcTrueSlopeDouble2(pt00, pt01, m01);
|
|
413
|
+
lineutility.CalcTrueSlopeDouble2(pt10, pt11, m12);
|
|
414
|
+
if (m01.value[0] === m12.value[0]) {
|
|
415
|
+
intersectPt = new POINT2(pt01);
|
|
416
|
+
intersectPoints.push(intersectPt);
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
//now we are assuming a non-trivial intersection
|
|
420
|
+
//calculate the y-intercepts using y=mx+b (use b=y-mx)
|
|
421
|
+
b01 = pt01.y - m01.value[0] * pt01.x;
|
|
422
|
+
b12 = pt11.y - m12.value[0] * pt11.x;
|
|
423
|
+
|
|
424
|
+
intersectPt = lineutility.CalcTrueIntersectDouble2(m01.value[0], b01, m12.value[0], b12, 1, 1, 0, 0);
|
|
425
|
+
intersectPoints.push(intersectPt);
|
|
426
|
+
}//end for
|
|
427
|
+
return intersectPoints;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type char = number; // UTF-16 code unit, default `\u0000`
|
|
2
|
+
export type byte = number; // 8-bit signed integer, default 0
|
|
3
|
+
export type short = number; // 16-bit signed integer, default 0
|
|
4
|
+
export type int = number; // 32-bit signed integer, default 0
|
|
5
|
+
export type long = bigint; // 64-bit signed integer, default 0n
|
|
6
|
+
export type float = number; // 32-bit IEEE 754 floating point, default 0.0
|
|
7
|
+
export type double = number; // 64-bit IEEE 754 floating point, default 0.0
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { Graphics2D } from "../graphics2d/Graphics2D"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export class BufferedImage {
|
|
16
|
+
public static readonly TYPE_INT_ARGB: int = 2;
|
|
17
|
+
public constructor(width: int,
|
|
18
|
+
height: int,
|
|
19
|
+
imageType: int)
|
|
20
|
+
{
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
public createGraphics(): Graphics2D {
|
|
24
|
+
return new Graphics2D();
|
|
25
|
+
}
|
|
26
|
+
public flush(): void {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
public getWidth(): double {
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
public getHeight(): double {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export class Font {
|
|
6
|
+
public static readonly PLAIN: number = 0;
|
|
7
|
+
public static readonly BOLD: number = 1;
|
|
8
|
+
public static readonly ITALIC: number= 2;
|
|
9
|
+
|
|
10
|
+
protected _size: number = 10;
|
|
11
|
+
protected _text: string = "";
|
|
12
|
+
protected _type: number = 0;
|
|
13
|
+
public constructor(s: string, type: number, size: number) {
|
|
14
|
+
this._text = s;
|
|
15
|
+
this._type = type;
|
|
16
|
+
this._size = size;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
public getSize(): number {
|
|
20
|
+
return this._size;
|
|
21
|
+
}
|
|
22
|
+
public getName():string
|
|
23
|
+
{
|
|
24
|
+
return this._text;
|
|
25
|
+
}
|
|
26
|
+
public getType():number
|
|
27
|
+
{
|
|
28
|
+
return this._type;
|
|
29
|
+
}
|
|
30
|
+
public isBold():boolean
|
|
31
|
+
{
|
|
32
|
+
return (this._type === Font.BOLD)
|
|
33
|
+
}
|
|
34
|
+
public getTypeString():string
|
|
35
|
+
{
|
|
36
|
+
let ret:string;
|
|
37
|
+
switch(this._type)
|
|
38
|
+
{
|
|
39
|
+
case Font.BOLD:
|
|
40
|
+
{
|
|
41
|
+
ret = "bold";
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case Font.ITALIC:
|
|
45
|
+
{
|
|
46
|
+
ret = "italic";
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
{
|
|
51
|
+
ret = "normal";
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return ret;
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
public static getTypeString(type:number):string
|
|
59
|
+
{
|
|
60
|
+
let ret:string;
|
|
61
|
+
switch(type)
|
|
62
|
+
{
|
|
63
|
+
case Font.BOLD:
|
|
64
|
+
{
|
|
65
|
+
ret = "bold";
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
/*case Font.ITALIC:
|
|
69
|
+
{
|
|
70
|
+
ret = "italic";
|
|
71
|
+
break;
|
|
72
|
+
}*/
|
|
73
|
+
default:
|
|
74
|
+
{
|
|
75
|
+
ret = "normal";
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return ret;
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
public static getTypeInt(type:string):number
|
|
83
|
+
{
|
|
84
|
+
let ret:number = Font.PLAIN;
|
|
85
|
+
switch(type)
|
|
86
|
+
{
|
|
87
|
+
case "bold":
|
|
88
|
+
{
|
|
89
|
+
ret = Font.BOLD;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case "italic":
|
|
93
|
+
{
|
|
94
|
+
ret = Font.ITALIC;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
default:
|
|
98
|
+
{
|
|
99
|
+
ret = Font.PLAIN;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return ret;
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
public toString():string
|
|
107
|
+
{
|
|
108
|
+
let font:string = this.getTypeString() + " " + this._size + "px " + this._text;
|
|
109
|
+
return font;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type int } from "../graphics2d/BasicTypes";
|
|
7
|
+
|
|
8
|
+
import { Font } from "../graphics2d/Font"
|
|
9
|
+
import { FontRenderContext } from "../graphics2d/FontRenderContext"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export class FontMetrics {
|
|
17
|
+
protected _fontRenderContext: FontRenderContext;
|
|
18
|
+
protected _font: Font;
|
|
19
|
+
public constructor(font: Font) {
|
|
20
|
+
//_fontRenderContext=new FontRenderContext();
|
|
21
|
+
this._font = font;
|
|
22
|
+
}
|
|
23
|
+
public stringWidth(str: string): int {
|
|
24
|
+
return this._font.getSize() / 2 * str.length;
|
|
25
|
+
}
|
|
26
|
+
public getFontRenderContext(): FontRenderContext {
|
|
27
|
+
return this._fontRenderContext;
|
|
28
|
+
}
|
|
29
|
+
}
|