From fe682356cf9d8afbc1bf93963a502592d8e9c50c Mon Sep 17 00:00:00 2001 From: ?? ? <ulysseskao@ximple.com.tw> Date: Thu, 08 Apr 2010 16:31:14 +0800 Subject: [PATCH] update geotools to 2.6.2 --- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatcher.java | 9 xdgnjobs/ximple-build/maven/jar-collector/pom.xml | 2 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java | 60 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java | 112 + xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java | 19 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java | 35 xdgnjobs/ximple-spatialjob/pom.xml | 28 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java | 109 + xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java | 22 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java | 197 +- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java | 50 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateComplexChainStrategy.java | 72 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java | 52 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java | 19 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java | 6 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java | 60 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java | 71 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java | 21 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractFLinkageDispatchableFilter.java | 4 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java | 19 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java | 19 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java | 70 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java | 64 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java | 64 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java | 755 +++++++++++-- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java | 6 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java | 26 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatchableFilter.java | 5 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java | 19 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java | 198 +- xdgnjobs/ximple-jobcarrier/pom.xml | 28 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java | 6 xdgnjobs/ximple-dgnio/pom.xml | 6 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java | 134 +- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java | 109 + xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractDispatchableFilter.java | 7 xdgnjobs/pom.xml | 230 +--- xdgnjobs/ximple-build/maven/pom.xml | 8 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementLevelCriterion.java | 4 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java | 24 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java | 142 +- xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java | 74 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java | 23 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java | 65 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java | 22 xdgnjobs/ximple-build/pom.xml | 4 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateFeatureTypeStrategy.java | 11 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/FeatureTypeEvent.java | 10 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java | 13 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java | 58 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java | 13 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementTypeCriterion.java | 4 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java | 19 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java | 6 xdgnjobs/ximple-elmparser/pom.xml | 30 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java | 15 56 files changed, 1,779 insertions(+), 1,479 deletions(-) diff --git a/xdgnjobs/pom.xml b/xdgnjobs/pom.xml index 6cb456d..4d3de58 100644 --- a/xdgnjobs/pom.xml +++ b/xdgnjobs/pom.xml @@ -18,8 +18,8 @@ <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> @@ -60,7 +60,7 @@ <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> @@ -71,7 +71,7 @@ <url>http://www.ximple.com.tw</url> </organization> - <inceptionYear>2008</inceptionYear> + <inceptionYear>2010</inceptionYear> <!-- =========================================================== --> <!-- Issue managements and mailing lists. --> @@ -112,19 +112,29 @@ <!-- 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 --> @@ -132,7 +142,7 @@ <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> - <version>1.7</version> + <version>1.8.2</version> </dependency> --> <dependency> @@ -143,12 +153,12 @@ <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> @@ -163,7 +173,7 @@ <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> - <version>1.1</version> + <version>1.2</version> </dependency> <dependency> <groupId>log4j</groupId> @@ -174,66 +184,61 @@ <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> @@ -246,13 +251,13 @@ <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> @@ -262,7 +267,7 @@ <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> @@ -283,27 +288,26 @@ <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> @@ -314,7 +318,7 @@ <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> - <version>5.8</version> + <version>5.11</version> <classifier>jdk15</classifier> <scope>test</scope> </dependency> @@ -325,15 +329,22 @@ <!-- Dependencies to be inherited by all modules. --> <!-- =========================================================== --> <dependencies> - <dependency> - <artifactId>geoapi-nogenerics</artifactId> - <groupId>org.opengis</groupId> - </dependency> - - <dependency> - <artifactId>jsr108</artifactId> - <groupId>javax.units</groupId> - </dependency> + <dependency> + <groupId>org.opengis</groupId> + <artifactId>geoapi</artifactId> + </dependency> + <dependency> + <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> <groupId>com.vividsolutions</groupId> @@ -367,12 +378,12 @@ </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> @@ -402,125 +413,13 @@ <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> @@ -528,7 +427,6 @@ <version>1.0-beta-2</version> </extension> </extensions> - --> <plugins> <!-- ======================================================= --> diff --git a/xdgnjobs/ximple-build/maven/jar-collector/pom.xml b/xdgnjobs/ximple-build/maven/jar-collector/pom.xml index 717c9b0..8c4ad5b 100644 --- a/xdgnjobs/ximple-build/maven/jar-collector/pom.xml +++ b/xdgnjobs/ximple-build/maven/jar-collector/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>com.ximple.eofms.maven</groupId> <artifactId>ximple-maven</artifactId> - <version>1.0.1</version> + <version>1.2.0</version> </parent> diff --git a/xdgnjobs/ximple-build/maven/pom.xml b/xdgnjobs/ximple-build/maven/pom.xml index 96a4daf..0d3dd22 100644 --- a/xdgnjobs/ximple-build/maven/pom.xml +++ b/xdgnjobs/ximple-build/maven/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>com.ximple.eofms.maven</groupId> <artifactId>ximple-build</artifactId> - <version>1.0.1</version> + <version>1.2.0</version> </parent> @@ -46,17 +46,17 @@ <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> diff --git a/xdgnjobs/ximple-build/pom.xml b/xdgnjobs/ximple-build/pom.xml index 6bfbd5d..e668448 100644 --- a/xdgnjobs/ximple-build/pom.xml +++ b/xdgnjobs/ximple-build/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>com.ximple.eofms</groupId> <artifactId>ximple-dgnjobs</artifactId> - <version>1.0.1</version> + <version>1.2.0</version> </parent> @@ -16,7 +16,7 @@ <!-- =========================================================== --> <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> diff --git a/xdgnjobs/ximple-dgnio/pom.xml b/xdgnjobs/ximple-dgnio/pom.xml index 3663acf..13c4f18 100644 --- a/xdgnjobs/ximple-dgnio/pom.xml +++ b/xdgnjobs/ximple-dgnio/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>com.ximple.eofms</groupId> <artifactId>ximple-dgnjobs</artifactId> - <version>1.0.1</version> + <version>1.2.0</version> </parent> <!-- =========================================================== --> @@ -15,7 +15,7 @@ <!-- =========================================================== --> <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> @@ -60,7 +60,7 @@ <dependencies> <dependency> <groupId>org.geotools</groupId> - <artifactId>gt2-sample-data</artifactId> + <artifactId>gt-sample-data</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/xdgnjobs/ximple-elmparser/pom.xml b/xdgnjobs/ximple-elmparser/pom.xml index 6ce9e0b..d9ce86a 100644 --- a/xdgnjobs/ximple-elmparser/pom.xml +++ b/xdgnjobs/ximple-elmparser/pom.xml @@ -5,18 +5,18 @@ <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> @@ -35,7 +35,7 @@ <url>http://www.ximple.com.tw</url> </organization> - <inceptionYear>2008</inceptionYear> + <inceptionYear>2010</inceptionYear> <developers> <developer> @@ -57,8 +57,8 @@ <!-- =========================================================== --> <dependencies> <dependency> + <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> - <groupId>opensymphony</groupId> </dependency> <dependency> @@ -69,50 +69,50 @@ <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> diff --git a/xdgnjobs/ximple-jobcarrier/pom.xml b/xdgnjobs/ximple-jobcarrier/pom.xml index db53177..1abbe63 100644 --- a/xdgnjobs/ximple-jobcarrier/pom.xml +++ b/xdgnjobs/ximple-jobcarrier/pom.xml @@ -6,19 +6,19 @@ <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> @@ -37,7 +37,7 @@ <url>http://www.ximple.com.tw</url> </organization> - <inceptionYear>2008</inceptionYear> + <inceptionYear>2010</inceptionYear> <developers> <developer> @@ -59,8 +59,8 @@ <!-- =========================================================== --> <dependencies> <dependency> + <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> - <groupId>opensymphony</groupId> </dependency> <dependency> @@ -71,44 +71,44 @@ <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> diff --git a/xdgnjobs/ximple-spatialjob/pom.xml b/xdgnjobs/ximple-spatialjob/pom.xml index 81152e8..44ebd85 100644 --- a/xdgnjobs/ximple-spatialjob/pom.xml +++ b/xdgnjobs/ximple-spatialjob/pom.xml @@ -7,18 +7,18 @@ <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> @@ -30,7 +30,7 @@ <url>http://www.ximple.com.tw</url> </organization> - <inceptionYear>2008</inceptionYear> + <inceptionYear>2010</inceptionYear> <developers> <developer> @@ -52,50 +52,50 @@ <!-- =========================================================== --> <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> diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractDispatchableFilter.java index 96b1323..35973ee 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractDispatchableFilter.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractDispatchableFilter.java @@ -1,12 +1,11 @@ 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractFLinkageDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractFLinkageDispatchableFilter.java index dc2f25c..3a67712 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractFLinkageDispatchableFilter.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/AbstractFLinkageDispatchableFilter.java @@ -1,11 +1,11 @@ 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()) diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java index 4e48219..ed4a509 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java @@ -1,34 +1,29 @@ 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() @@ -53,19 +48,22 @@ 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; @@ -82,7 +80,7 @@ gobj = lineStringElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -92,7 +90,7 @@ colorTable.getColorCode(lineStringElement.getColorIndex()), (short) lineStringElement.getWeight(), (short) lineStringElement.getLineStyle() - }); + }, null); } return feature; } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateComplexChainStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateComplexChainStrategy.java index 93504aa..ab67304 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateComplexChainStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateComplexChainStrategy.java @@ -1,38 +1,27 @@ 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() @@ -57,20 +46,21 @@ 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; @@ -90,7 +80,7 @@ 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(), @@ -100,7 +90,7 @@ colorTable.getColorCode(lineStringElement.getColorIndex()), (short) lineStringElement.getWeight(), (short) lineStringElement.getLineStyle() - }); + }, null); } else if (element instanceof ComplexChainElement) { ComplexChainElement complexChain = (ComplexChainElement) element; Geometry gobj; @@ -118,7 +108,7 @@ 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(), @@ -128,7 +118,7 @@ colorTable.getColorCode(complexChain.getColorIndex()), (short) complexChain.getWeight(), (short) complexChain.getLineStyle() - }); + }, null); } else if (element instanceof LineElement) { LineElement lineElement = (LineElement) element; Geometry gobj; @@ -147,7 +137,7 @@ 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(), @@ -157,7 +147,7 @@ colorTable.getColorCode(lineElement.getColorIndex()), (short) lineElement.getWeight(), (short) lineElement.getLineStyle() - }); + }, null); return feature; } else if (element instanceof ArcElement) { ArcElement arcElement = (ArcElement) element; @@ -177,7 +167,7 @@ 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(), @@ -187,7 +177,7 @@ colorTable.getColorCode(arcElement.getColorIndex()), (short) arcElement.getWeight(), (short) arcElement.getLineStyle() - }); + }, null); } return feature; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java index a0d7e1c..952d120 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java @@ -1,34 +1,29 @@ 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() @@ -53,19 +48,20 @@ 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; @@ -82,7 +78,7 @@ gobj = ellipseElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -92,7 +88,7 @@ colorTable.getColorCode(ellipseElement.getColorIndex()), (short) ellipseElement.getWeight(), (short) ellipseElement.getLineStyle() - }); + }, null); } return feature; } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateFeatureTypeStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateFeatureTypeStrategy.java index ac6e272..919bfa2 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateFeatureTypeStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateFeatureTypeStrategy.java @@ -1,16 +1,15 @@ 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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java index 7f766c4..62c52e1 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java @@ -1,39 +1,28 @@ 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() @@ -58,20 +47,21 @@ 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; @@ -88,7 +78,7 @@ gobj = lineStringElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -98,7 +88,7 @@ colorTable.getColorCode(lineStringElement.getColorIndex()), (short) lineStringElement.getWeight(), (short) lineStringElement.getLineStyle() - }); + }, null); } else if (element instanceof ComplexChainElement) { ComplexChainElement complexChain = (ComplexChainElement) element; Geometry gobj; @@ -123,7 +113,7 @@ 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(), @@ -133,7 +123,7 @@ colorTable.getColorCode(complexChain.getColorIndex()), (short) complexChain.getWeight(), (short) complexChain.getLineStyle() - }); + }, null); } else if (element instanceof LineElement) { LineElement lineElement = (LineElement) element; Geometry gobj; @@ -149,7 +139,7 @@ gobj = lineElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -159,7 +149,7 @@ colorTable.getColorCode(lineElement.getColorIndex()), (short) lineElement.getWeight(), (short) lineElement.getLineStyle() - }); + }, null); return feature; } else if (element instanceof ArcElement) { ArcElement arcElement = (ArcElement) element; @@ -176,7 +166,7 @@ gobj = arcElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -186,7 +176,7 @@ colorTable.getColorCode(arcElement.getColorIndex()), (short) arcElement.getWeight(), (short) arcElement.getLineStyle() - }); + }, null); } return feature; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java index b55d702..ed5f9bb 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java @@ -1,42 +1,25 @@ 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() @@ -61,20 +44,21 @@ 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; @@ -92,7 +76,7 @@ gobj = lineStringElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -102,7 +86,7 @@ colorTable.getColorCode(lineStringElement.getColorIndex()), (short) lineStringElement.getWeight(), (short) lineStringElement.getLineStyle() - }); + }, null); } else if (element instanceof TextElement) { TextElement txtElement = (TextElement) element; Coordinate ptOrigin = txtElement.getUserOrigin(); @@ -128,7 +112,7 @@ txtElement.getRotationAngle(); - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ line, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -138,7 +122,7 @@ colorTable.getColorCode(txtElement.getColorIndex()), (short) txtElement.getWeight(), (short) txtElement.getLineStyle() - }); + }, null); } else if (element instanceof ComplexChainElement) { ComplexChainElement complexChain = (ComplexChainElement) element; Geometry gobj; @@ -165,7 +149,7 @@ 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(), @@ -175,7 +159,7 @@ colorTable.getColorCode(complexChain.getColorIndex()), (short) complexChain.getWeight(), (short) complexChain.getLineStyle() - }); + }, null); } else if (element instanceof LineElement) { LineElement lineElement = (LineElement) element; Geometry gobj; @@ -190,7 +174,7 @@ } else { gobj = lineElement.toGeometry(geometryFactory); } - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -200,7 +184,7 @@ colorTable.getColorCode(lineElement.getColorIndex()), (short) lineElement.getWeight(), (short) lineElement.getLineStyle() - }); + }, null); } return feature; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java index f6ac9f7..0dc2aa4 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java @@ -1,40 +1,32 @@ 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() @@ -59,20 +51,21 @@ 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; @@ -104,7 +97,7 @@ gobj = txtElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -119,7 +112,7 @@ (float) txtElement.getTextWidth(), (float) angle, sb.toString() - }); + }, null); } else if (element instanceof TextNodeElement) { TextNodeElement nodeElement = (TextNodeElement) element; @@ -172,7 +165,7 @@ } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -187,7 +180,7 @@ (float) txtChildElement.getTextWidth(), (float) angle, sb.toString() - }); + }, null); } } } else { diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java index af11693..9ede6b2 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java @@ -1,35 +1,26 @@ 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() @@ -54,20 +45,21 @@ 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; @@ -85,7 +77,7 @@ } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -95,7 +87,7 @@ colorTable.getColorCode(shapeElement.getColorIndex()), (short) shapeElement.getWeight(), (short) shapeElement.getLineStyle() - }); + }, null); } else if (element instanceof ComplexShapeElement) { ComplexShapeElement complexShape = (ComplexShapeElement) element; Geometry gobj; @@ -111,7 +103,7 @@ gobj = complexShape.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -121,7 +113,7 @@ colorTable.getColorCode(complexShape.getColorIndex()), (short) complexShape.getWeight(), (short) complexShape.getLineStyle() - }); + }, null); } return feature; } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java index 001a4e3..cef2be2 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java @@ -1,36 +1,31 @@ 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() @@ -55,20 +50,21 @@ 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; @@ -99,7 +95,7 @@ gobj = txtElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -114,7 +110,7 @@ (float) txtElement.getTextWidth(), (float) angle, sb.toString() - }); + }, null); } else { logger.info("CreateSymbolStrategy cannot conver " + element.toString() + "to Feature"); } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java index 96d5ff0..0ea56d1 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java @@ -1,37 +1,28 @@ 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() @@ -56,20 +47,21 @@ 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; @@ -90,7 +82,7 @@ gobj = txtElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -105,7 +97,7 @@ (float) txtElement.getTextWidth(), (float) angle, content - }); + }, null); } else if (element instanceof TextNodeElement) { TextNodeElement nodeElement = (TextNodeElement) element; String[] texts = nodeElement.getTextArray(); @@ -132,7 +124,7 @@ gobj = nodeElement.toGeometry(geometryFactory); } if (gobj != null) - feature = featureType.create(new Object[]{ + feature = SimpleFeatureBuilder.build(featureType, new Object[]{ gobj, fLinkage.getFsc(), (long) fLinkage.getUfid(), @@ -147,7 +139,7 @@ (float) nodeElement.getTextNodeLength(), (float) angle, sb.toString() - }); + }, null); } return feature; } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatchableFilter.java index 9ee36e0..505616d 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatchableFilter.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatchableFilter.java @@ -1,13 +1,12 @@ 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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatcher.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatcher.java index 0ed3429..abebbfa 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatcher.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementDispatcher.java @@ -1,11 +1,10 @@ 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; @@ -41,7 +40,7 @@ } } - 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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementLevelCriterion.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementLevelCriterion.java index ab7fa89..bca9f31 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementLevelCriterion.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementLevelCriterion.java @@ -1,9 +1,9 @@ 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementTypeCriterion.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementTypeCriterion.java index 84e8aae..2fe04d3 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementTypeCriterion.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/ElementTypeCriterion.java @@ -1,9 +1,9 @@ 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/FeatureTypeEvent.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/FeatureTypeEvent.java index 80c1e29..ebede68 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/FeatureTypeEvent.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/FeatureTypeEvent.java @@ -1,11 +1,11 @@ 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. @@ -14,12 +14,12 @@ * @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; } } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java index 6b03173..16298cf 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java @@ -1,13 +1,12 @@ 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 { @@ -68,7 +67,7 @@ this.useLongName = useLongName; } - //�P�_�O�_�ũM���� + //�P�_�O�_�ũM��� public boolean isDispatchable(Element element) { FrammeAttributeData featureLinkage = getFeatureLinkage(element); return featureLinkage != null && tid == featureLinkage.getFsc() && @@ -76,10 +75,10 @@ (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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java index 1dd6d82..dde0428 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java @@ -1,13 +1,12 @@ 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 { @@ -86,10 +85,10 @@ (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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java index 1dc090d..d83ffc8 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java @@ -1,13 +1,12 @@ 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; @@ -54,10 +53,10 @@ (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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java index 57483a2..b144586 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java @@ -21,12 +21,12 @@ 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; @@ -51,7 +51,7 @@ 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; @@ -109,8 +109,7 @@ 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); @@ -171,7 +170,7 @@ 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()); @@ -186,24 +185,24 @@ */ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java index 75d382a..1ba6901 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java @@ -7,9 +7,9 @@ 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; @@ -40,9 +40,9 @@ } - 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java index 13b6fea..bc7f721 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java @@ -7,9 +7,9 @@ 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; @@ -44,9 +44,9 @@ 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java index 8782dec..3842334 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java @@ -20,11 +20,10 @@ 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; @@ -48,7 +47,7 @@ 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; @@ -107,14 +106,13 @@ 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); + AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Unknown Element:" + element.getElementType().toString() + - ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + - (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID()))); + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + + (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size()); @@ -169,7 +167,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -185,11 +183,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java index e6b6271..35eff29 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java @@ -20,11 +20,10 @@ 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; @@ -41,7 +40,7 @@ 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; @@ -100,8 +99,8 @@ 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); @@ -152,7 +151,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -170,11 +169,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java index 7aa074e..2db1e83 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java @@ -18,12 +18,8 @@ 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; @@ -44,6 +40,10 @@ 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); @@ -52,12 +52,11 @@ 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; @@ -74,9 +73,9 @@ } 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() + "'" + @@ -98,9 +97,9 @@ } 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()); @@ -136,7 +135,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save into OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -154,11 +153,11 @@ 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()); @@ -184,39 +183,43 @@ 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; @@ -227,7 +230,7 @@ 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(), @@ -236,7 +239,7 @@ textElement.getTextWidth(), angle, content - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -257,7 +260,7 @@ } if (geom != null) { - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, colorTable.getColorCode(textNodeElement.getColorIndex()), textNodeElement.getFontIndex(), @@ -266,7 +269,7 @@ textNodeElement.getTextNodeLength(), angle, sb.toString() - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -276,12 +279,12 @@ 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()); } @@ -291,24 +294,24 @@ 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; @@ -320,36 +323,36 @@ 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; @@ -367,7 +370,7 @@ 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"; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java index 4dda621..6a952c0 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java @@ -17,12 +17,8 @@ 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; @@ -40,6 +36,10 @@ 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); @@ -48,15 +48,15 @@ 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) { @@ -74,7 +74,7 @@ return; } - Feature feature = createFeature((TextElement) element); + SimpleFeature feature = createFeature((TextElement) element); if (feature == null) { logger.info("cannot craete feature." + element.toString() + "'" + ((TextElement) element).getText() + "'"); @@ -130,7 +130,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -146,9 +146,9 @@ 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()); @@ -174,21 +174,21 @@ 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; @@ -213,7 +213,7 @@ TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), })); - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, extent.getMinX(), extent.getMinY(), @@ -223,19 +223,19 @@ 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(), @@ -245,18 +245,18 @@ 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); @@ -293,7 +293,7 @@ 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(), @@ -303,7 +303,7 @@ colorTable.getColorCode(textElement.getColorIndex()), textElement.getWeight(), textElement.getLineStyle() - }); + }, null); } return result; @@ -311,7 +311,7 @@ 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("."); @@ -323,7 +323,7 @@ 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("."); @@ -336,7 +336,7 @@ 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("."); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java index 715ba40..ca621e3 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java @@ -22,10 +22,9 @@ 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; @@ -113,8 +112,8 @@ 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 = @@ -176,7 +175,7 @@ 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()); @@ -200,8 +199,8 @@ 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()); @@ -226,9 +225,9 @@ } /** - * �����]�Ƽg�J�� + * �����]�Ƽg�J�� * - * @throws IOException IO�o�Ϳ��~ + * @throws IOException IO�o�Ϳ�~ */ public void closeFeatureWriter() throws IOException { diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java index 3bd4e0d..a7ee988 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java @@ -7,9 +7,9 @@ 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; @@ -40,9 +40,9 @@ } - 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java index e8c4b5e..e4fbddb 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java @@ -7,9 +7,9 @@ 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; @@ -46,9 +46,9 @@ } - 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; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java index fab0c6b..0889606 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java @@ -20,11 +20,10 @@ 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; @@ -48,7 +47,7 @@ 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; @@ -107,8 +106,8 @@ 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); @@ -169,7 +168,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -185,11 +184,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java index feef1a4..97a2959 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java @@ -20,11 +20,10 @@ 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; @@ -41,7 +40,7 @@ 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; @@ -100,8 +99,8 @@ 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); @@ -152,7 +151,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -170,11 +169,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java index 7793db1..0ca77c6 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java @@ -18,12 +18,8 @@ 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; @@ -44,6 +40,10 @@ 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); @@ -52,12 +52,11 @@ 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; @@ -74,9 +73,9 @@ } 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() + "'" + @@ -98,9 +97,9 @@ } 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()); @@ -136,7 +135,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save into OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -154,11 +153,11 @@ 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()); @@ -184,39 +183,43 @@ 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; @@ -227,7 +230,7 @@ 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(), @@ -236,7 +239,7 @@ textElement.getTextWidth(), angle, content - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -257,7 +260,7 @@ } if (geom != null) { - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, colorTable.getColorCode(textNodeElement.getColorIndex()), textNodeElement.getFontIndex(), @@ -266,7 +269,7 @@ textNodeElement.getTextNodeLength(), angle, sb.toString() - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -276,12 +279,12 @@ 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()); } @@ -291,24 +294,24 @@ 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; @@ -320,36 +323,36 @@ 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; @@ -367,7 +370,7 @@ 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"; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java index 00f9e04..b7f682e 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java @@ -17,12 +17,8 @@ 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; @@ -40,6 +36,10 @@ 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); @@ -48,15 +48,15 @@ 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) { @@ -74,7 +74,7 @@ return; } - Feature feature = createFeature((TextElement) element); + SimpleFeature feature = createFeature((TextElement) element); if (feature == null) { logger.info("cannot craete feature." + element.toString() + "'" + ((TextElement) element).getText() + "'"); @@ -130,7 +130,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save OracleSDO:" + featureType.getTypeName()); FeatureWriter writer; @@ -146,9 +146,9 @@ 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()); @@ -174,21 +174,21 @@ 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; @@ -213,7 +213,7 @@ TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), })); - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, extent.getMinX(), extent.getMinY(), @@ -223,19 +223,19 @@ 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(), @@ -245,18 +245,18 @@ 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); @@ -293,7 +293,7 @@ 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(), @@ -303,7 +303,7 @@ colorTable.getColorCode(textElement.getColorIndex()), textElement.getWeight(), textElement.getLineStyle() - }); + }, null); } return result; @@ -311,7 +311,7 @@ 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("."); @@ -323,7 +323,7 @@ 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("."); @@ -336,7 +336,7 @@ 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("."); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java index 5d7bc09..ed8784f 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java @@ -22,10 +22,9 @@ 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; @@ -113,8 +112,8 @@ 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 = @@ -176,7 +175,7 @@ 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()); @@ -199,8 +198,8 @@ 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()); @@ -226,9 +225,9 @@ } /** - * �����]�Ƽg�J�� + * �����]�Ƽg�J�� * - * @throws IOException IO�o�Ϳ��~ + * @throws IOException IO�o�Ϳ�~ */ public void closeFeatureWriter() throws IOException { diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java index c14a3e8..4083c67 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java @@ -8,10 +8,7 @@ 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; @@ -19,13 +16,14 @@ 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; @@ -166,9 +164,9 @@ // 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; @@ -234,12 +232,12 @@ 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('"); @@ -247,7 +245,7 @@ sql.append("','"); sql.append(tableName); sql.append("','"); - sql.append(geometryAttribute.getLocalName()); + sql.append(geometryDescriptor.getLocalName()); sql.append("','"); sql.append(srid); sql.append("','"); @@ -258,24 +256,24 @@ 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); } @@ -288,23 +286,23 @@ 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); @@ -314,11 +312,11 @@ 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(); @@ -392,40 +390,42 @@ } - 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(); - if (f != null && f != Filter.EXCLUDE && f != Filter.INCLUDE && - (f instanceof PropertyIsLessThan || f instanceof PropertyIsLessThanOrEqualTo)) { - try { - BinaryComparisonOperator cf = (BinaryComparisonOperator) f; - if (cf.getExpression1() instanceof LengthFunction) { - length = Integer.parseInt(((Literal) cf.getExpression2()).getValue().toString()); - } else { - if (cf.getExpression2() instanceof LengthFunction) { - length = Integer.parseInt(((Literal) cf.getExpression1()).getValue().toString()); + 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 { + BinaryComparisonOperator cf = (BinaryComparisonOperator) f; + if (cf.getExpression1() instanceof LengthFunction) { + length = Integer.parseInt(((Literal) cf.getExpression2()).getValue().toString()); + } else { + if (cf.getExpression2() instanceof LengthFunction) { + length = Integer.parseInt(((Literal) cf.getExpression1()).getValue().toString()); + } } + } catch (NumberFormatException e) { + length = 256; } - } catch (NumberFormatException e) { + } else { length = 256; } - } else { - length = 256; + break; } - if (length < 1) { getLogger().warn("FeatureType did not specify string length; defaulted to 256"); length = 256; @@ -435,26 +435,26 @@ 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)); } @@ -496,12 +496,12 @@ 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; @@ -509,7 +509,7 @@ // 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) { @@ -521,15 +521,15 @@ 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"; @@ -537,8 +537,8 @@ attrValue = getGeometryInsertText(geometry, srid); } } else { - if (attributes[i] != null) { - attrValue = addQuotes(attributes[i]); + if (attributes.get(i) != null) { + attrValue = addQuotes(attributes.get(i)); } } @@ -552,9 +552,9 @@ 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; @@ -562,8 +562,8 @@ // 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(","); @@ -572,7 +572,7 @@ statementSQL.setCharAt(statementSQL.length() - 1, ')'); statementSQL.append(" VALUES ("); - for (AttributeType attributeType : attributeTypes) { + for (AttributeDescriptor attributeType : attributeTypes) { statementSQL.append(" ? ,"); } @@ -618,40 +618,40 @@ 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); } } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java index 01fafe0..5c9eb8e 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java @@ -8,22 +8,20 @@ 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; @@ -163,9 +161,9 @@ 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; @@ -229,12 +227,12 @@ 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('"); @@ -242,7 +240,7 @@ sql.append("','"); sql.append(tableName); sql.append("','"); - sql.append(geometryAttribute.getLocalName()); + sql.append(geometryDescriptor.getLocalName()); sql.append("','"); sql.append(srid); sql.append("','"); @@ -253,23 +251,23 @@ 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); @@ -292,17 +290,17 @@ 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); @@ -311,11 +309,11 @@ 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(); @@ -414,38 +412,41 @@ } - 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(); - if (f != null && f != Filter.EXCLUDE && f != Filter.INCLUDE && - (f instanceof PropertyIsLessThan || f instanceof PropertyIsLessThanOrEqualTo)) { - try { - BinaryComparisonOperator cf = (BinaryComparisonOperator) f; - if (cf.getExpression1() instanceof LengthFunction) { - length = Integer.parseInt(((Literal) cf.getExpression2()).getValue().toString()); - } else { - if (cf.getExpression2() instanceof LengthFunction) { - length = Integer.parseInt(((Literal) cf.getExpression1()).getValue().toString()); + 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 { + BinaryComparisonOperator cf = (BinaryComparisonOperator) f; + if (cf.getExpression1() instanceof LengthFunction) { + length = Integer.parseInt(((Literal) cf.getExpression2()).getValue().toString()); + } else { + if (cf.getExpression2() instanceof LengthFunction) { + length = Integer.parseInt(((Literal) cf.getExpression1()).getValue().toString()); + } } + } catch (NumberFormatException e) { + length = 512; } - } catch (NumberFormatException e) { + } else { length = 512; } - } else { - length = 512; + break; } if (length < 1) { @@ -457,26 +458,26 @@ 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)); } @@ -518,12 +519,12 @@ 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; @@ -532,8 +533,8 @@ // 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); @@ -544,15 +545,15 @@ 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"; @@ -560,8 +561,8 @@ attrValue = getGeometryInsertText(geometry, srid); } } else { - if (attributes[i] != null) { - attrValue = addQuotes(attributes[i]); + if (attributes.get(i) != null) { + attrValue = addQuotes(attributes.get(i)); } } @@ -575,9 +576,9 @@ 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; @@ -585,8 +586,8 @@ // 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(","); @@ -595,7 +596,7 @@ statementSQL.setCharAt(statementSQL.length() - 1, ')'); statementSQL.append(" VALUES ("); - for (AttributeType attributeType : attributeTypes) { + for (AttributeDescriptor descriptor : descriptors) { statementSQL.append(" ? ,"); } @@ -641,40 +642,40 @@ 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); } } diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java index 4a10002..fe43e2e 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java @@ -20,11 +20,10 @@ 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; @@ -47,7 +46,7 @@ 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; @@ -107,8 +106,8 @@ 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); @@ -168,7 +167,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save PostGIS:" + featureType.getTypeName()); FeatureWriter writer; @@ -184,11 +183,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java index 0469578..57cba8d 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java @@ -20,11 +20,10 @@ 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; @@ -41,7 +40,7 @@ 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; @@ -101,8 +100,8 @@ 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); @@ -120,7 +119,7 @@ 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); } @@ -152,7 +151,7 @@ try { while (it.hasNext()) { - FeatureType featureType = (FeatureType) it.next(); + SimpleFeatureType featureType = (SimpleFeatureType) it.next(); logger.debug("Begin Save PostGIS:" + featureType.getTypeName()); FeatureWriter writer; @@ -170,11 +169,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java index 46439f0..6bda3cd 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java @@ -20,11 +20,12 @@ 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; @@ -52,10 +53,9 @@ 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; @@ -73,10 +73,10 @@ } 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) { @@ -109,10 +109,10 @@ } 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++; } @@ -148,7 +148,7 @@ private void updateDataStore() { if (isProfileMode()) markUpdateTime(); - Iterator<FeatureType> it = txFeaturesContext.keySet().iterator(); + Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); Connection conn = null; try { conn = getConnection(); @@ -156,14 +156,14 @@ 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 { @@ -214,61 +214,67 @@ */ } - 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; @@ -280,7 +286,7 @@ 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(), @@ -289,7 +295,7 @@ textElement.getTextWidth(), angle, content - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -311,7 +317,7 @@ } if (geom != null) { - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, colorTable.getColorCode(textNodeElement.getColorIndex()), textNodeElement.getFontIndex(), @@ -320,7 +326,7 @@ textNodeElement.getTextNodeLength(), angle, sb.toString() - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -330,12 +336,12 @@ 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()); } @@ -345,24 +351,24 @@ 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; @@ -374,36 +380,36 @@ 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; @@ -421,7 +427,7 @@ 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"; @@ -511,20 +517,20 @@ 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); @@ -546,7 +552,7 @@ } 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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java index 8fd8f32..941a434 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java @@ -20,11 +20,12 @@ 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; @@ -52,15 +53,16 @@ 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; @@ -90,7 +92,7 @@ } 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() + "'"); @@ -98,9 +100,9 @@ } 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); @@ -111,19 +113,19 @@ } 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)); @@ -136,7 +138,7 @@ } 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) { @@ -152,9 +154,9 @@ } 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); @@ -173,12 +175,12 @@ } 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) { @@ -193,7 +195,7 @@ 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)); @@ -226,7 +228,7 @@ private void updateDataStore() { if (isProfileMode()) markUpdateTime(); - Iterator<FeatureType> it = txFeaturesContext.keySet().iterator(); + Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); Connection conn = null; try { conn = getConnection(); @@ -234,14 +236,14 @@ 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 { @@ -307,17 +309,17 @@ */ } - 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); } @@ -327,7 +329,7 @@ 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); @@ -348,7 +350,7 @@ try { conn = getConnection(); ArrayList<String> schemaTexts = createNewSchemaTexts(conn, - typeBuilderRect.getFeatureType()); + typeBuilderRect.buildFeatureType()); for (String stmtText : schemaTexts) { Statement stmt = conn.createStatement(); stmt.execute(stmtText); @@ -364,23 +366,23 @@ } } } - 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); @@ -401,7 +403,7 @@ try { conn = getConnection(); ArrayList<String> schemaTexts = createNewSchemaTexts(conn, - typeBuilderPnt.getFeatureType()); + typeBuilderPnt.buildFeatureType()); for (String stmtText : schemaTexts) { Statement stmt = conn.createStatement(); stmt.execute(stmtText); @@ -417,20 +419,20 @@ } } } - 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); } @@ -439,7 +441,7 @@ } 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); @@ -460,7 +462,7 @@ try { conn = getConnection(); ArrayList<String> schemaTexts = createNewSchemaTexts(conn, - typeBuilderSmallRect.getFeatureType()); + typeBuilderSmallRect.buildFeatureType()); for (String stmtText : schemaTexts) { Statement stmt = conn.createStatement(); stmt.execute(stmtText); @@ -476,10 +478,10 @@ } } } - 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; @@ -511,7 +513,7 @@ 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(), @@ -521,7 +523,7 @@ colorTable.getColorCode(textElement.getColorIndex()), textElement.getWeight(), textElement.getLineStyle() - }); + }, null); } else if (element instanceof ShapeElement) { ShapeElement shapeElement = (ShapeElement) element; Geometry geomShape = shapeElement.toGeometry(geometryFactory); @@ -565,7 +567,7 @@ } return (geom == null ? null : - featureType.create(new Object[]{ + SimpleFeatureBuilder.build(featureType, new Object[]{ geom, extent.getMinX(), extent.getMinY(), @@ -575,24 +577,24 @@ 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(), @@ -602,10 +604,10 @@ 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); @@ -623,7 +625,7 @@ 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(), @@ -633,7 +635,7 @@ 15 * 5, angle, tpclid - }); + }, null); return feature; } @@ -643,12 +645,12 @@ 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); @@ -690,7 +692,7 @@ } Envelope innerExtent = geom.getEnvelopeInternal(); - result[i] = featureType.create(new Object[]{ + result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ geom, innerExtent.getMinX(), innerExtent.getMinY(), @@ -700,7 +702,7 @@ colorTable.getColorCode(textElement.getColorIndex()), textElement.getWeight(), textElement.getLineStyle() - }); + }, null); } return result; @@ -711,7 +713,7 @@ 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) { @@ -752,7 +754,7 @@ Envelope innerExtent = geom.getEnvelopeInternal(); - result[i] = featureType.create(new Object[]{ + result[i] = SimpleFeatureBuilder.build(featureType, new Object[]{ geom, innerExtent.getMinX(), innerExtent.getMinY(), @@ -762,7 +764,7 @@ colorTable.getColorCode(shapeElement.getColorIndex()), shapeElement.getWeight(), shapeElement.getLineStyle() - }); + }, null); } return result; @@ -773,7 +775,7 @@ 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("."); @@ -785,7 +787,7 @@ 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("."); @@ -798,7 +800,7 @@ 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("."); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java index 57e9a6a..c48fd45 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java @@ -15,6 +15,7 @@ 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; @@ -25,9 +26,9 @@ 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; @@ -64,7 +65,7 @@ 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; @@ -118,8 +119,8 @@ 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 = @@ -142,7 +143,7 @@ return; } - if (feature.getDefaultGeometry().isEmpty()) { + if (((Geometry)feature.getDefaultGeometry()).isEmpty()) { boolean isEmptySize = false; FrammeAttributeData linkage = AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); @@ -165,9 +166,9 @@ } 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) { @@ -203,7 +204,7 @@ private void updateDataStore() { if (isProfileMode()) markUpdateTime(); - Iterator<FeatureType> it = txFeaturesContext.keySet().iterator(); + Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); Connection conn = null; try { conn = getConnection(); @@ -211,15 +212,15 @@ 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); @@ -235,7 +236,7 @@ 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())); } @@ -278,9 +279,9 @@ } /** - * �����]�Ƽg�J�� + * �����]�Ƽg�J�� * - * @throws IOException IO�o�Ϳ��~ + * @throws IOException IO�o�Ϳ�~ */ public void closeFeatureWriter() throws IOException { } @@ -322,7 +323,7 @@ } } - protected void createOrClearFeatureDataTable(FeatureType featureType) throws SchemaException { + protected void createOrClearFeatureDataTable(SimpleFeatureType featureType) throws SchemaException { String featureName = featureType.getTypeName(); Connection conn = null; if (isExistFeature(featureType)) { @@ -330,7 +331,7 @@ 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); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java index c17a3ee..f85c088 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java @@ -21,12 +21,12 @@ 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; @@ -50,7 +50,7 @@ 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; @@ -109,8 +109,8 @@ 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); @@ -171,7 +171,7 @@ 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()); @@ -187,7 +187,7 @@ 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) { @@ -201,11 +201,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java index 64d7ee7..c5818b8 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java @@ -21,12 +21,12 @@ 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; @@ -46,7 +46,7 @@ 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; @@ -105,8 +105,8 @@ 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); @@ -157,7 +157,7 @@ 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()); @@ -173,7 +173,7 @@ 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) { @@ -187,11 +187,11 @@ 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()); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java index aa3f9f0..23a190f 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java @@ -20,13 +20,10 @@ 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; @@ -47,6 +44,10 @@ 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); @@ -56,12 +57,11 @@ 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; @@ -78,9 +78,9 @@ } 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() + "'" + @@ -102,9 +102,9 @@ } 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()); @@ -140,7 +140,7 @@ 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()); @@ -156,7 +156,7 @@ 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) { @@ -170,11 +170,11 @@ 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()); @@ -213,39 +213,43 @@ 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; @@ -256,7 +260,7 @@ 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(), @@ -265,7 +269,7 @@ textElement.getTextWidth(), angle, content - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -286,7 +290,7 @@ } if (geom != null) { - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, colorTable.getColorCode(textNodeElement.getColorIndex()), textNodeElement.getFontIndex(), @@ -295,7 +299,7 @@ textNodeElement.getTextNodeLength(), angle, sb.toString() - }); + }, null); } else { logger.info("geometry is null." + element.toString()); } @@ -305,12 +309,12 @@ 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()); } @@ -320,24 +324,24 @@ 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; @@ -349,36 +353,36 @@ 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; @@ -396,7 +400,7 @@ 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"; diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java index ba84b6a..09ea970 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java @@ -20,13 +20,10 @@ 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; @@ -44,6 +41,10 @@ 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); @@ -55,15 +56,15 @@ 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; @@ -83,7 +84,7 @@ return; } - Feature feature = createFeature((TextElement) element); + SimpleFeature feature = createFeature((TextElement) element); if (feature == null) { logger.info("cannot craete feature." + element.toString() + "'" + ((TextElement) element).getText() + "'"); @@ -109,14 +110,14 @@ 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)); @@ -153,7 +154,7 @@ 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()); @@ -166,15 +167,15 @@ 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()); @@ -213,21 +214,21 @@ 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; @@ -254,7 +255,7 @@ TWDDatumConverter.fromTM2ToEPSG3825(new Coordinate(extent.getMinX(), extent.getMinY())), }); } - return featureType.create(new Object[]{ + return SimpleFeatureBuilder.build(featureType, new Object[]{ geom, extent.getMinX(), extent.getMinY(), @@ -264,19 +265,19 @@ 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(), @@ -286,18 +287,18 @@ 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); @@ -336,7 +337,7 @@ 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(), @@ -346,7 +347,7 @@ colorTable.getColorCode(textElement.getColorIndex()), textElement.getWeight(), textElement.getLineStyle() - }); + }, null); } return result; @@ -354,7 +355,7 @@ 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("."); @@ -366,7 +367,7 @@ 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("."); @@ -379,7 +380,7 @@ 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("."); diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java index 52773bc..e9aeee9 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java @@ -23,11 +23,11 @@ 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; @@ -123,8 +123,8 @@ 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 = @@ -186,7 +186,7 @@ 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()); @@ -202,7 +202,7 @@ 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) { @@ -219,8 +219,8 @@ 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()); @@ -247,9 +247,9 @@ } /** - * �����]�Ƽg�J�� + * �����]�Ƽg�J�� * - * @throws IOException IO�o�Ϳ��~ + * @throws IOException IO�o�Ϳ�~ */ public void closeFeatureWriter() throws IOException { @@ -261,9 +261,9 @@ } /** - * ���o��ƿ�X���| + * ��o��ƿ�X���| * - * @return ���|���r�� + * @return ���|���r�� */ public String getDataOutPath() { if (dataOut == null) { diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java index 59c05a7..f00e631 100644 --- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java +++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java @@ -1,18 +1,18 @@ 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; @@ -22,47 +22,190 @@ 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); @@ -74,7 +217,7 @@ */ } - public static FeatureTypeBuilder createNormalEllipseFeatureTypeBuilder(String featureName) { + public static SimpleFeatureTypeBuilder createNormalEllipseFeatureTypeBuilder(String featureName) { return createNormalPolygonFeatureTypeBuilder(featureName); /* FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); @@ -86,116 +229,390 @@ */ } - 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); @@ -212,7 +629,7 @@ */ } - public static FeatureTypeBuilder createArcFeatureTypeBuilder(String featureName) { + public static SimpleFeatureTypeBuilder createArcFeatureTypeBuilder(String featureName) { return createLineFeatureTypeBuilder(featureName); /* FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(featureName); @@ -229,22 +646,72 @@ */ } - 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; } } -- Gitblit v0.0.0-SNAPSHOT