From 741f15ae46171a6df532f7e3727b0fc55acd7d39 Mon Sep 17 00:00:00 2001 From: ?? ? <ulysseskao@ximple.com.tw> Date: Mon, 01 Sep 2008 11:28:39 +0800 Subject: [PATCH] update for EOFM-156 --- xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ShapeElement.java | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ShapeElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ShapeElement.java index 945d11e..c43458e 100644 --- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ShapeElement.java +++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ShapeElement.java @@ -5,6 +5,7 @@ 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 @@ -22,6 +23,30 @@ 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 -- Gitblit v0.0.0-SNAPSHOT