Revision 208
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.fmap/src/main/java/org/gvsig/raster/fmap/layers/DefaultFLyrRaster.java | ||
---|---|---|
420 | 420 |
params.setParam("colorTable", table); |
421 | 421 |
colorTableManager.addFilter(params); |
422 | 422 |
} else //sino hace lo que dice en las preferencias |
423 |
if (getDataType()[0] != Buffer.TYPE_BYTE)
|
|
423 |
if (!(getDataStore().getBandCount() >= 3 && getDataType()[0] == Buffer.TYPE_BYTE))
|
|
424 | 424 |
loadEnhancedOrColorTable(filterList); |
425 | 425 |
loadedFromProject = null; |
426 | 426 |
|
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.main/src/test/java/org/gvsig/fmap/dal/coverage/dataset/io/wmts/TestWMTSDriver.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
import java.net.MalformedURLException; |
25 | 25 |
import java.net.URL; |
26 |
import java.util.ArrayList; |
|
26 | 27 |
|
27 | 28 |
import org.gvsig.fmap.dal.coverage.BaseTestCase; |
28 | 29 |
import org.gvsig.fmap.dal.coverage.dataset.io.server.DefaultWMSServerExplorerParameters; |
... | ... | |
35 | 36 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
36 | 37 |
import org.gvsig.remoteclient.wmts.struct.WMTSTheme; |
37 | 38 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes; |
39 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
38 | 40 |
|
39 | 41 |
/** |
40 | 42 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
... | ... | |
69 | 71 |
String title = explorer.getTitle(); |
70 | 72 |
String version = explorer.getVersion(); |
71 | 73 |
WMTSThemes themes = explorer.getThemes(); |
72 |
System.out.println("===>>>" + title); |
|
74 |
System.out.println("Title: " + title); |
|
75 |
System.out.println("Version: " + version); |
|
73 | 76 |
|
74 | 77 |
for (int i = 0; i < themes.size(); i++) { |
75 | 78 |
WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer(); |
... | ... | |
77 | 80 |
layer.print(); |
78 | 81 |
} |
79 | 82 |
|
83 |
/*ArrayList<WMTSTileMatrixSet> tileMatrixSet = explorer.getTileMatrixSet(); |
|
84 |
for (int i = 0; i < tileMatrixSet.size(); i++) { |
|
85 |
WMTSTileMatrixSet tms = tileMatrixSet.get(i); |
|
86 |
tms.print(); |
|
87 |
}*/ |
|
88 |
|
|
80 | 89 |
} catch (MalformedURLException e) { |
81 | 90 |
e.printStackTrace(); |
82 | 91 |
} catch (InitializeException e) { |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.api/src/main/java/org/gvsig/fmap/dal/coverage/explorer/WMTSServerExplorer.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
package org.gvsig.fmap.dal.coverage.explorer; |
24 | 24 |
|
25 |
import java.util.ArrayList; |
|
26 |
|
|
25 | 27 |
import org.gvsig.compat.net.ICancellable; |
26 | 28 |
import org.gvsig.fmap.dal.DataServerExplorer; |
27 | 29 |
import org.gvsig.fmap.dal.coverage.exception.WMSException; |
28 | 30 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
29 | 31 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes; |
32 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
30 | 33 |
|
31 | 34 |
|
32 | 35 |
/** |
... | ... | |
80 | 83 |
* @return |
81 | 84 |
*/ |
82 | 85 |
public WMTSLayer getLayer(String layerName); |
86 |
|
|
87 |
/** |
|
88 |
* Gets the set of tiles definition |
|
89 |
* @return |
|
90 |
*/ |
|
91 |
public ArrayList<WMTSTileMatrixSet> getTileMatrixSet(); |
|
83 | 92 |
|
84 | 93 |
/** |
85 | 94 |
* Gets the url of this host |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.io/org.gvsig.raster.io.base/src/main/java/org/gvsig/fmap/dal/coverage/dataset/io/server/WMTSServerExplorerImpl.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.io.IOException; |
31 | 31 |
import java.net.URL; |
32 |
import java.util.ArrayList; |
|
32 | 33 |
import java.util.List; |
33 | 34 |
|
34 | 35 |
import org.gvsig.compat.net.ICancellable; |
... | ... | |
36 | 37 |
import org.gvsig.fmap.dal.DataStoreParameters; |
37 | 38 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
38 | 39 |
import org.gvsig.fmap.dal.coverage.dataset.io.param.WMSStoreParametersImpl; |
39 |
import org.gvsig.fmap.dal.coverage.dataset.io.wms.WMSDriver; |
|
40 | 40 |
import org.gvsig.fmap.dal.coverage.dataset.io.wmts.WMTSConnector; |
41 |
import org.gvsig.fmap.dal.coverage.dataset.io.wmts.WMTSDriver;
|
|
41 |
import org.gvsig.fmap.dal.coverage.dataset.io.wmts.WMTSProvider;
|
|
42 | 42 |
import org.gvsig.fmap.dal.coverage.exception.WMSException; |
43 | 43 |
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer; |
44 | 44 |
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorerParameters; |
... | ... | |
49 | 49 |
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices; |
50 | 50 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
51 | 51 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes; |
52 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
52 | 53 |
|
53 | 54 |
/** |
54 | 55 |
* Explorer for a WMTS server |
... | ... | |
70 | 71 |
* @see org.gvsig.fmap.dal.coverage.store.remote.RemoteServerExplorerProvider#getDataStoreProviderName() |
71 | 72 |
*/ |
72 | 73 |
public String getDataStoreProviderName() { |
73 |
return WMSDriver.NAME;
|
|
74 |
return WMTSProvider.NAME;
|
|
74 | 75 |
} |
75 | 76 |
|
76 | 77 |
/* |
... | ... | |
78 | 79 |
* @see org.gvsig.fmap.dal.coverage.store.remote.RemoteServerExplorerProvider#getDescription() |
79 | 80 |
*/ |
80 | 81 |
public String getDescription() { |
81 |
return WMSDriver.DESCRIPTION;
|
|
82 |
return WMTSProvider.DESCRIPTION;
|
|
82 | 83 |
} |
83 | 84 |
|
84 | 85 |
/* |
... | ... | |
162 | 163 |
throw new WMSException("Malformed URL",e); |
163 | 164 |
} |
164 | 165 |
try { |
165 |
connector = WMTSDriver.getConnectorFromURL(url);
|
|
166 |
connector = WMTSProvider.getConnectorFromURL(url);
|
|
166 | 167 |
if (!connector.connect(override, cancellable)) |
167 | 168 |
throw new WMSException("Error connecting"); |
168 | 169 |
} catch (IOException e) { |
... | ... | |
224 | 225 |
public WMTSLayer getLayer(String layerName) { |
225 | 226 |
return connector.getLayer(layerName); |
226 | 227 |
} |
228 |
|
|
229 |
/* |
|
230 |
* (non-Javadoc) |
|
231 |
* @see org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer#getTileMatrixSet() |
|
232 |
*/ |
|
233 |
public ArrayList<WMTSTileMatrixSet> getTileMatrixSet() { |
|
234 |
return connector.getTileMatrixSet(); |
|
235 |
} |
|
227 | 236 |
|
228 | 237 |
/* |
229 | 238 |
* (non-Javadoc) |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.io/org.gvsig.raster.io.base/src/main/java/org/gvsig/fmap/dal/coverage/dataset/io/wmts/WMTSDriver.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.wmts; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.awt.geom.NoninvertibleTransformException; |
|
26 |
import java.awt.geom.Point2D; |
|
27 |
import java.awt.geom.Rectangle2D; |
|
28 |
import java.io.File; |
|
29 |
import java.io.IOException; |
|
30 |
import java.net.URL; |
|
31 |
import java.util.Hashtable; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.DALLocator; |
|
34 |
import org.gvsig.fmap.dal.DataStore; |
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
37 |
import org.gvsig.fmap.dal.coverage.dataset.io.param.WMSStoreParametersImpl; |
|
38 |
import org.gvsig.fmap.dal.coverage.dataset.io.server.DefaultWMSServerExplorerParameters; |
|
39 |
import org.gvsig.fmap.dal.coverage.dataset.io.server.WMSServerExplorerImpl; |
|
40 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
41 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
42 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
43 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
44 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
45 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
46 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
47 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
48 |
import org.gvsig.fmap.dal.coverage.exception.WMSException; |
|
49 |
import org.gvsig.fmap.dal.coverage.explorer.WMSServerExplorer; |
|
50 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
|
51 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
52 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
53 |
import org.gvsig.metadata.MetadataLocator; |
|
54 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
|
55 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
56 |
import org.gvsig.raster.impl.provider.RemoteRasterProvider; |
|
57 |
import org.gvsig.raster.impl.store.AbstractRasterDataStore; |
|
58 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
|
59 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
60 |
import org.gvsig.tools.ToolsLocator; |
|
61 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
62 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
63 |
/** |
|
64 |
* Clase que representa al driver de acceso a datos de wmts. |
|
65 |
* |
|
66 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
67 |
*/ |
|
68 |
public class WMTSDriver extends DefaultRasterProvider implements RemoteRasterProvider { |
|
69 |
public static String NAME = "Wmts Store"; |
|
70 |
public static String DESCRIPTION = "Wmts Raster file"; |
|
71 |
public static final String METADATA_DEFINITION_NAME = "WmtsStore"; |
|
72 |
|
|
73 |
private Extent viewRequest = null; |
|
74 |
private static Hashtable<URL, WMTSConnector> |
|
75 |
drivers = new Hashtable<URL, WMTSConnector> (); |
|
76 |
private boolean open = false; |
|
77 |
//Only for fixed size. Complete extent and FIXED_SIZE in long side |
|
78 |
private File lastRequest = null; |
|
79 |
|
|
80 |
public static void register() { |
|
81 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
82 |
ExtensionPoint point = extensionPoints.get("RasterReader"); |
|
83 |
point.append("wmts", "", WMTSDriver.class); |
|
84 |
|
|
85 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
86 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
87 |
dataman.registerStoreProvider(NAME, |
|
88 |
WMTSDriver.class, WMSStoreParametersImpl.class); |
|
89 |
} |
|
90 |
|
|
91 |
if (!dataman.getExplorerProviders().contains(WMSServerExplorerImpl.NAME)) { |
|
92 |
dataman.registerExplorerProvider(WMSServerExplorer.NAME, WMSServerExplorerImpl.class, DefaultWMSServerExplorerParameters.class); |
|
93 |
} |
|
94 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
95 |
} |
|
96 |
|
|
97 |
public WMTSDriver() throws NotSupportedExtensionException { |
|
98 |
super(); |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* Constructor. Abre el dataset. |
|
103 |
* @param proj Proyecci?n |
|
104 |
* @param fName Nombre del fichero |
|
105 |
* @throws NotSupportedExtensionException |
|
106 |
*/ |
|
107 |
public WMTSDriver(String params) throws NotSupportedExtensionException { |
|
108 |
super(params); |
|
109 |
if(params instanceof String) { |
|
110 |
WMSStoreParametersImpl p = new WMSStoreParametersImpl(); |
|
111 |
p.setHost((String)params); |
|
112 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
|
113 |
.createDynObject( |
|
114 |
MetadataLocator.getMetadataManager().getDefinition( |
|
115 |
DataStore.METADATA_DEFINITION_NAME))); |
|
116 |
init(p, null); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
public WMTSDriver(WMSStoreParametersImpl params, |
|
121 |
AbstractRasterDataStore storeServices) throws NotSupportedExtensionException { |
|
122 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
123 |
.createDynObject( |
|
124 |
MetadataLocator.getMetadataManager().getDefinition( |
|
125 |
DataStore.METADATA_DEFINITION_NAME))); |
|
126 |
init(params, storeServices); |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
130 |
* Gets the connector from the URL |
|
131 |
* @return |
|
132 |
* @throws WMSException |
|
133 |
*/ |
|
134 |
@SuppressWarnings("unused") |
|
135 |
private WMTSConnector getConnector() throws WMSException { |
|
136 |
WMSStoreParametersImpl p = (WMSStoreParametersImpl)parameters; |
|
137 |
URL url = null; |
|
138 |
try { |
|
139 |
url = new URL(p.getHost()); |
|
140 |
} catch (Exception e) { |
|
141 |
throw new WMSException("Malformed URL",e); |
|
142 |
} |
|
143 |
try { |
|
144 |
return WMTSDriver.getConnectorFromURL(url); |
|
145 |
} catch (IOException e) { |
|
146 |
throw new WMSException("Error getting the connector",e); |
|
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* Crea las referencias al fichero y carga |
|
152 |
* las estructuras con la informaci?n y los metadatos. |
|
153 |
* @param proj Proyecci?n |
|
154 |
* @param param Parametros de carga |
|
155 |
* @throws NotSupportedExtensionException |
|
156 |
*/ |
|
157 |
public void init (DataStoreParameters params, |
|
158 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
159 |
setParam(params); |
|
160 |
setDataType(new int[]{Buffer.TYPE_BYTE, Buffer.TYPE_BYTE, Buffer.TYPE_BYTE}); |
|
161 |
bandCount = 3; |
|
162 |
} |
|
163 |
|
|
164 |
public static final WMTSConnector getConnectorFromURL(URL url) throws IOException { |
|
165 |
WMTSConnector drv = (WMTSConnector) drivers.get(url); |
|
166 |
if (drv == null) { |
|
167 |
drv = new WMTSConnector(url); |
|
168 |
drivers.put(url, drv); |
|
169 |
} |
|
170 |
return drv; |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 |
* Obtiene el objeto que contiene que contiene la interpretaci?n de |
|
175 |
* color por banda |
|
176 |
* @return |
|
177 |
*/ |
|
178 |
public DataStoreColorInterpretation getColorInterpretation() { |
|
179 |
if(colorInterpretation == null) { |
|
180 |
colorInterpretation = new DataStoreColorInterpretation(); |
|
181 |
colorInterpretation.initColorInterpretation(getBandCount()); |
|
182 |
colorInterpretation.setColorInterpValue(0, DataStoreColorInterpretation.RED_BAND); |
|
183 |
colorInterpretation.setColorInterpValue(1, DataStoreColorInterpretation.GREEN_BAND); |
|
184 |
colorInterpretation.setColorInterpValue(2, DataStoreColorInterpretation.BLUE_BAND); |
|
185 |
} |
|
186 |
return colorInterpretation; |
|
187 |
} |
|
188 |
|
|
189 |
/* |
|
190 |
* (non-Javadoc) |
|
191 |
* @see org.gvsig.fmap.dal.coverage.dataset.RasterDataSet#getAffineTransform() |
|
192 |
*/ |
|
193 |
public AffineTransform getAffineTransform() { |
|
194 |
return null; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Calcula el extent en coordenadas del mundo real |
|
199 |
* @return Extent |
|
200 |
*/ |
|
201 |
public Extent getExtent() { |
|
202 |
return null; |
|
203 |
} |
|
204 |
|
|
205 |
|
|
206 |
/* |
|
207 |
* (non-Javadoc) |
|
208 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getLayerExtent(java.lang.String, java.lang.String) |
|
209 |
*/ |
|
210 |
public Rectangle2D getLayerExtent(String layerName, String srs) throws WMSException { |
|
211 |
return null; |
|
212 |
} |
|
213 |
|
|
214 |
/* |
|
215 |
* (non-Javadoc) |
|
216 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#load() |
|
217 |
*/ |
|
218 |
public RasterProvider load() { |
|
219 |
return this; |
|
220 |
} |
|
221 |
|
|
222 |
/* |
|
223 |
* (non-Javadoc) |
|
224 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isOpen() |
|
225 |
*/ |
|
226 |
public boolean isOpen() { |
|
227 |
return open; |
|
228 |
} |
|
229 |
|
|
230 |
/* |
|
231 |
* (non-Javadoc) |
|
232 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#close() |
|
233 |
*/ |
|
234 |
public void close() { |
|
235 |
open = false; |
|
236 |
} |
|
237 |
|
|
238 |
/* |
|
239 |
* (non-Javadoc) |
|
240 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getTransparency() |
|
241 |
*/ |
|
242 |
public Transparency getTransparency() { |
|
243 |
return null; |
|
244 |
} |
|
245 |
|
|
246 |
/* |
|
247 |
* (non-Javadoc) |
|
248 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#translateFileName(java.lang.String) |
|
249 |
*/ |
|
250 |
public String translateFileName(String fileName) { |
|
251 |
return fileName; |
|
252 |
} |
|
253 |
|
|
254 |
/* |
|
255 |
* (non-Javadoc) |
|
256 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setView(org.gvsig.fmap.dal.coverage.datastruct.Extent) |
|
257 |
*/ |
|
258 |
public void setView(Extent e) { |
|
259 |
viewRequest = e; |
|
260 |
} |
|
261 |
|
|
262 |
/* |
|
263 |
* (non-Javadoc) |
|
264 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getView() |
|
265 |
*/ |
|
266 |
public Extent getView() { |
|
267 |
return viewRequest; |
|
268 |
} |
|
269 |
|
|
270 |
/* |
|
271 |
* (non-Javadoc) |
|
272 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWidth() |
|
273 |
*/ |
|
274 |
public double getWidth() { |
|
275 |
return 0; |
|
276 |
} |
|
277 |
|
|
278 |
/* |
|
279 |
* (non-Javadoc) |
|
280 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getHeight() |
|
281 |
*/ |
|
282 |
public double getHeight() { |
|
283 |
return 0; |
|
284 |
} |
|
285 |
|
|
286 |
/* |
|
287 |
* (non-Javadoc) |
|
288 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#readCompleteLine(int, int) |
|
289 |
*/ |
|
290 |
public Object readCompleteLine(int line, int band) |
|
291 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
292 |
return null; |
|
293 |
} |
|
294 |
|
|
295 |
/** |
|
296 |
* When the remote layer has fixed size this method downloads the file and return its reference. |
|
297 |
* File layer has in the long side FIXED_SIZE pixels and the bounding box is complete. This file could be |
|
298 |
* useful to build an histogram or calculate statistics. This represents a sample of data. |
|
299 |
* @return |
|
300 |
* @throws RasterDriverException |
|
301 |
*/ |
|
302 |
public File getFileLayer() throws RasterDriverException { |
|
303 |
return null; |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* Reads a complete block of data and returns an tridimensional array of the right type. This function is useful |
|
308 |
* to read a file very fast without setting a view. In a WMS service when the size is fixed then it will read the |
|
309 |
* entire image but when the source hasn't pixel size it will read a sample of data. This set of data will have |
|
310 |
* the size defined in FIXED_SIZE. |
|
311 |
* |
|
312 |
* @param pos Posici?n donde se empieza a leer |
|
313 |
* @param blockHeight Altura m?xima del bloque leido |
|
314 |
* @return Object que es un array tridimendional del tipo de datos del raster. (Bandas X Filas X Columnas) |
|
315 |
* @throws InvalidSetViewException |
|
316 |
* @throws FileNotOpenException |
|
317 |
* @throws RasterDriverException |
|
318 |
*/ |
|
319 |
public Object readBlock(int pos, int blockHeight) |
|
320 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
321 |
return null; |
|
322 |
} |
|
323 |
|
|
324 |
/* |
|
325 |
* (non-Javadoc) |
|
326 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getData(int, int, int) |
|
327 |
*/ |
|
328 |
public Object getData(int x, int y, int band) |
|
329 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
330 |
return null; |
|
331 |
} |
|
332 |
|
|
333 |
/** |
|
334 |
* Assigns the list of bands RGB and read a window of data |
|
335 |
* @param rasterBuf |
|
336 |
* @param bandList |
|
337 |
* @param lastFile |
|
338 |
* @param ulx |
|
339 |
* @param uly |
|
340 |
* @param lrx |
|
341 |
* @param lry |
|
342 |
* @return |
|
343 |
* @throws RasterDriverException |
|
344 |
* @throws ProcessInterruptedException |
|
345 |
*/ |
|
346 |
public Buffer getBuffer(Buffer rasterBuf, BandList bandList, File lastFile, |
|
347 |
double ulx, double uly, double lrx, double lry) throws RasterDriverException, ProcessInterruptedException { |
|
348 |
return null; |
|
349 |
} |
|
350 |
|
|
351 |
/* |
|
352 |
* (non-Javadoc) |
|
353 |
* @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) |
|
354 |
*/ |
|
355 |
public Buffer getWindowRaster(double ulx, double uly, double lrx, double lry, |
|
356 |
BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
357 |
return null; |
|
358 |
} |
|
359 |
|
|
360 |
/* |
|
361 |
* (non-Javadoc) |
|
362 |
* @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) |
|
363 |
*/ |
|
364 |
public Buffer getWindowRaster(double ulx, double uly, double w, double h, |
|
365 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
366 |
return null; |
|
367 |
} |
|
368 |
|
|
369 |
/* |
|
370 |
* (non-Javadoc) |
|
371 |
* @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) |
|
372 |
*/ |
|
373 |
public Buffer getWindowRaster(double ulx, double uly, double lrx, double lry, |
|
374 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
375 |
return null; |
|
376 |
} |
|
377 |
|
|
378 |
/* |
|
379 |
* (non-Javadoc) |
|
380 |
* @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) |
|
381 |
*/ |
|
382 |
public Buffer getWindowRaster(int x, int y, int w, int h, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
383 |
return null; |
|
384 |
} |
|
385 |
|
|
386 |
/* |
|
387 |
* (non-Javadoc) |
|
388 |
* @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) |
|
389 |
*/ |
|
390 |
public Buffer getWindowRaster(int x, int y, int w, int h, int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
391 |
return null; |
|
392 |
} |
|
393 |
|
|
394 |
/* |
|
395 |
* (non-Javadoc) |
|
396 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getBlockSize() |
|
397 |
*/ |
|
398 |
public int getBlockSize() { |
|
399 |
return 0; |
|
400 |
} |
|
401 |
|
|
402 |
/* |
|
403 |
* (non-Javadoc) |
|
404 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setAffineTransform(java.awt.geom.AffineTransform) |
|
405 |
*/ |
|
406 |
public void setAffineTransform(AffineTransform t){ |
|
407 |
|
|
408 |
} |
|
409 |
|
|
410 |
/* |
|
411 |
* (non-Javadoc) |
|
412 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getOverviewCount(int) |
|
413 |
*/ |
|
414 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
415 |
return 0; |
|
416 |
} |
|
417 |
|
|
418 |
/* |
|
419 |
* (non-Javadoc) |
|
420 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewWidth(int, int) |
|
421 |
*/ |
|
422 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
423 |
return 0; |
|
424 |
} |
|
425 |
|
|
426 |
/* |
|
427 |
* (non-Javadoc) |
|
428 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewHeight(int, int) |
|
429 |
*/ |
|
430 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
431 |
return 0; |
|
432 |
} |
|
433 |
|
|
434 |
/* |
|
435 |
* (non-Javadoc) |
|
436 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#overviewsSupport() |
|
437 |
*/ |
|
438 |
public boolean overviewsSupport() { |
|
439 |
return false; |
|
440 |
} |
|
441 |
|
|
442 |
/* |
|
443 |
* (non-Javadoc) |
|
444 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isReproyectable() |
|
445 |
*/ |
|
446 |
public boolean isReproyectable() { |
|
447 |
return false; |
|
448 |
} |
|
449 |
|
|
450 |
/* |
|
451 |
* (non-Javadoc) |
|
452 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider#getName() |
|
453 |
*/ |
|
454 |
public String getName() { |
|
455 |
return NAME; |
|
456 |
} |
|
457 |
|
|
458 |
/** |
|
459 |
* Convierte un punto desde coordenadas pixel a coordenadas del mundo. |
|
460 |
* @param pt Punto a transformar |
|
461 |
* @return punto transformado en coordenadas del mundo |
|
462 |
*/ |
|
463 |
public Point2D rasterToWorld(Point2D pt) { |
|
464 |
Point2D p = new Point2D.Double(); |
|
465 |
getAffineTransform().transform(pt, p); |
|
466 |
return p; |
|
467 |
} |
|
468 |
|
|
469 |
/** |
|
470 |
* Convierte un punto desde del mundo a coordenadas pixel. |
|
471 |
* @param pt Punto a transformar |
|
472 |
* @return punto transformado en coordenadas pixel |
|
473 |
*/ |
|
474 |
public Point2D worldToRaster(Point2D pt) { |
|
475 |
Point2D p = new Point2D.Double(); |
|
476 |
try { |
|
477 |
getAffineTransform().inverseTransform(pt, p); |
|
478 |
} catch (NoninvertibleTransformException e) { |
|
479 |
return pt; |
|
480 |
} |
|
481 |
return p; |
|
482 |
} |
|
483 |
|
|
484 |
/* |
|
485 |
* (non-Javadoc) |
|
486 |
* @see org.gvsig.raster.impl.provider.RasterProvider#setStatus(org.gvsig.raster.impl.provider.RasterProvider) |
|
487 |
*/ |
|
488 |
public void setStatus(RasterProvider provider) { |
|
489 |
if(provider instanceof WMTSDriver) { |
|
490 |
} |
|
491 |
} |
|
492 |
|
|
493 |
/* |
|
494 |
* (non-Javadoc) |
|
495 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getLastRequest() |
|
496 |
*/ |
|
497 |
public File getLastRequest() { |
|
498 |
return lastRequest; |
|
499 |
} |
|
500 |
} |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.io/org.gvsig.raster.io.base/src/main/java/org/gvsig/fmap/dal/coverage/dataset/io/wmts/WMTSConnector.java | ||
---|---|---|
24 | 24 |
import java.io.IOException; |
25 | 25 |
import java.net.ConnectException; |
26 | 26 |
import java.net.URL; |
27 |
import java.util.ArrayList; |
|
27 | 28 |
import java.util.TreeMap; |
28 | 29 |
|
29 | 30 |
import org.gvsig.compat.net.ICancellable; |
... | ... | |
31 | 32 |
import org.gvsig.remoteclient.wmts.WMTSClient; |
32 | 33 |
import org.gvsig.remoteclient.wmts.struct.WMTSLayer; |
33 | 34 |
import org.gvsig.remoteclient.wmts.struct.WMTSThemes; |
35 |
import org.gvsig.remoteclient.wmts.struct.WMTSTileMatrixSet; |
|
34 | 36 |
|
35 | 37 |
/** |
36 | 38 |
* This class offers an interface of services for a WMTS |
... | ... | |
93 | 95 |
public WMTSLayer getLayer(String layerName) { |
94 | 96 |
return client.getLayer(layerName); |
95 | 97 |
} |
98 |
|
|
99 |
/** |
|
100 |
* Gets the set of tiles definition |
|
101 |
* @return |
|
102 |
*/ |
|
103 |
@SuppressWarnings("unchecked") |
|
104 |
public ArrayList<WMTSTileMatrixSet> getTileMatrixSet() { |
|
105 |
return client.getTileMatrixSet(); |
|
106 |
} |
|
96 | 107 |
|
97 | 108 |
/** |
98 | 109 |
* Gets the host |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.io/org.gvsig.raster.io.base/src/main/java/org/gvsig/fmap/dal/coverage/dataset/io/wmts/WMTSProvider.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.wmts; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.awt.geom.NoninvertibleTransformException; |
|
26 |
import java.awt.geom.Point2D; |
|
27 |
import java.awt.geom.Rectangle2D; |
|
28 |
import java.io.File; |
|
29 |
import java.io.IOException; |
|
30 |
import java.net.URL; |
|
31 |
import java.util.Hashtable; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.DALLocator; |
|
34 |
import org.gvsig.fmap.dal.DataStore; |
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
37 |
import org.gvsig.fmap.dal.coverage.dataset.io.param.WMSStoreParametersImpl; |
|
38 |
import org.gvsig.fmap.dal.coverage.dataset.io.server.DefaultWMTSServerExplorerParameters; |
|
39 |
import org.gvsig.fmap.dal.coverage.dataset.io.server.WMTSServerExplorerImpl; |
|
40 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
41 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
42 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
43 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
44 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
45 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
46 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
47 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
48 |
import org.gvsig.fmap.dal.coverage.exception.WMSException; |
|
49 |
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer; |
|
50 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
|
51 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
52 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
53 |
import org.gvsig.metadata.MetadataLocator; |
|
54 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider; |
|
55 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
56 |
import org.gvsig.raster.impl.provider.RemoteRasterProvider; |
|
57 |
import org.gvsig.raster.impl.store.AbstractRasterDataStore; |
|
58 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
|
59 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
60 |
import org.gvsig.tools.ToolsLocator; |
|
61 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
62 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
63 |
/** |
|
64 |
* Clase que representa al driver de acceso a datos de wmts. |
|
65 |
* |
|
66 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
67 |
*/ |
|
68 |
public class WMTSProvider extends DefaultRasterProvider implements RemoteRasterProvider { |
|
69 |
public static String NAME = "Wmts Store"; |
|
70 |
public static String DESCRIPTION = "Wmts Raster file"; |
|
71 |
public static final String METADATA_DEFINITION_NAME = "WmtsStore"; |
|
72 |
|
|
73 |
private Extent viewRequest = null; |
|
74 |
private static Hashtable<URL, WMTSConnector> |
|
75 |
drivers = new Hashtable<URL, WMTSConnector> (); |
|
76 |
private boolean open = false; |
|
77 |
//Only for fixed size. Complete extent and FIXED_SIZE in long side |
|
78 |
private File lastRequest = null; |
|
79 |
|
|
80 |
public static void register() { |
|
81 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
82 |
ExtensionPoint point = extensionPoints.get("RasterReader"); |
|
83 |
point.append("wmts", "", WMTSProvider.class); |
|
84 |
|
|
85 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
86 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
87 |
dataman.registerStoreProvider(NAME, |
|
88 |
WMTSProvider.class, WMSStoreParametersImpl.class); |
|
89 |
} |
|
90 |
|
|
91 |
if (!dataman.getExplorerProviders().contains(WMTSServerExplorerImpl.NAME)) { |
|
92 |
dataman.registerExplorerProvider(WMTSServerExplorer.NAME, WMTSServerExplorerImpl.class, DefaultWMTSServerExplorerParameters.class); |
|
93 |
} |
|
94 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
95 |
} |
|
96 |
|
|
97 |
public WMTSProvider() throws NotSupportedExtensionException { |
|
98 |
super(); |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* Constructor. Abre el dataset. |
|
103 |
* @param proj Proyecci?n |
|
104 |
* @param fName Nombre del fichero |
|
105 |
* @throws NotSupportedExtensionException |
|
106 |
*/ |
|
107 |
public WMTSProvider(String params) throws NotSupportedExtensionException { |
|
108 |
super(params); |
|
109 |
if(params instanceof String) { |
|
110 |
WMSStoreParametersImpl p = new WMSStoreParametersImpl(); |
|
111 |
p.setHost((String)params); |
|
112 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
|
113 |
.createDynObject( |
|
114 |
MetadataLocator.getMetadataManager().getDefinition( |
|
115 |
DataStore.METADATA_DEFINITION_NAME))); |
|
116 |
init(p, null); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
public WMTSProvider(WMSStoreParametersImpl params, |
|
121 |
AbstractRasterDataStore storeServices) throws NotSupportedExtensionException { |
|
122 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
123 |
.createDynObject( |
|
124 |
MetadataLocator.getMetadataManager().getDefinition( |
|
125 |
DataStore.METADATA_DEFINITION_NAME))); |
|
126 |
init(params, storeServices); |
|
127 |
} |
|
128 |
|
|
129 |
/** |
|
130 |
* Gets the connector from the URL |
|
131 |
* @return |
|
132 |
* @throws WMSException |
|
133 |
*/ |
|
134 |
@SuppressWarnings("unused") |
|
135 |
private WMTSConnector getConnector() throws WMSException { |
|
136 |
WMSStoreParametersImpl p = (WMSStoreParametersImpl)parameters; |
|
137 |
URL url = null; |
|
138 |
try { |
|
139 |
url = new URL(p.getHost()); |
|
140 |
} catch (Exception e) { |
|
141 |
throw new WMSException("Malformed URL",e); |
|
142 |
} |
|
143 |
try { |
|
144 |
return WMTSProvider.getConnectorFromURL(url); |
|
145 |
} catch (IOException e) { |
|
146 |
throw new WMSException("Error getting the connector",e); |
|
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* Crea las referencias al fichero y carga |
|
152 |
* las estructuras con la informaci?n y los metadatos. |
|
153 |
* @param proj Proyecci?n |
|
154 |
* @param param Parametros de carga |
|
155 |
* @throws NotSupportedExtensionException |
|
156 |
*/ |
|
157 |
public void init (DataStoreParameters params, |
|
158 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
159 |
setParam(params); |
|
160 |
setDataType(new int[]{Buffer.TYPE_BYTE, Buffer.TYPE_BYTE, Buffer.TYPE_BYTE}); |
|
161 |
bandCount = 3; |
|
162 |
} |
|
163 |
|
|
164 |
public static final WMTSConnector getConnectorFromURL(URL url) throws IOException { |
|
165 |
WMTSConnector drv = (WMTSConnector) drivers.get(url); |
|
166 |
if (drv == null) { |
|
167 |
drv = new WMTSConnector(url); |
|
168 |
drivers.put(url, drv); |
|
169 |
} |
|
170 |
return drv; |
|
171 |
} |
|
172 |
|
|
173 |
/** |
|
174 |
* Obtiene el objeto que contiene que contiene la interpretaci?n de |
|
175 |
* color por banda |
|
176 |
* @return |
|
177 |
*/ |
|
178 |
public DataStoreColorInterpretation getColorInterpretation() { |
|
179 |
if(colorInterpretation == null) { |
|
180 |
colorInterpretation = new DataStoreColorInterpretation(); |
|
181 |
colorInterpretation.initColorInterpretation(getBandCount()); |
|
182 |
colorInterpretation.setColorInterpValue(0, DataStoreColorInterpretation.RED_BAND); |
|
183 |
colorInterpretation.setColorInterpValue(1, DataStoreColorInterpretation.GREEN_BAND); |
|
184 |
colorInterpretation.setColorInterpValue(2, DataStoreColorInterpretation.BLUE_BAND); |
|
185 |
} |
|
186 |
return colorInterpretation; |
|
187 |
} |
|
188 |
|
|
189 |
/* |
|
190 |
* (non-Javadoc) |
|
191 |
* @see org.gvsig.fmap.dal.coverage.dataset.RasterDataSet#getAffineTransform() |
|
192 |
*/ |
|
193 |
public AffineTransform getAffineTransform() { |
|
194 |
return null; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Calcula el extent en coordenadas del mundo real |
|
199 |
* @return Extent |
|
200 |
*/ |
|
201 |
public Extent getExtent() { |
|
202 |
return null; |
|
203 |
} |
|
204 |
|
|
205 |
|
|
206 |
/* |
|
207 |
* (non-Javadoc) |
|
208 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getLayerExtent(java.lang.String, java.lang.String) |
|
209 |
*/ |
|
210 |
public Rectangle2D getLayerExtent(String layerName, String srs) throws WMSException { |
|
211 |
return null; |
|
212 |
} |
|
213 |
|
|
214 |
/* |
|
215 |
* (non-Javadoc) |
|
216 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#load() |
|
217 |
*/ |
|
218 |
public RasterProvider load() { |
|
219 |
return this; |
|
220 |
} |
|
221 |
|
|
222 |
/* |
|
223 |
* (non-Javadoc) |
|
224 |
* @see org.gvsig.raster.impl.provider.RasterProvider#isOpen() |
|
225 |
*/ |
|
226 |
public boolean isOpen() { |
|
227 |
return open; |
|
228 |
} |
|
229 |
|
|
230 |
/* |
|
231 |
* (non-Javadoc) |
|
232 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#close() |
|
233 |
*/ |
|
234 |
public void close() { |
|
235 |
open = false; |
|
236 |
} |
|
237 |
|
|
238 |
/* |
|
239 |
* (non-Javadoc) |
|
240 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getTransparency() |
|
241 |
*/ |
|
242 |
public Transparency getTransparency() { |
|
243 |
return null; |
|
244 |
} |
|
245 |
|
|
246 |
/* |
|
247 |
* (non-Javadoc) |
|
248 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#translateFileName(java.lang.String) |
|
249 |
*/ |
|
250 |
public String translateFileName(String fileName) { |
|
251 |
return fileName; |
|
252 |
} |
|
253 |
|
|
254 |
/* |
|
255 |
* (non-Javadoc) |
|
256 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setView(org.gvsig.fmap.dal.coverage.datastruct.Extent) |
|
257 |
*/ |
|
258 |
public void setView(Extent e) { |
|
259 |
viewRequest = e; |
|
260 |
} |
|
261 |
|
|
262 |
/* |
|
263 |
* (non-Javadoc) |
|
264 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getView() |
|
265 |
*/ |
|
266 |
public Extent getView() { |
|
267 |
return viewRequest; |
|
268 |
} |
|
269 |
|
|
270 |
/* |
|
271 |
* (non-Javadoc) |
|
272 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getWidth() |
|
273 |
*/ |
|
274 |
public double getWidth() { |
|
275 |
return 0; |
|
276 |
} |
|
277 |
|
|
278 |
/* |
|
279 |
* (non-Javadoc) |
|
280 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getHeight() |
|
281 |
*/ |
|
282 |
public double getHeight() { |
|
283 |
return 0; |
|
284 |
} |
|
285 |
|
|
286 |
/* |
|
287 |
* (non-Javadoc) |
|
288 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#readCompleteLine(int, int) |
|
289 |
*/ |
|
290 |
public Object readCompleteLine(int line, int band) |
|
291 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
292 |
return null; |
|
293 |
} |
|
294 |
|
|
295 |
/** |
|
296 |
* When the remote layer has fixed size this method downloads the file and return its reference. |
|
297 |
* File layer has in the long side FIXED_SIZE pixels and the bounding box is complete. This file could be |
|
298 |
* useful to build an histogram or calculate statistics. This represents a sample of data. |
|
299 |
* @return |
|
300 |
* @throws RasterDriverException |
|
301 |
*/ |
|
302 |
public File getFileLayer() throws RasterDriverException { |
|
303 |
return null; |
|
304 |
} |
|
305 |
|
|
306 |
/** |
|
307 |
* Reads a complete block of data and returns an tridimensional array of the right type. This function is useful |
|
308 |
* to read a file very fast without setting a view. In a WMS service when the size is fixed then it will read the |
|
309 |
* entire image but when the source hasn't pixel size it will read a sample of data. This set of data will have |
|
310 |
* the size defined in FIXED_SIZE. |
|
311 |
* |
|
312 |
* @param pos Posici?n donde se empieza a leer |
|
313 |
* @param blockHeight Altura m?xima del bloque leido |
|
314 |
* @return Object que es un array tridimendional del tipo de datos del raster. (Bandas X Filas X Columnas) |
|
315 |
* @throws InvalidSetViewException |
|
316 |
* @throws FileNotOpenException |
|
317 |
* @throws RasterDriverException |
|
318 |
*/ |
|
319 |
public Object readBlock(int pos, int blockHeight) |
|
320 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
321 |
return null; |
|
322 |
} |
|
323 |
|
|
324 |
/* |
|
325 |
* (non-Javadoc) |
|
326 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getData(int, int, int) |
|
327 |
*/ |
|
328 |
public Object getData(int x, int y, int band) |
|
329 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
330 |
return null; |
|
331 |
} |
|
332 |
|
|
333 |
/** |
|
334 |
* Assigns the list of bands RGB and read a window of data |
|
335 |
* @param rasterBuf |
|
336 |
* @param bandList |
|
337 |
* @param lastFile |
|
338 |
* @param ulx |
|
339 |
* @param uly |
|
340 |
* @param lrx |
|
341 |
* @param lry |
|
342 |
* @return |
|
343 |
* @throws RasterDriverException |
|
344 |
* @throws ProcessInterruptedException |
|
345 |
*/ |
|
346 |
public Buffer getBuffer(Buffer rasterBuf, BandList bandList, File lastFile, |
|
347 |
double ulx, double uly, double lrx, double lry) throws RasterDriverException, ProcessInterruptedException { |
|
348 |
return null; |
|
349 |
} |
|
350 |
|
|
351 |
/* |
|
352 |
* (non-Javadoc) |
|
353 |
* @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) |
|
354 |
*/ |
|
355 |
public Buffer getWindowRaster(double ulx, double uly, double lrx, double lry, |
|
356 |
BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
357 |
return null; |
|
358 |
} |
|
359 |
|
|
360 |
/* |
|
361 |
* (non-Javadoc) |
|
362 |
* @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) |
|
363 |
*/ |
|
364 |
public Buffer getWindowRaster(double ulx, double uly, double w, double h, |
|
365 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
366 |
return null; |
|
367 |
} |
|
368 |
|
|
369 |
/* |
|
370 |
* (non-Javadoc) |
|
371 |
* @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) |
|
372 |
*/ |
|
373 |
public Buffer getWindowRaster(double ulx, double uly, double lrx, double lry, |
|
374 |
int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf, boolean adjustToExtent) throws ProcessInterruptedException, RasterDriverException { |
|
375 |
return null; |
|
376 |
} |
|
377 |
|
|
378 |
/* |
|
379 |
* (non-Javadoc) |
|
380 |
* @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) |
|
381 |
*/ |
|
382 |
public Buffer getWindowRaster(int x, int y, int w, int h, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
383 |
return null; |
|
384 |
} |
|
385 |
|
|
386 |
/* |
|
387 |
* (non-Javadoc) |
|
388 |
* @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) |
|
389 |
*/ |
|
390 |
public Buffer getWindowRaster(int x, int y, int w, int h, int bufWidth, int bufHeight, BandList bandList, Buffer rasterBuf) throws ProcessInterruptedException, RasterDriverException { |
|
391 |
return null; |
|
392 |
} |
|
393 |
|
|
394 |
/* |
|
395 |
* (non-Javadoc) |
|
396 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getBlockSize() |
|
397 |
*/ |
|
398 |
public int getBlockSize() { |
|
399 |
return 0; |
|
400 |
} |
|
401 |
|
|
402 |
/* |
|
403 |
* (non-Javadoc) |
|
404 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#setAffineTransform(java.awt.geom.AffineTransform) |
|
405 |
*/ |
|
406 |
public void setAffineTransform(AffineTransform t){ |
|
407 |
|
|
408 |
} |
|
409 |
|
|
410 |
/* |
|
411 |
* (non-Javadoc) |
|
412 |
* @see org.gvsig.raster.impl.provider.RasterProvider#getOverviewCount(int) |
|
413 |
*/ |
|
414 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
415 |
return 0; |
|
416 |
} |
|
417 |
|
|
418 |
/* |
|
419 |
* (non-Javadoc) |
|
420 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewWidth(int, int) |
|
421 |
*/ |
|
422 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
423 |
return 0; |
|
424 |
} |
|
425 |
|
|
426 |
/* |
|
427 |
* (non-Javadoc) |
|
428 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#getOverviewHeight(int, int) |
|
429 |
*/ |
|
430 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
431 |
return 0; |
|
432 |
} |
|
433 |
|
|
434 |
/* |
|
435 |
* (non-Javadoc) |
|
436 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#overviewsSupport() |
|
437 |
*/ |
|
438 |
public boolean overviewsSupport() { |
|
439 |
return false; |
|
440 |
} |
|
441 |
|
|
442 |
/* |
|
443 |
* (non-Javadoc) |
|
444 |
* @see org.gvsig.raster.impl.provider.DefaultRasterProvider#isReproyectable() |
|
445 |
*/ |
|
446 |
public boolean isReproyectable() { |
|
447 |
return false; |
|
448 |
} |
|
449 |
|
|
450 |
/* |
|
451 |
* (non-Javadoc) |
|
452 |
* @see org.gvsig.fmap.dal.raster.spi.CoverageStoreProvider#getName() |
|
453 |
*/ |
|
454 |
public String getName() { |
|
455 |
return NAME; |
|
456 |
} |
|
457 |
|
|
458 |
/** |
|
459 |
* Convierte un punto desde coordenadas pixel a coordenadas del mundo. |
|
460 |
* @param pt Punto a transformar |
|
461 |
* @return punto transformado en coordenadas del mundo |
|
462 |
*/ |
|
463 |
public Point2D rasterToWorld(Point2D pt) { |
|
464 |
Point2D p = new Point2D.Double(); |
|
465 |
getAffineTransform().transform(pt, p); |
|
466 |
return p; |
|
467 |
} |
|
468 |
|
|
469 |
/** |
|
470 |
* Convierte un punto desde del mundo a coordenadas pixel. |
|
471 |
* @param pt Punto a transformar |
|
472 |
* @return punto transformado en coordenadas pixel |
|
473 |
*/ |
|
474 |
public Point2D worldToRaster(Point2D pt) { |
|
475 |
Point2D p = new Point2D.Double(); |
|
476 |
try { |
|
477 |
getAffineTransform().inverseTransform(pt, p); |
|
478 |
} catch (NoninvertibleTransformException e) { |
|
479 |
return pt; |
|
480 |
} |
|
481 |
return p; |
|
482 |
} |
|
483 |
|
|
484 |
/* |
|
485 |
* (non-Javadoc) |
|
486 |
* @see org.gvsig.raster.impl.provider.RasterProvider#setStatus(org.gvsig.raster.impl.provider.RasterProvider) |
|
487 |
*/ |
|
488 |
public void setStatus(RasterProvider provider) { |
|
489 |
if(provider instanceof WMTSProvider) { |
|
490 |
} |
|
491 |
} |
|
492 |
|
|
493 |
/* |
|
494 |
* (non-Javadoc) |
|
495 |
* @see org.gvsig.raster.impl.provider.RemoteRasterProvider#getLastRequest() |
|
496 |
*/ |
|
497 |
public File getLastRequest() { |
|
498 |
return lastRequest; |
|
499 |
} |
|
500 |
} |
|
0 | 501 |
Also available in: Unified diff