From 10445847ed1bfa5755127e828b603a3cdd49c5e3 Mon Sep 17 00:00:00 2001
From: ?? ? <ulysseskao@ximple.com.tw>
Date: Wed, 07 May 2008 12:58:22 +0800
Subject: [PATCH] update for EOFM-75

---
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ShapeElement.java |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 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 146f94f..16b930c 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
@@ -2,6 +2,9 @@
 
 //~--- non-JDK imports --------------------------------------------------------
 
+import org.apache.log4j.Logger;
+
+import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Geometry;
 import com.vividsolutions.jts.geom.GeometryFactory;
 import com.vividsolutions.jts.geom.LinearRing;
@@ -15,6 +18,8 @@
  */
 public class ShapeElement extends LineStringElement implements GeometryConverter
 {
+    static final Logger logger = Logger.getLogger(ShapeElement.class);
+
     public ShapeElement(short[] raw)
     {
         super(raw);
@@ -22,10 +27,15 @@
 
     public Geometry toGeometry(GeometryFactory factory)
     {
-        LinearRing ring = factory.createLinearRing(this.getVertices());
-        return factory.createPolygon(ring, null);
-
-        // return factory.createPolygon(ring, null);
+        try
+        {
+            LinearRing ring = factory.createLinearRing(this.getVertices());
+            return factory.createPolygon(ring, null);
+        } catch (IllegalArgumentException e)
+        {
+            logger.warn(e.getMessage(), e);
+            return null;
+        }
     }
 
     public static class ElementHandler extends Element.ElementHandler

--
Gitblit v0.0.0-SNAPSHOT