com.vividsolutions.jts.geom.Coordinate [] coords = jtsBoundary.getCoordinates();
// If coords is emtpy, then this geometry is a ring. So we return
// an empty CurveBoundary object (i.e. one with both points set to
// null).
if ((coords == null) || (coords.length == 0)) {
CurveBoundaryImpl result = new CurveBoundaryImpl(
getCoordinateReferenceSystem(), null, null);
return result;
}
else {
// If it wasn't empty, then return a CurveBoundary with the two
// endpoints.
if (coords.length != 2) {
// Should this be an assert instead?
throw new RuntimeException("ERROR: One dimensional " +
"primitive had wrong number of boundary points (" +
coords.length + ")");
}
CoordinateReferenceSystem crs = getCoordinateReferenceSystem();
CurveBoundaryImpl result = new CurveBoundaryImpl(crs,
new PointImpl(JTSUtils.coordinateToDirectPosition(
coords[0], crs)),
new PointImpl(JTSUtils.coordinateToDirectPosition(
coords[1], crs)));
return result;