use of org.locationtech.jts.geom.CoordinateSequenceFactory in project hale by halestudio.
the class Line2D method toJTSLineString.
// functional methods ......................................................
/**
* This method will return this Line as a Java Topology Suite LineString.
*
* @param geometryFactory the factory for JTS geometries
* @return the converted LineString
*/
private org.locationtech.jts.geom.LineString toJTSLineString(GeometryFactory geometryFactory) {
Coordinate[] coords = new Coordinate[this.getPoints().length];
for (int i = 0; i < this.getPoints().length; i++) {
coords[i] = new Coordinate(this.getPoints()[i].getX(), this.getPoints()[i].getY());
}
CoordinateSequenceFactory csf = CoordinateArraySequenceFactory.instance();
CoordinateSequence cs = csf.create(coords);
org.locationtech.jts.geom.LineString jts_ls = new org.locationtech.jts.geom.LineString(cs, geometryFactory);
return jts_ls;
}
Aggregations