Revision 1213

View differences:

org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/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.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/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.wmts</artifactId>
5
	<packaging>pom</packaging>
6
	<version>2.0.0-SNAPSHOT</version>
7
	<name>org.gvsig.raster.wmts</name>
8
	<description>WMTS client</description>
9
	<inceptionYear>2011</inceptionYear>
10
    <parent>
11
        <groupId>org.gvsig</groupId>
12
        <artifactId>gvsig-base-pom</artifactId>
13
        <version>2.0-SNAPSHOT</version>
14
    </parent>
15
     <dependencyManagement>
16
        <dependencies>
17
            <dependency>
18
                <groupId>org.gvsig</groupId>
19
                <artifactId>org.gvsig.core.maven.dependencies</artifactId>
20
                <version>2.0.1-SNAPSHOT</version>
21
                <type>pom</type>
22
                <scope>import</scope>
23
            </dependency>
24
        </dependencies>
25
    </dependencyManagement>
26
    <developers>
27
		<developer>
28
			<id>nbrodin</id>
29
			<name>Nacho Brodin</name>
30
			<email>nachobrodin@gmail.com</email>
31
			<roles>
32
				<role>Architect</role>
33
				<role>Developer</role>
34
			</roles>
35
		</developer>
36
	</developers>
37
	<properties>
38
		<build-dir>${basedir}/../..</build-dir>
39
	</properties>
40
	<modules>
41
		<!--<module>org.gvsig.raster.wmts.swing</module>-->
42
		<module>org.gvsig.raster.wmts.io</module>
43
		<module>org.gvsig.raster.wmts.app</module>
44
	</modules>
45
</project>
0 46

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/distribution/distribution.xml
1
<assembly>
2
</assembly>
0 3

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Mon Jun 25 09:20:51 CEST 2012
3
buildNumber=2
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/distribution/distribution.xml
1
<assembly>
2
	<id>distribution</id>
3
	<formats>
4
		<format>dir</format>
5
	</formats>
6
	<fileSets>
7
		<!-- Estructure for the extension -->
8
		<fileSet>
9
			<directory>src/main/resources</directory>
10
			<outputDirectory>${extension.install.dir.name}
11
			</outputDirectory>
12
		</fileSet>
13
	</fileSets>
14
	<files>
15
	   <file>
16
          <source>package.info</source>
17
          <outputDirectory>${extension.install.dir.name}</outputDirectory>
18
       </file>
19
    </files>
20
	<dependencySets>
21
		<dependencySet>
22
			<outputDirectory>${extension.install.dir.name}/${library-dir}
23
			</outputDirectory>
24
			<includes>
25
				<include>org.gvsig:org.gvsig.raster.wmts.app.wmtsclient:jar</include>
26
				<include>org.gvsig:org.gvsig.raster.wmts.io:jar</include>
27
				<include>org.gvsig:org.gvsig.remoteclient</include>
28
			</includes>
29
		</dependencySet>
30
	</dependencySets>
31
</assembly>
0 32

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/buildNumber.properties
1
#maven.buildNumber.plugin properties file
2
#Wed Aug 08 10:25:52 CEST 2012
3
buildNumber=21
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/wmts/io/TestWMTSDriver.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.wmts.io;
23

  
24
import java.net.MalformedURLException;
25
import java.net.URL;
26

  
27
import org.gvsig.fmap.dal.exception.InitializeException;
28
import org.gvsig.remoteclient.wmts.exception.WMTSException;
29
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
30
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider;
31
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
32

  
33
/**
34
 * @author Nacho Brodin (nachobrodin@gmail.com)
35
 */
