Revision 2774
org.gvsig.raster.wms/tags/v2.2.2/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.2/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.2</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.31</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.2</connection> |
|
37 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wms/tags/v2.2.2</developerConnection> |
|
38 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.wms/tags/v2.2.2</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.2</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.2/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.2</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>final</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.2/org.gvsig.raster.wms.app.wmsclient/buildNumber.properties | ||
---|---|---|
1 |
#Fri Mar 28 14:03:30 CET 2014 |
|
2 |
buildNumber=55 |
|
0 | 3 |
org.gvsig.raster.wms/tags/v2.2.2/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.2/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/layer/ComposedLayerWMS.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 |
package org.gvsig.raster.wms.app.wmsclient.layer; |
|
23 |
|
|
24 |
import java.awt.Graphics2D; |
|
25 |
import java.awt.image.BufferedImage; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.compat.print.PrintAttributes; |
|
29 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
30 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer; |
|
33 |
import org.gvsig.raster.wms.io.RemoteWMSStyle; |
|
34 |
import org.gvsig.tools.task.Cancellable; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* Group WMS layers to make a single request to the |
|
39 |
* server for all layers. |
|
40 |
* |
|
41 |
* It is posible only if almost all params are the same. For this |
|
42 |
* comparasion, ComposedLayerWMS uses the method |
|
43 |
* {@link org.gvsig.wms.fmap.layers.FLyrWMS#isComposedLayerCompatible(com.iver.cit.gvsig.fmap.layers.FLayer)} |
|
44 |
* |
|
45 |
* |
|
46 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer |
|
47 |
* @see org.gvsig.wms.fmap.layers.FLyrWMS |
|
48 |
*/ |
|
49 |
public class ComposedLayerWMS extends ComposedLayer { |
|
50 |
private FLyrWMS layer=null; |
|
51 |
|
|
52 |
/* (non-Javadoc) |
|
53 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer#canAdd(com.iver.cit.gvsig.fmap.layers.FLayer) |
|
54 |
*/ |
|
55 |
public boolean canAdd(FLayer layer) { |
|
56 |
if (this.layer != null) { |
|
57 |
return this.layer.isComposedLayerCompatible(layer); |
|
58 |
} |
|
59 |
return false; |
|
60 |
} |
|
61 |
|
|
62 |
public void doAdd(FLayer layer) throws Exception { |
|
63 |
FLyrWMS aLayer = (FLyrWMS)layer; |
|
64 |
if (this.layer == null) { |
|
65 |
this.layer = new FLyrWMS(); |
|
66 |
//this.layer.setXMLEntity(aLayer.getXMLEntity()); |
|
67 |
return; |
|
68 |
} |
|
69 |
this.layer.getParameters().setLayerQuery( this.layer.getParameters().getLayerQuery() + ","+ aLayer.getParameters().getLayerQuery()); |
|
70 |
List<RemoteWMSStyle> aStyles = aLayer.getParameters().getStyles(); |
|
71 |
|
|
72 |
if (aStyles != null) { |
|
73 |
List<RemoteWMSStyle> myStyles = this.layer.getParameters().getStyles(); |
|
74 |
if (myStyles == null) { |
|
75 |
this.layer.getParameters().setStyles(aStyles); |
|
76 |
} else { |
|
77 |
myStyles.addAll(aStyles); |
|
78 |
this.layer.getParameters().setStyles(myStyles); |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
//revisar el fullextend para ajustarlo a todas las capas |
|
83 |
this.layer.getFullEnvelope().add(aLayer.getFullEnvelope()); |
|
84 |
|
|
85 |
} |
|
86 |
|
|
87 |
|
|
88 |
@Override |
|
89 |
protected void doDraw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
90 |
Cancellable cancel, double scale) |
|
91 |
throws ReadException { |
|
92 |
this.layer.draw(image, g, viewPort, cancel, scale); |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
protected void doPrint(Graphics2D g, ViewPort viewPort, |
|
98 |
Cancellable cancel, |
|
99 |
double scale, |
|
100 |
PrintAttributes properties) throws ReadException { |
|
101 |
this.layer.print(g, viewPort, cancel, scale, properties); |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
} |
|
0 | 106 |
org.gvsig.raster.wms/tags/v2.2.2/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/layer/DynObjectIteratorWMSInfo.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 |
package org.gvsig.raster.wms.app.wmsclient.layer; |
|
23 |
|
|
24 |
import java.util.ArrayList; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.feature.Feature; |
|
27 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
28 |
import org.gvsig.tools.dynobject.DynObject; |
|
29 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
30 |
|
|
31 |
/** |
|
32 |
* {@link DynObject} implementation to facade a iterator of a WMTSInfo |
|
33 |
* and allow to be used as a {@link DynObjectSet} iterator. |
|
34 |
* |
|
35 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
36 |
* @version $Id$ |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class DynObjectIteratorWMSInfo implements DisposableIterator { |
|
40 |
|
|
41 |
private ArrayList<Object> infoList = new ArrayList<Object>(); |
|
42 |
private int index = -1; |
|
43 |
|
|
44 |
/** |
|
45 |
* Creates a new DynObjects iterator facade over a feature iterator. |
|
46 |
* Each WMTSInfo will be returned through a new or reused |
|
47 |
* {@link DynObjectWMTSInfo} which allows the {@link Feature} to be |
|
48 |
* used like a DynObject. |
|
49 |
* |
|
50 |
* @param featureIterator |
|
51 |
* to facade |
|
52 |
* @param featureFacade |
|
53 |
* if not null this object will be reused as the facade for the |
|
54 |
* Feature objects of the feature iterator |
|
55 |
*/ |
|
56 |
public DynObjectIteratorWMSInfo(Object info) { |
|
57 |
this.infoList.add(info); |
|
58 |
index = 0; |
|
59 |
} |
|
60 |
|
|
61 |
public void addObject(Object info) { |
|
62 |
this.infoList.add(info); |
|
63 |
if(index == -1) |
|
64 |
index = 0; |
|
65 |
} |
|
66 |
|
|
67 |
public synchronized void dispose() { |
|
68 |
this.infoList.clear(); |
|
69 |
index = -1; |
|
70 |
} |
|
71 |
|
|
72 |
public synchronized boolean hasNext() { |
|
73 |
return (infoList.size() == 0 || index >= infoList.size()) ? false : true; |
|
74 |
} |
|
75 |
|
|
76 |
public synchronized Object next() { |
|
77 |
Object o = infoList.get(index); |
|
78 |
index ++; |
|
79 |
return o; |
|
80 |
} |
|
81 |
|
|
82 |
public synchronized void remove() { |
|
83 |
if(index < infoList.size() && index >= 0) { |
|
84 |
index --; |
|
85 |
infoList.remove(index); |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
public long getSize() { |
|
90 |
return infoList.size(); |
|
91 |
} |
|
92 |
} |
|
0 | 93 |
org.gvsig.raster.wms/tags/v2.2.2/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/layer/DynObjectSetWMSInfo.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 |
package org.gvsig.raster.wms.app.wmsclient.layer; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
25 |
import org.gvsig.tools.ToolsLocator; |
|
26 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
27 |
import org.gvsig.tools.dynobject.DynClass; |
|
28 |
import org.gvsig.tools.dynobject.DynObject; |
|
29 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
30 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
31 |
import org.gvsig.tools.exception.BaseException; |
|
32 |
import org.gvsig.tools.observer.Observable; |
|
33 |
import org.gvsig.tools.observer.Observer; |
|
34 |
import org.gvsig.tools.observer.impl.BaseWeakReferencingObservable; |
|
35 |
import org.gvsig.tools.visitor.Visitor; |
|
36 |
|
|
37 |
/** |
|
38 |
* {@link DynObject} implementation to facade of a {@link FeatureSet} and allow |
|
39 |
* to be used as a {@link DynObjectSet}. |
|
40 |
* |
|
41 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
42 |
* @version $Id$ |
|
43 |
*/ |
|
44 |
public class DynObjectSetWMSInfo extends BaseWeakReferencingObservable |
|
45 |
implements DynObjectSet, Observer { |
|
46 |
//public static final int TYPE_TEXT = 0; |
|
47 |
//public static final int TYPE_HTML = 1; |
|
48 |
//public static final int TYPE_XML = 2; |
|
49 |
private DynObjectIteratorWMSInfo ite = null; |
|
50 |
private DynObject dynObject = null; |
|
51 |
private String type = "text/plain"; |
|
52 |
|
|
53 |
public static void registerDynClass() { |
|
54 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
|
55 |
DynClass dynClass = manager.add("WMSInfoByPoint", "WMS InfoByPoint"); |
|
56 |
dynClass.setNamespace("InfoByPoint"); |
|
57 |
dynClass.addDynFieldString("info"); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Creates a new facade over a given info, with fast dynobject |
|
62 |
* iteration. |
|
63 |
*/ |
|
64 |
public DynObjectSetWMSInfo(String txt, String type) { |
|
65 |
DynObjectManager manager = ToolsLocator.getDynObjectManager(); |
|
66 |
dynObject = manager.createDynObject("WMSInfoByPoint"); |
|
67 |
dynObject.setDynValue("info", txt); |
|
68 |
ite = new DynObjectIteratorWMSInfo(dynObject); |
|
69 |
this.type = type; |
|
70 |
/*if(type == TYPE_HTML) |
|
71 |
this.type = "text/html"; |
|
72 |
if(type == TYPE_XML) |
|
73 |
this.type = "text/xml"; |
|
74 |
if(type == TYPE_TEXT) |
|
75 |
this.type = "text/plain";*/ |
|
76 |
} |
|
77 |
|
|
78 |
public String getTypeInfo() { |
|
79 |
return this.type; |
|
80 |
} |
|
81 |
|
|
82 |
public String getInfoElement() { |
|
83 |
return (String)dynObject.getDynValue("info"); |
|
84 |
} |
|
85 |
|
|
86 |
public void dispose() { |
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
public void accept(final Visitor visitor, long firstValueIndex) throws BaseException { |
|
91 |
while(ite.hasNext()) { |
|
92 |
visitor.visit(ite.next()); |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
public void accept(final Visitor visitor) throws BaseException { |
|
97 |
while(ite.hasNext()) { |
|
98 |
visitor.visit(ite.next()); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
public long getSize() throws BaseException { |
|
103 |
return ite.getSize(); |
|
104 |
} |
|
105 |
|
|
106 |
public DisposableIterator iterator(long index) throws BaseException { |
|
107 |
return iterator(); |
|
108 |
} |
|
109 |
|
|
110 |
public DisposableIterator iterator() throws BaseException { |
|
111 |
return ite; |
|
112 |
} |
|
113 |
|
|
114 |
public boolean isEmpty() throws BaseException { |
|
115 |
return (getSize() == 0); |
|
116 |
} |
|
117 |
|
|
118 |
public boolean isDeleteEnabled() { |
|
119 |
return true; |
|
120 |
} |
|
121 |
|
|
122 |
public void delete(DynObject dynObject) throws BaseException { |
|
123 |
|
|
124 |
} |
|
125 |
|
|
126 |
public boolean isUpdateEnabled() { |
|
127 |
return true; |
|
128 |
} |
|
129 |
|
|
130 |
public void update(DynObject dynObject) throws BaseException { |
|
131 |
System.out.println(); |
|
132 |
} |
|
133 |
|
|
134 |
public void update(Observable observable, Object notification) { |
|
135 |
System.out.println(); |
|
136 |
} |
|
137 |
} |
|
0 | 138 |
org.gvsig.raster.wms/tags/v2.2.2/org.gvsig.raster.wms.app.wmsclient/src/main/java/org/gvsig/raster/wms/app/wmsclient/layer/FLyrWMS.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.layer; |
|
24 |
|
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.Graphics2D; |
|
27 |
import java.awt.Image; |
|
28 |
import java.awt.Point; |
|
29 |
import java.awt.Rectangle; |
|
30 |
import java.awt.geom.AffineTransform; |
|
31 |
import java.awt.geom.NoninvertibleTransformException; |
|
32 |
import java.awt.geom.Point2D; |
|
33 |
import java.awt.geom.Rectangle2D; |
|
34 |
import java.awt.image.BufferedImage; |
|
35 |
import java.lang.ref.WeakReference; |
|
36 |
import java.util.ArrayList; |
|
37 |
import java.util.HashMap; |
|
38 |
import java.util.Iterator; |
|
39 |
import java.util.List; |
|
40 |
import java.util.Vector; |
|
41 |
import java.util.prefs.Preferences; |
|
42 |
|
|
43 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
44 |
import javax.swing.JOptionPane; |
|
45 |
|
|
46 |
import org.cresques.cts.ICoordTrans; |
|
47 |
import org.cresques.cts.IProjection; |
|
48 |
import org.gvsig.andami.PluginServices; |
|
49 |
import org.gvsig.fmap.dal.DALLocator; |
|
50 |
import org.gvsig.fmap.dal.DataManager; |
|
51 |
import org.gvsig.fmap.dal.DataParameters; |
|
52 |
import org.gvsig.fmap.dal.DataStore; |
|
53 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
54 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
55 |
import org.gvsig.fmap.dal.coverage.RasterManager; |
|
56 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
57 |
import org.gvsig.fmap.dal.coverage.datastruct.ViewPortData; |
|
58 |
import org.gvsig.fmap.dal.coverage.exception.FilePaletteException; |
|
59 |
import org.gvsig.fmap.dal.coverage.exception.InfoByPointException; |
|
60 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
61 |
import org.gvsig.fmap.dal.coverage.exception.QueryException; |
|
62 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
63 |
import org.gvsig.fmap.dal.coverage.grid.RasterFilter; |
|
64 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
65 |
import org.gvsig.fmap.dal.coverage.store.parameter.RasterDataParameters; |
|
66 |
import org.gvsig.fmap.dal.coverage.store.parameter.RemoteStoreParameters; |
|
67 |
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
|
68 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
69 |
import org.gvsig.fmap.dal.exception.DataException; |
|
70 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
71 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
72 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
73 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
74 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
75 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
76 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
77 |
import org.gvsig.fmap.geom.GeometryManager; |
|
78 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
79 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
80 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
81 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
82 |
import org.gvsig.fmap.mapcontext.exceptions.UnsupportedVersionLayerException; |
|
83 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
84 |
import org.gvsig.fmap.mapcontext.layers.Tiling; |
|
85 |
import org.gvsig.fmap.mapcontext.layers.operations.ComposedLayer; |
|
86 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
87 |
import org.gvsig.gui.beans.Messages; |
|
88 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
|
89 |
import org.gvsig.raster.fmap.layers.IRasterLayerActions; |
|
90 |
import org.gvsig.raster.fmap.layers.NotAvailableStateException; |
|
91 |
import org.gvsig.raster.fmap.legend.ImageLegend; |
|
92 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
93 |
import org.gvsig.raster.wms.app.wmsclient.wmc.WebMapContextTags; |
|
94 |
import org.gvsig.raster.wms.app.wmsclient.wmc.XmlBuilder; |
|
95 |
import org.gvsig.raster.wms.io.RemoteWMSStyle; |
|
96 |
import org.gvsig.raster.wms.io.WMSDataParameters; |
|
97 |
import org.gvsig.raster.wms.io.WMSLayerNode; |
|
98 |
import org.gvsig.raster.wms.io.WMSServerExplorer; |
|
99 |
import org.gvsig.raster.wms.io.WMSServerExplorerParameters; |
|
100 |
import org.gvsig.tools.ToolsLocator; |
|
101 |
import org.gvsig.tools.dynobject.DynObjectSet; |
|
102 |
import org.gvsig.tools.dynobject.DynStruct; |
|
103 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
104 |
import org.gvsig.tools.task.Cancellable; |
|
105 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
106 |
import org.gvsig.tools.task.TaskStatusManager; |
|
107 |
import org.slf4j.Logger; |
|
108 |
import org.slf4j.LoggerFactory; |
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
/** |
|
113 |
* FMap's WMS Layer class. |
|
114 |
* |
|
115 |
* Las capas WMS son tileadas para descargarlas del servidor. Esto quiere decir que |
|
116 |
* est?n formadas por multiples ficheros raster. Por esto la fuente de datos raster (IRasterDatasource) |
|
117 |
* de la capa FLyrWMS es un objeto de tipo CompositeDataset. Este objeto est? compuesto por un array |
|
118 |
* bidimensional de MultiRasterDataset. Cada uno de los MultiRasterDataset corresponde con un tile |
|
119 |
* salvado en disco. Estos MultiRasterDataset se crean cada vez que se repinta ya que en WMS a cada |
|
120 |
* zoom varian los ficheros fuente. La secuencia de creaci?n de un CompositeDataset ser?a la siguiente: |
|
121 |
* <UL> |
|
122 |
* <LI>Se hace una petici?n de dibujado por parte del usuario llamando al m?todo draw de FLyrWMS</LI> |
|
123 |
* <LI>Se tilea la petici?n</LI> |
|
124 |
* <LI>Cada tile se dibuja abriendo una FLyerRaster para ese tile</LI> |
|
125 |
* <LI>Si es el primer dibujado se guarda una referencia en la capa WMS a las propiedades de renderizado, orden de bandas, |
|
126 |
* transparencia, filtros aplicados, ...</LI> |
|
127 |
* <LI>Si no es el primer dibujado se asignan las propiedades de renderizado cuya referencia se guarda en la capa WMS</LI> |
|
128 |
* <LI>Se guarda el MultiRasterDataset de cada tile</LI> |
|
129 |
* <LI>Al acabar todos los tiles creamos un CompositeDataset con los MultiRasterDataset de todos los tiles</LI> |
|
130 |
* <LI>Asignamos a la capa la referencia de las propiedades de renderizado que tenemos almacenadas. De esta forma si hay |
|
131 |
* alguna modificaci?n desde el cuadro de propiedades ser? efectiva sobre los tiles que se dibujan.</LI> |
|
132 |
* </UL> |
|
133 |
* |
|
134 |
* |
|
135 |
* @author Jaume Dominguez Faus |
|
136 |
* |
|
137 |
*/ |
|
138 |
@SuppressWarnings("deprecation") |
|
139 |
public class FLyrWMS extends DefaultFLyrRaster { |
|
140 |
public static final String PERSISTENT_NAME = "FLyrWMS_Persistent"; |
|
141 |
public static final String PERSISTENT_DESCRIPTION = "FLyrWMS Persistent Definition"; |
|
142 |
|
|
143 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
144 |
private static final Logger logger = LoggerFactory.getLogger(FLyrWMS.class); |
|
145 |
private boolean mustSplitRequest = false; |
|
146 |
private final int maxTileDrawWidth = 1023; |
|
147 |
private final int maxTileDrawHeight = 1023; |
|
148 |
private final int maxTilePrintWidth = 1023; |
|
149 |
private final int maxTilePrintHeight = 1023; |
|
150 |
private List<WeakReference<Thread>> disableUpdateDrawVersion; |
|
151 |
//private Envelope fullEnvelope = null; |
|
152 |
private boolean firstLoad = false; |
|
153 |
private RasterManager rManager = RasterLocator.getManager(); |
|
154 |
//private WMSServerExplorer explorer = null; |
|
155 |
private boolean deleteCache = false; |
|
156 |
|
|
157 |
public FLyrWMS() { |
|
158 |
super(); |
|
159 |
this.updateDrawVersion(); |
|
160 |
try { |
|
161 |
enableAwake(); |
|
162 |
} catch (NotAvailableStateException e) { |
|
163 |
logger.error("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), this, e); |
|
164 |
} |
|
165 |
} |
|
166 |
|
|
167 |
public FLyrWMS(DataStoreParameters dataStoreParameters) throws Exception { |
|
168 |
this(); |
|
169 |
//Create the explorer and connect |
|
170 |
DataManager dataManager = DALLocator.getDataManager(); |
|
171 |
WMSServerExplorerParameters explorerParams = (WMSServerExplorerParameters) |
|
172 |
dataManager.createServerExplorerParameters(WMSServerExplorer.NAME); |
|
173 |
explorerParams.setHost((String)dataStoreParameters.getDynValue("uri")); |
|
174 |
WMSServerExplorer wmsServerExplorer = |
|
175 |
(WMSServerExplorer) dataManager.openServerExplorer(WMSServerExplorer.NAME, explorerParams); |
|
176 |
wmsServerExplorer.connect(null, ((RemoteStoreParameters)dataStoreParameters).isDeletingCache()); |
|
177 |
|
|
178 |
//Set the parameters |
|
179 |
setParameters((WMSDataParameters)dataStoreParameters); |
|
180 |
setExplorer(wmsServerExplorer); |
|
181 |
} |
|
182 |
|
|
183 |
public static DataStore createDataStore(String host, IProjection srs) throws InitializeException { |
|
184 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
185 |
RasterDataParameters params = null; |
|
186 |
try { |
|
187 |
params = (RasterDataParameters)dataman.createServerExplorerParameters(WMSServerExplorer.NAME); |
|
188 |
} catch (InitializeException e) { |
|
189 |
return null; |
|
190 |
} catch (ProviderNotRegisteredException e) { |
|
191 |
return null; |
|
192 |
} |
|
193 |
params.setURI(host); |
|
194 |
params.setSRS(srs); |
|
195 |
|
|
196 |
try { |
|
197 |
return dataman.openStore(params.getDataStoreName(), params); |
|
198 |
} catch (ValidateDataParametersException e) { |
|
199 |
throw new InitializeException(e); |
|
200 |
} catch (ProviderNotRegisteredException e) { |
|
201 |
throw new InitializeException(e); |
|
202 |
} |
|
203 |
} |
|
204 |
|
|
205 |
public void setDataStore(DataStore dataStore) throws LoadLayerException { |
|
206 |
this.dataStore = (RasterDataStore) dataStore; |
|
207 |
try { |
|
208 |
this.dataStore.isOpen(); |
|
209 |
if(!isOpen()) |
|
210 |
enableOpen(); |
|
211 |
} catch (NotAvailableStateException e) { |
|
212 |
logger.error("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), this, e); |
|
213 |
} |
|
214 |
setProjection(this.dataStore.getProjection()); |
|
215 |
} |
|
216 |
|
|
217 |
/** |
|
218 |
* It choose the best format to load different maps if the server |
|
219 |
* supports it. This format could be png, because it supports |
|
220 |
* transparency. |
|
221 |
* @param formats |
|
222 |
* Arraywith all the formats supported by the server |
|
223 |
* @return |
|
224 |
*/ |
|
225 |
@SuppressWarnings("unused") |
|
226 |
private String getGreatFormat(Vector<String> formats){ |
|
227 |
for (int i = 0 ; i < formats.size() ; i++){ |
|
228 |
String format = (String) formats.get(i); |
|
229 |
if (format.equals("image/jpg")){ |
|
230 |
return format; |
|
231 |
} |
|
232 |
if (format.equals("image/jpeg")){ |
|
233 |
return format; |
|
234 |
} |
|
235 |
} |
|
236 |
return (String)formats.get(0); |
|
237 |
} |
|
238 |
|
|
239 |
public static void registerPersistent() { |
|
240 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
241 |
DynStruct definition = manager.getDefinition("FLyrWMS_Persistent"); |
|
242 |
if( definition == null ) { |
|
243 |
if (manager.getDefinition(DefaultFLyrRaster.class) == null) { |
|
244 |
DefaultFLyrRaster.registerPersistent(); |
|
245 |
} |
|
246 |
|
|
247 |
definition = manager.addDefinition( |
|
248 |
FLyrWMS.class, |
|
249 |
"FLyrWMS_Persistent", |
|
250 |
"FLyrWMS Persistent Definition", |
|
251 |
null, |
|
252 |
null |
|
253 |
); |
|
254 |
|
|
255 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, DefaultFLyrRaster.PERSISTENT_NAME); |
|
256 |
} |
|
257 |
|
|
258 |
DefaultFLyrRaster.registerPersistence(definition); |
|
259 |
} |
|
260 |
|
|
261 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
262 |
Cancellable cancel, double scale) throws ReadException { |
|
263 |
TaskStatusManager manager = ToolsLocator.getTaskStatusManager(); |
|
264 |
SimpleTaskStatus taskStatus = new RasterTaskStatus("Drawing " + getName() + "...", cancel); |
|
265 |
manager.add(taskStatus); |
|
266 |
taskStatus.setAutoremove(true); |
|
267 |
splitRequestCalculation(viewPort.getImageWidth(), viewPort.getImageHeight()); |
|
268 |
|
|
269 |
if(!firstLoad) { |
|
270 |
try { |
|
271 |
initFilters(); |
|
272 |
try { |
|
273 |
if(!isOpen()) |
|
274 |
enableOpen(); |
|
275 |
} catch (NotAvailableStateException e) { |
|
276 |
throw new ReadException("Fallo el estado de open. Closed=" + isClosed() + " Awake=" + isAwake(), e); |
|
277 |
} |
|
278 |
} catch (FilePaletteException e) { |
|
279 |
logger.error(e.getMessage(), this, e); |
|
280 |
} |
|
281 |
firstLoad = true; |
|
282 |
} |
|
283 |
|
|
284 |
enableStopped(); |
|
285 |
|
|
286 |
if(recalcLevel) { |
|
287 |
double pixelSize = viewPort.getEnvelope().getLength(0) / (double)viewPort.getImageWidth(); |
|
288 |
zoomLevel = dataStore.getNearestLevel(pixelSize); |
|
289 |
} |
|
290 |
recalcLevel = true; |
|
291 |
|
|
292 |
if (isWithinScale(scale)) { |
|
293 |
|
|
294 |
if(mustSplitRequest) { |
|
295 |
Point2D p = viewPort.getOffset(); |
|
296 |
Rectangle r = new Rectangle((int) p.getX(), (int) p.getY(), viewPort.getImageWidth(), viewPort.getImageHeight()); |
|
297 |
Tiling tiles = new Tiling(maxTileDrawWidth, maxTileDrawHeight, r); |
|
298 |
tiles.setAffineTransform((AffineTransform) viewPort.getAffineTransform().clone()); |
|
299 |
|
|
300 |
for (int tileNr = 0; tileNr < tiles.getNumTiles(); tileNr++) { |
|
301 |
// drawing part |
|
302 |
try { |
|
303 |
ViewPort vp = tiles.getTileViewPort(viewPort, tileNr); |
|
304 |
drawTile(g, vp, taskStatus, scale); |
|
305 |
} catch (LoadLayerException e) { |
|
306 |
throw new ReadException(e.getMessage(), e); |
|
307 |
} catch (NoninvertibleTransformException e) { |
|
308 |
throw new ReadException(e.getMessage(), e); |
|
309 |
} |
|
310 |
} |
|
311 |
} else { |
|
312 |
try { |
|
313 |
drawTile(g, viewPort, taskStatus, scale); |
|
314 |
} catch (LoadLayerException e) { |
|
315 |
setAvailable(false); |
|
316 |
logger.error("Server error:" + e.getMessage(), e); |
|
317 |
} |
|
318 |
} |
|
319 |
} |
|
320 |
disableStopped(); |
|
321 |
} |
|
322 |
|
|
323 |
|
|
324 |
/** |
|
325 |
* This is the method used to draw a tile in a WMS mosaic layer. |
|
326 |
* @throws LoadLayerException |
|
327 |
* @throws ReadDriverException |
|
328 |
* @return true when a tile has been painted |
|
329 |
*/ |
|
330 |
private void drawTile(Graphics2D g, ViewPort vp, SimpleTaskStatus taskStatus, double scale) throws LoadLayerException, ReadException { |
|
331 |
|
|
332 |
// Compute the query geometry |
|
333 |
// 1. Check if it is within borders |
|
334 |
Envelope envelope = getFullEnvelope(); |
|
335 |
Envelope vpEnv = vp.getAdjustedExtent(); |
|
336 |
if (!vpEnv.intersects(envelope)) { |
|
337 |
return; |
|
338 |
} |
|
339 |
|
|
340 |
// 2. Compute extent to be requested. |
|
341 |
Rectangle2D bBox = new Rectangle2D.Double(); |
|
342 |
Rectangle2D.intersect(getRectable2DFromEnvelope(vpEnv), |
|
343 |
getRectable2DFromEnvelope(envelope), bBox); |
|
344 |
|
|
345 |
// 3. Compute size in pixels |
|
346 |
double scalex = vp.getAffineTransform().getScaleX(); |
|
347 |
double scaley = vp.getAffineTransform().getScaleY(); |
|
348 |
int wImg = (int) Math.ceil(Math.abs(bBox.getWidth() * scalex) + 1); |
|
349 |
int hImg = (int) Math.ceil(Math.abs(bBox.getHeight() * scaley) + 1); |
|
350 |
|
|
351 |
Dimension sz = new Dimension(wImg, hImg); |
|
352 |
|
|
353 |
if ((wImg <= 0) || (hImg <= 0)) { |
|
354 |
return; |
|
355 |
} |
|
356 |
|
|
357 |
//try { |
|
358 |
|
|
359 |
Rectangle2D extent = new Rectangle2D.Double(); |
|
360 |
Rectangle2D.Double vpExtent = this.getRectable2DFromEnvelope(vpEnv); |
|
361 |
Rectangle2D.intersect(vpExtent, bBox, extent); |
|
362 |
|
|
363 |
Extent ex = rManager.getDataStructFactory().createExtent( |
|
364 |
vp.getAdjustedEnvelope().getMinimum(0), |
|
365 |
vp.getAdjustedEnvelope().getMaximum(1), |
|
366 |
vp.getAdjustedEnvelope().getMaximum(0), |
|
367 |
vp.getAdjustedEnvelope().getMinimum(1)); |
|
368 |
ViewPortData vpData = rManager.getDataStructFactory().createViewPortData(vp.getProjection(), ex, sz ); |
|
369 |
vpData.setMat(vp.getAffineTransform()); |
|
370 |
|
|
371 |
try { |
|
372 |
getParameters().setExtent(bBox); |
|
373 |
if(getParameters().isSizeFixed()) { |
|
374 |
getParameters().setWidth((int)getParameters().getFixedSize().getWidth()); |
|
375 |
getParameters().setHeight((int)getParameters().getFixedSize().getHeight()); |
|
376 |
} else { |
|
377 |
getParameters().setWidth(wImg); |
|
378 |
getParameters().setHeight(hImg); |
|
379 |
} |
|
380 |
|
|
381 |
if(getDataStore().getParameters() instanceof WMSDataParameters) { |
|
382 |
getRender().draw(g, vpData, taskStatus); |
|
383 |
} else { |
|
384 |
Envelope adjustedExtent = vp.getAdjustedExtent(); |
|
385 |
Extent e = rManager.getDataStructFactory().createExtent(adjustedExtent.getLowerCorner().getX(), |
|
386 |
adjustedExtent.getUpperCorner().getY(), adjustedExtent.getUpperCorner().getX(), |
|
387 |
adjustedExtent.getLowerCorner().getY()); |
|
388 |
ViewPortData vp2 = rManager.getDataStructFactory().createViewPortData(vp.getProjection(), e, vp.getImageSize() ); |
|
389 |
vp2.setMat(vp.getAffineTransform()); |
|
390 |
getParameters().setExtent(ex.toRectangle2D()); |
|
391 |
getRender().drawTiledService(g, vp2, vp.getImageSize(), taskStatus); |
|
392 |
} |
|
393 |
//this.updateDrawVersion(); |
|
394 |
|
|
395 |
} catch (ProcessInterruptedException e) { |
|
396 |
} catch (QueryException e) { |
|
397 |
setAvailable(false); |
|
398 |
JOptionPane.showMessageDialog(null, "Problems drawing this layer:" + e.getMessage(), Messages.getText("Error"), JOptionPane.ERROR_MESSAGE); |
|
399 |
logger.info("Problems drawing this layer:" + e.getMessage(), e); |
|
400 |
} finally { |
|
401 |
taskStatus.terminate(); |
|
402 |
} |
|
403 |
|
|
404 |
/*} catch (RemoteServiceException e) { |
|
405 |
if (!taskStatus.isCancellationRequested()) { |
|
406 |
if (callCount < MAX_RETRY_TIMES) { |
|
407 |
logger.warn("\n[ FLyrWMS.drawFixedSize() ] Failed in trying " + callCount + "/" + MAX_RETRY_TIMES + ")\n"); // mess code |
|
408 |
drawTile(g, vp, taskStatus, scale); |
|
409 |
} else { |
|
410 |
if (!isPrinting) { |
|
411 |
this.setVisible(false); |
|
412 |
} |
|
413 |
logger.error("Server error:" + e.getMessage(), e); |
|
414 |
} |
|
415 |
} |
|
416 |
}*/ |
|
417 |
return; |
|
418 |
} |
|
419 |
|
|
420 |
/** |
|
421 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, |
|
422 |
* com.iver.cit.gvsig.fmap.ViewPort, |
|
423 |
* com.iver.cit.gvsig.fmap.operations.Cancellable) |
|
424 |
*/ |
|
425 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, double scale, PrintRequestAttributeSet properties) |
|
426 |
throws ReadException { |
|
427 |
TaskStatusManager manager = ToolsLocator.getTaskStatusManager(); |
|
428 |
SimpleTaskStatus taskStatus = new RasterTaskStatus("Printing " + getName() + "...", cancel); |
|
429 |
manager.add(taskStatus); |
|
430 |
taskStatus.setAutoremove(true); |
|
431 |
splitRequestCalculation(viewPort.getImageWidth(), viewPort.getImageHeight()); |
|
432 |
|
|
433 |
if (isVisible() && isWithinScale(scale)){ |
|
434 |
if (!mustSplitRequest) { |
|
435 |
draw(null, g, viewPort, cancel,scale); |
|
436 |
} else { |
|
437 |
Tiling tiles = new Tiling(maxTilePrintWidth, maxTilePrintHeight, g.getClipBounds()); |
|
438 |
tiles.setAffineTransform((AffineTransform) viewPort.getAffineTransform().clone()); |
|
439 |
for (int tileNr = 0; tileNr < tiles.getNumTiles(); tileNr++) { |
|
440 |
// Parte que dibuja |
|
441 |
try { |
|
442 |
ViewPort vp = tiles.getTileViewPort(viewPort, tileNr); |
|
443 |
drawTile(g, vp, taskStatus, scale); |
|
444 |
} catch (NoninvertibleTransformException e) { |
|
445 |
throw new ReadException(e.getMessage(), e); |
|
446 |
} catch (LoadLayerException e) { |
|
447 |
throw new ReadException(e.getMessage(), e); |
|
448 |
} |
|
449 |
} |
|
450 |
} |
|
451 |
} |
|
452 |
taskStatus.terminate(); |
|
453 |
} |
|
454 |
|
|
455 |
public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel, |
|
456 |
double scale) throws ReadException { |
|
457 |
draw(null, g, viewPort, cancel,scale); |
|
458 |
} |
|
459 |
|
|
460 |
public HashMap<String, Object> getProperties() { |
|
461 |
HashMap<String, Object> info = new HashMap<String, Object>(); |
|
462 |
String[] layerNames = getParameters().getLayerQuery().split(","); |
|
463 |
Vector<WMSLayerNode> layers = new Vector<WMSLayerNode>(layerNames.length); |
|
464 |
try { |
|
465 |
//explorer.connect(null); |
|
466 |
for (int i = 0; i < layerNames.length; i++) { |
|
467 |
layers.add(i, getExplorer().getLayer(layerNames[i])); |
|
468 |
} |
|
469 |
info.put("name", getName()); |
|
470 |
info.put("selectedLayers", layers); |
|
471 |
info.put("host", getParameters().getURI()); |
|
472 |
info.put("srs", getParameters().getSRSCode()); |
|
473 |
info.put("format", getParameters().getFormat()); |
|
474 |
info.put("infoformat", getParameters().getInfoFormat()); |
|
475 |
info.put("wmsTransparency", new Boolean(getParameters().isWmsTransparent())); |
|
476 |
info.put("styles", getParameters().getStyles()); |
|
477 |
info.put("dimensions", getParameters().getDimensions()); |
|
478 |
info.put("fixedSize", getParameters().getFixedSize()); |
|
479 |
return info; |
|
480 |
} catch (Exception e) { |
|
481 |
e.printStackTrace(); |
|
482 |
} |
|
483 |
return null; |
|
484 |
} |
|
485 |
|
|
486 |
/** |
|
487 |
* Creates the part of a OGC's MapContext document that would describe this |
|
488 |
* layer(s). |
|
489 |
* @param version, The desired version of the resulting document. (1.1.0) |
|
490 |
* @return String containing the xml. |
|
491 |
* @throws UnsupportedVersionLayerException |
|
492 |
*/ |
|
493 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
494 |
public String toMapContext(String mapContextVersion) { |
|
495 |
XmlBuilder xml = new XmlBuilder(); |
|
496 |
|
|
497 |
String query = getParameters().getLayerQuery(); |
|
498 |
String[] layerNames = query.split(","); |
|
499 |
List<RemoteWMSStyle> styleList = getParameters().getStyles(); |
|
500 |
for (int i = 0; i < layerNames.length; i++) { |
|
501 |
WMSLayerNode layer = getExplorer().getLayer(layerNames[i]); |
|
502 |
HashMap xmlAttrs = new HashMap(); |
|
503 |
|
|
504 |
// <Layer> |
|
505 |
xmlAttrs.put(WebMapContextTags.HIDDEN, !isVisible() + ""); |
|
506 |
xmlAttrs.put(WebMapContextTags.QUERYABLE, getExplorer().isQueryable() + ""); |
|
507 |
xml.openTag(WebMapContextTags.LAYER, xmlAttrs); |
|
508 |
xmlAttrs.clear(); |
|
509 |
if (mapContextVersion.equals("1.1.0") || mapContextVersion.equals("1.0.0")) { |
|
510 |
// <Server> |
|
511 |
xmlAttrs.put(WebMapContextTags.SERVICE, WebMapContextTags.WMS); |
|
512 |
xmlAttrs.put(WebMapContextTags.VERSION, getExplorer().getVersion()); |
|
513 |
xmlAttrs.put(WebMapContextTags.SERVER_TITLE, getExplorer().getServiceTitle()); |
|
514 |
xml.openTag(WebMapContextTags.SERVER, xmlAttrs); |
|
515 |
xmlAttrs.clear(); |
|
516 |
|
|
517 |
// <OnlineResource> |
|
518 |
xmlAttrs.put(WebMapContextTags.XLINK_TYPE, "simple"); |
|
519 |
xmlAttrs.put(WebMapContextTags.XLINK_HREF, getParameters().getURI().toString()); |
|
520 |
xml.writeTag(WebMapContextTags.ONLINE_RESOURCE, xmlAttrs); |
|
521 |
xmlAttrs.clear(); |
|
522 |
// </OnlineResource> |
|
523 |
|
|
524 |
xml.closeTag(); |
|
525 |
// </Server> |
|
526 |
|
|
527 |
// <Name> |
|
528 |
xml.writeTag(WebMapContextTags.NAME, layer.getName().trim()); |
|
529 |
// </Name> |
|
530 |
|
|
531 |
// <Title> |
|
532 |
xml.writeTag(WebMapContextTags.TITLE, layer.getTitle().trim()); |
|
533 |
//?xml.writeTag(WebMapContextTags.TITLE, getName().trim()); |
|
534 |
// </Title> |
|
535 |
|
|
536 |
// <Abstract> |
|
537 |
if (layer.getAbstract() != null) { |
|
538 |
xml.writeTag(WebMapContextTags.ABSTRACT, layer.getAbstract()); |
|
539 |
// </Abstract> |
|
540 |
} |
|
541 |
|
|
542 |
// <SRS> (a list of available SRS for the enclosing layer) |
|
543 |
String[] strings = (String[]) layer.getAllSrs().toArray(new String[0]); |
|
544 |
String mySRS = strings[0]; |
|
545 |
for (int j = 1; j < strings.length; j++) { |
|
546 |
mySRS += ","+strings[j]; |
|
547 |
} |
|
548 |
xml.writeTag(WebMapContextTags.SRS, mySRS); |
|
549 |
// </SRS> |
|
550 |
|
|
551 |
// <FormatList> |
|
552 |
xml.openTag(WebMapContextTags.FORMAT_LIST); |
|
553 |
strings = getExplorer().getFormats(); |
|
554 |
for (int j = 0; j < strings.length; j++) { |
|
555 |
// <Format> |
|
556 |
String str = strings[j].trim(); |
|
557 |
if (str.equals(getParameters().getFormat())) { |
|
558 |
xml.writeTag(WebMapContextTags.FORMAT, str, WebMapContextTags.CURRENT, "1"); |
|
559 |
} else { |
|
560 |
xml.writeTag(WebMapContextTags.FORMAT, str); |
|
561 |
// </Format> |
|
562 |
} |
|
563 |
} |
|
564 |
xml.closeTag(); |
|
565 |
// </FormatList> |
|
566 |
|
|
567 |
// <StyleList> |
|
568 |
xml.openTag(WebMapContextTags.STYLE_LIST); |
|
569 |
|
|
570 |
if (layer.getStyles().size() > 0) { |
|
571 |
for (int j = 0; j < layer.getStyles().size(); j++) { |
|
572 |
// <Style> |
|
573 |
RemoteWMSStyle st = layer.getStyles().get(j); |
|
574 |
if (st.getName().equals(styleList.get(i).getName())) { |
|
575 |
xmlAttrs.put(WebMapContextTags.CURRENT, "1"); |
|
576 |
} |
|
577 |
xml.openTag(WebMapContextTags.STYLE, xmlAttrs); |
|
578 |
xmlAttrs.clear(); |
|
579 |
|
|
580 |
// <Name> |
|
581 |
xml.writeTag(WebMapContextTags.NAME, st.getName()); |
|
582 |
// </Name> |
|
583 |
|
|
584 |
// <Title> |
|
585 |
xml.writeTag(WebMapContextTags.TITLE, st.getTitle()); |
|
586 |
// </Title> |
|
587 |
|
|
588 |
// <LegendURL width="180" format="image/gif" height="50"> |
|
589 |
// <OnlineResource xlink:type="simple" xlink:href="http://globe.digitalearth.gov/globe/en/icons/colorbars/NATIONAL.gif"/> |
|
590 |
// </OnlineResource> |
|
591 |
// </LegendURL> |
|
592 |
xml.closeTag(); |
|
593 |
// </Style> |
|
594 |
|
|
595 |
} |
|
596 |
|
|
597 |
} else { |
|
598 |
// Create fake style (for compatibility issues) |
|
599 |
xmlAttrs.put(WebMapContextTags.CURRENT, "1"); |
|
600 |
// <Style> |
|
601 |
xml.openTag(WebMapContextTags.STYLE, xmlAttrs); |
|
602 |
xmlAttrs.clear(); |
|
603 |
// <Name> |
|
604 |
xml.writeTag(WebMapContextTags.NAME, "default"); |
|
605 |
// </Name> |
|
606 |
|
|
607 |
// <Title> |
|
608 |
xml.writeTag(WebMapContextTags.TITLE, "default"); |
|
609 |
xml.closeTag(); |
|
610 |
} |
|
611 |
// </StyleList> |
|
612 |
xml.closeTag(); |
|
613 |
if (mapContextVersion.compareTo("1.0.0") > 0) { |
|
614 |
// <DimensionList> |
|
615 |
xml.openTag(WebMapContextTags.DIMENSION_LIST); |
|
616 |
// <Dimension> |
|
617 |
// </Dimension> |
|
618 |
xml.closeTag(); |
|
619 |
// </DimensionList> |
|
620 |
} |
|
621 |
} else { |
|
622 |
xml.writeTag("ERROR", PluginServices.getText(this, "unsupported_map_context_version")); |
|
623 |
} |
|
624 |
// </Layer> |
|
625 |
xml.closeTag(); |
|
626 |
} |
|
627 |
return xml.getXML(); |
|
628 |
} |
Also available in: Unified diff