Revision 10781
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/Jaddo.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.addo; |
|
23 |
import java.io.File; |
|
24 |
|
|
25 |
import org.gdal.gdal.Dataset; |
|
26 |
import org.gdal.gdal.gdal; |
|
27 |
|
|
28 |
/** |
|
29 |
* Clase para la construccion de overviews de un raster. |
|
30 |
* |
|
31 |
* 15-nov-2007 |
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
33 |
*/ |
|
34 |
public class Jaddo implements IOverviewIncrement{ |
|
35 |
public final static int NEAREST = 0; |
|
36 |
public final static int AVERAGE = 1; |
|
37 |
public final static int AVERAGE_MP = 2; |
|
38 |
public final static int AVERAGE_MAGPHASE = 3; |
|
39 |
public final static int MODE = 4; |
|
40 |
|
|
41 |
private IOverviewIncrement incrementListener = null; |
|
42 |
private int value = 0; |
|
43 |
|
|
44 |
// private native int buildOverviewsNative(int resamplingAlg, String file, int[] overviews); |
|
45 |
|
|
46 |
/** |
|
47 |
* Construccion de overviews |
|
48 |
*/ |
|
49 |
public void buildOverviews(int resamplingAlg, String file, int[] overviews) |
|
50 |
throws BuildingOverviewsException, WritingException { |
|
51 |
File f = new File(file); |
|
52 |
if(!f.exists() || !f.isFile()) |
|
53 |
throw new BuildingOverviewsException("File does not exist."); |
|
54 |
if(!f.canWrite()) |
|
55 |
throw new WritingException("File is not writeable"); |
|
56 |
Dataset data = gdal.Open(file); |
|
57 |
if(data.BuildOverviews(overviews) >= 0) |
|
58 |
throw new BuildingOverviewsException("Problems building overviews"); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* Devuelve el porcentaje del incremento. |
|
63 |
* @return int |
|
64 |
*/ |
|
65 |
public int getPercent() { |
|
66 |
return value; |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* Asigna el porcentaje de incremento de la construccion de overview. |
|
71 |
* Esto se hace automaticamente desde el callback que asigna el porcentaje. |
|
72 |
*/ |
|
73 |
public void setPercent(int value) { |
|
74 |
this.value = value; |
|
75 |
if(incrementListener != null) |
|
76 |
incrementListener.setPercent(value); |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* Asigna el listener para la asignacion del incremento |
|
81 |
* @param incr IOverviewIncrement |
|
82 |
*/ |
|
83 |
public void setIncrementListener(IOverviewIncrement incr) { |
|
84 |
this.incrementListener = incr; |
|
85 |
} |
|
86 |
} |
|
0 | 87 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/WritingException.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.addo; |
|
23 |
|
|
24 |
/** |
|
25 |
* Es generada no se puede escribir las overviews |
|
26 |
* |
|
27 |
* @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es |
|
28 |
* @version 0.0 |
|
29 |
* @link http://www.gvsig.org |
|
30 |
*/ |
|
31 |
|
|
32 |
|
|
33 |
public class WritingException extends Exception { |
|
34 |
|
|
35 |
public WritingException(String msg){ |
|
36 |
super(msg); |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
} |
|
0 | 41 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/IOverviewIncrement.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.addo; |
|
23 |
|
|
24 |
/** |
|
25 |
* Interfaz para la asignacion y recuperacion del incremento |
|
26 |
* de la tarea. |
|
27 |
* |
|
28 |
* 17-nov-2007 |
|
29 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
30 |
*/ |
|
31 |
public interface IOverviewIncrement { |
|
32 |
/** |
|
33 |
* Devuelve el porcentaje del incremento |
|
34 |
* @return int |
|
35 |
*/ |
|
36 |
public int getPercent(); |
|
37 |
|
|
38 |
/** |
|
39 |
* Asigna el porcentaje de incremento de la construccion de overview. |
|
40 |
* Esto se hace automaticamente desde el callback que asigna el porcentaje. |
|
41 |
*/ |
|
42 |
public void setPercent(int value); |
|
43 |
} |
|
0 | 44 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/addo/BuildingOverviewsException.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.addo; |
|
23 |
|
|
24 |
/** |
|
25 |
* Es generada cuando hay algun problema en la construccion de |
|
26 |
* las overviews y la funcion nativa devuelve 0 |
|
27 |
* |
|
28 |
* @author Nacho Brodin (nachobrodin@gmail.com).<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es |
|
29 |
* @version 0.0 |
|
30 |
* @link http://www.gvsig.org |
|
31 |
*/ |
|
32 |
public class BuildingOverviewsException extends Exception { |
|
33 |
|
|
34 |
public BuildingOverviewsException(String msg) { |
|
35 |
super(msg); |
|
36 |
} |
|
37 |
|
|
38 |
} |
|
0 | 39 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryRasterProvider.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.memory.io; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.awt.geom.Point2D; |
|
26 |
import java.awt.geom.Rectangle2D; |
|
27 |
import java.io.File; |
|
28 |
|
|
29 |
import org.cresques.cts.ICoordTrans; |
|
30 |
|
|
31 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
32 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
33 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
34 |
import org.gvsig.fmap.dal.coverage.exception.BandAccessException; |
|
35 |
import org.gvsig.fmap.dal.coverage.exception.FileNotOpenException; |
|
36 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSetViewException; |
|
37 |
import org.gvsig.fmap.dal.coverage.exception.InvalidSourceException; |
|
38 |
import org.gvsig.fmap.dal.coverage.exception.NotSupportedExtensionException; |
|
39 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
40 |
import org.gvsig.fmap.dal.coverage.exception.RasterDriverException; |
|
41 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
|
42 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
43 |
import org.gvsig.metadata.MetadataLocator; |
|
44 |
import org.gvsig.raster.cache.tile.provider.TileServer; |
|
45 |
import org.gvsig.raster.impl.buffer.SpiRasterQuery; |
|
46 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
|
47 |
import org.gvsig.raster.impl.provider.AbstractRasterProvider; |
|
48 |
import org.gvsig.raster.impl.provider.RasterProvider; |
|
49 |
import org.gvsig.raster.impl.store.AbstractRasterDataParameters; |
|
50 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
|
51 |
import org.gvsig.tools.ToolsLocator; |
|
52 |
import org.gvsig.tools.task.TaskStatus; |
|
53 |
|
|
54 |
/** |
|
55 |
* Driver para datos cargados en un objeto IBuffer |
|
56 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
57 |
* |
|
58 |
*/ |
|
59 |
public class MemoryRasterProvider extends AbstractRasterProvider { |
|
60 |
public static String NAME = "Gdal Store"; |
|
61 |
public static String DESCRIPTION = "Gdal Raster file"; |
|
62 |
public static final String METADATA_DEFINITION_NAME = "GdalStore"; |
|
63 |
|
|
64 |
private Extent v = null; |
|
65 |
protected Buffer buffer = null; |
|
66 |
private Extent extent = null; |
|
67 |
private boolean open = false; |
|
68 |
|
|
69 |
public static void register() { |
|
70 |
} |
|
71 |
|
|
72 |
public void registerTileProviderFormats(Class<RasterProvider> c) { |
|
73 |
|
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Mandatory constructor to instantiate an empty provider |
|
78 |
*/ |
|
79 |
public MemoryRasterProvider() {} |
|
80 |
|
|
81 |
/** |
|
82 |
* Constructor. Asigna el buffer de datos y la extensi?n |
|
83 |
* @param proj Proyecci?n |
|
84 |
* @param buf Buffer |
|
85 |
* @throws NotSupportedExtensionException |
|
86 |
*/ |
|
87 |
public MemoryRasterProvider(AbstractRasterDataParameters params, |
|
88 |
DataStoreProviderServices storeServices) throws NotSupportedExtensionException { |
|
89 |
super(params, storeServices, ToolsLocator.getDynObjectManager() |
|
90 |
.createDynObject( |
|
91 |
MetadataLocator.getMetadataManager().getDefinition( |
|
92 |
METADATA_DEFINITION_NAME))); |
|
93 |
setParam(storeServices, params); |
|
94 |
if(!(params instanceof MemoryDataParameters)) |
|
95 |
throw new NotSupportedExtensionException("Buffer not supported"); |
|
96 |
|
|
97 |
extent = ((MemoryDataParameters)params).getExtent(); |
|
98 |
this.buffer = ((MemoryDataParameters)params).getBuffer(); |
|
99 |
|
|
100 |
if(extent != null) { |
|
101 |
double psX = (extent.maxX() - extent.minX()) / buffer.getWidth(); |
|
102 |
double psY = (extent.minY() - extent.maxY()) / buffer.getHeight(); |
|
103 |
ownTransformation = new AffineTransform(psX, 0, 0, psY, extent.minX(), extent.maxY()); |
|
104 |
} else |
|
105 |
ownTransformation = new AffineTransform(1, 0, 0, -1, 0, buffer.getHeight()); |
|
106 |
|
|
107 |
if(buffer == null) |
|
108 |
throw new NotSupportedExtensionException("Buffer invalid"); |
|
109 |
|
|
110 |
load(); |
|
111 |
bandCount = buffer.getBandCount(); |
|
112 |
|
|
113 |
//Obtenemos el tipo de dato de gdal y lo convertimos el de RasterBuf |
|
114 |
int[] dt = new int[buffer.getBandCount()]; |
|
115 |
for (int i = 0; i < dt.length; i++) |
|
116 |
dt[i] = buffer.getDataType(); |
|
117 |
setDataType(dt); |
|
118 |
open = true; |
|
119 |
} |
|
120 |
|
|
121 |
public RasterProvider load() { |
|
122 |
return this; |
|
123 |
} |
|
124 |
|
|
125 |
public boolean isOpen() { |
|
126 |
return open; |
|
127 |
} |
|
128 |
|
|
129 |
public void close() { |
|
130 |
buffer = null; |
|
131 |
open = false; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* Asigna el extent de la vista actual. |
|
136 |
*/ |
|
137 |
public void setView(Extent e) { |
|
138 |
v = e; |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* Obtiene extent de la vista actual |
|
143 |
*/ |
|
144 |
public Extent getView() { |
|
145 |
return v; |
|
146 |
} |
|
147 |
|
|
148 |
/** |
|
149 |
* Obtiene la anchura del fichero |
|
150 |
*/ |
|
151 |
public double getWidth() { |
|
152 |
return buffer.getWidth(); |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* Obtiene la altura del fichero |
|
157 |
*/ |
|
158 |
public double getHeight() { |
|
159 |
return buffer.getHeight(); |
|
160 |
} |
|
161 |
|
|
162 |
public void reProject(ICoordTrans rp) { |
|
163 |
} |
|
164 |
|
|
165 |
/** |
|
166 |
* Obtiene la orientaci?n de la imagen a partir del signo del tama?o de pixel para poder |
|
167 |
* asignarlo en el setView. Esto es util para poder conocer como debe leerse la image, |
|
168 |
* de abajo a arriba, de arriba a abajo, de izquierda a derecha o de derecha a izquierda. |
|
169 |
* La posici?n habitual es la que el pixel size en X es positivo y en Y negativo leyendose |
|
170 |
* en este caso las X de menor a mayor y las Y de mayor a menor. Los casos posibles son: |
|
171 |
* <UL> |
|
172 |
* <LI><B>X > 0; Y < 0;</B> {true, false}</LI> |
|
173 |
* <LI><B>X > 0; Y > 0;</B> {true, true}</LI> |
|
174 |
* <LI><B>X < 0; Y > 0;</B> {false, true}</LI> |
|
175 |
* <LI><B>X < 0; Y < 0;</B> {false, false}</LI> |
|
176 |
* </UL> |
|
177 |
* |
|
178 |
* @return |
|
179 |
*/ |
|
180 |
/*private boolean[] getOrientation(){ |
|
181 |
boolean[] orientation = {true, false}; |
|
182 |
return orientation; |
|
183 |
}*/ |
|
184 |
|
|
185 |
public Object getData(int x, int y, int band) { |
|
186 |
if(buffer.getDataType() == Buffer.TYPE_BYTE){ |
|
187 |
return new Integer(buffer.getElemByte(y, x, band)); |
|
188 |
}else if(buffer.getDataType() == Buffer.TYPE_SHORT){ |
|
189 |
return new Integer(buffer.getElemShort(y, x, band)); |
|
190 |
}else if(buffer.getDataType() == Buffer.TYPE_INT){ |
|
191 |
return new Integer(buffer.getElemInt(y, x, band)); |
|
192 |
}else if(buffer.getDataType() == Buffer.TYPE_FLOAT){ |
|
193 |
return new Float(buffer.getElemFloat(y, x, band)); |
|
194 |
}else if(buffer.getDataType() == Buffer.TYPE_DOUBLE){ |
|
195 |
return new Double(buffer.getElemDouble(y, x, band)); |
|
196 |
} |
|
197 |
return null; |
|
198 |
} |
|
199 |
|
|
200 |
|
|
201 |
/** |
|
202 |
* Devuelve el tama?o de bloque |
|
203 |
* @return Tama?o de bloque |
|
204 |
*/ |
|
205 |
public int getBlockSize(){ |
|
206 |
return 0; |
|
207 |
} |
|
208 |
|
|
209 |
/** |
|
210 |
* Obtiene el flag que dice si la imagen est? o no georreferenciada |
|
211 |
* @return true si est? georreferenciada y false si no lo est?. |
|
212 |
*/ |
|
213 |
public boolean isGeoreferenced() { |
|
214 |
return (this.extent != null); |
|
215 |
} |
|
216 |
|
|
217 |
/** |
|
218 |
* Informa de si el driver ha supersampleado en el ?ltimo dibujado. Es el driver el que colocar? |
|
219 |
* el valor de esta variable cada vez que dibuja. |
|
220 |
* @return true si se ha supersampleado y false si no se ha hecho. |
|
221 |
*/ |
|
222 |
public boolean isSupersampling() { |
|
223 |
return false; |
|
224 |
} |
|
225 |
|
|
226 |
/** |
|
227 |
* @return Returns the dataType. |
|
228 |
*/ |
|
229 |
public int[] getDataType() { |
|
230 |
int[] dt = new int[buffer.getBandCount()]; |
|
231 |
for (int i = 0; i < dt.length; i++) |
|
232 |
dt[i] = buffer.getDataType(); |
|
233 |
return dt; |
|
234 |
} |
|
235 |
|
|
236 |
/** |
|
237 |
* Ajusta los puntos pasados por par?metro a los l?mites del buffer. Es decir si alguno excede |
|
238 |
* los l?mites por arriba o por abajo los ajusta. |
|
239 |
* @param begin Punto inicial |
|
240 |
* @param end Punto final |
|
241 |
*/ |
|
242 |
private void adjustPointsToBufferLimits(Point2D begin, Point2D end) { |
|
243 |
if(begin.getX() < 0) |
|
244 |
begin.setLocation(0, begin.getY()); |
|
245 |
if(begin.getY() > buffer.getHeight()) |
|
246 |
begin.setLocation(begin.getX(), buffer.getHeight()); |
|
247 |
if(end.getY() < 0) |
|
248 |
end.setLocation(begin.getX(), 0); |
|
249 |
if(end.getX() > buffer.getWidth()) |
|
250 |
begin.setLocation(buffer.getWidth(), begin.getY()); |
|
251 |
} |
|
252 |
|
|
253 |
public void loadBuffer(SpiRasterQuery q) |
|
254 |
throws ProcessInterruptedException, RasterDriverException { |
|
255 |
getWindow(q.getAdjustedRequestBoundingBox(), q.getBandList(), q.getBufferForProviders(), q.getTaskStatus()); |
|
256 |
} |
|
257 |
|
|
258 |
public Buffer getWindow(Extent ex, BandList bandList, Buffer rasterBuf, TaskStatus status) { |
|
259 |
Point2D begin = worldToRaster(new Point2D.Double(ex.getULX(), ex.getULY())); |
|
260 |
Point2D end = worldToRaster(new Point2D.Double(ex.getLRX(), ex.getLRY())); |
|
261 |
setView(ex); |
|
262 |
|
|
263 |
adjustPointsToBufferLimits(begin, end); |
|
264 |
|
|
265 |
switch(buffer.getDataType()){ |
|
266 |
case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
267 |
case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
268 |
case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
269 |
case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
270 |
case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
271 |
} |
|
272 |
return rasterBuf; |
|
273 |
} |
|
274 |
|
|
275 |
public Buffer getWindow(double x, double y, double w, double h, |
|
276 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) { |
|
277 |
Point2D begin = worldToRaster(new Point2D.Double(x, y)); |
|
278 |
Point2D end = worldToRaster(new Point2D.Double(x + w, y - h)); |
|
279 |
setView(new ExtentImpl(x, y, x + w, y - h)); |
|
280 |
|
|
281 |
adjustPointsToBufferLimits(begin, end); |
|
282 |
|
|
283 |
switch(buffer.getDataType()){ |
|
284 |
case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
285 |
case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
286 |
case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
287 |
case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
288 |
case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, 1, 1, begin, bandList); break; |
|
289 |
} |
|
290 |
return rasterBuf; |
|
291 |
} |
|
292 |
|
|
293 |
public Buffer getWindow(Extent extent, int bufWidth, int bufHeight, |
|
294 |
BandList bandList, Buffer rasterBuf, boolean adjustToExtent, TaskStatus status) { |
|
295 |
Point2D begin = worldToRaster(new Point2D.Double(extent.getMin().getX(), extent.getMax().getY())); |
|
296 |
Point2D end = worldToRaster(new Point2D.Double(extent.getMax().getX(), extent.getMin().getY())); |
|
297 |
setView(extent); |
|
298 |
|
|
299 |
adjustPointsToBufferLimits(begin, end); |
|
300 |
|
|
301 |
//Ancho y alto en pixels (double) del area seleccionada. |
|
302 |
double w = Math.abs(end.getX() - begin.getX()); |
|
303 |
double h = Math.abs(end.getY() - begin.getY()); |
|
304 |
|
|
305 |
//Relaci?n entre el n?mero de pixels del buffer origen (area seleccionada) y el destino |
|
306 |
double stepX = w / ((double)bufWidth); |
|
307 |
double stepY = h / ((double)bufHeight); |
|
308 |
|
|
309 |
//Escritura separada en 5 llamadas para mejorar el rendimiento |
|
310 |
switch(buffer.getDataType()){ |
|
311 |
case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, stepX, stepY, begin, bandList); break; |
|
312 |
case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, stepX, stepY, begin, bandList); break; |
|
313 |
case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, stepX, stepY, begin, bandList); break; |
|
314 |
case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, stepX, stepY, begin, bandList); break; |
|
315 |
case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, stepX, stepY, begin, bandList); break; |
|
316 |
} |
|
317 |
|
|
318 |
/*int xPx = 0, yPx = 0; |
|
319 |
for (int iBand = 0; iBand < rasterBuf.getBandCount(); iBand++) { |
|
320 |
yPx = 0; |
|
321 |
for(double row = begin.getY(); yPx < bufHeight; row += stepY) { |
|
322 |
xPx = 0; |
|
323 |
for(double col = begin.getX(); xPx < bufWidth; col += stepX) { |
|
324 |
switch(buffer.getDataType()){ |
|
325 |
case Buffer.TYPE_BYTE: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemByte((int)row, (int)col, iBand)); break; |
|
326 |
case Buffer.TYPE_SHORT: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemShort((int)row, (int)col, iBand)); break; |
|
327 |
case Buffer.TYPE_INT: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemInt((int)row, (int)col, iBand)); break; |
|
328 |
case Buffer.TYPE_FLOAT: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemFloat((int)row, (int)col, iBand)); break; |
|
329 |
case Buffer.TYPE_DOUBLE: rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemDouble((int)row, (int)col, iBand)); break; |
|
330 |
} |
|
331 |
xPx ++; |
|
332 |
} |
|
333 |
yPx ++; |
|
334 |
} |
|
335 |
}*/ |
|
336 |
return rasterBuf; |
|
337 |
} |
|
338 |
|
|
339 |
/** |
|
340 |
* Escribe sobre el buffer pasado por par?metro los valores solicitados, desde el buffer de la clase. Los valores |
|
341 |
* se solicitan a trav?s de los par?metros. En ellos se especifica el tama?o del buffer de destino, las bandas a |
|
342 |
* escribir, el punto inicial en coordenadas pixel (double) y el incremento. |
|
343 |
* @param rasterBuf Buffer donde se escriben los datos |
|
344 |
* @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario |
|
345 |
* ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino. |
|
346 |
* @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario |
|
347 |
* ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino. |
|
348 |
* @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio |
|
349 |
* del pixel. Esto es util cuando se supersamplea. |
|
350 |
*/ |
|
351 |
private void writeByteBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) { |
|
352 |
int xPx = 0, yPx = 0; |
|
353 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
354 |
int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand); |
|
355 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
356 |
continue; |
|
357 |
for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) { |
|
358 |
yPx = 0; |
|
359 |
for(double row = begin.getY(); (yPx < rasterBuf.getHeight() && row < buffer.getHeight()); row += stepY) { |
|
360 |
xPx = 0; |
|
361 |
for(double col = begin.getX(); (xPx < rasterBuf.getWidth() && col < buffer.getWidth()); col += stepX) { |
|
362 |
rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemByte((int)row, (int)col, iBand)); |
|
363 |
xPx ++; |
|
364 |
} |
|
365 |
yPx ++; |
|
366 |
} |
|
367 |
} |
|
368 |
} |
|
369 |
} |
|
370 |
|
|
371 |
/** |
|
372 |
* Escribe sobre el buffer pasado por par?metro los valores solicitados, desde el buffer de la clase. Los valores |
|
373 |
* se solicitan a trav?s de los par?metros. En ellos se especifica el tama?o del buffer de destino, las bandas a |
|
374 |
* escribir, el punto inicial en coordenadas pixel (double) y el incremento. |
|
375 |
* @param rasterBuf Buffer donde se escriben los datos |
|
376 |
* @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario |
|
377 |
* ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino. |
|
378 |
* @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario |
|
379 |
* ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino. |
|
380 |
* @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio |
|
381 |
* del pixel. Esto es util cuando se supersamplea. |
|
382 |
*/ |
|
383 |
private void writeShortBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) { |
|
384 |
int xPx = 0, yPx = 0; |
|
385 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
386 |
int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand); |
|
387 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
388 |
continue; |
|
389 |
for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) { |
|
390 |
yPx = 0; |
|
391 |
for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) { |
|
392 |
xPx = 0; |
|
393 |
for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) { |
|
394 |
rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemShort((int)row, (int)col, iBand)); |
|
395 |
xPx ++; |
|
396 |
} |
|
397 |
yPx ++; |
|
398 |
} |
|
399 |
} |
|
400 |
} |
|
401 |
} |
|
402 |
|
|
403 |
/** |
|
404 |
* Escribe sobre el buffer pasado por par?metro los valores solicitados, desde el buffer de la clase. Los valores |
|
405 |
* se solicitan a trav?s de los par?metros. En ellos se especifica el tama?o del buffer de destino, las bandas a |
|
406 |
* escribir, el punto inicial en coordenadas pixel (double) y el incremento. |
|
407 |
* @param rasterBuf Buffer donde se escriben los datos |
|
408 |
* @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario |
|
409 |
* ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino. |
|
410 |
* @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario |
|
411 |
* ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino. |
|
412 |
* @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio |
|
413 |
* del pixel. Esto es util cuando se supersamplea. |
|
414 |
*/ |
|
415 |
private void writeIntBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) { |
|
416 |
int xPx = 0, yPx = 0; |
|
417 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
418 |
int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand); |
|
419 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
420 |
continue; |
|
421 |
for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) { |
|
422 |
yPx = 0; |
|
423 |
for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) { |
|
424 |
xPx = 0; |
|
425 |
for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) { |
|
426 |
rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemInt((int)row, (int)col, iBand)); |
|
427 |
xPx ++; |
|
428 |
} |
|
429 |
yPx ++; |
|
430 |
} |
|
431 |
} |
|
432 |
} |
|
433 |
} |
|
434 |
|
|
435 |
/** |
|
436 |
* Escribe sobre el buffer pasado por par?metro los valores solicitados, desde el buffer de la clase. Los valores |
|
437 |
* se solicitan a trav?s de los par?metros. En ellos se especifica el tama?o del buffer de destino, las bandas a |
|
438 |
* escribir, el punto inicial en coordenadas pixel (double) y el incremento. |
|
439 |
* @param rasterBuf Buffer donde se escriben los datos |
|
440 |
* @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario |
|
441 |
* ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino. |
|
442 |
* @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario |
|
443 |
* ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino. |
|
444 |
* @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio |
|
445 |
* del pixel. Esto es util cuando se supersamplea. |
|
446 |
*/ |
|
447 |
private void writeFloatBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) { |
|
448 |
int xPx = 0, yPx = 0; |
|
449 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
450 |
int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand); |
|
451 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
452 |
continue; |
|
453 |
for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) { |
|
454 |
yPx = 0; |
|
455 |
for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) { |
|
456 |
xPx = 0; |
|
457 |
for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) { |
|
458 |
rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemFloat((int)row, (int)col, iBand)); |
|
459 |
xPx ++; |
|
460 |
} |
|
461 |
yPx ++; |
|
462 |
} |
|
463 |
} |
|
464 |
} |
|
465 |
} |
|
466 |
|
|
467 |
/** |
|
468 |
* Escribe sobre el buffer pasado por par?metro los valores solicitados, desde el buffer de la clase. Los valores |
|
469 |
* se solicitan a trav?s de los par?metros. En ellos se especifica el tama?o del buffer de destino, las bandas a |
|
470 |
* escribir, el punto inicial en coordenadas pixel (double) y el incremento. |
|
471 |
* @param rasterBuf Buffer donde se escriben los datos |
|
472 |
* @param stepX Incremento en X. Cada vez que se escribe un pixel en X se incrementa el contador en stepX pixels. Esto es necesario |
|
473 |
* ya que el buffer destino no tiene porque tener el mismo ancho que el de origen. Este valor suele ser ancho_buffer_origen / ancho_buffer_destino. |
|
474 |
* @param stepY Incremento en Y. Cada vez que se escribe un pixel en Y se incrementa el contador en stepY pixels. Esto es necesario |
|
475 |
* ya que el buffer destino no tiene porque tener el mismo alto que el de origen. Este valor suele ser alto_buffer_origen / alto_buffer_destino. |
|
476 |
* @param begin pixel donde se comienza a leer en el buffer de origen. Este valor es decimal ya que no tiene porque empezar a leerse al principio |
|
477 |
* del pixel. Esto es util cuando se supersamplea. |
|
478 |
*/ |
|
479 |
private void writeDoubleBuffer(Buffer rasterBuf, double stepX, double stepY, Point2D begin, BandList bandList) { |
|
480 |
int xPx = 0, yPx = 0; |
|
481 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
482 |
int[] drawableBands = bandList.getBufferBandToDraw(new File(this.getURIOfFirstProvider()).getAbsolutePath(), iBand); |
|
483 |
if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
484 |
continue; |
|
485 |
for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) { |
|
486 |
yPx = 0; |
|
487 |
for(double row = begin.getY(); yPx < rasterBuf.getHeight(); row += stepY) { |
|
488 |
xPx = 0; |
|
489 |
for(double col = begin.getX(); xPx < rasterBuf.getWidth(); col += stepX) { |
|
490 |
rasterBuf.setElem(yPx, xPx, iBand, buffer.getElemDouble((int)row, (int)col, iBand)); |
|
491 |
xPx ++; |
|
492 |
} |
|
493 |
yPx ++; |
|
494 |
} |
|
495 |
} |
|
496 |
} |
|
497 |
} |
|
498 |
|
|
499 |
/* |
|
500 |
* (non-Javadoc) |
|
501 |
* @see org.gvsig.raster.dataset.RasterDataset#getWindowRaster(int, int, org.gvsig.raster.dataset.BandList, org.gvsig.raster.dataset.Buffer) |
|
502 |
*/ |
|
503 |
// public Buffer getWindow(int x, int y, BandList bandList, Buffer rasterBuf) { |
|
504 |
// int w = rasterBuf.getWidth(); |
|
505 |
// int h = rasterBuf.getHeight(); |
|
506 |
// setView( |
|
507 |
// new ExtentImpl( rasterUtil.getMapRectFromPxRect(getExtent().toRectangle2D(), |
|
508 |
// getWidth(), |
|
509 |
// getHeight(), |
|
510 |
// new Rectangle2D.Double(x, y, w, h))) |
|
511 |
// ); |
|
512 |
// |
|
513 |
// for(int iBand = 0; iBand < buffer.getBandCount(); iBand ++){ |
|
514 |
// int[] drawableBands = bandList.getBufferBandToDraw(this.getURIOfFirstProvider(), iBand); |
|
515 |
// if(drawableBands == null || (drawableBands.length == 1 && drawableBands[0] == -1)) |
|
516 |
// continue; |
|
517 |
// if(buffer.getDataType() == Buffer.TYPE_BYTE) { |
|
518 |
// for(int drawBands = 0; drawBands < drawableBands.length; drawBands++) { |
|
519 |
// for(int line = y; line < (y + h); line ++) |
|
520 |
// for(int col = x; col < (x + w); col ++) |
|
521 |
// rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemByte(line, col, drawableBands[drawBands])); |
|
522 |
// } |
|
523 |
// }else if(buffer.getDataType() == Buffer.TYPE_SHORT){ |
|
524 |
// for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){ |
|
525 |
// for(int line = y; line < (y + h); line ++) |
|
526 |
// for(int col = x; col < (x + w); col ++) |
|
527 |
// rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemShort(line, col, drawableBands[drawBands])); |
|
528 |
// } |
|
529 |
// }else if(buffer.getDataType() == Buffer.TYPE_INT){ |
|
530 |
// for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){ |
|
531 |
// for(int line = y; line < (y + h); line ++) |
|
532 |
// for(int col = x; col < (x + w); col ++) |
|
533 |
// rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemInt(line, col, drawableBands[drawBands])); |
|
534 |
// } |
|
535 |
// }else if(buffer.getDataType() == Buffer.TYPE_FLOAT){ |
|
536 |
// for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){ |
|
537 |
// for(int line = y; line < (y + h); line ++) |
|
538 |
// for(int col = x; col < (x + w); col ++) |
|
539 |
// rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemFloat(line, col, drawableBands[drawBands])); |
|
540 |
// } |
|
541 |
// }else if(buffer.getDataType() == Buffer.TYPE_DOUBLE){ |
|
542 |
// for(int drawBands = 0; drawBands < drawableBands.length; drawBands++){ |
|
543 |
// for(int line = y; line < (y + h); line ++) |
|
544 |
// for(int col = x; col < (x + w); col ++) |
|
545 |
// rasterBuf.setElem((line - y), (col - x), drawableBands[drawBands], buffer.getElemDouble(line, col, drawableBands[drawBands])); |
|
546 |
// } |
|
547 |
// } |
|
548 |
// } |
|
549 |
// return rasterBuf; |
|
550 |
// } |
|
551 |
|
|
552 |
public Buffer getWindow(int x, int y, int w, int h, |
|
553 |
BandList bandList, Buffer rasterBuf, TaskStatus status) { |
|
554 |
setView( |
|
555 |
new ExtentImpl( rasterUtil.getMapRectFromPxRect(getExtent().toRectangle2D(), |
|
556 |
getWidth(), |
|
557 |
getHeight(), |
|
558 |
new Rectangle2D.Double(x, y, w, h))) |
|
559 |
); |
|
560 |
|
|
561 |
//Relaci?n entre el n?mero de pixels del buffer origen (area seleccionada) y el destino |
|
562 |
double stepX = w / ((double)rasterBuf.getWidth()); |
|
563 |
double stepY = h / ((double)rasterBuf.getHeight()); |
|
564 |
switch(buffer.getDataType()){ |
|
565 |
case Buffer.TYPE_BYTE: writeByteBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break; |
|
566 |
case Buffer.TYPE_SHORT: writeShortBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break; |
|
567 |
case Buffer.TYPE_INT: writeIntBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break; |
|
568 |
case Buffer.TYPE_FLOAT: writeFloatBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break; |
|
569 |
case Buffer.TYPE_DOUBLE: writeDoubleBuffer(rasterBuf, stepX, stepY, new Point2D.Double(x, y), bandList); break; |
|
570 |
} |
|
571 |
return rasterBuf; |
|
572 |
} |
|
573 |
|
|
574 |
public Object readCompleteLine(int line, int band) throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
575 |
switch(buffer.getDataType()){ |
|
576 |
case Buffer.TYPE_BYTE: return buffer.getLineFromBandByte(line, band); |
|
577 |
case Buffer.TYPE_SHORT: return buffer.getLineFromBandShort(line, band); |
|
578 |
case Buffer.TYPE_INT: return buffer.getLineFromBandInt(line, band); |
|
579 |
case Buffer.TYPE_FLOAT: return buffer.getLineFromBandFloat(line, band); |
|
580 |
case Buffer.TYPE_DOUBLE: return buffer.getLineFromBandDouble(line, band); |
|
581 |
} |
|
582 |
return null; |
|
583 |
} |
|
584 |
|
|
585 |
public Object readBlock(int pos, int blockHeight, double scale) throws InvalidSetViewException, FileNotOpenException, RasterDriverException { |
|
586 |
if(pos < 0) |
|
587 |
throw new InvalidSetViewException("Request out of grid"); |
|
588 |
|
|
589 |
if((pos + blockHeight) > buffer.getHeight()) |
|
590 |
blockHeight = Math.abs(buffer.getHeight() - pos); |
|
591 |
|
|
592 |
switch(buffer.getDataType()){ |
|
593 |
case Buffer.TYPE_BYTE: |
|
594 |
byte[][][] bufb = new byte[getBandCount()][][]; |
|
595 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
596 |
for (int row = 0; row < blockHeight; row++) { |
|
597 |
bufb[iBand][row] = buffer.getLineFromBandByte(row, iBand); |
|
598 |
} |
|
599 |
} |
|
600 |
return bufb; |
|
601 |
case Buffer.TYPE_SHORT: |
|
602 |
short[][][] bufs = new short[getBandCount()][][]; |
|
603 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
604 |
for (int row = 0; row < blockHeight; row++) { |
|
605 |
bufs[iBand][row] = buffer.getLineFromBandShort(row, iBand); |
|
606 |
} |
|
607 |
} |
|
608 |
return bufs; |
|
609 |
case Buffer.TYPE_INT: |
|
610 |
int[][][] bufi = new int[getBandCount()][][]; |
|
611 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
612 |
for (int row = 0; row < blockHeight; row++) { |
|
613 |
bufi[iBand][row] = buffer.getLineFromBandInt(row, iBand); |
|
614 |
} |
|
615 |
} |
|
616 |
return bufi; |
|
617 |
case Buffer.TYPE_FLOAT: |
|
618 |
float[][][] buff = new float[getBandCount()][][]; |
|
619 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
620 |
for (int row = 0; row < blockHeight; row++) { |
|
621 |
buff[iBand][row] = buffer.getLineFromBandFloat(row, iBand); |
|
622 |
} |
|
623 |
} |
|
624 |
return buff; |
|
625 |
case Buffer.TYPE_DOUBLE: |
|
626 |
double[][][] bufd = new double[getBandCount()][][]; |
|
627 |
for (int iBand = 0; iBand < buffer.getBandCount(); iBand++) { |
|
628 |
for (int row = 0; row < blockHeight; row++) { |
|
629 |
bufd[iBand][row] = buffer.getLineFromBandDouble(row, iBand); |
|
630 |
} |
|
631 |
} |
|
632 |
return bufd; |
|
633 |
} |
|
634 |
return null; |
|
635 |
} |
|
636 |
|
|
637 |
/** |
|
638 |
* Obtiene el objeto que contiene el estado de la transparencia |
|
639 |
*/ |
|
640 |
public Transparency getTransparency() { |
|
641 |
if(transparency == null) |
|
642 |
transparency = new DataStoreTransparency(getColorInterpretation()); |
|
643 |
return transparency; |
|
644 |
} |
|
645 |
|
|
646 |
public int getOverviewCount(int band) throws BandAccessException, RasterDriverException { |
|
647 |
if(band >= getBandCount()) |
|
648 |
throw new BandAccessException("Wrong band"); |
|
649 |
return 0; |
|
650 |
} |
|
651 |
|
|
652 |
public int getOverviewWidth(int band, int overview) throws BandAccessException, RasterDriverException { |
|
653 |
if (band >= getBandCount()) |
|
654 |
throw new BandAccessException("Wrong band"); |
|
655 |
return 0; |
|
656 |
} |
|
657 |
|
|
658 |
public int getOverviewHeight(int band, int overview) throws BandAccessException, RasterDriverException { |
|
659 |
if (band >= getBandCount()) |
|
660 |
throw new BandAccessException("Wrong band"); |
|
661 |
return 0; |
|
662 |
} |
|
663 |
|
|
664 |
public boolean isOverviewsSupported() { |
|
665 |
return false; |
|
666 |
} |
|
667 |
|
|
668 |
public String getProviderName() { |
|
669 |
return NAME; |
|
670 |
} |
|
671 |
|
|
672 |
public String getName() { |
|
673 |
return "buffer"+this.hashCode(); |
|
674 |
} |
|
675 |
|
|
676 |
public String getFullName() { |
|
677 |
return this.getName(); |
|
678 |
} |
|
679 |
|
|
680 |
public void setStatus(RasterProvider provider) { |
|
681 |
if(provider instanceof MemoryRasterProvider) { |
|
682 |
//Not implemented yet |
|
683 |
} |
|
684 |
} |
|
685 |
|
|
686 |
public TileServer getTileServer() { |
|
687 |
return null; |
|
688 |
} |
|
689 |
|
|
690 |
public void addFile(File file) throws InvalidSourceException { |
|
691 |
// Do nothing |
|
692 |
} |
|
693 |
|
|
694 |
public void removeFile(File file) { |
|
695 |
// Do nothing |
|
696 |
} |
|
697 |
|
|
698 |
} |
|
0 | 699 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/memory/io/MemoryDataParameters.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.memory.io; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
31 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
32 |
import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters; |
|
33 |
|
|
34 |
/** |
|
35 |
* Parameters for the memory provider |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
38 |
public class MemoryDataParameters extends AbstractRasterFileDataParameters { |
|
39 |
private final String id = "memory"; |
|
40 |
private Buffer buffer = null; |
|
41 |
private Extent extent = null; |
|
42 |
|
|
43 |
/** |
|
44 |
* Constructor vacio |
|
45 |
*/ |
|
46 |
public MemoryDataParameters() { |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* Contructor |
|
51 |
* @param buf buffer del driver |
|
52 |
* @param ext extensi?n del buffer |
|
53 |
*/ |
|
54 |
public MemoryDataParameters(Buffer buf, Extent ext) { |
|
55 |
this.buffer = buf; |
|
56 |
this.extent = ext; |
|
57 |
} |
|
58 |
|
|
59 |
/** |
|
60 |
* Obtiene el buffer de datos |
|
61 |
* @return Buffer |
|
62 |
*/ |
|
63 |
public Buffer getBuffer() { |
|
64 |
return buffer; |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* Asigna el buffer de datos |
|
69 |
* @param buffer Buffer |
|
70 |
*/ |
|
71 |
public void setBuffer(Buffer buffer) { |
|
72 |
this.buffer = buffer; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Obtiene la extensi?n del buffer de datos |
|
77 |
* @return Extent |
|
78 |
*/ |
|
79 |
public Extent getExtent() { |
|
80 |
return extent; |
|
81 |
} |
|
82 |
|
|
83 |
/**O |
|
84 |
* Asigna la extensi?n del buffer de datos |
|
85 |
* @param extent |
|
86 |
*/ |
|
87 |
public void setExtent(Extent extent) { |
|
88 |
this.extent = extent; |
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* Obtiene el identificador del driver |
|
93 |
* @return String |
|
94 |
*/ |
|
95 |
public String getFormatID() { |
|
96 |
return id; |
|
97 |
} |
|
98 |
|
|
99 |
/* |
|
100 |
* (non-Javadoc) |
|
101 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDataStoreName() |
|
102 |
*/ |
|
103 |
public String getDataStoreName() { |
|
104 |
return MemoryRasterProvider.NAME; |
|
105 |
} |
|
106 |
|
|
107 |
/* |
|
108 |
* (non-Javadoc) |
|
109 |
* @see org.gvsig.fmap.dal.DataStoreParameters#getDescription() |
|
110 |
*/ |
|
111 |
public String getDescription() { |
|
112 |
return MemoryRasterProvider.DESCRIPTION; |
|
113 |
} |
|
114 |
} |
|
0 | 115 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/overview/GdalOverviewBuilder.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.gdal.overview; |
|
23 |
|
|
24 |
import org.gvsig.addo.BuildingOverviewsException; |
|
25 |
import org.gvsig.addo.IOverviewIncrement; |
|
26 |
import org.gvsig.addo.Jaddo; |
|
27 |
import org.gvsig.addo.WritingException; |
|
28 |
import org.gvsig.fmap.dal.coverage.exception.OverviewException; |
|
29 |
import org.gvsig.fmap.dal.coverage.process.BaseIncrementableTask; |
|
30 |
import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder; |
|
31 |
|
|
32 |
/** |
|
33 |
* Servicios ofrecidos por el proceso de construcci?n de overviews. Esta |
|
34 |
* implementaci?n usa gdal para construir las overviews. |
|
35 |
* |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
38 |
public class GdalOverviewBuilder implements OverviewBuilder { |
|
39 |
private Jaddo build = new Jaddo(); |
|
40 |
private int value = 0; |
|
41 |
|
|
42 |
/** |
|
43 |
* Bindings between an IOverviewIncrement and a BaseIncrementableTask |
|
44 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
45 |
*/ |
|
46 |
class ProcessBinding implements IOverviewIncrement { |
|
47 |
private BaseIncrementableTask task = null; |
|
48 |
|
|
49 |
public ProcessBinding(BaseIncrementableTask task) { |
|
50 |
this.task = task; |
|
51 |
} |
|
52 |
|
|
53 |
public int getPercent() { |
|
54 |
return task.getPercent(); |
|
55 |
} |
|
56 |
|
|
57 |
public void setPercent(int value) { |
|
58 |
task.setPercent(value); |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
/* |
|
63 |
* (non-Javadoc) |
|
64 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#buildOverviews(int, java.lang.String, int[]) |
|
65 |
*/ |
|
66 |
public void buildOverviews(int resamplingAlg, String file, int[] overviews) |
|
67 |
throws OverviewException { |
|
68 |
try { |
|
69 |
build.buildOverviews(resamplingAlg, file, overviews); |
|
70 |
} catch (BuildingOverviewsException e) { |
|
71 |
throw new OverviewException("Error building overviews", e); |
|
72 |
} catch (WritingException e) { |
|
73 |
throw new OverviewException("Error writing overviews", e); |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
/* |
|
78 |
* (non-Javadoc) |
|
79 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#getPercent() |
|
80 |
*/ |
|
81 |
public int getPercent() { |
|
82 |
return value; |
|
83 |
} |
|
84 |
|
|
85 |
/* |
|
86 |
* (non-Javadoc) |
|
87 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#setIncrementListener(org.gvsig.addo.IOverviewIncrement) |
|
88 |
*/ |
|
89 |
public void setIncrementListener(BaseIncrementableTask incr) { |
|
90 |
build.setIncrementListener(new ProcessBinding(incr)); |
|
91 |
} |
|
92 |
|
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
95 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#setPercent(int) |
|
96 |
*/ |
|
97 |
public void setPercent(int value) { |
|
98 |
this.value = value; |
|
99 |
} |
|
100 |
} |
|
0 | 101 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PAuxFeatures.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.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
25 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
26 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
27 |
/** |
|
28 |
* Caracteristicas del formato PAux para escritura. |
|
29 |
* Soporta tipo de datos enteros de 8 y 16 bits y reales de 32 bits. |
|
30 |
* La georreferenciaci?n y la proyecci?n son ignoradas. |
|
31 |
* |
|
32 |
* @version 04/06/2007 |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class PAuxFeatures extends WriteFileFormatFeatures { |
|
36 |
|
|
37 |
public PAuxFeatures() { |
|
38 |
super(GdalProvider.FORMAT_PAUX, "aux", new int[] { 3 }, null, GdalWriter.class); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Carga los par?metros de este driver. |
|
43 |
*/ |
|
44 |
public void loadParams() { |
|
45 |
super.loadParams(); |
|
46 |
} |
|
47 |
} |
|
0 | 48 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PgmFeatures.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.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato PNM para escritura. |
|
30 |
* Esta clase soporta solo ficheros pgm. Estos son solo los PNM en |
|
31 |
* escala de grises |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class PNM_PgmFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public PNM_PgmFeatures() { |
|
39 |
super(GdalProvider.FORMAT_PNM, "pgm", new int[] { 1 }, null, GdalWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
|
|
48 |
driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null); |
|
49 |
} |
|
50 |
} |
|
0 | 51 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/BMPFeatures.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.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato BMP para escritura. |
|
30 |
* Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. |
|
31 |
* La georreferenciaci?n puede hacerse mediante un fichero .wld. |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class BMPFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public BMPFeatures() { |
|
39 |
super(GdalProvider.FORMAT_BMP, "bmp", new int[] { 3 }, null, GdalWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null); |
|
48 |
} |
|
49 |
} |
|
0 | 50 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/HFAFeatures.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.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato HFA (.img) de Erdas para escritura. |
|
30 |
* Soporta enteros de 8, 16 y 32 bits y datos en coma flotante de 32 y 64 bits |
|
31 |
* con cualquier n?mero de bandas. |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
//TODO: Mirar si se pueden generar con piramides |
|
37 |
public class HFAFeatures extends WriteFileFormatFeatures { |
|
38 |
|
|
39 |
public HFAFeatures() { |
|
40 |
super(GdalProvider.FORMAT_HFA, "img", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Carga los par?metros de este driver. |
|
45 |
*/ |
|
46 |
public void loadParams() { |
|
47 |
super.loadParams(); |
|
48 |
|
|
49 |
driverParams.setParam("rrd", |
|
50 |
new Integer(1), |
|
51 |
Params.CHOICE, |
|
52 |
new String[]{ "YES", "NO"}); |
|
53 |
|
|
54 |
driverParams.setParam("compress", |
|
55 |
new Integer(1), |
|
56 |
Params.CHOICE, |
|
57 |
new String[]{"YES", "NO"}); |
|
58 |
} |
|
59 |
} |
|
0 | 60 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.98/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/GTiffFeatures.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.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
|
|
29 |
/** |
|
30 |
* Caracteristicas del formato GeoTiff para escritura. |
|
31 |
* |
|
32 |
* @version 04/06/2007 |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class GTiffFeatures extends WriteFileFormatFeatures { |
|
36 |
|
|
37 |
public GTiffFeatures() { |
|
38 |
super(GdalProvider.FORMAT_GTiff, "tif", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Carga los par?metros de este driver. |
|
43 |
*/ |
|
44 |
public void loadParams() { |
|
45 |
super.loadParams(); |
|
46 |
driverParams.setParam( |
|
47 |
"photometric", |
Also available in: Unified diff