public class PointList extends Object implements Iterable<GHPoint3D>, PointAccess
ShallowImmutablePointList if you change it or extend it, you should make sure that your
changes play well with the ShallowImmutablePointList to avoid unexpected issues.
| 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 PointList |
from(com.vividsolutions.jts.geom.LineString lineString) |
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() |
void |
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 ensureConsistency)
Create a shallow copy of this Pointlist from from to end, excluding end.
|
int |
size() |
List<Double[]> |
toGeoJson()
Attention: geoJson is LON,LAT or LON,LAT,ELE
|
List<Double[]> |
toGeoJson(boolean includeElevation) |
GHPoint3D |
toGHPoint(int index) |
String |
toString() |
void |
trimToSize(int newSize) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final PointList EMPTY
protected int size
protected boolean is3D
public boolean is3D()
is3D in interface PointAccesspublic int getDimension()
getDimension in interface PointAccesspublic void ensureNode(int nodeId)
PointAccessensureNode in interface PointAccesspublic void setNode(int nodeId,
double lat,
double lon)
PointAccessThis methods sets the latitude, longitude and elevation to the specified value.
setNode in interface PointAccesspublic void setNode(int nodeId,
double lat,
double lon,
double ele)
PointAccessThis methods sets the latitude, longitude and elevation to the specified value.
setNode in interface PointAccesspublic 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 PointAccesspublic double getLatitude(int index)
getLatitude in interface PointAccesspublic double getLon(int index)
getLon in interface PointAccesspublic double getLongitude(int index)
getLongitude in interface PointAccesspublic double getElevation(int index)
PointAccessgetElevation in interface PointAccesspublic void setElevation(int index,
double ele)
public double getEle(int index)
getEle in interface PointAccesspublic void reverse()
public void clear()
public void trimToSize(int newSize)
public PointList clone(boolean reverse)
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 ensureConsistency)
The ensureConsistency parameter makes this PointList immutable, so the shallow copy will stay
consistent with this object. 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 toGHPoint(int index)
public static PointList from(com.vividsolutions.jts.geom.LineString lineString)
public boolean isImmutable()
public void makeImmutable()
Copyright © 2012–2018. All rights reserved.