| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | { |
| | | 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[] |
| | |
| | | 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); |
| | | |
| | |
| | | { |
| | | 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]; |