Revision 2282

View differences:

org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/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/tagdate_06112013_13_59/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.1.0-SNAPSHOT</version>
7
	<name>org.gvsig.raster.wmts</name>
8
	<description>WMTS client</description>
9
	<inceptionYear>2011</inceptionYear>
10
	
11
	<parent>
12
        <groupId>org.gvsig</groupId>
13
        <artifactId>org.gvsig.desktop</artifactId>
14
        <version>2.0.16-SNAPSHOT</version>
15
    </parent>
16
    
17
     <scm>
18
        <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts</connection>
19
        <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts</developerConnection>
20
        <url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.wmts/trunk/org.gvsig.raster.wmts</url>
21
    </scm>
22
    
23
     <dependencyManagement>
24
		<dependencies>
25
			<dependency>
26
				<groupId>org.gvsig</groupId>
27
				<artifactId>org.gvsig.raster.wmts.swing.api</artifactId>
28
				<version>2.1.0-SNAPSHOT</version>
29
			</dependency>
30
			<dependency>
31
				<groupId>org.gvsig</groupId>
32
				<artifactId>org.gvsig.raster.wmts.ogc.api</artifactId>
33
				<version>2.1.0-SNAPSHOT</version>
34
			</dependency>
35
			<dependency>
36
				<groupId>org.gvsig</groupId>
37
				<artifactId>org.gvsig.raster.wmts.ogc.impl</artifactId>
38
				<version>2.1.0-SNAPSHOT</version>
39
			</dependency>
40
			<dependency>
41
				<groupId>org.gvsig</groupId>
42
				<artifactId>org.gvsig.raster.cache.lib.api</artifactId>
43
				<version>2.1.0-SNAPSHOT</version>
44
			</dependency>
45
			<dependency>
46
				<groupId>org.gvsig</groupId>
47
				<artifactId>org.gvsig.raster.lib.api</artifactId>
48
				<version>2.1.0-SNAPSHOT</version>
49
			</dependency>
50
			<dependency>
51
				<groupId>org.gvsig</groupId>
52
				<artifactId>org.gvsig.raster.swing.api</artifactId>
53
				<version>2.1.0-SNAPSHOT</version>
54
			</dependency>
55
	        <dependency>
56
	            <groupId>org.gvsig</groupId>
57
	            <artifactId>org.gvsig.raster.lib.impl</artifactId>
58
	            <version>2.1.0-SNAPSHOT</version>
59
	        </dependency>
60
			<dependency>
61
	            <groupId>org.gvsig</groupId>
62
	            <artifactId>org.gvsig.raster.wmts.io</artifactId>
63
	            <version>2.1.0-SNAPSHOT</version>
64
	        </dependency>
65
			<dependency>
66
				<groupId>org.gvsig</groupId>
67
				<artifactId>org.gvsig.raster.fmap</artifactId>
68
				<version>2.1.0-SNAPSHOT</version>
69
			</dependency>
70
		</dependencies>
71
	</dependencyManagement>
72
	
73
    <developers>
74
		<developer>
75
			<id>nbrodin</id>
76
			<name>Nacho Brodin</name>
77
			<email>nachobrodin@gmail.com</email>
78
			<roles>
79
				<role>Architect</role>
80
				<role>Developer</role>
81
			</roles>
82
		</developer>
83
	</developers>
84
	
85
	<build>
86
        <plugins>
87
            <plugin>
88
                <groupId>org.apache.maven.plugins</groupId>
89
                <artifactId>maven-release-plugin</artifactId>
90
                <configuration>
91
                    <tagBase>https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.wmts/tags/</tagBase>
92
                    <goals>deploy</goals>
93
                </configuration>
94
            </plugin>
95
        </plugins>
96
    </build>
97
    
98
	<modules>
99
		<!--<module>org.gvsig.raster.wmts.swing</module>-->
100
		<module>org.gvsig.raster.wmts.io</module>
101
		<module>org.gvsig.raster.wmts.app.wmtsclient</module>
102
		<module>org.gvsig.raster.wmts.ogc</module>
103
	</modules>
104
</project>
0 105

  
org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/test/resources/TemplateRasterProvider.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.fmap.dal.coverage.dataset.io.netcdf;
23

  
24
import java.awt.geom.AffineTransform;
25

  
26
import org.gvsig.fmap.dal.DALFileLocator;
27
import org.gvsig.fmap.dal.DALLocator;
28
import org.gvsig.fmap.dal.DataStore;
29
import org.gvsig.fmap.dal.coverage.dataset.Buffer;
30
import org.gvsig.fmap.dal.coverage.dataset.io.tile.downloader.FileTileServer;
31
import org.gvsig.fmap.dal.coverage.datastruct.BandList;
32
import org.gvsig.fmap.dal.coverage.datastruct.Extent;
33
import org.gvsig.fmap.dal.coverage.exception.BandAccessException;
34
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException;
35
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException;
36
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException;
37
import org.gvsig.fmap.dal.coverage.exception.ParsingException;
38
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException;
39
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException;
40
import org.gvsig.fmap.dal.coverage.store.RasterFileStoreParameters;
41
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
42
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
43
import org.gvsig.metadata.MetadataLocator;
44
import org.gvsig.raster.cache.tile.provider.TileListener;
45
import org.gvsig.raster.cache.tile.provider.TileServer;
46
import org.gvsig.raster.impl.datastruct.ExtentImpl;
47
import org.gvsig.raster.impl.provider.DefaultRasterProvider;
48
import org.gvsig.raster.impl.provider.RasterProvider;
49
import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
50
import org.gvsig.raster.impl.store.AbstractRasterDataStore;
51
import org.gvsig.raster.impl.store.DefaultStoreFactory;
52
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation;
53
import org.gvsig.raster.impl.store.properties.DataStoreMetadata;
54
import org.gvsig.raster.impl.store.properties.DataStoreTransparency;
55
import org.gvsig.tools.ToolsLocator;
56
import org.gvsig.tools.extensionpoint.ExtensionPoint;
57
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
58
/**
59
 * Data provider for ...
60
 *
61
 * @author Nacho Brodin (nachobrodin@gmail.com)
62
 */
