Revision 2716
org.gvsig.raster.wms/tags/v2.2.1/prepare-workspace.xml | ||
---|---|---|
1 |
<project name="org.gvsig.initial.build" default="prepare-workspace"> |
|
2 |
|
|
3 |
<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" /> |
|
4 |
|
|
5 |
<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." /> |
|
6 |
<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" /> |
|
7 |
<property name="build.jar.version" value="1.0.8-SNAPSHOT" /> |
|
8 |
<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" /> |
|
9 |
|
|
10 |
<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" /> |
|
11 |
|
|
12 |
<target name="check-maven-base-build-available"> |
|
13 |
<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" /> |
|
14 |
</target> |
|
15 |
|
|
16 |
<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available"> |
|
17 |
<!-- Unzip de build jar file from the maven repository into the workspace root folder --> |
|
18 |
<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false"> |
|
19 |
<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}"> |
|
20 |
<patternset> |
|
21 |
<exclude name="META-INF/**" /> |
|
22 |
</patternset> |
|
23 |
</zipfileset> |
|
24 |
</copy> |
|
25 |
</target> |
|
26 |
|
|
27 |
<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available"> |
|
28 |
<mkdir dir="target" /> |
|
29 |
|
|
30 |
<!-- Download the build jar file --> |
|
31 |
<get src="http://devel.gvsig.org/m2repo/j2se/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" /> |
|
32 |
|
|
33 |
<!-- Unzip de build jar file into the workspace root folder --> |
|
34 |
<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false"> |
|
35 |
<zipfileset src="target/${build.jar.file}"> |
|
36 |
<patternset> |
|
37 |
<exclude name="META-INF/**" /> |
|
38 |
</patternset> |
|
39 |
</zipfileset> |
|
40 |
</copy> |
|
41 |
|
|
42 |
</target> |
|
43 |
|
|
44 |
<target name="find.depends.natives.file"> |
|
45 |
<condition property="depends.natives.file.exists"> |
|
46 |
<available file="${org.gvsig.initial.build.basedir}/DEPENDS_ON_NATIVE_LIBRARIES"/> |
|
47 |
</condition> |
|
48 |
</target> |
|
49 |
|
|
50 |
<target name="find.gvsig.platform.properties.file" |
|
51 |
depends="find.depends.natives.file" |
|
52 |
if="depends.natives.file.exists"> |
|
53 |
<condition property="gvsig.platform.exists"> |
|
54 |
<available file="${user.home}/.gvsig.platform.properties"/> |
|
55 |
</condition> |
|
56 |
</target> |
|
57 |
|
|
58 |
<target name="check.gvsig.platform.properties" |
|
59 |
depends="find.gvsig.platform.properties.file"> |
|
60 |
<fail if="depends.natives.file.exists" unless="gvsig.platform.exists"> |
|
61 |
ERROR!! |
|
62 |
|
|
63 |
You have to define your gvSIG platform properties, |
|
64 |
by creating the file: ${user.home}/.gvsig.platform.properties |
|
65 |
with the following content: |
|
66 |
|
|
67 |
native_platform=linux |
|
68 |
native_distribution=all |
|
69 |
native_compiler=gcc4 |
|
70 |
native_arch=i386 |
|
71 |
native_libraryType=dynamic |
|
72 |
export native_classifier=${native_platform}-${native_distribution}-${native_compiler}-${native_arch}-${native_libraryType} |
|
73 |
|
|
74 |
Replace the fifth initial variables values with the ones appropiate |
|
75 |
to your platform. |
|
76 |
|
|
77 |
If you use maven in the command line, you can use the previous file also |
|
78 |
to define the MAVEN_OPTS environment variable, by adding to your |
|
79 |
.bash_rc file something like this: |
|
80 |
|
|
81 |
if [ -f "${HOME}/.gvsig.platform.properties" ] |
|
82 |
then |
|
83 |
. ${HOME}/.gvsig.platform.properties |
|
84 |
export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m -Dnative-classifier=${native_classifier}" |
|
85 |
else |
|
86 |
export MAVEN_OPTS="-Xmx256M -XX:MaxPermSize=64m" |
|
87 |
fi |
|
88 |
|
|
89 |
It will work if you use the bash shell. In any other case or platform, you'll |
|
90 |
have to define your MAVEN_OPTS environment variable and set the |
|
91 |
"native-classifier" parameter directly. |
|
92 |
</fail> |
|
93 |
|
|
94 |
</target> |
|
95 |
|
|
96 |
<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote,check.gvsig.platform.properties"> |
|
97 |
|
|
98 |
<mkdir dir="target" /> |
|
99 |
|
|
100 |
<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" /> |
|
101 |
|
|
102 |
<!-- Copy the maven launchers to the workspace metadata folder --> |
|
103 |
<copy todir="${workspace.basedir}/.metadata"> |
|
104 |
<fileset dir="${build.basedir}/eclipse-launchers"> |
|
105 |
<exclude name="**/org.eclipse.jdt.core.prefs" /> |
|
106 |
<exclude name="**/org.eclipse.core.variables.prefs" /> |
|
107 |
</fileset> |
|
108 |
</copy> |
|
109 |
|
|
110 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true"> |
|
111 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" /> |
|
112 |
</concat> |
|
113 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true"> |
|
114 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" /> |
|
115 |
</concat> |
|
116 |
|
|
117 |
<!-- Configure the eclipse workspace --> |
|
118 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" /> |
|
119 |
|
|
120 |
<!-- Configure the gvSIG profile --> |
|
121 |
<ant antfile="${build.basedir}/check-gvsig-profile.xml" /> |
|
122 |
|
|
123 |
<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" /> |
|
124 |
|
|
125 |
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"> |
|
126 |
<classpath> |
|
127 |
<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" /> |
|
128 |
</classpath> |
|
129 |
</taskdef> |
|
130 |
|
|
131 |
<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}"> |
|
132 |
<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" /> |
|
133 |
</xmltask> |
|
134 |
|
|
135 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
136 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
137 |
|
|
138 |
<!-- Compile, install and generate eclipse projects --> |
|
139 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" /> |
|
140 |
|
|
141 |
<echo>INFORMATION!!!</echo> |
|
142 |
<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo> |
|
143 |
|
|
144 |
<!-- TODO: copiar al proyecto de configuración general --> |
|
145 |
</target> |
|
146 |
|
|
147 |
<target name="clean"> |
|
148 |
<delete dir="target" /> |
|
149 |
</target> |
|
150 |
|
|
151 |
</project> |
|
0 | 152 |
org.gvsig.raster.wms/tags/v2.2.1/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.wms</artifactId> |
|
5 |
<packaging>pom</packaging> |
|
6 |
<version>2.2.1</version> |
|
7 |
<name>org.gvsig.raster.wms</name> |
|
8 |
<description>wms client</description> |
|
9 |
<inceptionYear>2011</inceptionYear> |
|
10 |
|
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.desktop</artifactId> |
|
14 |
<version>2.0.28-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
|
|
17 |
<repositories> |
|
18 |
<repository> |
|
19 |
<id>gvsig-public-http-repository</id> |
|
20 |
<name>gvSIG maven public HTTP repository</name> |
|
21 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
22 |
<releases> |
|
23 |
<enabled>true</enabled> |
|
24 |
<updatePolicy>daily</updatePolicy> |
|
25 |
<checksumPolicy>warn</checksumPolicy> |
|
26 |
</releases> |
|
27 |
<snapshots> |
|
28 |
<enabled>true</enabled> |
|
29 |
<updatePolicy>daily</updatePolicy> |
|
30 |
<checksumPolicy>warn</checksumPolicy> |
|
31 |
</snapshots> |
|
32 |
</repository> |
|
33 |
</repositories> |
|
34 |
|
|
35 |
<scm> |
|
36 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/v2.2.1</connection> |
|
37 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/v2.2.1</developerConnection> |
|
38 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.wms/tags/v2.2.1</url> |
|
39 |
</scm> |
|
40 |
|
|
41 |
<build> |
|
42 |
<plugins> |
|
43 |
<plugin> |
|
44 |
<groupId>org.apache.maven.plugins</groupId> |
|
45 |
<artifactId>maven-release-plugin</artifactId> |
|
46 |
<configuration> |
|
47 |
<tagBase>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/</tagBase> |
|
48 |
<goals>deploy</goals> |
|
49 |
</configuration> |
|
50 |
</plugin> |
|
51 |
</plugins> |
|
52 |
</build> |
|
53 |
|
|
54 |
<dependencyManagement> |
|
55 |
<dependencies> |
|
56 |
<dependency> |
|
57 |
<groupId>org.gvsig</groupId> |
|
58 |
<artifactId>org.gvsig.raster.cache.lib.api</artifactId> |
|
59 |
<version>2.2.0</version> |
|
60 |
</dependency> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
64 |
<version>2.2.1</version> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
69 |
<version>2.2.1</version> |
|
70 |
</dependency> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.raster.swing.api</artifactId> |
|
74 |
<version>2.2.1</version> |
|
75 |
</dependency> |
|
76 |
<dependency> |
|
77 |
<groupId>org.gvsig</groupId> |
|
78 |
<artifactId>org.gvsig.raster.swing.impl</artifactId> |
|
79 |
<version>2.2.1</version> |
|
80 |
</dependency> |
|
81 |
<dependency> |
|
82 |
<groupId>org.gvsig</groupId> |
|
83 |
<artifactId>org.gvsig.raster.wms.io</artifactId> |
|
84 |
<version>2.2.1</version> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId>org.gvsig.raster.fmap</artifactId> |
|
89 |
<version>2.2.1</version> |
|
90 |
</dependency> |
|
91 |
</dependencies> |
|
92 |
</dependencyManagement> |
|
93 |
<modules> |
|
94 |
<module>org.gvsig.raster.wms.io</module> |
|
95 |
<module>org.gvsig.raster.wms.app.wmsclient</module> |
|
96 |
</modules> |
|
97 |
</project> |
|
0 | 98 |
org.gvsig.raster.wms/tags/v2.2.1/org.gvsig.raster.wms.app.wmsclient/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.raster.wms.app.wmsclient</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>Formats: WMS support</name> |
|
8 |
<description>Web Map Service support</description> |
|
9 |
|
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.raster.wms</artifactId> |
|
13 |
<version>2.2.1</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.raster.swing.api</artifactId> |
|
20 |
<scope>compile</scope> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.raster.swing.impl</artifactId> |
|
25 |
<scope>runtime</scope> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>org.gvsig</groupId> |
|
29 |
<artifactId>org.gvsig.raster.wms.io</artifactId> |
|
30 |
<scope>compile</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.remoteclient</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
40 |
<scope>compile</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
45 |
<scope>compile</scope> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>org.gvsig</groupId> |
|
49 |
<artifactId>org.gvsig.raster.fmap</artifactId> |
|
50 |
<scope>compile</scope> |
|
51 |
</dependency> |
|
52 |
<dependency> |
|
53 |
<groupId>org.gvsig</groupId> |
|
54 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
55 |
<scope>compile</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.utils</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.gvsig</groupId> |
|
64 |
<artifactId>org.gvsig.ui</artifactId> |
|
65 |
<scope>compile</scope> |
|
66 |
</dependency> |
|
67 |
<dependency> |
|
68 |
<groupId>org.gvsig</groupId> |
|
69 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
70 |
<scope>compile</scope> |
|
71 |
</dependency> |
|
72 |
<dependency> |
|
73 |
<groupId>org.gvsig</groupId> |
|
74 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
75 |
<scope>compile</scope> |
|
76 |
</dependency> |
|
77 |
<dependency> |
|
78 |
<groupId>org.gvsig</groupId> |
|
79 |
<artifactId>org.gvsig.raster.cache.lib.api</artifactId> |
|
80 |
<scope>compile</scope> |
|
81 |
</dependency> |
|
82 |
|
|
83 |
<dependency> |
|
84 |
<groupId>org.gvsig</groupId> |
|
85 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
86 |
<scope>compile</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
91 |
<scope>runtime</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.fmap.mapcontext.operation</artifactId> |
|
96 |
<scope>runtime</scope> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.gvsig</groupId> |
|
100 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
101 |
<scope>compile</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
106 |
<scope>runtime</scope> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
111 |
<scope>compile</scope> |
|
112 |
</dependency> |
|
113 |
<dependency> |
|
114 |
<groupId>org.gvsig</groupId> |
|
115 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
116 |
<scope>compile</scope> |
|
117 |
</dependency> |
|
118 |
<dependency> |
|
119 |
<groupId>org.gvsig</groupId> |
|
120 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
121 |
<scope>compile</scope> |
|
122 |
</dependency> |
|
123 |
<dependency> |
|
124 |
<groupId>org.gvsig</groupId> |
|
125 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
126 |
<scope>compile</scope> |
|
127 |
</dependency> |
|
128 |
<dependency> |
|
129 |
<groupId>org.gvsig</groupId> |
|
130 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
131 |
<scope>compile</scope> |
|
132 |
</dependency> |
|
133 |
<dependency> |
|
134 |
<groupId>org.gvsig</groupId> |
|
135 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
136 |
<scope>compile</scope> |
|
137 |
</dependency> |
|
138 |
<dependency> |
|
139 |
<groupId>org.gvsig</groupId> |
|
140 |
<artifactId>org.gvsig.fmap.geometry.impl</artifactId> |
|
141 |
<scope>runtime</scope> |
|
142 |
</dependency> |
|
143 |
<dependency> |
|
144 |
<groupId>org.gvsig</groupId> |
|
145 |
<artifactId>org.gvsig.fmap.geometry.operation</artifactId> |
|
146 |
<scope>runtime</scope> |
|
147 |
</dependency> |
|
148 |
</dependencies> |
|
149 |
|
|
150 |
<properties> |
|
151 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
152 |
<gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2, required: org.gvsig.raster.mainplugin -ge 2</gvsig.package.info.dependencies> |
|
153 |
<gvsig.package.info.poolURL>http://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL> |
|
154 |
<gvsig.package.info.categories>OGC,Remote Services,Raster</gvsig.package.info.categories> |
|
155 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
156 |
</properties> |
|
157 |
</project> |
|
0 | 158 |
org.gvsig.raster.wms/tags/v2.2.1/org.gvsig.raster.wms.app.wmsclient/buildNumber.properties | ||
---|---|---|
1 |
#Fri Mar 28 14:03:30 CET 2014 |
|
2 |
buildNumber=54 |
|
0 | 3 |
org.gvsig.raster.wms/tags/v2.2.1/org.gvsig.raster.wms.app.wmsclient/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.wms.app.wmsclient:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.wms.io:jar</include> |
|
34 |
</includes> |
|
35 |
</dependencySet> |
|
36 |
</dependencySets> |
|
37 |
</assembly> |
|
0 | 38 |
org.gvsig.raster.wms/tags/v2.2.1/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/wmc/ExportWebMapContextExtension.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.wmc; |
|
24 |
|
|
25 |
import java.io.BufferedWriter; |
|
26 |
import java.io.File; |
|
27 |
import java.io.FileWriter; |
|
28 |
import java.io.IOException; |
|
29 |
import java.util.ArrayList; |
|
30 |
import java.util.List; |
|
31 |
|
|
32 |
import org.gvsig.andami.PluginServices; |
|
33 |
import org.gvsig.andami.messages.NotificationManager; |
|
34 |
import org.gvsig.andami.plugins.Extension; |
|
35 |
import org.gvsig.andami.plugins.IExtension; |
|
36 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
37 |
import org.gvsig.app.project.Project; |
|
38 |
import org.gvsig.app.project.ProjectManager; |
|
39 |
import org.gvsig.app.project.documents.Document; |
|
40 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
41 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
42 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
43 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
45 |
import org.gvsig.raster.wms.app.wmsclient.gui.panel.WebMapContextSettingsPanel; |
|
46 |
import org.gvsig.raster.wms.app.wmsclient.layer.FLyrWMS; |
|
47 |
|
|
48 |
|
|
49 |
/** |
|
50 |
* Extension to export a view with WMS layers to a OGC's Web Map Context XML |
|
51 |
* file |
|
52 |
* |
|
53 |
* @author jaume dom?nguez faus - jaume.dominguez@iver.es |
|
54 |
* @author laura d?az s?nchez - laura.diaz@iver.es |
|
55 |
*/ |
|
56 |
public class ExportWebMapContextExtension extends Extension { |
|
57 |
private static ArrayList<String> supportedVersions; |
|
58 |
private AbstractViewPanel viewToExport; |
|
59 |
private WebMapContextSettingsPanel mc; |
|
60 |
private static IExtension thisExtension; |
|
61 |
|
|
62 |
{ |
|
63 |
supportedVersions = new ArrayList<String>(); |
|
64 |
supportedVersions.add("1.1.0"); |
|
65 |
} |
|
66 |
|
|
67 |
public void initialize() { |
|
68 |
thisExtension = PluginServices |
|
69 |
.getExtension(ExportWebMapContextExtension.class); |
|
70 |
} |
|
71 |
|
|
72 |
public void execute(String actionCommand) { |
|
73 |
if (actionCommand.equals("EXPORT")) { |
|
74 |
// Here we collect the info |
|
75 |
DefaultViewDocument[] views = getExportableViews(); |
|
76 |
if (views.length <= 0) { |
|
77 |
return; |
|
78 |
} |
|
79 |
mc = new WebMapContextSettingsPanel(views); |
|
80 |
PluginServices.getMDIManager().addWindow(mc); |
|
81 |
|
|
82 |
} else if (actionCommand.equals("DO_EXPORT")) { |
|
83 |
// Here the target file is produced (called from the WebMapContextSettingsPanel) |
|
84 |
String xml = mc.getXML(); |
|
85 |
File f = mc.getTargetFile(); |
|
86 |
if (xml != null) { |
|
87 |
createFile(f, xml); |
|
88 |
} |
|
89 |
|
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* Takes a File object and its XML contents and stores it as a regular |
|
95 |
* file in the file system. |
|
96 |
* @param f |
|
97 |
* @param xml |
|
98 |
*/ |
|
99 |
public static void createFile(File f, String xml) { |
|
100 |
if (xml != null) { |
|
101 |
try { |
|
102 |
if (!f.exists()) { |
|
103 |
f.createNewFile(); |
|
104 |
} |
|
105 |
BufferedWriter bw = new BufferedWriter(new FileWriter(f)); |
|
106 |
bw.write(xml); |
|
107 |
bw.close(); |
|
108 |
bw = null; |
|
109 |
} catch (IOException e) { |
|
110 |
NotificationManager.addError(PluginServices.getText( |
|
111 |
thisExtension, "error_writting_file"), e); |
|
112 |
} |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
public boolean isEnabled() { |
|
117 |
return true; |
|
118 |
} |
|
119 |
|
|
120 |
public boolean isVisible() { |
|
121 |
// Will be visible if the current project has, at least, one FLyrWMS. |
|
122 |
// Project project = ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject(); |
|
123 |
final Project project = ProjectManager.getInstance().getCurrentProject(); |
|
124 |
|
|
125 |
if (project == null) { |
|
126 |
return false; |
|
127 |
} |
|
128 |
IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
|
129 |
if (f instanceof AbstractViewPanel) { |
|
130 |
AbstractViewPanel v = (AbstractViewPanel) f; |
|
131 |
if (v != null && v instanceof AbstractViewPanel) { |
|
132 |
// Check if the active contains WMS layers. If so, this view |
|
133 |
// will be the one to be exported. |
|
134 |
FLayers lyrs = v.getMapControl().getMapContext().getLayers(); |
|
135 |
for (int i = 0; i < lyrs.getLayersCount(); i++) { |
|
136 |
FLayer lyr = lyrs.getLayer(i); |
|
137 |
if (WebMapContext.containsExportableLayers(lyr)) { |
|
138 |
viewToExport = v; |
|
139 |
return true; |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
143 |
} |
|
144 |
|
|
145 |
// Since the active view does not contain WMS layers then will |
|
146 |
// see what about the others. In this case, no view is set to be |
|
147 |
// the exported one. |
|
148 |
viewToExport = null; |
|
149 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
|
150 |
for (int i = 0; i < views.size(); i++) { |
|
151 |
DefaultViewDocument v = ((DefaultViewDocument) views.get(i)); |
|
152 |
if (v != null) { |
|
153 |
FLayers lyrs = v.getMapContext().getLayers(); |
|
154 |
for (int j = 0; j < lyrs.getLayersCount(); j++) { |
|
155 |
FLayer lyr = lyrs.getLayer(j); |
|
156 |
if (WebMapContext.containsExportableLayers(lyr)) { |
|
157 |
return true; |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
162 |
return false; |
|
163 |
} |
|
164 |
|
|
165 |
/** |
|
166 |
* <p> |
|
167 |
* Searches the views in the current project that can be exported to a |
|
168 |
* WebMapContext file (with ".cml" extension) and return them in a |
|
169 |
* ProjectView array.<br> |
|
170 |
* </p> |
|
171 |
* <p> |
|
172 |
* A view is exportable to WebMapContext if it contains at least one FLyrWMS |
|
173 |
* and in a near future, any other OGC layer such as WebCoverageService, WFS, and so on. Only |
|
174 |
* these layers will be exported. Other kind of layers are ignored since they |
|
175 |
* are out of the OGC premises. |
|
176 |
* </p> |
|
177 |
* @return |
|
178 |
*/ |
|
179 |
@SuppressWarnings({ "unchecked", "deprecation" }) |
|
180 |
private DefaultViewDocument[] getExportableViews() { |
|
181 |
// Project project = ((ProjectExtension) PluginServices.getExtension(ProjectExtension.class)).getProject(); |
|
182 |
// ArrayList views = project.getDocumentsByType(ProjectViewFactory.registerName); |
|
183 |
final Project project = ProjectManager.getInstance().getCurrentProject(); |
|
184 |
|
|
185 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
|
186 |
|
|
187 |
List exportableViews = new ArrayList(); |
|
188 |
if (viewToExport!=null) { |
|
189 |
exportableViews.add(viewToExport.getModel()); |
|
190 |
} |
|
191 |
|
|
192 |
for (int i = 0; i < views.size(); i++) { |
|
193 |
DefaultViewDocument v = ((DefaultViewDocument) views.get(i)); |
|
194 |
if (v != null) { |
|
195 |
FLayers lyrs = v.getMapContext().getLayers(); |
|
196 |
for (int j = 0; j < lyrs.getLayersCount(); j++) { |
|
197 |
FLayer lyr = lyrs.getLayer(j); |
|
198 |
if (lyr instanceof FLyrWMS && !exportableViews.contains(v)) { |
|
199 |
exportableViews.add(v); |
|
200 |
break; |
|
201 |
} |
|
202 |
} |
|
203 |
} |
|
204 |
} |
|
205 |
return (DefaultViewDocument[]) exportableViews.toArray(new DefaultViewDocument[0]); |
|
206 |
} |
|
207 |
|
|
208 |
} |
|
0 | 209 |
org.gvsig.raster.wms/tags/v2.2.1/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/wmc/WebMapContextTags.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.wmc; |
|
24 |
|
|
25 |
/** |
|
26 |
* WebMapContextTags is a class with only static public fields containing the |
|
27 |
* String constants of the WebMapContext XML document. |
|
28 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class WebMapContextTags { |
|
32 |
private WebMapContextTags() {}; |
|
33 |
|
|
34 |
public static final String VIEW_CONTEXT = "ViewContext"; |
|
35 |
public static final String VIEW_CONTEXT_0_1_4 = "WMS_Viewer_Context"; |
|
36 |
public static final String VERSION = "version"; |
|
37 |
public static final String ID = "id"; |
|
38 |
public static final String XMLNS = "xmlns"; |
|
39 |
public static final String XMLNS_XLINK = "xmlns:xlink"; |
|
40 |
public static final String XMLNS_XLINK_VALUE = "http://www.w3.org/1999/xlink"; |
|
41 |
public static final String XMLNS_VALUE = "http://www.opengis.net/context"; // "http://www.opengeospatial.net/context" |
|
42 |
public static final String XMLNS_XSI = "xmlns:xsi"; |
|
43 |
public static final String XMLNS_XSI_VALUE = "http://www.w3.org/2001/XMLSchema-instance"; |
|
44 |
public static final String XSI_SCHEMA_LOCATION = "xsi:schemaLocation"; |
|
45 |
public static final String XSI_SCHEMA_LOCATION_VALUE = "http://www.opengeospatial.net/context context.xsd"; |
|
46 |
public static final String GENERAL = "General"; |
|
47 |
public static final String WIDTH = "width"; |
|
48 |
public static final String HEIGHT = "height"; |
|
49 |
public static final String WINDOW = "Window"; |
|
50 |
public static final String SRS = "SRS"; |
|
51 |
public static final String X_MIN = "minx"; |
|
52 |
public static final String Y_MIN = "miny"; |
|
53 |
public static final String X_MAX = "maxx"; |
|
54 |
public static final String Y_MAX = "maxy"; |
|
55 |
public static final String BOUNDING_BOX = "BoundingBox"; |
|
56 |
public static final String TITLE = "Title"; |
|
57 |
public static final String LAYER_LIST = "LayerList"; |
|
58 |
public static final String LAYER = "Layer"; |
|
59 |
public static final String QUERYABLE = "queryable"; |
|
60 |
public static final String HIDDEN = "hidden"; |
|
61 |
public static final String SERVICE = "service"; |
|
62 |
public static final String WMS = "WMS"; |
|
63 |
public static final String SERVER_TITLE = "title"; |
|
64 |
public static final String SERVER = "Server"; |
|
65 |
public static final String XLINK_TYPE = "xlink:type"; |
|
66 |
public static final String XLINK_HREF = "xlink:href"; |
|
67 |
public static final String ONLINE_RESOURCE = "OnlineResource"; |
|
68 |
public static final String NAME = "Name"; |
|
69 |
public static final String ABSTRACT = "Abstract"; |
|
70 |
public static final String FORMAT_LIST = "FormatList"; |
|
71 |
public static final String CURRENT = "current"; |
|
72 |
public static final String FORMAT = "Format"; |
|
73 |
public static final String STYLE_LIST = "StyleList"; |
|
74 |
public static final String STYLE = "Style"; |
|
75 |
public static final String KEYWORD_LIST = "KeywordList"; |
|
76 |
public static final String KEYWORD = "Keyword"; |
|
77 |
public static final String LOGO_URL = "LogoURL"; |
|
78 |
public static final String DESCRIPTION_URL = "DescriptionURL"; |
|
79 |
public static final String CONTACT_INFORMATION = "ContactInformation"; |
|
80 |
public static final String CONTACT_PERSON_PRIMARY = "ContactPersonPrimary"; |
|
81 |
public static final String CONTACT_PERSON = "ContactPerson"; |
|
82 |
public static final String CONTACT_ORGANIZATION = "ContactOrganization"; |
|
83 |
public static final String CONTACT_POSITION = "ContactPosition"; |
|
84 |
public static final String CONTACT_ADDRESS = "ContactAddress"; |
|
85 |
public static final String ADDRESS_TYPE = "AddressType"; |
|
86 |
public static final String ADDRESS = "Address"; |
|
87 |
public static final String CITY = "City"; |
|
88 |
public static final String STATE_OR_PROVINCE = "StateOrProvince"; |
|
89 |
public static final String POSTCODE = "PostCode"; |
|
90 |
public static final String COUNTRY = "Country"; |
|
91 |
public static final String CONTACT_VOICE_TELEPHONE = "ContactVoiceTelephone"; |
|
92 |
public static final String CONTACT_FACSIMILE_TELEPHONE = "ContactFacsimileTelephone"; |
|
93 |
public static final String CONTACT_ELECTRONIC_MAIL_ADDRESS = "ContactElectronicMailAddress"; |
|
94 |
public static final String DIMENSION_LIST = "DimensionList"; |
|
95 |
public static final String LEGEND_URL = "LegendURL"; |
|
96 |
|
|
97 |
} |
|
0 | 98 |
org.gvsig.raster.wms/tags/v2.2.1/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/wmc/WebMapContext.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.wms.app.wmsclient.wmc; |
|
24 |
|
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.geom.Rectangle2D; |
|
27 |
import java.io.BufferedReader; |
|
28 |
import java.io.File; |
|
29 |
import java.io.FileInputStream; |
|
30 |
import java.io.FileNotFoundException; |
|
31 |
import java.io.FileReader; |
|
32 |
import java.io.IOException; |
|
33 |
import java.util.ArrayList; |
|
34 |
import java.util.Arrays; |
|
35 |
import java.util.HashMap; |
|
36 |
import java.util.HashSet; |
|
37 |
import java.util.Hashtable; |
|
38 |
import java.util.List; |
|
39 |
import java.util.Vector; |
|
40 |
|
|
41 |
import org.cresques.cts.ICoordTrans; |
|
42 |
import org.cresques.cts.IProjection; |
|
43 |
import org.gvsig.app.ApplicationLocator; |
|
44 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
45 |
import org.gvsig.fmap.crs.CRSFactory; |
|
46 |
import org.gvsig.fmap.dal.coverage.exception.ImportMapContextException; |
|
47 |
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException; |
|
48 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
49 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
50 |
import org.gvsig.i18n.Messages; |
|
51 |
import org.gvsig.raster.wms.app.wmsclient.layer.FLyrWMS; |
|
52 |
import org.gvsig.raster.wms.io.RemoteWMSStyle; |
|
53 |
import org.gvsig.raster.wms.io.WMSDataParameters; |
|
54 |
import org.gvsig.raster.wms.io.WMSDataParametersImpl; |
|
55 |
import org.kxml2.io.KXmlParser; |
|
56 |
import org.slf4j.Logger; |
|
57 |
import org.slf4j.LoggerFactory; |
|
58 |
import org.xmlpull.v1.XmlPullParserException; |
|
59 |
|
|
60 |
|
|
61 |
/** |
|
62 |
* Class that loads and produces WebMapContext files and holds its attributes. |
|
63 |
* |
|
64 |
* You can create a blank WebMapContext instance using the default constructor |
|
65 |
* or an already initialized instance by specifying a source file. In the last |
|
66 |
* case the file will be readed and the values loaded an holded by the instance. |
|
67 |
* |
|
68 |
* You can get the equivalent WebMapContext XML document by calling the method |
|
69 |
* getXML() supplying the ProjectView that you want to export and depending on |
|
70 |
* the value of the fileVersion field (currently you can use "1.1.0" (default), |
|
71 |
* "1.0.0" or "0.4.1" to specify the destination document version. |
|
72 |
* |
|
73 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
74 |
*/ |
|
75 |
public class WebMapContext { |
|
76 |
public final static String FILE_EXTENSION = ".cml"; |
|
77 |
private Logger log = LoggerFactory.getLogger(WebMapContext.class); |
|
78 |
static final ArrayList<String> supportedVersions = new ArrayList<String>(); |
|
79 |
static public final ArrayList<String> exportVersions = new ArrayList<String>(); |
|
80 |
static private HashSet supportedLayers = new HashSet(); |
|
81 |
private File mapContextFile; |
|
82 |
private String encoding = "UTF-8"; |
|
83 |
private String WMC_START_TAG; |
|
84 |
|
|
85 |
// MapContext stuff |
|
86 |
public String fileVersion = null; |
|
87 |
public Dimension windowSize = null; |
|
88 |
public String srs = null; |
|
89 |
public Rectangle2D bBox = null; |
|
90 |
public String title = null; |
|
91 |
public String id = null; |
|
92 |
public String xmlns = null; |
|
93 |
public String xmlns_xlink = null; |
|
94 |
public String xmlns_xsi = null;; |
|
95 |
public String xsi_schemaLocation = null; |
|
96 |
public String _abstract = null; |
|
97 |
public List<String> keywordList = null; |
|
98 |
public Dimension logoURLSize = null; |
|
99 |
public String logoURLFormat = null; |
|
100 |
public String logoURL = null; |
|
101 |
public String descriptionURLFormat = null; |
|
102 |
public String descriptionURL = null; |
|
103 |
public boolean contactInfo = false; |
|
104 |
public String contactPerson = null; |
|
105 |
public String contactOrganization = null; |
|
106 |
public String contactPosition = null; |
|
107 |
public String address = null; |
|
108 |
public String city = null; |
|
109 |
public String stateOrProvince = null; |
|
110 |
public String postCode = null; |
|
111 |
public String country = null; |
|
112 |
public String telephone = null; |
|
113 |
public String fax = null; |
|
114 |
public String email = null; |
|
115 |
|
|
116 |
private StringBuffer errorMessages; |
|
117 |
|
|
118 |
List<FLyrWMS> layerList = null; |
|
119 |
List<WMSDataParameters> paramsList = null; |
|
120 |
|
|
121 |
Hashtable<Object, String[]> srsList = null; |
|
122 |
|
|
123 |
/** |
|
124 |
* key: server URL (URL) |
|
125 |
* value: server title (String) |
|
126 |
*/ |
|
127 |
Hashtable<String, String> serverTitles = null; |
|
128 |
|
|
129 |
/** |
|
130 |
* key: layer FLyrWMS |
|
131 |
* value: layer abstract (String) |
|
132 |
*/ |
|
133 |
Hashtable layerAbstracts = null; |
|
134 |
|
|
135 |
/** |
|
136 |
* key: layer FLyrWMS |
|
137 |
* value: layer formats (String[]) |
|
138 |
*/ |
|
139 |
Hashtable layerFormats = null; |
|
140 |
|
|
141 |
/** |
|
142 |
* key: layer FLyrWMS |
|
143 |
* value: styles (FMapWMSStyle[]) |
|
144 |
*/ |
|
145 |
Hashtable layerStyles = null; |
|
146 |
|
|
147 |
|
|
148 |
static { |
|
149 |
supportedVersions.add("1.1.0"); |
|
150 |
supportedVersions.add("1.0.0"); |
|
151 |
supportedVersions.add("0.1.4"); |
|
152 |
} |
|
153 |
|
|
154 |
static { |
|
155 |
exportVersions.add("1.1.0"); |
|
156 |
exportVersions.add("1.0.0"); |
|
157 |
exportVersions.add("0.1.4"); |
|
158 |
} |
|
159 |
|
|
160 |
static { |
|
161 |
supportedLayers.add(FLyrWMS.class); |
|
162 |
} |
|
163 |
|
|
164 |
|
|
165 |
/** |
|
166 |
* Initializes the WebMapContext properties from the values in the WebMapContext (.cml) |
|
167 |
* file passed in the argument. |
|
168 |
* @param file |
|
169 |
* @throws UnsupportedVersionLayerException |
|
170 |
* @throws ImportMapContextException |
|
171 |
*/ |
|
172 |
public void readFile(File file) throws UnsupportedVersionLayerException, ImportMapContextException { |
|
173 |
this.mapContextFile = file; |
|
174 |
errorMessages = new StringBuffer(); |
|
175 |
if (getVersion() != null) { |
|
176 |
if (supportedVersions.contains(getVersion())) { |
|
177 |
WMC_START_TAG = WebMapContextTags.VIEW_CONTEXT; |
|
178 |
if (getVersion().equals("0.1.4")) { |
|
179 |
WMC_START_TAG = WebMapContextTags.VIEW_CONTEXT_0_1_4; |
|
180 |
parse1_1_0(file); |
|
181 |
} else if (getVersion().equals("1.1.0")) { |
|
182 |
parse1_1_0(file); |
|
183 |
} else if (getVersion().equals("1.0.0")) { |
|
184 |
parse1_1_0(file); |
|
185 |
} else { |
|
186 |
parseDefaultVersion(file); |
|
187 |
} |
|
188 |
|
|
189 |
// Once parsed, check errors |
|
190 |
if (errorMessages.length() > 0) { |
|
191 |
throw new ImportMapContextException(errorMessages.toString(), false); |
|
192 |
} |
|
193 |
} else { |
|
194 |
throw new UnsupportedVersionLayerException(file.getName(), null); |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
|
|
199 |
|
|
200 |
/** |
|
201 |
* If no version was recognized then will parse the default one which is supposed |
|
202 |
* to be the best available. |
|
203 |
* @param file |
|
204 |
* @throws ImportMapContextException |
|
205 |
*/ |
|
206 |
private void parseDefaultVersion(File file) throws ImportMapContextException { |
|
207 |
parse1_1_0(file); |
|
208 |
} |
|
209 |
|
|
210 |
/** |
|
211 |
* Reads the header of the Weg Map Context file and determines which version |
|
212 |
* it belongs to. |
|
213 |
* @return String. |
|
214 |
*/ |
|
215 |
private String getVersion() { |
|
216 |
if (fileVersion == null) { |
|
217 |
String v = null; |
|
218 |
try { |
|
219 |
FileReader fr = new FileReader(mapContextFile); |
|
220 |
KXmlParser parser = new KXmlParser(); |
|
221 |
parser.setInput(fr); |
|
222 |
parser.nextTag(); |
|
223 |
if ( parser.getEventType() != KXmlParser.END_DOCUMENT ) { |
|
224 |
if ((parser.getName().compareTo(WebMapContextTags.VIEW_CONTEXT) == 0) || |
|
225 |
parser.getName().compareTo(WebMapContextTags.VIEW_CONTEXT_0_1_4) == 0) { |
|
226 |
v = parser.getAttributeValue("", WebMapContextTags.VERSION); |
|
227 |
} |
|
228 |
} |
|
229 |
} catch (FileNotFoundException fnfEx) { |
|
230 |
} catch (XmlPullParserException xmlEx) { |
|
231 |
xmlEx.printStackTrace(); |
|
232 |
} catch (IOException e) { |
|
233 |
} |
|
234 |
fileVersion = v; |
|
235 |
} |
|
236 |
return fileVersion; |
|
237 |
} |
|
238 |
|
|
239 |
private void readEnconding(File file) { |
|
240 |
FileReader fr = null; |
|
241 |
try { |
|
242 |
fr = new FileReader(file); |
|
243 |
BufferedReader br = new BufferedReader(fr); |
|
244 |
char[] buffer = new char[100]; |
|
245 |
br.read(buffer); |
|
246 |
StringBuffer st = new StringBuffer(new String(buffer)); |
|
247 |
String searchText = "encoding=\""; |
|
248 |
int index = st.indexOf(searchText); |
|
249 |
if (index>-1) { |
|
250 |
st.delete(0, index+searchText.length()); |
|
251 |
encoding = st.substring(0, st.indexOf("\"")); |
|
252 |
} |
|
253 |
br.close(); |
|
254 |
fr.close(); |
|
255 |
} catch(FileNotFoundException ex) { |
|
256 |
log.info("Error reading the encoding", ex); |
|
257 |
} catch (IOException e) { |
|
258 |
log.info("Error reading the encoding", e); |
|
259 |
} |
|
260 |
} |
|
261 |
|
|
262 |
/** |
|
263 |
* Reads a Web Map Context version 1.1.0. As far as v1.0.0 is a subset of |
|
264 |
* v1.1.0 it can be used to read files belonging to 1.0.0 as well. |
|
265 |
* @param file, the web map context file. |
|
266 |
*/ |
|
267 |
private void parse1_1_0(File file) throws ImportMapContextException { |
|
268 |
try { |
|
269 |
readEnconding(file); |
|
270 |
|
|
271 |
KXmlParser parser = new KXmlParser(); |
|
272 |
parser.setInput(new FileInputStream(file), encoding); |
|
273 |
int tag = parser.nextTag(); |
|
274 |
if ( parser.getEventType() != KXmlParser.END_DOCUMENT ) { |
|
275 |
parser.require(KXmlParser.START_TAG, null, WMC_START_TAG); |
|
276 |
while(tag != KXmlParser.END_DOCUMENT) { |
|
277 |
switch(tag) { |
|
278 |
case KXmlParser.START_TAG: |
|
279 |
if (parser.getName().compareTo(WMC_START_TAG) == 0) { |
|
280 |
id = parser.getAttributeValue("", WebMapContextTags.ID); |
|
281 |
xmlns = parser.getAttributeValue("", WebMapContextTags.XMLNS); |
|
282 |
xmlns_xlink = parser.getAttributeValue("", WebMapContextTags.XMLNS_XLINK); |
|
283 |
xmlns_xsi = parser.getAttributeValue("", WebMapContextTags.XMLNS_XSI); |
|
284 |
xsi_schemaLocation = parser.getAttributeValue("", WebMapContextTags.XSI_SCHEMA_LOCATION) ; |
|
285 |
} else if (parser.getName().compareTo(WebMapContextTags.GENERAL) == 0) { |
|
286 |
parseGeneral1_1_0(parser); |
|
287 |
} else if (parser.getName().compareTo(WebMapContextTags.LAYER_LIST) == 0) { |
|
288 |
int layerListTag = parser.nextTag(); |
|
289 |
boolean bLayerListEnd = false; |
|
290 |
layerList = new ArrayList<FLyrWMS>(); |
|
291 |
paramsList = new ArrayList<WMSDataParameters>(); |
|
292 |
while (!bLayerListEnd) { |
|
293 |
switch(layerListTag) { |
|
294 |
case KXmlParser.START_TAG: |
|
295 |
if (parser.getName().compareTo(WebMapContextTags.LAYER) == 0) { |
|
296 |
FLyrWMS layer = new FLyrWMS(); |
|
297 |
WMSDataParameters dataParameters = new WMSDataParametersImpl(); |
|
298 |
dataParameters.setSRS(srs); |
|
299 |
parseLayer1_1_0(parser, layer, dataParameters); |
|
300 |
// will use the mapcontext's bounding box as layer's fullextent |
|
301 |
IProjection proj = CRSFactory.getCRS(srs); |
|
302 |
if (proj == null) { |
|
303 |
// non supported srs, and cannot continue |
|
304 |
String msg = Messages.getText("unsupported_crs") + " (" + srs + ")"; |
|
305 |
throw new ImportMapContextException(msg, true); |
|
306 |
} |
|
307 |
/*String[] availableSRS = dataParameters.getSRSCode().split(","); |
|
308 |
ICoordTrans ct = null; |
|
309 |
String mySRS = null; |
|
310 |
for (int i = 0; i < availableSRS.length; i++) { |
|
311 |
mySRS = availableSRS[i]; |
|
312 |
IProjection dstProj = CRSFactory.getCRS(mySRS); |
|
313 |
if (dstProj != null) { |
|
314 |
try{ |
|
315 |
ct = proj.getCT(dstProj); |
|
316 |
} catch(Exception e) { |
|
317 |
ct = null; |
|
318 |
} catch (Error e) { |
|
319 |
ct = null; |
|
320 |
} |
|
321 |
if (mySRS.equals(srs)) { |
|
322 |
break; |
|
323 |
} |
|
324 |
} |
|
325 |
} |
|
326 |
|
|
327 |
if (ct != null) { |
|
328 |
dataParameters.setSRS(mySRS); |
|
329 |
} else { |
|
330 |
// can't reproject |
|
331 |
errorMessages.append("["). |
|
332 |
append(Messages.getText("layer")). |
|
333 |
append(" "). |
|
334 |
append(layer.getName()). |
|
335 |
append("] "). |
|
336 |
append(Messages.getText("cant_reproject_from_any_of")). |
|
337 |
append(" [").append(dataParameters.getSRSCode()).append("] "). |
|
338 |
append(Messages.getText("to")). |
|
339 |
append(srs). |
|
340 |
append("\n"); |
|
341 |
dataParameters.setSRS(srs); |
|
342 |
}*/ |
|
343 |
|
|
344 |
dataParameters.setWmsTransparency(true); |
|
345 |
layerList.add(layer); |
|
346 |
paramsList.add(dataParameters); |
|
347 |
} else { |
|
348 |
log.info("Unrecognized "+ parser.getName()); |
|
349 |
} |
|
350 |
break; |
|
351 |
case KXmlParser.END_TAG: |
|
352 |
if (parser.getName().compareTo(WebMapContextTags.LAYER_LIST) == 0) { |
|
353 |
bLayerListEnd = true; |
|
354 |
} |
|
355 |
break; |
|
356 |
case KXmlParser.TEXT: |
|
357 |
break; |
|
358 |
} |
|
359 |
layerListTag = parser.next(); |
|
360 |
} |
|
361 |
} else if (parser.getName().compareTo(WebMapContextTags.DIMENSION_LIST) == 0) { |
|
362 |
log.info("WebMapContext's Dimension not yet implemented"); |
|
363 |
} else { |
|
364 |
log.info("Unrecognized " + parser.getName()); |
|
365 |
} |
|
366 |
break; |
|
367 |
case KXmlParser.END_TAG: |
|
368 |
break; |
|
369 |
case KXmlParser.TEXT: |
|
370 |
break; |
|
371 |
} |
|
372 |
tag = parser.next(); |
|
373 |
} |
|
374 |
parser.require(KXmlParser.END_DOCUMENT, null, null); |
|
375 |
} |
|
376 |
} catch (ImportMapContextException e){ |
|
377 |
throw e; |
|
378 |
} catch (Exception e) { |
|
379 |
log.debug(Messages.getText("map_context_file_error"), e); |
|
380 |
} |
|
381 |
} |
|
382 |
|
|
383 |
/** |
|
384 |
* Parses the General tag of a web map context 1.1.0 (and 1.0.0) file |
|
385 |
* @param parser |
|
386 |
* @throws XmlPullParserException |
|
387 |
* @throws IOException |
|
388 |
*/ |
|
389 |
private void parseGeneral1_1_0(KXmlParser parser) throws XmlPullParserException, IOException { |
|
390 |
boolean end = false; |
|
391 |
int tag = parser.next(); |
|
392 |
while (!end) { |
|
393 |
switch(tag) { |
|
394 |
case KXmlParser.START_TAG: |
|
395 |
if (parser.getName().compareTo(WebMapContextTags.WINDOW) == 0) { |
|
396 |
if (windowSize == null) { |
|
397 |
windowSize = new Dimension(); |
|
398 |
} |
|
399 |
windowSize.setSize(Integer.parseInt(parser.getAttributeValue("", WebMapContextTags.WIDTH)), |
|
400 |
Integer.parseInt(parser.getAttributeValue("", WebMapContextTags.HEIGHT))); |
|
401 |
} else if (parser.getName().compareTo(WebMapContextTags.BOUNDING_BOX) == 0) { |
|
402 |
srs = parser.getAttributeValue("", WebMapContextTags.SRS); |
|
403 |
double minx = Double.parseDouble(parser.getAttributeValue("", WebMapContextTags.X_MIN)); |
|
404 |
double miny = Double.parseDouble(parser.getAttributeValue("", WebMapContextTags.Y_MIN)); |
|
405 |
double maxx = Double.parseDouble(parser.getAttributeValue("", WebMapContextTags.X_MAX)); |
|
406 |
double maxy = Double.parseDouble(parser.getAttributeValue("", WebMapContextTags.Y_MAX)); |
|
407 |
bBox = new Rectangle2D.Double(minx, miny, maxx-minx, maxy-miny); |
|
408 |
} else if (parser.getName().compareTo(WebMapContextTags.TITLE) == 0) { |
|
409 |
title = parser.nextText(); |
|
410 |
} else if (parser.getName().compareTo(WebMapContextTags.ABSTRACT) == 0) { |
|
411 |
_abstract = parser.nextText(); |
|
412 |
} else if (parser.getName().compareTo(WebMapContextTags.KEYWORD_LIST) == 0) { |
|
413 |
keywordList = new ArrayList<String>(); |
|
414 |
boolean keywordEnd = false; |
|
415 |
int keywordTag = parser.next(); |
|
416 |
while (!keywordEnd) { |
|
417 |
switch(keywordTag) { |
|
418 |
case KXmlParser.START_TAG: |
|
419 |
if (parser.getName().compareTo(WebMapContextTags.KEYWORD) == 0) { |
|
420 |
keywordList.add(parser.nextText()); |
|
421 |
} else { |
|
422 |
System.out.println("Unrecognized "+parser.getName()); |
|
423 |
} |
|
424 |
break; |
|
425 |
case KXmlParser.END_TAG: |
|
426 |
if (parser.getName().compareTo(WebMapContextTags.KEYWORD_LIST) == 0) { |
|
427 |
keywordEnd = true; |
|
428 |
} |
|
429 |
break; |
|
430 |
case KXmlParser.TEXT: |
|
431 |
if (parser.getName()!=null) { |
|
432 |
System.out.println("[TAG]["+parser.getName()+"]\n[TEXT]["+parser.getText().trim()+"]"); |
|
433 |
} |
|
434 |
break; |
|
435 |
} |
|
436 |
keywordTag = parser.next(); |
|
437 |
} |
|
438 |
} else if (parser.getName().compareTo(WebMapContextTags.LOGO_URL) == 0) { |
|
439 |
logoURLSize = new Dimension(Integer.parseInt(parser.getAttributeValue("", WebMapContextTags.WIDTH)), |
|
440 |
Integer.parseInt(parser.getAttributeValue("", WebMapContextTags.HEIGHT))); |
|
441 |
logoURLFormat = parser.getAttributeValue("", WebMapContextTags.FORMAT.toLowerCase()); |
|
442 |
parser.nextTag(); |
|
443 |
if (parser.getName().compareTo(WebMapContextTags.ONLINE_RESOURCE) == 0) { |
|
444 |
logoURL = parser.getAttributeValue("", WebMapContextTags.XLINK_HREF); |
|
445 |
} else { |
|
446 |
System.out.println("Unrecognized "+parser.getName()); |
|
447 |
} |
|
448 |
} else if (parser.getName().compareTo(WebMapContextTags.DESCRIPTION_URL) == 0) { |
|
449 |
descriptionURLFormat = parser.getAttributeValue("", WebMapContextTags.FORMAT.toLowerCase()); |
|
450 |
parser.nextTag(); |
|
451 |
if (parser.getName().compareTo(WebMapContextTags.ONLINE_RESOURCE) == 0) { |
|
452 |
descriptionURL = parser.getAttributeValue("", WebMapContextTags.XLINK_HREF); |
|
453 |
} else { |
|
454 |
System.out.println("Unrecognized "+parser.getName()); |
|
455 |
} |
|
456 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_INFORMATION) == 0) { |
|
457 |
boolean contactInfoEnd = false; |
|
458 |
int contactInfoTag = parser.next(); |
|
459 |
while (!contactInfoEnd) { |
|
460 |
switch(contactInfoTag) { |
|
461 |
case KXmlParser.START_TAG: |
|
462 |
if (parser.getName().compareTo(WebMapContextTags.CONTACT_PERSON) == 0) { |
|
463 |
contactPerson = parser.nextText(); |
|
464 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_ORGANIZATION) == 0) { |
|
465 |
contactOrganization = parser.nextText(); |
|
466 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_POSITION) == 0) { |
|
467 |
contactPosition = parser.nextText(); |
|
468 |
} else if (parser.getName().compareTo(WebMapContextTags.ADDRESS) == 0) { |
|
469 |
address = parser.nextText(); |
|
470 |
} else if (parser.getName().compareTo(WebMapContextTags.CITY) == 0) { |
|
471 |
city = parser.nextText(); |
|
472 |
} else if (parser.getName().compareTo(WebMapContextTags.STATE_OR_PROVINCE) == 0) { |
|
473 |
stateOrProvince = parser.nextText(); |
|
474 |
} else if (parser.getName().compareTo(WebMapContextTags.POSTCODE) == 0) { |
|
475 |
postCode = parser.nextText(); |
|
476 |
} else if (parser.getName().compareTo(WebMapContextTags.COUNTRY) == 0) { |
|
477 |
country = parser.nextText(); |
|
478 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_VOICE_TELEPHONE) == 0) { |
|
479 |
telephone = parser.nextText(); |
|
480 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_FACSIMILE_TELEPHONE) == 0) { |
|
481 |
fax = parser.nextText(); |
|
482 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_ELECTRONIC_MAIL_ADDRESS) == 0) { |
|
483 |
email = parser.nextText(); |
|
484 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_PERSON_PRIMARY) == 0) { |
|
485 |
// DO NOTHING |
|
486 |
} else if (parser.getName().compareTo(WebMapContextTags.CONTACT_ADDRESS) == 0) { |
|
487 |
// DO NOTHING |
|
488 |
} else { |
|
489 |
System.out.println("Unrecognized "+parser.getName()); |
|
490 |
} |
|
491 |
break; |
|
492 |
case KXmlParser.END_TAG: |
|
493 |
if (parser.getName().compareTo(WebMapContextTags.CONTACT_INFORMATION) == 0) { |
|
494 |
contactInfoEnd = true; |
|
495 |
} |
|
496 |
break; |
|
497 |
case KXmlParser.TEXT: |
|
498 |
if (parser.getName()!=null) { |
|
499 |
System.out.println("[TAG]["+parser.getName()+"]\n[TEXT]["+parser.getText().trim()+"]"); |
|
500 |
} |
|
501 |
break; |
|
502 |
} |
|
503 |
contactInfoTag = parser.next(); |
|
504 |
} |
|
505 |
} else { |
|
506 |
System.out.println("Unrecognized "+parser.getName()); |
|
507 |
} |
|
508 |
break; |
|
509 |
case KXmlParser.END_TAG: |
|
510 |
if (parser.getName().compareTo(WebMapContextTags.GENERAL) == 0) { |
|
511 |
end = true; |
|
512 |
} |
|
513 |
break; |
|
514 |
case KXmlParser.TEXT: |
|
515 |
if (parser.getName()!=null) { |
|
516 |
System.out.println("[TAG]["+parser.getName()+"]\n[TEXT]["+parser.getText().trim()+"]"); |
|
517 |
} |
|
518 |
break; |
|
519 |
} |
|
520 |
tag = parser.next(); |
|
521 |
} |
|
522 |
} |
|
523 |
|
|
524 |
@SuppressWarnings("unchecked") |
|
525 |
private void parseLayer1_1_0(KXmlParser parser, FLyrWMS layer, WMSDataParameters dataParameters) throws XmlPullParserException, IOException { |
|
526 |
boolean end = false; |
|
527 |
|
|
528 |
String queryable = parser.getAttributeValue("", WebMapContextTags.QUERYABLE); |
|
529 |
dataParameters.setQueryable(queryable!=null && (queryable.equals("1") || queryable.toLowerCase().equals("true"))); |
|
530 |
List<RemoteWMSStyle> styles = new ArrayList<RemoteWMSStyle>(); |
|
531 |
|
|
532 |
String hidden = parser.getAttributeValue("", WebMapContextTags.HIDDEN); |
|
533 |
layer.setVisible(hidden == null || !hidden.equals("1") || !hidden.toLowerCase().equals("true")); |
|
534 |
int tag = parser.next(); |
|
535 |
while (!end) { |
|
536 |
switch(tag) { |
|
537 |
case KXmlParser.START_TAG: |
|
538 |
if (parser.getName().compareTo(WebMapContextTags.SERVER) == 0) { |
|
539 |
String serverTitle = parser.getAttributeValue("", WebMapContextTags.TITLE.toLowerCase()); |
|
540 |
parser.nextTag(); |
|
541 |
if (parser.getName().compareTo(WebMapContextTags.ONLINE_RESOURCE) == 0) { |
|
542 |
dataParameters.setURI(parser.getAttributeValue("", WebMapContextTags.XLINK_HREF)); |
|
543 |
if (serverTitles == null) { |
|
544 |
serverTitles = new Hashtable<String, String>(); |
|
545 |
} |
|
546 |
serverTitles.put(parser.getAttributeValue("", WebMapContextTags.XLINK_HREF), serverTitle); |
|
547 |
} |
|
548 |
} else if (parser.getName().compareTo(WebMapContextTags.TITLE) == 0) { |
|
549 |
layer.setName(parser.nextText()); |
|
550 |
} else if (parser.getName().compareTo(WebMapContextTags.NAME) == 0) { |
|
551 |
dataParameters.setLayerQuery(parser.nextText()); |
|
552 |
/* //TODO This case would handle nested layer definitions. |
|
553 |
* |
|
554 |
} else if (parser.getName().compareTo(WebMapContextTags.LAYER) == 0) { |
|
555 |
FLyrWMS sonLayer = parseLayer1_1_0(parser); |
|
556 |
String q = layer.getLayerQuery(); |
|
557 |
if (q == null) q = ""; |
|
558 |
else q += ","; |
|
559 |
layer.setLayerQuery( q + sonLayer.getLayerQuery()); |
|
560 |
* |
|
561 |
*/ |
|
562 |
} else if (parser.getName().compareTo(WebMapContextTags.ABSTRACT) == 0) { |
|
563 |
if (layerAbstracts == null) { |
|
564 |
layerAbstracts = new Hashtable(); |
|
565 |
} |
|
566 |
layerAbstracts.put(layer, parser.nextText()); |
|
567 |
} else if (parser.getName().compareTo(WebMapContextTags.SRS) == 0) { |
|
568 |
String[] srss = parseEPSGList(parser.nextText()); |
|
569 |
if (srsList == null) { |
|
570 |
srsList = new Hashtable<Object, String[]>(); |
|
571 |
} |
|
572 |
srsList.put(layer, srss); |
|
573 |
} else if (parser.getName().compareTo(WebMapContextTags.FORMAT_LIST) == 0) { |
|
574 |
int formatsTag = parser.nextTag(); |
|
575 |
boolean bFormatsEnd = false; |
|
576 |
ArrayList formats = new ArrayList(); |
|
577 |
while (!bFormatsEnd) { |
|
578 |
switch (formatsTag) { |
|
579 |
case KXmlParser.START_TAG: |
|
580 |
if (parser.getName().compareTo(WebMapContextTags.FORMAT) == 0) { |
|
581 |
String current = parser.getAttributeValue("", WebMapContextTags.CURRENT); |
|
582 |
String format = parser.nextText(); |
|
583 |
if (current!=null && current.equals("1")) { |
|
584 |
dataParameters.setFormat(format); |
|
585 |
} |
|
586 |
formats.add(format); |
|
587 |
} else { |
|
588 |
log.info("Unrecognized " + parser.getName()); |
|
589 |
} |
|
590 |
break; |
|
591 |
case KXmlParser.END_TAG: |
|
592 |
if (parser.getName().compareTo(WebMapContextTags.FORMAT_LIST) == 0) { |
|
593 |
bFormatsEnd = true; |
|
594 |
} |
|
595 |
break; |
|
596 |
case KXmlParser.TEXT: |
|
597 |
if (parser.getName()!=null) { |
|
598 |
log.info("[TAG]["+parser.getName()+"]\n[TEXT]["+parser.getText().trim()+"]"); |
|
599 |
} |
|
600 |
break; |
|
601 |
} |
|
602 |
formatsTag = parser.next(); |
|
603 |
} |
|
604 |
if (layerFormats == null) { |
|
605 |
layerFormats = new Hashtable(); |
|
606 |
} |
|
607 |
layerFormats.put(layer, formats.toArray(new String[0])); |
|
608 |
|
|
609 |
} else if (parser.getName().compareTo(WebMapContextTags.STYLE_LIST) == 0) { |
|
610 |
int stylesTag = parser.nextTag(); |
|
611 |
boolean bStylesEnd = false; |
|
612 |
while (!bStylesEnd) { |
|
613 |
switch (stylesTag) { |
|
614 |
case KXmlParser.START_TAG: |
|
615 |
if (parser.getName().compareTo(WebMapContextTags.STYLE) == 0) { |
|
616 |
String current = parser.getAttributeValue("", WebMapContextTags.CURRENT); |
|
617 |
RemoteWMSStyle style = parseStyle1_1_0(parser); |
|
618 |
|
|
619 |
if (current!=null && current.equals("1") && !style.getName().equals("default")) { |
|
620 |
style.setName("default"); |
|
621 |
} |
|
622 |
styles.add(style); |
|
623 |
} else { |
|
624 |
System.out.println("Unrecognized "+parser.getName()); |
|
625 |
} |
|
626 |
break; |
|
627 |
case KXmlParser.END_TAG: |
|
628 |
if (parser.getName().compareTo(WebMapContextTags.STYLE_LIST) == 0) { |
|
629 |
bStylesEnd = true; |
|
630 |
} |
|
631 |
break; |
|
632 |
case KXmlParser.TEXT: |
|
633 |
if (parser.getName()!=null) { |
|
634 |
System.out.println("[TAG]["+parser.getName()+"]\n[TEXT]["+parser.getText().trim()+"]"); |
|
635 |
} |
|
636 |
break; |
|
637 |
} |
|
638 |
stylesTag = parser.next(); |
|
639 |
} |
|
640 |
if (layerStyles == null) { |
|
641 |
layerStyles = new Hashtable(); |
|
642 |
} |
|
643 |
|
|
644 |
layerStyles.put(layer, styles.toArray(new RemoteWMSStyle[0])); |
|
645 |
} else { |
|
646 |
log.info("Unrecognized " + parser.getName()); |
|
647 |
} |
|
648 |
break; |
|
649 |
case KXmlParser.END_TAG: |
|
650 |
if (parser.getName().compareTo(WebMapContextTags.LAYER) == 0) { |
|
651 |
end = true; |
|
652 |
} |
|
653 |
break; |
|
654 |
case KXmlParser.TEXT: |
|
655 |
if (parser.getName()!=null) { |
|
656 |
System.out.println("[TAG]["+parser.getName()+"]\n[TEXT]["+parser.getText().trim()+"]"); |
|
657 |
} |
|
658 |
break; |
|
659 |
} |
|
660 |
tag = parser.next(); |
|
661 |
} |
|
662 |
dataParameters.setStyles(styles); |
|
663 |
} |
|
664 |
|
|
665 |
private String[] parseEPSGList(String nextText) { |
|
666 |
String[] epsglist = nextText.split(","); |
|
667 |
return epsglist;//Arrays.asList(epsglist); |
|
668 |
} |
Also available in: Unified diff