public class PointList extends Object implements Iterable<GHPoint3D>, PointAccess
ShallowImmutablePointList
both are not designed for inheritance (but final is not possible if we keep it simple).Modifier and Type | Field and Description |
---|---|
static PointList |
EMPTY |
protected boolean |
is3D |
protected int |
size |
Constructor and Description |
---|
PointList() |
PointList(int cap,
boolean is3D) |
Modifier and Type | Method and Description |
---|---|
void |
add(double lat,
double lon) |
void |
add(double lat,
double lon,
double ele) |
void |
add(GHPoint point) |
void |
add(PointAccess nodeAccess,
int index) |
void |
add(PointList points) |
double |
calcDistance(DistanceCalc calc) |
void |
clear() |
PointList |
clone(boolean reverse)
Clones this PointList.
|
PointList |
copy(int from,
int end)
This method does a deep copy of this object for the specified range.
|
void |
ensureNode(int nodeId)
This method ensures that the node with the specified index exists i.e.
|
boolean |
equals(Object obj) |
static boolean |
equalsEps(double d1,
double d2) |
static boolean |
equalsEps(double d1,
double d2,
double epsilon) |
static PointList |
from(org.locationtech.jts.geom.LineString lineString) |
static PointList |
fromLineString(org.locationtech.jts.geom.LineString lineString) |
GHPoint3D |
get(int index) |
org.locationtech.jts.geom.LineString |
getCachedLineString(boolean includeElevation) |
int |
getDimension() |
double |
getEle(int index) |
double |
getElevation(int index)
Returns the elevation of the specified nodeId.
|
double |
getLat(int index) |
double |
getLatitude(int index) |
double |
getLon(int index) |
double |
getLongitude(int index) |
int |
getSize() |
int |
hashCode() |
boolean |
is3D() |
boolean |
isEmpty() |
boolean |
isImmutable() |
Iterator<GHPoint3D> |
iterator() |
PointList |
makeImmutable()
Once immutable, there is no way to make this object mutable again.
|
void |
parse2DJSON(String str)
Takes the string from a json array ala [lon1,lat1], [lon2,lat2], ...
|
void |
removeLastPoint() |
void |
reverse() |
void |
set(int index,
double lat,
double lon,
double ele) |
void |
setElevation(int index,
double ele) |
void |
setNode(int nodeId,
double lat,
double lon)
This method ensures that the node with the specified index exists and prepares access to it.
|
void |
setNode(int nodeId,
double lat,
double lon,
double ele)
This method ensures that the node with the specified index exists and prepares access to it.
|
PointList |
shallowCopy(int from,
int end,
boolean makeImmutable)
Create a shallow copy of this Pointlist from from to end, excluding end.
|
int |
size() |
org.locationtech.jts.geom.LineString |
toLineString(boolean includeElevation) |
String |
toString() |
void |
trimToSize(int newSize) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final PointList EMPTY
protected int size
protected boolean is3D
public boolean is3D()
is3D
in interface PointAccess
public int getDimension()
getDimension
in interface PointAccess
public void ensureNode(int nodeId)
PointAccess
ensureNode
in interface PointAccess
public void setNode(int nodeId, double lat, double lon)
PointAccess
This methods sets the latitude, longitude and elevation to the specified value.
setNode
in interface PointAccess
public void setNode(int nodeId, double lat, double lon, double ele)
PointAccess
This methods sets the latitude, longitude and elevation to the specified value.
setNode
in interface PointAccess
public void set(int index, double lat, double lon, double ele)
public void add(double lat, double lon)
public void add(double lat, double lon, double ele)
public void add(PointAccess nodeAccess, int index)
public void add(GHPoint point)
public void add(PointList points)
public void removeLastPoint()
public int size()
public int getSize()
public boolean isEmpty()
public double getLat(int index)
getLat
in interface PointAccess
public double getLatitude(int index)
getLatitude
in interface PointAccess
public double getLon(int index)
getLon
in interface PointAccess
public double getLongitude(int index)
getLongitude
in interface PointAccess
public double getElevation(int index)
PointAccess
getElevation
in interface PointAccess
public void setElevation(int index, double ele)
public double getEle(int index)
getEle
in interface PointAccess
public void reverse()
public void clear()
public void trimToSize(int newSize)
public static PointList fromLineString(org.locationtech.jts.geom.LineString lineString)
public org.locationtech.jts.geom.LineString toLineString(boolean includeElevation)
public org.locationtech.jts.geom.LineString getCachedLineString(boolean includeElevation)
public static boolean equalsEps(double d1, double d2)
public static boolean equalsEps(double d1, double d2, double epsilon)
public PointList clone(boolean reverse)
ShallowImmutablePointList
, the cloned PointList will be a regular PointList.public PointList copy(int from, int end)
from
- the copying of the old PointList starts at this indexend
- the copying of the old PointList ends at the index before (i.e. end is exclusive)public PointList shallowCopy(int from, int end, boolean makeImmutable)
makeImmutable
- makes this PointList immutable. If you don't ensure the consistency it might happen that due to changes of this
object, the shallow copy might contain incorrect or corrupt data.public double calcDistance(DistanceCalc calc)
public void parse2DJSON(String str)
public GHPoint3D get(int index)
public static PointList from(org.locationtech.jts.geom.LineString lineString)
public boolean isImmutable()
public PointList makeImmutable()
Copyright © 2012–2020. All rights reserved.