62 files modified
1 files added
| | |
| | | xdgnjobs/ximple-spatialjob/src/main/resources/conf/DefaultConvertShpFilter.xml svneol=native#text/xml |
| | | xdgnjobs/ximple-spatialjob/src/main/resources/conf/DefaultMapGroups.xml svneol=native#text/xml |
| | | xdgnjobs/ximple-spatialjob/src/test/java/com/ximple/eofms/filter/ElementDispatcherTest.java svneol=native#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/test/java/com/ximple/eofms/util/FeatureTypeBuilderUtilTest.java -text svneol=unset#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/test/java/com/ximple/eofms/util/FileUtilsTest.java -text svneol=unset#text/plain |
| | | xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testElementFilter.xml svneol=native#text/xml |
| | | xdgnjobs/ximple-spatialjob/src/test/resources/com/ximple/eofms/filter/test-data/testRules.xml svneol=native#text/xml |
| | |
| | | <failIfNoTests>false</failIfNoTests> |
| | | <stress.skip.pattern></stress.skip.pattern> |
| | | <online.skip.pattern></online.skip.pattern> |
| | | <java.awt.headless>false</java.awt.headless> |
| | | <allow.test.failure.ignore>false</allow.test.failure.ignore> |
| | | </properties> |
| | | |
| | |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-referencing</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-h2</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | |
| | |
| | | <dependency> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | | <version>1.5.0</version> |
| | | <version>1.5.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <version>1.7.3</version> |
| | | <version>1.8.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.awl</groupId> |
| | |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-main</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-h2</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>testng</artifactId> |
| | |
| | | <convention>gt2/jalopygeotools.xml</convention> |
| | | <failOnError>false</failOnError> |
| | | </configuration> |
| | | <!-- |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.geotools.maven</groupId> |
| | |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | </dependencies> |
| | | --> |
| | | </plugin> |
| | | |
| | | |
| | |
| | | import java.nio.charset.CharacterCodingException; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.CharsetDecoder; |
| | | import java.util.ArrayList; |
| | | |
| | | import org.apache.log4j.Logger; |
| | | |
| | |
| | | * |
| | | * @author Ulysses |
| | | * @version 0.1 |
| | | * @since 2006/5/18 �W�� 11:45:29 |
| | | * @since 2006/5/18 |
| | | */ |
| | | public class TextElement extends Element implements GeometryConverter { |
| | | private static final Logger logger = Logger.getLogger(TextElement.class); |
| | |
| | | |
| | | val.append(temp[i]); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | byte[] strRaw = new byte[num * 2]; |
| | | ArrayList byteResult = new ArrayList(); |
| | | for (int i = 0; i < num; i++) |
| | | { |
| | | short charValue = raw[i + 31]; |
| | |
| | | byte lo = (byte) charValue; |
| | | strRaw[i * 2] = hi; |
| | | strRaw[i * 2 + 1] = lo; |
| | | |
| | | } |
| | | |
| | | try { |
| | |
| | | |
| | | <!-- Ximple Library --> |
| | | <dependency> |
| | | <artifactId>ximple-dgnio</artifactId> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <version>${xdgnio.version}</version> |
| | | <artifactId>ximple-dgnio</artifactId> |
| | | <version>1.2.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>ximple-spatialjob</artifactId> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <version>${xdgnio.version}</version> |
| | | <artifactId>ximple-spatialjob</artifactId> |
| | | <version>1.2.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | |
| | | Use maven from the command line: |
| | | mvn exec:java -Dexec.mainClass="com.ximple.eofms.XElementParser" |
| | | --> |
| | | <artifactId>exec-maven-plugin</artifactId> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <artifactId>exec-maven-plugin</artifactId> |
| | | <version>1.1.1</version> |
| | | <!-- |
| | | <executions> |
| | | <execution> |
| | |
| | | <plugin> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-jar-collector</artifactId> |
| | | <version>${project.version}</version> |
| | | <version>1.2.0</version> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | |
| | | Use maven from the command line: |
| | | mvn exec:java -Dexec.mainClass="com.ximple.eofms.XQuartzJobCarrier" |
| | | --> |
| | | <artifactId>exec-maven-plugin</artifactId> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <!-- |
| | | <artifactId>exec-maven-plugin</artifactId> |
| | | <version>1.1.1</version> |
| | | <executions> |
| | | <execution> |
| | | <phase>package</phase> |
| | | <!--<phase>package</phase> --> |
| | | <goals> |
| | | <goal>run</goal> |
| | | <goal>java</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | --> |
| | | <configuration> |
| | | <mainClass>com.ximple.eofms.XQuartzJobCarrier</mainClass> |
| | | <!-- |
| | | <commandlineArgs>-wizard</commandlineArgs> |
| | | <commandlineArgs>-Dlog4j.configuration=log4j.properties</commandlineArgs> |
| | | --> |
| | | <systemProperties> |
| | | <systemProperty> |
| | | <key>log4j.configuration</key> |
| | | <value>log4j.properties</value> |
| | | </systemProperty> |
| | | </systemProperties> |
| | | </configuration> |
| | | <!-- |
| | | <dependencies> |
| | |
| | | --> |
| | | <resource> |
| | | <directory>src/main/resources</directory> |
| | | <!-- |
| | | <includes> |
| | | <include>log4j.properties</include> |
| | | <include>quartz.properties</include> |
| | | <include>quartz_jobs.xml</include> |
| | | </includes> |
| | | --> |
| | | <!-- |
| | | <excludes> |
| | | <exclude>log4j.properties</exclude> |
| | | <exclude>quartz_jobs.xml</exclude> |
| | | </excludes> |
| | | --> |
| | | <!-- |
| | | <excludes> |
| | | <exclude>XQuartzJobWizard*.properties</exclude> |
| | |
| | | static Log logger = LogFactory.getLog(XQuartzJobCarrier.class); |
| | | static Options options = new Options(); |
| | | |
| | | private static final String VERSION = "0.9.0"; |
| | | private static final String VERSION = "1.2.0"; |
| | | |
| | | public static void main(String[] args) { |
| | | XQuartzJobCarrier instance = new XQuartzJobCarrier(); |
| | |
| | | #Configure JobStore |
| | | #=============================================================== |
| | | org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore |
| | | org.quartz.jobStore.misfireThreshold = 60000 |
| | | |
| | | #=============================================================== |
| | | #Configure Plugins |
| | | #=============================================================== |
| | | org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin |
| | | org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin |
| | | |
| | | org.quartz.plugin.jobInitializer.fileName = quartz_jobs.xml |
| | | #org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin |
| | | org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin |
| | | |
| | | org.quartz.plugin.jobInitializer.overWriteExistingJobs = true |
| | | org.quartz.plugin.jobInitializer.fileNames = quartz_jobs.xml |
| | | |
| | | #org.quartz.plugin.jobInitializer.overWriteExistingJobs = true |
| | | org.quartz.plugin.jobInitializer.failOnFileNotFound = true |
| | | org.quartz.plugin.jobInitializer.validating=false |
| | | #org.quartz.plugin.jobInitializer.validating=false |
| | | org.quartz.plugin.jobInitializer.scanInterval = 120 |
| | | org.quartz.plugin.jobInitializer.wrapInUserTransaction = false |
| | | |
| | | org.quartz.plugin.shutdownhook.class = org.quartz.plugins.management.ShutdownHookPlugin |
| | | org.quartz.plugin.shutdownhook.cleanShutdown = true |
| | |
| | | <?xml version='1.0' encoding='utf-8'?> |
| | | |
| | | <quartz xmlns="http://www.opensymphony.com/quartz/JobSchedulingData" |
| | | <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://www.opensymphony.com/quartz/JobSchedulingData |
| | | http://www.opensymphony.com/quartz/xml/job_scheduling_data_1_5.xsd" |
| | | version="1.5"> |
| | | xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" |
| | | version="1.8"> |
| | | |
| | | <pre-processing-commands> |
| | | <delete-jobs-in-group>*</delete-jobs-in-group> |
| | | <!-- clear all jobs in scheduler --> |
| | | <delete-triggers-in-group>*</delete-triggers-in-group> |
| | | <!-- clear all triggers in scheduler --> |
| | | </pre-processing-commands> |
| | | |
| | | <processing-directives> |
| | | <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> |
| | | <overwrite-existing-data>true</overwrite-existing-data> |
| | | <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> |
| | | <ignore-duplicates>false</ignore-duplicates> |
| | | </processing-directives> |
| | | |
| | | <schedule> |
| | | <job> |
| | | <job-detail> |
| | | <name>ConvertDgn2PostGisIntoPostgre</name> |
| | | <group>DEFAULT</group> |
| | | <description>A job that convert dgn to shapefiles</description> |
| | |
| | | <volatility>false</volatility> |
| | | <durability>false</durability> |
| | | <recover>false</recover> |
| | | <job-data-map allows-transient-data="true"> |
| | | <!--job-data-map allows-transient-data="true"--> |
| | | <job-data-map> |
| | | <entry> |
| | | <key>JOBDATA_DIR</key> |
| | | <value>C:\DBS\XDGNDATA</value> |
| | | <value>C:\Usr\Projects\XDCAD\nstpcjobs</value> |
| | | </entry> |
| | | <entry> |
| | | <key>PGHOST</key> |
| | | <value>127.0.0.1</value> |
| | | <value>192.168.11.99</value> |
| | | </entry> |
| | | <entry> |
| | | <key>PGDDATBASE</key> |
| | | <value>tpc</value> |
| | | <value>pgNSTPC</value> |
| | | </entry> |
| | | <entry> |
| | | <key>PGPORT</key> |
| | |
| | | </entry> |
| | | <entry> |
| | | <key>PGUSER</key> |
| | | <value>spatialdb</value> |
| | | <value>tpcdb</value> |
| | | </entry> |
| | | <entry> |
| | | <key>PGPASS</key> |
| | | <value>spatialdb000</value> |
| | | <value>simple000</value> |
| | | </entry> |
| | | <entry> |
| | | <key>ORAHOST</key> |
| | | <value>10.206.120.190</value> |
| | | <value>192.168.11.200</value> |
| | | </entry> |
| | | <entry> |
| | | <key>ORAINST</key> |
| | |
| | | <value>true</value> |
| | | </entry> |
| | | <entry> |
| | | <key>USEEPSG3826</key> |
| | | <key>USEZONE121</key> |
| | | <value>true</value> |
| | | </entry> |
| | | </job-data-map> |
| | | </job-detail> |
| | | </job> |
| | | |
| | | <trigger> |
| | | <simple> |
| | |
| | | </simple> |
| | | </trigger> |
| | | |
| | | </job> |
| | | </quartz> |
| | | </schedule> |
| | | </job-scheduling-data> |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateArcLineStringStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | ArcElement lineStringElement = (ArcElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineStringElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineStringElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(lineStringElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateComplexChainStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | if (element instanceof LineStringElement) { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | | Geometry gobj; |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineStringElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineStringElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | convertDecorator.setConverter(lineStringElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(complexChain); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(complexChain); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(complexChain); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else |
| | | gobj = complexChain.toGeometry(geometryFactory); |
| | | if (gobj instanceof LineString) { |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | LineElement lineElement = (LineElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(lineElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineElement.toGeometry(geometryFactory); |
| | | } |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | ArcElement arcElement = (ArcElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(arcElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(arcElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(arcElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = arcElement.toGeometry(geometryFactory); |
| | | } |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateEllipseShapeStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateShapeStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | EllipseElement ellipseElement = (EllipseElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(ellipseElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(ellipseElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(ellipseElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = ellipseElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException; |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException; |
| | | boolean useTransform) throws IllegalAttributeException; |
| | | |
| | | public void addCreateFeatureTypeEventListener(CreateFeatureTypeEventListener listener); |
| | | |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateLineStringStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineStringElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineStringElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(lineStringElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(complexChain); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(complexChain); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(complexChain); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = complexChain.toGeometry(geometryFactory); |
| | | } |
| | |
| | | gobj = geometryFactory.createLineString(coordinateList.toCoordinateArray()); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | LineElement lineElement = (LineElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(lineElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | ArcElement arcElement = (ArcElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(arcElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(arcElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(arcElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = arcElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateLineTextStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineTextStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineStringElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineStringElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(lineStringElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | ptEnd.y = ptOrigin.y + txtElement.getTextHeight(); |
| | | Coordinate[] vect = new Coordinate[2]; |
| | | if (useTransform) { |
| | | vect[0] = useEPSG3826 ? |
| | | vect[0] = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826) ? |
| | | TWDDatumConverter.fromTM2ToEPSG3826(ptOrigin) : |
| | | TWDDatumConverter.fromTM2ToEPSG3825(ptOrigin); |
| | | vect[1] = useEPSG3826 ? |
| | | vect[1] = FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | TWDDatumConverter.fromTM2ToEPSG3826(ptEnd) : |
| | | TWDDatumConverter.fromTM2ToEPSG3825(ptEnd); |
| | | } else { |
| | |
| | | |
| | | txtElement.getRotationAngle(); |
| | | |
| | | line.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | line, |
| | | fLinkage.getFsc(), |
| | |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(complexChain); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(complexChain); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(complexChain); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = complexChain.toGeometry(geometryFactory); |
| | | } |
| | |
| | | gobj = geometryFactory.createLineString(coordinateList.toCoordinateArray()); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | LineElement lineElement = (LineElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(lineElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(lineElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(lineElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = lineElement.toGeometry(geometryFactory); |
| | | } |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | import com.vividsolutions.jts.geom.CoordinateList; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.PrecisionModel; |
| | | import com.vividsolutions.jts.util.Assert; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateMultiSymbolStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateMultiSymbolStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826AnchorGeometryConverterDecorator(), |
| | | new EPSG3825AnchorGeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(txtElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(txtElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = txtElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | |
| | | Iterator<Element> txtElement = nodeElement.iterator(); |
| | | |
| | | while(txtElement.hasNext()) |
| | | { |
| | | while (txtElement.hasNext()) { |
| | | if (txtElement instanceof TextElement) { |
| | | TextElement txtChildElement = (TextElement) element; |
| | | |
| | | char[] charArray = txtChildElement.getText().toCharArray(); |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | for(int i = 0 ; i < charArray.length ; i++) |
| | | { |
| | | for (int i = 0; i < charArray.length; i++) { |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("OCT"); |
| | |
| | | |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(txtChildElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(txtChildElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtChildElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = txtChildElement.toGeometry(geometryFactory); |
| | | } |
| | | |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | sb.toString() |
| | | }, null); |
| | | } |
| | | } else { |
| | | logger.info("CreateMultiSymbolStrategy cannot conver " + element.toString() + "to Feature"); |
| | | return null; |
| | | } |
| | | } |
| | | } else { |
| | | logger.info("CreateMultiSymbolStrategy cannot conver " + element.toString() + "to Feature"); |
| | | return null; |
| | | } |
| | | return feature; |
| | | } |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateShapeStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateShapeStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | ShapeElement shapeElement = (ShapeElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(shapeElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(shapeElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(shapeElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = shapeElement.toGeometry(geometryFactory); |
| | | } |
| | | |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | ComplexShapeElement complexShape = (ComplexShapeElement) element; |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(complexShape); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(complexShape); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(complexShape); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = complexShape.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateSymbolStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateSymbolStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(txtElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(txtElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = txtElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | |
| | | |
| | | public class CreateTextStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateTextStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | | }; |
| | | |
| | | // Create the listener list |
| | | protected EventListenerList listenerList = new EventListenerList(); |
| | |
| | | } |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | boolean useTransform) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | SimpleFeature feature = null; |
| | |
| | | content = content.replace('\u0000', ' '); |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(txtElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(txtElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = txtElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | Geometry gobj; |
| | | if (useTransform) { |
| | | if (useEPSG3826) { |
| | | convertDecorator[0].setConverter(nodeElement); |
| | | gobj = convertDecorator[0].toGeometry(geometryFactory); |
| | | } else { |
| | | convertDecorator[1].setConverter(nodeElement); |
| | | gobj = convertDecorator[1].toGeometry(geometryFactory); |
| | | } |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(nodeElement); |
| | | gobj = convertDecorator.toGeometry(geometryFactory); |
| | | } else { |
| | | gobj = nodeElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | |
| | | public interface ElementDispatchableFilter { |
| | | public boolean isDispatchable(Element element); |
| | | |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826); |
| | | public SimpleFeature execute(Element element, boolean useTransform); |
| | | |
| | | void setUseLongName(boolean useLongName); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform) { |
| | | for (ElementDispatchableFilter rule : rules) { |
| | | if (rule.isDispatchable(element)) { |
| | | return rule.execute(element, useTransform, useEPSG3826); |
| | | return rule.execute(element, useTransform); |
| | | } |
| | | } |
| | | return null; |
| | |
| | | (compareType(element) == 0); |
| | | } |
| | | |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform) { |
| | | try { |
| | | String ftName = getFeatureTypeName(element); |
| | | SimpleFeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | return createStrategy.createFeature(ftype, element, useTransform, useEPSG3826); |
| | | return createStrategy.createFeature(ftype, element, useTransform); |
| | | } catch (SchemaException e) { |
| | | logger.error(e.getMessage(), e); |
| | | } catch (IllegalAttributeException e) { |
| | |
| | | (lid == element.getLevelIndex()) && (compareLevel(element) == 0); |
| | | } |
| | | |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform) { |
| | | try { |
| | | String ftName = getFeatureTypeName(element); |
| | | SimpleFeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | return createStrategy.createFeature(ftype, element, useTransform, useEPSG3826); |
| | | return createStrategy.createFeature(ftype, element, useTransform); |
| | | } catch (SchemaException e) { |
| | | logger.error(e.getMessage(), e); |
| | | } catch (IllegalAttributeException e) { |
| | |
| | | (compareType(element) == 0); |
| | | } |
| | | |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform) { |
| | | try { |
| | | String ftName = getFeatureTypeName(element); |
| | | SimpleFeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | return createStrategy.createFeature(ftype, element, useTransform, useEPSG3826); |
| | | return createStrategy.createFeature(ftype, element, useTransform); |
| | | } catch (SchemaException e) { |
| | | logger.error(e.getMessage(), e); |
| | | } catch (IllegalAttributeException e) { |
| | |
| | | import java.util.StringTokenizer; |
| | | import java.util.TreeMap; |
| | | |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import org.apache.commons.logging.Log; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | |
| | | private static final String TESTCOUNT = "TESTCOUNT"; |
| | | private static final String COPYCONNECTIVITYMODE = "COPYCONNECTIVITYMODE"; |
| | | private static final String PROFILEMODE = "PROFILEMODE"; |
| | | private static final String USEEPSG3826 = "USEEPSG3826"; |
| | | private static final String USEZONE121 = "USEZONE121"; |
| | | |
| | | protected static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory(); |
| | | |
| | |
| | | protected boolean _testMode = false; |
| | | protected boolean _copyConnectivityMode = false; |
| | | protected boolean _profileMode = false; |
| | | protected boolean _useEPSG3826 = true; |
| | | protected boolean _useZone121 = true; |
| | | protected boolean _useTransform = true; |
| | | |
| | | protected int _testCount = -1; |
| | |
| | | _testCount = dataMap.getIntFromString(TESTCOUNT); |
| | | _copyConnectivityMode = dataMap.getBooleanFromString(COPYCONNECTIVITYMODE); |
| | | _profileMode = dataMap.getBooleanFromString(PROFILEMODE); |
| | | _useEPSG3826 = dataMap.getBooleanFromString(USEEPSG3826); |
| | | _useZone121 = dataMap.getBooleanFromString(USEZONE121); |
| | | if (_useZone121) { |
| | | FeatureTypeBuilderUtil.setDefaultFeatureSRID(3826); |
| | | } else { |
| | | FeatureTypeBuilderUtil.setDefaultFeatureSRID(3825); |
| | | } |
| | | |
| | | // Validate the required input |
| | | if (_dataPath == null) { |
| | |
| | | } |
| | | |
| | | protected abstract AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, |
| | | boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826); |
| | | boolean profileMode, boolean useTransform); |
| | | |
| | | protected byte[] getBytesFromBLOB(BLOB blob) throws SQLException, BufferOverflowException { |
| | | byte[] raw = null; |
| | |
| | | return _useTransform; |
| | | } |
| | | |
| | | public boolean isEPSG3826() { |
| | | return _useEPSG3826; |
| | | public boolean isZone121() { |
| | | return _useZone121; |
| | | } |
| | | |
| | | public DataStore getSourceDataStore() { |
| | |
| | | public class DummyFeatureConvertJobContext extends AbstractDgnFileJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | private String _filterConfig; |
| | | |
| | | public DummyFeatureConvertJobContext(String dataPath, String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | return; |
| | | } |
| | | |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | protected static MySQLDataStoreFactory dataStoreFactory = new MySQLDataStoreFactory(); |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | protected String _myHost; |
| | | protected String _myDatabase; |
| | | protected String _myPort; |
| | |
| | | } |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | boolean useTransform) { |
| | | return new OracleConvertMySQLJobContext(getDataPath(), getTargetDataStore(), filterPath, profileMode, |
| | | useTransform, useEPSG3826); |
| | | useTransform); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { |
| | |
| | | for (String orgSchema : _orgSchema) { |
| | | OracleConvertMySQLJobContext jobContext = |
| | | (OracleConvertMySQLJobContext) prepareJobContext(targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | // jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | IndexDgnConvertMySQLJobContext convertContext = |
| | | new IndexDgnConvertMySQLJobContext(getDataPath(), getTargetDataStore(), isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | GeneralDgnConvertMySQLJobContext convertContext = |
| | | new GeneralDgnConvertMySQLJobContext(getDataPath(), getTargetDataStore(), isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | FeatureDgnConvertMySQLJobContext convertContext = |
| | | new FeatureDgnConvertMySQLJobContext(getDataPath(), getTargetDataStore(), _filterPath, isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | |
| | | protected static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory(); |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | protected String _sdoHost; |
| | | protected String _sdoDatabase; |
| | | protected String _sdoPort; |
| | |
| | | } |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | boolean profileMode, boolean useTransform) { |
| | | return new OracleConvertOraSDOJobContext(getDataPath(), getTargetDataStore(), filterPath, profileMode, |
| | | useTransform, useEPSG3826); |
| | | useTransform); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { |
| | |
| | | for (String orgSchema : _orgSchema) { |
| | | OracleConvertOraSDOJobContext jobContext = |
| | | (OracleConvertOraSDOJobContext) prepareJobContext(targetSchemaName, _filterPath, |
| | | isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | // jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | IndexDgnConvertOraSDOJobContext convertContext = |
| | | new IndexDgnConvertOraSDOJobContext(getDataPath(), getTargetDataStore(), isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | GeneralDgnConvertOraSDOJobContext convertContext = |
| | | new GeneralDgnConvertOraSDOJobContext(getDataPath(), getTargetDataStore(), isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | FeatureDgnConvertOraSDOJobContext convertContext = |
| | | new FeatureDgnConvertOraSDOJobContext(getDataPath(), getTargetDataStore(), _filterPath, isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import oracle.jdbc.OracleConnection; |
| | | import oracle.jdbc.OracleResultSet; |
| | | import oracle.sql.ARRAY; |
| | |
| | | import com.ximple.io.dgn7.ElementType; |
| | | import com.ximple.io.dgn7.IElementHandler; |
| | | import com.ximple.io.dgn7.Lock; |
| | | import com.ximple.io.dgn7.ShapeElement; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.util.PrintfFormat; |
| | | |
| | | public class OracleConvertDgn2PostGISJob extends AbstractOracleDatabaseJob { |
| | |
| | | |
| | | protected static PostgisDataStoreFactory dataStoreFactory = new PostgisDataStoreFactory(); |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | protected String _pgHost; |
| | | protected String _pgDatabase; |
| | | protected String _pgPort; |
| | |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, |
| | | boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | boolean useTransform) { |
| | | return new OracleConvertPostGISJobContext(getDataPath(), |
| | | getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform, useEPSG3826); |
| | | getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { |
| | |
| | | |
| | | OracleConvertPostGISJobContext jobContext = |
| | | (OracleConvertPostGISJobContext) prepareJobContext(targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | // jobContext.setConvertElementIn(_convertElementIn); |
| | | jobContext.setElementLogging(checkElementLogging()); |
| | | jobContext.setExecutionContext(context); |
| | | |
| | | CreateHibernateSequence(jobContext); |
| | | createHibernateSequence(jobContext); |
| | | |
| | | long tStep = System.currentTimeMillis(); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | private void CreateHibernateSequence(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | private void createHibernateSequence(OracleConvertPostGISJobContext jobContext) throws SQLException { |
| | | Connection connection = jobContext.getOracleConnection(); |
| | | |
| | | try { |
| | |
| | | stmt.close(); |
| | | } catch (SQLException e) |
| | | { |
| | | logger.warn("HIBERNATE_SEQUENCE �w�g�s�b"); |
| | | logger.warn("HIBERNATE_SEQUENCE is already exist."); |
| | | } |
| | | } |
| | | |
| | |
| | | if (dgnFile.isDirectory()) continue; |
| | | IndexDgnConvertPostGISJobContext convertContext = |
| | | new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start index dgnfile-" + dgnFile.toString() + " ---"); |
| | | FileInputStream fs = null; |
| | | FileChannel fc = null; |
| | |
| | | |
| | | GeneralDgnConvertPostGISJobContext convertContext = |
| | | new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start other dgnfile-" + dgnFile.toString() + " ---"); |
| | | FileInputStream fs = null; |
| | | FileChannel fc; |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | FeatureDgnConvertPostGISJobContext convertContext = |
| | | new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, _filterPath, |
| | | isProfileMode(), isTransformed(), isEPSG3826()); |
| | | isProfileMode(), isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | |
| | | sql = new StringBuilder("ALTER TABLE "); |
| | | sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); |
| | | sql.append(" OWNER TO spatialdb"); |
| | | sql.append(" OWNER TO ").append(_pgUsername); |
| | | stmt.executeUpdate(sql.toString()); |
| | | |
| | | sql = new StringBuilder("GRANT ALL ON TABLE "); |
| | |
| | | |
| | | StringBuilder sbSQL = new StringBuilder("CREATE SCHEMA "); |
| | | sbSQL.append(s).append(' '); |
| | | sbSQL.append("AUTHORIZATION spatialdb"); |
| | | sbSQL.append("AUTHORIZATION ").append(_pgUsername); |
| | | stmt = connection.createStatement(); |
| | | stmt.executeUpdate(sbSQL.toString()); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | GeometryFactory _geomFactory = new GeometryFactory(); |
| | | |
| | | public Log getLogger() { |
| | | return logger; |
| | | } |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | return new OracleConvertShapefilesJobContext(filterPath, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | return new OracleConvertShapefilesJobContext(filterPath, profileMode, useTransform); |
| | | } |
| | | |
| | | protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { |
| | |
| | | |
| | | for (String orgSchema : _orgSchema) { |
| | | OracleConvertShapefilesJobContext jobContext = (OracleConvertShapefilesJobContext) |
| | | prepareJobContext(targetSchemaName, _filterPath, isProfileMode(), isTransformed(), isEPSG3826()); |
| | | prepareJobContext(targetSchemaName, _filterPath, isProfileMode(), isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | jobContext.setDataPath(_dataPath); |
| | | jobContext.setConvertElementIn(_convertElementIn); |
| | |
| | | |
| | | for (File dgnFile : dgnFiles) { |
| | | IndexDgnConvertShpJobContext convertContext = new IndexDgnConvertShpJobContext(getDataPath(), isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | GeneralDgnConvertShpJobContext convertContext = new GeneralDgnConvertShpJobContext(getDataPath(), |
| | | isProfileMode(), |
| | | isTransformed(), |
| | | isEPSG3826()); |
| | | isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | for (File dgnFile : dgnFiles) { |
| | | FeatureDgnConvertShpJobContext convertContext = new FeatureDgnConvertShpJobContext(getDataPath(), _filterPath, |
| | | isProfileMode(), |
| | | isTransformed(), |
| | | isEPSG3826()); |
| | | isTransformed()); |
| | | logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); |
| | | try { |
| | | convertContext.setExecutionContext(context); |
| | |
| | | } |
| | | |
| | | AbstractOracleJobContext jobContext = prepareJobContext(targetSchemaName, _filterPath, isProfileMode(), |
| | | isTransformed(), isEPSG3826()); |
| | | isTransformed()); |
| | | jobContext.setSourceDataStore(getSourceDataStore()); |
| | | |
| | | try { |
| | |
| | | |
| | | protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, |
| | | boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | return new OracleUpgradeJobContext(profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | return new OracleUpgradeJobContext(profileMode, useTransform); |
| | | } |
| | | |
| | | private void exetcuteConvert(AbstractOracleJobContext jobContext, |
| | |
| | | private boolean _elementLogging;
|
| | | private boolean _profileMode = false;
|
| | | private boolean _useTransform = true;
|
| | | private boolean _useEPSG3826 = true;
|
| | |
|
| | | private long _processTime;
|
| | | private long _updateTime;
|
| | |
| | | // --------------------------- CONSTRUCTORS ---------------------------
|
| | |
|
| | | public AbstractDgnFileJobContext(String dataPath, boolean profileMode,
|
| | | boolean useTransform, boolean useEPSG3826) {
|
| | | boolean useTransform) {
|
| | | _dataPath = dataPath;
|
| | | _profileMode = profileMode;
|
| | | _useTransform = useTransform;
|
| | | _useEPSG3826 = useEPSG3826;
|
| | | }
|
| | |
|
| | | // --------------------- GETTER / SETTER METHODS ---------------------
|
| | |
| | |
|
| | | public boolean isTransformed() {
|
| | | return _useTransform;
|
| | | }
|
| | |
|
| | | public boolean isEPSG3826() {
|
| | | return _useEPSG3826;
|
| | | }
|
| | |
|
| | | // -------------------------- OTHER METHODS --------------------------
|
| | |
| | | private Connection connection = null; |
| | | private boolean profileMode; |
| | | private boolean useTransform; |
| | | private boolean useEPSG3826; |
| | | |
| | | private long _processTime; |
| | | private long _updateTime; |
| | | private long _processTimeStart; |
| | | private long _updateTimeStart; |
| | | |
| | | public AbstractOracleJobContext(boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | public AbstractOracleJobContext(boolean profileMode, boolean useTransform) { |
| | | this.profileMode = profileMode; |
| | | this.useTransform = useTransform; |
| | | this.useEPSG3826 = useEPSG3826; |
| | | } |
| | | |
| | | public OracleDataStore getSourceDataStore() { |
| | |
| | | |
| | | public boolean isTransformed() { |
| | | return useTransform; |
| | | } |
| | | |
| | | public boolean isEPSG3826() { |
| | | return useEPSG3826; |
| | | } |
| | | |
| | | public final void accumulateProcessTime() { |
| | |
| | | import org.apache.commons.logging.Log; |
| | | |
| | | public class OracleUpgradeJobContext extends AbstractOracleJobContext { |
| | | public OracleUpgradeJobContext(boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(profileMode, useTransform, useEPSG3826); |
| | | public OracleUpgradeJobContext(boolean profileMode, boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | } |
| | | |
| | | public void startTransaction() { |
| | |
| | | protected MySQLDataStore targetDataStore; |
| | | |
| | | public AbstractDgnToMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | this.targetDataStore = (MySQLDataStore) targetDataStore; |
| | | } |
| | | |
| | |
| | | protected MySQLDataStore targetDataStore; |
| | | |
| | | public AbstractOracleToMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof MySQLDataStore)) { |
| | | this.targetDataStore = (MySQLDataStore) targetDataStore; |
| | | } else { |
| | |
| | | public class DummyFeatureConvertMySQlJobContext extends AbstractDgnToMySQLJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertMySQlJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public DummyFeatureConvertMySQlJobContext(String dataPath, DataStore targetDataStore, String filterConfig, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | return; |
| | | } |
| | | |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | public class FeatureDgnConvertMySQLJobContext extends AbstractDgnToMySQLJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertMySQLJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public FeatureDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore, String filterConfig, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class GeneralDgnConvertMySQLJobContext extends AbstractDgnToMySQLJobContext { |
| | | static final Log logger = LogFactory.getLog(GeneralDgnConvertMySQLJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | private String dataOut = null; |
| | | |
| | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | | private boolean withIndex = false; |
| | | |
| | | public GeneralDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | if (isEPSG3826()) |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | else |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | convertDecorator.setConverter(textElement); |
| | |
| | | String content = textElement.getText(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | |
| | | LineStringElement linestring = (LineStringElement) element; |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(linestring.getColorIndex()), |
| | | linestring.getWeight(), |
| | | linestring.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof LineElement) { |
| | | LineElement line = (LineElement) element; |
| | | convertDecorator.setConverter(line); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(line.getColorIndex()), |
| | | line.getWeight(), |
| | | line.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ArcElement) { |
| | | ArcElement arcElement = (ArcElement) element; |
| | |
| | | */ |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof EllipseElement) { |
| | | EllipseElement arcElement = (EllipseElement) element; |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChainElement = (ComplexChainElement) element; |
| | | convertDecorator.setConverter(complexChainElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class IndexDgnConvertMySQLJobContext extends AbstractDgnToMySQLJobContext { |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertMySQLJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | |
| | | private SimpleFeatureType featureType3 = null; |
| | | |
| | | public IndexDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | if (isEPSG3826()) { |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | } else { |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | String tpclid = textElement.getText(); |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | Geometry geom = (isEPSG3826() ? |
| | | Geometry geom = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | })); |
| | | |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | TextElement txtElement = (TextElement) element; |
| | | double angle = txtElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | geom, |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | | txtElement.getLineStyle(), |
| | |
| | | int dx = (i % 2) * TPCLIDConverter.SX600; |
| | | int dy = (i / 2) * TPCLIDConverter.SY600; |
| | | |
| | | Geometry geom = (isEPSG3826() ? |
| | | Geometry geom = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate( |
| | |
| | | extent.getMinX() + dx, extent.getMaxY() - TPCLIDConverter.SY600 - dy)), |
| | | }), null)); |
| | | |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | // private String _convertElementIn = null; |
| | | |
| | | public OracleConvertMySQLJobContext(String dataPath, DataStore oraDS, String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, oraDS, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, oraDS, profileMode, useTransform); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | protected OracleDataStore targetDataStore; |
| | | |
| | | public AbstractDgnToOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | this.targetDataStore = (OracleDataStore) targetDataStore; |
| | | } |
| | | |
| | |
| | | protected OracleDataStore targetDataStore; |
| | | |
| | | public AbstractOracleToOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof OracleDataStore)) { |
| | | this.targetDataStore = (OracleDataStore) targetDataStore; |
| | | } else { |
| | |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | |
| | | public class DummyFeatureConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertOraSDOJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public DummyFeatureConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, String filterConfig, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | public class FeatureDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertOraSDOJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public FeatureDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, String filterConfig, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | return; |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class GeneralDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext { |
| | | static final Log logger = LogFactory.getLog(GeneralDgnConvertOraSDOJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | private String dataOut = null; |
| | | |
| | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | | private boolean withIndex = false; |
| | | |
| | | public GeneralDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | if (isEPSG3826()) |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | else |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | convertDecorator.setConverter(textElement); |
| | |
| | | String content = textElement.getText(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | |
| | | LineStringElement linestring = (LineStringElement) element; |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(linestring.getColorIndex()), |
| | | linestring.getWeight(), |
| | | linestring.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof LineElement) { |
| | | LineElement line = (LineElement) element; |
| | | convertDecorator.setConverter(line); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(line.getColorIndex()), |
| | | line.getWeight(), |
| | | line.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ArcElement) { |
| | | ArcElement arcElement = (ArcElement) element; |
| | |
| | | */ |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof EllipseElement) { |
| | | EllipseElement arcElement = (EllipseElement) element; |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChainElement = (ComplexChainElement) element; |
| | | convertDecorator.setConverter(complexChainElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class IndexDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext { |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertOraSDOJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | |
| | | private SimpleFeatureType featureType3 = null; |
| | | |
| | | public IndexDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, targetDataStore, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | if (isEPSG3826()) { |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | } else { |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | String tpclid = textElement.getText(); |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | Geometry geom = (isEPSG3826() ? |
| | | Geometry geom = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | })); |
| | | |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | |
| | | public SimpleFeature createFeature2(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | if (element instanceof TextElement) { |
| | | TextElement txtElement = (TextElement) element; |
| | | double angle = txtElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | convertDecorator.setConverter(txtElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | geom, |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | | txtElement.getLineStyle(), |
| | |
| | | int dx = (i % 2) * TPCLIDConverter.SX600; |
| | | int dy = (i / 2) * TPCLIDConverter.SY600; |
| | | |
| | | Geometry geom = (isEPSG3826() ? |
| | | Geometry geom = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate( |
| | |
| | | extent.getMinX() + dx, extent.getMaxY() - TPCLIDConverter.SY600 - dy)), |
| | | }), null)); |
| | | |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | // private String _convertElementIn = null; |
| | | |
| | | public OracleConvertOraSDOJobContext(String dataPath, DataStore oraDS, String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, oraDS, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, oraDS, profileMode, useTransform); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.AttributeType; |
| | | import org.opengis.feature.type.GeometryDescriptor; |
| | | import org.opengis.feature.type.GeometryType; |
| | | import org.opengis.feature.type.PropertyType; |
| | | import org.opengis.filter.BinaryComparisonOperator; |
| | | import org.opengis.filter.Filter; |
| | |
| | | protected boolean schemaEnabled = true; |
| | | |
| | | public AbstractDgnToPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) { |
| | | this.targetDataStore = (PostgisDataStore) targetDataStore; |
| | | } else { |
| | |
| | | |
| | | private String addGeometryColumn(String dbSchema, String tableName, GeometryDescriptor geometryDescriptor, int srid) { |
| | | StringBuilder sql; |
| | | String typeName = getGeometrySQLTypeName(geometryDescriptor.getType().getBinding()); |
| | | String typeName = getGeometrySQLTypeName(((AttributeType) geometryDescriptor.getType()).getBinding()); |
| | | if (typeName == null) { |
| | | getLogger().warn("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | | throw new RuntimeException("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | |
| | | |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | String typeName; |
| | | typeName = CLASS_MAPPINGS.get(descriptor.getType().getBinding()); |
| | | typeName = CLASS_MAPPINGS.get(((AttributeType) descriptor.getType()).getBinding()); |
| | | if (typeName == null) { |
| | | typeName = GEOM_CLASS_MAPPINGS.get(descriptor.getType().getBinding()); |
| | | typeName = GEOM_CLASS_MAPPINGS.get(((AttributeType) descriptor.getType()).getBinding()); |
| | | if (typeName != null) continue; |
| | | } |
| | | |
| | |
| | | if (descriptor == null) { |
| | | msg = "AttributeType was null!"; |
| | | } else { |
| | | msg = "Type '" + descriptor.getType().getBinding() + "' not supported!"; |
| | | msg = "Type '" + ((AttributeType) descriptor.getType()).getBinding() + "' not supported!"; |
| | | } |
| | | throw (new IOException(msg)); |
| | | } |
| | |
| | | if (descriptors.get(i) instanceof GeometryDescriptor) { |
| | | pstmt.setBytes(i + 1, binaryWriter.writeBinary((Geometry) attributes.get(i))); |
| | | } else { |
| | | if (descriptors.get(i).getType().getBinding().equals(Short.class)) { |
| | | Class<?> bindingType = ((AttributeType) descriptors.get(i).getType()).getBinding(); |
| | | if (bindingType.equals(Short.class)) { |
| | | pstmt.setShort(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Integer.class)) { |
| | | } else if (bindingType.equals(Integer.class)) { |
| | | pstmt.setInt(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Long.class)) { |
| | | } else if (bindingType.equals(Long.class)) { |
| | | pstmt.setLong(i + 1, (Long) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(String.class)) { |
| | | } else if (bindingType.equals(String.class)) { |
| | | pstmt.setString(i + 1, (String) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Float.class)) { |
| | | } else if (bindingType.equals(Float.class)) { |
| | | pstmt.setFloat(i + 1, (Float) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Double.class)) { |
| | | } else if (bindingType.equals(Double.class)) { |
| | | pstmt.setDouble(i + 1, (Double) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Boolean.class)) { |
| | | } else if (bindingType.equals(Boolean.class)) { |
| | | pstmt.setBoolean(i + 1, (Boolean) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(BigDecimal.class)) { |
| | | } else if (bindingType.equals(BigDecimal.class)) { |
| | | pstmt.setBigDecimal(i + 1, (BigDecimal) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.sql.Date.class)) { |
| | | } else if (bindingType.equals(java.sql.Date.class)) { |
| | | pstmt.setDate(i + 1, (java.sql.Date) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.sql.Time.class)) { |
| | | } else if (bindingType.equals(java.sql.Time.class)) { |
| | | pstmt.setTime(i + 1, (java.sql.Time) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.sql.Timestamp.class)) { |
| | | } else if (bindingType.equals(java.sql.Timestamp.class)) { |
| | | pstmt.setTimestamp(i + 1, (java.sql.Timestamp) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.util.Date.class)) { |
| | | } else if (bindingType.equals(java.util.Date.class)) { |
| | | java.sql.Date sDate = new java.sql.Date(((java.util.Date) attributes.get(i)).getTime()); |
| | | pstmt.setDate(i + 1, sDate); |
| | | } |
| | |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.AttributeType; |
| | | import org.opengis.feature.type.GeometryDescriptor; |
| | | import org.opengis.feature.type.PropertyType; |
| | | import org.opengis.filter.BinaryComparisonOperator; |
| | |
| | | private String targetSchema = "public"; |
| | | |
| | | public AbstractOracleToPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore)) { |
| | | this.targetDataStore = (PostgisDataStore) targetDataStore; |
| | | } else { |
| | |
| | | } |
| | | |
| | | if (length < 1) { |
| | | getLogger().warn("FeatureType did not specify string length; defaulted to 256"); |
| | | getLogger().info("FeatureType did not specify string length; defaulted to 512"); |
| | | length = 512; |
| | | } else if (length > MAX_ALLOWED_VALUE) { |
| | | length = MAX_ALLOWED_VALUE; |
| | |
| | | |
| | | for (int i = 0; i < descriptors.size(); i++) { |
| | | if (descriptors.get(i) instanceof GeometryDescriptor) { |
| | | // String wktTest = geometryWriter.write((Geometry) attributes.get(i)); |
| | | pstmt.setBytes(i + 1, binaryWriter.writeBinary((Geometry) attributes.get(i))); |
| | | } else { |
| | | if (descriptors.get(i).getType().getBinding().equals(Short.class)) { |
| | | Class<?> bindingType = ((AttributeType)descriptors.get(i).getType()).getBinding(); |
| | | if (bindingType.equals(Short.class)) { |
| | | pstmt.setShort(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Integer.class)) { |
| | | } else if (bindingType.equals(Integer.class)) { |
| | | pstmt.setInt(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Long.class)) { |
| | | } else if (bindingType.equals(Long.class)) { |
| | | pstmt.setLong(i + 1, (Long) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(String.class)) { |
| | | } else if (bindingType.equals(String.class)) { |
| | | pstmt.setString(i + 1, (String) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Float.class)) { |
| | | } else if (bindingType.equals(Float.class)) { |
| | | pstmt.setFloat(i + 1, (Float) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Double.class)) { |
| | | } else if (bindingType.equals(Double.class)) { |
| | | pstmt.setDouble(i + 1, (Double) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Boolean.class)) { |
| | | } else if (bindingType.equals(Boolean.class)) { |
| | | pstmt.setBoolean(i + 1, (Boolean) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(BigDecimal.class)) { |
| | | } else if (bindingType.equals(BigDecimal.class)) { |
| | | pstmt.setBigDecimal(i + 1, (BigDecimal) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.sql.Date.class)) { |
| | | } else if (bindingType.equals(java.sql.Date.class)) { |
| | | pstmt.setDate(i + 1, (java.sql.Date) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.sql.Time.class)) { |
| | | } else if (bindingType.equals(java.sql.Time.class)) { |
| | | pstmt.setTime(i + 1, (java.sql.Time) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.sql.Timestamp.class)) { |
| | | } else if (bindingType.equals(java.sql.Timestamp.class)) { |
| | | pstmt.setTimestamp(i + 1, (java.sql.Timestamp) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(java.util.Date.class)) { |
| | | } else if (bindingType.equals(java.util.Date.class)) { |
| | | java.sql.Date sDate = new java.sql.Date(((java.util.Date) attributes.get(i)).getTime()); |
| | | pstmt.setDate(i + 1, sDate); |
| | | } |
| | |
| | | public class DummyFeatureConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private String dataOut = null; |
| | | |
| | |
| | | |
| | | public DummyFeatureConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | public class FeatureDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | |
| | | |
| | | public FeatureDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.feature.type.FeatureTypeImpl; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.opengis.feature.type.FeatureType; |
| | | import org.postgresql.util.PSQLException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | |
| | | public class GeneralDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | static final Log logger = LogFactory.getLog(GeneralDgnConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | private HashMap<SimpleFeatureType, ArrayList<SimpleFeature>> txFeaturesContext = new HashMap<SimpleFeatureType, ArrayList<SimpleFeature>>(); |
| | | |
| | |
| | | private int accumulate = 0; |
| | | |
| | | public GeneralDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform, useEPSG3826); |
| | | if (isEPSG3826()) |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | else |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform); |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | content = content.replace('\u0000', ' '); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | |
| | | LineStringElement linestring = (LineStringElement) element; |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(linestring.getColorIndex()), |
| | | linestring.getWeight(), |
| | | linestring.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof LineElement) { |
| | | LineElement line = (LineElement) element; |
| | | convertDecorator.setConverter(line); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(line.getColorIndex()), |
| | | line.getWeight(), |
| | | line.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ArcElement) { |
| | | ArcElement arcElement = (ArcElement) element; |
| | |
| | | */ |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof EllipseElement) { |
| | | EllipseElement arcElement = (EllipseElement) element; |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChainElement = (ComplexChainElement) element; |
| | | convertDecorator.setConverter(complexChainElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilder.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | ((FeatureTypeImpl)typeBuilder.buildFeatureType()).getGeometryDescriptor().getLocalName()); |
| | | dropTable(conn, featureName); |
| | | |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilder.buildFeatureType()); |
| | |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.feature.type.FeatureTypeImpl; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.postgresql.util.PSQLException; |
| | |
| | | public class IndexDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext { |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertPostGISJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | private HashMap<SimpleFeatureType, ArrayList<SimpleFeature>> txFeaturesContext = |
| | | new HashMap<SimpleFeatureType, ArrayList<SimpleFeature>>(); |
| | |
| | | private int accumulate = 0; |
| | | |
| | | public IndexDgnConvertPostGISJobContext(String dataPath, DataStore targetDataStore, String targetSchema, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform, useEPSG3826); |
| | | if (isEPSG3826()) { |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | } else { |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, targetDataStore, targetSchema, profileMode, useTransform); |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | if (dropTableMode) { |
| | | try { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilderRect.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | ((FeatureTypeImpl)typeBuilderRect.buildFeatureType()).getGeometryDescriptor().getLocalName()); |
| | | } catch (PSQLException e) { |
| | | logger.debug(e.getMessage(), e); |
| | | } |
| | |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilderPnt.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | ((FeatureTypeImpl)typeBuilderPnt.buildFeatureType()).getGeometryDescriptor().getLocalName()); |
| | | dropTable(conn, featureName); |
| | | |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, |
| | |
| | | if (dropTableMode) { |
| | | try { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilderSmallRect.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | ((FeatureTypeImpl)typeBuilderSmallRect.buildFeatureType()).getGeometryDescriptor().getLocalName()); |
| | | } catch (PSQLException e) { |
| | | logger.debug(e.getMessage(), e); |
| | | } |
| | |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | Geometry geom; |
| | | if (isEPSG3826()) { |
| | | if (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826) { |
| | | geom = geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | }), null); |
| | | } |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | Geometry geom = null; |
| | | try { |
| | | geom = (isEPSG3826() ? |
| | | geom = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | |
| | | logger.warn(e.getMessage(), e); |
| | | return null; |
| | | } |
| | | |
| | | if (geom != null) geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | |
| | | return (geom == null ? null : |
| | | SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | |
| | | TextElement txtElement = (TextElement) element; |
| | | double angle = txtElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | | Geometry gobj = convertDecorator.toGeometry(geometryFactory); |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | |
| | | String tpclid = TPCLIDConverter.CoordinateToTpclId(center); |
| | | if (tpclid.length() > 5) { |
| | | tpclid = tpclid.substring(0, 5); |
| | | Coordinate pos = (isEPSG3826() ? |
| | | Coordinate pos = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate(center.x, center.y)) : |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(center.x, center.y))); |
| | | Geometry gobj = geometryFactory.createPoint(pos); |
| | | |
| | | if (gobj != null) |
| | | gobj.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | |
| | | |
| | | Geometry geom; |
| | | |
| | | if (isEPSG3826()) { |
| | | if (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826) { |
| | | geom = geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate( |
| | |
| | | } |
| | | Envelope innerExtent = geom.getEnvelopeInternal(); |
| | | |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | innerExtent.getMinX(), |
| | |
| | | int dx = (i % 2) * TPCLIDConverter.SX600; |
| | | int dy = (i / 2) * TPCLIDConverter.SY600; |
| | | |
| | | Geometry geom = (isEPSG3826() ? |
| | | Geometry geom = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826 ? |
| | | geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate( |
| | |
| | | |
| | | Envelope innerExtent = geom.getEnvelopeInternal(); |
| | | |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | innerExtent.getMinX(), |
| | |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.postgis.PostgisDataStoreFactory; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.type.FeatureTypeImpl; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.postgresql.util.PSQLException; |
| | |
| | | private int accumulate = 0; |
| | | |
| | | public OracleConvertPostGISJobContext(String dataPath, DataStore pgDS, String targetSchema, String filterConfig, |
| | | boolean profileMode, boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, pgDS, targetSchema, profileMode, useTransform, useEPSG3826); |
| | | boolean profileMode, boolean useTransform) { |
| | | super(dataPath, pgDS, targetSchema, profileMode, useTransform); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | | elementDispatcher.addCreateFeatureTypeEventListener(this); |
| | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // 判斷是否符和條件 |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | } catch (BatchUpdateException e) { |
| | | JDBCUtils.close(conn, Transaction.AUTO_COMMIT, e); |
| | | logger.error(e.getMessage(), e); |
| | | SQLException ex; |
| | | while ((ex = e.getNextException()) != null) { |
| | | // logger.warn(ex.getMessage(), ex); |
| | | logger.warn(ex.getMessage()); |
| | | } |
| | | } catch (SQLException e) { |
| | | JDBCUtils.close(conn, Transaction.AUTO_COMMIT, e); |
| | | logger.error(e.getMessage(), e); |
| | |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | dropGeometryColumn(conn, getTargetSchema(), featureName, |
| | | featureType.getGeometryDescriptor().getName().getLocalPart()); |
| | | ((FeatureTypeImpl)featureType).getGeometryDescriptor().getName().getLocalPart()); |
| | | dropTable(conn, getTargetSchema(), featureName); |
| | | |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, featureType); |
| | |
| | | |
| | | public abstract class AbstractDgnToShapefileJobContext extends AbstractDgnFileJobContext { |
| | | public AbstractDgnToShapefileJobContext(String dataPath, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | } |
| | | |
| | | public abstract String getDataOutPath(); |
| | |
| | | public class DummyFeatureConvertShpJobContext extends AbstractDgnToShapefileJobContext { |
| | | static final Log logger = LogFactory.getLog(DummyFeatureConvertShpJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public DummyFeatureConvertShpJobContext(String dataPath, String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | public class FeatureDgnConvertShpJobContext extends AbstractDgnToShapefileJobContext { |
| | | static final Log logger = LogFactory.getLog(FeatureDgnConvertShpJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public FeatureDgnConvertShpJobContext(String dataPath, String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | } |
| | | |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class GeneralDgnConvertShpJobContext extends AbstractDgnToShapefileJobContext { |
| | | static final Log logger = LogFactory.getLog(GeneralDgnConvertShpJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | public static final String SHPOUTPATH = "shpout"; |
| | | |
| | | private String dataOut = null; |
| | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | | private boolean withIndex = false; |
| | | |
| | | public GeneralDgnConvertShpJobContext(String dataPath, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | if (isEPSG3826()) |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | else |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | convertDecorator.setConverter(textElement); |
| | |
| | | String content = textElement.getText(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | |
| | | LineStringElement linestring = (LineStringElement) element; |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(linestring.getColorIndex()), |
| | | linestring.getWeight(), |
| | | linestring.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof LineElement) { |
| | | LineElement line = (LineElement) element; |
| | | convertDecorator.setConverter(line); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(line.getColorIndex()), |
| | | line.getWeight(), |
| | | line.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ArcElement) { |
| | | ArcElement arcElement = (ArcElement) element; |
| | |
| | | */ |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof EllipseElement) { |
| | | EllipseElement arcElement = (EllipseElement) element; |
| | | convertDecorator.setConverter(arcElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | arcElement.getWeight(), |
| | | arcElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChainElement = (ComplexChainElement) element; |
| | | convertDecorator.setConverter(complexChainElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | if (geom != null) { |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class IndexDgnConvertShpJobContext extends AbstractDgnToShapefileJobContext { |
| | | static final Log logger = LogFactory.getLog(IndexDgnConvertShpJobContext.class); |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | static final GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null); |
| | | public static final String SHPOUTPATH = "shpout"; |
| | | |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | |
| | | private String dataOut = null; |
| | | |
| | |
| | | private int accumulate = 0; |
| | | |
| | | public IndexDgnConvertShpJobContext(String dataPath, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(dataPath, profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(dataPath, profileMode, useTransform); |
| | | txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger); |
| | | if (isEPSG3826()) { |
| | | convertDecorator = new EPSG3826GeometryConverterDecorator(); |
| | | } else { |
| | | convertDecorator = new EPSG3825GeometryConverterDecorator(); |
| | | } |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | Geometry geom; |
| | | if (isEPSG3826()) { |
| | | if (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826) { |
| | | geom = geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | }); |
| | | } |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | TextElement txtElement = (TextElement) element; |
| | | double angle = txtElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); |
| | | convertDecorator.setConverter(txtElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | geom, |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | | txtElement.getLineStyle(), |
| | |
| | | int dy = (i / 2) * TPCLIDConverter.SY600; |
| | | |
| | | Geometry geom; |
| | | if (isEPSG3826()) { |
| | | if (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826) { |
| | | geom = geometryFactory.createPolygon(geometryFactory.createLinearRing(new Coordinate[] |
| | | { |
| | | TWDDatumConverter.fromTM2ToEPSG3826(new Coordinate( |
| | |
| | | extent.getMinX() + dx, extent.getMaxY() - TPCLIDConverter.SY600 - dy)), |
| | | }), null); |
| | | } |
| | | geom.setSRID(FeatureTypeBuilderUtil.getDefaultFeatureSRID()); |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | |
| | | private boolean withIndex = false; |
| | | |
| | | public OracleConvertShapefilesJobContext(String filterConfig, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | | super(profileMode, useTransform, useEPSG3826); |
| | | boolean useTransform) { |
| | | super(profileMode, useTransform); |
| | | properties = new Properties(); |
| | | _filterConfig = filterConfig; |
| | | elementDispatcher = createElementDispatcher(); |
| | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | package com.ximple.eofms.util; |
| | | |
| | | import com.vividsolutions.jts.geom.*; |
| | | import org.apache.log4j.LogManager; |
| | | import org.apache.log4j.Logger; |
| | | import org.geotools.feature.AttributeTypeBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | import org.geotools.referencing.CRS; |
| | | import org.geotools.referencing.ReferencingFactoryFinder; |
| | | import org.geotools.referencing.factory.epsg.ThreadedH2EpsgFactory; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.AttributeType; |
| | | import org.opengis.feature.type.GeometryType; |
| | | import org.opengis.referencing.FactoryException; |
| | | import org.opengis.referencing.crs.CRSFactory; |
| | | import org.opengis.referencing.crs.CoordinateReferenceSystem; |
| | | import org.opengis.referencing.cs.CSFactory; |
| | | import org.opengis.referencing.cs.CoordinateSystem; |
| | | import org.opengis.referencing.operation.MathTransform; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.TreeMap; |
| | | |
| | | public final class FeatureTypeBuilderUtil { |
| | | protected static GeometryFactory _geomFactory = new GeometryFactory(); |
| | | private static final Logger LOGGER = LogManager.getLogger(FeatureTypeBuilderUtil.class); |
| | | private static boolean notAllowNull = false; |
| | | protected static final String DEFAULTNAMESPACE = "http://www.ximple.com.tw/tpc/"; |
| | | |
| | |
| | | } |
| | | |
| | | protected static GeometryType createGeometryType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | return attrBuilder.buildGeometryType(); |
| | | String name, Class clazz, boolean isNillable, |
| | | CoordinateReferenceSystem crs) { |
| | | return createGeometryType(attrBuilder, name, clazz, isNillable, crs, null); |
| | | } |
| | | |
| | | protected static GeometryType createGeometryType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable, Object defaultValue) { |
| | | String name, Class clazz, boolean isNillable, |
| | | CoordinateReferenceSystem crs, |
| | | Object defaultValue) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | attrBuilder.setDefaultValue(defaultValue); |
| | | if (defaultValue != null) attrBuilder.setDefaultValue(defaultValue); |
| | | if (crs != null) attrBuilder.setCRS(crs); |
| | | return attrBuilder.buildGeometryType(); |
| | | } |
| | | |
| | |
| | | |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, false))); |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, false, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", LineString.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "LineType", LineString.class, true))); |
| | | "geom", createGeometryType(attrBuilder, "LineType", LineString.class, true, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiLineString.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "MultiLineStringType", MultiLineString.class, true))); |
| | | "geom", createGeometryType(attrBuilder, "MultiLineStringType", MultiLineString.class, true, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, true))); |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, true, lookupCRS(defaultSRID)))); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, true))); |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, true, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("x1", Double.class, notAllowNull, 1, 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, true))); |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, true, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull))); |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull))); |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, notAllowNull))); |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", LineString.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "LineStringType", LineString.class, notAllowNull))); |
| | | "geom", createGeometryType(attrBuilder, "LineStringType", LineString.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiLineString.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "MultiLineStringType", MultiLineString.class, notAllowNull))); |
| | | "geom", createGeometryType(attrBuilder, "MultiLineStringType", MultiLineString.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiPoint.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "MultiPointType", MultiPoint.class, notAllowNull))); |
| | | "geom", createGeometryType(attrBuilder, "MultiPointType", MultiPoint.class, notAllowNull, lookupCRS(defaultSRID)))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | static int defaultSRID = 3826; |
| | | |
| | | static TreeMap<Integer, CoordinateReferenceSystem> crsMap = null; |
| | | static TreeMap<Integer, GeometryConverterDecorator> geometryConverterMap = null; |
| | | |
| | | static void initializeFactories() { |
| | | try { |
| | | crsMap = new TreeMap<Integer, CoordinateReferenceSystem>(); |
| | | CoordinateReferenceSystem wgs84 = CRS.decode("EPSG:4326"); |
| | | crsMap.put(4326, wgs84); |
| | | CoordinateReferenceSystem epsg3825 = CRS.decode("EPSG:3825"); // TWD97-ZONE 119 |
| | | crsMap.put(3825, epsg3825); |
| | | CoordinateReferenceSystem epsg3826 = CRS.decode("EPSG:3826"); // TWD97-ZONE 121 |
| | | crsMap.put(3826, epsg3826); |
| | | CoordinateReferenceSystem epsg3827 = CRS.decode("EPSG:3827"); // TWD67-ZONE 119 |
| | | crsMap.put(3827, epsg3827); |
| | | CoordinateReferenceSystem epsg3828 = CRS.decode("EPSG:3828"); // TWD67-ZONE 121 |
| | | crsMap.put(3828, epsg3828); |
| | | } catch (FactoryException e) { |
| | | LOGGER.warn(e.getMessage(), e); |
| | | } |
| | | |
| | | geometryConverterMap = new TreeMap<Integer, GeometryConverterDecorator>(); |
| | | geometryConverterMap.put(3825, new EPSG3825GeometryConverterDecorator()); |
| | | geometryConverterMap.put(3826, new EPSG3826GeometryConverterDecorator()); |
| | | } |
| | | |
| | | public static CoordinateReferenceSystem lookupCRS(int SRID) { |
| | | if (crsMap == null) initializeFactories(); |
| | | return crsMap.get(SRID); |
| | | } |
| | | |
| | | public static GeometryConverterDecorator lookupGeometryConverter(int SRID) { |
| | | if (crsMap == null) initializeFactories(); |
| | | return geometryConverterMap.get(SRID); |
| | | } |
| | | |
| | | public static GeometryConverterDecorator lookupDefaultGeometryConverter() { |
| | | return lookupGeometryConverter(defaultSRID); |
| | | } |
| | | |
| | | public static int getDefaultFeatureSRID() { |
| | | return defaultSRID; |
| | | } |
| | | |
| | | public static void setDefaultFeatureSRID(int SRID) { |
| | | initializeFactories(); |
| | | defaultSRID = SRID; |
| | | } |
| | | |
| | | public static MathTransform getTWD67ToTWD97Zone191Transform() throws FactoryException { |
| | | CoordinateReferenceSystem sourceCRS = lookupCRS(3827); |
| | | CoordinateReferenceSystem targetCRS = lookupCRS(3825); |
| | | |
| | | MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true); |
| | | return transform; |
| | | } |
| | | |
| | | public static MathTransform getTWD67ToTWD97Zone121Transform() throws FactoryException { |
| | | CoordinateReferenceSystem sourceCRS = lookupCRS(3828); |
| | | CoordinateReferenceSystem targetCRS = lookupCRS(3826); |
| | | |
| | | MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true); |
| | | // Geometry targetGeometry = JTS.transform( sourceGeometry, transform); |
| | | return transform; |
| | | } |
| | | } |
| | |
| | | import com.vividsolutions.jts.geom.Point; |
| | | import com.vividsolutions.jts.geom.Polygon; |
| | | import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence; |
| | | import org.geotools.geometry.jts.JTSFactoryFinder; |
| | | |
| | | public class JTSShape implements Shape { |
| | | static GeometryFactory fac = new GeometryFactory(); |
| | | static GeometryFactory fac = JTSFactoryFinder.getGeometryFactory(null); |
| | | |
| | | Geometry geom; |
| | | |
New file |
| | |
| | | package com.ximple.eofms.util;
|
| | |
|
| | | import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
| | | import org.testng.Assert;
|
| | | import org.testng.annotations.Test;
|
| | |
|
| | | public class FeatureTypeBuilderUtilTest {
|
| | | @Test
|
| | | public void testLookupCRS() {
|
| | | CoordinateReferenceSystem crs;
|
| | | crs = FeatureTypeBuilderUtil.lookupCRS(3825);
|
| | | Assert.assertNotNull(crs);
|
| | | crs = FeatureTypeBuilderUtil.lookupCRS(3826);
|
| | | Assert.assertNotNull(crs);
|
| | | crs = FeatureTypeBuilderUtil.lookupCRS(3827);
|
| | | Assert.assertNotNull(crs);
|
| | | crs = FeatureTypeBuilderUtil.lookupCRS(3828);
|
| | | Assert.assertNotNull(crs);
|
| | | }
|
| | | }
|