| | |
| | | package com.ximple.eofms.jobs; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.MalformedURLException; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.sql.ResultSet; |
| | |
| | | import org.apache.commons.collections.map.LinkedMap; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureCollection; |
| | | import org.geotools.feature.FeatureCollections; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.geometry.Geometry; |
| | | import org.quartz.JobDetail; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.LineElement; |
| | | import com.ximple.util.PrintfFormat; |
| | | |
| | | /** |
| | |
| | | this.second = second; |
| | | } |
| | | } |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | |
| | | public Log getLogger() |
| | | { |
| | |
| | | { |
| | | // OracleConnection connection = jobContext.getOracleConnection(); |
| | | // connection.commit(); |
| | | jobContext.commit(); |
| | | System.gc(); |
| | | } |
| | | } |
| | |
| | | |
| | | try |
| | | { |
| | | onBinaryElement(raw); |
| | | Element element = fetchBinaryElement(raw); |
| | | jobContext.putFeatureCollection(element); |
| | | |
| | | } catch (Dgn7fileException e) |
| | | { |
| | | logger.warn("Dgn7Exception", e); |
| | |
| | | |
| | | try |
| | | { |
| | | onBinaryElement(rawDest); |
| | | Element element = fetchBinaryElement(rawDest); |
| | | // Feature feature = convertElementToFeature(element); |
| | | } catch (Dgn7fileException e) |
| | | { |
| | | logger.warn("Dgn7Exception:" + e.getMessage(), e); |
| | |
| | | } |
| | | } |
| | | |
| | | private void onBinaryElement(byte[] raws) throws Dgn7fileException |
| | | private Element fetchBinaryElement(byte[] raws) throws Dgn7fileException |
| | | { |
| | | ByteBuffer buffer = ByteBuffer.wrap(raws); |
| | | buffer.order(ByteOrder.LITTLE_ENDIAN); |
| | |
| | | } |
| | | } |
| | | |
| | | Feature feature = convertElementToFeature(dgnElement); |
| | | return dgnElement; |
| | | } |
| | | |
| | | private Feature convertElementToFeature(Element dgnElement) |
| | | { |
| | | GeometryFactory geomFactory = new GeometryFactory(); |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance("Line"); |
| | | |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("GEOM", Geometry.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("TID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("OID", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("CID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LID", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("LEVEL", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMCOLOR", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMWEIGHT", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("SYMSTYLE", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("FONT", String.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("JUST", Integer.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("HEIGHT", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("WIDTH", Double.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("ANGLE", Double.class)); |
| | | |
| | | // typeBuilder.setNamespace(new URI("")); |
| | | /* |
| | | Feature feature = null; |
| | | try |
| | | { |
| | | FeatureType featureType = typeBuilder.getFeatureType(); |
| | | feature = featureType.create(new Object[]{ |
| | | ((LineElement) dgnElement).toGeometry(geomFactory) |
| | | ((LineElement) dgnElement).toGeometry(_geomFactory) |
| | | }); |
| | | |
| | | FeatureCollection features = FeatureCollections.newCollection(); |
| | |
| | | { |
| | | logger.warn(e.getMessage(), e); |
| | | } |
| | | */ |
| | | |
| | | |
| | | return null; |
| | |
| | | return true; |
| | | } |
| | | |
| | | public FeatureCollection loopupFeatureCollection(String name) |
| | | { |
| | | return null; |
| | | } |
| | | } |