|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.geometry.iso.topograph2D.util.CoordinateArrays
public class CoordinateArrays
Useful utility functions for handling Coordinate arrays
Nested Class Summary | |
---|---|
static class |
CoordinateArrays.BidirectionalComparator
A Comparator for Coordinate arrays modulo their
directionality. |
static class |
CoordinateArrays.ForwardComparator
A Comparator for Coordinate arrays in the forward
direction of their coordinates, using lexicographic ordering. |
Constructor Summary | |
---|---|
CoordinateArrays()
|
Method Summary | |
---|---|
static Coordinate[] |
atLeastNCoordinatesOrNothing(int n,
Coordinate[] c)
Returns either the given coordinate array if its length is greater than the given amount, or an empty coordinate array. |
static int |
compare(Coordinate[] pts1,
Coordinate[] pts2)
Compares two Coordinate arrays in the forward direction of their
coordinates, using lexicographic ordering. |
static Coordinate[] |
copyDeep(Coordinate[] coordinates)
Creates a deep copy of the argument {@link Coordinate) array. |
static boolean |
equals(Coordinate[] coord1,
Coordinate[] coord2)
Returns true if the two arrays are identical, both null, or pointwise equal (as compared using Coordinate#equals) |
static boolean |
equals(Coordinate[] coord1,
Coordinate[] coord2,
java.util.Comparator coordinateComparator)
Returns true if the two arrays are identical, both null, or pointwise equal, using a user-defined CoordinateArrays.ForwardComparator for Coordinate s |
static Coordinate[] |
extract(Coordinate[] pts,
int start,
int end)
Extracts a subsequence of the input Coordinate array from indices
start to end (inclusive). |
static boolean |
hasRepeatedPoints(Coordinate[] coord)
Returns whether #equals returns true for any two consecutive Coordinates in the given array. |
static int |
increasingDirection(Coordinate[] pts)
Determines which orientation of the Coordinate array is (overall)
increasing. |
static int |
indexOf(Coordinate coordinate,
Coordinate[] coordinates)
Returns the index of coordinate in
coordinates . |
static Coordinate |
minCoordinate(Coordinate[] coordinates)
Returns the minimum coordinate, using the usual lexicographic comparison. |
static Coordinate |
ptNotInList(Coordinate[] testPts,
Coordinate[] pts)
Finds a point in a list of points which is not contained in another list of points |
static Coordinate[] |
removeRepeatedPoints(Coordinate[] coord)
If the coordinate array argument has repeated points, constructs a new array containing no repeated points. |
static void |
reverse(Coordinate[] coord)
Reverses the coordinates in an array in-place. |
static void |
scroll(Coordinate[] coordinates,
Coordinate firstCoordinate)
Shifts the positions of the coordinates until firstCoordinate is first. |
static Coordinate[] |
toCoordinateArray(java.util.Collection coordList)
Converts the given Collection of Coordinates into a Coordinate array. |
static Coordinate[] |
toCoordinateArray(java.util.List<org.opengis.geometry.DirectPosition> aPositions)
SJ TODO faellt evtl weg, wenn coordinate durch DirectPosition ausgetauscht wird |
static java.util.List<DirectPositionImpl> |
toDirectPositionList(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
Coordinate[] coordArray)
Converts a Coordinate array into a list of DirectPositions |
static java.util.List<org.opengis.geometry.coordinate.Position> |
toPositionList(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
Coordinate[] coordArray)
Converts a Coordinate array into a list of Positions SJ: faellt evtl weg, wenn coordinate durch DirectPosition ausgetauscht wird |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CoordinateArrays()
Method Detail |
---|
public static Coordinate ptNotInList(Coordinate[] testPts, Coordinate[] pts)
testPts
- the Coordinate
s to testpts
- an array of Coordinate
s to test the input points
against
Coordinate
from testPts
which is not in
pts
, ' or null
public static int compare(Coordinate[] pts1, Coordinate[] pts2)
Coordinate
arrays in the forward direction of their
coordinates, using lexicographic ordering.
pts1
- pts2
-
public static int increasingDirection(Coordinate[] pts)
Coordinate
array is (overall)
increasing. In other words, determines which end of the array is
"smaller" (using the standard ordering on Coordinate
). Returns
an integer indicating the increasing direction. If the sequence is a
palindrome, it is defined to be oriented in a positive direction.
pts
- the array of Coordinates to test
1
if the array is smaller at the start or is a
palindrome, -1
if smaller at the endpublic static Coordinate[] copyDeep(Coordinate[] coordinates)
coordinates
- an array of Coordinates
public static Coordinate[] toCoordinateArray(java.util.Collection coordList)
public static boolean hasRepeatedPoints(Coordinate[] coord)
public static Coordinate[] atLeastNCoordinatesOrNothing(int n, Coordinate[] c)
public static Coordinate[] removeRepeatedPoints(Coordinate[] coord)
hasRepeatedPoints(Coordinate[])
public static void reverse(Coordinate[] coord)
public static boolean equals(Coordinate[] coord1, Coordinate[] coord2)
Coordinate.equals(Object)
public static boolean equals(Coordinate[] coord1, Coordinate[] coord2, java.util.Comparator coordinateComparator)
CoordinateArrays.ForwardComparator
for Coordinate
s
coord1
- an array of Coordinatescoord2
- an array of CoordinatescoordinateComparator
- a Comparator for Coordinatespublic static Coordinate minCoordinate(Coordinate[] coordinates)
coordinates
- the array to search
compareTo
Coordinate.compareTo(Object)
public static void scroll(Coordinate[] coordinates, Coordinate firstCoordinate)
firstCoordinate
is first.
coordinates
- the array to rearrangefirstCoordinate
- the coordinate to make firstpublic static int indexOf(Coordinate coordinate, Coordinate[] coordinates)
coordinate
in
coordinates
. The first position is 0; the second, 1; etc.
coordinate
- the Coordinate
to search forcoordinates
- the array to search
coordinate
, or -1 if it is not
foundpublic static Coordinate[] extract(Coordinate[] pts, int start, int end)
Coordinate
array from indices
start
to end
(inclusive).
pts
- the input arraystart
- the index of the start of the subsequence to extractend
- the index of the end of the subsequence to extract
public static Coordinate[] toCoordinateArray(java.util.List<org.opengis.geometry.DirectPosition> aPositions)
aPositions
-
public static java.util.List<org.opengis.geometry.coordinate.Position> toPositionList(org.opengis.referencing.crs.CoordinateReferenceSystem crs, Coordinate[] coordArray)
coordArray
-
public static java.util.List<DirectPositionImpl> toDirectPositionList(org.opengis.referencing.crs.CoordinateReferenceSystem crs, Coordinate[] coordArray)
crs
- coordArray
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |