Revision 13254
org.gvsig.raster.lizardtech/tags/org.gvsig.raster.lizardtech-2.2.124/org.gvsig.raster.lizardtech.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.lizardtech.io.DefaultLizardtechIOLibrary |
org.gvsig.raster.lizardtech/tags/org.gvsig.raster.lizardtech-2.2.124/org.gvsig.raster.lizardtech.io/src/main/java/org/gvsig/raster/lizardtech/io/DefaultLizardtechIOLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.lizardtech.io; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
25 |
import org.gvsig.fmap.dal.DALLibrary; |
|
26 |
import org.gvsig.raster.impl.store.AbstractNewRasterStoreParameters; |
|
27 |
import org.gvsig.tools.ToolsLibrary; |
|
28 |
import org.gvsig.tools.library.AbstractLibrary; |
|
29 |
import org.gvsig.tools.library.Library; |
|
30 |
import org.gvsig.tools.library.LibraryException; |
|
31 |
/** |
|
32 |
* |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class DefaultLizardtechIOLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
@SuppressWarnings("deprecation") |
|
38 |
public DefaultLizardtechIOLibrary() { |
|
39 |
super(DefaultLizardtechIOLibrary.class,Library.TYPE.IMPL); |
|
40 |
require(ToolsLibrary.class); |
|
41 |
require(DALLibrary.class); |
|
42 |
require(DALFileLibrary.class); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doInitialize() throws LibraryException { |
|
47 |
//RasterLibrary.wakeUp(); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
AbstractNewRasterStoreParameters.registerDynClass(); |
|
53 |
|
|
54 |
// Registro de los drivers de lectura |
|
55 |
LizardTechProvider.register(); |
|
56 |
LizardTechDataParameters.registerDynClass(); |
|
57 |
} |
|
58 |
} |
|
0 | 59 |
org.gvsig.raster.lizardtech/tags/org.gvsig.raster.lizardtech-2.2.124/org.gvsig.raster.lizardtech.io/src/main/java/org/gvsig/raster/lizardtech/io/LizardTechNative.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.lizardtech.io; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.awt.geom.NoninvertibleTransformException; |
|
26 |
import java.awt.geom.Point2D; |
|
27 |
import java.io.IOException; |
|
28 |
|
|
29 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
30 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
31 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
32 |
import org.gvsig.raster.impl.process.RasterTask; |
|
33 |
import org.gvsig.raster.impl.process.RasterTaskQueue; |
|
34 |
|
|
35 |
import es.gva.cit.jmrsid.LTIDataType; |
|
36 |
import es.gva.cit.jmrsid.LTIGeoCoord; |
|
37 |
import es.gva.cit.jmrsid.LTIImageStage; |
|
38 |
import es.gva.cit.jmrsid.LTIMetadataDatabase; |
|
39 |
import es.gva.cit.jmrsid.LTIMetadataRecord; |
|
40 |
import es.gva.cit.jmrsid.LTISceneBuffer; |
|
41 |
import es.gva.cit.jmrsid.LTIUtils; |
|
42 |
import es.gva.cit.jmrsid.MrSIDException; |
|
43 |
import es.gva.cit.jmrsid.MrSIDImageReader; |
|
44 |
|
|
45 |
public class LizardTechNative extends MrSIDImageReader { |
|
46 |
static boolean WITH_OVERVIEWS = true; |
|
47 |
public int width = 0; |
|
48 |
public int height = 0; |
|
49 |
public double originX = 0D; |
|
50 |
public double originY = 0D; |
|
51 |
public String version = ""; |
|
52 |
public LTIMetadataDatabase metadata; |
|
53 |
private int alpha = 0; |
|
54 |
protected int rBandNr = 1; |
|
55 |
protected int gBandNr = 2; |
|
56 |
protected int bBandNr = 3; |
|
57 |
protected byte[] bandR; |
|
58 |
protected byte[] bandG; |
|
59 |
protected byte[] bandB; |
|
60 |
private int dataType = LTIDataType.LTI_DATATYPE_UINT8; |
|
61 |
//View |
|
62 |
private double zoomoverview = 0.0; |
|
63 |
private int eSampleType; |
|
64 |
private int noverviews; |
|
65 |
public int xini; |
|
66 |
public int yini; |
|
67 |
/** |
|
68 |
* Ancho y alto de la overview |
|
69 |
*/ |
|
70 |
public int anchoOver; |
|
71 |
public int altoOver; |
|
72 |
public int blocksize = 1; |
|
73 |
/** |
|
74 |
* N?mero de bandas de la imagen |
|
75 |
*/ |
|
76 |
public int nbands; |
|
77 |
/** |
|
78 |
* Posici?n de la esquina superior izquierda en coordenadas pixel |
|
79 |
*/ |
|
80 |
private double currentViewY = -1; |
|
81 |
private double currentViewX = 0D; |
|
82 |
/** |
|
83 |
* Ancho y alto de la im�gen (pixeles en pantalla) |
|
84 |
*/ |
|
85 |
private int currentViewWidth = -1; |
|
86 |
private int currentViewHeight = -1; |
|
87 |
/** |
|
88 |
* Ancho y alto de la imagen completa en pixeles |
|
89 |
*/ |
|
90 |
@SuppressWarnings("unused") |
|
91 |
private int currentFullWidth = -1; |
|
92 |
@SuppressWarnings("unused") |
|
93 |
private int currentFullHeight = -1; |
|
94 |
private int overviewFullWidth = -1; |
|
95 |
private int overviewFullHeight = -1; |
|
96 |
/** |
|
97 |
* Escala del viewport en X e Y |
|
98 |
*/ |
|
99 |
private double viewportScaleX = 0D; |
|
100 |
private double viewportScaleY = 0D; |
|
101 |
/** |
|
102 |
* ?ltimo extent de la ventana seleccionada por el usuario. Este extent corresponde al de la |
|
103 |
* imagen, no al del viewport de la vista. |
|
104 |
*/ |
|
105 |
private double[] currentImageView = new double[4]; |
|
106 |
public int[] stepArrayX = null; |
|
107 |
public int[] stepArrayY = null; |
|
108 |
public boolean isSupersampling = false; |
|
109 |
private String fileName = null; |
|
110 |
protected AffineTransform ownTransformation = null; |
|
111 |
protected AffineTransform externalTransformation = new AffineTransform(); |
|
112 |
/** |
|
113 |
*Array de transformaciones afines donde cada elemento es la transformaci�n correspondiente a una overview |
|
114 |
*/ |
|
115 |
protected AffineTransform[] overviewsTransformation = null; |
|
116 |
|
|
117 |
/** |
|
118 |
* Constructor |
|
119 |
* @param fName |
|
120 |
* @throws MrSIDException |
|
121 |
* @throws IOException |
|
122 |
*/ |
|
123 |
public LizardTechNative(String fName) throws MrSIDException, IOException { |
|
124 |
super(fName); |
|
125 |
init(fName); |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Inicializa las variables de instancia con los valores de la imagen |
|
130 |
* @param fName |
|
131 |
* @throws MrSIDException |
|
132 |
* @throws IOException |
|
133 |
*/ |
|
134 |
private void init(String fName) throws MrSIDException, IOException { |
|
135 |
this.initialize(); |
|
136 |
|
|
137 |
fileName = fName; |
|
138 |
width = this.getWidth(); |
|
139 |
height = this.getHeight(); |
|
140 |
eSampleType = this.getDataType(); |
|
141 |
nbands = this.getNumBands(); |
|
142 |
//eColorSpace = this.getColorSpace(); |
|
143 |
noverviews = this.getNumLevels(); |
|
144 |
overviewsTransformation = new AffineTransform[noverviews]; |
|
145 |
|
|
146 |
//Creamos una matriz de transformaci�n por nivel de overview con el factor de escala de esta overview |
|
147 |
overviewsTransformation[0] = new AffineTransform(); |
|
148 |
int[] dims = this.getDimsAtMag(LTIUtils.levelToMag(0)); |
|
149 |
int dimLastX = dims[0]; |
|
150 |
int dimLastY = dims[1]; |
|
151 |
for (int i = 1; i < noverviews; i++) { |
|
152 |
dims = this.getDimsAtMag(LTIUtils.levelToMag(i)); |
|
153 |
|
|
154 |
double scaleFactorX = (double)dims[0] / (double)dimLastX; |
|
155 |
double scaleFactorY = (double)dims[1] / (double)dimLastY; |
|
156 |
//System.out.println("Over:" + i + " zoom:" + LTIUtils.levelToMag(i) + " dims:" + dims[0] + "X" + dims[1]); |
|
157 |
overviewsTransformation[i] = new AffineTransform(scaleFactorX, 0, 0, scaleFactorY, 0, 0); |
|
158 |
} |
|
159 |
|
|
160 |
metadata = this.getMetadata(); |
|
161 |
|
|
162 |
double ox = 0D; |
|
163 |
double oy = 0D; |
|
164 |
double resx = 0D; |
|
165 |
double resy = 0D; |
|
166 |
|
|
167 |
LTIGeoCoord geoc = this.getGeoCoord(); |
|
168 |
|
|
169 |
ox = geoc.getX(); |
|
170 |
oy = geoc.getY(); |
|
171 |
resx = geoc.getXRes(); |
|
172 |
resy = geoc.getYRes(); |
|
173 |
|
|
174 |
ownTransformation = new AffineTransform(resx, 0, 0, resy, ox, oy); |
|
175 |
externalTransformation = (AffineTransform)ownTransformation.clone(); |
|
176 |
|
|
177 |
currentFullWidth = width; |
|
178 |
currentFullHeight = height; |
|
179 |
|
|
180 |
blocksize = this.getStripHeight(); |
|
181 |
|
|
182 |
if(nbands == 1) { |
|
183 |
rBandNr = gBandNr = bBandNr = 1; |
|
184 |
} |
|
185 |
if(nbands == 2) { |
|
186 |
rBandNr = gBandNr = 1; |
|
187 |
bBandNr = 2; |
|
188 |
} |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* Asigna el valor de Alpha |
|
193 |
* @param a alpha |
|
194 |
*/ |
|
195 |
public void setAlpha(int a) { |
|
196 |
alpha = a; |
|
197 |
} |
|
198 |
|
|
199 |
/** |
|
200 |
* Asigna el tipo de datos |
|
201 |
* @param dt tipo de datos |
|
202 |
*/ |
|
203 |
public void setDataType(int dt) { |
|
204 |
dataType = dt; |
|
205 |
} |
|
206 |
|
|
207 |
/** |
|
208 |
* Obtiene un punto 2D con las coordenadas del raster a partir de uno en coordenadas |
|
209 |
* del punto real. |
|
210 |
* Supone rasters no girados |
|
211 |
* @param pt punto en coordenadas del punto real |
|
212 |
* @return punto en coordenadas del raster |
|
213 |
*/ |
|
214 |
public Point2D worldToRaster(Point2D pt) { |
|
215 |
Point2D p = new Point2D.Double(); |
|
216 |
try { |
|
217 |
externalTransformation.inverseTransform(pt, p); |
|
218 |
} catch (NoninvertibleTransformException e) { |
|
219 |
return pt; |
|
220 |
} |
|
221 |
return p; |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* Obtiene un punto del raster en coordenadas pixel a partir de un punto en coordenadas |
|
226 |
* reales. |
|
227 |
* @param pt Punto en coordenadas reales |
|
228 |
* @return Punto en coordenadas pixel. |
|
229 |
*/ |
|
230 |
public Point2D rasterToWorld(Point2D pt) { |
|
231 |
Point2D p = new Point2D.Double(); |
|
232 |
externalTransformation.transform(pt, p); |
|
233 |
return p; |
|
234 |
} |
|
235 |
|
|
236 |
/** |
|
237 |
* Calcula el overview a usar de la imagen y el viewport a partir del ancho, alto y |
|
238 |
* coordenadas del mundo real |
|
239 |
* @param dWorldTLX Coordenada X superior izquierda |
|
240 |
* @param dWorldTLY Coordenada Y superior izquierda |
|
241 |
* @param dWorldBRX Coordenada X inferior derecha |
|
242 |
* @param dWorldBRY Coordenada Y inferior derecha |
|
243 |
* @param nWidth ancho |
|
244 |
* @param nHeight alto |
|
245 |
*/ |
|
246 |
public void setView(double ulx, double uly, double lrx, double lry, |
|
247 |
int nWidth, int nHeight) { |
|
248 |
currentImageView[0] = ulx; |
|
249 |
currentImageView[1] = uly; |
|
250 |
currentImageView[2] = lrx; |
|
251 |
currentImageView[3] = lry; |
|
252 |
|
|
253 |
//Ancho y alto de la im�gen en pixeles (pixeles de la overview) |
|
254 |
overviewFullWidth = currentFullWidth = width; |
|
255 |
overviewFullHeight = currentFullHeight = height; |
|
256 |
|
|
257 |
//Ventana de la imagen. (en tama�o completo) |
|
258 |
//tl->esq sup izda en pixeles |
|
259 |
//br->esq inf der en pixeles |
|
260 |
Point2D a = worldToRaster(new Point2D.Double(ulx, uly)); |
|
261 |
Point2D b = worldToRaster(new Point2D.Double(lrx, lry)); |
|
262 |
Point2D tl = new Point2D.Double(Math.min(a.getX(), b.getX()), Math.min(a.getY(), b.getY())); |
|
263 |
Point2D br = new Point2D.Double(Math.max(a.getX(), b.getX()), Math.max(a.getY(), b.getY())); |
|
264 |
|
|
265 |
//Ancho y alto de la im�gen (pixeles en pantalla) |
|
266 |
currentViewWidth = nWidth; |
|
267 |
currentViewHeight = nHeight; |
|
268 |
|
|
269 |
//Posici�n de la esquina superior izquierda en coordenadas pixel |
|
270 |
currentViewX = tl.getX(); |
|
271 |
currentViewY = tl.getY(); |
|
272 |
|
|
273 |
//Escala de la vista en X e Y |
|
274 |
viewportScaleX = (double) currentViewWidth / (br.getX() - tl.getX()); |
|
275 |
viewportScaleY = (double) currentViewHeight / (br.getY() - tl.getY()); |
|
276 |
|
|
277 |
try { |
|
278 |
// calcula el overview a usar |
|
279 |
int[] dims = null; |
|
280 |
double zoom = 1.0; |
|
281 |
zoomoverview = 1.0; |
|
282 |
|
|
283 |
if (WITH_OVERVIEWS && ((noverviews - 1) > 0)) { |
|
284 |
for (int i = (noverviews - 1); i > 0; i--) { |
|
285 |
zoom = LTIUtils.levelToMag(i); |
|
286 |
dims = this.getDimsAtMag(zoom); |
|
287 |
|
|
288 |
if (dims[0] > (this.getWidth() * viewportScaleX)) { |
|
289 |
zoomoverview = zoom; |
|
290 |
viewportScaleX /= zoomoverview; |
|
291 |
viewportScaleY /= zoomoverview; |
|
292 |
overviewFullWidth = currentFullWidth = dims[0]; |
|
293 |
overviewFullHeight = currentFullHeight = dims[1]; |
|
294 |
tl = worldToRaster(new Point2D.Double(ulx, uly)); |
|
295 |
br = worldToRaster(new Point2D.Double(lrx, lry)); |
|
296 |
tl.setLocation(Math.min(tl.getX(), br.getX()), Math.min(tl.getY(), br.getY())); |
|
297 |
overviewsTransformation[i].transform(tl, tl); |
|
298 |
//Hemos asignado currentFull solo para calcular tl en relaci�n al tama�o de la overview |
|
299 |
currentFullWidth = width; |
|
300 |
currentFullHeight = height; |
|
301 |
currentViewX = tl.getX(); |
|
302 |
currentViewY = tl.getY(); |
|
303 |
break; |
|
304 |
} |
|
305 |
} |
|
306 |
} |
|
307 |
|
|
308 |
setDataType(eSampleType); |
|
309 |
} catch (MrSIDException e) { |
|
310 |
e.printStackTrace(); |
|
311 |
} |
|
312 |
} |
|
313 |
|
|
314 |
/** |
|
315 |
* Muestra alguna informaci�n para la depuraci�n |
|
316 |
*/ |
|
317 |
void pintaInfo() { |
|
318 |
try { |
|
319 |
System.out.println("GeoTransform:"); |
|
320 |
|
|
321 |
LTIGeoCoord geoc = this.getGeoCoord(); |
|
322 |
|
|
323 |
System.out.println(" param[0]=" + geoc.getX()); |
|
324 |
System.out.println(" param[0]=" + geoc.getY()); |
|
325 |
System.out.println(" param[0]=" + geoc.getXRes()); |
|
326 |
System.out.println(" param[0]=" + geoc.getYRes()); |
|
327 |
System.out.println(" param[0]=" + geoc.getXRot()); |
|
328 |
System.out.println(" param[0]=" + geoc.getYRot()); |
|
329 |
System.out.println("Metadata:"); |
|
330 |
|
|
331 |
LTIMetadataDatabase metadata = this.getMetadata(); |
|
332 |
|
|
333 |
for (int i = 0; i < metadata.getIndexCount(); i++) { |
|
334 |
LTIMetadataRecord rec = null; |
|
335 |
rec = metadata.getDataByIndex(i); |
|
336 |
System.out.println(rec.getTagName()); |
|
337 |
|
|
338 |
if (rec.isScalar()) { |
|
339 |
System.out.println(rec.getScalarData()); |
|
340 |
} else if (rec.isVector()) { |
|
341 |
String[] s = rec.getVectorData(); |
|
342 |
|
|
343 |
for (int j = 0; j < s.length; j++) |
|
344 |
System.out.println("V" + j + "->" + s[j]); |
|
345 |
} else if (rec.isArray()) { |
|
346 |
String[] s = rec.getArrayData(); |
|
347 |
|
|
348 |
for (int j = 0; j < s.length; j++) |
|
349 |
System.out.println("A" + j + "->" + s[j]); |
|
350 |
} else { |
|
351 |
System.out.println(""); |
|
352 |
} |
|
353 |
} |
|
354 |
} catch (MrSIDException e) { |
|
355 |
// TODO Auto-generated catch block |
|
356 |
e.printStackTrace(); |
|
357 |
} |
|
358 |
} |
|
359 |
|
|
360 |
|
|
361 |
public LTISceneBuffer readBuffer(int x, int y, int SceneWidth, int SceneHeight)throws MrSIDException{ |
|
362 |
LTISceneBuffer buffer = ((LTIImageStage) this).readScene((double)x, (double)y, (double)SceneWidth, (double)SceneHeight, zoomoverview, (MrSIDImageReader)this, SceneWidth, SceneHeight, true); |
|
363 |
return buffer; |
|
364 |
} |
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
/** |
|
369 |
* Lee la escena de la imagen correspondiente a la vista seleccionada con |
|
370 |
* currentView a trav�s de la libreria de MrSid. Esta escena es cargada sobre |
|
371 |
* un buffer y asignada al par�metro de salida. |
|
372 |
* @param line Escena leida |
|
373 |
* @throws MrSIDException Lanzada si ocurre un error en la lectura de la escena |
|
374 |
*/ |
|
375 |
public void readScene(int[] line, RasterTask task) throws MrSIDException, ProcessInterruptedException { |
|
376 |
//Posici�n de inicio de la escena en entero para la petici�n a la libreria |
|
377 |
int x = (int) Math.floor(currentViewX); |
|
378 |
int y = (int) Math.floor(currentViewY); |
|
379 |
|
|
380 |
//Ancho y alto de la escena en pixeles |
|
381 |
int SceneWidth = 0; |
|
382 |
int SceneHeight = 0; |
|
383 |
|
|
384 |
SceneWidth = (int) Math.ceil((((double) currentViewWidth) / viewportScaleX) + 1); |
|
385 |
SceneHeight = (int) Math.ceil((((double) currentViewHeight) / viewportScaleY) + 1); |
|
386 |
|
|
387 |
while((x + SceneWidth) > overviewFullWidth) |
|
388 |
SceneWidth --; |
|
389 |
while((y + SceneHeight) > overviewFullHeight) |
|
390 |
SceneHeight --; |
|
391 |
|
|
392 |
if (SceneWidth == 0) |
|
393 |
SceneWidth = 1; |
|
394 |
|
|
395 |
if (SceneHeight == 0) |
|
396 |
SceneHeight = 1; |
|
397 |
|
|
398 |
LTISceneBuffer buffer = null; |
|
399 |
buffer = ((LTIImageStage) this).readScene((double)x, (double)y, (double)SceneWidth, (double)SceneHeight, zoomoverview, (MrSIDImageReader)this, SceneWidth, SceneHeight, true); |
|
400 |
|
|
401 |
/*boolean sizeOk = false; |
|
402 |
while (!sizeOk) { |
|
403 |
sizeOk = true; |
|
404 |
try { |
|
405 |
buffer = readBuffer(x, y, SceneWidth, SceneHeight); |
|
406 |
} catch (MrSIDException ex) { |
|
407 |
SceneWidth-- ; |
|
408 |
try{ |
|
409 |
buffer = readBuffer(x, y, SceneWidth, SceneHeight); |
|
410 |
} catch (MrSIDException ex1) { |
|
411 |
SceneWidth++; |
|
412 |
SceneHeight--; |
|
413 |
try{ |
|
414 |
buffer = readBuffer(x, y, SceneWidth, SceneHeight); |
|
415 |
} catch (MrSIDException ex2) { |
|
416 |
SceneWidth-- ; |
|
417 |
try{ |
|
418 |
buffer = readBuffer(x, y, SceneWidth, SceneHeight); |
|
419 |
} catch (MrSIDException ex3) { |
|
420 |
sizeOk = false; |
|
421 |
} |
|
422 |
} |
|
423 |
} |
|
424 |
} |
|
425 |
}*/ |
|
426 |
|
|
427 |
if(task.getEvent() != null) |
|
428 |
task.manageEvent(task.getEvent()); |
|
429 |
|
|
430 |
if ((dataType == LTIDataType.LTI_DATATYPE_UINT8) || |
|
431 |
(dataType == LTIDataType.LTI_DATATYPE_SINT8) || |
|
432 |
(dataType == LTIDataType.LTI_DATATYPE_SINT16) || |
|
433 |
(dataType == LTIDataType.LTI_DATATYPE_SINT32) || |
|
434 |
(dataType == LTIDataType.LTI_DATATYPE_UINT16) || |
|
435 |
(dataType == LTIDataType.LTI_DATATYPE_UINT32)) { |
|
436 |
int kd; |
|
437 |
int k; |
|
438 |
double scaleX = 1 / viewportScaleX; |
|
439 |
double scaleY = 1 / viewportScaleY; |
|
440 |
|
|
441 |
int alpha = (this.alpha & 0xff) << 24; |
|
442 |
|
|
443 |
if (rBandNr == 1) { |
|
444 |
bandR = buffer.buf1; |
|
445 |
} else if (rBandNr == 2) { |
|
446 |
bandR = buffer.buf2; |
|
447 |
} else if (rBandNr == 3) { |
|
448 |
bandR = buffer.buf3; |
|
449 |
} |
|
450 |
|
|
451 |
if (gBandNr == 1) { |
|
452 |
bandG = buffer.buf1; |
|
453 |
} else if (gBandNr == 2) { |
|
454 |
bandG = buffer.buf2; |
|
455 |
} else if (gBandNr == 3) { |
|
456 |
bandG = buffer.buf3; |
|
457 |
} |
|
458 |
|
|
459 |
if (bBandNr == 1) { |
|
460 |
bandB = buffer.buf1; |
|
461 |
} else if (bBandNr == 2) { |
|
462 |
bandB = buffer.buf2; |
|
463 |
} else if (bBandNr == 3) { |
|
464 |
bandB = buffer.buf3; |
|
465 |
} |
|
466 |
|
|
467 |
//Desplazamiento para la X y la Y leidas. Estas tienen efecto cuando un pixel no empieza a visualizarse |
|
468 |
//justo en su esquina superior izquierda y tiene que ser cortado en la visualizaci�n. |
|
469 |
double offsetX = Math.abs(currentViewX - ((int)currentViewX)); |
|
470 |
double offsetY = Math.abs(currentViewY - ((int)currentViewY)); |
|
471 |
|
|
472 |
for (int y1 = 0; y1 < currentViewHeight; y1++) { |
|
473 |
for (int x1 = 0; x1 < currentViewWidth; x1++) { |
|
474 |
kd = (y1 * currentViewWidth) + x1; |
|
475 |
k = (((int) ((y1 * scaleY) + offsetY)) * SceneWidth) + (int) ((x1 * scaleX) + offsetX); |
|
476 |
try { |
|
477 |
line[kd] = alpha + ((0xff & bandR[k]) << 16) + ((0xff & bandG[k]) << 8) + (0xff & bandB[k]); |
|
478 |
} catch (java.lang.ArrayIndexOutOfBoundsException e) { |
|
479 |
} |
|
480 |
} |
|
481 |
if(task.getEvent() != null) |
|
482 |
task.manageEvent(task.getEvent()); |
|
483 |
} |
|
484 |
} |
|
485 |
|
|
486 |
buffer = null; |
|
487 |
} |
|
488 |
|
|
489 |
/** |
|
490 |
* Reads a window of data. The size of the input window may not coincide |
|
491 |
* with the size of the buffer. In that case would have to resize |
|
492 |
* @param buf |
|
493 |
* @param bandList |
|
494 |
* @param x |
|
495 |
* Initial X position in input buffer |
|
496 |
* @param y |
|
497 |
* Initial Y position in input buffer |
|
498 |
* @throws MrSIDException |
|
499 |
* @throws ProcessInterruptedException |
|
500 |
*/ |
|
501 |
public void readWindow(Buffer buf, |
|
502 |
BandList bandList, |
|
503 |
int x, int y, int w, int h, |
|
504 |
int bufWidth, int bufHeight) throws MrSIDException, ProcessInterruptedException { |
|
505 |
if(bufWidth > buf.getWidth()) |
|
506 |
bufWidth = buf.getWidth(); |
|
507 |
|
|
508 |
if(bufHeight > buf.getHeight()) |
|
509 |
bufHeight = buf.getHeight(); |
|
510 |
|
|
511 |
if(buf.isCached()) { |
|
512 |
int nBlocks = (int)(bufHeight / buf.getBlockHeight()); |
|
513 |
int lastBlock = bufHeight - (nBlocks * buf.getBlockHeight()); |
|
514 |
int lastBlockSrc = (lastBlock * h) / bufHeight; |
|
515 |
int sizeBlockSrc = (buf.getBlockHeight() * h) / bufHeight; |
|
516 |
if(lastBlock > 0) |
|
517 |
nBlocks ++; |
|
518 |
int initSrc = y; |
|
519 |
int init = 0; |
|
520 |
for (int i = 0; i < nBlocks; i++) { |
|
521 |
if(lastBlock > 0 && i == (nBlocks - 1)) { |
|
522 |
double[] stepSrc = new double[]{x, initSrc, w, lastBlockSrc}; |
|
523 |
int[] stepDst = new int[]{0, init, bufWidth, init + lastBlock}; |
|
524 |
readWindowInMemory(buf, bandList, stepSrc, stepDst, w, lastBlock); |
|
525 |
} else { |
|
526 |
double[] stepSrc = new double[]{x, initSrc, w, sizeBlockSrc}; |
|
527 |
int[] stepDst = new int[]{0, init, bufWidth, init + buf.getBlockHeight()}; |
|
528 |
readWindowInMemory(buf, bandList, stepSrc, stepDst, w, buf.getBlockHeight()); |
|
529 |
init += buf.getBlockHeight(); |
|
530 |
initSrc += sizeBlockSrc; |
|
531 |
} |
|
532 |
} |
|
533 |
} else { |
|
534 |
readWindowInMemory(buf, bandList, x, y, w, h); |
|
535 |
} |
|
536 |
} |
|
537 |
|
|
538 |
/** |
|
539 |
* Reads a window of data. The width and height is indicated by the size of the buffer |
|
540 |
* @param buf |
|
541 |
* @param bandList |
|
542 |
* @param x |
|
543 |
* Initial X position in input buffer |
|
544 |
* @param y |
|
545 |
* Initial Y position in input buffer |
|
546 |
* @throws MrSIDException |
|
547 |
* @throws ProcessInterruptedException |
|
548 |
*/ |
|
549 |
public void readWindow(Buffer buf, BandList bandList, int x, int y) throws MrSIDException, ProcessInterruptedException { |
|
550 |
int w = (x + buf.getWidth()) > getWidth() ? getWidth() - x : buf.getWidth(); |
|
551 |
int h = (y + buf.getHeight()) > getHeight() ? getHeight() - y : buf.getHeight(); |
|
552 |
|
|
553 |
if(buf.isCached()) { |
|
554 |
int nBlocks = (int)(buf.getHeight() / buf.getBlockHeight()); |
|
555 |
int lastBlock = buf.getHeight() - (nBlocks * buf.getBlockHeight()); |
|
556 |
if(lastBlock > 0) |
|
557 |
nBlocks ++; |
|
558 |
int initYSrc = y; |
|
559 |
int initYBuffer = 0; |
|
560 |
for (int i = 0; i < nBlocks; i++) { |
|
561 |
if(lastBlock > 0 && i == (nBlocks - 1)) { |
|
562 |
double[] stepSrc = new double[]{x, initYSrc, w, lastBlock}; |
|
563 |
int[] stepDst = new int[]{0, initYBuffer, w, initYBuffer + lastBlock}; |
|
564 |
readWindowInMemory(buf, bandList, stepSrc, stepDst, w, lastBlock); |
|
565 |
} else { |
|
566 |
double[] stepSrc = new double[]{x, initYSrc, w, buf.getBlockHeight()}; |
|
567 |
int[] stepDst = new int[]{0, initYBuffer, w, initYBuffer + buf.getBlockHeight()}; |
|
568 |
readWindowInMemory(buf, bandList, stepSrc, stepDst, w, buf.getBlockHeight()); |
|
569 |
initYSrc += buf.getBlockHeight(); |
|
570 |
initYBuffer += buf.getBlockHeight(); |
|
571 |
} |
|
572 |
} |
|
573 |
} else { |
|
574 |
readWindowInMemory(buf, bandList, x, y, w, h); |
|
575 |
} |
|
576 |
} |
|
577 |
|
|
578 |
|
|
579 |
private void readWindowInMemory(Buffer buf, BandList bandList, double[] srcPxPos, int[] stepDst, int sizeSrcX, int sizeSrcY) throws MrSIDException, ProcessInterruptedException { |
|
580 |
RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
581 |
|
|
582 |
isSupersampling = false; |
|
583 |
|
|
584 |
LTISceneBuffer buffer = ((LTIImageStage) this).readScene( |
|
585 |
srcPxPos[0], srcPxPos[1], srcPxPos[2], srcPxPos[3], |
|
586 |
1.0, |
|
587 |
(MrSIDImageReader)this, |
|
588 |
sizeSrcX, sizeSrcY, |
|
589 |
true); |
|
590 |
|
|
591 |
byte[] bandBuf = null; |
|
592 |
for(int iBand = 0; iBand < getNumBands(); iBand++) { |
|
593 |
int[] drawableBands = bandList.getBufferBandToDraw(fileName, iBand); |
|
594 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
595 |
continue; |
|
596 |
switch(iBand) { |
|
597 |
case 0: bandBuf = buffer.buf1; break; |
|
598 |
case 1: bandBuf = buffer.buf2; break; |
|
599 |
case 2: bandBuf = buffer.buf3; break; |
|
600 |
} |
|
601 |
|
|
602 |
int lineSrc = 0; |
|
603 |
for (int line = stepDst[1]; line < stepDst[3]; line++) { |
|
604 |
int colSrc = 0; |
|
605 |
for (int col = stepDst[0]; col < stepDst[2]; col++) { |
|
606 |
int kd = (int)((lineSrc * srcPxPos[2]) + colSrc); |
|
607 |
buf.setElem(line, col, iBand, (byte)bandBuf[kd]); |
|
608 |
colSrc ++; |
|
609 |
} |
|
610 |
lineSrc ++; |
|
611 |
if(task.getEvent() != null) |
|
612 |
task.manageEvent(task.getEvent()); |
|
613 |
} |
|
614 |
} |
|
615 |
} |
|
616 |
|
|
617 |
/** |
|
618 |
* Lee una ventana de datos sin resampleo a partir de coordenadas en pixeles. |
|
619 |
* @param buf Buffer donde se almacenan los datos |
|
620 |
* @param bandList Lista de bandas que queremos leer y sobre que bandas del buffer de destino queremos escribirlas |
|
621 |
* @param x Posici�n X en pixeles |
|
622 |
* @param y Posici�n Y en pixeles |
|
623 |
* @param w Ancho en pixeles |
|
624 |
* @param h Alto en pixeles |
|
625 |
*/ |
|
626 |
private void readWindowInMemory(Buffer buf, BandList bandList, int x, int y, int w, int h) throws MrSIDException, ProcessInterruptedException { |
|
627 |
RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
628 |
|
|
629 |
isSupersampling = false; |
|
630 |
|
|
631 |
LTISceneBuffer buffer = ((LTIImageStage) this).readScene((double)x, (double)y, (double)w, (double)h, 1.0, (MrSIDImageReader)this, w, h, true); |
|
632 |
|
|
633 |
byte[] bandBuf = null; |
|
634 |
for(int iBand = 0; iBand < getNumBands(); iBand++) { |
|
635 |
int[] drawableBands = bandList.getBufferBandToDraw(fileName, iBand); |
|
636 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
637 |
continue; |
|
638 |
switch(iBand) { |
|
639 |
case 0: bandBuf = buffer.buf1; break; |
|
640 |
case 1: bandBuf = buffer.buf2; break; |
|
641 |
case 2: bandBuf = buffer.buf3; break; |
|
642 |
} |
|
643 |
for (int line = 0; line < h; line++){ |
|
644 |
for (int col = 0; col < w; col++){ |
|
645 |
int kd = (line * w) + col; |
|
646 |
buf.setElem(line, col, iBand, (byte)bandBuf[kd]); |
|
647 |
} |
|
648 |
if(task.getEvent() != null) |
|
649 |
task.manageEvent(task.getEvent()); |
|
650 |
} |
|
651 |
} |
|
652 |
} |
|
653 |
|
|
654 |
/** |
|
655 |
* Lee una ventana de la imagen y devuelve un buffer de bytes |
|
656 |
* @param ulX Coordenada X de la esquina superior izquierda |
|
657 |
* @param ulY Coordenada Y de la esquina superior izquierda |
|
658 |
* @param sizeX Tama�o X de la imagen |
|
659 |
* @param sizeY Tama�o Y de la image |
|
660 |
* @param band N�mero de bandas |
|
661 |
* @return buffer con la ventana leida |
|
662 |
* @throws MrSIDException |
|
663 |
*/ |
|
664 |
public byte[] getWindow(int ulX, int ulY, int sizeX, int sizeY, int band) throws MrSIDException { |
|
665 |
LTISceneBuffer buffer = ((LTIImageStage) this).readScene((double)ulX, (double)ulY, (double)sizeX, (double)sizeY, 1.0, (MrSIDImageReader)this, sizeX, sizeY, true); |
|
666 |
|
|
667 |
if (band == 1) { |
|
668 |
return buffer.buf1; |
|
669 |
} else if (band == 2) { |
|
670 |
return buffer.buf2; |
|
671 |
} else if (band == 3) { |
|
672 |
return buffer.buf3; |
|
673 |
} |
|
674 |
|
|
675 |
return null; |
|
676 |
} |
|
677 |
|
|
678 |
/** |
|
679 |
* Obtiene el valor de un pixel determinado por las coordenadas x e y que se pasan |
|
680 |
* por par�metro |
|
681 |
* @param x Coordenada X del pixel |
|
682 |
* @param y Coordenada Y del pixel |
|
683 |
* @return Array de Object donde cada posici�n representa una banda y el valor ser� Integer |
|
684 |
* en caso de ser byte, shot o int, Float en caso de ser float y Double en caso de ser double. |
|
685 |
*/ |
|
686 |
public Object[] getData(int x, int y) { |
|
687 |
try { |
|
688 |
Object[] data = new Object[nbands]; |
|
689 |
for(int i = 0; i < nbands; i++){ |
|
690 |
byte[] b = getWindow(x, y, 1, 1, nbands); |
|
691 |
switch(dataType){ |
|
692 |
case 0: break; |
|
693 |
case 1: data[i] = new Integer(b[0]); |
|
694 |
break; |
|
695 |
case 2: |
|
696 |
case 3: data[i] = new Integer(b[0]); |
|
697 |
break; |
|
698 |
case 4: |
|
699 |
case 5: data[i] = new Integer(b[0]); |
|
700 |
break; |
|
701 |
case 6: data[i] = new Float(b[0]); |
|
702 |
break; |
|
703 |
case 7: data[i] = new Double(b[0]); |
|
704 |
break; |
|
705 |
} |
|
706 |
} |
|
707 |
return data; |
|
708 |
} catch (MrSIDException e) { |
|
709 |
return null; |
|
710 |
} |
|
711 |
} |
|
712 |
|
|
713 |
/** |
|
714 |
* Asigna una transformaci�n que es aplicada sobre la que ya tiene el propio fichero |
|
715 |
* @param t |
|
716 |
*/ |
|
717 |
public void setExternalTransform(AffineTransform t){ |
|
718 |
externalTransformation = t; |
|
719 |
} |
|
720 |
|
|
721 |
/** |
|
722 |
* Devuelve la transformaci�n del fichero de georreferenciaci�n |
|
723 |
* @return AffineTransform |
|
724 |
*/ |
|
725 |
public AffineTransform getOwnTransformation() { |
|
726 |
return ownTransformation; |
|
727 |
} |
|
728 |
} |
|
0 | 729 |
org.gvsig.raster.lizardtech/tags/org.gvsig.raster.lizardtech-2.2.124/org.gvsig.raster.lizardtech.io/src/main/java/org/gvsig/raster/lizardtech/io/LizardTechProvider.java | ||
---|---|---|
1 |
package org.gvsig.raster.lizardtech.io; |
|
2 |
|
|
3 |
import java.awt.geom.AffineTransform; |
|
4 |
import java.awt.geom.Point2D; |
|
5 |
import java.awt.image.BufferedImage; |
|
6 |
import java.io.File; |
|
7 |
import java.net.URI; |
|
8 |
import java.net.URISyntaxException; |
|
9 |
|
|
10 |
import es.gva.cit.jmrsid.MrSIDException; |
|
11 |
|
|
12 |
import org.slf4j.Logger; |
|
13 |
import org.slf4j.LoggerFactory; |
|
14 |
|
|
15 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
16 |
import org.gvsig.fmap.dal.DALLocator; |
|
17 |
import org.gvsig.fmap.dal.DataStore; |
|
18 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
19 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
20 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
21 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
22 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
23 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
24 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
25 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException; |
|
26 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
27 |
import org.gvsig.fmap.dal.coverage.exception.ParsingException; |
|
28 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
29 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
30 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
31 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
32 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
33 |
import org.gvsig.metadata.MetadataLocator; |
|
34 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
|
35 |
import org.gvsig.raster.impl.buffer.SpiRasterQuery; |
|
36 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
|
37 |
import org.gvsig.raster.impl.process.RasterTask; |
|
38 |
import org.gvsig.raster.impl.process.RasterTaskQueue; |
|
39 |
import org.gvsig.raster.impl.provider.AbstractRasterProvider; |
|
40 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
41 |
import org.gvsig.raster.impl.provider.tile.FileTileServer; |
|
42 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
|
43 |
import org.gvsig.raster.impl.store.DefaultRasterStore; |
|
44 |
import org.gvsig.raster.impl.store.DefaultStoreFactory; |
|
45 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
46 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
|
47 |
import org.gvsig.tools.ToolsLocator; |
|
48 |
/** |
|
49 |
* Clase encargada del acceso a los datos y repintado de imagenes MrSID. Estos |
|
50 |
* son registrados con la extensi?n sid |
|
51 |
* |
|
52 |
* @version 15/05/2008 |
|
53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
54 |
*/ |
|
55 |
public class LizardTechProvider extends AbstractRasterProvider { |
|
56 |
private static final Logger logger = LoggerFactory.getLogger(LizardTechProvider.class); |
|
57 |
|
|
58 |
public static String NAME = "LizardTech Store"; |
|
59 |
public static String DESCRIPTION = "LizardTech Raster file"; |
|
60 |
public static final String METADATA_DEFINITION_NAME = "LizardTechStore"; |
|
61 |
protected LizardTechNative lztNative = null; |
|
62 |
private Extent viewRequest = null; |
|
63 |
private DataStoreColorInterpretation colorInterpr = null; |
|
64 |
protected DataStoreTransparency fileTransparency = null; |
|
65 |
private boolean open = false; |
|
66 |
protected static String[] formatList = null; |
|
67 |
|
|
68 |
public static void register() { |
|
69 |
RasterLocator.getManager().getProviderServices().registerFileProvidersTiled(LizardTechProvider.class); |
|
70 |
registerFormats(); |
|
71 |
|
|
72 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager(); |
|
73 |
if (dataman != null && !dataman.getStoreProviders().contains(NAME)) { |
|
74 |
dataman.registerStoreProvider(NAME, |
|
75 |
LizardTechProvider.class, LizardTechDataParameters.class); |
|
76 |
} |
|
77 |
|
|
78 |
if(DALFileLocator.getFilesystemServerExplorerManager() != null) |
|
79 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
|
80 |
NAME, DESCRIPTION, |
|
81 |
LizardTechFilesystemServerExplorer.class); |
|
82 |
|
|
83 |
dataman.registerStoreFactory(NAME, DefaultStoreFactory.class); |
|
84 |
} |
|
85 |
|
|
86 |
private static void registerFormats() { |
|
87 |
formatList = new String[] {"sid"}; |
|
88 |
for (int i = 0; i < formatList.length; i++) |
|
89 |
RasterLocator.getManager().getProviderServices().addFormat(formatList[i], LizardTechProvider.class); |
|
90 |
} |
|
91 |
|
|
92 |
public String[] getFormatList() { |
|
93 |
return formatList; |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Returns true if the extension is supported and false if doesn't |
|
98 |
* @param ext |
|
99 |
* @return |
|
100 |
*/ |
|
101 |
public boolean isExtensionSupported(String ext) { |
|
102 |
if(ext.indexOf(".") != -1) |
|
103 |
ext = ext.substring(ext.lastIndexOf(".") + 1, ext.length()); |
|
104 |
for (int i = 0; i < formatList.length; i++) { |
|
105 |
if(formatList[i].compareTo(ext) == 0) |
|
106 |
return true; |
|
107 |
} |
|
108 |
return false; |
|
109 |
} |
|
110 |
|
|
111 |
/** |
|
112 |
* Mandatory constructor to instantiate an empty provider |
|
113 |
*/ |
|
114 |
public LizardTechProvider() { |
|
115 |
} |
|
116 |
|
|
117 |
/** |
|
118 |
* Constructor. Abre el dataset. |
|
119 |
* @param proj Proyecci?n |
|
120 |
* @param fName Nombre del fichero ecw |
|
121 |
* @throws NotSupportedExtensionException |
|
122 |
* @throws OpenException |
|
123 |
* @deprecated use {@link #LizardTechProvider(URI)}, this constructor will be removed in gvSIG 2.5 |
|
124 |
*/ |
|
125 |
public LizardTechProvider(String params) throws NotSupportedExtensionException, OpenException { |
|
126 |
super(params); |
|
127 |
logger.info("Deprecated use of LizardTechProvider constructor"); |
|
128 |
if(params instanceof String) { |
|
129 |
LizardTechDataParameters p = new LizardTechDataParameters(); |
|
130 |
URI uriObj; |
|
131 |
try { |
|
132 |
uriObj = new URI((String)params); |
|
133 |
} catch (URISyntaxException e) { |
|
134 |
throw new OpenException("Can't create uri from "+(String)params, e); |
|
135 |
} |
|
136 |
p.setURI(uriObj); |
|
137 |
super.init(p, null, ToolsLocator.getDynObjectManager() |
|
138 |
.createDynObject( |
|
139 |
MetadataLocator.getMetadataManager().getDefinition( |
|
140 |
DataStore.METADATA_DEFINITION_NAME))); |
|
141 |
init(p, null); |
|
142 |
} |
|
143 |
} |
|
144 |
|
|
145 |
/** |
|
146 |
* Constructor. Abre el dataset. |
|
147 |
* @param proj Proyecci?n |
|
148 |
* @param fName Nombre del fichero ecw |
|
149 |
* @throws NotSupportedExtensionException |
|
150 |
*/ |
|
151 |
public LizardTechProvider(URI uri) throws NotSupportedExtensionException { |
|
152 |
super(uri); |
|
153 |
LizardTechDataParameters p = new LizardTechDataParameters(); |
|
154 |
p.setURI(uri); |
|
155 |
super.init( |
|
156 |
p, |
|
157 |
null, |
|
158 |
ToolsLocator.getDynObjectManager().createDynObject( |
|
159 |
MetadataLocator.getMetadataManager().getDefinition(DataStore.METADATA_DEFINITION_NAME))); |
|
160 |
init(p, null); |
|
161 |
} |
|
162 |
|
|
163 |
public LizardTechProvider(LizardTechDataParameters params, |
|
164 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
165 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
166 |
.createDynObject( |
|
167 |
MetadataLocator.getMetadataManager().getDefinition( |
|
168 |
DataStore.METADATA_DEFINITION_NAME))); |
|
169 |
init(params, storeServices); |
|
170 |
} |
|
171 |
|
|
172 |
/** |
|
173 |
* Contructor. Abre el fichero mrsid |
|
174 |
* @param proj Proyecci?n |
|
175 |
* @param fName Nombre del fichero mrsid |
|
176 |
*/ |
|
177 |
public void init(AbstractRasterDataParameters params, |
|
178 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
179 |
setParam(storeServices, params); |
|
180 |
try { |
|
181 |
lztNative = new LizardTechNative(new File(params.getURI()).getAbsolutePath()); |
|
182 |
load(); |
|
183 |
bandCount = lztNative.nbands; |
|
184 |
int[] dt = new int[bandCount]; |
|
185 |
for (int i = 0; i < dt.length; i++) |
|
186 |
dt[i] = Buffer.TYPE_BYTE; |
|
187 |
setDataType(dt); |
|
188 |
super.init(); |
|
189 |
|
|
190 |
try { |
|
191 |
loadFromRmf(getRmfBlocksManager()); |
|
192 |
} catch (ParsingException e) { |
|
193 |
// No lee desde rmf |
|
194 |
} |
|
195 |
} catch (Exception e) { |
|
196 |
System.out.println("Error en constructor de MrSID"); |
|
197 |
e.printStackTrace(); |
|
198 |
lztNative = null; |
|
199 |
} |
|
200 |
open = true; |
|
201 |
} |
|
202 |
|
|
203 |
public RasterProvider load() { |
|
204 |
ownTransformation = lztNative.getOwnTransformation(); |
|
205 |
externalTransformation = (AffineTransform) ownTransformation.clone(); |
|
206 |
return this; |
|
207 |
} |
|
208 |
|
|
209 |
public boolean isOpen() { |
|
210 |
return open; |
|
211 |
} |
|
212 |
|
|
213 |
public void close() { |
|
214 |
if (lztNative != null) { |
|
215 |
lztNative.close(); |
|
216 |
lztNative = null; |
|
217 |
} |
|
218 |
open = false; |
|
219 |
} |
|
220 |
|
|
221 |
public void setView(Extent e) { |
|
222 |
viewRequest = new ExtentImpl(e); |
|
223 |
} |
|
224 |
|
|
225 |
public Extent getView() { |
|
226 |
return viewRequest; |
|
227 |
} |
|
228 |
|
|
229 |
public double getWidth() { |
|
230 |
return lztNative.width; |
|
231 |
} |
|
232 |
|
|
233 |
public double getHeight() { |
|
234 |
return lztNative.height; |
|
235 |
} |
|
236 |
|
|
237 |
/** |
|
238 |
* Asigna al objeto Image los valores con los dato de la imagen contenidos en |
|
239 |
* el vector de enteros. |
|
240 |
* @param image imagen con los datos actuales |
|
241 |
* @param startX inicio de la posici?n en X dentro de la imagen |
|
242 |
* @param startY inicio de la posici?n en X dentro de la imagen |
|
243 |
* @param w Ancho de la imagen |
|
244 |
* @param h Alto de la imagen |
|
245 |
* @param rgbArray vector que contiene la banda que se va a sustituir |
|
246 |
* @param offset desplazamiento |
|
247 |
* @param scansize tama?o de imagen recorrida por cada p |
|
248 |
*/ |
|
249 |
protected void setRGBLine(BufferedImage image, int startX, int startY, int w, int h, |
|
250 |
int[] rgbArray, int offset, int scansize) { |
|
251 |
image.setRGB(startX, startY, w, h, rgbArray, offset, scansize); |
|
252 |
} |
|
253 |
|
|
254 |
public Object getData(int x, int y, int band) throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
255 |
if (lztNative != null) { |
|
256 |
if (x < 0 || y < 0 || x >= lztNative.width || y >= lztNative.height) |
|
257 |
throw new InvalidSetViewException("Request out of grid"); |
|
258 |
Object[] data = lztNative.getData(x, y); |
|
259 |
return data[band]; |
|
260 |
} |
|
261 |
throw new FileNotOpenException("MrSIDNative not exist"); |
|
262 |
} |
|
263 |
|
|
264 |
public int getBlockSize() { |
|
265 |
return lztNative.blocksize; |
|
266 |
} |
|
267 |
|
|
268 |
/** |
|
269 |
* Informa de si el driver ha supersampleado en el ?ltimo dibujado. Es el |
|
270 |
* driver el que colocar? el valor de esta variable cada vez que dibuja. |
|
271 |
* @return true si se ha supersampleado y false si no se ha hecho. |
|
272 |
*/ |
|
273 |
public boolean isSupersampling() { |
|
274 |
return lztNative.isSupersampling; |
|
275 |
} |
|
276 |
|
|
277 |
@Override |
|
278 |
public void loadBuffer(SpiRasterQuery query) |
|
279 |
throws ProcessInterruptedException, RasterDriverException { |
|
280 |
setView(query.getAdjustedRequestBoundingBox()); |
|
281 |
int width = query.getAdjustedBufWidth(); |
|
282 |
int height = query.getAdjustedBufHeight(); |
|
283 |
lztNative.setView(viewRequest.getULX(), viewRequest.getULY(), viewRequest.getLRX(), viewRequest.getLRY(), width, height); |
|
284 |
|
|
285 |
int[] pRGBArray = new int[width * height]; |
|
286 |
|
|
287 |
try { |
|
288 |
RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
289 |
lztNative.readScene(pRGBArray, task); |
|
290 |
loadBuffer(height, |
|
291 |
width, |
|
292 |
query.getBandList(), |
|
293 |
query.getBufferForProviders(), |
|
294 |
pRGBArray); |
|
295 |
} catch (MrSIDException e) { |
|
296 |
throw new RasterDriverException("Error reading data"); |
|
297 |
} |
|
298 |
} |
|
299 |
|
|
300 |
// private void loadCachedBuffer( Buffer buf, |
|
301 |
// Extent inputWindow, |
|
302 |
// RasterTask task, |
|
303 |
// int[] pRGBArray, |
|
304 |
// BandList bandList) throws ProcessInterruptedException, MrSIDException { |
|
305 |
// if(buf.isCached()) { |
|
306 |
// Point2D blockHeightWC = rasterToWorld(new Point2D.Double(buf.getBlockHeight(), buf.getBlockHeight())); |
|
307 |
// int nBlocks = (int)(inputWindow.height() / blockHeightWC.getX()); |
|
308 |
// double lastblockWC = inputWindow.height() - (nBlocks * blockHeightWC.getX()); |
|
309 |
// int lastBlock = buf.getHeight() - (nBlocks * buf.getBlockHeight()); |
|
310 |
// if(lastblockWC > 0) |
|
311 |
// nBlocks ++; |
|
312 |
// double init = inputWindow.getULY(); |
|
313 |
// Extent ext = null; |
|
314 |
// for (int i = 0; i < nBlocks; i++) { |
|
315 |
// if(lastblockWC > 0 && i == (nBlocks - 1)) { |
|
316 |
// ext = RasterLocator.getManager().getDataStructFactory().createExtent( |
|
317 |
// inputWindow.getULX(), |
|
318 |
// init, |
|
319 |
// inputWindow.getLRX(), |
|
320 |
// lastblockWC); |
|
321 |
// file.setView(ext.getULX(), ext.getULY(), ext.getLRX(), ext.getLRY(), buf.getWidth(), buf.getBlockHeight()); |
|
322 |
// file.readScene(pRGBArray, task); |
|
323 |
// loadPartialBuffer(new int[]{0, i * buf.getBlockHeight(), buf.getWidth(), buf.getHeight() }, |
|
324 |
// bandList, |
|
325 |
// buf, |
|
326 |
// pRGBArray, |
|
327 |
// buf.getWidth()); |
|
328 |
// } else { |
|
329 |
// ext = RasterLocator.getManager().getDataStructFactory().createExtent( |
|
330 |
// inputWindow.getULX(), |
|
331 |
// init, |
|
332 |
// inputWindow.getLRX(), |
|
333 |
// init - blockHeightWC.getX()); |
|
334 |
// file.setView(ext.getULX(), ext.getULY(), ext.getLRX(), ext.getLRY(), buf.getWidth(), lastBlock); |
|
335 |
// file.readScene(pRGBArray, task); |
|
336 |
// loadPartialBuffer(new int[]{0, i * buf.getBlockHeight(), buf.getWidth(), i * buf.getBlockHeight() + buf.getBlockHeight() }, |
|
337 |
// bandList, |
|
338 |
// buf, |
|
339 |
// pRGBArray, |
|
340 |
// buf.getWidth()); |
|
341 |
// init += buf.getBlockHeight(); |
|
342 |
// } |
|
343 |
// } |
|
344 |
// } else { |
|
345 |
// file.setView(inputWindow.getULX(), inputWindow.getULY(), inputWindow.getLRX(), inputWindow.getLRY(), buf.getWidth(), buf.getHeight()); |
|
346 |
// file.readScene(pRGBArray, task); |
|
347 |
// loadBuffer(buf.getWidth(), buf.getHeight(), bandList, buf, pRGBArray); |
|
348 |
// } |
|
349 |
// } |
|
350 |
// |
|
351 |
// private void loadPartialBuffer(int[] stepBuffer, |
|
352 |
// BandList bandList, |
|
353 |
// Buffer rasterBuf, |
|
354 |
// int[] pRGBArray, |
|
355 |
// int bufWidth) throws ProcessInterruptedException { |
|
356 |
// RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
357 |
// int[] drawableBandsR = bandList.getBufferBandToDraw(getURIOfFirstProvider(), 0); |
|
358 |
// int[] drawableBandsG = bandList.getBufferBandToDraw(getURIOfFirstProvider(), 1); |
|
359 |
// int[] drawableBandsB = bandList.getBufferBandToDraw(getURIOfFirstProvider(), 2); |
|
360 |
// int element = 0; |
|
361 |
// int rowSrc = 0; |
|
362 |
// |
|
363 |
// for (int row = stepBuffer[1]; row < stepBuffer[3]; row++) { |
|
364 |
// int colSrc = 0; |
|
365 |
// for (int col = stepBuffer[0]; col < stepBuffer[2]; col++) { |
|
366 |
// element = pRGBArray[(rowSrc * bufWidth) + colSrc]; |
|
367 |
// if(drawableBandsR != null) { |
|
368 |
// for (int i = 0; i < drawableBandsR.length; i++) { |
|
369 |
// if(drawableBandsR[i] >= 0 && drawableBandsR[i] < rasterBuf.getBandCount()) |
|
370 |
// rasterBuf.setElem(row, col, drawableBandsR[i], (byte) ((element & 0x00ff0000) >> 16)); |
|
371 |
// } |
|
372 |
// } |
|
373 |
// if(drawableBandsG != null) { |
|
374 |
// for (int i = 0; i < drawableBandsG.length; i++) { |
|
375 |
// if(drawableBandsG[i] >= 0 && drawableBandsG[i] < rasterBuf.getBandCount()) |
|
376 |
// rasterBuf.setElem(row, col, drawableBandsG[i], (byte) ((element & 0x0000ff00) >> 8)); |
|
377 |
// } |
|
378 |
// } |
|
379 |
// if(drawableBandsB != null) { |
|
380 |
// for (int i = 0; i < drawableBandsB.length; i++) { |
|
381 |
// if(drawableBandsB[i] >= 0 && drawableBandsB[i] < rasterBuf.getBandCount()) |
|
382 |
// rasterBuf.setElem(row, col, drawableBandsB[i], (byte) (element & 0x000000ff)); |
|
383 |
// } |
|
384 |
// } |
|
385 |
// colSrc ++; |
|
386 |
// } |
|
387 |
// if (task.getEvent() != null) |
|
388 |
// task.manageEvent(task.getEvent()); |
|
389 |
// rowSrc ++; |
|
390 |
// } |
|
391 |
// } |
|
392 |
|
|
393 |
private void loadBuffer(int h, int w, BandList bandList, Buffer rasterBuf, int[] pRGBArray) throws ProcessInterruptedException { |
|
394 |
RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
395 |
String absolutePath = new File(getURIOfFirstProvider()).getAbsolutePath(); |
|
396 |
int[] drawableBandsR = bandList.getBufferBandToDraw(absolutePath, 0); |
|
397 |
int[] drawableBandsG = bandList.getBufferBandToDraw(absolutePath, 1); |
|
398 |
int[] drawableBandsB = bandList.getBufferBandToDraw(absolutePath, 2); |
|
399 |
int element = 0; |
|
400 |
|
|
401 |
for (int row = 0; row < h; row++) { |
|
402 |
for (int col = 0; col < w; col++) { |
|
403 |
element = pRGBArray[(row * w) + col]; |
|
404 |
if(drawableBandsR != null) { |
|
405 |
for (int i = 0; i < drawableBandsR.length; i++) { |
|
406 |
if(drawableBandsR[i] >= 0 && drawableBandsR[i] < rasterBuf.getBandCount()) |
|
407 |
rasterBuf.setElem(row, col, drawableBandsR[i], (byte) ((element & 0x00ff0000) >> 16)); |
|
408 |
} |
|
409 |
} |
|
410 |
if(drawableBandsG != null) { |
|
411 |
for (int i = 0; i < drawableBandsG.length; i++) { |
|
412 |
if(drawableBandsG[i] >= 0 && drawableBandsG[i] < rasterBuf.getBandCount()) |
|
413 |
rasterBuf.setElem(row, col, drawableBandsG[i], (byte) ((element & 0x0000ff00) >> 8)); |
|
414 |
} |
|
415 |
} |
|
416 |
if(drawableBandsB != null) { |
|
417 |
for (int i = 0; i < drawableBandsB.length; i++) { |
|
418 |
if(drawableBandsB[i] >= 0 && drawableBandsB[i] < rasterBuf.getBandCount()) |
|
419 |
rasterBuf.setElem(row, col, drawableBandsB[i], (byte) (element & 0x000000ff)); |
|
420 |
} |
|
421 |
} |
|
422 |
} |
|
423 |
if (task.getEvent() != null) |
|
424 |
task.manageEvent(task.getEvent()); |
|
425 |
} |
|
426 |
} |
|
427 |
|
|
428 |
public Object readBlock(int pos, int blockHeight, double scale) throws InvalidSetViewException, FileNotOpenException, RasterDriverException, ProcessInterruptedException { |
|
429 |
RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
430 |
|
|
431 |
if (pos < 0) |
|
432 |
throw new InvalidSetViewException("Request out of grid"); |
|
433 |
|
|
434 |
if ((pos + blockHeight) > lztNative.height) |
|
435 |
blockHeight = Math.abs(lztNative.height - pos); |
|
436 |
|
|
437 |
Point2D begin = rasterToWorld(new Point2D.Double(0, pos)); |
|
438 |
Point2D end = rasterToWorld(new Point2D.Double(lztNative.width, pos + blockHeight)); |
|
439 |
|
|
440 |
int w = lztNative.width; |
|
441 |
|
|
442 |
lztNative.setView(begin.getX(), begin.getY(), end.getX(), end.getY(), w, blockHeight); |
|
443 |
|
|
444 |
int[] pRGBArray = new int[lztNative.width * blockHeight]; |
|
445 |
try { |
|
446 |
lztNative.readScene(pRGBArray, task); |
|
447 |
byte[][][] buf = new byte[3][blockHeight][w]; |
|
448 |
for (int row = 0; row < blockHeight; row++) { |
|
449 |
for (int col = 0; col < w; col++) { |
|
450 |
buf[0][row][col] = (byte) ((pRGBArray[(row * w) + col] & 0x00ff0000) >> 16); |
|
451 |
buf[1][row][col] = (byte) ((pRGBArray[(row * w) + col] & 0x0000ff00) >> 8); |
|
452 |
buf[2][row][col] = (byte) (pRGBArray[(row * w) + col] & 0x000000ff); |
|
453 |
} |
|
454 |
if (task.getEvent() != null) |
|
455 |
task.manageEvent(task.getEvent()); |
|
456 |
} |
|
457 |
return buf; |
|
458 |
} catch (MrSIDException e) { |
|
459 |
throw new RasterDriverException("Error reading data"); |
|
460 |
} |
|
461 |
} |
|
462 |
|
|
463 |
/** |
|
464 |
* Read a line from the file |
|
465 |
* @param line |
|
466 |
* @param band |
|
467 |
* @return |
|
468 |
* @throws InvalidSetViewException |
|
469 |
* @throws FileNotOpenException |
|
470 |
* @throws RasterDriverException |
|
471 |
* @Deprecated This operation is deprecated because is not useful and in the future |
|
472 |
* it will not be maintained. The abstract operation has dissapear |
|
473 |
*/ |
|
474 |
public Object readCompleteLine(int line, int band) |
|
475 |
throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
476 |
RasterTask task = RasterTaskQueue.get(Thread.currentThread().getId() + ""); |
|
477 |
|
|
478 |
if (line > this.getHeight() || band > this.getBandCount()) |
|
479 |
throw new InvalidSetViewException("Request out of grid"); |
|
480 |
|
|
481 |
try { |
|
482 |
Extent extent = getExtent(); |
|
483 |
Point2D pt = rasterToWorld(new Point2D.Double(extent.minX(), line)); |
|
484 |
lztNative.setView(extent.minX(), pt.getY(), extent.maxX(), pt.getY(), (int)getWidth(), 1); |
|
485 |
int[] pRGBArray = new int[(int)getWidth()]; |
|
486 |
lztNative.readScene(pRGBArray, task); |
|
487 |
return pRGBArray; |
|
488 |
} catch (MrSIDException e) { |
|
489 |
throw new RasterDriverException("Error reading data from MrSID library"); |
|
490 |
} catch (ProcessInterruptedException e) { |
|
491 |
// El proceso que debe ser interrumpido es el que llama a readLine. |
|
492 |
} |
|
493 |
return null; |
|
494 |
} |
|
495 |
|
|
496 |
public DataStoreTransparency getTransparency() { |
|
497 |
if (fileTransparency == null) |
|
498 |
fileTransparency = new DataStoreTransparency(getColorInterpretation()); |
|
499 |
return fileTransparency; |
|
500 |
} |
|
501 |
|
|
502 |
public DataStoreColorInterpretation getColorInterpretation() { |
|
503 |
if(colorInterpr == null) { |
|
504 |
colorInterpr = new DataStoreColorInterpretation(); |
|
505 |
colorInterpr.initColorInterpretation(getBandCount()); |
|
506 |
if(getBandCount() == 1) |
|
507 |
colorInterpr = DataStoreColorInterpretation.createGrayInterpretation(); |
|
508 |
if(getBandCount() == 3) { |
|
509 |
colorInterpr = DataStoreColorInterpretation.createRGBInterpretation(); |
|
510 |
} |
|
511 |
if(getBandCount() >= 4) { |
|
512 |
colorInterpr = DataStoreColorInterpretation.createRGBAInterpretation(); |
|
513 |
} |
|
514 |
} |
|
515 |
return colorInterpr; |
|
516 |
} |
|
517 |
|
|
518 |
public String getWktProjection() { |
|
519 |
// System.err.println("======>" + file); |
|
520 |
return null; |
|
521 |
} |
|
522 |
|
|
523 |
public void setAffineTransform(AffineTransform t) { |
|
524 |
super.setAffineTransform(t); |
|
525 |
lztNative.setExternalTransform(t); |
|
526 |
} |
|
527 |
|
|
528 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
529 |
if (band >= getBandCount()) |
|
530 |
throw new BandAccessException("Wrong band"); |
|
531 |
try { |
|
532 |
return lztNative.getNumLevels(); |
|
533 |
} catch (MrSIDException e) { |
|
534 |
throw new RasterDriverException(""); |
|
535 |
} |
|
536 |
} |
|
537 |
|
|
538 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
539 |
if (band >= getBandCount()) |
|
540 |
throw new BandAccessException("Wrong band"); |
|
541 |
return 0; |
|
542 |
} |
|
543 |
|
|
544 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
545 |
if (band >= getBandCount()) |
|
546 |
throw new BandAccessException("Wrong band"); |
|
547 |
return 0; |
|
548 |
} |
|
549 |
|
|
550 |
public boolean isOverviewsSupported() { |
|
551 |
// No podemos escribir por lo que no podemos informar de que soporta overviews aunque el formato si lo haga. |
|
552 |
return false; |
|
553 |
} |
|
554 |
|
|
555 |
public String getProviderName() { |
|
556 |
return NAME; |
|
557 |
} |
|
558 |
|
|
559 |
public void setStatus(RasterProvider provider) { |
|
560 |
if(provider instanceof LizardTechProvider) { |
|
561 |
//Not implemented yet |
|
562 |
} |
|
563 |
} |
|
564 |
|
|
565 |
public TileServer getTileServer() { |
|
566 |
if(tileServer == null) { |
|
567 |
DefaultRasterStore store = new DefaultRasterStore(); |
|
568 |
store.setProvider(this); |
|
569 |
tileServer = new FileTileServer(store); |
|
570 |
} |
|
571 |
return tileServer; |
|
572 |
} |
|
573 |
|
|
574 |
public void addFile(File file) throws InvalidSourceException { |
|
575 |
// Do nothing |
|
576 |
} |
|
577 |
|
|
578 |
public void removeFile(File file) { |
|
579 |
// Do nothing |
|
580 |
} |
|
581 |
|
|
582 |
|
|
583 |
} |
|
0 | 584 |
org.gvsig.raster.lizardtech/tags/org.gvsig.raster.lizardtech-2.2.124/org.gvsig.raster.lizardtech.io/src/main/java/org/gvsig/raster/lizardtech/io/LizardTechFilesystemServerExplorer.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 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.raster.lizardtech.io; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
|
|
32 |
import org.gvsig.fmap.dal.DALLocator; |
|
33 |
import org.gvsig.fmap.dal.DataManager; |
|
34 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
37 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
38 |
import org.gvsig.fmap.dal.exception.CreateException; |
|
39 |
import org.gvsig.fmap.dal.exception.DataException; |
|
40 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
41 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
42 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
43 |
import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters; |
|
44 |
|
|
45 |
public class LizardTechFilesystemServerExplorer extends AbstractFilesystemServerExplorerProvider { |
|
46 |
|
|
47 |
/* |
|
48 |
* (non-Javadoc) |
|
49 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#canCreate() |
|
50 |
*/ |
|
51 |
public boolean canCreate() { |
|
52 |
return false; |
|
53 |
} |
|
54 |
|
|
55 |
/* |
|
56 |
* (non-Javadoc) |
|
57 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#canCreate(org.gvsig.fmap.dal.NewDataStoreParameters) |
|
58 |
*/ |
|
59 |
public boolean canCreate(NewDataStoreParameters parameters) { |
|
60 |
return false; |
|
61 |
} |
|
62 |
|
|
63 |
/* |
|
64 |
* (non-Javadoc) |
|
65 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#create(org.gvsig.fmap.dal.NewDataStoreParameters, boolean) |
|
66 |
*/ |
|
67 |
public void create(NewDataStoreParameters parameters, boolean overwrite) |
|
68 |
throws CreateException { |
|
69 |
throw new UnsupportedOperationException(); |
|
70 |
} |
|
71 |
|
|
72 |
/* |
|
73 |
* (non-Javadoc) |
|
74 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#getCreateParameters() |
|
75 |
*/ |
|
76 |
public NewDataStoreParameters getCreateParameters() throws DataException { |
|
77 |
return null; |
|
78 |
} |
|
79 |
|
|
80 |
/* |
|
81 |
* (non-Javadoc) |
|
82 |
* @see org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider#initialize(org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices) |
|
83 |
*/ |
|
84 |
public void initialize( |
|
85 |
FilesystemServerExplorerProviderServices serverExplorer) { |
|
86 |
} |
Also available in: Unified diff