63
public class NetCDFProvider extends DefaultRasterProvider {
64
	public static String        NAME                     = "Template Store";
65
	public static String        DESCRIPTION              = "Template Raster file";
66
	public final String         METADATA_DEFINITION_NAME = "TemplateStore";
67
	
68
	private static String[]     formatList               = new String[]{"*"};
69

  
70
	private Extent              viewRequest              = null;
71
	private TileServer          tileServer               = null;
72
	private boolean             open                     = false;
73

  
74
	public static void register() {
75
		DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
76
		if (dataman != null && !dataman.getStoreProviders().contains(NAME)) {
77
			dataman.registerStoreProvider(NAME,
78
					NetCDFProvider.class, NetCDFDataParameters.class);
79
		}
80
		
81
		if(DALFileLocator.getFilesystemServerExplorerManager() != null)
82
			DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
83
					NAME, DESCRIPTION,
84
					NetCDFFilesystemServerExplorer.class);
85
		
86
		dataman.registerStoreFactory(NAME, DefaultStoreFactory.class);
87
	}
88

  
89
	/**
90
	 * Returns true if the extension is supported and false if doesn't
91
	 * @param ext
92
	 * @return
93
	 */
94
	public static boolean isExtensionSupported(String ext) {
95
		for (int i = 0; i < formatList.length; i++) {
96
			if(formatList[i].compareTo(ext) == 0)
97
				return true;
98
		}
99
		return false;
100
	}
101
	
102
	/**
103
	 * Constructor. Abre el dataset.
104
	 * @param proj Proyecci?n
105
	 * @param fName Nombre del fichero
106
	 * @throws NotSupportedExtensionException
107
	 */
108
	public NetCDFProvider(String params) throws NotSupportedExtensionException {
109
		super(params);
110
		if(params instanceof String) {
111
			NetCDFDataParameters p = new NetCDFDataParameters();
112
			p.setURI((String)params);
113
			super.init(p, null, ToolsLocator.getDynObjectManager()
114
					.createDynObject(
115
							MetadataLocator.getMetadataManager().getDefinition(
116
									DataStore.METADATA_DEFINITION_NAME)));
117
			init(p, null);
118
		}
119
	}
120
	
121
	public NetCDFProvider (NetCDFDataParameters params,
122
			AbstractRasterDataStore storeServices) throws NotSupportedExtensionException {
123
		super(params, storeServices, ToolsLocator.getDynObjectManager()
124
				.createDynObject(
125
						MetadataLocator.getMetadataManager().getDefinition(
126
								DataStore.METADATA_DEFINITION_NAME)));
127
		init(params, storeServices);
128
	}
129

  
130
	/**
131
	 * Crea las referencias al fichero y carga
132
	 * las estructuras con la informaci?n y los metadatos.
133
	 * @param proj Proyecci?n
134
	 * @param param Parametros de carga
135
	 * @throws NotSupportedExtensionException
136
	 */
137
	public void init (AbstractRasterDataParameters params,
138
			DataStoreProviderServices storeServices) throws NotSupportedExtensionException {
139
		//TODO:
140
		
141
		if(((RasterFileStoreParameters)params).getFile().exists()) {
142
			setParam(params);
143
			colorTable = null;
144
			noData = 0;
145
			wktProjection = null;
146
			//CrsWkt crs = new CrsWkt(wktProjection);
147
			//IProjection proj = CRSFactory.getCRS("EPSG:23030");
148
			noDataEnabled = true;
149
			ownTransformation = null;
150
			externalTransformation = (AffineTransform)ownTransformation.clone();
151
			load();
152
		} else
153
			setParam(params);
154
		bandCount = 0;
155
		setDataType(null);
156
		super.init();
157

  
158
		try {
159
			loadFromRmf(getRmfBlocksManager());
160
		} catch (ParsingException e) {
161
			//No lee desde rmf
162
		}
163
	}
164
	
165
	/*
166
	 * (non-Javadoc)
167
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#load()
168
	 */
169
	public RasterProvider load() {
170
		return this;
171
	}
172
	
173
	/*
174
	 * (non-Javadoc)
175
	 * @see org.gvsig.raster.impl.provider.RasterProvider#isOpen()
176
	 */
177
	public boolean isOpen() {
178
		return open;
179
	}
180

  
181
	/*
182
	 * (non-Javadoc)
183
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#close()
184
	 */
