@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,726 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* To change this template, choose Tools | Templates
|
|
3
|
+
* and open the template in the editor.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
|
|
8
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
9
|
+
*
|
|
10
|
+
* This code is free software; you can redistribute it and/or modify it
|
|
11
|
+
* under the terms of the GNU General Public License version 2 only, as
|
|
12
|
+
* published by the Free Software Foundation. Sun designates this
|
|
13
|
+
* particular file as subject to the "Classpath" exception as provided
|
|
14
|
+
* by Sun in the LICENSE file that accompanied this code.
|
|
15
|
+
*
|
|
16
|
+
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
17
|
+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
19
|
+
* version 2 for more details (a copy is included in the LICENSE file that
|
|
20
|
+
* accompanied this code).
|
|
21
|
+
*
|
|
22
|
+
* You should have received a copy of the GNU General Public License version
|
|
23
|
+
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
24
|
+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
25
|
+
*
|
|
26
|
+
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
27
|
+
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
28
|
+
* have any questions.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
import { type double, type float, type long, type int } from "../graphics2d/BasicTypes";
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
import { Point2D } from "../graphics2d/Point2D"
|
|
36
|
+
import { Rectangle2D } from "../graphics2d/Rectangle2D"
|
|
37
|
+
import { Shape } from "../graphics2d/Shape"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This <code>Line2D</code> represents a line segment in {@code (x,y)}
|
|
42
|
+
* coordinate space. This class, like all of the Java 2D API, uses a default
|
|
43
|
+
* coordinate system called <i>user space</i> in which the y-axis values
|
|
44
|
+
* increase downward and x-axis values increase to the right. For more
|
|
45
|
+
* information on the user space coordinate system, see the <a href=
|
|
46
|
+
* "http://java.sun.com/j2se/1.3/docs/guide/2d/spec/j2d-intro.fm2.html#61857">
|
|
47
|
+
* Coordinate Systems</a> section of the Java 2D Programmer's Guide.
|
|
48
|
+
* <p>
|
|
49
|
+
* This class is only the abstract superclass for all objects that store a 2D
|
|
50
|
+
* line segment. The actual storage representation of the coordinates is left to
|
|
51
|
+
* the subclass.
|
|
52
|
+
*
|
|
53
|
+
* @author Jim Graham
|
|
54
|
+
* @since 1.2
|
|
55
|
+
*/
|
|
56
|
+
export class Line2D {
|
|
57
|
+
public intersectsLine(edge: Line2D): boolean {
|
|
58
|
+
return Line2D.linesIntersect(edge.getX1(), edge.getY1(), edge.getX2(), edge.getY2(),
|
|
59
|
+
this.getX1(), this.getY1(), this.getX2(), this.getY2());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public static linesIntersect(x1: double, y1: double,
|
|
63
|
+
x2: double, y2: double,
|
|
64
|
+
x3: double, y3: double,
|
|
65
|
+
x4: double, y4: double): boolean {
|
|
66
|
+
return ((Line2D.relativeCCW(x1, y1, x2, y2, x3, y3) *
|
|
67
|
+
Line2D.relativeCCW(x1, y1, x2, y2, x4, y4) <= 0)
|
|
68
|
+
&& (Line2D.relativeCCW(x3, y3, x4, y4, x1, y1) *
|
|
69
|
+
Line2D.relativeCCW(x3, y3, x4, y4, x2, y2) <= 0));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The X coordinate of the start point of the line segment.
|
|
76
|
+
*
|
|
77
|
+
* @since 1.2
|
|
78
|
+
* @serial
|
|
79
|
+
*/
|
|
80
|
+
public x1: double = 0;
|
|
81
|
+
/**
|
|
82
|
+
* The Y coordinate of the start point of the line segment.
|
|
83
|
+
*
|
|
84
|
+
* @since 1.2
|
|
85
|
+
* @serial
|
|
86
|
+
*/
|
|
87
|
+
public y1: double = 0;
|
|
88
|
+
/**
|
|
89
|
+
* The X coordinate of the end point of the line segment.
|
|
90
|
+
*
|
|
91
|
+
* @since 1.2
|
|
92
|
+
* @serial
|
|
93
|
+
*/
|
|
94
|
+
public x2: double = 0;
|
|
95
|
+
/**
|
|
96
|
+
* The Y coordinate of the end point of the line segment.
|
|
97
|
+
*
|
|
98
|
+
* @since 1.2
|
|
99
|
+
* @serial
|
|
100
|
+
*/
|
|
101
|
+
public y2: double = 0;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Constructs and initializes a Line with coordinates (0, 0) -> (0, 0).
|
|
105
|
+
*
|
|
106
|
+
* @since 1.2
|
|
107
|
+
*/
|
|
108
|
+
public constructor();
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Constructs and initializes a <code>Line2D</code> from the specified
|
|
112
|
+
* <code>Point2D</code> objects.
|
|
113
|
+
*
|
|
114
|
+
* @param p1
|
|
115
|
+
* the start <code>Point2D</code> of this line segment
|
|
116
|
+
* @param p2
|
|
117
|
+
* the end <code>Point2D</code> of this line segment
|
|
118
|
+
* @since 1.2
|
|
119
|
+
*/
|
|
120
|
+
public constructor(p1: Point2D, p2: Point2D);
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Constructs and initializes a <code>Line2D</code> from the specified
|
|
124
|
+
* coordinates.
|
|
125
|
+
*
|
|
126
|
+
* @param x1
|
|
127
|
+
* the X coordinate of the start point
|
|
128
|
+
* @param y1
|
|
129
|
+
* the Y coordinate of the start point
|
|
130
|
+
* @param x2
|
|
131
|
+
* the X coordinate of the end point
|
|
132
|
+
* @param y2
|
|
133
|
+
* the Y coordinate of the end point
|
|
134
|
+
* @since 1.2
|
|
135
|
+
*/
|
|
136
|
+
public constructor(x1: double, y1: double, x2: double, y2: double);
|
|
137
|
+
public constructor(...args: unknown[]) {
|
|
138
|
+
switch (args.length) {
|
|
139
|
+
case 0: {
|
|
140
|
+
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
case 2: {
|
|
145
|
+
const [p1, p2] = args as [Point2D, Point2D];
|
|
146
|
+
|
|
147
|
+
this.setLine(p1, p2);
|
|
148
|
+
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
case 4: {
|
|
153
|
+
const [x1, y1, x2, y2] = args as [double, double, double, double];
|
|
154
|
+
|
|
155
|
+
this.setLine(x1, y1, x2, y2);
|
|
156
|
+
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
default: {
|
|
161
|
+
throw Error(`Invalid number of arguments`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* {@inheritDoc}
|
|
169
|
+
*
|
|
170
|
+
* @since 1.2
|
|
171
|
+
*/
|
|
172
|
+
public getX1(): double {
|
|
173
|
+
return this.x1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* {@inheritDoc}
|
|
178
|
+
*
|
|
179
|
+
* @since 1.2
|
|
180
|
+
*/
|
|
181
|
+
public getY1(): double {
|
|
182
|
+
return this.y1;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* {@inheritDoc}
|
|
187
|
+
*
|
|
188
|
+
* @since 1.2
|
|
189
|
+
*/
|
|
190
|
+
public getP1(): Point2D {
|
|
191
|
+
return new Point2D(this.x1, this.y1);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* {@inheritDoc}
|
|
196
|
+
*
|
|
197
|
+
* @since 1.2
|
|
198
|
+
*/
|
|
199
|
+
public getX2(): double {
|
|
200
|
+
return this.x2;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* {@inheritDoc}
|
|
205
|
+
*
|
|
206
|
+
* @since 1.2
|
|
207
|
+
*/
|
|
208
|
+
public getY2(): double {
|
|
209
|
+
return this.y2;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* {@inheritDoc}
|
|
214
|
+
*
|
|
215
|
+
* @since 1.2
|
|
216
|
+
*/
|
|
217
|
+
public getP2(): Point2D {
|
|
218
|
+
return new Point2D(this.x2, this.y2);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* {@inheritDoc}
|
|
223
|
+
*
|
|
224
|
+
* @since 1.2
|
|
225
|
+
*/
|
|
226
|
+
public getBounds2D(): Rectangle2D {
|
|
227
|
+
let x: double = 0;
|
|
228
|
+
let y: double = 0;
|
|
229
|
+
let w: double = 0;
|
|
230
|
+
let h: double = 0;
|
|
231
|
+
if (this.x1 < this.x2) {
|
|
232
|
+
x = this.x1;
|
|
233
|
+
w = this.x2 - this.x1;
|
|
234
|
+
} else {
|
|
235
|
+
x = this.x2;
|
|
236
|
+
w = this.x1 - this.x2;
|
|
237
|
+
}
|
|
238
|
+
if (this.y1 < this.y2) {
|
|
239
|
+
y = this.y1;
|
|
240
|
+
h = this.y2 - this.y1;
|
|
241
|
+
} else {
|
|
242
|
+
y = this.y2;
|
|
243
|
+
h = this.y1 - this.y2;
|
|
244
|
+
}
|
|
245
|
+
return new Rectangle2D(x, y, w, h);
|
|
246
|
+
}
|
|
247
|
+
/*
|
|
248
|
+
* JDK 1.6 serialVersionUID
|
|
249
|
+
*/
|
|
250
|
+
private static readonly serialVersionUID: number = 0;//long = 7979627399746467499n;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Sets the location of the end points of this <code>Line2D</code> to the
|
|
254
|
+
* same as those end points of the specified <code>Line2D</code>.
|
|
255
|
+
*
|
|
256
|
+
* @param l
|
|
257
|
+
* the specified <code>Line2D</code>
|
|
258
|
+
* @since 1.2
|
|
259
|
+
*/
|
|
260
|
+
public setLine(l: Line2D): void;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Sets the location of the end points of this <code>Line2D</code> to the
|
|
264
|
+
* specified <code>Point2D</code> coordinates.
|
|
265
|
+
*
|
|
266
|
+
* @param p1
|
|
267
|
+
* the start <code>Point2D</code> of the line segment
|
|
268
|
+
* @param p2
|
|
269
|
+
* the end <code>Point2D</code> of the line segment
|
|
270
|
+
* @since 1.2
|
|
271
|
+
*/
|
|
272
|
+
public setLine(p1: Point2D, p2: Point2D): void;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Sets the location of the end points of this <code>Line2D</code> to the
|
|
276
|
+
* specified double coordinates.
|
|
277
|
+
*
|
|
278
|
+
* @param x1
|
|
279
|
+
* the X coordinate of the start point
|
|
280
|
+
* @param y1
|
|
281
|
+
* the Y coordinate of the start point
|
|
282
|
+
* @param x2
|
|
283
|
+
* the X coordinate of the end point
|
|
284
|
+
* @param y2
|
|
285
|
+
* the Y coordinate of the end point
|
|
286
|
+
* @since 1.2
|
|
287
|
+
*/
|
|
288
|
+
public setLine(x1: double, y1: double, x2: double, y2: double): void;
|
|
289
|
+
public setLine(...args: unknown[]): void {
|
|
290
|
+
switch (args.length) {
|
|
291
|
+
case 1: {
|
|
292
|
+
const [l] = args as [Line2D];
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
this.setLine(l.getX1(), l.getY1(), l.getX2(), l.getY2());
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
case 2: {
|
|
302
|
+
const [p1, p2] = args as [Point2D, Point2D];
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
this.setLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
case 4: {
|
|
312
|
+
const [x1, y1, x2, y2] = args as [double, double, double, double];
|
|
313
|
+
this.x1 = x1;
|
|
314
|
+
this.y1 = y1;
|
|
315
|
+
this.x2 = x2;
|
|
316
|
+
this.y2 = y2;
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
default: {
|
|
323
|
+
throw Error(`Invalid number of arguments`);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Returns an indicator of where the specified point {@code (px,py)} lies
|
|
331
|
+
* with respect to the line segment from {@code (x1,y1)} to {@code (x2,y2)}.
|
|
332
|
+
* The return value can be either 1, -1, or 0 and indicates in which
|
|
333
|
+
* direction the specified line must pivot around its first end point,
|
|
334
|
+
* {@code (x1,y1)}, in order to point at the specified point {@code (px,py)}
|
|
335
|
+
* .
|
|
336
|
+
* <p>
|
|
337
|
+
* A return value of 1 indicates that the line segment must turn in the
|
|
338
|
+
* direction that takes the positive X axis towards the negative Y axis. In
|
|
339
|
+
* the default coordinate system used by Java 2D, this direction is
|
|
340
|
+
* counterclockwise.
|
|
341
|
+
* <p>
|
|
342
|
+
* A return value of -1 indicates that the line segment must turn in the
|
|
343
|
+
* direction that takes the positive X axis towards the positive Y axis. In
|
|
344
|
+
* the default coordinate system, this direction is clockwise.
|
|
345
|
+
* <p>
|
|
346
|
+
* A return value of 0 indicates that the point lies exactly on the line
|
|
347
|
+
* segment. Note that an indicator value of 0 is rare and not useful for
|
|
348
|
+
* determining colinearity because of floating point rounding issues.
|
|
349
|
+
* <p>
|
|
350
|
+
* If the point is colinear with the line segment, but not between the end
|
|
351
|
+
* points, then the value will be -1 if the point lies "beyond {@code
|
|
352
|
+
* (x1,y1)}" or 1 if the point lies "beyond {@code (x2,y2)}".
|
|
353
|
+
*
|
|
354
|
+
* @param x1
|
|
355
|
+
* the X coordinate of the start point of the specified line
|
|
356
|
+
* segment
|
|
357
|
+
* @param y1
|
|
358
|
+
* the Y coordinate of the start point of the specified line
|
|
359
|
+
* segment
|
|
360
|
+
* @param x2
|
|
361
|
+
* the X coordinate of the end point of the specified line
|
|
362
|
+
* segment
|
|
363
|
+
* @param y2
|
|
364
|
+
* the Y coordinate of the end point of the specified line
|
|
365
|
+
* segment
|
|
366
|
+
* @param px
|
|
367
|
+
* the X coordinate of the specified point to be compared with
|
|
368
|
+
* the specified line segment
|
|
369
|
+
* @param py
|
|
370
|
+
* the Y coordinate of the specified point to be compared with
|
|
371
|
+
* the specified line segment
|
|
372
|
+
* @return an integer that indicates the position of the third specified
|
|
373
|
+
* coordinates with respect to the line segment formed by the first
|
|
374
|
+
* two specified coordinates.
|
|
375
|
+
* @since 1.2
|
|
376
|
+
*/
|
|
377
|
+
public static relativeCCW(x1: double, y1: double, x2: double, y2: double,
|
|
378
|
+
px: double, py: double): int {
|
|
379
|
+
x2 -= x1;
|
|
380
|
+
y2 -= y1;
|
|
381
|
+
px -= x1;
|
|
382
|
+
py -= y1;
|
|
383
|
+
let ccw: double = px * y2 - py * x2;
|
|
384
|
+
if (ccw === 0.0) {
|
|
385
|
+
// The point is colinear, classify based on which side of
|
|
386
|
+
// the segment the point falls on. We can calculate a
|
|
387
|
+
// relative value using the projection of px,py onto the
|
|
388
|
+
// segment - a negative value indicates the point projects
|
|
389
|
+
// outside of the segment in the direction of the particular
|
|
390
|
+
// endpoint used as the origin for the projection.
|
|
391
|
+
ccw = px * x2 + py * y2;
|
|
392
|
+
if (ccw > 0.0) {
|
|
393
|
+
// Reverse the projection to be relative to the original x2,y2
|
|
394
|
+
// x2 and y2 are simply negated.
|
|
395
|
+
// px and py need to have (x2 - x1) or (y2 - y1) subtracted
|
|
396
|
+
// from them (based on the original values)
|
|
397
|
+
// Since we really want to get a positive answer when the
|
|
398
|
+
// point is "beyond (x2,y2)", then we want to calculate
|
|
399
|
+
// the inverse anyway - thus we leave x2 & y2 negated.
|
|
400
|
+
px -= x2;
|
|
401
|
+
py -= y2;
|
|
402
|
+
ccw = px * x2 + py * y2;
|
|
403
|
+
if (ccw < 0.0) {
|
|
404
|
+
ccw = 0.0;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return (ccw < 0.0) ? -1 : ((ccw > 0.0) ? 1 : 0);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Returns an indicator of where the specified point {@code (px,py)} lies
|
|
413
|
+
* with respect to this line segment. See the method comments of
|
|
414
|
+
* {@link #relativeCCW(double, double, double, double, double, double)} to
|
|
415
|
+
* interpret the return value.
|
|
416
|
+
*
|
|
417
|
+
* @param px
|
|
418
|
+
* the X coordinate of the specified point to be compared with
|
|
419
|
+
* this <code>Line2D</code>
|
|
420
|
+
* @param py
|
|
421
|
+
* the Y coordinate of the specified point to be compared with
|
|
422
|
+
* this <code>Line2D</code>
|
|
423
|
+
* @return an integer that indicates the position of the specified
|
|
424
|
+
* coordinates with respect to this <code>Line2D</code>
|
|
425
|
+
* @see #relativeCCW(double, double, double, double, double, double)
|
|
426
|
+
* @since 1.2
|
|
427
|
+
*/
|
|
428
|
+
public relativeCCW(px: double, py: double): int {
|
|
429
|
+
return Line2D.relativeCCW(this.getX1(), this.getY1(), this.getX2(), this.getY2(), px, py);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Returns the square of the distance from a point to a line. The distance
|
|
434
|
+
* measured is the distance between the specified point and the closest
|
|
435
|
+
* point on the infinitely-extended line defined by the specified
|
|
436
|
+
* coordinates. If the specified point intersects the line, this method
|
|
437
|
+
* returns 0.0.
|
|
438
|
+
*
|
|
439
|
+
* @param x1
|
|
440
|
+
* the X coordinate of the start point of the specified line
|
|
441
|
+
* @param y1
|
|
442
|
+
* the Y coordinate of the start point of the specified line
|
|
443
|
+
* @param x2
|
|
444
|
+
* the X coordinate of the end point of the specified line
|
|
445
|
+
* @param y2
|
|
446
|
+
* the Y coordinate of the end point of the specified line
|
|
447
|
+
* @param px
|
|
448
|
+
* the X coordinate of the specified point being measured against
|
|
449
|
+
* the specified line
|
|
450
|
+
* @param py
|
|
451
|
+
* the Y coordinate of the specified point being measured against
|
|
452
|
+
* the specified line
|
|
453
|
+
* @return a double value that is the square of the distance from the
|
|
454
|
+
* specified point to the specified line.
|
|
455
|
+
* @since 1.2
|
|
456
|
+
*/
|
|
457
|
+
public static ptLineDistSq(x1: double, y1: double, x2: double,
|
|
458
|
+
y2: double, px: double, py: double): double {
|
|
459
|
+
// Adjust vectors relative to x1,y1
|
|
460
|
+
// x2,y2 becomes relative vector from x1,y1 to end of segment
|
|
461
|
+
x2 -= x1;
|
|
462
|
+
y2 -= y1;
|
|
463
|
+
// px,py becomes relative vector from x1,y1 to test point
|
|
464
|
+
px -= x1;
|
|
465
|
+
py -= y1;
|
|
466
|
+
let dotprod: double = px * x2 + py * y2;
|
|
467
|
+
// dotprod is the length of the px,py vector
|
|
468
|
+
// projected on the x1,y1=>x2,y2 vector times the
|
|
469
|
+
// length of the x1,y1=>x2,y2 vector
|
|
470
|
+
let projlenSq: double = dotprod * dotprod / (x2 * x2 + y2 * y2);
|
|
471
|
+
// Distance to line is now the length of the relative point
|
|
472
|
+
// vector minus the length of its projection onto the line
|
|
473
|
+
let lenSq: double = px * px + py * py - projlenSq;
|
|
474
|
+
if (lenSq < 0) {
|
|
475
|
+
lenSq = 0;
|
|
476
|
+
}
|
|
477
|
+
return lenSq;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Returns the distance from a point to a line. The distance measured is the
|
|
482
|
+
* distance between the specified point and the closest point on the
|
|
483
|
+
* infinitely-extended line defined by the specified coordinates. If the
|
|
484
|
+
* specified point intersects the line, this method returns 0.0.
|
|
485
|
+
*
|
|
486
|
+
* @param x1
|
|
487
|
+
* the X coordinate of the start point of the specified line
|
|
488
|
+
* @param y1
|
|
489
|
+
* the Y coordinate of the start point of the specified line
|
|
490
|
+
* @param x2
|
|
491
|
+
* the X coordinate of the end point of the specified line
|
|
492
|
+
* @param y2
|
|
493
|
+
* the Y coordinate of the end point of the specified line
|
|
494
|
+
* @param px
|
|
495
|
+
* the X coordinate of the specified point being measured against
|
|
496
|
+
* the specified line
|
|
497
|
+
* @param py
|
|
498
|
+
* the Y coordinate of the specified point being measured against
|
|
499
|
+
* the specified line
|
|
500
|
+
* @return a double value that is the distance from the specified point to
|
|
501
|
+
* the specified line.
|
|
502
|
+
* @since 1.2
|
|
503
|
+
*/
|
|
504
|
+
public static ptLineDist(x1: double, y1: double, x2: double, y2: double,
|
|
505
|
+
px: double, py: double): double {
|
|
506
|
+
return Math.sqrt(Line2D.ptLineDistSq(x1, y1, x2, y2, px, py));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Returns the square of the distance from a specified <code>Point2D</code>
|
|
511
|
+
* to this line. The distance measured is the distance between the specified
|
|
512
|
+
* point and the closest point on the infinitely-extended line defined by
|
|
513
|
+
* this <code>Line2D</code>. If the specified point intersects the line,
|
|
514
|
+
* this method returns 0.0.
|
|
515
|
+
*
|
|
516
|
+
* @param pt
|
|
517
|
+
* the specified <code>Point2D</code> being measured against this
|
|
518
|
+
* line
|
|
519
|
+
* @return a double value that is the square of the distance from a
|
|
520
|
+
* specified <code>Point2D</code> to the current line.
|
|
521
|
+
* @since 1.2
|
|
522
|
+
*/
|
|
523
|
+
public ptLineDistSq(pt: Point2D): double;
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Returns the square of the distance from a point to this line. The
|
|
527
|
+
* distance measured is the distance between the specified point and the
|
|
528
|
+
* closest point on the infinitely-extended line defined by this
|
|
529
|
+
* <code>Line2D</code>. If the specified point intersects the line, this
|
|
530
|
+
* method returns 0.0.
|
|
531
|
+
*
|
|
532
|
+
* @param px
|
|
533
|
+
* the X coordinate of the specified point being measured against
|
|
534
|
+
* this line
|
|
535
|
+
* @param py
|
|
536
|
+
* the Y coordinate of the specified point being measured against
|
|
537
|
+
* this line
|
|
538
|
+
* @return a double value that is the square of the distance from a
|
|
539
|
+
* specified point to the current line.
|
|
540
|
+
* @since 1.2
|
|
541
|
+
*/
|
|
542
|
+
public ptLineDistSq(px: double, py: double): double;
|
|
543
|
+
public ptLineDistSq(...args: unknown[]): double {
|
|
544
|
+
switch (args.length) {
|
|
545
|
+
case 1: {
|
|
546
|
+
const [pt] = args as [Point2D];
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
return Line2D.ptLineDistSq(this.getX1(), this.getY1(), this.getX2(), this.getY2(), pt.getX(), pt.getY());
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
case 2: {
|
|
556
|
+
const [px, py] = args as [double, double];
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
return Line2D.ptLineDistSq(this.getX1(), this.getY1(), this.getX2(), this.getY2(), px, py);
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
default: {
|
|
566
|
+
throw Error(`Invalid number of arguments`);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Returns the distance from a <code>Point2D</code> to this line. The
|
|
574
|
+
* distance measured is the distance between the specified point and the
|
|
575
|
+
* closest point on the infinitely-extended line defined by this
|
|
576
|
+
* <code>Line2D</code>. If the specified point intersects the line, this
|
|
577
|
+
* method returns 0.0.
|
|
578
|
+
*
|
|
579
|
+
* @param pt
|
|
580
|
+
* the specified <code>Point2D</code> being measured
|
|
581
|
+
* @return a double value that is the distance from a specified
|
|
582
|
+
* <code>Point2D</code> to the current line.
|
|
583
|
+
* @since 1.2
|
|
584
|
+
*/
|
|
585
|
+
public ptLineDist(pt: Point2D): double;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Returns the distance from a point to this line. The distance measured is
|
|
589
|
+
* the distance between the specified point and the closest point on the
|
|
590
|
+
* infinitely-extended line defined by this <code>Line2D</code>. If the
|
|
591
|
+
* specified point intersects the line, this method returns 0.0.
|
|
592
|
+
*
|
|
593
|
+
* @param px
|
|
594
|
+
* the X coordinate of the specified point being measured against
|
|
595
|
+
* this line
|
|
596
|
+
* @param py
|
|
597
|
+
* the Y coordinate of the specified point being measured against
|
|
598
|
+
* this line
|
|
599
|
+
* @return a double value that is the distance from a specified point to the
|
|
600
|
+
* current line.
|
|
601
|
+
* @since 1.2
|
|
602
|
+
*/
|
|
603
|
+
public ptLineDist(px: double, py: double): double;
|
|
604
|
+
public ptLineDist(...args: unknown[]): double {
|
|
605
|
+
switch (args.length) {
|
|
606
|
+
case 1: {
|
|
607
|
+
const [pt] = args as [Point2D];
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
return Line2D.ptLineDist(this.getX1(), this.getY1(), this.getX2(), this.getY2(), pt.getX(), pt.getY());
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
case 2: {
|
|
617
|
+
const [px, py] = args as [double, double];
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
return Line2D.ptLineDist(this.getX1(), this.getY1(), this.getX2(), this.getY2(), px, py);
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
default: {
|
|
627
|
+
throw Error(`Invalid number of arguments`);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Tests if a given <code>Point2D</code> is inside the boundary of this
|
|
635
|
+
* <code>Line2D</code>. This method is required to implement the
|
|
636
|
+
* {@link Shape} interface, but in the case of <code>Line2D</code> objects
|
|
637
|
+
* it always returns <code>false</code> since a line contains no area.
|
|
638
|
+
*
|
|
639
|
+
* @param p
|
|
640
|
+
* the specified <code>Point2D</code> to be tested
|
|
641
|
+
* @return <code>false</code> because a <code>Line2D</code> contains no
|
|
642
|
+
* area.
|
|
643
|
+
* @since 1.2
|
|
644
|
+
*/
|
|
645
|
+
public contains(p: Point2D): boolean;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Tests if the interior of this <code>Line2D</code> entirely contains the
|
|
649
|
+
* specified <code>Rectangle2D</code>. This method is required to implement
|
|
650
|
+
* the <code>Shape</code> interface, but in the case of <code>Line2D</code>
|
|
651
|
+
* objects it always returns <code>false</code> since a line contains no
|
|
652
|
+
* area.
|
|
653
|
+
*
|
|
654
|
+
* @param r
|
|
655
|
+
* the specified <code>Rectangle2D</code> to be tested
|
|
656
|
+
* @return <code>false</code> because a <code>Line2D</code> contains no
|
|
657
|
+
* area.
|
|
658
|
+
* @since 1.2
|
|
659
|
+
*/
|
|
660
|
+
public contains(r: Rectangle2D): boolean;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Tests if a specified coordinate is inside the boundary of this
|
|
664
|
+
* <code>Line2D</code>. This method is required to implement the
|
|
665
|
+
* {@link Shape} interface, but in the case of <code>Line2D</code> objects
|
|
666
|
+
* it always returns <code>false</code> since a line contains no area.
|
|
667
|
+
*
|
|
668
|
+
* @param x
|
|
669
|
+
* the X coordinate of the specified point to be tested
|
|
670
|
+
* @param y
|
|
671
|
+
* the Y coordinate of the specified point to be tested
|
|
672
|
+
* @return <code>false</code> because a <code>Line2D</code> contains no
|
|
673
|
+
* area.
|
|
674
|
+
* @since 1.2
|
|
675
|
+
*/
|
|
676
|
+
public contains(x: double, y: double): boolean;
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Tests if the interior of this <code>Line2D</code> entirely contains the
|
|
680
|
+
* specified set of rectangular coordinates. This method is required to
|
|
681
|
+
* implement the <code>Shape</code> interface, but in the case of
|
|
682
|
+
* <code>Line2D</code> objects it always returns false since a line contains
|
|
683
|
+
* no area.
|
|
684
|
+
*
|
|
685
|
+
* @param x
|
|
686
|
+
* the X coordinate of the upper-left corner of the specified
|
|
687
|
+
* rectangular area
|
|
688
|
+
* @param y
|
|
689
|
+
* the Y coordinate of the upper-left corner of the specified
|
|
690
|
+
* rectangular area
|
|
691
|
+
* @param w
|
|
692
|
+
* the width of the specified rectangular area
|
|
693
|
+
* @param h
|
|
694
|
+
* the height of the specified rectangular area
|
|
695
|
+
* @return <code>false</code> because a <code>Line2D</code> contains no
|
|
696
|
+
* area.
|
|
697
|
+
* @since 1.2
|
|
698
|
+
*/
|
|
699
|
+
public contains(x: double, y: double, w: double, h: double): boolean;
|
|
700
|
+
public contains(...args: unknown[]): boolean {
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Creates a new object of the same class as this object.
|
|
706
|
+
*
|
|
707
|
+
* @return a clone of this instance.
|
|
708
|
+
* @exception OutOfMemoryError
|
|
709
|
+
* if there is not enough memory.
|
|
710
|
+
* @see java.lang.Cloneable
|
|
711
|
+
* @since 1.2
|
|
712
|
+
*/
|
|
713
|
+
public clone(): Line2D | null
|
|
714
|
+
{
|
|
715
|
+
try {
|
|
716
|
+
//return super.clone();
|
|
717
|
+
throw Error("Need to implement clone for Line2D");
|
|
718
|
+
} catch (e) {
|
|
719
|
+
{
|
|
720
|
+
// this shouldn't happen, since we are Cloneable
|
|
721
|
+
throw Error("Need to implement clone for Line2D" + e.message);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|