36
public class TestWMTSDriver extends AbstractLibraryAutoInitTestCase {
37
	
38
	protected void doSetUp() throws Exception {
39
		System.err.println("TestWMTSDriver running...");
40
	}
41
	
42
	public void testStack() {
43
		
44
		URL url = null;
45
		try {
46
			url = new URL("http://scolab.es:9090/geoserver/gwc/service/wmts");
47
			
48
			//Crea el manejador para la versi?n del servidor y devuelve la versi?n 
49
			//WMTSConnector conn = WMTSDriver.getConnectorFromURL(url);
50
			//String version = conn.getVersion();
51
			
52
			//Creamos un explorer para obtener los datos del servidor
53
			WMTSServerExplorerParameters.registerDynClass();
54
			WMTSServerExplorerParameters param = new WMTSServerExplorerParameters();
55
			param.setHost(url.toString());
56
			WMTSServerExplorer explorer = new WMTSServerExplorer(param, null);
57
			explorer.connect(null);
58
			
59
			WMTSServiceIdentification id = explorer.getServiceIdentification();
60
			String title = id.getTitle();
61
			String version = id.getServiceTypeVersion();
62
			String type = id.getServiceType();
63
			
64
			WMTSServiceProvider prov = explorer.getServiceProvider();
65
			String pN = prov.getProviderName();
66
			String pS = prov.getProviderSite();
67
			String pC = prov.getServiceContact();
68
			
69
			//WMTSThemes themes = explorer.getThemes();
70
			System.out.println("Title: " + title);
71
			System.out.println("Version: " + version);
72
			System.out.println("Type: " + type);
73
			System.out.println("Provider Name: " + pN);
74
			System.out.println("Provider Site: " + pS);
75
			System.out.println("Service Contact: " + pC);
76
			
77
			//En este caso solo hay una lista de temas con una capa por cada uno
78
			//pero en un caso corriente seria un ?rbol de themas con una capa asociada a cada uno
79
			/*for (int i = 0; i < themes.size(); i++) {
80
				WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer();
81
				if(layer != null)
82
					layer.print();
83
			}*/
84
			
85
		} catch (MalformedURLException e) {
86
			e.printStackTrace();
87
		} catch (InitializeException e) {
88
			e.printStackTrace();
89
		} catch (WMTSException e) {
90
			e.printStackTrace();
91
		}
92
		
93
	}
94
}
0 95

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/dialog/TestPropsDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.dialog;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.dialog.WMTSPropsDialog;
24

  
25
public class TestPropsDialog {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private WMTSPropsDialog   desc     = null;
30

  
31
	public TestPropsDialog() {
32
		desc = new WMTSPropsDialog();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestPropsDialog();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestAddDelPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.AddDelLayerPanel;
24

  
25
public class TestAddDelPanel {
26
	private int               w        = 510;
27
	private int               h        = 110;
28
	private JFrame            frame    = new JFrame();
29
	private AddDelLayerPanel  desc     = null;
30

  
31
	public TestAddDelPanel() {
32
		desc = new AddDelLayerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestAddDelPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestILayerPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.ILayerPanel;
24

  
25
public class TestILayerPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private ILayerPanel       desc     = null;
30

  
31
	public TestILayerPanel() {
32
		desc = new ILayerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestILayerPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/layer/TestLayerListPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.layer;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.layer.LayersSelectedPanel;
24

  
25
public class TestLayerListPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private LayersSelectedPanel    desc     = null;
30

  
31
	public TestLayerListPanel() {
32
		desc = new LayersSelectedPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestLayerListPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/TestStylesPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel;
20

  
21
import javax.swing.JFrame;
22
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.StylesPanel;
23

  
24
public class TestStylesPanel {
25
	private int               w        = 510;
26
	private int               h        = 610;
27
	private JFrame            frame    = new JFrame();
28
	private StylesPanel       desc     = null;
29

  
30
	public TestStylesPanel() {
31
		desc = new StylesPanel();
32
		frame.getContentPane().add(desc);
33
		frame.setSize(w, h);
34
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
35
		frame.setVisible(true);
36
	}
37
 
38
	public static void main(String[] args) {
39
		new TestStylesPanel();
40
	}
41
}
0 42

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestNextPrevPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.NextPrevPanel;
24

  
25
public class TestNextPrevPanel {
26
	private int               w        = 510;
27
	private int               h        = 100;
28
	private JFrame            frame    = new JFrame();
29
	private NextPrevPanel     desc     = null;
30

  
31
	public TestNextPrevPanel() {
32
		desc = new NextPrevPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestNextPrevPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestDescriptionPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.DescriptionPanel;
24

  
25
public class TestDescriptionPanel {
26
	private int               w        = 510;
27
	private int               h        = 510;
28
	private JFrame            frame    = new JFrame();
29
	private DescriptionPanel  desc     = null;
30

  
31
	public TestDescriptionPanel() {
32
		desc = new DescriptionPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestDescriptionPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestServerPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.IServerPanel;
24

  
25
public class TestServerPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private IServerPanel       desc     = null;
30

  
31
	public TestServerPanel() {
32
		desc = new IServerPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestServerPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/main/TestConnectPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.main;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.main.ConnectPanel;
24

  
25
public class TestConnectPanel {
26
	private int               w        = 510;
27
	private int               h        = 90;
28
	private JFrame            frame    = new JFrame();
29
	private ConnectPanel      connect  = null;
30

  
31
	public TestConnectPanel() {
32
		connect = new ConnectPanel();
33
		frame.getContentPane().add(connect);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestConnectPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/test/java/org/gvsig/raster/app/extension/wmtsclient/gui/panel/format/TestFormatsPanel.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.app.extension.wmtsclient.gui.panel.format;
20

  
21
import javax.swing.JFrame;
22

  
23
import org.gvsig.raster.wmts.app.wmtsclient.gui.panel.format.IFormatsPanel;
24

  
25
public class TestFormatsPanel {
26
	private int               w        = 510;
27
	private int               h        = 610;
28
	private JFrame            frame    = new JFrame();
29
	private IFormatsPanel      desc     = null;
30

  
31
	public TestFormatsPanel() {
32
		desc = new IFormatsPanel();
33
		frame.getContentPane().add(desc);
34
		frame.setSize(w, h);
35
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
36
		frame.setVisible(true);
37
	}
38

  
39
	public static void main(String[] args) {
40
		new TestFormatsPanel();
41
	}
42
}
0 43

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources/text.properties
1
WMTSLayer=Capa WMTS
2
select_info_formats=Seleccionar formatos de texto (Info)
3
wmts_properties=Propiedades WMTS
4
wmts_cant_connect=No ha sido posible realizar la conexi\u00f3n con el WMTS
5
wmts_not_queryable=Este servidor no acepta peticiones de este tipo
6
wmts_server_error=Error del servidor WMTS
7
wmts_transparency=Transparencia
8
WMTSLayer=Capa WMTS
9
fit_WMTS_layer=Ajustar capa WMTS
10
invert_axis_order=Invertir orden de los ejes
11
cache_refresh=Este check debe estar activado antes de pulsar el bot?n de conectar.\n Si la capa fue cargada previamente con este check box\n en distinta posici?n es posible que el contenido de la cach? sea erroneo \n. Limpiela antes de continuar.
0 12

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources/text_en.properties
1
WMTSLayer=WMTS Layer
2
select_info_formats=Select text formats for Info by point
3
wmts_properties=WMTS Properties
4
wmts_cant_connect=The connection cannot be established
5
wmts_not_queryable=This server does not accept this kind of requests
6
wmts_server_error=Error in WMTS Server
7
wmts_transparency=Transparency
8
WMTSLayer=WMTS Layer
9
fit_WMTS_layer=Fits to WTMS layer
10
invert_axis_order=Invert the order of the axes
11
cache_refresh=This check has to be enabled before press the connect button.\n  If the layer was loaded with this check in other status it is possible that the cache not to be correct. \n. Clean the cache before continue.
0 12

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.raster.tilecache.app" />
4
	<libraries library-dir="lib"/>
5
	<resourceBundle name="text"/>
6
	<extensions>
7
		<extension class-name="org.gvsig.raster.wmts.app.wmtsclient.WMTSClientExtension"
8
			description="Support to access WMTS"
9
			active="true"
10
			priority="1">
11
			<!-- Estas tools se pusieron para pruebas. 
12
				Habilitan dos botones para llevar al siguiente/anterior nivel de resoluci?n
13
			<tool-bar name="ZoomMas" position="5">
14
				<action-tool icon="level-plus" action-command="NEXT_LEVEL" tooltip="Zoom_next_level" position="1"/>
15
			</tool-bar>
16
			<tool-bar name="ZoomMenos" position="5">
17
				<action-tool icon="level-less" action-command="PREV_LEVEL" tooltip="Zoom_prev_level" position="2"/>
18
			</tool-bar>
19
			-->
20
		</extension>
21
	</extensions>
22
</plugin-config>
0 23

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/resources/about/wmts-about.html
1
<html>
2
	<head>
3
	<style type="text/css">
4
	BODY { background-image: url(logo.png); background-repeat: no-repeat; background-position: 100% 0% }
5
	</style>
6
	</head>
7
	<body>	
8
		<h2>Soporte WMTS para gvSIG</h2>	
9
		<p><b>Prodevelop S.L.</b> ha incorporado el soporte al formato WMTS para el proyecto de Espa?a Virtual</p>
10
		
11
		<p><b>Desarrollo:</b></p>
12
		
13
		<p>Director del proyecto:</p>
14
		<ul>
15
			<li>Miguel Montesinos Lajara</li>
16
		</ul>
17
		<p>Equipo de desarrollo:</p>
18
		<ul>
19
			<li>Nacho Brodin</li>
20
		</ul>
21

  
22
		<p>Build Number de la extensi&oacute;n: 1</p>
23
		<center>
24
			<p><b><a href="http://www.prodevelop.es" title="Prodevelop">http://www.prodevelop.es</a></b></p>
25
		</center>
26
		
27
	</body>
28
</html>
0 29

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/WMTSClientExtension.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.wmts.app.wmtsclient;
24

  
25
import java.awt.Component;
26
import java.awt.geom.Point2D;
27

  
28
import javax.swing.JOptionPane;
29

  
30
import org.gvsig.about.AboutManager;
31
import org.gvsig.about.AboutParticipant;
32
import org.gvsig.andami.IconThemeHelper;
33
import org.gvsig.andami.PluginServices;
34
import org.gvsig.andami.plugins.Extension;
35
import org.gvsig.andami.ui.mdiManager.IWindow;
36
import org.gvsig.app.ApplicationLocator;
37
import org.gvsig.app.ApplicationManager;
38
import org.gvsig.app.extension.AddLayer;
39
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel;
40
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
41
import org.gvsig.fmap.geom.primitive.Envelope;
42
import org.gvsig.fmap.mapcontext.ViewPort;
43
import org.gvsig.fmap.mapcontext.layers.FLayer;
44
import org.gvsig.fmap.mapcontext.layers.FLayers;
45
import org.gvsig.fmap.mapcontrol.MapControl;
46
import org.gvsig.raster.fmap.layers.Multiresolution;
47
import org.gvsig.raster.wmts.app.wmtsclient.gui.toc.WMTSPropsTocMenuEntry;
48
import org.gvsig.raster.wmts.app.wmtsclient.gui.wizard.WMTSWizard;
49
import org.gvsig.raster.wmts.app.wmtsclient.layer.DynObjectSetWMTSInfo;
50
import org.gvsig.raster.wmts.app.wmtsclient.layer.FLyrWMTS;
51
import org.gvsig.tools.ToolsLocator;
52
import org.gvsig.tools.extensionpoint.ExtensionPoint;
53

  
54

  
55
/**
56
 * Extension for adding WMTS support to gvSIG.
57
 *
58
 * @author Nacho Brodin (nachobrodin@gmail.com)
59
 */
60
public class WMTSClientExtension extends Extension {
61
	
62
	/*
63
	 * (non-Javadoc)
64
	 * @see org.gvsig.andami.plugins.IExtension#initialize()
65
	 */
66
    public void initialize() {
67
    	// Adds an entry to the TOC's floating menu to those layers defined in this extension
68
		ExtensionPoint exPoint = ToolsLocator.getExtensionPointManager().add("View_TocActions");
69
		exPoint.append("WMTSPropsTocMenuEntry", "", new WMTSPropsTocMenuEntry());
70

  
71
        // Adds a new tab to the "add layer" wizard for WMTS layer creation
72
    	AddLayer.addWizard(WMTSWizard.class);
73

  
74
    	//ToolsLocator.getExtensionPointManager().add("CatalogLayers").append("OGC:WMTS", "", FLyrWMTS.class);
75
    	initilizeIcons();
76
    	DynObjectSetWMTSInfo.registerDynClass();
77
    }
78
    
79
    /*
80
	 * (non-Javadoc)
81
	 * @see org.gvsig.andami.plugins.Extension#postInitialize()
82
	 */
83
	public void postInitialize() {
84
		FLyrWMTS.registerPersistent();
85
		addAboutInfo();
86
	}
87
	
88
	private void addAboutInfo() {
89
        ApplicationManager application = ApplicationLocator.getManager();
90
        
91
        AboutManager about = application.getAbout();
92
        about.addDeveloper("PRODEVELOP", getClass().getClassLoader()
93
            .getResource("about/wmts-about.html"), 2);
94

  
95
        AboutParticipant participant = about.getDeveloper("PRODEVELOP");
96
        participant.addContribution(
97
            "WMTS",
98
            "Cliente para Web Map Tile Service", 
99
            2011,3,1, 
100
            2011,3,30
101
        );      
102
    }
103

  
104
    @SuppressWarnings("deprecation")
105
	public void execute(String actionCommand) {
106
    	AbstractViewPanel theView = (AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow();
107
		MapControl mapCtrl = theView.getMapControl();
108
		ViewPort viewPort = mapCtrl.getViewPort();
109
		
110
		Multiresolution lyrMultires = null;
111
		
112
		FLayers lyrs = mapCtrl.getMapContext().getLayers();
113
		for (int i = 0; i < lyrs.getLayersCount(); i++) {
114
			FLayer lyr = lyrs.getLayer(i);
115
			if(lyr instanceof FLyrWMTS) {
116
				lyrMultires = ((Multiresolution)lyr);
117
			}
118
		}
119
		
120
    	if(actionCommand.compareTo("NEXT_LEVEL") == 0) {
121
    		if(!lyrMultires.increaseZoomLevel()) {
122
    			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), "max_zoom_reached");
123
    			return;
124
    		}
125
    	}
126
    	
127
    	if(actionCommand.compareTo("PREV_LEVEL") == 0) {
128
    		if(!lyrMultires.decreaseZoomLevel()) {
129
    			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), "min_zoom_reached");
130
    			return;
131
    		}
132
    	}
133
    	
134
    	Point2D center = new Point2D.Double(viewPort.getExtent().getCenterX(), viewPort.getExtent().getCenterY());
135
		Envelope r;
136
		try {
137
			r = lyrMultires.getCoordsInLevel(center, lyrMultires.getZoomLevel(), 
138
					viewPort.getImageWidth(), viewPort.getImageHeight());
139
		} catch (CreateEnvelopeException e) {
140
			return;
141
		}
142
		
143
		mapCtrl.getViewPort().setEnvelope(r);
144
		mapCtrl.invalidate();
145
    }
146

  
147
    public boolean isEnabled() {
148
        return true;
149
    }
150

  
151
    public boolean isVisible() {
152
    	IWindow window = PluginServices.getMDIManager().getActiveWindow();
153
    	if(window instanceof AbstractViewPanel) {
154
    		AbstractViewPanel theView = (AbstractViewPanel) window;
155
    		MapControl mapCtrl = theView.getMapControl();
156
    		FLayers lyrs = mapCtrl.getMapContext().getLayers();
157
    		for (int i = 0; i < lyrs.getLayersCount(); i++) {
158
    			if(lyrs.getLayer(i) instanceof FLyrWMTS)
159
    				return true;
160
    		}
161
    	}
162
        return false;
163
    }
164

  
165

  
166
    void initilizeIcons(){
167
		IconThemeHelper.registerIcon(null, "level-plus", this);
168
		IconThemeHelper.registerIcon(null, "level-less", this);
169
		IconThemeHelper.registerIcon(null, "icon-layer-wms", this);
170
    }
171
}
0 172

  
org.gvsig.raster.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/layer/DynObjectIteratorWMTSInfo.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.wmts.app.wmtsclient.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 DynObjectIteratorWMTSInfo 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 DynObjectIteratorWMTSInfo(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.wmts/tags/buildNumber_21/org.gvsig.raster.wmts/org.gvsig.raster.wmts.app/org.gvsig.raster.wmts.app.wmtsclient/src/main/java/org/gvsig/raster/wmts/app/wmtsclient/layer/DynObjectSetWMTSInfo.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.wmts.app.wmtsclient.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 DynObjectSetWMTSInfo 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 DynObjectIteratorWMTSInfo   ite = null;
50
	
51
	public static void registerDynClass() {
52
		DynObjectManager manager = ToolsLocator.getDynObjectManager();
53
    	DynClass dynClass = manager.add("WMTSInfoByPoint", "WMTS InfoByPoint");
54
    	dynClass.setNamespace("InfoByPoint");
55
    	dynClass.addDynFieldString("info");
56
	}
57
	
58
    /**
59
     * Creates a new facade over a given info, with fast dynobject
60
     * iteration.
61
     */
62
    public DynObjectSetWMTSInfo(String txt, int type) {
63
    	DynObjectManager manager = ToolsLocator.getDynObjectManager();
64
    	DynObject dynObject = manager.createDynObject("WMTSInfoByPoint");
65
    	dynObject.setDynValue("info", txt);
66
    	ite = new DynObjectIteratorWMTSInfo(dynObject);
67
    }
68

  
69
    public void dispose() {
70

  
71
    }
72

  
73
    public void accept(final Visitor visitor, long firstValueIndex) throws BaseException {
74
    	while(ite.hasNext()) {
75
    		visitor.visit(ite.next());
76
    	}
77
    }
78

  
79
    public void accept(final Visitor visitor) throws BaseException {
80
    	while(ite.hasNext()) {
81
    		visitor.visit(ite.next());
82
    	}
83
    }
84

  
85
    public long getSize() throws BaseException {
86
       return ite.getSize();
87
    }
88

  
89
    public DisposableIterator iterator(long index) throws BaseException {
90
        return iterator();
91
    }
92

  
93
    public DisposableIterator iterator() throws BaseException {
94
    	return ite;
95
    }
96

  
97
    public boolean isEmpty() throws BaseException {
98
    	return (getSize() == 0);
99
    }
100

  
101
    public boolean isDeleteEnabled() {
102
    	return true;
103
    }
104

  
105
    public void delete(DynObject dynObject) throws BaseException {
106

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff