| | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.LinearRing; |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | |
| | | /** |
| | | * ShapeElement |
| | |
| | | super(raw); |
| | | } |
| | | |
| | | public Coordinate[] getVertices() |
| | | { |
| | | Coordinate[] result = super.getVertices(); |
| | | if ((result != null) && (result.length > 2)) |
| | | { |
| | | boolean isClosed = result[0].equals2D(result[result.length - 1]); |
| | | if (!isClosed) |
| | | { |
| | | double distance = result[0].distance(result[result.length - 1]); |
| | | if (distance < 0.00210) |
| | | { |
| | | result[result.length - 1] = new Coordinate(result[0]); |
| | | } else |
| | | { |
| | | logger.info("Shape is not closed. distance=" + distance); |
| | | logger.debug("result[0]=" + result[0].toString()); |
| | | logger.debug("result[length - 1]=" + result[result.length - 1]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public Geometry toGeometry(GeometryFactory factory) |
| | | { |
| | | try |