| | |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Iterator; |
| | | import java.net.MalformedURLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.FeatureTypeFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.transaction.util.CommonsLoggingLogger; |
| | | import org.apache.commons.transaction.util.LoggerFacade; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.apache.commons.transaction.memory.PessimisticMapWrapper; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.Feature; |
| | | 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 com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.Envelope; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.TPCLIDConverter; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.ShapeElement; |
| | | import com.ximple.io.dgn7.ComplexShapeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter; |
| | | import com.ximple.eofms.util.TPCLIDConverter; |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.StringUtils; |
| | | |
| | | public class IndexDgnConvertJobContext extends AbstractDgnFileJobContext |
| | | { |
| | | static Log logger = LogFactory.getLog(IndexDgnConvertJobContext.class); |
| | | static GeometryFactory geometryFactory = new GeometryFactory(); |
| | | private final static String SHPOUTPATH = "shpout"; |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | | |
| | |
| | | public IndexDgnConvertJobContext(String dataPath) |
| | | { |
| | | super(dataPath); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException |
| | |
| | | File sfile = new File(getDataOutPath() + "\\" + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | | FeatureWriter writer = null; |
| | | FeatureWriter writer; |
| | | if(featuresWriterContext.containsKey(featureType.getTypeName())) |
| | | { |
| | | writer = (FeatureWriter) featuresWriterContext.get(featureType.getTypeName()) ; |
| | |
| | | { |
| | | logger.error(e.getMessage(), e); |
| | | } |
| | | |
| | | } |
| | | |
| | | public String getDataOutPath() |
| | |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) |
| | | { |
| | | TextElement textElm = (TextElement) element; |
| | | String tpclid = textElm.getText(); |
| | | TextElement textElement = (TextElement) element; |
| | | String tpclid = textElement.getText(); |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | Geometry geom = geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | new Coordinate(extent.getMinX(), extent.getMinY()), |
| | | new Coordinate(extent.getMaxX(), extent.getMinY()), |
| | | new Coordinate(extent.getMaxX(), extent.getMaxY()), |
| | | new Coordinate(extent.getMinX(), extent.getMaxY()), |
| | | new Coordinate(extent.getMinX(), extent.getMinY()), |
| | | TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMaxX(), extent.getMinY())), |
| | | TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMaxX(), extent.getMaxY())), |
| | | TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMaxY())), |
| | | TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | }); |
| | | |
| | | TextElement textElement = (TextElement) element; |
| | | Feature feature = featureType.create(new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |