1 files deleted
6 files modified
1 files added
| | |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeometryCoordinateDecorator.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleUpgradeBlob2UDTJob.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleUpgradeJobContext.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/TWD97GeometryConverterDecorator.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/BinConverter.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/Bits.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ByteArrayCompressor.java svneol=native#text/plain |
| | |
| | | */ |
| | | public class ComplexChainElement extends Element implements ComplexElement, GeometryConverter |
| | | { |
| | | ArrayList list = new ArrayList(); |
| | | protected ArrayList list = new ArrayList(); |
| | | |
| | | public ComplexChainElement(short[] raw) |
| | | { |
| | |
| | | public static final int PATTERN_HATCH = 0; |
| | | public static final int PRIMARY_CLASS = 0; |
| | | public static final int PRIMARY_RULE_CLASS = 0; |
| | | short[] raw; |
| | | byte attrOffset = 0; |
| | | |
| | | protected short[] raw; |
| | | protected byte attrOffset = 0; |
| | | |
| | | public Element(short[] raw) |
| | | { |
| | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | |
| | | import com.ximple.io.dgn7.*; |
| | | import com.ximple.eofms.jobs.TWD97GeometryConverterDecorator; |
| | | |
| | | public class CreateLineStringStrategy implements CreateFeatureTypeStrategy |
| | | { |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | FeatureTypeBuilder typeBuilder = null; |
| | | TWD97GeometryConverterDecorator convertDecordator = new TWD97GeometryConverterDecorator(); |
| | | |
| | | public CreateLineStringStrategy() |
| | | { |
| | |
| | | if (element instanceof LineStringElement) |
| | | { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | | convertDecordator.setConverter(lineStringElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | lineStringElement.toGeometry(geometryFactory), |
| | | convertDecordator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | |
| | | } else if (element instanceof ComplexChainElement) |
| | | { |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | convertDecordator.setConverter(complexChain); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | complexChain.toGeometry(geometryFactory), |
| | | convertDecordator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.eofms.jobs.TWD97GeometryConverterDecorator; |
| | | |
| | | public class CreateTextStrategy implements CreateFeatureTypeStrategy |
| | | { |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | FeatureTypeBuilder typeBuilder = null; |
| | | TWD97GeometryConverterDecorator convertDecordator = new TWD97GeometryConverterDecorator(); |
| | | |
| | | public CreateTextStrategy() |
| | | { |
| | |
| | | if (element instanceof TextElement) |
| | | { |
| | | TextElement txtElement = (TextElement) element; |
| | | convertDecordator.setConverter(txtElement); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | txtElement.toGeometry(geometryFactory), |
| | | convertDecordator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
| | |
| | | } else if (element instanceof TextNodeElement) |
| | | { |
| | | TextNodeElement nodeElement = (TextNodeElement) element; |
| | | convertDecordator.setConverter(nodeElement); |
| | | String[] texts = nodeElement.getTextArray(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (String text : texts) |
| | |
| | | } |
| | | |
| | | Feature feature = featureType.create(new Object[]{ |
| | | nodeElement.toGeometry(geometryFactory), |
| | | convertDecordator.toGeometry(geometryFactory), |
| | | (int) fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | | (int) fLinkage.getComponentID(), |
New file |
| | |
| | | package com.ximple.eofms.jobs; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.CoordinateSequenceFilter; |
| | | import com.vividsolutions.jts.geom.CoordinateSequence; |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.util.Assert; |
| | | |
| | | import com.ximple.io.dgn7.GeometryConverter; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | |
| | | public class TWD97GeometryConverterDecorator implements GeometryConverter |
| | | { |
| | | private GeometryConverter converter; |
| | | private TWD97ConvertFilter coordinatesFilter = new TWD97ConvertFilter(); |
| | | |
| | | public TWD97GeometryConverterDecorator() |
| | | { |
| | | } |
| | | |
| | | public GeometryConverter getConverter() |
| | | { |
| | | return converter; |
| | | } |
| | | |
| | | public void setConverter(GeometryConverter converter) |
| | | { |
| | | this.converter = converter; |
| | | } |
| | | |
| | | public Geometry toGeometry(GeometryFactory factory) |
| | | { |
| | | if (converter == null) Assert.shouldNeverReachHere(); |
| | | |
| | | coordinatesFilter.reset(); |
| | | |
| | | Geometry geom = converter.toGeometry(factory); |
| | | geom.apply(coordinatesFilter); |
| | | return geom; |
| | | } |
| | | |
| | | class TWD97ConvertFilter implements CoordinateSequenceFilter |
| | | { |
| | | private boolean done = false; |
| | | private boolean geometryChanged = false; |
| | | |
| | | public void filter(CoordinateSequence coordinateSequence, int i) |
| | | { |
| | | Coordinate pt = coordinateSequence.getCoordinateCopy(i); |
| | | Coordinate pt97 = TWDDatumConverter.toTWD97(pt); |
| | | pt.x = pt97.x; |
| | | pt.y = pt97.y; |
| | | pt.z = pt97.z; |
| | | done = (i >= coordinateSequence.size()); |
| | | geometryChanged = true; |
| | | } |
| | | |
| | | public boolean isDone() |
| | | { |
| | | return done; |
| | | } |
| | | |
| | | public boolean isGeometryChanged() |
| | | { |
| | | return geometryChanged; |
| | | } |
| | | |
| | | public void reset() |
| | | { |
| | | done = false; |
| | | geometryChanged = false; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ximple.eofms.util; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | |
| | | /** |
| | | * TWDDatumConverter |
| | | * User: Ulysses |
| | |
| | | /* |
| | | * datum convert function |
| | | */ |
| | | void toTWD97(double x, double y, double z) |
| | | public static Coordinate toTWD97(Coordinate pt) |
| | | { |
| | | double newX, newY, newZ; |
| | | double r, pole, sin_lat, cos_lat; |
| | |
| | | double x1, y1, z1, x2, y2, z2; |
| | | double q, q2, t, t1, s, s1, sum, sin_b, cos_b, sin_p, cos_p; |
| | | |
| | | lon = x * DEG_RAD; |
| | | lat = y * DEG_RAD; |
| | | height = z * DEG_RAD; |
| | | lon = pt.x * DEG_RAD; |
| | | lat = pt.y * DEG_RAD; |
| | | height = pt.z * DEG_RAD; |
| | | |
| | | if ((lat < -HALF_PI) && (lat > -1.001 * HALF_PI)) |
| | | { |
| | |
| | | lat = HALF_PI; |
| | | } else if ((lat < -HALF_PI) || (lat > HALF_PI)) |
| | | { |
| | | return; |
| | | return null; |
| | | } |
| | | |
| | | if (lon > PI) |
| | |
| | | newY = lat * RAD_DEG; |
| | | newZ = -TWD97_B; |
| | | |
| | | return; |
| | | return new Coordinate(newX, newY, newZ); |
| | | } |
| | | } |
| | | } |
| | |
| | | newX = lon * RAD_DEG; |
| | | newY = lat * RAD_DEG; |
| | | newZ = height; |
| | | return new Coordinate(newX, newY, newZ); |
| | | } |
| | | |
| | | void toTWD67(double x, double y, double z) |
| | | public static Coordinate toTWD67(Coordinate pt) |
| | | { |
| | | double newX, newY, newZ; |
| | | double r, pole, sin_lat, cos_lat; |
| | |
| | | double x1, y1, z1, x2, y2, z2; |
| | | double q, q2, t, t1, s, s1, sum, sin_b, cos_b, sin_p, cos_p; |
| | | |
| | | lon = x * DEG_RAD; |
| | | lat = y * DEG_RAD; |
| | | height = z * DEG_RAD; |
| | | lon = pt.x * DEG_RAD; |
| | | lat = pt.y * DEG_RAD; |
| | | height = pt.z * DEG_RAD; |
| | | |
| | | if ((lat < -HALF_PI) && (lat > -1.001 * HALF_PI)) |
| | | { |
| | |
| | | lat = HALF_PI; |
| | | } else if ((lat < -HALF_PI) || (lat > HALF_PI)) |
| | | { |
| | | return; |
| | | return null; |
| | | } |
| | | |
| | | if (lon > PI) |
| | |
| | | newY = lat * RAD_DEG; |
| | | newZ = -TWD67_B; |
| | | |
| | | return; |
| | | return new Coordinate(newX, newY, newZ); |
| | | } |
| | | } |
| | | } |
| | |
| | | newX = lon * RAD_DEG; |
| | | newY = lat * RAD_DEG; |
| | | newZ = height; |
| | | return new Coordinate(newX, newY, newZ); |
| | | } |
| | | |
| | | void toTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | public static void toTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | { |
| | | double x0, y0, x1, y1, m0, m1; |
| | | double n, t, c, A; |
| | |
| | | + (61.0 - 58.0 * t + t * t + 600.0 * c - 330.0 * ecc2) * Math.pow(A, 6.0) / 720.0)); |
| | | } |
| | | |
| | | void fromTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | public static void fromTM2(double a, double ecc, double ecc2, double lat, double lon, double scale, double x, double y) |
| | | { |
| | | double newX, newY; |
| | | double x0, y0, x1, y1, phi, m, m0, mu, e1; |
| | |
| | | / 72.0)) * RAD_DEG; |
| | | } |
| | | |
| | | double mercator(double y, double a, double ecc) |
| | | private static double mercator(double y, double a, double ecc) |
| | | { |
| | | if (y == 0.0) |
| | | { |