| | |
| | | <test.maxHeapSize>512M</test.maxHeapSize> |
| | | <src.output>${basedir}/target</src.output> |
| | | <java5>1.5</java5> |
| | | <xdgnio.version>1.0.1</xdgnio.version> |
| | | <gt2.version>2.4.5</gt2.version> |
| | | <xdgnio.version>1.2.0</xdgnio.version> |
| | | <gt2.version>2.6.2</gt2.version> |
| | | <failIfNoTests>false</failIfNoTests> |
| | | </properties> |
| | | |
| | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <packaging>pom</packaging> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | <name>ximple-dgnjobs</name> |
| | | <url>http://www.ximple.com.tw</url> |
| | | |
| | |
| | | <url>http://www.ximple.com.tw</url> |
| | | </organization> |
| | | |
| | | <inceptionYear>2008</inceptionYear> |
| | | <inceptionYear>2010</inceptionYear> |
| | | |
| | | <!-- =========================================================== --> |
| | | <!-- Issue managements and mailing lists. --> |
| | |
| | | <!-- GeoAPI and its dependencies --> |
| | | <dependency> |
| | | <groupId>org.opengis</groupId> |
| | | <artifactId>geoapi-nogenerics</artifactId> |
| | | <version>2.1.1</version> |
| | | <artifactId>geoapi</artifactId> |
| | | <version>2.3-M1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax.units</groupId> |
| | | <artifactId>jsr108</artifactId> |
| | | <version>0.01</version> |
| | | <groupId>org.opengis</groupId> |
| | | <artifactId>geoapi-dummy-pending</artifactId> |
| | | <version>2.3-M1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.opengis</groupId> |
| | | <artifactId>geoapi-pending</artifactId> |
| | | <version>2.3-M1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>net.java.dev.jsr-275</groupId> |
| | | <artifactId>jsr-275</artifactId> |
| | | <version>1.0-beta-2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.vividsolutions</groupId> |
| | | <artifactId>jts</artifactId> |
| | | <version>1.9</version> |
| | | <version>1.10</version> |
| | | </dependency> |
| | | |
| | | <!-- Apache --> |
| | |
| | | <dependency> |
| | | <groupId>commons-beanutils</groupId> |
| | | <artifactId>commons-beanutils</artifactId> |
| | | <version>1.7</version> |
| | | <version>1.8.2</version> |
| | | </dependency> |
| | | --> |
| | | <dependency> |
| | |
| | | <dependency> |
| | | <groupId>commons-digester</groupId> |
| | | <artifactId>commons-digester</artifactId> |
| | | <version>1.8</version> |
| | | <version>2.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-pool</groupId> |
| | | <artifactId>commons-pool</artifactId> |
| | | <version>1.4</version> |
| | | <version>1.5.4</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-logging</groupId> |
| | |
| | | <dependency> |
| | | <groupId>commons-cli</groupId> |
| | | <artifactId>commons-cli</artifactId> |
| | | <version>1.1</version> |
| | | <version>1.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>log4j</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi</artifactId> |
| | | <version>3.2-FINAL</version> |
| | | <version>3.6</version> |
| | | </dependency> |
| | | |
| | | <!-- geotools --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2</artifactId> |
| | | <artifactId>gt-api</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-api</artifactId> |
| | | <artifactId>gt-main</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-main</artifactId> |
| | | <artifactId>gt-shapefile</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <artifactId>gt-sample-data</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-data</artifactId> |
| | | <artifactId>gt-data</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | <artifactId>gt-jdbc</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-mysql</artifactId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | <artifactId>gt-referencing</artifactId> |
| | | <version>${gt2.version}</version> |
| | | </dependency> |
| | | |
| | |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity</artifactId> |
| | | <version>1.5</version> |
| | | <version>1.6.3</version> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <version>${gt2.version}</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | | <artifactId>ojdbc5</artifactId> |
| | | <version>11.1.0</version> |
| | | <version>11.1.0.7.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.oracle</groupId> |
| | |
| | | <dependency> |
| | | <groupId>postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | <version>8.3-603.jdbc3</version> |
| | | <version>8.4-701.jdbc3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.postgis</groupId> |
| | | <artifactId>postgis-driver</artifactId> |
| | | <version>1.3.3</version> |
| | | <version>1.5.0</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>5.1.6</version> |
| | | <version>5.1.12</version> |
| | | </dependency> |
| | | |
| | | <!-- opensymphony --> |
| | | <!-- quartz-scheduler--> |
| | | <dependency> |
| | | <groupId>opensymphony</groupId> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <version>1.6.5</version> |
| | | <version>1.7.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.awl</groupId> |
| | | <artifactId>awl</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>org.testng</groupId> |
| | | <artifactId>testng</artifactId> |
| | | <version>5.8</version> |
| | | <version>5.11</version> |
| | | <classifier>jdk15</classifier> |
| | | <scope>test</scope> |
| | | </dependency> |
| | |
| | | <!-- =========================================================== --> |
| | | <dependencies> |
| | | <dependency> |
| | | <artifactId>geoapi-nogenerics</artifactId> |
| | | <groupId>org.opengis</groupId> |
| | | <artifactId>geoapi</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>jsr108</artifactId> |
| | | <groupId>javax.units</groupId> |
| | | <groupId>org.opengis</groupId> |
| | | <artifactId>geoapi-dummy-pending</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.opengis</groupId> |
| | | <artifactId>geoapi-pending</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>net.java.dev.jsr-275</groupId> |
| | | <artifactId>jsr-275</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>gt2-api</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <artifactId>gt2-main</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-main</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-assembly-plugin</artifactId> |
| | | <version>2.1</version> |
| | | <configuration> |
| | | <descriptors> |
| | | <descriptor>build/maven/assembly/binaryDist.xml</descriptor> |
| | | <descriptor>build/maven/assembly/sourceDist.xml</descriptor> |
| | | </descriptors> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-clean-plugin</artifactId> |
| | | <version>2.1.1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-clover-plugin</artifactId> |
| | | <version>2.3</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>2.0.2</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-install-plugin</artifactId> |
| | | <version>2.1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-jar-plugin</artifactId> |
| | | <version>2.1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-javadoc-plugin</artifactId> |
| | | <version>2.4</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-plugin-plugin</artifactId> |
| | | <version>2.3</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-pmd-plugin</artifactId> |
| | | <version>2.4</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-project-info-reports-plugin</artifactId> |
| | | <version>2.0.1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-resources-plugin</artifactId> |
| | | <version>2.2</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-site-plugin</artifactId> |
| | | <version>2.0-beta-5</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-plugin</artifactId> |
| | | <version>2.4.2</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-surefire-report-plugin</artifactId> |
| | | <version>2.4.2</version> |
| | | </plugin> |
| | | |
| | | <!-- http://www.ibiblio.org/maven2/org/codehaus/mojo/ --> |
| | | <plugin> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <artifactId>changelog-maven-plugin</artifactId> |
| | | <version>2.0-beta-1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <artifactId>changes-maven-plugin</artifactId> |
| | | <version>2.0-beta-1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <artifactId>jxr-maven-plugin</artifactId> |
| | | <version>2.0-beta-1</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <artifactId>taglist-maven-plugin</artifactId> |
| | | <version>2.2</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.codehaus.mojo</groupId> |
| | | <artifactId>jalopy-maven-plugin</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-source-plugin</artifactId> |
| | | <configuration> |
| | | <outputDirectory>${src.output}</outputDirectory> |
| | | <attach>false</attach> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-eclipse-plugin</artifactId> |
| | | <version>2.4</version> |
| | | <version>2.5</version> |
| | | </plugin> |
| | | </plugins> |
| | | </pluginManagement> |
| | | |
| | | <!-- http://www.ibiblio.org/maven2/org/apache/maven/wagon/ --> |
| | | <!-- |
| | | <extensions> |
| | | <extension> |
| | | <groupId>org.apache.maven.wagon</groupId> |
| | |
| | | <version>1.0-beta-2</version> |
| | | </extension> |
| | | </extensions> |
| | | --> |
| | | |
| | | <plugins> |
| | | <!-- ======================================================= --> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-maven</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-build</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | |
| | |
| | | <dependency> |
| | | <groupId>org.apache.maven</groupId> |
| | | <artifactId>maven-plugin-api</artifactId> |
| | | <version>2.0.4</version> |
| | | <version>2.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.maven</groupId> |
| | | <artifactId>maven-project</artifactId> |
| | | <version>2.0.4</version> |
| | | <version>2.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.codehaus.plexus</groupId> |
| | | <artifactId>plexus-utils</artifactId> |
| | | <version>1.2</version> |
| | | <version>2.0.1</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | |
| | |
| | | <!-- =========================================================== --> |
| | | <groupId>com.ximple.eofms.maven</groupId> |
| | | <artifactId>ximple-build</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | <packaging>pom</packaging> |
| | | <name>Build tools for Ximple DgnJobs</name> |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | <!-- =========================================================== --> |
| | |
| | | <!-- =========================================================== --> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnio</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-dgnio</name> |
| | | <url>http://www.ximple.com.tw</url> |
| | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <artifactId>gt-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-elmparser</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-elmparser</name> |
| | | <url>http://maven.apache.org</url> |
| | | |
| | | <properties> |
| | | <xdgnio.version>1.0.1</xdgnio.version> |
| | | <xdgnio.version>1.2.0</xdgnio.version> |
| | | </properties> |
| | | |
| | | <scm> |
| | |
| | | <url>http://www.ximple.com.tw</url> |
| | | </organization> |
| | | |
| | | <inceptionYear>2008</inceptionYear> |
| | | <inceptionYear>2010</inceptionYear> |
| | | |
| | | <developers> |
| | | <developer> |
| | |
| | | <!-- =========================================================== --> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <groupId>opensymphony</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | <artifactId>gt-shapefile</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <artifactId>gt-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-data</artifactId> |
| | | <artifactId>gt-data</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | <artifactId>gt-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-mysql</artifactId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | <artifactId>gt-referencing</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <artifactId>jdom</artifactId> |
| | | <groupId>org.jdom</groupId> |
| | | <artifactId>jdom</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-jobcarrier</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-jobcarrier</name> |
| | | <url>http://maven.apache.org</url> |
| | | |
| | | <properties> |
| | | <xdgnio.version>1.0.1</xdgnio.version> |
| | | <xdgnio.version>1.2.0</xdgnio.version> |
| | | </properties> |
| | | |
| | | <scm> |
| | |
| | | <url>http://www.ximple.com.tw</url> |
| | | </organization> |
| | | |
| | | <inceptionYear>2008</inceptionYear> |
| | | <inceptionYear>2010</inceptionYear> |
| | | |
| | | <developers> |
| | | <developer> |
| | |
| | | <!-- =========================================================== --> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <groupId>opensymphony</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | <artifactId>gt-shapefile</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <artifactId>gt-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-data</artifactId> |
| | | <artifactId>gt-data</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | <artifactId>gt-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-mysql</artifactId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | <artifactId>gt-referencing</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | |
| | | <parent> |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-dgnjobs</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.ximple.eofms</groupId> |
| | | <artifactId>ximple-spatialjob</artifactId> |
| | | <version>1.0.1</version> |
| | | <version>1.2.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>ximple-spatialjob</name> |
| | | <url>http://www.ximple.com.tw</url> |
| | | |
| | | <properties> |
| | | <xdgnio.version>1.0.1</xdgnio.version> |
| | | <xdgnio.version>1.2.0</xdgnio.version> |
| | | </properties> |
| | | |
| | | <description> |
| | |
| | | <url>http://www.ximple.com.tw</url> |
| | | </organization> |
| | | |
| | | <inceptionYear>2008</inceptionYear> |
| | | <inceptionYear>2010</inceptionYear> |
| | | |
| | | <developers> |
| | | <developer> |
| | |
| | | <!-- =========================================================== --> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <groupId>opensymphony</groupId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-shapefile</artifactId> |
| | | <artifactId>gt-shapefile</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-sample-data</artifactId> |
| | | <artifactId>gt-sample-data</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-data</artifactId> |
| | | <artifactId>gt-data</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-jdbc</artifactId> |
| | | <artifactId>gt-jdbc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-postgis</artifactId> |
| | | <artifactId>gt-postgis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-oracle-spatial</artifactId> |
| | | <artifactId>gt-oracle-spatial</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-mysql</artifactId> |
| | | <artifactId>gt-mysql</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- because main and sample-data depend on referencing we need a tie breaker --> |
| | | <dependency> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt2-referencing</artifactId> |
| | | <artifactId>gt-referencing</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- We need this to make the referencing module useful --> |
| | | <dependency> |
| | | <artifactId>gt2-epsg-hsql</artifactId> |
| | | <groupId>org.geotools</groupId> |
| | | <artifactId>gt-epsg-hsql</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.LinkedList; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.LinkedList; |
| | | |
| | | public abstract class AbstractDispatchableFilter implements ElementDispatchableFilter { |
| | | private String name; |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | import java.util.List; |
| | | |
| | | public abstract class AbstractFLinkageDispatchableFilter extends AbstractDispatchableFilter { |
| | | public static FrammeAttributeData getFeatureLinkage(Element element) { |
| | | if (!element.hasUserAttributeData()) |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | public class CreateArcLineStringStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createArcFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof ArcElement) { |
| | | ArcElement lineStringElement = (ArcElement) element; |
| | |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | return feature; |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.LineString; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.LineString; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.LineElement; |
| | | import com.ximple.io.dgn7.LineStringElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class CreateComplexChainStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createMultiLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createMultiLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof LineStringElement) { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | Geometry gobj; |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(complexChain.getColorIndex()), |
| | | (short) complexChain.getWeight(), |
| | | (short) complexChain.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof LineElement) { |
| | | LineElement lineElement = (LineElement) element; |
| | | Geometry gobj; |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineElement.getColorIndex()), |
| | | (short) lineElement.getWeight(), |
| | | (short) lineElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } else if (element instanceof ArcElement) { |
| | | ArcElement arcElement = (ArcElement) element; |
| | |
| | | gobj = geometryFactory.createMultiLineString(new LineString[]{(LineString) gobj}); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | (short) arcElement.getWeight(), |
| | | (short) arcElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | |
| | | return feature; |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.EllipseElement; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | public class CreateEllipseShapeStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateShapeStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createEllipseFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof EllipseElement) { |
| | | EllipseElement ellipseElement = (EllipseElement) element; |
| | |
| | | gobj = ellipseElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(ellipseElement.getColorIndex()), |
| | | (short) ellipseElement.getWeight(), |
| | | (short) ellipseElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | return feature; |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import com.ximple.io.dgn7.Element; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public interface CreateFeatureTypeStrategy { |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException; |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException; |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException; |
| | | |
| | | public void addCreateFeatureTypeEventListener(CreateFeatureTypeEventListener listener); |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.CoordinateList; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.MultiLineString; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ArcElement; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.LineElement; |
| | | import com.ximple.io.dgn7.LineStringElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | public class CreateLineStringStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineStringStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof LineStringElement) { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | Geometry gobj; |
| | |
| | | gobj = geometryFactory.createLineString(coordinateList.toCoordinateArray()); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(complexChain.getColorIndex()), |
| | | (short) complexChain.getWeight(), |
| | | (short) complexChain.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof LineElement) { |
| | | LineElement lineElement = (LineElement) element; |
| | | Geometry gobj; |
| | |
| | | gobj = lineElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineElement.getColorIndex()), |
| | | (short) lineElement.getWeight(), |
| | | (short) lineElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } else if (element instanceof ArcElement) { |
| | | ArcElement arcElement = (ArcElement) element; |
| | |
| | | gobj = arcElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(arcElement.getColorIndex()), |
| | | (short) arcElement.getWeight(), |
| | | (short) arcElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | |
| | | return feature; |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import com.vividsolutions.jts.geom.*; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.CoordinateList; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.LineString; |
| | | import com.vividsolutions.jts.geom.MultiLineString; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.TWDDatumConverter; |
| | | import com.ximple.io.dgn7.ComplexChainElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.LineElement; |
| | | import com.ximple.io.dgn7.LineStringElement; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class CreateLineTextStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateLineTextStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof LineStringElement) { |
| | | LineStringElement lineStringElement = (LineStringElement) element; |
| | |
| | | gobj = lineStringElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineStringElement.getColorIndex()), |
| | | (short) lineStringElement.getWeight(), |
| | | (short) lineStringElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof TextElement) { |
| | | TextElement txtElement = (TextElement) element; |
| | | Coordinate ptOrigin = txtElement.getUserOrigin(); |
| | |
| | | |
| | | txtElement.getRotationAngle(); |
| | | |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | line, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | (short) txtElement.getWeight(), |
| | | (short) txtElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof ComplexChainElement) { |
| | | ComplexChainElement complexChain = (ComplexChainElement) element; |
| | | Geometry gobj; |
| | |
| | | gobj = geometryFactory.createLineString(coordinateList.toCoordinateArray()); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(complexChain.getColorIndex()), |
| | | (short) complexChain.getWeight(), |
| | | (short) complexChain.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof LineElement) { |
| | | LineElement lineElement = (LineElement) element; |
| | | Geometry gobj; |
| | |
| | | } else { |
| | | gobj = lineElement.toGeometry(geometryFactory); |
| | | } |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(lineElement.getColorIndex()), |
| | | (short) lineElement.getWeight(), |
| | | (short) lineElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | |
| | | return feature; |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.CoordinateList; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.util.Assert; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.GeometryConverter; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import javax.swing.event.EventListenerList; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | public class CreateMultiSymbolStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateMultiSymbolStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826AnchorGeometryConverterDecorator(), |
| | | new EPSG3825AnchorGeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createMultiSymbolFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createMultiSymbolFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof TextElement) { |
| | | TextElement txtElement = (TextElement) element; |
| | |
| | | gobj = txtElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | (float) txtElement.getTextWidth(), |
| | | (float) angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof TextNodeElement) { |
| | | TextNodeElement nodeElement = (TextNodeElement) element; |
| | | |
| | |
| | | } |
| | | |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | (float) txtChildElement.getTextWidth(), |
| | | (float) angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } |
| | | } |
| | | } else { |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.ComplexShapeElement; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.ShapeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class CreateShapeStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateShapeStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createPolygonFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createPolygonFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof ShapeElement) { |
| | | ShapeElement shapeElement = (ShapeElement) element; |
| | |
| | | } |
| | | |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | (short) shapeElement.getWeight(), |
| | | (short) shapeElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof ComplexShapeElement) { |
| | | ComplexShapeElement complexShape = (ComplexShapeElement) element; |
| | | Geometry gobj; |
| | |
| | | gobj = complexShape.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | colorTable.getColorCode(complexShape.getColorIndex()), |
| | | (short) complexShape.getWeight(), |
| | | (short) complexShape.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | return feature; |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class CreateSymbolStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateSymbolStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createSymbolFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createSymbolFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof TextElement) { |
| | | TextElement txtElement = (TextElement) element; |
| | |
| | | gobj = txtElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | (float) txtElement.getTextWidth(), |
| | | (float) angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("CreateSymbolStrategy cannot conver " + element.toString() + "to Feature"); |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.ximple.eofms.util.*; |
| | | import com.ximple.io.dgn7.*; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.List; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.EPSG3825GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.EPSG3826GeometryConverterDecorator; |
| | | import com.ximple.eofms.util.FeatureTypeBuilderUtil; |
| | | import com.ximple.eofms.util.GeometryConverterDecorator; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | |
| | | public class CreateTextStrategy implements CreateFeatureTypeStrategy { |
| | | static final Log logger = LogFactory.getLog(CreateTextStrategy.class); |
| | | GeometryFactory geometryFactory = new GeometryFactory(); |
| | | TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | TreeMap<String, SimpleFeatureType> typeBuilders = new TreeMap<String, SimpleFeatureType>(); |
| | | static final GeometryConverterDecorator convertDecorator[] = new GeometryConverterDecorator[]{ |
| | | new EPSG3826GeometryConverterDecorator(), |
| | | new EPSG3825GeometryConverterDecorator() |
| | |
| | | return null; |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, typeBuilder.getFeatureType())); |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createPointFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | typeBuilders.put(featureName, featureType); |
| | | fireFeatureTypeEvent(new FeatureTypeEvent(this, featureType)); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return typeBuilders.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element, |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element, |
| | | boolean useTransform, boolean useEPSG3826) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | FrammeAttributeData fLinkage = getFeatureLinkage(element); |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | if (fLinkage == null) return null; |
| | | if (element instanceof TextElement) { |
| | | TextElement txtElement = (TextElement) element; |
| | |
| | | gobj = txtElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | (float) txtElement.getTextWidth(), |
| | | (float) angle, |
| | | content |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof TextNodeElement) { |
| | | TextNodeElement nodeElement = (TextNodeElement) element; |
| | | String[] texts = nodeElement.getTextArray(); |
| | |
| | | gobj = nodeElement.toGeometry(geometryFactory); |
| | | } |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | fLinkage.getFsc(), |
| | | (long) fLinkage.getUfid(), |
| | |
| | | (float) nodeElement.getTextNodeLength(), |
| | | (float) angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } |
| | | return feature; |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | |
| | | public interface ElementDispatchableFilter { |
| | | public boolean isDispatchable(Element element); |
| | | |
| | | public Feature execute(Element element, boolean useTransform, boolean useEPSG3826); |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826); |
| | | |
| | | void setUseLongName(boolean useLongName); |
| | | |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | |
| | | import javax.swing.event.EventListenerList; |
| | | import java.util.LinkedList; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | |
| | | public class ElementDispatcher implements CreateFeatureTypeEventListener { |
| | | private LinkedList<ElementDispatchableFilter> rules; |
| | |
| | | } |
| | | } |
| | | |
| | | public Feature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | for (ElementDispatchableFilter rule : rules) { |
| | | if (rule.isDispatchable(element)) { |
| | | return rule.execute(element, useTransform, useEPSG3826); |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | public class ElementLevelCriterion implements Comparable { |
| | | private int elementLevel; |
| | | private ArrayList<Integer> elementLevelArray; |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import com.ximple.io.dgn7.Element; |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | public class ElementTypeCriterion implements Comparable { |
| | | private int elementType; |
| | | private ArrayList<Integer> elementTypeArray; |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | import java.util.EventObject; |
| | | |
| | | import org.geotools.feature.FeatureType; |
| | | |
| | | public class FeatureTypeEvent extends EventObject { |
| | | private FeatureType featureType; |
| | | private SimpleFeatureType featureType; |
| | | |
| | | /** |
| | | * Constructs a prototypical Event. |
| | |
| | | * @param featureType featureType |
| | | * @throws IllegalArgumentException if source is null. |
| | | */ |
| | | public FeatureTypeEvent(Object source, FeatureType featureType) { |
| | | public FeatureTypeEvent(Object source, SimpleFeatureType featureType) { |
| | | super(source); |
| | | this.featureType = featureType; |
| | | } |
| | | |
| | | public FeatureType getFeatureType() { |
| | | public SimpleFeatureType getFeatureType() { |
| | | return featureType; |
| | | } |
| | | } |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class TypeCompIdDispatchableFilter extends AbstractFLinkageDispatchableFilter |
| | | implements CreateFeatureTypeEventListener { |
| | |
| | | this.useLongName = useLongName; |
| | | } |
| | | |
| | | //§PÂ_¬O§_²Å©M±ø¥ó |
| | | //�P�_�O�_�ũM��� |
| | | public boolean isDispatchable(Element element) { |
| | | FrammeAttributeData featureLinkage = getFeatureLinkage(element); |
| | | return featureLinkage != null && tid == featureLinkage.getFsc() && |
| | |
| | | (compareType(element) == 0); |
| | | } |
| | | |
| | | public Feature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | try { |
| | | String ftName = getFeatureTypeName(element); |
| | | FeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | SimpleFeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | return createStrategy.createFeature(ftype, element, useTransform, useEPSG3826); |
| | | } catch (SchemaException e) { |
| | | logger.error(e.getMessage(), e); |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class TypeCompLevelIdDispatchableFilter extends AbstractFLinkageDispatchableFilter |
| | | implements CreateFeatureTypeEventListener { |
| | |
| | | (lid == element.getLevelIndex()) && (compareLevel(element) == 0); |
| | | } |
| | | |
| | | public Feature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | try { |
| | | String ftName = getFeatureTypeName(element); |
| | | FeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | SimpleFeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | return createStrategy.createFeature(ftype, element, useTransform, useEPSG3826); |
| | | } catch (SchemaException e) { |
| | | logger.error(e.getMessage(), e); |
| | |
| | | package com.ximple.eofms.filter; |
| | | |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.io.dgn7.Element; |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public class TypeIdDispatchableFilter extends AbstractFLinkageDispatchableFilter implements CreateFeatureTypeEventListener { |
| | | private int tid; |
| | |
| | | (compareType(element) == 0); |
| | | } |
| | | |
| | | public Feature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | public SimpleFeature execute(Element element, boolean useTransform, boolean useEPSG3826) { |
| | | try { |
| | | String ftName = getFeatureTypeName(element); |
| | | FeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | SimpleFeatureType ftype = createStrategy.createFeatureElement(ftName); |
| | | return createStrategy.createFeature(ftype, element, useTransform, useEPSG3826); |
| | | } catch (SchemaException e) { |
| | | logger.error(e.getMessage(), e); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexType; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | |
| | | */ |
| | | if (!sfile.exists()) { |
| | | ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } else { |
| | | ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(), |
| | | Transaction.AUTO_COMMIT); |
| | | } |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save shapefile:" + sfile.toURI()); |
| | |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.mysql.MySQLDataStore; |
| | | import org.geotools.feature.FeatureType; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractDgnToMySQLJobContext extends AbstractDgnFileJobContext { |
| | | protected MySQLDataStore targetDataStore; |
| | |
| | | } |
| | | |
| | | |
| | | protected boolean isExistFeature(FeatureType featureType) { |
| | | protected boolean isExistFeature(SimpleFeatureType featureType) { |
| | | try { |
| | | FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | SimpleFeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | return existFeatureType != null && existFeatureType.equals(featureType); |
| | | } catch (SchemaNotFoundException e) { |
| | | return false; |
| | |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.mysql.MySQLDataStore; |
| | | import org.geotools.feature.FeatureType; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractOracleToMySQLJobContext extends AbstractOracleJobContext { |
| | | protected MySQLDataStore targetDataStore; |
| | |
| | | return null; |
| | | } |
| | | |
| | | protected boolean isExistFeature(FeatureType featureType) { |
| | | protected boolean isExistFeature(SimpleFeatureType featureType) { |
| | | try { |
| | | FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | SimpleFeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | return existFeatureType != null && existFeatureType.equals(featureType); |
| | | } catch (SchemaNotFoundException e) { |
| | | return false; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | 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); |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | private TreeMap<String, FeatureType> featureTypes = new TreeMap<String, FeatureType>(); |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | | FeatureType ft = lookupFeatureType(element); |
| | | SimpleFeatureType ft = lookupFeatureType(element); |
| | | if (ft != null) { |
| | | Feature feature = createFeature(ft, element); |
| | | SimpleFeature feature = createFeature(ft, element); |
| | | if (feature == null) { |
| | | if (element instanceof TextElement) |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = (ArrayList<Feature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = (ArrayList<SimpleFeature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | } else { |
| | | logger.info("Unknown Element :" + element.getType() + ", lv=" + element.getLevelIndex()); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save into OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save into OracleSDO:" + featureType.getTypeName()); |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public FeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | String content = textElement.getText(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getFontIndex(), |
| | |
| | | textElement.getTextWidth(), |
| | | angle, |
| | | content |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | | textNodeElement.getFontIndex(), |
| | |
| | | textNodeElement.getTextNodeLength(), |
| | | angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | return featureBaseName; |
| | | } |
| | | |
| | | private FeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | String typeName; |
| | | if (element instanceof TextElement) { |
| | | typeName = getFeatureBaseName() + "_P"; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.Envelope; |
| | |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | 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); |
| | |
| | | |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private FeatureTypeBuilder typeBuilderPnt = null; |
| | | private FeatureTypeBuilder typeBuilderRect = null; |
| | | private FeatureType featureType = null; |
| | | private FeatureType featureType2 = null; |
| | | private FeatureType featureType3 = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderPnt = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderRect = null; |
| | | private SimpleFeatureType featureType = null; |
| | | private SimpleFeatureType featureType2 = null; |
| | | private SimpleFeatureType featureType3 = null; |
| | | |
| | | public IndexDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | |
| | | return; |
| | | } |
| | | |
| | | Feature feature = createFeature((TextElement) element); |
| | | SimpleFeature feature = createFeature((TextElement) element); |
| | | if (feature == null) { |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | ((TextElement) element).getText() + "'"); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | for (Feature feature1 : features) { |
| | | ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes(null)); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | for (SimpleFeature feature1 : features) { |
| | | ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (typeBuilderRect == null) { |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderRect.getFeatureType(); |
| | | return typeBuilderRect.buildFeatureType(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | if (typeBuilderPnt == null) { |
| | | typeBuilderPnt = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderPnt.getFeatureType(); |
| | | return typeBuilderPnt.buildFeatureType(); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | })); |
| | | |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature createFeature2(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature2(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | 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); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | |
| | | txtElement.getTextWidth(), |
| | | angle, |
| | | txtElement.getText() |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature[] createFeature3(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature[] createFeature3(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | String tpclid = textElement.getText(); |
| | | Feature[] result = new Feature[4]; |
| | | SimpleFeature[] result = new SimpleFeature[4]; |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | |
| | |
| | | extent.getMinX() + dx, extent.getMaxY() - TPCLIDConverter.SY600 - dy)), |
| | | }), null)); |
| | | |
| | | result[i] = featureType.create(new Object[]{ |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | |
| | | } |
| | | return result; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private Feature createFeature(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature(featureType, element); |
| | | } |
| | | |
| | | private Feature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType2 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature2(featureType2, element); |
| | | } |
| | | |
| | | private Feature[] createFeature3(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature[] createFeature3(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType3 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.mysql.MySQLDataStoreFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | | |
| | |
| | | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | FeatureWriter writer = null; |
| | | if (featuresWriterContext.containsKey(featureType.getTypeName())) { |
| | | writer = featuresWriterContext.get(featureType.getTypeName()); |
| | |
| | | ArrayList features = (ArrayList) featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Ãö³¬³]³Æ¼g¤J¾¹ |
| | | * �����]�Ƽg�J�� |
| | | * |
| | | * @throws IOException IOµo¥Í¿ù»~ |
| | | * @throws IOException IO�o�Ϳ�~ |
| | | */ |
| | | public void closeFeatureWriter() throws IOException { |
| | | |
| | |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.feature.FeatureType; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractDgnToOraSDOJobContext extends AbstractDgnFileJobContext { |
| | | protected OracleDataStore targetDataStore; |
| | |
| | | } |
| | | |
| | | |
| | | protected boolean isExistFeature(FeatureType featureType) { |
| | | protected boolean isExistFeature(SimpleFeatureType featureType) { |
| | | try { |
| | | FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | SimpleFeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | return existFeatureType != null && existFeatureType.equals(featureType); |
| | | } catch (SchemaNotFoundException e) { |
| | | return false; |
| | |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStore; |
| | | import org.geotools.feature.FeatureType; |
| | | |
| | | import com.ximple.eofms.jobs.context.AbstractOracleJobContext; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | |
| | | public abstract class AbstractOracleToOraSDOJobContext extends AbstractOracleJobContext { |
| | | protected boolean profileMode = false; |
| | |
| | | } |
| | | |
| | | |
| | | protected boolean isExistFeature(FeatureType featureType) { |
| | | protected boolean isExistFeature(SimpleFeatureType featureType) { |
| | | try { |
| | | FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | SimpleFeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | return existFeatureType != null && existFeatureType.equals(featureType); |
| | | } catch (SchemaNotFoundException e) { |
| | | return false; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | 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); |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | private TreeMap<String, FeatureType> featureTypes = new TreeMap<String, FeatureType>(); |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | | FeatureType ft = lookupFeatureType(element); |
| | | SimpleFeatureType ft = lookupFeatureType(element); |
| | | if (ft != null) { |
| | | Feature feature = createFeature(ft, element); |
| | | SimpleFeature feature = createFeature(ft, element); |
| | | if (feature == null) { |
| | | if (element instanceof TextElement) |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = (ArrayList<Feature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = (ArrayList<SimpleFeature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | } else { |
| | | logger.info("Unknown Element :" + element.getType() + ", lv=" + element.getLevelIndex()); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save into OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save into OracleSDO:" + featureType.getTypeName()); |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public FeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | String content = textElement.getText(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getFontIndex(), |
| | |
| | | textElement.getTextWidth(), |
| | | angle, |
| | | content |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | | textNodeElement.getFontIndex(), |
| | |
| | | textNodeElement.getTextNodeLength(), |
| | | angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | return featureBaseName; |
| | | } |
| | | |
| | | private FeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | String typeName; |
| | | if (element instanceof TextElement) { |
| | | typeName = getFeatureBaseName() + "P"; |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.Envelope; |
| | |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | 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); |
| | |
| | | |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private FeatureTypeBuilder typeBuilderPnt = null; |
| | | private FeatureTypeBuilder typeBuilderRect = null; |
| | | private FeatureType featureType = null; |
| | | private FeatureType featureType2 = null; |
| | | private FeatureType featureType3 = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderPnt = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderRect = null; |
| | | private SimpleFeatureType featureType = null; |
| | | private SimpleFeatureType featureType2 = null; |
| | | private SimpleFeatureType featureType3 = null; |
| | | |
| | | public IndexDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, boolean profileMode, |
| | | boolean useTransform, boolean useEPSG3826) { |
| | |
| | | return; |
| | | } |
| | | |
| | | Feature feature = createFeature((TextElement) element); |
| | | SimpleFeature feature = createFeature((TextElement) element); |
| | | if (feature == null) { |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | ((TextElement) element).getText() + "'"); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | for (Feature feature1 : features) { |
| | | ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes(null)); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | for (SimpleFeature feature1 : features) { |
| | | ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (typeBuilderRect == null) { |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderRect.getFeatureType(); |
| | | return typeBuilderRect.buildFeatureType(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | if (typeBuilderPnt == null) { |
| | | typeBuilderPnt = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderPnt.getFeatureType(); |
| | | return typeBuilderPnt.buildFeatureType(); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | })); |
| | | |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature createFeature2(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature2(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | 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); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | |
| | | txtElement.getTextWidth(), |
| | | angle, |
| | | txtElement.getText() |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature[] createFeature3(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature[] createFeature3(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | String tpclid = textElement.getText(); |
| | | Feature[] result = new Feature[4]; |
| | | SimpleFeature[] result = new SimpleFeature[4]; |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | |
| | |
| | | extent.getMinX() + dx, extent.getMaxY() - TPCLIDConverter.SY600 - dy)), |
| | | }), null)); |
| | | |
| | | result[i] = featureType.create(new Object[]{ |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | |
| | | } |
| | | return result; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private Feature createFeature(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature(featureType, element); |
| | | } |
| | | |
| | | private Feature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType2 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature2(featureType2, element); |
| | | } |
| | | |
| | | private Feature[] createFeature3(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature[] createFeature3(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType3 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.oracle.OracleDataStoreFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | | |
| | |
| | | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | FeatureWriter writer; |
| | | if (featuresWriterContext.containsKey(featureType.getTypeName())) { |
| | | writer = featuresWriterContext.get(featureType.getTypeName()); |
| | |
| | | |
| | | ArrayList features = (ArrayList) featuresContext.get(featureType); |
| | | for (Object feature1 : features) { |
| | | Feature feature = (Feature) feature1; |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) feature1; |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save OracleSDO:" + featureType.getTypeName()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Ãö³¬³]³Æ¼g¤J¾¹ |
| | | * �����]�Ƽg�J�� |
| | | * |
| | | * @throws IOException IOµo¥Í¿ù»~ |
| | | * @throws IOException IO�o�Ϳ�~ |
| | | */ |
| | | public void closeFeatureWriter() throws IOException { |
| | | |
| | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | import org.geotools.data.DataSourceException; |
| | | import org.geotools.data.DataStore; |
| | |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.feature.AttributeType; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.GeometryAttributeType; |
| | | import org.geotools.filter.LengthFunction; |
| | | import org.geotools.referencing.NamedIdentifier; |
| | | import org.geotools.referencing.crs.DefaultGeographicCRS; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.GeometryDescriptor; |
| | | import org.opengis.feature.type.PropertyType; |
| | | import org.opengis.filter.BinaryComparisonOperator; |
| | | import org.opengis.filter.Filter; |
| | | import org.opengis.filter.PropertyIsLessThan; |
| | |
| | | // return connection; |
| | | } |
| | | |
| | | protected boolean isExistFeature(FeatureType featureType) { |
| | | protected boolean isExistFeature(SimpleFeatureType featureType) { |
| | | try { |
| | | FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | SimpleFeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | return existFeatureType != null; // && existFeatureType.equals(featureType); |
| | | } catch (SchemaNotFoundException e) { |
| | | return false; |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String addGeometryColumn(String dbSchema, String tableName, GeometryAttributeType geometryAttribute, int srid) { |
| | | private String addGeometryColumn(String dbSchema, String tableName, GeometryDescriptor geometryDescriptor, int srid) { |
| | | StringBuilder sql; |
| | | String typeName = getGeometrySQLTypeName(geometryAttribute.getBinding()); |
| | | String typeName = getGeometrySQLTypeName(geometryDescriptor.getType().getBinding()); |
| | | if (typeName == null) { |
| | | getLogger().warn("Error: " + geometryAttribute.getLocalName() + " unknown type!!!"); |
| | | throw new RuntimeException("Error: " + geometryAttribute.getLocalName() + " unknown type!!!"); |
| | | getLogger().warn("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | | throw new RuntimeException("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | | } |
| | | |
| | | sql = new StringBuilder("SELECT \"public\".AddGeometryColumn('"); |
| | |
| | | sql.append("','"); |
| | | sql.append(tableName); |
| | | sql.append("','"); |
| | | sql.append(geometryAttribute.getLocalName()); |
| | | sql.append(geometryDescriptor.getLocalName()); |
| | | sql.append("','"); |
| | | sql.append(srid); |
| | | sql.append("','"); |
| | |
| | | return sql.toString(); |
| | | } |
| | | |
| | | public ArrayList<String> createNewSchemaTexts(Connection conn, FeatureType featureType) throws IOException { |
| | | public ArrayList<String> createNewSchemaTexts(Connection conn, SimpleFeatureType featureType) throws IOException { |
| | | String origintableName = featureType.getTypeName(); |
| | | String tableName = origintableName.toLowerCase(); |
| | | |
| | | ArrayList<String> result = new ArrayList<String>(); |
| | | |
| | | AttributeType[] attributeType = featureType.getAttributeTypes(); |
| | | List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors(); |
| | | |
| | | boolean shouldDrop = tablePresent(getTargetSchema(), tableName, conn); |
| | | |
| | | if (shouldDrop) { |
| | | String sqlStr; |
| | | for (AttributeType anAttributeType : attributeType) { |
| | | if (!(anAttributeType instanceof GeometryAttributeType)) { |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | if (!(descriptor instanceof GeometryDescriptor)) { |
| | | continue; |
| | | } |
| | | GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType; |
| | | sqlStr = dropGeometryColumn(getTargetSchema(), tableName, geomAttribute.getLocalName()); |
| | | GeometryDescriptor geometryDescriptor = (GeometryDescriptor) descriptor; |
| | | sqlStr = dropGeometryColumn(getTargetSchema(), tableName, geometryDescriptor.getLocalName()); |
| | | getLogger().info(sqlStr); |
| | | result.add(sqlStr); |
| | | } |
| | |
| | | StringBuilder sql = new StringBuilder("CREATE TABLE "); |
| | | sql.append(encodeSchemaTableName(tableName)); |
| | | sql.append(" ( gid serial PRIMARY KEY, "); |
| | | sql.append(makeNonGeomSqlCreate(attributeType)); |
| | | sql.append(makeNonGeomSqlCreate(descriptors)); |
| | | sql.append(");"); |
| | | |
| | | String sqlStr = sql.toString(); |
| | | getLogger().debug(sqlStr); |
| | | result.add(sqlStr); |
| | | |
| | | for (AttributeType anAttributeType : attributeType) { |
| | | if (!(anAttributeType instanceof GeometryAttributeType)) { |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | if (!(descriptor instanceof GeometryDescriptor)) { |
| | | continue; |
| | | } |
| | | GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType; |
| | | GeometryDescriptor geometryDescriptor = (GeometryDescriptor) descriptor; |
| | | |
| | | CoordinateReferenceSystem refSys = geomAttribute.getCoordinateSystem(); |
| | | CoordinateReferenceSystem refSys = geometryDescriptor.getCoordinateReferenceSystem(); |
| | | int SRID = getSRID(refSys); |
| | | |
| | | sqlStr = addGeometryColumn(getTargetSchema(), tableName, geomAttribute, SRID); |
| | | sqlStr = addGeometryColumn(getTargetSchema(), tableName, geometryDescriptor, SRID); |
| | | getLogger().debug(sqlStr); |
| | | result.add(sqlStr); |
| | | |
| | |
| | | sql = new StringBuilder("CREATE INDEX \"spatial_"); |
| | | sql.append(indexName); |
| | | sql.append("_"); |
| | | sql.append(anAttributeType.getLocalName().toLowerCase()); |
| | | sql.append(descriptor.getLocalName().toLowerCase()); |
| | | sql.append("\" ON "); |
| | | sql.append(encodeSchemaTableName(tableName)); |
| | | sql.append(" USING GIST ("); |
| | | sql.append(encodeSchemaColumnName(anAttributeType.getLocalName())); |
| | | sql.append(encodeSchemaColumnName(descriptor.getLocalName())); |
| | | sql.append(" gist_geometry_ops);"); |
| | | |
| | | sqlStr = sql.toString(); |
| | |
| | | } |
| | | |
| | | |
| | | private StringBuilder makeNonGeomSqlCreate(AttributeType[] attributeType) |
| | | private StringBuilder makeNonGeomSqlCreate(List<AttributeDescriptor> descriptors) |
| | | throws IOException { |
| | | StringBuilder buf = new StringBuilder(""); |
| | | |
| | | for (AttributeType anAttributeType : attributeType) { |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | String typeName; |
| | | typeName = CLASS_MAPPINGS.get(anAttributeType.getBinding()); |
| | | typeName = CLASS_MAPPINGS.get(descriptor.getType().getBinding()); |
| | | if (typeName == null) { |
| | | typeName = GEOM_CLASS_MAPPINGS.get(anAttributeType.getBinding()); |
| | | typeName = GEOM_CLASS_MAPPINGS.get(descriptor.getType().getBinding()); |
| | | if (typeName != null) continue; |
| | | } |
| | | |
| | | if (typeName != null) { |
| | | if (typeName.equals("VARCHAR")) { |
| | | int length = -1; |
| | | Filter f = anAttributeType.getRestriction(); |
| | | List<Filter> flist = ((PropertyType) descriptor.getType()).getRestrictions(); |
| | | for (Filter f : flist) { |
| | | if (f != null && f != Filter.EXCLUDE && f != Filter.INCLUDE && |
| | | (f instanceof PropertyIsLessThan || f instanceof PropertyIsLessThanOrEqualTo)) { |
| | | try { |
| | |
| | | } else { |
| | | length = 256; |
| | | } |
| | | |
| | | break; |
| | | } |
| | | if (length < 1) { |
| | | getLogger().warn("FeatureType did not specify string length; defaulted to 256"); |
| | | length = 256; |
| | |
| | | typeName = typeName + "(" + length + ")"; |
| | | } |
| | | |
| | | if (!anAttributeType.isNillable()) { |
| | | if (!descriptor.isNillable()) { |
| | | typeName = typeName + " NOT NULL"; |
| | | } |
| | | |
| | | //TODO review!!! Is toString() always OK??? |
| | | Object defaultValue = anAttributeType.createDefaultValue(); |
| | | Object defaultValue = descriptor.getDefaultValue(); |
| | | |
| | | if (defaultValue != null) { |
| | | typeName = typeName + " DEFAULT '" |
| | | + defaultValue.toString() + "'"; |
| | | } |
| | | |
| | | buf.append(" \"").append(anAttributeType.getLocalName()).append("\" ").append(typeName).append(","); |
| | | buf.append(" \"").append(descriptor.getLocalName()).append("\" ").append(typeName).append(","); |
| | | |
| | | } else { |
| | | String msg; |
| | | if (anAttributeType == null) { |
| | | if (descriptor == null) { |
| | | msg = "AttributeType was null!"; |
| | | } else { |
| | | msg = "Type '" + anAttributeType.getBinding() + "' not supported!"; |
| | | msg = "Type '" + descriptor.getType().getBinding() + "' not supported!"; |
| | | } |
| | | throw (new IOException(msg)); |
| | | } |
| | |
| | | return "GeometryFromText('" + geoText + "', " + srid + ")"; |
| | | } |
| | | |
| | | protected String makeInsertSql(Feature feature, int srid) // throws IOException |
| | | protected String makeInsertSql(SimpleFeature feature, int srid) // throws IOException |
| | | { |
| | | FeatureType featureType = feature.getFeatureType(); |
| | | SimpleFeatureType featureType = feature.getFeatureType(); |
| | | |
| | | String tableName = encodeSchemaTableName(featureType.getTypeName()); |
| | | AttributeType[] attributeTypes = featureType.getAttributeTypes(); |
| | | List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors(); |
| | | |
| | | String attrValue; |
| | | |
| | |
| | | |
| | | // encode insertion for attributes, but remember to avoid auto-increment ones, |
| | | // they may be included in the feature type as well |
| | | for (AttributeType attributeType : attributeTypes) { |
| | | for (AttributeDescriptor attributeType : descriptors) { |
| | | String attName = attributeType.getLocalName(); |
| | | |
| | | if (feature.getAttribute(attName) != null) { |
| | |
| | | statementSQL.setCharAt(statementSQL.length() - 1, ')'); |
| | | statementSQL.append(" VALUES ("); |
| | | |
| | | Object[] attributes = feature.getAttributes(null); |
| | | List<Object> attributes = feature.getAttributes(); |
| | | |
| | | for (int i = 0; i < attributeTypes.length; i++) { |
| | | for (int i = 0; i < descriptors.size(); i++) { |
| | | attrValue = null; |
| | | |
| | | if (attributeTypes[i] instanceof GeometryAttributeType) { |
| | | // String geomName = attributeTypes[i].getLocalName(); |
| | | if (descriptors.get(i) instanceof GeometryDescriptor) { |
| | | // String geomName = descriptors[i].getLocalName(); |
| | | // int srid = ftInfo.getSRID(geomName); |
| | | Geometry geometry = (Geometry) attributes[i]; |
| | | Geometry geometry = (Geometry) attributes.get(i); |
| | | |
| | | if (geometry == null) { |
| | | attrValue = "NULL"; |
| | |
| | | attrValue = getGeometryInsertText(geometry, srid); |
| | | } |
| | | } else { |
| | | if (attributes[i] != null) { |
| | | attrValue = addQuotes(attributes[i]); |
| | | if (attributes.get(i) != null) { |
| | | attrValue = addQuotes(attributes.get(i)); |
| | | } |
| | | } |
| | | |
| | |
| | | return (statementSQL.toString()); |
| | | } |
| | | |
| | | protected String makePrepareInsertSql(FeatureType featureType) { |
| | | protected String makePrepareInsertSql(SimpleFeatureType featureType) { |
| | | String tableName = encodeSchemaTableName(featureType.getTypeName()); |
| | | AttributeType[] attributeTypes = featureType.getAttributeTypes(); |
| | | List<AttributeDescriptor> attributeTypes = featureType.getAttributeDescriptors(); |
| | | |
| | | String attrValue; |
| | | |
| | |
| | | |
| | | // encode insertion for attributes, but remember to avoid auto-increment ones, |
| | | // they may be included in the feature type as well |
| | | for (AttributeType attributeType : attributeTypes) { |
| | | String attName = attributeType.getLocalName(); |
| | | for (AttributeDescriptor descriptor : attributeTypes) { |
| | | String attName = descriptor.getName().getLocalPart(); |
| | | |
| | | String colName = encodeSchemaColumnName(attName); |
| | | statementSQL.append(colName).append(","); |
| | |
| | | statementSQL.setCharAt(statementSQL.length() - 1, ')'); |
| | | statementSQL.append(" VALUES ("); |
| | | |
| | | for (AttributeType attributeType : attributeTypes) { |
| | | for (AttributeDescriptor attributeType : attributeTypes) { |
| | | statementSQL.append(" ? ,"); |
| | | } |
| | | |
| | |
| | | return "\"" + columnName + "\""; |
| | | } |
| | | |
| | | protected void bindFeatureParameters(PreparedStatement pstmt, Feature feature) throws SQLException { |
| | | FeatureType featureType = feature.getFeatureType(); |
| | | protected void bindFeatureParameters(PreparedStatement pstmt, SimpleFeature feature) throws SQLException { |
| | | SimpleFeatureType featureType = feature.getFeatureType(); |
| | | |
| | | AttributeType[] attributeTypes = featureType.getAttributeTypes(); |
| | | Object[] attributes = feature.getAttributes(null); |
| | | List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors(); |
| | | List<Object> attributes = feature.getAttributes(); |
| | | |
| | | for (int i = 0; i < attributeTypes.length; i++) { |
| | | if (attributeTypes[i] instanceof GeometryAttributeType) { |
| | | pstmt.setBytes(i + 1, binaryWriter.writeBinary((Geometry) attributes[i])); |
| | | for (int i = 0; i < descriptors.size(); i++) { |
| | | if (descriptors.get(i) instanceof GeometryDescriptor) { |
| | | pstmt.setBytes(i + 1, binaryWriter.writeBinary((Geometry) attributes.get(i))); |
| | | } else { |
| | | if (attributeTypes[i].getBinding().equals(Short.class)) { |
| | | pstmt.setShort(i + 1, (Short) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Integer.class)) { |
| | | pstmt.setInt(i + 1, (Short) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Long.class)) { |
| | | pstmt.setLong(i + 1, (Long) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(String.class)) { |
| | | pstmt.setString(i + 1, (String) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Float.class)) { |
| | | pstmt.setFloat(i + 1, (Float) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Double.class)) { |
| | | pstmt.setDouble(i + 1, (Double) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Boolean.class)) { |
| | | pstmt.setBoolean(i + 1, (Boolean) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(BigDecimal.class)) { |
| | | pstmt.setBigDecimal(i + 1, (BigDecimal) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.sql.Date.class)) { |
| | | pstmt.setDate(i + 1, (java.sql.Date) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.sql.Time.class)) { |
| | | pstmt.setTime(i + 1, (java.sql.Time) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.sql.Timestamp.class)) { |
| | | pstmt.setTimestamp(i + 1, (java.sql.Timestamp) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.util.Date.class)) { |
| | | java.sql.Date sDate = new java.sql.Date(((java.util.Date) attributes[i]).getTime()); |
| | | if (descriptors.get(i).getType().getBinding().equals(Short.class)) { |
| | | pstmt.setShort(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Integer.class)) { |
| | | pstmt.setInt(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Long.class)) { |
| | | pstmt.setLong(i + 1, (Long) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(String.class)) { |
| | | pstmt.setString(i + 1, (String) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Float.class)) { |
| | | pstmt.setFloat(i + 1, (Float) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Double.class)) { |
| | | pstmt.setDouble(i + 1, (Double) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Boolean.class)) { |
| | | pstmt.setBoolean(i + 1, (Boolean) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(BigDecimal.class)) { |
| | | pstmt.setBigDecimal(i + 1, (BigDecimal) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().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)) { |
| | | pstmt.setTime(i + 1, (java.sql.Time) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().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)) { |
| | | java.sql.Date sDate = new java.sql.Date(((java.util.Date) attributes.get(i)).getTime()); |
| | | pstmt.setDate(i + 1, sDate); |
| | | } |
| | | } |
| | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | import org.geotools.data.DataSourceException; |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.SchemaNotFoundException; |
| | | import org.geotools.data.postgis.PostgisDataStore; |
| | | import org.geotools.feature.AttributeType; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.GeometryAttributeType; |
| | | import org.geotools.filter.LengthFunction; |
| | | import org.geotools.referencing.NamedIdentifier; |
| | | import org.geotools.referencing.crs.DefaultGeographicCRS; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.GeometryDescriptor; |
| | | import org.opengis.feature.type.PropertyType; |
| | | import org.opengis.filter.BinaryComparisonOperator; |
| | | import org.opengis.filter.Filter; |
| | | import org.opengis.filter.PropertyIsLessThan; |
| | |
| | | return null; |
| | | } |
| | | |
| | | protected boolean isExistFeature(FeatureType featureType) { |
| | | protected boolean isExistFeature(SimpleFeatureType featureType) { |
| | | try { |
| | | FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | SimpleFeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName()); |
| | | return existFeatureType != null; // && existFeatureType.equals(featureType); |
| | | } catch (SchemaNotFoundException e) { |
| | | return false; |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | private String addGeometryColumn(String dbSchema, String tableName, GeometryAttributeType geometryAttribute, int srid) { |
| | | private String addGeometryColumn(String dbSchema, String tableName, GeometryDescriptor geometryDescriptor, int srid) { |
| | | StringBuilder sql; |
| | | String typeName = getGeometrySQLTypeName(geometryAttribute.getBinding()); |
| | | String typeName = getGeometrySQLTypeName(((PropertyType)geometryDescriptor.getType()).getBinding()); |
| | | if (typeName == null) { |
| | | getLogger().warn("Error: " + geometryAttribute.getLocalName() + " unknown type!!!"); |
| | | throw new RuntimeException("Error: " + geometryAttribute.getLocalName() + " unknown type!!!"); |
| | | getLogger().warn("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | | throw new RuntimeException("Error: " + geometryDescriptor.getLocalName() + " unknown type!!!"); |
| | | } |
| | | |
| | | sql = new StringBuilder("SELECT \"public\".AddGeometryColumn('"); |
| | |
| | | sql.append("','"); |
| | | sql.append(tableName); |
| | | sql.append("','"); |
| | | sql.append(geometryAttribute.getLocalName()); |
| | | sql.append(geometryDescriptor.getLocalName()); |
| | | sql.append("','"); |
| | | sql.append(srid); |
| | | sql.append("','"); |
| | |
| | | return sql.toString(); |
| | | } |
| | | |
| | | public ArrayList<String> createNewSchemaTexts(Connection conn, FeatureType featureType) throws IOException { |
| | | public ArrayList<String> createNewSchemaTexts(Connection conn, SimpleFeatureType featureType) throws IOException { |
| | | String origintableName = featureType.getTypeName(); |
| | | String tableName = origintableName.toLowerCase(); |
| | | |
| | | ArrayList<String> result = new ArrayList<String>(); |
| | | |
| | | AttributeType[] attributeType = featureType.getAttributeTypes(); |
| | | List<AttributeDescriptor> attributeType = featureType.getAttributeDescriptors(); |
| | | // String dbSchema = targetDataStore.getDatabaseSchemaName(); |
| | | |
| | | boolean shouldDrop = tablePresent(getTargetSchema(), tableName, conn); |
| | | if (shouldDrop) { |
| | | String sqlStr; |
| | | for (AttributeType anAttributeType : attributeType) { |
| | | if (!(anAttributeType instanceof GeometryAttributeType)) { |
| | | for (AttributeDescriptor descriptor : attributeType) { |
| | | if (!(descriptor instanceof GeometryDescriptor)) { |
| | | continue; |
| | | } |
| | | GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType; |
| | | GeometryDescriptor geomAttribute = (GeometryDescriptor) descriptor; |
| | | sqlStr = dropGeometryColumn(getTargetSchema(), tableName, geomAttribute.getLocalName()); |
| | | getLogger().info(sqlStr); |
| | | result.add(sqlStr); |
| | |
| | | |
| | | String indexName = tableName.replace('-', '_'); |
| | | |
| | | for (AttributeType anAttributeType : attributeType) { |
| | | if (!(anAttributeType instanceof GeometryAttributeType)) { |
| | | String fieldName = anAttributeType.getLocalName().toLowerCase(); |
| | | for (AttributeDescriptor descriptor : attributeType) { |
| | | if (!(descriptor instanceof GeometryDescriptor)) { |
| | | String fieldName = descriptor.getLocalName().toLowerCase(); |
| | | continue; |
| | | } |
| | | GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType; |
| | | GeometryDescriptor geomDescriptor = (GeometryDescriptor) descriptor; |
| | | |
| | | CoordinateReferenceSystem refSys = geomAttribute.getCoordinateSystem(); |
| | | CoordinateReferenceSystem refSys = geomDescriptor.getCoordinateReferenceSystem(); |
| | | int SRID = getSRID(refSys); |
| | | |
| | | sqlStr = addGeometryColumn(getTargetSchema(), tableName, geomAttribute, SRID); |
| | | sqlStr = addGeometryColumn(getTargetSchema(), tableName, geomDescriptor, SRID); |
| | | getLogger().debug(sqlStr); |
| | | result.add(sqlStr); |
| | | |
| | |
| | | sql.append("spatial_"); |
| | | sql.append(indexName); |
| | | sql.append("_"); |
| | | sql.append(anAttributeType.getLocalName().toLowerCase()); |
| | | sql.append(descriptor.getLocalName().toLowerCase()); |
| | | sql.append("\" ON "); |
| | | sql.append(encodeSchemaTableName(tableName)); |
| | | sql.append(" USING GIST ("); |
| | | sql.append(encodeSchemaColumnName(anAttributeType.getLocalName())); |
| | | sql.append(encodeSchemaColumnName(descriptor.getLocalName())); |
| | | sql.append(" gist_geometry_ops);"); |
| | | |
| | | sqlStr = sql.toString(); |
| | |
| | | } |
| | | |
| | | |
| | | private StringBuffer makeNonGeomSqlCreate(AttributeType[] attributeType) |
| | | private StringBuffer makeNonGeomSqlCreate(List<AttributeDescriptor> descriptors) |
| | | throws IOException { |
| | | StringBuffer buf = new StringBuffer(""); |
| | | |
| | | for (AttributeType anAttributeType : attributeType) { |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | String typeName; |
| | | typeName = CLASS_MAPPINGS.get(anAttributeType.getBinding()); |
| | | typeName = CLASS_MAPPINGS.get(((PropertyType) descriptor.getType()).getBinding()); |
| | | if (typeName == null) { |
| | | typeName = GEOM_CLASS_MAPPINGS.get(anAttributeType.getBinding()); |
| | | typeName = GEOM_CLASS_MAPPINGS.get(((PropertyType) descriptor.getType()).getBinding()); |
| | | if (typeName != null) continue; |
| | | } |
| | | |
| | | if (typeName != null) { |
| | | if (typeName.equals("VARCHAR")) { |
| | | int length = -1; |
| | | Filter f = anAttributeType.getRestriction(); |
| | | List<Filter> flist = ((PropertyType) descriptor.getType()).getRestrictions(); |
| | | for (Filter f : flist) { |
| | | if (f != null && f != Filter.EXCLUDE && f != Filter.INCLUDE && |
| | | (f instanceof PropertyIsLessThan || f instanceof PropertyIsLessThanOrEqualTo)) { |
| | | try { |
| | |
| | | } else { |
| | | length = 512; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (length < 1) { |
| | | getLogger().warn("FeatureType did not specify string length; defaulted to 256"); |
| | |
| | | typeName = typeName + "(" + length + ")"; |
| | | } |
| | | |
| | | if (!anAttributeType.isNillable()) { |
| | | if (!descriptor.isNillable()) { |
| | | typeName = typeName + " NOT NULL"; |
| | | } |
| | | |
| | | //TODO review!!! Is toString() always OK??? |
| | | Object defaultValue = anAttributeType.createDefaultValue(); |
| | | Object defaultValue = descriptor.getDefaultValue(); |
| | | |
| | | if (defaultValue != null) { |
| | | typeName = typeName + " DEFAULT '" |
| | | + defaultValue.toString() + "'"; |
| | | } |
| | | |
| | | buf.append(" \"").append(anAttributeType.getLocalName()).append("\" ").append(typeName).append(","); |
| | | buf.append(" \"").append(descriptor.getLocalName()).append("\" ").append(typeName).append(","); |
| | | |
| | | } else { |
| | | String msg; |
| | | if (anAttributeType == null) { |
| | | if (descriptor == null) { |
| | | msg = "AttributeType was null!"; |
| | | } else { |
| | | msg = "Type '" + anAttributeType.getBinding() + "' not supported!"; |
| | | msg = "Type '" + ((PropertyType) descriptor.getType()).getBinding() + "' not supported!"; |
| | | } |
| | | throw (new IOException(msg)); |
| | | } |
| | |
| | | return "GeometryFromText('" + geoText + "', " + srid + ")"; |
| | | } |
| | | |
| | | protected String makeInsertSql(Feature feature, int srid) // throws IOException |
| | | protected String makeInsertSql(SimpleFeature feature, int srid) // throws IOException |
| | | { |
| | | FeatureType featureType = feature.getFeatureType(); |
| | | SimpleFeatureType featureType = feature.getFeatureType(); |
| | | |
| | | String tableName = encodeSchemaTableName(featureType.getTypeName()); |
| | | AttributeType[] attributeTypes = featureType.getAttributeTypes(); |
| | | List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors(); |
| | | |
| | | String attrValue; |
| | | |
| | |
| | | |
| | | // encode insertion for attributes, but remember to avoid auto-increment ones, |
| | | // they may be included in the feature type as well |
| | | for (AttributeType attributeType : attributeTypes) { |
| | | String attName = attributeType.getLocalName(); |
| | | for (AttributeDescriptor attributeDescriptor : descriptors) { |
| | | String attName = attributeDescriptor.getLocalName(); |
| | | |
| | | if (feature.getAttribute(attName) != null) { |
| | | String colName = encodeSchemaColumnName(attName); |
| | |
| | | statementSQL.setCharAt(statementSQL.length() - 1, ')'); |
| | | statementSQL.append(" VALUES ("); |
| | | |
| | | Object[] attributes = feature.getAttributes(null); |
| | | List<Object> attributes = feature.getAttributes(); |
| | | |
| | | for (int i = 0; i < attributeTypes.length; i++) { |
| | | for (int i = 0; i < descriptors.size(); i++) { |
| | | attrValue = null; |
| | | |
| | | if (attributeTypes[i] instanceof GeometryAttributeType) { |
| | | // String geomName = attributeTypes[i].getLocalName(); |
| | | if (descriptors.get(i) instanceof GeometryDescriptor) { |
| | | // String geomName = descriptors[i].getLocalName(); |
| | | // int srid = ftInfo.getSRID(geomName); |
| | | Geometry geometry = (Geometry) attributes[i]; |
| | | Geometry geometry = (Geometry) attributes.get(i); |
| | | |
| | | if (geometry == null) { |
| | | attrValue = "NULL"; |
| | |
| | | attrValue = getGeometryInsertText(geometry, srid); |
| | | } |
| | | } else { |
| | | if (attributes[i] != null) { |
| | | attrValue = addQuotes(attributes[i]); |
| | | if (attributes.get(i) != null) { |
| | | attrValue = addQuotes(attributes.get(i)); |
| | | } |
| | | } |
| | | |
| | |
| | | return (statementSQL.toString()); |
| | | } |
| | | |
| | | protected String makePrepareInsertSql(FeatureType featureType) { |
| | | protected String makePrepareInsertSql(SimpleFeatureType featureType) { |
| | | String tableName = encodeSchemaTableName(featureType.getTypeName()); |
| | | AttributeType[] attributeTypes = featureType.getAttributeTypes(); |
| | | List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors(); |
| | | |
| | | String attrValue; |
| | | |
| | |
| | | |
| | | // encode insertion for attributes, but remember to avoid auto-increment ones, |
| | | // they may be included in the feature type as well |
| | | for (AttributeType attributeType : attributeTypes) { |
| | | String attName = attributeType.getLocalName(); |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | String attName = descriptor.getLocalName(); |
| | | |
| | | String colName = encodeSchemaColumnName(attName); |
| | | statementSQL.append(colName).append(","); |
| | |
| | | statementSQL.setCharAt(statementSQL.length() - 1, ')'); |
| | | statementSQL.append(" VALUES ("); |
| | | |
| | | for (AttributeType attributeType : attributeTypes) { |
| | | for (AttributeDescriptor descriptor : descriptors) { |
| | | statementSQL.append(" ? ,"); |
| | | } |
| | | |
| | |
| | | return "\"" + columnName + "\""; |
| | | } |
| | | |
| | | protected void bindFeatureParameters(PreparedStatement pstmt, Feature feature) throws SQLException { |
| | | FeatureType featureType = feature.getFeatureType(); |
| | | protected void bindFeatureParameters(PreparedStatement pstmt, SimpleFeature feature) throws SQLException { |
| | | SimpleFeatureType featureType = feature.getFeatureType(); |
| | | |
| | | AttributeType[] attributeTypes = featureType.getAttributeTypes(); |
| | | Object[] attributes = feature.getAttributes(null); |
| | | List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors(); |
| | | List<Object> attributes = feature.getAttributes(); |
| | | |
| | | for (int i = 0; i < attributeTypes.length; i++) { |
| | | if (attributeTypes[i] instanceof GeometryAttributeType) { |
| | | pstmt.setBytes(i + 1, binaryWriter.writeBinary((Geometry) attributes[i])); |
| | | for (int i = 0; i < descriptors.size(); i++) { |
| | | if (descriptors.get(i) instanceof GeometryDescriptor) { |
| | | pstmt.setBytes(i + 1, binaryWriter.writeBinary((Geometry) attributes.get(i))); |
| | | } else { |
| | | if (attributeTypes[i].getBinding().equals(Short.class)) { |
| | | pstmt.setShort(i + 1, (Short) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Integer.class)) { |
| | | pstmt.setInt(i + 1, (Short) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Long.class)) { |
| | | pstmt.setLong(i + 1, (Long) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(String.class)) { |
| | | pstmt.setString(i + 1, (String) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Float.class)) { |
| | | pstmt.setFloat(i + 1, (Float) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Double.class)) { |
| | | pstmt.setDouble(i + 1, (Double) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(Boolean.class)) { |
| | | pstmt.setBoolean(i + 1, (Boolean) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(BigDecimal.class)) { |
| | | pstmt.setBigDecimal(i + 1, (BigDecimal) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.sql.Date.class)) { |
| | | pstmt.setDate(i + 1, (java.sql.Date) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.sql.Time.class)) { |
| | | pstmt.setTime(i + 1, (java.sql.Time) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.sql.Timestamp.class)) { |
| | | pstmt.setTimestamp(i + 1, (java.sql.Timestamp) attributes[i]); |
| | | } else if (attributeTypes[i].getBinding().equals(java.util.Date.class)) { |
| | | java.sql.Date sDate = new java.sql.Date(((java.util.Date) attributes[i]).getTime()); |
| | | if (descriptors.get(i).getType().getBinding().equals(Short.class)) { |
| | | pstmt.setShort(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Integer.class)) { |
| | | pstmt.setInt(i + 1, (Short) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Long.class)) { |
| | | pstmt.setLong(i + 1, (Long) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(String.class)) { |
| | | pstmt.setString(i + 1, (String) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Float.class)) { |
| | | pstmt.setFloat(i + 1, (Float) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Double.class)) { |
| | | pstmt.setDouble(i + 1, (Double) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(Boolean.class)) { |
| | | pstmt.setBoolean(i + 1, (Boolean) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().equals(BigDecimal.class)) { |
| | | pstmt.setBigDecimal(i + 1, (BigDecimal) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().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)) { |
| | | pstmt.setTime(i + 1, (java.sql.Time) attributes.get(i)); |
| | | } else if (descriptors.get(i).getType().getBinding().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)) { |
| | | java.sql.Date sDate = new java.sql.Date(((java.util.Date) attributes.get(i)).getTime()); |
| | | pstmt.setDate(i + 1, sDate); |
| | | } |
| | | } |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save PostGIS:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save PostGIS:" + featureType.getTypeName()); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList()); |
| | | } |
| | | ArrayList<Feature> arrayList = (ArrayList<Feature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = (ArrayList<SimpleFeature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | } |
| | | |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | logger.debug("Begin Save PostGIS:" + featureType.getTypeName()); |
| | | |
| | | FeatureWriter writer; |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save PostGIS:" + featureType.getTypeName()); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.postgresql.util.PSQLException; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | |
| | | static final LoggerFacade sLogger = new CommonsLoggingLogger(logger); |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | |
| | | private HashMap<FeatureType, ArrayList<Feature>> txFeaturesContext = new HashMap<FeatureType, ArrayList<Feature>>(); |
| | | private HashMap<SimpleFeatureType, ArrayList<SimpleFeature>> txFeaturesContext = new HashMap<SimpleFeatureType, ArrayList<SimpleFeature>>(); |
| | | |
| | | private TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | private TreeMap<String, FeatureType> featureTypes = new TreeMap<String, FeatureType>(); |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | | FeatureType ft = lookupFeatureType(element); |
| | | SimpleFeatureType ft = lookupFeatureType(element); |
| | | if (ft != null) { |
| | | boolean canLog = true; |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | try { |
| | | feature = createFeature(ft, element); |
| | | } catch (ArrayIndexOutOfBoundsException e) { |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | if (feature.getDefaultGeometry() != null && !feature.getDefaultGeometry().isEmpty()) { |
| | | ArrayList<SimpleFeature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | if (feature.getDefaultGeometry() != null && !((Geometry)feature.getDefaultGeometry()).isEmpty()) { |
| | | arrayList.add(feature); |
| | | accumulate++; |
| | | } |
| | |
| | | |
| | | private void updateDataStore() { |
| | | if (isProfileMode()) markUpdateTime(); |
| | | Iterator<FeatureType> it = txFeaturesContext.keySet().iterator(); |
| | | Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); |
| | | Connection conn = null; |
| | | try { |
| | | conn = getConnection(); |
| | |
| | | conn.setAutoCommit(false); |
| | | |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = it.next(); |
| | | SimpleFeatureType featureType = it.next(); |
| | | logger.debug("Begin Save into PostGIS:" + featureType.getTypeName()); |
| | | |
| | | String bindingStmt = makePrepareInsertSql(featureType); |
| | | ArrayList<Feature> features = txFeaturesContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = txFeaturesContext.get(featureType); |
| | | PreparedStatement pstmt = conn.prepareStatement(bindingStmt); |
| | | |
| | | for (Feature feature : features) { |
| | | for (SimpleFeature feature : features) { |
| | | // currentStmt = feature; |
| | | // Statement stmt = conn.createStatement(); |
| | | try { |
| | |
| | | */ |
| | | } |
| | | |
| | | public FeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | clearFeatureData(typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createPolygonFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPolygonFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createPolygonFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPolygonFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | clearFeatureData(typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | clearFeatureData(typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createMultiLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalMultiLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createMultiLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalMultiLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | clearFeatureData(typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | clearFeatureData(typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | clearFeatureData(typeBuilder); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | content = content.replace('\u0000', ' '); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getFontIndex(), |
| | |
| | | textElement.getTextWidth(), |
| | | angle, |
| | | content |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | | textNodeElement.getFontIndex(), |
| | |
| | | textNodeElement.getTextNodeLength(), |
| | | angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | return featureBaseName; |
| | | } |
| | | |
| | | private FeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | String typeName; |
| | | if (element instanceof TextElement) { |
| | | typeName = getFeatureBaseName() + "_P"; |
| | |
| | | this.dropTableMode = dropTableMode; |
| | | } |
| | | |
| | | protected void clearFeatureData(FeatureTypeBuilder typeBuilder) throws SchemaException { |
| | | protected void clearFeatureData(SimpleFeatureTypeBuilder typeBuilder) throws SchemaException { |
| | | if (isProfileMode()) markUpdateTime(); |
| | | |
| | | String featureName = typeBuilder.getName(); |
| | | Connection conn = null; |
| | | if (isExistFeature(typeBuilder.getFeatureType())) { |
| | | if (isExistFeature(typeBuilder.buildFeatureType())) { |
| | | try { |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilder.getFeatureType().getDefaultGeometry().getLocalName()); |
| | | typeBuilder.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | dropTable(conn, featureName); |
| | | |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilder.getFeatureType()); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilder.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | } else { |
| | | try { |
| | | conn = getConnection(); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilder.getFeatureType()); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilder.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | import org.geotools.data.DataStore; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.postgresql.util.PSQLException; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | |
| | | static final GeometryFactory geometryFactory = new GeometryFactory(); |
| | | protected GeometryConverterDecorator convertDecorator; |
| | | |
| | | private HashMap<FeatureType, ArrayList<Feature>> txFeaturesContext = new HashMap<FeatureType, ArrayList<Feature>>(); |
| | | private HashMap<SimpleFeatureType, ArrayList<SimpleFeature>> txFeaturesContext = |
| | | new HashMap<SimpleFeatureType, ArrayList<SimpleFeature>>(); |
| | | |
| | | private FeatureTypeBuilder typeBuilderPnt = null; |
| | | private FeatureTypeBuilder typeBuilderRect = null; |
| | | private FeatureTypeBuilder typeBuilderSmallRect = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderPnt = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderRect = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderSmallRect = null; |
| | | |
| | | private FeatureType featureType = null; |
| | | private FeatureType featureType2 = null; |
| | | private FeatureType featureType3 = null; |
| | | private SimpleFeatureType featureType = null; |
| | | private SimpleFeatureType featureType2 = null; |
| | | private SimpleFeatureType featureType3 = null; |
| | | |
| | | private boolean dropTableMode = true; |
| | | private int accumulate = 0; |
| | |
| | | } |
| | | |
| | | protected void putTextFeatureCollection(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | Feature feature = createFeature(element); |
| | | SimpleFeature feature = createFeature(element); |
| | | if (feature == null) { |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | element.getText() + "'"); |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | |
| | | feature = createFeature2(element); |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | |
| | | Feature[] features = createFeature3(element); |
| | | SimpleFeature[] features = createFeature3(element); |
| | | if (features == null) { |
| | | logger.info("cannot craete feature3." + element.toString() + "'" + |
| | | element.getText() + "'"); |
| | | return; |
| | | } |
| | | if (!txFeaturesContext.containsKey(features[0].getFeatureType())) { |
| | | txFeaturesContext.put(features[0].getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(features[0].getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | arrayList = txFeaturesContext.get(features[0].getFeatureType()); |
| | | arrayList.addAll(Arrays.asList(features)); |
| | |
| | | } |
| | | |
| | | protected void putShapeFeatureCollection(ShapeElement element) throws SchemaException, IllegalAttributeException { |
| | | Feature feature = createFeature(element); |
| | | SimpleFeature feature = createFeature(element); |
| | | if (feature == null) { |
| | | Polygon polygon = (Polygon) element.toGeometry(geometryFactory); |
| | | if (polygon == null) { |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | |
| | | feature = createFeature2(element); |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | |
| | | Feature[] features = createFeature3(element); |
| | | SimpleFeature[] features = createFeature3(element); |
| | | if (features == null) { |
| | | Polygon polygon = (Polygon) element.toGeometry(geometryFactory); |
| | | if (polygon == null) { |
| | |
| | | return; |
| | | } |
| | | if (!txFeaturesContext.containsKey(features[0].getFeatureType())) { |
| | | txFeaturesContext.put(features[0].getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(features[0].getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | arrayList = txFeaturesContext.get(features[0].getFeatureType()); |
| | | arrayList.addAll(Arrays.asList(features)); |
| | |
| | | private void updateDataStore() { |
| | | if (isProfileMode()) markUpdateTime(); |
| | | |
| | | Iterator<FeatureType> it = txFeaturesContext.keySet().iterator(); |
| | | Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); |
| | | Connection conn = null; |
| | | try { |
| | | conn = getConnection(); |
| | |
| | | conn.setAutoCommit(false); |
| | | |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = it.next(); |
| | | SimpleFeatureType featureType = it.next(); |
| | | logger.debug("Begin Save PostGIS:" + featureType.getTypeName()); |
| | | |
| | | String bindingStmt = makePrepareInsertSql(featureType); |
| | | ArrayList<Feature> features = txFeaturesContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = txFeaturesContext.get(featureType); |
| | | PreparedStatement pstmt = conn.prepareStatement(bindingStmt); |
| | | |
| | | for (Feature feature : features) { |
| | | for (SimpleFeature feature : features) { |
| | | // currentStmt = feature; |
| | | // Statement stmt = conn.createStatement(); |
| | | try { |
| | |
| | | */ |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (typeBuilderRect == null) { |
| | | Connection conn = null; |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | if (isExistFeature(typeBuilderRect.getFeatureType())) { |
| | | if (isExistFeature(typeBuilderRect.buildFeatureType())) { |
| | | try { |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | try { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilderRect.getFeatureType().getDefaultGeometry().getLocalName()); |
| | | typeBuilderRect.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | } catch (PSQLException e) { |
| | | logger.debug(e.getMessage(), e); |
| | | } |
| | |
| | | logger.debug(e.getMessage(), e); |
| | | } |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, |
| | | typeBuilderRect.getFeatureType()); |
| | | typeBuilderRect.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | try { |
| | | conn = getConnection(); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, |
| | | typeBuilderRect.getFeatureType()); |
| | | typeBuilderRect.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | } |
| | | } |
| | | } |
| | | return typeBuilderRect.getFeatureType(); |
| | | return typeBuilderRect.buildFeatureType(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | if (typeBuilderPnt == null) { |
| | | Connection conn = null; |
| | | typeBuilderPnt = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName); |
| | | if (isExistFeature(typeBuilderPnt.getFeatureType())) { |
| | | if (isExistFeature(typeBuilderPnt.buildFeatureType())) { |
| | | try { |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilderPnt.getFeatureType().getDefaultGeometry().getLocalName()); |
| | | typeBuilderPnt.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | dropTable(conn, featureName); |
| | | |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, |
| | | typeBuilderPnt.getFeatureType()); |
| | | typeBuilderPnt.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | try { |
| | | conn = getConnection(); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, |
| | | typeBuilderPnt.getFeatureType()); |
| | | typeBuilderPnt.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | } |
| | | } |
| | | } |
| | | return typeBuilderPnt.getFeatureType(); |
| | | return typeBuilderPnt.buildFeatureType(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement3(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement3(String featureName) throws SchemaException { |
| | | if (typeBuilderSmallRect == null) { |
| | | Connection conn = null; |
| | | typeBuilderSmallRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | if (isExistFeature(typeBuilderSmallRect.getFeatureType())) { |
| | | if (isExistFeature(typeBuilderSmallRect.buildFeatureType())) { |
| | | try { |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | try { |
| | | dropGeometryColumn(conn, featureName, |
| | | typeBuilderSmallRect.getFeatureType().getDefaultGeometry().getLocalName()); |
| | | typeBuilderSmallRect.buildFeatureType().getGeometryDescriptor().getLocalName()); |
| | | } catch (PSQLException e) { |
| | | logger.debug(e.getMessage(), e); |
| | | } |
| | |
| | | } catch (PSQLException e) { |
| | | logger.debug(e.getMessage(), e); |
| | | } |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilderSmallRect.getFeatureType()); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, typeBuilderSmallRect.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | try { |
| | | conn = getConnection(); |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, |
| | | typeBuilderSmallRect.getFeatureType()); |
| | | typeBuilderSmallRect.buildFeatureType()); |
| | | for (String stmtText : schemaTexts) { |
| | | Statement stmt = conn.createStatement(); |
| | | stmt.execute(stmtText); |
| | |
| | | } |
| | | } |
| | | } |
| | | return typeBuilderSmallRect.getFeatureType(); |
| | | return typeBuilderSmallRect.buildFeatureType(); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | }), null); |
| | | } |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else if (element instanceof ShapeElement) { |
| | | ShapeElement shapeElement = (ShapeElement) element; |
| | | Geometry geomShape = shapeElement.toGeometry(geometryFactory); |
| | |
| | | } |
| | | |
| | | return (geom == null ? null : |
| | | featureType.create(new Object[]{ |
| | | SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | })); |
| | | }, null)); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature createFeature2(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature2(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | TextElement txtElement = (TextElement) element; |
| | | double angle = txtElement.getRotationAngle(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | convertDecorator.setConverter(txtElement); |
| | | Geometry gobj = convertDecorator.toGeometry(geometryFactory); |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | |
| | | txtElement.getTextWidth(), |
| | | angle, |
| | | txtElement.getText() |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } else if (element instanceof ShapeElement) { |
| | | Feature feature = null; |
| | | SimpleFeature feature = null; |
| | | ShapeElement shapeElement = (ShapeElement) element; |
| | | double angle = 0.0; |
| | | Geometry geomShape = shapeElement.toGeometry(geometryFactory); |
| | |
| | | Geometry gobj = geometryFactory.createPoint(pos); |
| | | |
| | | if (gobj != null) |
| | | feature = featureType.create(new Object[]{ |
| | | feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | gobj, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | |
| | | 15 * 5, |
| | | angle, |
| | | tpclid |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public Feature[] createFeature3(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature[] createFeature3(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | String tpclid = textElement.getText(); |
| | | Feature[] result = new Feature[4]; |
| | | SimpleFeature[] result = new SimpleFeature[4]; |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | |
| | |
| | | } |
| | | Envelope innerExtent = geom.getEnvelopeInternal(); |
| | | |
| | | result[i] = featureType.create(new Object[]{ |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | innerExtent.getMinX(), |
| | | innerExtent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | |
| | | } |
| | | return result; |
| | |
| | | if (polygon.isRectangle()) { |
| | | Envelope extent = polygon.getEnvelopeInternal(); |
| | | if (extent.getWidth() == TPCLIDConverter.SX1200) { |
| | | Feature[] result = new Feature[4]; |
| | | SimpleFeature[] result = new SimpleFeature[4]; |
| | | Coordinate center = extent.centre(); |
| | | String tpclid = TPCLIDConverter.CoordinateToTpclId(center); |
| | | if (tpclid.length() > 5) { |
| | |
| | | |
| | | Envelope innerExtent = geom.getEnvelopeInternal(); |
| | | |
| | | result[i] = featureType.create(new Object[]{ |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | innerExtent.getMinX(), |
| | | innerExtent.getMinY(), |
| | |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | |
| | | return result; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private Feature createFeature(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature(Element element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature(featureType, element); |
| | | } |
| | | |
| | | private Feature createFeature2(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature2(Element element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType2 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature2(featureType2, element); |
| | | } |
| | | |
| | | private Feature[] createFeature3(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature[] createFeature3(Element element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType3 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import org.apache.commons.digester.Digester; |
| | | import org.apache.commons.digester.xmlrules.DigesterLoader; |
| | | import org.apache.commons.logging.Log; |
| | |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.jdbc.JDBCUtils; |
| | | import org.geotools.data.postgis.PostgisDataStoreFactory; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.postgresql.util.PSQLException; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | |
| | | |
| | | private ElementDispatcher elementDispatcher; |
| | | |
| | | private HashMap<FeatureType, ArrayList<Feature>> txFeaturesContext = new HashMap<FeatureType, ArrayList<Feature>>(); |
| | | private HashMap<SimpleFeatureType, ArrayList<SimpleFeature>> txFeaturesContext = new HashMap<SimpleFeatureType, ArrayList<SimpleFeature>>(); |
| | | |
| | | private JobExecutionContext executionContext; |
| | | |
| | |
| | | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // 判斷是否符和條件 |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | return; |
| | | } |
| | | |
| | | if (feature.getDefaultGeometry().isEmpty()) { |
| | | if (((Geometry)feature.getDefaultGeometry()).isEmpty()) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | accumulate++; |
| | | if (accumulate > BATCHSIZE) { |
| | |
| | | |
| | | private void updateDataStore() { |
| | | if (isProfileMode()) markUpdateTime(); |
| | | Iterator<FeatureType> it = txFeaturesContext.keySet().iterator(); |
| | | Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); |
| | | Connection conn = null; |
| | | try { |
| | | conn = getConnection(); |
| | |
| | | conn.setAutoCommit(false); |
| | | |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = it.next(); |
| | | SimpleFeatureType featureType = it.next(); |
| | | logger.debug("Begin Save into PostGIS:" + featureType.getTypeName()); |
| | | |
| | | int batchCount = 0; |
| | | String bindingStmt = makePrepareInsertSql(featureType); |
| | | ArrayList<Feature> features = txFeaturesContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = txFeaturesContext.get(featureType); |
| | | PreparedStatement pstmt = conn.prepareStatement(bindingStmt); |
| | | |
| | | for (Feature feature : features) { |
| | | for (SimpleFeature feature : features) { |
| | | try { |
| | | // stmt.execute(feature); |
| | | bindFeatureParameters(pstmt, feature); |
| | |
| | | if (bindingStmt != null) { |
| | | logger.error("Execute:" + bindingStmt); |
| | | } |
| | | for (int i = 0; i < feature.getNumberOfAttributes(); i++) { |
| | | for (int i = 0; i < feature.getAttributeCount(); i++) { |
| | | logger.info("attr[" + i + "]-" + ((feature.getAttribute(i) == null) ? " NULL" : |
| | | feature.getAttribute(i).toString())); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Ãö³¬³]³Æ¼g¤J¾¹ |
| | | * �����]�Ƽg�J�� |
| | | * |
| | | * @throws IOException IOµo¥Í¿ù»~ |
| | | * @throws IOException IO�o�Ϳ�~ |
| | | */ |
| | | public void closeFeatureWriter() throws IOException { |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | protected void createOrClearFeatureDataTable(FeatureType featureType) throws SchemaException { |
| | | protected void createOrClearFeatureDataTable(SimpleFeatureType featureType) throws SchemaException { |
| | | String featureName = featureType.getTypeName(); |
| | | Connection conn = null; |
| | | if (isExistFeature(featureType)) { |
| | |
| | | conn = getConnection(); |
| | | if (dropTableMode) { |
| | | dropGeometryColumn(conn, getTargetSchema(), featureName, |
| | | featureType.getDefaultGeometry().getLocalName()); |
| | | featureType.getGeometryDescriptor().getName().getLocalPart()); |
| | | dropTable(conn, getTargetSchema(), featureName); |
| | | |
| | | ArrayList<String> schemaTexts = createNewSchemaTexts(conn, featureType); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexType; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | |
| | | true, Charset.forName("UTF-8")); |
| | | } else { |
| | | shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | } |
| | | |
| | | if (!existFile) { |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save shapefile:" + sfile.toURI()); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexType; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | |
| | | return; |
| | | } |
| | | |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | FrammeAttributeData linkage = |
| | | AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | |
| | | true, Charset.forName("UTF-8")); |
| | | } else { |
| | | shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | } |
| | | |
| | | if (!existFile) { |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save shapefile:" + sfile.toURI()); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexType; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.TextNodeElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | 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); |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>(); |
| | | private TreeMap<String, FeatureType> featureTypes = new TreeMap<String, FeatureType>(); |
| | | private TreeMap<String, SimpleFeatureType> featureTypes = new TreeMap<String, SimpleFeatureType>(); |
| | | |
| | | private GeometryConverterDecorator convertDecorator = null; |
| | | private String featureBaseName = null; |
| | |
| | | } |
| | | |
| | | public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException { |
| | | FeatureType ft = lookupFeatureType(element); |
| | | SimpleFeatureType ft = lookupFeatureType(element); |
| | | if (ft != null) { |
| | | Feature feature = createFeature(ft, element); |
| | | SimpleFeature feature = createFeature(ft, element); |
| | | if (feature == null) { |
| | | if (element instanceof TextElement) |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | |
| | | } |
| | | |
| | | if (!txFeaturesContext.containsKey(feature.getFeatureType())) { |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(feature.getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | ArrayList<Feature> arrayList = (ArrayList<Feature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | ArrayList<SimpleFeature> arrayList = (ArrayList<SimpleFeature>) txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | } else { |
| | | logger.info("Unknown Element :" + element.getType() + ", lv=" + element.getLevelIndex()); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | |
| | | true, Charset.forName("UTF-8")); |
| | | } else { |
| | | shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | } |
| | | |
| | | if (!existFile) { |
| | |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save shapefile:" + sfile.toURI()); |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public FeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createPointFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createLineFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createArcFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!typeBuilders.containsKey(featureName)) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | typeBuilders.put(featureName, typeBuilder); |
| | | public SimpleFeatureType createEllipseFeatureElement(String featureName) throws SchemaException { |
| | | if (!featureTypes.containsKey(featureName)) { |
| | | SimpleFeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName); |
| | | SimpleFeatureType featureType = typeBuilder.buildFeatureType(); |
| | | featureTypes.put(featureName, featureType); |
| | | } |
| | | return typeBuilders.get(featureName).getFeatureType(); |
| | | return featureTypes.get(featureName); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | String content = textElement.getText(); |
| | | angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getFontIndex(), |
| | |
| | | textElement.getTextWidth(), |
| | | angle, |
| | | content |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | } |
| | | |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(textNodeElement.getColorIndex()), |
| | | textNodeElement.getFontIndex(), |
| | |
| | | textNodeElement.getTextNodeLength(), |
| | | angle, |
| | | sb.toString() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(shapeElement); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) { |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(shapeElement.getColorIndex()), |
| | | shapeElement.getWeight(), |
| | | shapeElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } else { |
| | | logger.info("geometry is null." + element.toString()); |
| | | } |
| | |
| | | convertDecorator.setConverter(linestring); |
| | | Geometry geom = convertDecorator.toGeometry(geometryFactory); |
| | | if (geom != null) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | 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) |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | colorTable.getColorCode(complexChainElement.getColorIndex()), |
| | | complexChainElement.getWeight(), |
| | | complexChainElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | return null; |
| | | } |
| | | return null; |
| | |
| | | return featureBaseName; |
| | | } |
| | | |
| | | private FeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException { |
| | | String typeName; |
| | | if (element instanceof TextElement) { |
| | | typeName = getFeatureBaseName() + "P"; |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexType; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SchemaException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.Envelope; |
| | |
| | | import com.ximple.io.dgn7.FrammeAttributeData; |
| | | import com.ximple.io.dgn7.TextElement; |
| | | import com.ximple.io.dgn7.UserAttributeData; |
| | | import org.geotools.feature.simple.SimpleFeatureBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | 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); |
| | |
| | | |
| | | private String dataOut = null; |
| | | |
| | | private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>(); |
| | | private HashMap<String, ArrayList<SimpleFeature>> featuresContext = new HashMap<String, ArrayList<SimpleFeature>>(); |
| | | private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>(); |
| | | |
| | | private PessimisticMapWrapper txFeaturesContext; |
| | | private FeatureTypeBuilder typeBuilderPnt = null; |
| | | private FeatureTypeBuilder typeBuilderRect = null; |
| | | private FeatureType featureType = null; |
| | | private FeatureType featureType2 = null; |
| | | private FeatureType featureType3 = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderPnt = null; |
| | | private SimpleFeatureTypeBuilder typeBuilderRect = null; |
| | | private SimpleFeatureType featureType = null; |
| | | private SimpleFeatureType featureType2 = null; |
| | | private SimpleFeatureType featureType3 = null; |
| | | |
| | | private int accumulate = 0; |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | Feature feature = createFeature((TextElement) element); |
| | | SimpleFeature feature = createFeature((TextElement) element); |
| | | if (feature == null) { |
| | | logger.info("cannot craete feature." + element.toString() + "'" + |
| | | ((TextElement) element).getText() + "'"); |
| | |
| | | arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType()); |
| | | arrayList.add(feature); |
| | | |
| | | Feature[] features = createFeature3((TextElement) element); |
| | | SimpleFeature[] features = createFeature3((TextElement) element); |
| | | if (features == null) { |
| | | logger.info("cannot craete feature3." + element.toString() + "'" + |
| | | ((TextElement) element).getText() + "'"); |
| | | return; |
| | | } |
| | | if (!txFeaturesContext.containsKey(features[0].getFeatureType())) { |
| | | txFeaturesContext.put(features[0].getFeatureType(), new ArrayList<Feature>()); |
| | | txFeaturesContext.put(features[0].getFeatureType(), new ArrayList<SimpleFeature>()); |
| | | } |
| | | arrayList = (ArrayList) txFeaturesContext.get(features[0].getFeatureType()); |
| | | arrayList.addAll(Arrays.asList(features)); |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | |
| | | true, Charset.forName("UTF-8")); |
| | | */ |
| | | ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | shapefileDataStore.createSchema(featureType); |
| | | writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT); |
| | | featuresWriterContext.put(featureType.getTypeName(), writer); |
| | | } |
| | | |
| | | ArrayList<Feature> features = featuresContext.get(featureType); |
| | | for (Feature feature1 : features) { |
| | | ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes(null)); |
| | | ArrayList<SimpleFeature> features = featuresContext.get(featureType); |
| | | for (SimpleFeature feature1 : features) { |
| | | ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save shapefile:" + sfile.toURI()); |
| | |
| | | this.featuresWriterContext.clear(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement(String featureName) throws SchemaException { |
| | | if (typeBuilderRect == null) { |
| | | typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderRect.getFeatureType(); |
| | | return typeBuilderRect.buildFeatureType(); |
| | | } |
| | | |
| | | public FeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | public SimpleFeatureType createFeatureElement2(String featureName) throws SchemaException { |
| | | if (typeBuilderPnt == null) { |
| | | typeBuilderPnt = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName); |
| | | } |
| | | return typeBuilderPnt.getFeatureType(); |
| | | return typeBuilderPnt.buildFeatureType(); |
| | | } |
| | | |
| | | public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | |
| | | TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), |
| | | }); |
| | | } |
| | | return featureType.create(new Object[]{ |
| | | return SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature createFeature2(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature createFeature2(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | 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); |
| | | Feature feature = featureType.create(new Object[]{ |
| | | SimpleFeature feature = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | convertDecorator.toGeometry(geometryFactory), |
| | | colorTable.getColorCode(txtElement.getColorIndex()), |
| | | txtElement.getWeight(), |
| | |
| | | txtElement.getTextWidth(), |
| | | angle, |
| | | txtElement.getText() |
| | | }); |
| | | }, null); |
| | | return feature; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Feature[] createFeature3(FeatureType featureType, Element element) throws IllegalAttributeException { |
| | | public SimpleFeature[] createFeature3(SimpleFeatureType featureType, Element element) throws IllegalAttributeException { |
| | | DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); |
| | | if (element instanceof TextElement) { |
| | | TextElement textElement = (TextElement) element; |
| | | String tpclid = textElement.getText(); |
| | | Feature[] result = new Feature[4]; |
| | | SimpleFeature[] result = new SimpleFeature[4]; |
| | | |
| | | Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid); |
| | | |
| | |
| | | extent.getMinX() + dx, extent.getMaxY() - TPCLIDConverter.SY600 - dy)), |
| | | }), null); |
| | | } |
| | | result[i] = featureType.create(new Object[]{ |
| | | result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ |
| | | geom, |
| | | extent.getMinX(), |
| | | extent.getMinY(), |
| | |
| | | colorTable.getColorCode(textElement.getColorIndex()), |
| | | textElement.getWeight(), |
| | | textElement.getLineStyle() |
| | | }); |
| | | }, null); |
| | | |
| | | } |
| | | return result; |
| | |
| | | return null; |
| | | } |
| | | |
| | | private Feature createFeature(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature(featureType, element); |
| | | } |
| | | |
| | | private Feature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType2 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | return createFeature2(featureType2, element); |
| | | } |
| | | |
| | | private Feature[] createFeature3(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | private SimpleFeature[] createFeature3(TextElement element) throws SchemaException, IllegalAttributeException { |
| | | if (featureType3 == null) { |
| | | String dgnname = getFilename().toLowerCase(); |
| | | int i = dgnname.lastIndexOf("."); |
| | |
| | | import org.geotools.data.FeatureWriter; |
| | | import org.geotools.data.Transaction; |
| | | import org.geotools.data.shapefile.ShapefileDataStore; |
| | | import org.geotools.data.shapefile.indexed.IndexType; |
| | | import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore; |
| | | import org.geotools.feature.Feature; |
| | | import org.geotools.feature.FeatureType; |
| | | import org.geotools.feature.IllegalAttributeException; |
| | | import org.geotools.feature.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeature; |
| | | import org.opengis.feature.simple.SimpleFeatureType; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.xml.sax.SAXException; |
| | | |
| | |
| | | |
| | | public void putFeatureCollection(Element element) { |
| | | assert elementDispatcher != null; |
| | | // §PÂ_¬O§_²Å©M±ø¥ó |
| | | Feature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | // �P�_�O�_�ũM��� |
| | | SimpleFeature feature = elementDispatcher.execute(element, isTransformed(), isEPSG3826()); |
| | | if (feature == null) { |
| | | boolean isEmptySize = false; |
| | | FrammeAttributeData linkage = |
| | |
| | | |
| | | try { |
| | | while (it.hasNext()) { |
| | | FeatureType featureType = (FeatureType) it.next(); |
| | | SimpleFeatureType featureType = (SimpleFeatureType) it.next(); |
| | | File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName()); |
| | | logger.debug("Begin Save shapefile:" + sfile.toURI()); |
| | | |
| | |
| | | true, Charset.forName("UTF-8")); |
| | | } else { |
| | | shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(), |
| | | null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8")); |
| | | null, true, true, IndexType.QIX, Charset.forName("UTF-8")); |
| | | } |
| | | |
| | | if (!existFile) { |
| | |
| | | ArrayList features = (ArrayList) featuresContext.get(featureType); |
| | | Iterator itFeature = features.iterator(); |
| | | while (itFeature.hasNext()) { |
| | | Feature feature = (Feature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null)); |
| | | SimpleFeature feature = (SimpleFeature) itFeature.next(); |
| | | ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes()); |
| | | } |
| | | //writer.close(); |
| | | logger.debug("End Save shapefile:" + sfile.toURI()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Ãö³¬³]³Æ¼g¤J¾¹ |
| | | * �����]�Ƽg�J�� |
| | | * |
| | | * @throws IOException IOµo¥Í¿ù»~ |
| | | * @throws IOException IO�o�Ϳ�~ |
| | | */ |
| | | public void closeFeatureWriter() throws IOException { |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * ¨ú±o¸ê®Æ¿é¥X¸ô®| |
| | | * ��o��ƿ�X���| |
| | | * |
| | | * @return ¸ô®|ªº¦r¦ê |
| | | * @return ���|���r�� |
| | | */ |
| | | public String getDataOutPath() { |
| | | if (dataOut == null) { |
| | |
| | | package com.ximple.eofms.util; |
| | | |
| | | import org.geotools.feature.AttributeTypeFactory; |
| | | import org.geotools.feature.FeatureTypeBuilder; |
| | | import com.vividsolutions.jts.geom.*; |
| | | import org.geotools.feature.AttributeTypeBuilder; |
| | | import org.geotools.feature.simple.SimpleFeatureTypeBuilder; |
| | | import org.opengis.feature.type.AttributeDescriptor; |
| | | import org.opengis.feature.type.AttributeType; |
| | | import org.opengis.feature.type.GeometryType; |
| | | |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | import com.vividsolutions.jts.geom.LineString; |
| | | import com.vividsolutions.jts.geom.MultiLineString; |
| | | import com.vividsolutions.jts.geom.MultiPoint; |
| | | import com.vividsolutions.jts.geom.Point; |
| | | import com.vividsolutions.jts.geom.Polygon; |
| | | import java.util.ArrayList; |
| | | |
| | | public final class FeatureTypeBuilderUtil { |
| | | protected static GeometryFactory _geomFactory = new GeometryFactory(); |
| | | private static boolean notAllowNull = false; |
| | | protected static final String DEFAULTNAMESPACE = "http://www.ximple.com.tw/tpc/"; |
| | | |
| | | public static boolean isNotAllowNull() { |
| | | return notAllowNull; |
| | |
| | | FeatureTypeBuilderUtil.notAllowNull = notAllowNull; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalPointFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, true)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("font", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("context", String.class, notAllowNull, 254, "")); |
| | | protected static AttributeType createAttributeType(String name, Class clazz, boolean isNillable) { |
| | | AttributeTypeBuilder attrBuilder = new AttributeTypeBuilder(); |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | return attrBuilder.buildType(); |
| | | } |
| | | |
| | | protected static GeometryType createGeometryType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | return attrBuilder.buildGeometryType(); |
| | | } |
| | | |
| | | protected static GeometryType createGeometryType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable, Object defaultValue) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | attrBuilder.setDefaultValue(defaultValue); |
| | | return attrBuilder.buildGeometryType(); |
| | | } |
| | | |
| | | protected static AttributeType createAttributeType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | return attrBuilder.buildType(); |
| | | } |
| | | |
| | | protected static AttributeType createAttributeType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable, Object defaultValue) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | attrBuilder.setDefaultValue(defaultValue); |
| | | return attrBuilder.buildType(); |
| | | } |
| | | |
| | | protected static AttributeType createAttributeType(AttributeTypeBuilder attrBuilder, |
| | | String name, Class clazz, boolean isNillable, int len, |
| | | Object defaultValue) { |
| | | attrBuilder.setName(name); |
| | | attrBuilder.setBinding(clazz); |
| | | attrBuilder.setNillable(isNillable); |
| | | attrBuilder.setLength(len); |
| | | attrBuilder.setDefaultValue(defaultValue); |
| | | return attrBuilder.buildType(); |
| | | } |
| | | |
| | | public static SimpleFeatureTypeBuilder createNormalPointFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | // typeBuilder.add("geom", Point.class, -1); |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, false))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("font", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "font", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "just", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "height", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "width", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("context", String.class, notAllowNull, 254, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "context", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 254, ""))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalLineFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", LineString.class, true)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | public static SimpleFeatureTypeBuilder createNormalLineFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", LineString.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "LineType", LineString.class, true))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalMultiLineFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiLineString.class, true)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | public static SimpleFeatureTypeBuilder createNormalMultiLineFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiLineString.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "MultiLineStringType", MultiLineString.class, true))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalPolygonFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, true)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | public static SimpleFeatureTypeBuilder createNormalPolygonFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, true))); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalArcFeatureTypeBuilder(String featureName) { |
| | | public static SimpleFeatureTypeBuilder createNormalArcFeatureTypeBuilder(String featureName) { |
| | | return createNormalLineFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalEllipseFeatureTypeBuilder(String featureName) { |
| | | public static SimpleFeatureTypeBuilder createNormalEllipseFeatureTypeBuilder(String featureName) { |
| | | return createNormalPolygonFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalIndexFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, true)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("x1", Double.class, notAllowNull, 1, 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("y1", Double.class, notAllowNull, 1, 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("x2", Double.class, notAllowNull, 1, 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("y2", Double.class, notAllowNull, 1, 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tpclid", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | public static SimpleFeatureTypeBuilder createNormalIndexFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, true))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("x1", Double.class, notAllowNull, 1, 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "x1", createAttributeType(attrBuilder, "DoubleType", Double.class, notAllowNull, 1, 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("y1", Double.class, notAllowNull, 1, 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "y1", createAttributeType(attrBuilder, "DoubleType", Double.class, notAllowNull, 1, 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("x2", Double.class, notAllowNull, 1, 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "x2", createAttributeType(attrBuilder, "DoubleType", Double.class, notAllowNull, 1, 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("y2", Double.class, notAllowNull, 1, 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "y2", createAttributeType(attrBuilder, "DoubleType", Double.class, notAllowNull, 1, 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tpclid", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tpclid", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createNormalIndexTextFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, true)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull, 1, (short) 0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tpclid", String.class, notAllowNull, 12, "")); |
| | | public static SimpleFeatureTypeBuilder createNormalIndexTextFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, true)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, true))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "just", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "height", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "width", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tpclid", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tpclid", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createPointFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("context", String.class, true, 254)); |
| | | public static SimpleFeatureTypeBuilder createPointFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "oid", createAttributeType(attrBuilder, "LongType", Long.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "cid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "lid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "level", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "just", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "height", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "width", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("context", String.class, true, 254)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "context", createAttributeType(attrBuilder, "StringType", String.class, true, 254))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createSymbolFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symbol", String.class, notAllowNull, 20)); |
| | | public static SimpleFeatureTypeBuilder createSymbolFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Point.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PointType", Point.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "oid", createAttributeType(attrBuilder, "LongType", Long.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "cid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "lid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "level", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "just", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "height", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "width", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symbol", String.class, notAllowNull, 20)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createPolygonFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull)); |
| | | public static SimpleFeatureTypeBuilder createPolygonFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", Polygon.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "PolygonType", Polygon.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "oid", createAttributeType(attrBuilder, "LongType", Long.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "cid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "lid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "level", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createLineFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", LineString.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull)); |
| | | public static SimpleFeatureTypeBuilder createLineFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", LineString.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "LineStringType", LineString.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "oid", createAttributeType(attrBuilder, "LongType", Long.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "cid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "lid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "level", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createMultiLineFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiLineString.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull)); |
| | | public static SimpleFeatureTypeBuilder createMultiLineFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiLineString.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "MultiLineStringType", MultiLineString.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "oid", createAttributeType(attrBuilder, "LongType", Long.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "cid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "lid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "level", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createEllipseFeatureTypeBuilder(String featureName) { |
| | | public static SimpleFeatureTypeBuilder createEllipseFeatureTypeBuilder(String featureName) { |
| | | return createPolygonFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createArcFeatureTypeBuilder(String featureName) { |
| | | public static SimpleFeatureTypeBuilder createArcFeatureTypeBuilder(String featureName) { |
| | | return createLineFeatureTypeBuilder(featureName); |
| | | /* |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | |
| | | */ |
| | | } |
| | | |
| | | public static FeatureTypeBuilder createMultiSymbolFeatureTypeBuilder(String featureName) { |
| | | FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiPoint.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull)); |
| | | typeBuilder.addType(AttributeTypeFactory.newAttributeType("symbol", String.class, notAllowNull, 20)); |
| | | public static SimpleFeatureTypeBuilder createMultiSymbolFeatureTypeBuilder(String featureName) { |
| | | SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder(); // .build(featureName); |
| | | typeBuilder.setName(featureName); |
| | | typeBuilder.setNamespaceURI(DEFAULTNAMESPACE); |
| | | |
| | | AttributeTypeBuilder attrBuilder; |
| | | ArrayList<AttributeDescriptor> attrDescs = new ArrayList<AttributeDescriptor>(); |
| | | |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("geom", MultiPoint.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "geom", createGeometryType(attrBuilder, "MultiPointType", MultiPoint.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("tid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "tid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("oid", Long.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "oid", createAttributeType(attrBuilder, "LongType", Long.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("cid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "cid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("lid", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "lid", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("level", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "level", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symcolor", String.class, notAllowNull, 12, "")); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symcolor", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 12, ""))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symweight", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symweight", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symstyle", Short.class, notAllowNull, 1, (short) 0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symstyle", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("just", Short.class, notAllowNull)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "just", createAttributeType(attrBuilder, "ShortType", Short.class, notAllowNull, 1, (short) 0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("height", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "height", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("width", Float.class, notAllowNull, 1, (float) 1.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "width", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 1.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("angle", Float.class, notAllowNull, 1, (float) 0.0)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); |
| | | // typeBuilder.addType(AttributeTypeFactory.newAttributeType("symbol", String.class, notAllowNull, 20)); |
| | | attrBuilder = new AttributeTypeBuilder(); |
| | | attrDescs.add(attrBuilder.buildDescriptor( |
| | | "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20))); |
| | | |
| | | typeBuilder.addAll(attrDescs); |
| | | return typeBuilder; |
| | | } |
| | | } |