@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,437 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* To change this template, choose Tools | Templates
|
|
3
|
-
* and open the template in the editor.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { type int, type double } from "../graphics2d/BasicTypes";
|
|
9
|
-
|
|
10
|
-
import { GeneralPath } from "../graphics2d/GeneralPath"
|
|
11
|
-
import { IPathIterator } from "../graphics2d/IPathIterator"
|
|
12
|
-
import { Line2D } from "../graphics2d/Line2D"
|
|
13
|
-
import { PathIterator } from "../graphics2d/PathIterator"
|
|
14
|
-
import { Point2D } from "../graphics2d/Point2D"
|
|
15
|
-
import { Polygon } from "../graphics2d/Polygon"
|
|
16
|
-
import { Rectangle2D } from "../graphics2d/Rectangle2D"
|
|
17
|
-
import { Shape } from "../graphics2d/Shape"
|
|
18
|
-
|
|
19
|
-
import { lineutility } from "../JavaLineArray/lineutility"
|
|
20
|
-
import { POINT2 } from "../JavaLineArray/POINT2"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import { ErrorLogger } from "../renderer/utilities/ErrorLogger"
|
|
24
|
-
import { RendererException } from "../renderer/utilities/RendererException"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
export class Area extends GeneralPath {
|
|
32
|
-
private static readonly _className: string = "Area";
|
|
33
|
-
//private ArrayList<POINT2>_pts;
|
|
34
|
-
|
|
35
|
-
public constructor(arg: Polygon | Shape) {
|
|
36
|
-
if (arg instanceof Polygon) {
|
|
37
|
-
super();
|
|
38
|
-
const poly = arg;
|
|
39
|
-
let j: int = 0;
|
|
40
|
-
let n: int = poly.npoints;
|
|
41
|
-
//for(j=0;j<poly.npoints;j++)
|
|
42
|
-
for (j = 0; j < n; j++) {
|
|
43
|
-
if (j === 0) {
|
|
44
|
-
this.moveTo(poly.xpoints[j], poly.ypoints[j]);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
else {
|
|
48
|
-
this.lineTo(poly.xpoints[j], poly.ypoints[j]);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
super();
|
|
53
|
-
const shape = arg;
|
|
54
|
-
let j: int = 0;
|
|
55
|
-
let p: PathIterator = shape.getPathIterator(null);
|
|
56
|
-
let pts: Array<POINT2> = p.getPoints();
|
|
57
|
-
let pt: POINT2;
|
|
58
|
-
let n: int = pts.length;
|
|
59
|
-
//for(j=0;j<pts.length;j++)
|
|
60
|
-
for (j = 0; j < n; j++) {
|
|
61
|
-
pt = pts[j];
|
|
62
|
-
switch (pt.style) {
|
|
63
|
-
case IPathIterator.SEG_MOVETO: {
|
|
64
|
-
this.moveTo(pt.x, pt.y);
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
case IPathIterator.SEG_LINETO: {
|
|
69
|
-
this.lineTo(pt.x, pt.y);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
default: {
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* organizes intersect points by increasing distance from the hatch line origin
|
|
84
|
-
* @param hatchLine
|
|
85
|
-
* @param pts
|
|
86
|
-
*/
|
|
87
|
-
private static reorderPointsByDistance(hatchLine: Line2D, pts: Array<Point2D>): void {
|
|
88
|
-
try {
|
|
89
|
-
|
|
90
|
-
var minDistance = 0;
|
|
91
|
-
var dist = 0;
|
|
92
|
-
var j = 0;
|
|
93
|
-
var minIndex = -1;
|
|
94
|
-
var distances = new Map<int,double>(); //new java.util.HashMap ();
|
|
95
|
-
var ptsOrdered = new Array();//new java.util.ArrayList ();
|
|
96
|
-
var origin = hatchLine.getP1 ();
|
|
97
|
-
var pt0 = new POINT2 (origin.getX (), origin.getY ());
|
|
98
|
-
var pt1 = null;
|
|
99
|
-
for (j = 0; j < pts.length; j++) {
|
|
100
|
-
pt1 = new POINT2 (pts.at(j).getX (), pts.at(j).getY ());
|
|
101
|
-
dist = lineutility.CalcDistanceDouble (pt0, pt1);
|
|
102
|
-
distances.set(j, dist);
|
|
103
|
-
}
|
|
104
|
-
while (distances.size > 0) {
|
|
105
|
-
for (j = 0; j < pts.length; j++) {
|
|
106
|
-
if (distances.has(j)) {
|
|
107
|
-
minIndex = j;
|
|
108
|
-
minDistance = (distances.get (j));
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
for (j = 0; j < pts.length; j++) {
|
|
113
|
-
if (distances.has(j)) {
|
|
114
|
-
dist = (distances.get (j))
|
|
115
|
-
if (dist < minDistance) {
|
|
116
|
-
minDistance = dist;
|
|
117
|
-
minIndex = j;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
ptsOrdered.push (pts.at(minIndex));
|
|
122
|
-
distances.delete(minIndex);
|
|
123
|
-
}
|
|
124
|
-
pts.length = 0; // pts.clear()
|
|
125
|
-
for (j = 0; j < ptsOrdered.length; j++)
|
|
126
|
-
pts.push(ptsOrdered.at(j));
|
|
127
|
-
|
|
128
|
-
/*
|
|
129
|
-
let minDistance: double = 0;
|
|
130
|
-
let dist: double = 0;
|
|
131
|
-
let j: int = 0;
|
|
132
|
-
let minIndex: int = -1;
|
|
133
|
-
let distances: HashMap<number, number> = new HashMap();
|
|
134
|
-
//let distances: Array<number> = new Array();
|
|
135
|
-
let ptsOrdered: Array<Point2D> = new Array();
|
|
136
|
-
let origin: Point2D = hatchLine.getP1();
|
|
137
|
-
let pt0: POINT2 = new POINT2(origin.getX(), origin.getY());
|
|
138
|
-
let pt1: POINT2;
|
|
139
|
-
//build the distances array
|
|
140
|
-
let n: int = pts.length;
|
|
141
|
-
//for(j=0;j<pts.length;j++)
|
|
142
|
-
for (j = 0; j < n; j++) {
|
|
143
|
-
pt1 = new POINT2(pts[j].getX(), pts[j].getY());
|
|
144
|
-
dist = lineutility.CalcDistanceDouble(pt0, pt1);
|
|
145
|
-
distances.put(j, dist);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
while (distances.size() > 0) {
|
|
149
|
-
//initialize minDistance after an array element was removed
|
|
150
|
-
minIndex = distances.keySet().stream().findFirst();//.get();
|
|
151
|
-
minDistance = distances[minIndex];
|
|
152
|
-
|
|
153
|
-
//loop through the remaining elements to find the next minimum distance
|
|
154
|
-
//for(j=0;j<pts.length;j++)
|
|
155
|
-
for (j = 0; j < n; j++) {
|
|
156
|
-
if (distances.containsKey(j)) {
|
|
157
|
-
dist = distances.get(j);
|
|
158
|
-
if (dist < minDistance) {
|
|
159
|
-
minDistance = dist;
|
|
160
|
-
minIndex = j;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
//add the next point to the array
|
|
166
|
-
ptsOrdered.push(pts[minIndex]);
|
|
167
|
-
distances.remove(minIndex);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
pts.length = 0; // pts.clear()
|
|
171
|
-
n = ptsOrdered.length;
|
|
172
|
-
//for(j=0;j<ptsOrdered.length;j++)
|
|
173
|
-
for (j = 0; j < n; j++) {
|
|
174
|
-
pts.push(ptsOrdered[j]);
|
|
175
|
-
}//*/
|
|
176
|
-
|
|
177
|
-
} catch (exc) {
|
|
178
|
-
if (exc instanceof Error) {
|
|
179
|
-
ErrorLogger.LogException(Area._className, "reorderPointsByDistance",
|
|
180
|
-
new RendererException("Failed inside reorderPointsByDistance", exc));
|
|
181
|
-
} else {
|
|
182
|
-
throw exc;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
protected getMBR(polygon: Array<POINT2>): Rectangle2D {
|
|
187
|
-
let j: int = 0;
|
|
188
|
-
let left: double = polygon[0].x;
|
|
189
|
-
let top: double = polygon[0].y;
|
|
190
|
-
let right: double = polygon[0].x;
|
|
191
|
-
let bottom: double = polygon[0].y;
|
|
192
|
-
let n: int = polygon.length;
|
|
193
|
-
//for (j=1;j<polygon.length;j++)
|
|
194
|
-
for (j = 1; j < n; j++) {
|
|
195
|
-
if (polygon[j].x < left) {
|
|
196
|
-
|
|
197
|
-
left = polygon[j].x;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (polygon[j].x > right) {
|
|
201
|
-
|
|
202
|
-
right = polygon[j].x;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (polygon[j].y < top) {
|
|
207
|
-
|
|
208
|
-
top = polygon[j].y;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (polygon[j].y > bottom) {
|
|
212
|
-
|
|
213
|
-
bottom = polygon[j].y;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
return new Rectangle2D(left, top, right - left, bottom - top);
|
|
218
|
-
}
|
|
219
|
-
protected static isVertical(edge: Line2D): boolean {
|
|
220
|
-
if (edge.getX1() === edge.getX2()) {
|
|
221
|
-
|
|
222
|
-
return true;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
else {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
private static adjustVerticalLine(line: Line2D): void {
|
|
231
|
-
let linePt0: Point2D = line.getP1();
|
|
232
|
-
let linePt1: Point2D = line.getP1();
|
|
233
|
-
if (Area.isVertical(line)) {
|
|
234
|
-
let x: double = line.getX2() + .001;
|
|
235
|
-
let y: double = line.getY2();
|
|
236
|
-
linePt1.setLocation(x, y);
|
|
237
|
-
line.setLine(linePt0, linePt1);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
*
|
|
242
|
-
* @param hatchLine the hatch line to intersect against the area points.
|
|
243
|
-
* the thatch line is assumed to start outside the area (polygon) MBR
|
|
244
|
-
* @return the GeneralPath which represents the intersection
|
|
245
|
-
*/
|
|
246
|
-
private static getLineIntersectPoints(polygon: Array<POINT2>, hatchLine: Line2D): Array<POINT2> {
|
|
247
|
-
let pts: Array<POINT2>;
|
|
248
|
-
try {
|
|
249
|
-
let j: int = 0;
|
|
250
|
-
let k: int = 0;
|
|
251
|
-
let segment: Line2D;
|
|
252
|
-
let pt0: Point2D;
|
|
253
|
-
let pt1: Point2D;
|
|
254
|
-
//no (exactly) vertical hatch lines
|
|
255
|
-
Area.adjustVerticalLine(hatchLine);
|
|
256
|
-
let ptsPath: Array<Point2D> = new Array();
|
|
257
|
-
let x: double = 0;
|
|
258
|
-
let y: double = 0;
|
|
259
|
-
let m1: double = 0;
|
|
260
|
-
let //hatch line
|
|
261
|
-
m2: double = 0;
|
|
262
|
-
let //segment slope
|
|
263
|
-
b1: double = 0;
|
|
264
|
-
let //hatch line y intercept
|
|
265
|
-
b2: double = 0; //segment y intercept
|
|
266
|
-
let n: int = polygon.length;
|
|
267
|
-
//for(j=0;j<polygon.length-1;j++)
|
|
268
|
-
for (j = 0; j < n - 1; j++) {
|
|
269
|
-
pt0 = new Point2D(polygon[j]);
|
|
270
|
-
pt1 = new Point2D(polygon[j + 1]);
|
|
271
|
-
segment = new Line2D(pt0, pt1);
|
|
272
|
-
//no vertical segments
|
|
273
|
-
Area.adjustVerticalLine(segment);
|
|
274
|
-
pt0 = segment.getP1();
|
|
275
|
-
pt1 = segment.getP2();
|
|
276
|
-
m1 = (hatchLine.getY1() - hatchLine.getY2()) / (hatchLine.getX1() - hatchLine.getX2());
|
|
277
|
-
m2 = (pt0.getY() - pt1.getY()) / (pt0.getX() - pt1.getX());
|
|
278
|
-
if (hatchLine.intersectsLine(segment)) {
|
|
279
|
-
//m1=(hatchLine.getY1()-hatchLine.getY2())/(hatchLine.getX1()-hatchLine.getX2());
|
|
280
|
-
//m2=(pt0.getY()-pt1.getY())/(pt0.getX()-pt1.getX());
|
|
281
|
-
if (m1 === m2) {
|
|
282
|
-
ptsPath.push(pt0);
|
|
283
|
-
ptsPath.push(pt1);
|
|
284
|
-
}
|
|
285
|
-
else //slopes not equal
|
|
286
|
-
{
|
|
287
|
-
//add one intersection point
|
|
288
|
-
b1 = hatchLine.getY1() - m1 * hatchLine.getX1();
|
|
289
|
-
b2 = segment.getY1() - m2 * segment.getX1();
|
|
290
|
-
x = (b2 - b1) / (m1 - m2); //cannot blow up
|
|
291
|
-
y = (m1 * x + b1);
|
|
292
|
-
|
|
293
|
-
/*
|
|
294
|
-
Touching vertex logic:
|
|
295
|
-
If intersect vertex the line is entering or exiting a shape, add point once
|
|
296
|
-
if tangent to vertex the line is not entering or exiting shape, add point twice to negate changes
|
|
297
|
-
|
|
298
|
-
Intersect vertex => points before and after in the shape are on different sides of the line
|
|
299
|
-
Tangent to vertex => points before and after in the shape are on the same side of the line
|
|
300
|
-
|
|
301
|
-
Every vertex is in two segments of the shape, one where its pt0 and another as pt1
|
|
302
|
-
Always add vertex if pt0 of polygon
|
|
303
|
-
If pt1 of polygon and pts before and after are on same side then add pt1
|
|
304
|
-
*/
|
|
305
|
-
if (Math.abs(pt1.getX() - x) < .001 && Math.abs(pt1.getY() - y) < .001) {
|
|
306
|
-
let ptBefore: Point2D = new Point2D(polygon[j]);
|
|
307
|
-
let ptAfter: Point2D = new Point2D(polygon[(j + 2) % (polygon.length - 1)]);
|
|
308
|
-
if ((ptBefore.getY() > m1 * ptBefore.getX() + b1 && ptAfter.getY() > m1 * ptAfter.getX() + b1) ||
|
|
309
|
-
(ptBefore.getY() < m1 * ptBefore.getX() + b1 && ptAfter.getY() < m1 * ptAfter.getX() + b1)) {
|
|
310
|
-
// Points before and after vertex on the same side
|
|
311
|
-
ptsPath.push(new Point2D(x, y));
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
ptsPath.push(new Point2D(x, y));
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
//reorder ptsPath by distance from the hatch line origin
|
|
321
|
-
Area.reorderPointsByDistance(hatchLine, ptsPath);
|
|
322
|
-
let pt: Point2D;
|
|
323
|
-
pts = new Array();
|
|
324
|
-
n = ptsPath.length;
|
|
325
|
-
//for(k=0;k<ptsPath.length;k++)
|
|
326
|
-
for (k = 0; k < n; k++) {
|
|
327
|
-
pt = ptsPath[k];
|
|
328
|
-
if (k % 2 === 0) {
|
|
329
|
-
pts.push(new POINT2(pt.getX(), pt.getY(), IPathIterator.SEG_MOVETO));
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
332
|
-
pts.push(new POINT2(pt.getX(), pt.getY(), IPathIterator.SEG_LINETO));
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
ptsPath.length = 0; // ptsPath.clear()
|
|
337
|
-
} catch (exc) {
|
|
338
|
-
if (exc instanceof Error) {
|
|
339
|
-
ErrorLogger.LogException(Area._className, "getLineIntersectPoints",
|
|
340
|
-
new RendererException("Failed inside getLineIntersectPoints", exc));
|
|
341
|
-
} else {
|
|
342
|
-
throw exc;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
return pts;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* this is functionality for clsUtilityGE.buildHatchFillwhich calls hatchLineArea.intersect(shapeArea).
|
|
349
|
-
* so it assumes that this._pts is the hatch lines so it is hatchLines.intersect(shape) where
|
|
350
|
-
* shape is the polygon to be filled with hatch lines
|
|
351
|
-
* @param area
|
|
352
|
-
*/
|
|
353
|
-
public intersect(area: Area): void {
|
|
354
|
-
try {
|
|
355
|
-
//assume area is the polygon and "this" is the hatch line shape
|
|
356
|
-
let j: int = 0;
|
|
357
|
-
let polygon: Array<POINT2> = area.getPathIterator(null).getPoints();
|
|
358
|
-
let hatchLines: Array<POINT2> = this.getPathIterator(null).getPoints();
|
|
359
|
-
// Remove duplicates from the shape
|
|
360
|
-
for (let i: int = 0; i < polygon.length - 1; i++) {
|
|
361
|
-
let pt0: POINT2 = polygon[i];
|
|
362
|
-
let pt1: POINT2 = polygon[i + 1];
|
|
363
|
-
if (pt0.x === pt1.x && pt0.y === pt1.y) {
|
|
364
|
-
polygon.splice(i + 1, 1);
|
|
365
|
-
i--;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
//close the polygon
|
|
369
|
-
if (polygon[0].x !== polygon[polygon.length - 1].x || polygon[0].y !== polygon[polygon.length - 1].y) {
|
|
370
|
-
polygon.push(new POINT2(polygon[0]));
|
|
371
|
-
}
|
|
372
|
-
//GeneralPath gp=null;
|
|
373
|
-
//GeneralPath masterGP=null;
|
|
374
|
-
let hatchLine: Line2D;
|
|
375
|
-
let rectHatch: Rectangle2D;
|
|
376
|
-
let rectPoly: Rectangle2D = this.getMBR(polygon);
|
|
377
|
-
let pts: Array<POINT2> = new Array();
|
|
378
|
-
let ptsTemp: Array<POINT2>;
|
|
379
|
-
let n: int = hatchLines.length;
|
|
380
|
-
//for(j=0;j<hatchLines.length-1;j++)
|
|
381
|
-
for (j = 0; j < n - 1; j++) {
|
|
382
|
-
hatchLine = new Line2D(hatchLines[j].x, hatchLines[j].y, hatchLines[j + 1].x, hatchLines[j + 1].y);
|
|
383
|
-
rectHatch = hatchLine.getBounds2D();
|
|
384
|
-
if (rectHatch.intersects(rectPoly) === false) {
|
|
385
|
-
|
|
386
|
-
continue;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
ptsTemp = Area.getLineIntersectPoints(polygon, hatchLine);
|
|
391
|
-
if (ptsTemp != null) {
|
|
392
|
-
|
|
393
|
-
for (const value of ptsTemp) {
|
|
394
|
-
pts.push(value);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
let pt: POINT2;
|
|
401
|
-
//area.getPathIterator(null).reset();
|
|
402
|
-
//area.getPathIterator(null).getPoints().clear();
|
|
403
|
-
//this._pts.clear();
|
|
404
|
-
this.getPathIterator(null).getPoints().length = 0; // this.getPathIterator(null).getPoints().clear()
|
|
405
|
-
//area._pts.clear();
|
|
406
|
-
n = pts.length;
|
|
407
|
-
//for(j=0;j<pts.length;j++)
|
|
408
|
-
for (j = 0; j < n; j++) {
|
|
409
|
-
pt = pts[j];
|
|
410
|
-
switch (pt.style) {
|
|
411
|
-
case IPathIterator.SEG_MOVETO: {
|
|
412
|
-
this.moveTo(pt.x, pt.y);
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
case IPathIterator.SEG_LINETO: {
|
|
417
|
-
this.lineTo(pt.x, pt.y);
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
default: {
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
this.getPathIterator(null).reset();
|
|
428
|
-
} catch (exc) {
|
|
429
|
-
if (exc instanceof Error) {
|
|
430
|
-
ErrorLogger.LogException(Area._className, "intersect",
|
|
431
|
-
new RendererException("Failed inside intersect", exc));
|
|
432
|
-
} else {
|
|
433
|
-
throw exc;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|