From 6cbaecc154e0e63dea3e8ced7e26930fec092785 Mon Sep 17 00:00:00 2001 From: ?? ? <ulysseskao@ximple.com.tw> Date: Mon, 08 Sep 2008 13:01:11 +0800 Subject: [PATCH] update for EOFM-161 --- xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml | 2 +- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java | 2 +- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java | 42 +++++++++++++++++++++--------------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml b/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml index cce905d..73cb85a 100644 --- a/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml +++ b/xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml @@ -74,7 +74,7 @@ </entry> <entry> <key>CONVERTFILE</key> - <value>false</value> + <value>true</value> </entry> <entry> <key>CONVERTELEMIN</key> diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java index 961379e..f19cf00 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java @@ -73,7 +73,7 @@ private static final String PGPASS = "PGPASS"; private static final String USEWKB = "USEWKB"; - private static final boolean useTpclidText = true; + private static final boolean useTpclidText = false; private static final int FETCHSIZE = 30; private static final int COMMITSIZE = 100; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java index f7d33f1..4cfd27b 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java @@ -31,6 +31,7 @@ import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LinearRing; +import com.vividsolutions.jts.geom.Polygon; import com.ximple.eofms.util.DefaultColorTable; import com.ximple.eofms.util.FeatureTypeBuilderUtil; @@ -145,14 +146,14 @@ Feature feature = createFeature(element); if (feature == null) { - LinearRing ring = (LinearRing) element.toGeometry(geometryFactory); - if (ring == null) + Polygon polygon = (Polygon) element.toGeometry(geometryFactory); + if (polygon == null) { logger.info("cannot craete feature." + element.toString() + "'" + "linear is null" + "'"); } else { - Coordinate pt = ring.getEnvelopeInternal().centre(); + Coordinate pt = polygon.getEnvelopeInternal().centre(); String id = TPCLIDConverter.CoordinateToTpclId(pt); logger.info("cannot craete feature." + element.toString() + "'" + id + "'- from pt=" + pt); @@ -170,14 +171,14 @@ feature = createFeature2(element); if (feature == null) { - LinearRing ring = (LinearRing) element.toGeometry(geometryFactory); - if (ring == null) + Polygon polygon = (Polygon) element.toGeometry(geometryFactory); + if (polygon == null) { logger.info("cannot craete feature2." + element.toString() + "'" + "linear is null" + "'"); } else { - Coordinate pt = ring.getEnvelopeInternal().centre(); + Coordinate pt = polygon.getEnvelopeInternal().centre(); String id = TPCLIDConverter.CoordinateToTpclId(pt); logger.info("cannot craete feature2." + element.toString() + "'" + id + "'- from pt=" + pt); @@ -195,14 +196,14 @@ Feature[] features = createFeature3(element); if (features == null) { - LinearRing ring = (LinearRing) element.toGeometry(geometryFactory); - if (ring == null) + Polygon polygon = (Polygon) element.toGeometry(geometryFactory); + if (polygon == null) { logger.info("cannot craete feature3." + element.toString() + "'" + "linear is null" + "'"); } else { - Coordinate pt = ring.getEnvelopeInternal().centre(); + Coordinate pt = polygon.getEnvelopeInternal().centre(); String id = TPCLIDConverter.CoordinateToTpclId(pt); logger.info("cannot craete feature3." + element.toString() + "'" + id + "'- from pt=" + pt); @@ -561,17 +562,17 @@ { ShapeElement shapeElement = (ShapeElement) element; Geometry geomShape = shapeElement.toGeometry(geometryFactory); - LinearRing linearRing = (LinearRing) geomShape; - if (linearRing.isRectangle()) + Polygon polygon = (Polygon) geomShape; + if (polygon.isRectangle()) { - Envelope bounds = linearRing.getEnvelopeInternal(); + Envelope bounds = polygon.getEnvelopeInternal(); if (bounds.getWidth() == TPCLIDConverter.SX1200) { Coordinate center = bounds.centre(); String tpclid = TPCLIDConverter.CoordinateToTpclId(center); if (tpclid.length() > 5) { - tpclid = tpclid.substring(0, 4); + tpclid = tpclid.substring(0, 5); } Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); Geometry geom = geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] @@ -630,18 +631,17 @@ ShapeElement shapeElement = (ShapeElement) element; double angle = 0.0; Geometry geomShape = shapeElement.toGeometry(geometryFactory); - LinearRing linearRing = (LinearRing) geomShape; - - if (linearRing.isRectangle()) + Polygon polygon = (Polygon) geomShape; + if (polygon.isRectangle()) { - Envelope bounds = linearRing.getEnvelopeInternal(); + Envelope bounds = polygon.getEnvelopeInternal(); if (bounds.getWidth() == TPCLIDConverter.SX1200) { Coordinate center = bounds.centre(); String tpclid = TPCLIDConverter.CoordinateToTpclId(center); if (tpclid.length() > 5) { - tpclid = tpclid.substring(0, 4); + tpclid = tpclid.substring(0, 5); Coordinate pos = TWDDatumConverter.fromTM2ToTWD97(new Coordinate(center.x, center.y)); Geometry gobj = geometryFactory.createPoint(pos); @@ -717,10 +717,10 @@ { ShapeElement shapeElement = (ShapeElement) element; Geometry geomShape = shapeElement.toGeometry(geometryFactory); - LinearRing linearRing = (LinearRing) geomShape; - if (linearRing.isRectangle()) + Polygon polygon = (Polygon) geomShape; + if (polygon.isRectangle()) { - Envelope extent = linearRing.getEnvelopeInternal(); + Envelope extent = polygon.getEnvelopeInternal(); if (extent.getWidth() == TPCLIDConverter.SX1200) { Feature[] result = new Feature[4]; -- Gitblit v0.0.0-SNAPSHOT