Package hec.map
Class WorldLine
java.lang.Object
hec.map.WorldLine
- All Implemented Interfaces:
AsciiSerializable
,FieldAccessor
,Serializable
,Cloneable
- Direct Known Subclasses:
WorldLine3d
A multi-point line in world coordinates.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WorldRect
protected double[]
protected double
protected static WorldLineSeg
static final int
Vector of interior points in linestatic final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
clone()
createOffsetLine
(double coord0, double coord1, double offset, int bank) Creates a WorldLine offset from the current line between the given coordinatesboolean
boolean
double
computes the stream coordinate nearest the given locationgetFieldObject
(Field fld) This method allows access to java.lang.reflect.Field objects within the implementing class.double
Computes the length of the line and the coordinate at each pointint
getLocalArrays
(MapScale scl, int[] xarray, int[] yarray, int start, int numPoints) creates a set of local coordinates to draw a polygonal reachint
getLocalArrays2d
(MapScale scl, int[] xarray, int[] yarray, int start, int numPoints) creates a set of local coordinates to draw a line using Graphics2dint
getLocalRegionArrays
(MapScale scl, int[] xarray, int[] yarray) creates a set of local coordiates to draw a polygonal reachint
getLocalRegionArrays
(MapScale scl, int[] xarray, int[] yarray, double width) int
getLocalRegionArrays
(MapScale scl, int[] xarray, int[] yarray, double width, int start, int numPoints) creates a set of local coordiates to draw a polygonal reachgetLocationByCoord
(double coord) double
getNearestLocation
(WorldPt wpt, WorldPt ptnbest) Computes the shortest distance between the given point and the linedouble
getNearestLocationSigned
(WorldPt wpt, WorldPt ptnbest) computes the shortest distance between the given point and the line, sign of returned value indicates which side of line the point is onint
getPtIndexBeforeCoord
(double coord) returns the index of the point in the pts vector before the given coordint
getPtIndexNearCoord
(double coord) returns the index of the point in the pts vector nearest the given coordboolean
getSlopeAtCoord
(double coord, WorldPt wpt, WorldPt slope) Compute the location and slope at the specified line coordinate.boolean
if the given point is within the given tolerance of the line, a new point is inserted at the location on the line nearest the given point.boolean
intersects
(WorldLine wl, WorldPt intersectPt) check to see if WorldLine wl intersects this WorldLineboolean
intersects
(WorldLineSeg l, WorldPt ptOfIntersect, WorldPt ptDist, int istart) tests for intersection with a world line segment starting from point istartvoid
boolean
isEmpty()
boolean
newPt()
void
parseString
(String str) boolean
boolean
removePtsAfter
(WorldPt wpt) void
boolean
setFieldObject
(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.void
setLinePoint
(double coord, WorldPt wpt) reset the location of a point on the stream linetoString()
-
Field Details
-
RIGHTBANK
public static final int RIGHTBANK- See Also:
-
LEFTBANK
public static final int LEFTBANK- See Also:
-
pts
Vector of interior points in line -
_length
protected transient double _length -
_bounds
-
_coordAtPt
protected transient double[] _coordAtPt -
_tmpSeg
-
-
Constructor Details
-
WorldLine
public WorldLine()
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
clone
-
reverseDirection
public void reverseDirection() -
newPt
-
getFirstPt
-
getLastPt
-
getCenterPt
-
nearPt
-
getNearestLocationSigned
computes the shortest distance between the given point and the line, sign of returned value indicates which side of line the point is on -
getNearestLocation
Computes the shortest distance between the given point and the line- Parameters:
wpt
- this is the point that we are testing to find the shortest distance to this line.ptnbest
- this is an object if NOT null will hold the point on this line that is the closest to the test point.
-
getLength
public double getLength()Computes the length of the line and the coordinate at each point -
invalidate
public void invalidate() -
getPtIndexBeforeCoord
public int getPtIndexBeforeCoord(double coord) returns the index of the point in the pts vector before the given coord -
getPtIndexNearCoord
public int getPtIndexNearCoord(double coord) returns the index of the point in the pts vector nearest the given coord -
getCoordAtLocation
computes the stream coordinate nearest the given location -
getLocationByCoord
-
insertPt
if the given point is within the given tolerance of the line, a new point is inserted at the location on the line nearest the given point. -
removePt
-
removePtsAfter
-
toString
-
parseString
-
createOffsetLine
Creates a WorldLine offset from the current line between the given coordinates -
intersects
check to see if WorldLine wl intersects this WorldLine -
intersects
tests for intersection with a world line segment starting from point istart -
getLocalRegionArrays
creates a set of local coordiates to draw a polygonal reach -
getLocalRegionArrays
-
getLocalRegionArrays
public int getLocalRegionArrays(MapScale scl, int[] xarray, int[] yarray, double width, int start, int numPoints) creates a set of local coordiates to draw a polygonal reach -
getLocalArrays
creates a set of local coordinates to draw a polygonal reach- Parameters:
scl
-xarray
-yarray
-start
-numPoints
-- Returns:
-
getLocalArrays2d
creates a set of local coordinates to draw a line using Graphics2d- Parameters:
scl
-xarray
-yarray
-start
-numPoints
-- Returns:
-
getSlopeAtCoord
Compute the location and slope at the specified line coordinate. The line coordinate goes from 0 to 1. -
setLinePoint
reset the location of a point on the stream line -
getBounds
-
add
-
equals
-
equals
-
getFieldObject
Description copied from interface:FieldAccessor
This method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObject
in interfaceFieldAccessor
- Parameters:
fld
- The field to get.- Returns:
- The data object that is stored in the given field
-
setFieldObject
Description copied from interface:FieldAccessor
This allows access to fields withing the implementing object to set there data.- Specified by:
setFieldObject
in interfaceFieldAccessor
- Parameters:
fld
- The java field object representing the member field to be setfobj
- The data to set in that field- Returns:
- returns true if successful
-