public LineString reverse() { Point[] points = this.getPoints(); int l = points.length; int i, j; Point[] p = new Point[l]; for (i = 0, j = l - 1; i < l; i++, j--) { p[i] = points[j]; } return new LineString(p); }
public LineString reverse() { Point[] points = this.getPoints(); int l = points.length; int i, j; Point[] p = new Point[l]; for (i = 0, j = l - 1; i < l; i++, j--) { p[i] = points[j]; } return new LineString(p); }
private void writeLineString(LineString geom, ValueSetter dest) { writePointArray(geom.getPoints(), dest); }
private int estimateLineString(LineString geom) { return estimatePointArray(geom.getPoints()); }
private int estimateLineString(LineString geom) { return estimatePointArray(geom.getPoints()); }
private void writeLineString(LineString geom, ValueSetter dest) { writePointArray(geom.getPoints(), dest); }
public double length() { if (len < 0) { Point[] points = this.getPoints(); if ((points == null) || (points.length < 2)) { len = 0; } else { double sum = 0; for (int i = 1; i < points.length; i++) { sum += points[i - 1].distance(points[i]); } len = sum; } } return len; } }
public double length() { if (len < 0) { Point[] points = this.getPoints(); if ((points == null) || (points.length < 2)) { len = 0; } else { double sum = 0; for (int i = 1; i < points.length; i++) { sum += points[i - 1].distance(points[i]); } len = sum; } } return len; } }
private static LineString convert(org.postgis.LineString geometry) { PointSequence points = convertPoints(geometry.getPoints()); return new LineString(points); }
private static LineString convert(org.postgis.LineString geometry) { PointSequence points = convertPoints(geometry.getPoints()); return new LineString(points); }
protected com.vividsolutions.jts.geom.LineString convertLineString( org.postgis.LineString lstr) { com.vividsolutions.jts.geom.LineString out = lstr.haveMeasure ? getGeometryFactory() .createMLineString(toJTSCoordinates(lstr.getPoints())) : getGeometryFactory().createLineString( toJTSCoordinates(lstr.getPoints())); return out; }
public LineString concat(LineString other) { Point[] points = this.getPoints(); Point[] opoints = other.getPoints(); boolean cutPoint = this.getLastPoint() == null || this.getLastPoint().equals(other.getFirstPoint()); int count = points.length + opoints.length - (cutPoint ? 1 : 0); Point[] p = new Point[count]; // Maybe we should use System.arrayCopy here? int i, j; for (i = 0; i < points.length; i++) { p[i] = points[i]; } if (!cutPoint) { p[i++] = other.getFirstPoint(); } for (j = 1; j < opoints.length; j++, i++) { p[i] = opoints[j]; } return new LineString(p); }
public LineString concat(LineString other) { Point[] points = this.getPoints(); Point[] opoints = other.getPoints(); boolean cutPoint = this.getLastPoint() == null || this.getLastPoint().equals(other.getFirstPoint()); int count = points.length + opoints.length - (cutPoint ? 1 : 0); Point[] p = new Point[count]; // Maybe we should use System.arrayCopy here? int i, j; for (i = 0; i < points.length; i++) { p[i] = points[i]; } if (!cutPoint) { p[i++] = other.getFirstPoint(); } for (j = 1; j < opoints.length; j++, i++) { p[i] = opoints[j]; } return new LineString(p); }
private com.vividsolutions.jts.geom.Geometry convertMultiLineString( MultiLineString mlstr) { com.vividsolutions.jts.geom.MultiLineString out; if (mlstr.haveMeasure) { MLineString[] lstrs = new MLineString[mlstr.numLines()]; for (int i = 0; i < mlstr.numLines(); i++) { MCoordinate[] coordinates = toJTSCoordinates(mlstr.getLine(i) .getPoints()); lstrs[i] = getGeometryFactory().createMLineString(coordinates); } out = getGeometryFactory().createMultiMLineString(lstrs); } else { com.vividsolutions.jts.geom.LineString[] lstrs = new com.vividsolutions.jts.geom.LineString[mlstr .numLines()]; for (int i = 0; i < mlstr.numLines(); i++) { lstrs[i] = getGeometryFactory().createLineString( toJTSCoordinates(mlstr.getLine(i).getPoints())); } out = getGeometryFactory().createMultiLineString(lstrs); } return out; }