185
	public void close() {
186
		//TODO:
187
	}
188

  
189
	/*
190
	 * (non-Javadoc)
191
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#translateFileName(java.lang.String)
192
	 */
193
	public String translateFileName(String fileName) {
194
		return fileName;
195
	}
196

  
197
	/**
198
	 * Asigna el extent de la vista actual. existe un fichero .rmf debemos hacer una transformaci?n
199
	 * de la vista asignada ya que la petici?n viene en coordenadas del fichero .rmf y la vista (v)
200
	 * ha de estar en coordenadas del fichero.
201
	 */
202
	public void setView(Extent e) {
203
		viewRequest = new ExtentImpl(e);
204
	}
205

  
206
	/*
207
	 * (non-Javadoc)
208
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getView()
209
	 */
210
	public Extent getView() {
211
		return viewRequest;
212
	}
213

  
214
	/*
215
	 * (non-Javadoc)
216
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWidth()
217
	 */
218
	public double getWidth() {
219
		//TODO:
220
		return 0;
221
	}
222

  
223
	/*
224
	 * (non-Javadoc)
225
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getHeight()
226
	 */
227
	public double getHeight() {
228
		//TODO:
229
		return 0;
230
	}
231

  
232
	/**
233
	 * Read a line from the file
234
	 * @param line
235
	 * @param band
236
	 * @return
237
	 * @throws InvalidSetViewException
238
	 * @throws FileNotOpenException
239
	 * @throws RasterDriverException
240
	 * @Deprecated This operation is deprecated because is not useful and in the future
241
	 * it will not be maintained. The abstract operation has dissapear
242
	 */
243
	public Object readCompleteLine(int line, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
244
		if(line > this.getHeight() || band > this.getBandCount())
245
			throw new InvalidSetViewException("Request out of grid");
246

  
247
		//TODO:
248
		return null;
249
	}
250

  
251
	/*
252
	 *  (non-Javadoc)
253
	 * @see org.gvsig.raster.dataset.RasterDataset#readBlock(int, int)
254
	 */
255
	public Object readBlock(int pos, int blockHeight)
256
		throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException {
257
		if(pos < 0)
258
			throw new InvalidSetViewException("Request out of grid");
259

  
260
		if((pos + blockHeight) > getHeight())
261
			blockHeight = Math.abs(((int)getHeight()) - pos);
262
		
263
		//TODO:
264
		return null;
265
	}
266

  
267
	/*
268
	 * (non-Javadoc)
269
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getData(int, int, int)
270
	 */
271
	public Object getData(int x, int y, int band)throws InvalidSetViewException, FileNotOpenException, RasterDriverException {
272
		if(x < 0 || y < 0 || x >= getWidth() || y >= getHeight())
273
			throw new InvalidSetViewException("Request out of grid");
274
		
275
		//TODO
276
		return null;
277
	}
278

  
279
	/*
280
	 * (non-Javadoc)
281
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(double, double, double, double, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.raster.cache.tile.provider.TileListener)
282
	 */
283
	public void getWindow(Extent ex, int bufWidth, int bufHeight, 
284
			BandList bandList, TileListener listener) throws ProcessInterruptedException, RasterDriverException {
285
		//TODO
286
	}
287

  
288
	/*
289
	 * (non-Javadoc)
290
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(org.gvsig.fmap.dal.coverage.datastruct.Extent, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer)
291
	 */
292
	public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf) 
293
		throws ProcessInterruptedException, RasterDriverException {
294
		//TODO
295

  
296
		return rasterBuf;
297
	}
298

  
299
	/*
300
	 * (non-Javadoc)
301
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(double, double, double, double, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer, boolean)
302
	 */
303
	public Buffer getWindow(double ulx, double uly, double w, double h, 
304
			BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException {
305
		//TODO
306

  
307
		return rasterBuf;
308
	}
309

  
310
	/*
311
	 * (non-Javadoc)
312
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(double, double, double, double, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer, boolean)
313
	 */
314
	public Buffer getWindow(Extent extent, 
315
			int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException {
316
		//TODO
317
		
318
		return rasterBuf;
319
	}
320

  
321
	/*
322
	 * (non-Javadoc)
323
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(int, int, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer)
324
	 */
325
	public Buffer getWindow(int x, int y, int w, int h, 
326
			BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException {
327
		//TODO
328
		
329
		return rasterBuf;
330
	}
331

  
332
	/*
333
	 * (non-Javadoc)
334
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWindowRaster(int, int, int, int, int, int, org.gvsig.fmap.dal.coverage.datastruct.BandList, org.gvsig.fmap.dal.coverage.dataset.Buffer)
335
	 */
336
	public Buffer getWindow(int x, int y, int w, int h, 
337
			int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException {
338
		//TODO
339
		
340
		return rasterBuf;
341
	}
342

  
343
	/*
344
	 * (non-Javadoc)
345
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getBlockSize()
346
	 */
347
	public int getBlockSize(){
348
		//TODO
349
		
350
		return 0;
351
	}
352

  
353
	/*
354
	 * (non-Javadoc)
355
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getMetadata()
356
	 */
357
	public DataStoreMetadata getMetadata() {
358
		//TODO
359
		
360
		return null;
361
	}
362

  
363
	/*
364
	 * (non-Javadoc)
365
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getColorInterpretation()
366
	 */
367
	public DataStoreColorInterpretation getColorInterpretation(){
368
		//TODO
369
		
370
		return null;
371
	}
372

  
373
	/*
374
	 * (non-Javadoc)
375
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setColorInterpretation(org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation)
376
	 */
377
	public void setColorInterpretation(DataStoreColorInterpretation colorInterpretation){
378
		//TODO
379
	}
380

  
381
	/*
382
	 * (non-Javadoc)
383
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getTransparency()
384
	 */
385
	public DataStoreTransparency getTransparency() {
386
		//TODO
387
		
388
		return null;
389
	}
390

  
391
	/*
392
	 * (non-Javadoc)
393
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isGeoreferenced()
394
	 */
395
	public boolean isGeoreferenced() {
396
		//TODO
397
		
398
		return false;
399
	}
400

  
401
	/**
402
	 * Informa de si el driver ha supersampleado en el ?ltimo dibujado. Es el driver el que colocar?
403
	 * el valor de esta variable cada vez que dibuja.
404
	 * @return true si se ha supersampleado y false si no se ha hecho.
405
	 */
406
	public boolean isSupersampling() {
407
		//TODO
408
		
409
		return false;
410
	}
411

  
412
	/*
413
	 * (non-Javadoc)
414
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setAffineTransform(java.awt.geom.AffineTransform)
415
	 */
416
	public void setAffineTransform(AffineTransform t){
417
		super.setAffineTransform(t);
418
	}
419

  
420
	/*
421
	 * (non-Javadoc)
422
	 * @see org.gvsig.raster.impl.provider.RasterProvider#getOverviewCount(int)
423
	 */
424
	public int getOverviewCount(int band) throws BandAccessException, RasterDriverException {
425
		if(band >= getBandCount())
426
			throw new BandAccessException("Wrong band");
427
		//TODO
428
		
429
		return 0;
430
	}
431

  
432
	/*
433
	 * (non-Javadoc)
434
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewWidth(int, int)
435
	 */
436
	public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException {
437
		if (band >= getBandCount())
438
			throw new BandAccessException("Wrong band");
439
		//TODO
440
		
441
		return 0;
442
	}
443

  
444
	/*
445
	 * (non-Javadoc)
446
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewHeight(int, int)
447
	 */
448
	public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException {
449
		if (band >= getBandCount())
450
			throw new BandAccessException("Wrong band");
451
		//TODO
452
		
453
		return 0;
454
	}
455

  
456
	/*
457
	 * (non-Javadoc)
458
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#overviewsSupport()
459
	 */
460
	public boolean overviewsSupport() {
461
		return true;
462
	}
463

  
464
	/*
465
	 * (non-Javadoc)
466
	 * @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isReproyectable()
467
	 */
468
	public boolean isReproyectable() {
469
		return true;
470
	}
471

  
472
	/*
473
	 * (non-Javadoc)
474
	 * @see org.gvsig.fmap.dal.spi.DataStoreProvider#getName()
475
	 */
476
	public String getName() {
477
		return NAME;
478
	}
479
	
480
	/*
481
	 * (non-Javadoc)
482
	 * @see org.gvsig.raster.impl.provider.RasterProvider#setStatus(org.gvsig.raster.impl.provider.RasterProvider)
483
	 */
484
	public void setStatus(RasterProvider provider) {
485
		if(provider instanceof NetCDFProvider) {
486
			//Not implemented yet
487
		}
488
	}
489
	
490
	/*
491
	 * (non-Javadoc)
492
	 * @see org.gvsig.raster.impl.provider.RasterProvider#getTileServer()
493
	 */
494
	public TileServer getTileServer() {
495
		if(tileServer == null)
496
			tileServer = new FileTileServer(this);
497
		return tileServer;
498
	}
499
}
0 500

  
org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/test/resources/README.txt
1
Put into this folder the resources needed by your test classes.
2

  
3
This folder is added to the Tests classpath, so you can load any resources 
4
through the ClassLoader.
5

  
6
By default, in this folder you can find an example of log4j configuration,
7
prepared to log messages through the console, so logging works when you
8
run your tests classes.
0 9

  
org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
	<!-- Appender configuration to show logging messages through the console -->
10
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
		<layout class="org.apache.log4j.PatternLayout">
12
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
13
		</layout>
14
	</appender>
15

  
16
	<!-- 
17
	Activate logging messages of DEBUG level of higher only for the
18
	org.gvsig.tools packages.
19
	You can put full classes names or packages instead, to configure
20
	logging for all the classes and subpackages of the package.
21
	-->
22
	<category name="org.gvsig.tools">
23
		<priority value="DEBUG" />
24
	</category>
25
	<category name="org.gvsig.raster">
26
		<priority value="DEBUG" />
27
	</category>
28

  
29
	<!-- 
30
	By default, show only logging messages of INFO level or higher, 
31
	through the previously configured CONSOLE appender. 
32
	-->
33
	<root>
34
		<priority value="INFO" />
35
		<appender-ref ref="CONSOLE" />
36
	</root>
37
</log4j:configuration>
0 38

  
org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.wmts.io.DefaultWMTSIOLibrary
org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParameters.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.io;
24

  
25
import java.awt.geom.Rectangle2D;
26

  
27
import org.cresques.cts.IProjection;
28
import org.gvsig.compat.net.ICancellable;
29
import org.gvsig.fmap.dal.coverage.store.parameter.RemoteStoreParameters;
30
import org.gvsig.raster.wmts.ogc.WMTSClient;
31
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
32
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
33

  
34
/**
35
 * Parameters for the WMTS provider
36
 * @author Nacho Brodin (nachobrodin@gmail.com)
37
 */
38
public interface WMTSDataParameters extends RemoteStoreParameters {
39
	public static final String      DYNCLASS_NAME         = "WMTSDataParameters";
40
	public static final String      FIELD_SRS             = "srs";
41
	public static final String      FIELD_IMAGE_FORMAT    = "imageformat";
42
	public static final String      FIELD_INFO_FORMAT     = "infoformat";
43
	public static final String      FIELD_LAYER           = "layer";
44
	public static final String      FIELD_STYLE           = "style";
45
	public static final String      FIELD_NAME            = "name";
46
	public static final String      FIELD_SRSSTR          = "srsstr";
47
	public static final String      FIELD_OVERRIDE        = "override";
48
	public static final String      FIELD_CANCEL          = "cancellable";
49
	public static final String      FIELD_EXTENT          = "extent";
50
	public static final String      FIELD_WIDTH           = "width";
51
	public static final String      FIELD_HEIGHT          = "height";
52
	public static final String      FIELD_DELETECACHE     = "deletecache";
53
	public static final String      OGC_CLIENT            = "ogcclient";
54
	
55
	/**
56
	 * Assign the fields of the selected WMTSDataParameters in the current
57
	 * @param p
58
	 */
59
	public void assignFields(WMTSDataParameters p);
60
	
61
	/**
62
	 * Sets the style selected
63
	 * @param layer
64
	 */
65
	public void setStyle(WMTSStyle layer);
66
	
67
	/**
68
	 * Gets the style
69
	 * @return
70
	 */
71
	public WMTSStyle getStyle();
72
	
73
	/**
74
	 * Gets the image format
75
	 * @return Format
76
	 */
77
	public String getImageFormat();
78

  
79
	/**
80
	 * Sets the image format
81
	 * @param format
82
	 */
83
	public void setImageFormat(String format);
84
	
85
	/**
86
	 * Gets the format of the info by point
87
	 * @return
88
	 */
89
	public String getInfoFormat();
90

  
91
	/**
92
	 * Sets the format of the info by point
93
	 */
94
	public void setInfoFormat(String format);
95
	
96
	/**
97
	 * Sets the layer selected
98
	 * @param layer
99
	 */
100
	public void setLayer(WMTSLayer layer);
101
	
102
	/**
103
	 * Gets the layer
104
	 * @return
105
	 */
106
	public WMTSLayer getLayer();
107
	
108
	/**
109
	 * Devuelve el SRS.
110
	 * @return SRS.
111
	 */
112
	public String getSRSCode();
113
	
114
	public void setSRS(String m_srs);
115
	
116
	public void setSRS(IProjection srs);
117

  
118
	/**
119
	 * Returns the projection
120
	 * @return
121
	 */
122
	public IProjection getSRS();
123
	
124
	/**
125
	 * Returns true if the layer is projected
126
	 * @return
127
	 */
128
	public boolean isProjected();
129
	
130
	public String getSRSID();
131

  
132
	public void setSRSID(String srsid);
133
	
134
	/**
135
	 * Returns the current selected SRS.
136
	 * @return
137
	 */
138
	public String getEPSG(String value);
139
	
140
	public String getName();
141

  
142
	public void setName(String name);
143
	
144
	public void setCancellable(ICancellable cancel);
145
	
146
	public ICancellable getCancellable();
147
	
148
	public boolean isOverridingHost();
149
	
150
	public void setOverrideHost(boolean over);
151
	/**
152
	 * Assigns the extent. 
153
	 * When a provider is initialized this will need to know what is the extent before the request.
154
	 * 
155
	 * @param bBox
156
	 */
157
	public void setExtent(Rectangle2D bBox);
158
	
159
	/**
160
	 * Sets the width
161
	 * When a provider is initialized this will need to know what is the width before the request.
162
	 * @param w
163
	 */
164
	public void setWidth(int w);
165
	
166
	/**
167
	 * Sets the height
168
	 * When a provider is initialized this will need to know what is the height before the request.
169
	 * @param h
170
	 */
171
	public void setHeight(int h);
172
	
173
	/**
174
	 * Gets the bounding box
175
	 * @return
176
	 */
177
	public Rectangle2D getExtent();
178
	
179
	/**
180
	 * Gets the width
181
	 * @return
182
	 */
183
	public int getWidth();
184
	
185
	/**
186
	 * Gets the height
187
	 * @return
188
	 */
189
	public int getHeight();
190
	
191
	public boolean isSizeFixed();
192

  
193
	public void setURI(String params);
194

  
195
	public String getURI();
196
	
197
	public WMTSClient getOGCClient();
198
	
199
	public void setOGCClient(WMTSClient ogcClient);
200
}
0 201

  
org.gvsig.raster.wmts/tags/tagdate_06112013_13_59/org.gvsig.raster.wmts/org.gvsig.raster.wmts.io/src/main/java/org/gvsig/raster/wmts/io/WMTSDataParametersImpl.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.io;
24

  
25

  
26
import java.awt.geom.Rectangle2D;
27

  
28
import org.cresques.cts.IProjection;
29
import org.gvsig.compat.net.ICancellable;
30
import org.gvsig.fmap.crs.CRSFactory;
31
import org.gvsig.raster.impl.store.AbstractRasterDataParameters;
32
import org.gvsig.raster.wmts.ogc.WMTSClient;
33
import org.gvsig.raster.wmts.ogc.struct.WMTSLayer;
34
import org.gvsig.raster.wmts.ogc.struct.WMTSStyle;
35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dataTypes.DataTypes;
37
import org.gvsig.tools.dynobject.DelegatedDynObject;
38
import org.gvsig.tools.dynobject.DynClass;
39
import org.gvsig.tools.dynobject.DynField;
40
import org.gvsig.tools.dynobject.DynObjectManager;
41
import org.gvsig.tools.dynobject.DynStruct;
42
import org.gvsig.tools.persistence.PersistenceManager;
43
import org.gvsig.tools.persistence.PersistentState;
44
import org.gvsig.tools.persistence.exception.PersistenceException;
45
import org.slf4j.LoggerFactory;
46

  
47
/**
48
 * Parameters for the WMTS provider
49
 * @author Nacho Brodin (nachobrodin@gmail.com)
50
 */
51
public class WMTSDataParametersImpl extends AbstractRasterDataParameters implements WMTSDataParameters {
52
	private DelegatedDynObject       delegatedDynObject    = null;
53
	protected static DynClass        DYNCLASS              = null;
54
	//private Logger                   log                   = LoggerFactory.getLogger(WMTSDataParametersImpl.class);
55
	
56
	public static void registerPersistence() {
57
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
58
		DynStruct definition = manager.getDefinition("WMTSDataParametersImpl_Persistent");
59
		if( definition == null ) {
60
			definition = manager.addDefinition(
61
					WMTSDataParametersImpl.class,
62
					"WMTSDataParametersImpl_Persistent",
63
					"WMTS DataParameters Persistency",
64
					null, 
65
					null
66
			);
67
			AbstractRasterDataParameters.registerPersistence(definition);
68
			
69
			definition.addDynFieldObject(FIELD_EXTENT).setClassOfValue(Rectangle2D.class).setMandatory(false);
70
			definition.addDynFieldString(FIELD_IMAGE_FORMAT).setMandatory(false);
71
			definition.addDynFieldString(FIELD_INFO_FORMAT).setMandatory(false);
72
			definition.addDynFieldString(FIELD_NAME).setMandatory(false);			
73
			definition.addDynFieldString(FIELD_SRSSTR).setMandatory(false);
74
			definition.addDynFieldBoolean(FIELD_OVERRIDE).setMandatory(false);
75
		}
76
	}
77
	
78
	@Override
79
	public void saveToState(PersistentState state) throws PersistenceException {
80
		super.saveToState(state);
81
		
82
		state.set(FIELD_NAME, getName());	
83
		state.set(FIELD_SRSSTR, getSRSCode());
84
		state.set(FIELD_OVERRIDE, isOverridingHost());
85
		state.set(FIELD_EXTENT, getExtent());
86
		state.set(FIELD_IMAGE_FORMAT, getImageFormat());
87
		state.set(FIELD_INFO_FORMAT, getInfoFormat());
88
	}
89
	
90
	@Override
91
	public void loadFromState(PersistentState state)
92
			throws PersistenceException {
93
		super.loadFromState(state);
94
		
95
		setImageFormat(state.getString(FIELD_IMAGE_FORMAT));
96
		setInfoFormat(state.getString(FIELD_INFO_FORMAT));
97
		setName(state.getString(FIELD_NAME));
98
		setSRS(state.getString(FIELD_SRSSTR));
99
		setOverrideHost(state.getBoolean(FIELD_OVERRIDE));
100
		setExtent((Rectangle2D)state.get(FIELD_EXTENT));
101
	}
102
	
103
	/*
104
	 * (non-Javadoc)
105
	 * @see org.gvsig.raster.wmts.io.WMTSDataParameters#assignFields(org.gvsig.raster.wmts.io.WMTSDataParameters)
106
	 */
107
	public void assignFields(WMTSDataParameters p) {
108
		setImageFormat(p.getImageFormat());
109
		setInfoFormat(p.getInfoFormat());
110
		setName(p.getName());
111
		setSRS(p.getSRSCode());
112
		setOverrideHost(p.isOverridingHost());
113
		setExtent(p.getExtent());
114
	}
115
	 
116
	public WMTSDataParametersImpl() {
117
		super();
118
		initialize();
119
	}
120
	
121
	protected void initialize() {
122
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
123
				.getDynObjectManager().createDynObject(
124
						DYNCLASS);
125
	}
126
	
127
	@SuppressWarnings("deprecation")
128
	public static void registerDynClass() {
129
		DynObjectManager dynman = ToolsLocator.getDynObjectManager();
130
		DynClass dynClass;
131
		DynField field;
132
		
133
		if(dynman == null)
134
			return;
135
		
136
		if (DYNCLASS == null) {
137
			dynClass = AbstractRasterDataParameters.registerDynClass(WMTSDataParametersImpl.DYNCLASS_NAME);
138

  
139
			field = dynClass.addDynField(FIELD_LAYER);
140
			field.setTheTypeOfAvailableValues(DynField.ANY);
141
			field.setDescription("Layer");
142
			field.setType(DataTypes.OBJECT);
143
			field.setMandatory(false);
144
			
145
			field = dynClass.addDynField(FIELD_STYLE);
146
			field.setTheTypeOfAvailableValues(DynField.ANY);
147
			field.setDescription("Style");
148
			field.setType(DataTypes.OBJECT);
149
			field.setMandatory(false);
150
			
151
			field = dynClass.addDynField(FIELD_SRS);
152
			field.setTheTypeOfAvailableValues(DynField.ANY);
153
			field.setDescription("SRS");
154
			field.setType(org.cresques.DataTypes.CRS);
155
			field.setMandatory(false);
156

  
157
			field = dynClass.addDynField(FIELD_IMAGE_FORMAT);
158
			field.setTheTypeOfAvailableValues(DynField.ANY);
159
			field.setDescription("Image Format");
160
			field.setType(DataTypes.STRING);
161
			field.setMandatory(false);
162

  
163
			field = dynClass.addDynField(FIELD_INFO_FORMAT);
164
			field.setTheTypeOfAvailableValues(DynField.ANY);
165
			field.setDescription("Info Format");
166
			field.setType(DataTypes.STRING);
167
			field.setMandatory(false);
168
			
169
			field = dynClass.addDynField(FIELD_NAME);
170
			field.setTheTypeOfAvailableValues(DynField.ANY);
171
			field.setDescription("Name");
172
			field.setType(DataTypes.STRING);
173
			field.setMandatory(false);
174
			
175
			field = dynClass.addDynField(FIELD_SRSSTR);
176
			field.setTheTypeOfAvailableValues(DynField.ANY);
177
			field.setDescription("String that represents the SRS");
178
			field.setType(DataTypes.STRING);
179
			field.setMandatory(false);
180
			
181
			field = dynClass.addDynField(FIELD_OVERRIDE);
182
			field.setTheTypeOfAvailableValues(DynField.ANY);
183
			field.setDescription("Override a host capabilities");
184
			field.setType(DataTypes.BOOLEAN);
185
			field.setMandatory(false);
186
			
187
			field = dynClass.addDynField(FIELD_CANCEL);
188
			field.setTheTypeOfAvailableValues(DynField.ANY);
189
			field.setDescription("Cancellable");
190
			field.setType(DataTypes.OBJECT);
191
			field.setMandatory(false);
192
			
193
			field = dynClass.addDynField(FIELD_EXTENT);
194
			field.setTheTypeOfAvailableValues(DynField.ANY);
195
			field.setDescription("Extent");
196
			field.setType(DataTypes.OBJECT);
197
			field.setMandatory(false);
198
			
199
			field = dynClass.addDynField(FIELD_WIDTH);
200
			field.setTheTypeOfAvailableValues(DynField.ANY);
201
			field.setDescription("Width");
202
			field.setType(DataTypes.INT);
203
			field.setMandatory(false);
204
			
205
			field = dynClass.addDynField(FIELD_HEIGHT);
206
			field.setTheTypeOfAvailableValues(DynField.ANY);
207
			field.setDescription("Height");
208
			field.setType(DataTypes.INT);
209
			field.setMandatory(false);
210
			
211
			field = dynClass.addDynField(FIELD_DELETECACHE);
212
			field.setTheTypeOfAvailableValues(DynField.ANY);
213
			field.setDescription("Flag to delete cache the next request");
214
			field.setType(DataTypes.BOOLEAN);
215
			field.setMandatory(false);
216
			
217
			field = dynClass.addDynFieldObject(OGC_CLIENT);
218
			field.setDescription("Driver to get access OGC library");
219
			field.setClassOfValue(Object.class); 
220
			field.setMandatory(false);
221
			
222
			DYNCLASS = dynClass;
223
		}
224

  
225
	}
226
	
227
	/**
228
	 * Sets the style selected
229
	 * @param layer
230
	 */
231
	public void setStyle(WMTSStyle layer) {
232
		this.setDynValue(FIELD_STYLE, layer);
233
	}
234
	
235
	/**
236
	 * Gets the style
237
	 * @return
238
	 */
239
	public WMTSStyle getStyle() {
240
		return (WMTSStyle) this.getDynValue(FIELD_STYLE);
241
	}
242
	
243
	/**
244
	 * Gets the image format
245
	 * @return Format
246
	 */
247
	public String getImageFormat() {
248
		return (String) this.getDynValue(FIELD_IMAGE_FORMAT);
249
	}
250

  
251
	/**
252
	 * Sets the image format
253
	 * @param format
254
	 */
255
	public void setImageFormat(String format) {
256
		this.setDynValue(FIELD_IMAGE_FORMAT, format);
257
	}
258
	
259
	/*
260
	 * (non-Javadoc)
261
	 * @see org.gvsig.fmap.dal.coverage.store.parameter.WMTSStoreParameters#getImageFormat()
262
	 */
263
	public String getInfoFormat() {
264
		return (String) this.getDynValue(FIELD_INFO_FORMAT);
265
	}
266

  
267
	/*
268
	 * (non-Javadoc)
269
	 * @see org.gvsig.fmap.dal.coverage.store.parameter.WMTSStoreParameters#setImageFormat(java.lang.String)
270
	 */
271
	public void setInfoFormat(String format) {
272
		this.setDynValue(FIELD_INFO_FORMAT, format);
273
	}
274
	
275
	/**
276
	 * Sets the layer selected
277
	 * @param layer
278
	 */
279
	public void setLayer(WMTSLayer layer) {
280
		this.setDynValue(FIELD_LAYER, layer);
281
	}
282
	
283
	/**
284
	 * Gets the layer
285
	 * @return
286
	 */
287
	public WMTSLayer getLayer() {
288
		return (WMTSLayer) this.getDynValue(FIELD_LAYER);
289
	}
290
	
291
	/**
292
	 * Devuelve el SRS.
293
	 * @return SRS.
294
	 */
295
	public String getSRSCode() {
296
		return (String) this.getDynValue(FIELD_SRSSTR);
297
	}
298
	
299
	public void setSRS(String m_srs) {
300
		if(m_srs.compareTo("CRS:84") == 0)
301
			m_srs = "EPSG:4326";
302
		this.setDynValue(FIELD_SRSSTR, m_srs);
303
		if(getEPSG(m_srs) != null)
304
			setSRS(CRSFactory.getCRS(getEPSG(m_srs)));
305
	}
306
	
307
	public void setSRS(IProjection srs) {
308
		setDynValue(FIELD_SRS, srs);
309
	}
310

  
311
	/**
312
	 * Returns the projection
313
	 * @return
314
	 */
315
	public IProjection getSRS() {
316
		if (this.getSRSID() == null) {
317
			return null;
318
		}
319
		return (IProjection) getDynValue(FIELD_SRS);
320
	}
321
	
322
	/**
323
	 * Returns true if the layer is projected
324
	 * @return
325
	 */
326
	public boolean isProjected() {
327
		IProjection proj = getSRS();
328
		if(proj == null)
329
			return true;
330
		else {
331
			try {
332
				return proj.isProjected();
333
			} catch (Exception e) {
334
				LoggerFactory.getLogger(WMTSDataParameters.class).debug("error in projection", e);
335
				return true;
336
			}
337
		}
338
	}
339
	
340
	public String getSRSID() {
341
		IProjection srs = (IProjection) getDynValue(FIELD_SRS);
342
		if (srs == null) {
343
			return null;
344
		}
345
		return srs.getAbrev();
346
	}
347

  
348
	public void setSRSID(String srsid) {
349
		if (srsid == null) {
350
			setDynValue(FIELD_SRS, null);
351
		} else {
352
			setDynValue(FIELD_SRS, CRSFactory.getCRS(getEPSG(srsid)));
353
		}
354
	}
355
	
356
	/**
357
	 * Returns the current selected SRS.
358
	 * @return
359
	 */
360
	public String getEPSG(String value) {
361
		if(value != null) {
362
			if(value.compareTo("CRS:84") == 0)
363
				return "EPSG:4326";
364

  
365
			String s = value.substring(value.lastIndexOf(":") + 1);
366
			return "EPSG:" + s;
367
		}
368
		return null;
369
	}
370
	
371
	public String getName() {
372
		return (String) this.getDynValue(FIELD_NAME);
373
	}
374

  
375
	public void setName(String name) {
376
		this.setDynValue(FIELD_NAME, name);
377
	}
378
	
379
	public void setCancellable(ICancellable cancel) {
380
		this.setDynValue(FIELD_CANCEL, cancel);
381
	}
382
	
383
	public ICancellable getCancellable() {
384
		return (ICancellable) this.getDynValue(FIELD_CANCEL);
385
	}
386
	
387
	/*
388
	 * (non-Javadoc)
389
	 * @see org.gvsig.fmap.dal.coverage.store.RasterStoreParameters#isOverridingHost()
390
	 */
391
	public boolean isOverridingHost() {
392
		Boolean b = (Boolean)getDynValue(FIELD_OVERRIDE);
393
		if(b != null)
394
			return ((Boolean)b).booleanValue();
395
		return false;
396
	}
397
	
398
	/*
399
	 * (non-Javadoc)
400
	 * @see org.gvsig.fmap.dal.coverage.store.RasterStoreParameters#setOverrideHost(boolean)
401
	 */
402
	public void setOverrideHost(boolean over) {
403
		this.setDynValue(FIELD_OVERRIDE, new Boolean(over));;
404
	}
405

  
406
	/**
407
	 * Assigns the extent. 
408
	 * When a provider is initialized this will need to know what is the extent before the request.
409
	 * 
410
	 * @param bBox
411
	 */
412
	public void setExtent(Rectangle2D bBox) {
413
		this.setDynValue(FIELD_EXTENT, bBox);
414
	}
415
	
416
	/**
417
	 * Sets the width
418
	 * When a provider is initialized this will need to know what is the width before the request.
419
	 * @param w
420
	 */
421
	public void setWidth(int w) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff