Revision 9448
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.cache.tile.TileCacheLibrary |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/BufferCacheManager.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.cache.buffer; |
|
23 |
|
|
24 |
import java.io.IOException; |
|
25 |
|
|
26 |
import org.gvsig.raster.cache.buffer.histogram.BufferHistogram; |
|
27 |
import org.gvsig.raster.cache.buffer.task.TaskEventManager; |
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
/** |
|
34 |
* This class is responsible of the management of the library's business logic. |
|
35 |
* It is the library's main entry point, and provides all the services to manage |
|
36 |
* {@link BufferCacheService}s. |
|
37 |
* |
|
38 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
39 |
* @version $Id$ |
|
40 |
*/ |
|
41 |
public interface BufferCacheManager { |
|
42 |
public static int DONT_FORCE = 0; |
|
43 |
public static int MEMORY_BUFFER = 1; |
|
44 |
public static int BAND_CACHE = 2; |
|
45 |
public static int BAND_VERT_CACHE = 3; |
|
46 |
public static int READ_ONLY_CACHE = 4; |
|
47 |
|
|
48 |
/** |
|
49 |
* Valor noData por defecto para la librer?a. En caso de no tener un valor asociado |
|
50 |
* al raster se usar? este. |
|
51 |
*/ |
|
52 |
public static double defaultNoDataValue = -99999; |
|
53 |
public static boolean noDataValueEnable = false; |
|
54 |
|
|
55 |
//***************************************************** |
|
56 |
//BUFFER API |
|
57 |
//***************************************************** |
|
58 |
|
|
59 |
/** |
|
60 |
* Genera instancias del buffer de datos adecuado al tama?o del raster. Si no hay muchos datos |
|
61 |
* (menos de cacheMemorySize) crear? un buffer en memoria. Si hay m?s de esta cantidad |
|
62 |
* entonces crearemos un buffer cacheado (RasterCache). A partir de la cantidad se?alada |
|
63 |
* por multicacheMemorySize haremos un buffer cacheado donde cada p?gina no ocupa todo |
|
64 |
* el ancho del raster ya que este ser? muy grande. La gesti?n de una cache donde cada |
|
65 |
* pagina ha de partir una l?nea lleva una complejidad a?adida. |
|
66 |
* |
|
67 |
* @param params Par?metros de la carga |
|
68 |
* @return Objeto RasterBuffer |
|
69 |
*/ |
|
70 |
public Buffer createBuffer(BufferParam params); |
|
71 |
|
|
72 |
/** |
|
73 |
* Genera una instancia del buffer de solo lectura. Este buffer consta de una cache y unos apuntadores |
|
74 |
* a las p?ginas en disco. Cuando se accede a los datos se carga en memoria la p?gina pedida. |
|
75 |
* |
|
76 |
* @param file |
|
77 |
* File to read data |
|
78 |
*/ |
|
79 |
public Buffer createReadOnlyBuffer(String file); |
|
80 |
|
|
81 |
/** |
|
82 |
* Creates an instance of a memory buffer |
|
83 |
* |
|
84 |
* @param dataType Tipo de dato |
|
85 |
* @param width Ancho |
|
86 |
* @param height Alto |
|
87 |
* @param bandNr Banda |
|
88 |
* @param flag En caso de buffers de memoria este flag a true significa que se reserva la memoria |
|
89 |
* para el buffer de forma normal y si est? a false no se reserva por lo que la reserva deber? ser |
|
90 |
* posterior. |
|
91 |
*/ |
|
92 |
public Buffer createMemoryBuffer(int dataType, int width, int height, int bandNr, boolean malloc); |
|
93 |
|
|
94 |
/** |
|
95 |
* Creates an instance of a memory buffer |
|
96 |
* |
|
97 |
* @param params |
|
98 |
* Parameters to instantiate this buffer |
|
99 |
*/ |
|
100 |
public Buffer createMemoryBuffer(BufferParam params); |
|
101 |
|
|
102 |
/** |
|
103 |
* Creates a new instance of an interpolation object. |
|
104 |
* @param buf IRasterBuffer |
|
105 |
* @return IBufferInterpolation |
|
106 |
*/ |
|
107 |
public BufferInterpolation createInterpolation(Buffer buf); |
|
108 |
|
|
109 |
/** |
|
110 |
* Builds a new parameter object |
|
111 |
* @param x |
|
112 |
* Upper left X position |
|
113 |
* @param y |
|
114 |
* Upper left X position |
|
115 |
* @param w |
|
116 |
* Width |
|
117 |
* @param h |
|
118 |
* Height |
|
119 |
*/ |
|
120 |
public BufferParam createBufferParams(int w, int h); |
|
121 |
|
|
122 |
/** |
|
123 |
* Creates a parameter object for building a buffer. The buffer type is read-write. |
|
124 |
* This type could be changed after the creation of a {@link BufferParam} object. |
|
125 |
* @param w |
|
126 |
* Width |
|
127 |
* @param h |
|
128 |
* Height |
|
129 |
* @param bandCount |
|
130 |
* Number of bands |
|
131 |
* @param dataType |
|
132 |
* Type of data |
|
133 |
*/ |
|
134 |
public BufferParam createBufferParams(int w, int h, int bandCount, int dataType); |
|
135 |
|
|
136 |
/** |
|
137 |
* Creates a parameter object for building a buffer. For this call the buffer type |
|
138 |
* is read-only and the source will be a multifile. |
|
139 |
* @param files |
|
140 |
* File list in disk |
|
141 |
* @param x |
|
142 |
* initial pixel |
|
143 |
* @param y |
|
144 |
* initial pixel |
|
145 |
* @param w |
|
146 |
* Width in pixels |
|
147 |
* @param h |
|
148 |
* Height in pixels |
|
149 |
* @param bands |
|
150 |
* bands to render |
|
151 |
* @return {@link BufferParam} |
|
152 |
* @throws IOException |
|
153 |
*/ |
|
154 |
public BufferParam createBufferParams(String[] files, int x, int y, int w, int h, int[] bands) throws IOException; |
|
155 |
|
|
156 |
/** |
|
157 |
* Creates a parameter object for building a buffer. For this call the buffer type |
|
158 |
* is read-only. |
|
159 |
* @param file |
|
160 |
* File in disk |
|
161 |
* @param x |
|
162 |
* initial pixel |
|
163 |
* @param y |
|
164 |
* initial pixel |
|
165 |
* @param w |
|
166 |
* Width in pixels |
|
167 |
* @param h |
|
168 |
* Height in pixels |
|
169 |
* @param bands |
|
170 |
* bands to render |
|
171 |
* @return {@link BufferParam} |
|
172 |
* @throws IOException |
|
173 |
*/ |
|
174 |
public BufferParam createBufferParams(String file, int x, int y, int w, int h, int[] bands) throws IOException; |
|
175 |
|
|
176 |
/** |
|
177 |
* Creates a parameter object for building a buffer. For this call the buffer type |
|
178 |
* is read-only. |
|
179 |
* @param file |
|
180 |
* File in disk |
|
181 |
* @param x |
|
182 |
* initial pixel |
|
183 |
* @param y |
|
184 |
* initial pixel |
|
185 |
* @param w |
|
186 |
* Width in pixels |
|
187 |
* @param h |
|
188 |
* Height in pixels |
|
189 |
* @param bands |
|
190 |
* bands to render |
|
191 |
* @return {@link BufferParam} |
|
192 |
* @throws IOException |
|
193 |
*/ |
|
194 |
public BufferParam createBufferParams(String file, int x, int y, int w, int h) throws IOException; |
|
195 |
|
|
196 |
//***************************************************** |
|
197 |
//NODATA API |
|
198 |
//***************************************************** |
|
199 |
|
|
200 |
/** |
|
201 |
* Builds a new NoData object |
|
202 |
* @param noData |
|
203 |
* value to assign to all bands |
|
204 |
* @param nativeNoData |
|
205 |
* The native is the original value |
|
206 |
* saved in the head of the file or its metadata. |
|
207 |
* @param fileName |
|
208 |
* Name of file owner of this nodata value. This string is useful to |
|
209 |
* save the rmf file |
|
210 |
* @param bandCount |
|
211 |
* Number of bands of the file |
|
212 |
* @return NoData |
|
213 |
*/ |
|
214 |
public BufferNoData createNoData(Number noData, Number nativeNoData, String fileName, int bandCount); |
|
215 |
|
|
216 |
/** |
|
217 |
* Builds a new NoData for DEMs |
|
218 |
* @param noData |
|
219 |
* value to assign to all bands |
|
220 |
* @param nativeNoData |
|
221 |
* The native is the original value |
|
222 |
* saved in the head of the file or its metadata. |
|
223 |
* @param fileName |
|
224 |
* Name of file owner of this nodata value. This string is useful to |
|
225 |
* save the rmf file |
|
226 |
* @return NoData |
|
227 |
*/ |
|
228 |
public BufferNoData createNoData(Number noData, Number nativeNoData, String fileName); |
|
229 |
|
|
230 |
/** |
|
231 |
* Builds a new NoData for DEMs |
|
232 |
* @param dataType |
|
233 |
* dataType of this NoData |
|
234 |
* @param bandCount |
|
235 |
* Number of bands |
|
236 |
* @return NoData |
|
237 |
*/ |
|
238 |
public BufferNoData createDefaultNoData(int bandCount, int dataType); |
|
239 |
|
|
240 |
//***************************************************** |
|
241 |
//HISTOGRAM API |
|
242 |
//***************************************************** |
|
243 |
|
|
244 |
/** |
|
245 |
* Creates a empty histogram |
|
246 |
* @param nBands |
|
247 |
* @param min |
|
248 |
* @param max |
|
249 |
* @param dataType |
|
250 |
* @param numberOfClasses |
|
251 |
* @return |
|
252 |
*/ |
|
253 |
public BufferHistogram createHistogram(int nBands, double[] min, double[] max, int dataType, int numberOfClasses); |
|
254 |
|
|
255 |
/** |
|
256 |
* Creates a empty histogram |
|
257 |
* @param nBands |
|
258 |
* @param min |
|
259 |
* @param max |
|
260 |
* @param dataType |
|
261 |
* @param numberOfClasses |
|
262 |
* @return |
|
263 |
*/ |
|
264 |
public BufferHistogram createHistogram(int nBands, int nClasses, double[] min, double[] max); |
|
265 |
|
|
266 |
//***************************************************** |
|
267 |
//TASK API |
|
268 |
//***************************************************** |
|
269 |
|
|
270 |
/** |
|
271 |
* Gets a register task. To get a task it will use the current thread ID |
|
272 |
* @return TaskEventManager |
|
273 |
*/ |
|
274 |
public TaskEventManager getTask(); |
|
275 |
|
|
276 |
/** |
|
277 |
* Registers the object as a task using the current thread ID. It returns |
|
278 |
* a TaskEventManager |
|
279 |
* @param process |
|
280 |
* @return |
|
281 |
*/ |
|
282 |
public TaskEventManager createTask(Object process); |
|
283 |
} |
|
0 | 284 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/BufferStats.java | ||
---|---|---|
1 |
package org.gvsig.raster.cache.buffer; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
|
|
5 |
import org.gvsig.raster.cache.buffer.exception.ProcessInterruptedException; |
|
6 |
|
|
7 |
/** |
|
8 |
* This class is used to calculate basic statistics in a buffer. |
|
9 |
* |
|
10 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
11 |
*/ |
|
12 |
public interface BufferStats { |
|
13 |
/** |
|
14 |
* Calculate statistics |
|
15 |
*/ |
|
16 |
public void calculate(); |
|
17 |
|
|
18 |
public double[] getLimits() throws ProcessInterruptedException; |
|
19 |
|
|
20 |
public double[][] getAllBandsLimits() throws ProcessInterruptedException; |
|
21 |
|
|
22 |
/** |
|
23 |
* Gets the band list. Each band contains the statistics using |
|
24 |
* {@link StatsValues} |
|
25 |
* @return |
|
26 |
*/ |
|
27 |
public ArrayList<Band> getBandList(); |
|
28 |
} |
|
0 | 29 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/BufferParam.java | ||
---|---|---|
1 |
package org.gvsig.raster.cache.buffer; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
|
|
5 |
import org.gvsig.raster.cache.buffer.BufferDataSource; |
|
6 |
|
|
7 |
/** |
|
8 |
* Buffer parameters. This class contains generic parameters. |
|
9 |
* Basic information to fill: x, y, w, h, datatype and bandcount. If |
|
10 |
* the buffer is RasterReadOnlyBuffer is necessary a IBufferDataSource too. |
|
11 |
* 02/11/2008 |
|
12 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
13 |
*/ |
|
14 |
public interface BufferParam { |
|
15 |
/** |
|
16 |
* Get a interest area |
|
17 |
* @return Rectangle2D |
|
18 |
*/ |
|
19 |
public Rectangle2D getAreaOfInterest(); |
|
20 |
|
|
21 |
/** |
|
22 |
* Set a interest area |
|
23 |
* @param selection |
|
24 |
*/ |
|
25 |
public void setAreaOfInterest(Rectangle2D selection); |
|
26 |
|
|
27 |
/** |
|
28 |
* Get the file reference |
|
29 |
* @return |
|
30 |
*/ |
|
31 |
public String getReference(); |
|
32 |
|
|
33 |
/** |
|
34 |
* Set the file reference |
|
35 |
* @param ref |
|
36 |
*/ |
|
37 |
public void setReference(String ref); |
|
38 |
|
|
39 |
/** |
|
40 |
* Set the data source |
|
41 |
* @param dataSource |
|
42 |
*/ |
|
43 |
public void setDataSource(BufferDataSource dataSource); |
|
44 |
|
|
45 |
/** |
|
46 |
* Get the data source |
|
47 |
* @return |
|
48 |
*/ |
|
49 |
public BufferDataSource getDataSource(); |
|
50 |
|
|
51 |
/** |
|
52 |
* Returns the width in pixels |
|
53 |
* @return Width in pixels of this raster |
|
54 |
*/ |
|
55 |
public int getWidth(); |
|
56 |
|
|
57 |
/** |
|
58 |
* Sets the width in pixels |
|
59 |
* @param width |
|
60 |
* Width in pixels of this raster |
|
61 |
*/ |
|
62 |
public void setWidth(int width); |
|
63 |
|
|
64 |
/** |
|
65 |
* Returns the height in pixels |
|
66 |
* @return Height in pixels of this raster |
|
67 |
*/ |
|
68 |
public int getHeight(); |
|
69 |
|
|
70 |
/** |
|
71 |
* Sets the height in pixels |
|
72 |
* @param height |
|
73 |
* Height in pixels of this raster |
|
74 |
*/ |
|
75 |
public void setHeight(int height); |
|
76 |
|
|
77 |
/** |
|
78 |
* Returns the X upper left coordinate |
|
79 |
* @return X upper left coordinate in pixels |
|
80 |
*/ |
|
81 |
public int getX(); |
|
82 |
|
|
83 |
/** |
|
84 |
* Sets the X upper left coordinate |
|
85 |
* @params x |
|
86 |
* X upper left coordinate in pixels |
|
87 |
*/ |
|
88 |
public void setX(int x); |
|
89 |
|
|
90 |
/** |
|
91 |
* Returns the Y upper left coordinate |
|
92 |
* @return Y upper left coordinate in pixels |
|
93 |
*/ |
|
94 |
public int getY(); |
|
95 |
|
|
96 |
/** |
|
97 |
* Sets the Y upper left coordinate |
|
98 |
* @params y |
|
99 |
* Y upper left coordinate in pixels |
|
100 |
*/ |
|
101 |
public void setY(int y); |
|
102 |
|
|
103 |
/** |
|
104 |
* Gets the data type |
|
105 |
* @return |
|
106 |
*/ |
|
107 |
public int getDataType(); |
|
108 |
|
|
109 |
/** |
|
110 |
* Sets the data type |
|
111 |
* @param dataType |
|
112 |
*/ |
|
113 |
public void setDataType(int dataType); |
|
114 |
|
|
115 |
/** |
|
116 |
* Gets number of bands |
|
117 |
* @return |
|
118 |
*/ |
|
119 |
public int getBandCount(); |
|
120 |
|
|
121 |
/** |
|
122 |
* Sets number of bands |
|
123 |
* @param bandCount |
|
124 |
*/ |
|
125 |
public void setBandCount(int bandCount); |
|
126 |
|
|
127 |
/** |
|
128 |
* Adds one to the band counter |
|
129 |
*/ |
|
130 |
public void bandPlusPlus(); |
|
131 |
|
|
132 |
/** |
|
133 |
* Substracts one to the band counter |
|
134 |
*/ |
|
135 |
public void bandLessLess(); |
|
136 |
|
|
137 |
/** |
|
138 |
* Gets no data value |
|
139 |
* @return double |
|
140 |
*/ |
|
141 |
public double getNoDataValue(); |
|
142 |
|
|
143 |
/** |
|
144 |
* Sets no data value |
|
145 |
* @return double |
|
146 |
*/ |
|
147 |
public void setNoDataValue(double noDataValue); |
|
148 |
|
|
149 |
/** |
|
150 |
* Gets the size of the data type in bytes |
|
151 |
* @return Size of the data type that is used |
|
152 |
*/ |
|
153 |
public int getDataSize(); |
|
154 |
|
|
155 |
/** |
|
156 |
* Gets the buffer size |
|
157 |
* @return buffer size |
|
158 |
*/ |
|
159 |
public long sizeof(); |
|
160 |
|
|
161 |
/** |
|
162 |
* Sets the type of access defined as constant in Buffer interface |
|
163 |
*/ |
|
164 |
public void setAccessType(int accessType); |
|
165 |
|
|
166 |
/** |
|
167 |
* Gets the type of access defined as constant in Buffer interface |
|
168 |
*/ |
|
169 |
public int getAccessType(); |
|
170 |
|
|
171 |
/** |
|
172 |
* Sets the band list |
|
173 |
* @param file |
|
174 |
*/ |
|
175 |
public void setBandList(int[] bands); |
|
176 |
|
|
177 |
/** |
|
178 |
* Gets the band list |
|
179 |
* @return |
|
180 |
*/ |
|
181 |
public int[] getBandList(); |
|
182 |
} |
|
0 | 183 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/RasterBase.java | ||
---|---|---|
1 |
package org.gvsig.raster.cache.buffer; |
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
/** |
|
6 |
* Base class for raster elements. This class contains methos for |
|
7 |
* reading width, height, number of bands and other raster parameters |
|
8 |
* |
|
9 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
10 |
*/ |
|
11 |
public abstract class RasterBase { |
|
12 |
private static final long serialVersionUID = 1L; |
|
13 |
private int dataType = Buffer.TYPE_UNDEFINED; |
|
14 |
private int bandCount = 0; |
|
15 |
private int width = 0; |
|
16 |
private int height = 0; |
|
17 |
private int x = 0; |
|
18 |
private int y = 0; |
|
19 |
public double noDataValue = -99999.0; |
|
20 |
|
|
21 |
/** |
|
22 |
* Sets size and position values |
|
23 |
* @param x |
|
24 |
* Upper left X position |
|
25 |
* @param y |
|
26 |
* Upper left X position |
|
27 |
* @param w |
|
28 |
* Width |
|
29 |
* @param h |
|
30 |
* Height |
|
31 |
*/ |
|
32 |
public RasterBase(int x, int y, int w, int h) { |
|
33 |
this.x = x; |
|
34 |
this.y = y; |
|
35 |
this.width = w; |
|
36 |
this.height = h; |
|
37 |
} |
|
38 |
|
|
39 |
/** |
|
40 |
* Sets size and position values |
|
41 |
* @param x |
|
42 |
* Upper left X position |
|
43 |
* @param y |
|
44 |
* Upper left X position |
|
45 |
* @param w |
|
46 |
* Width |
|
47 |
* @param h |
|
48 |
* Height |
|
49 |
* @param datatype |
|
50 |
* Data type of this raster |
|
51 |
* @param nBands |
|
52 |
* Number of bands of this raster |
|
53 |
*/ |
|
54 |
public RasterBase(int x, int y, int w, int h, int dataType, int nBands) { |
|
55 |
this.x = x; |
|
56 |
this.y = y; |
|
57 |
this.width = w; |
|
58 |
this.height = h; |
|
59 |
this.dataType = dataType; |
|
60 |
this.bandCount = nBands; |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* Returns the width in pixels |
|
65 |
* @return Width in pixels of this raster |
|
66 |
*/ |
|
67 |
public int getWidth() { |
|
68 |
return width; |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* Sets the width in pixels |
|
73 |
* @param width |
|
74 |
* Width in pixels of this raster |
|
75 |
*/ |
|
76 |
public void setWidth(int width) { |
|
77 |
this.width = width; |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Returns the height in pixels |
|
82 |
* @return Height in pixels of this raster |
|
83 |
*/ |
|
84 |
public int getHeight() { |
|
85 |
return height; |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Sets the height in pixels |
|
90 |
* @param height |
|
91 |
* Height in pixels of this raster |
|
92 |
*/ |
|
93 |
public void setHeight(int height) { |
|
94 |
this.height = height; |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* Returns the X upper left coordinate |
|
99 |
* @return X upper left coordinate in pixels |
|
100 |
*/ |
|
101 |
public int getX() { |
|
102 |
return x; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Sets the X upper left coordinate |
|
107 |
* @params x |
|
108 |
* X upper left coordinate in pixels |
|
109 |
*/ |
|
110 |
public void setX(int x) { |
|
111 |
this.x = x; |
|
112 |
} |
|
113 |
|
|
114 |
/** |
|
115 |
* Returns the Y upper left coordinate |
|
116 |
* @return Y upper left coordinate in pixels |
|
117 |
*/ |
|
118 |
public int getY() { |
|
119 |
return y; |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* Sets the Y upper left coordinate |
|
124 |
* @params y |
|
125 |
* Y upper left coordinate in pixels |
|
126 |
*/ |
|
127 |
public void setY(int y) { |
|
128 |
this.y = y; |
|
129 |
} |
|
130 |
|
|
131 |
/** |
|
132 |
* Gets the data type |
|
133 |
* @return |
|
134 |
*/ |
|
135 |
public int getDataType() { |
|
136 |
return dataType; |
|
137 |
} |
|
138 |
|
|
139 |
/** |
|
140 |
* Sets the data type |
|
141 |
* @param dataType |
|
142 |
*/ |
|
143 |
public void setDataType(int dataType) { |
|
144 |
this.dataType = dataType; |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
148 |
* Gets number of bands |
|
149 |
* @return |
|
150 |
*/ |
|
151 |
public int getBandCount() { |
|
152 |
return bandCount; |
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* Sets number of bands |
|
157 |
* @param bandCount |
|
158 |
*/ |
|
159 |
public void setBandCount(int bandCount) { |
|
160 |
this.bandCount = bandCount; |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* Adds one to the band counter |
|
165 |
*/ |
|
166 |
public void bandPlusPlus() { |
|
167 |
this.bandCount ++; |
|
168 |
} |
|
169 |
|
|
170 |
/** |
|
171 |
* Substracts one to the band counter |
|
172 |
*/ |
|
173 |
public void bandLessLess() { |
|
174 |
this.bandCount --; |
|
175 |
} |
|
176 |
|
|
177 |
/** |
|
178 |
* Gets no data value |
|
179 |
* @return double |
|
180 |
*/ |
|
181 |
public double getNoDataValue() { |
|
182 |
return noDataValue; |
|
183 |
} |
|
184 |
|
|
185 |
/** |
|
186 |
* Sets no data value |
|
187 |
* @return double |
|
188 |
*/ |
|
189 |
public void setNoDataValue(double noDataValue) { |
|
190 |
this.noDataValue = noDataValue; |
|
191 |
} |
|
192 |
|
|
193 |
/** |
|
194 |
* Gets the size of the data type in bytes |
|
195 |
* @return Size of the data type that is used |
|
196 |
*/ |
|
197 |
public int getDataSize() { |
|
198 |
if (getDataType() == Buffer.TYPE_BYTE) { |
|
199 |
return 1; |
|
200 |
} else if ((getDataType() == Buffer.TYPE_SHORT) | (getDataType() == Buffer.TYPE_USHORT)) { |
|
201 |
return 2; |
|
202 |
} else if (getDataType() == Buffer.TYPE_INT) { |
|
203 |
return 4; |
|
204 |
}else if (getDataType() == Buffer.TYPE_FLOAT) { |
|
205 |
return 8; |
|
206 |
}else if (getDataType() == Buffer.TYPE_DOUBLE) { |
|
207 |
return 16; |
|
208 |
} |
|
209 |
|
|
210 |
return 0; |
|
211 |
} |
|
212 |
|
|
213 |
/** |
|
214 |
* Gets the buffer size |
|
215 |
* @return buffer size |
|
216 |
*/ |
|
217 |
public long sizeof() { |
|
218 |
return (long)(getDataSize() * getWidth() * getHeight() * getBandCount()); |
|
219 |
} |
|
220 |
|
|
221 |
} |
|
0 | 222 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/BufferNoData.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.cache.buffer; |
|
23 |
|
|
24 |
/** |
|
25 |
* This class represents the nodata value. |
|
26 |
* |
|
27 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
28 |
*/ |
|
29 |
public interface BufferNoData { |
|
30 |
public static byte defaultByteNoDataValue = -128; |
|
31 |
public static short defaultShortNoDataValue = -32768; |
|
32 |
public static int defaultIntegerNoDataValue = -99999; |
|
33 |
public static float defaultFloatNoDataValue = -99999F; |
|
34 |
public static double defaultDoubleNoDataValue = -99999D; |
|
35 |
|
|
36 |
/** |
|
37 |
* Gets a unique value for nodata. It doesn't take into account if the raster has |
|
38 |
* several bands. Returns the same value for all of them. |
|
39 |
* @return the noData |
|
40 |
*/ |
|
41 |
public Number getValue(); |
|
42 |
|
|
43 |
/** |
|
44 |
* Sets a unique value for nodata. It doesn't take into account if the raster has |
|
45 |
* several bands. Assigns the same value for all of them. |
|
46 |
* @param noData the noData to set |
|
47 |
*/ |
|
48 |
public void setValue(Number noData); |
|
49 |
|
|
50 |
/** |
|
51 |
* Returns true if getValue is defined and false if is null |
|
52 |
* @return |
|
53 |
*/ |
|
54 |
public boolean isDefined(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Deletes the nodata value. |
|
58 |
*/ |
|
59 |
public void delete(); |
|
60 |
|
|
61 |
/** |
|
62 |
* Restores native value. The native is the original value |
|
63 |
* saved in the head of the file or its metadata. This value |
|
64 |
* has to be assign when NoData object is initialize. |
|
65 |
*/ |
|
66 |
public void restore(); |
|
67 |
|
|
68 |
/** |
|
69 |
* The native is the original value |
|
70 |
* saved in the head of the file or its metadata. This value |
|
71 |
* has to be assign when NoData object is initialize |
|
72 |
* @return the noData |
|
73 |
*/ |
|
74 |
public Number getNativeValue(); |
|
75 |
|
|
76 |
/** |
|
77 |
* The native is the original value |
|
78 |
* saved in the head of the file or its metadata. This value |
|
79 |
* has to be assign when NoData object is initialize. |
|
80 |
* @param nativeNoDataValue |
|
81 |
*/ |
|
82 |
public void setNativeValue(Number nativeNoDataValue); |
|
83 |
|
|
84 |
/** |
|
85 |
* Sets the file name |
|
86 |
* @param bandCount |
|
87 |
*/ |
|
88 |
public void setFileName(String fileName); |
|
89 |
|
|
90 |
/** |
|
91 |
* Gets the file name |
|
92 |
* @return |
|
93 |
*/ |
|
94 |
public String getFileName(); |
|
95 |
|
|
96 |
/** |
|
97 |
* Flag to renderize nodata values as transparent |
|
98 |
* @return |
|
99 |
*/ |
|
100 |
public boolean isNoDataTransparent(); |
|
101 |
|
|
102 |
/** |
|
103 |
* Flag to renderize nodata values as transparent |
|
104 |
* @param noDataAsTransparent |
|
105 |
*/ |
|
106 |
public void setNoDataTransparent(boolean noDataAsTransparent); |
|
107 |
|
|
108 |
/** |
|
109 |
* Gets the NoData data type |
|
110 |
* @return |
|
111 |
*/ |
|
112 |
public int getDataType(); |
|
113 |
|
|
114 |
/** |
|
115 |
* Sets the datatype |
|
116 |
*/ |
|
117 |
public void setDataType(int datatype); |
|
118 |
|
|
119 |
/** |
|
120 |
* Compares two NoData objects an returns true if contains the same values |
|
121 |
* @param noData |
|
122 |
* @return |
|
123 |
*/ |
|
124 |
public boolean compare(BufferNoData noData); |
|
125 |
|
|
126 |
/** |
|
127 |
* Creates and returns a copy of this object. |
|
128 |
* @return |
|
129 |
*/ |
|
130 |
public Object clone(); |
|
131 |
|
|
132 |
//*********************************************** |
|
133 |
//Only for file with more than one band |
|
134 |
|
|
135 |
/** |
|
136 |
* Gets the nodata value by band |
|
137 |
* @param nBand |
|
138 |
* @return |
|
139 |
*/ |
|
140 |
public Number getValueByBand(int nBand); |
|
141 |
|
|
142 |
/** |
|
143 |
* Gets the number of bands |
|
144 |
* @return |
|
145 |
*/ |
|
146 |
public int getBandCount(); |
|
147 |
|
|
148 |
/** |
|
149 |
* Sets the number of bands |
|
150 |
* @param bandCount |
|
151 |
*/ |
|
152 |
public void setBandCount(int bandCount); |
|
153 |
|
|
154 |
/** |
|
155 |
* Assigns one value in a band |
|
156 |
* @param noDataValue |
|
157 |
*/ |
|
158 |
public void setValueByBand(Number noDataValue, int nBand); |
|
159 |
|
|
160 |
} |
|
0 | 161 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/Band.java | ||
---|---|---|
1 |
package org.gvsig.raster.cache.buffer; |
|
2 |
|
|
3 |
import org.gvsig.raster.cache.buffer.exception.OperationNotSupportedException; |
|
4 |
|
|
5 |
|
|
6 |
/** |
|
7 |
* Interface implemented by a raster band |
|
8 |
* |
|
9 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
10 |
* |
|
11 |
*/ |
|
12 |
public interface Band extends StatsValues { |
|
13 |
public final static int TYPE_UNDEFINED = Buffer.TYPE_UNDEFINED; |
|
14 |
public final static int TYPE_BYTE = Buffer.TYPE_BYTE; |
|
15 |
public final static int TYPE_SHORT = Buffer.TYPE_SHORT; |
|
16 |
public final static int TYPE_USHORT = Buffer.TYPE_USHORT; |
|
17 |
public final static int TYPE_INT = Buffer.TYPE_INT; |
|
18 |
public final static int TYPE_FLOAT = Buffer.TYPE_FLOAT; |
|
19 |
public final static int TYPE_DOUBLE = Buffer.TYPE_DOUBLE; |
|
20 |
public final static int TYPE_IMAGE = -1; |
|
21 |
|
|
22 |
/** |
|
23 |
* Ancho de la banda |
|
24 |
* @return Entero con el ancho de la banda |
|
25 |
*/ |
|
26 |
public int getWidth(); |
|
27 |
|
|
28 |
/** |
|
29 |
* Alto de la banda |
|
30 |
* @return Entero con el alto de la banda |
|
31 |
*/ |
|
32 |
public int getHeight(); |
|
33 |
|
|
34 |
/** |
|
35 |
* Obtiene el tipo de dato. Los tipos de dato posibles est?n definidos en IRaster. |
|
36 |
* @return tipo de datos |
|
37 |
*/ |
|
38 |
public int getDataType(); |
|
39 |
|
|
40 |
/** |
|
41 |
* Gets the height of each minimum data block. For instance, when you're using |
|
42 |
* a cache the BlockSize is the height of one piece of cache. If it is a vertical |
|
43 |
* cache the BlockSize is the width of each block. |
|
44 |
* @return size of minimum data block |
|
45 |
*/ |
|
46 |
public int getBlockSize(); |
|
47 |
|
|
48 |
/** |
|
49 |
* Gets the number of blocks |
|
50 |
* @return integer that represents the number of blocks |
|
51 |
*/ |
|
52 |
public int getNumberOfBlocks(); |
|
53 |
|
|
54 |
/** |
|
55 |
* Returns true if the block is horizontal and false if is not |
|
56 |
* @return integer that represents the number of blocks |
|
57 |
*/ |
|
58 |
public boolean isHorizontalBlock(); |
|
59 |
|
|
60 |
/** |
|
61 |
* Assigns a new band number |
|
62 |
* @param band New band number |
|
63 |
*/ |
|
64 |
public void setBandNumber(int band); |
|
65 |
|
|
66 |
/** |
|
67 |
* Gets the band number |
|
68 |
* @return band number |
|
69 |
*/ |
|
70 |
public int getBandNumber(); |
|
71 |
|
|
72 |
//*********************************************** |
|
73 |
//Getting a block of data |
|
74 |
|
|
75 |
/** |
|
76 |
* Gets a minimum block of data. The height of this data block is getBlockHeight |
|
77 |
* pixels. |
|
78 |
* @return Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
79 |
*/ |
|
80 |
public byte[][] getByteBlock(int block); |
|
81 |
|
|
82 |
/** |
|
83 |
* Gets a minimum block of data. The height of this data block is getBlockHeight |
|
84 |
* pixels. |
|
85 |
* @return Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
86 |
*/ |
|
87 |
public short[][] getShortBlock(int block); |
|
88 |
|
|
89 |
/** |
|
90 |
* Gets a minimum block of data. The height of this data block is getBlockHeight |
|
91 |
* pixels. |
|
92 |
* @return Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
93 |
*/ |
|
94 |
public int[][] getIntBlock(int block); |
|
95 |
|
|
96 |
/** |
|
97 |
* Gets a minimum block of data. The height of this data block is getBlockHeight |
|
98 |
* pixels. |
|
99 |
* @return Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
100 |
*/ |
|
101 |
public float[][] getFloatBlock(int block); |
|
102 |
|
|
103 |
/** |
|
104 |
* Gets a minimum block of data. The height of this data block is getBlockHeight |
|
105 |
* pixels. |
|
106 |
* @return Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
107 |
*/ |
|
108 |
public double[][] getDoubleBlock(int block); |
|
109 |
|
|
110 |
//*********************************************** |
|
111 |
//Obtiene una linea de datos |
|
112 |
|
|
113 |
/** |
|
114 |
* Obtiene una l?nea de datos de esta banda para buffers con tipo |
|
115 |
* de dato byte. |
|
116 |
* @param line |
|
117 |
* N?mero de l?nea del buffer a recuperar |
|
118 |
* @return Array unidimensional que representa la l?nea de datos. |
|
119 |
*/ |
|
120 |
public byte[] getByteLine(int line) throws OperationNotSupportedException; |
|
121 |
|
|
122 |
/** |
|
123 |
* Obtiene una l?nea de datos de esta banda para buffers con tipo |
|
124 |
* de dato short. |
|
125 |
* @param line |
|
126 |
* N?mero de l?nea del buffer a recuperar |
|
127 |
* @return Array unidimensional que representa la l?nea de datos. |
|
128 |
*/ |
|
129 |
public short[] getShortLine(int line) throws OperationNotSupportedException; |
|
130 |
|
|
131 |
/** |
|
132 |
* Obtiene una l?nea de datos de esta banda para buffers con tipo |
|
133 |
* de dato int. |
|
134 |
* @param line |
|
135 |
* N?mero de l?nea del buffer a recuperar |
|
136 |
* @return Array unidimensional que representa la l?nea de datos. |
|
137 |
*/ |
|
138 |
public int[] getIntLine(int line) throws OperationNotSupportedException; |
|
139 |
|
|
140 |
/** |
|
141 |
* Obtiene una l?nea de datos de esta banda para buffers con tipo |
|
142 |
* de dato float. |
|
143 |
* @param line |
|
144 |
* N?mero de l?nea del buffer a recuperar |
|
145 |
* @return Array unidimensional que representa la l?nea de datos. |
|
146 |
*/ |
|
147 |
public float[] getFloatLine(int line) throws OperationNotSupportedException; |
|
148 |
|
|
149 |
/** |
|
150 |
* Obtiene una l?nea de datos de esta banda para buffers con tipo |
|
151 |
* de dato double. |
|
152 |
* @param line |
|
153 |
* N?mero de l?nea del buffer a recuperar |
|
154 |
* @return Array unidimensional que representa la l?nea de datos. |
|
155 |
*/ |
|
156 |
public double[] getDoubleLine(int line) throws OperationNotSupportedException; |
|
157 |
|
|
158 |
//*********************************************** |
|
159 |
//Obtiene un elemento de la matriz |
|
160 |
|
|
161 |
/** |
|
162 |
* Gets one element from the array if this is byte datatype |
|
163 |
* @param line |
|
164 |
* Y position |
|
165 |
* @param col |
|
166 |
* X position |
|
167 |
* @param band Number of band to read |
|
168 |
* @return Readed element |
|
169 |
*/ |
|
170 |
public byte getElemByte(int line, int col); |
|
171 |
|
|
172 |
/** |
|
173 |
* Gets one element from the array if this is short datatype |
|
174 |
* @param line |
|
175 |
* Y position |
|
176 |
* @param col |
|
177 |
* X position |
|
178 |
* @param band Number of band to read |
|
179 |
* @return Readed element |
|
180 |
*/ |
|
181 |
public short getElemShort(int line, int col); |
|
182 |
|
|
183 |
/** |
|
184 |
* Gets one element from the array if this is int datatype |
|
185 |
* @param line |
|
186 |
* Y position |
|
187 |
* @param col |
|
188 |
* X position |
|
189 |
* @param band |
|
190 |
* Number of band to read |
|
191 |
* @return Readed element |
|
192 |
*/ |
|
193 |
public int getElemInt(int line, int col); |
|
194 |
|
|
195 |
/** |
|
196 |
* Gets one element from the array if this is float datatype |
|
197 |
* @param line |
|
198 |
* Y position |
|
199 |
* @param col |
|
200 |
* X position |
|
201 |
* @param band |
|
202 |
* Number of band to read |
|
203 |
* @return Readed element |
|
204 |
*/ |
|
205 |
public float getElemFloat(int line, int col); |
|
206 |
|
|
207 |
/** |
|
208 |
* Gets one element from the array if this is double datatype |
|
209 |
* @param line |
|
210 |
* Y position |
|
211 |
* @param col |
|
212 |
* X position |
|
213 |
* @param band |
|
214 |
* Number of band to read |
|
215 |
* @return Readed element |
|
216 |
*/ |
|
217 |
public double getElemDouble(int line, int col); |
|
218 |
|
|
219 |
//*********************************************** |
|
220 |
//Asigna una linea de datos a una banda |
|
221 |
|
|
222 |
/** |
|
223 |
* Sets one line of byte data |
|
224 |
* @param data |
|
225 |
* line of data |
|
226 |
* @param line |
|
227 |
* Number of line to set |
|
228 |
* @throws OperationNotSupportedException |
|
229 |
*/ |
|
230 |
public void setByteLine(byte[] data, int line) throws OperationNotSupportedException; |
|
231 |
|
|
232 |
/** |
|
233 |
* Sets one line of short data |
|
234 |
* @param data |
|
235 |
* line of data |
|
236 |
* @param line |
|
237 |
* Number of line to set |
|
238 |
* @throws OperationNotSupportedException |
|
239 |
*/ |
|
240 |
public void setShortLine(short[] data, int line) throws OperationNotSupportedException; |
|
241 |
|
|
242 |
/** |
|
243 |
* Sets one line of int data |
|
244 |
* @param data |
|
245 |
* line of data |
|
246 |
* @param line |
|
247 |
* Number of line to set |
|
248 |
* @throws OperationNotSupportedException |
|
249 |
*/ |
|
250 |
public void setIntLine(int[] data, int line) throws OperationNotSupportedException; |
|
251 |
|
|
252 |
/** |
|
253 |
* Sets one line of float data |
|
254 |
* @param data |
|
255 |
* line of data |
|
256 |
* @param line |
|
257 |
* Number of line to set |
|
258 |
* @throws OperationNotSupportedException |
|
259 |
*/ |
|
260 |
public void setFloatLine(float[] data, int line) throws OperationNotSupportedException; |
|
261 |
|
|
262 |
/** |
|
263 |
* Sets one line of double data |
|
264 |
* @param data |
|
265 |
* line of data |
|
266 |
* @param line |
|
267 |
* Number of line to set |
|
268 |
* @throws OperationNotSupportedException |
|
269 |
*/ |
|
270 |
public void setDoubleLine(double[] data, int line) throws OperationNotSupportedException; |
|
271 |
|
|
272 |
//********************************************** |
|
273 |
//Asigna un elemento de la matriz |
|
274 |
|
|
275 |
/** |
|
276 |
* Sets one byte element |
|
277 |
* @param line |
|
278 |
* Y position |
|
279 |
* @param col |
|
280 |
* X position |
|
281 |
* @param data |
|
282 |
* data value to set |
|
283 |
* @throws OperationNotSupportedException |
|
284 |
*/ |
|
285 |
public void setElem(int line, int col, byte data) throws OperationNotSupportedException; |
|
286 |
|
|
287 |
/** |
|
288 |
* Sets one short element |
|
289 |
* @param line |
|
290 |
* Y position |
|
291 |
* @param col |
|
292 |
* X position |
|
293 |
* @param data |
|
294 |
* data value to set |
|
295 |
* @throws OperationNotSupportedException |
|
296 |
*/ |
|
297 |
public void setElem(int line, int col, short data) throws OperationNotSupportedException; |
|
298 |
|
|
299 |
/** |
|
300 |
* Sets one int element |
|
301 |
* @param line |
|
302 |
* Y position |
|
303 |
* @param col |
|
304 |
* X position |
|
305 |
* @param data |
|
306 |
* data value to set |
|
307 |
* @throws OperationNotSupportedException |
|
308 |
*/ |
|
309 |
public void setElem(int line, int col, int data) throws OperationNotSupportedException; |
|
310 |
|
|
311 |
/** |
|
312 |
* Sets one float element |
|
313 |
* @param line |
|
314 |
* Y position |
|
315 |
* @param col |
|
316 |
* X position |
|
317 |
* @param data |
|
318 |
* data value to set |
|
319 |
* @throws OperationNotSupportedException |
|
320 |
*/ |
|
321 |
public void setElem(int line, int col, float data) throws OperationNotSupportedException; |
|
322 |
|
|
323 |
/** |
|
324 |
* Sets one double element |
|
325 |
* @param line |
|
326 |
* Y position |
|
327 |
* @param col |
|
328 |
* X position |
|
329 |
* @param data |
|
330 |
* data value to set |
|
331 |
* @throws OperationNotSupportedException |
|
332 |
*/ |
|
333 |
public void setElem(int line, int col, double data) throws OperationNotSupportedException; |
|
334 |
|
|
335 |
//*********************************************** |
|
336 |
//Inicializa la banda al valor pasado por par?metro |
|
337 |
|
|
338 |
/** |
|
339 |
* Sets all elements in this band to the parameter value |
|
340 |
* @param value |
|
341 |
* Value to set |
|
342 |
* @throws OperationNotSupportedException |
|
343 |
*/ |
|
344 |
public void assign(byte value) throws OperationNotSupportedException; |
|
345 |
|
|
346 |
/** |
|
347 |
* Sets all elements in this band to the parameter value |
|
348 |
* @param value |
|
349 |
* Value to set |
|
350 |
* @throws OperationNotSupportedException |
|
351 |
*/ |
|
352 |
public void assign(short value) throws OperationNotSupportedException; |
|
353 |
|
|
354 |
/** |
|
355 |
* Sets all elements in this band to the parameter value |
|
356 |
* @param value |
|
357 |
* Value to set |
|
358 |
* @throws OperationNotSupportedException |
|
359 |
*/ |
|
360 |
public void assign(int value) throws OperationNotSupportedException; |
|
361 |
|
|
362 |
/** |
|
363 |
* Sets all elements in this band to the parameter value |
|
364 |
* @param value |
|
365 |
* Value to set |
|
366 |
* @throws OperationNotSupportedException |
|
367 |
*/ |
|
368 |
public void assign(float value) throws OperationNotSupportedException; |
|
369 |
|
|
370 |
/** |
|
371 |
* Sets all elements in this band to the parameter value |
|
372 |
* @param value |
|
373 |
* Value to set |
|
374 |
* @throws OperationNotSupportedException |
|
375 |
*/ |
|
376 |
public void assign(double value) throws OperationNotSupportedException; |
|
377 |
|
|
378 |
//*********************************************** |
|
379 |
//Getting a block of data |
|
380 |
|
|
381 |
/** |
|
382 |
* Sets a minimum byte block. The height of this data block is getBlockHeight |
|
383 |
* pixels. |
|
384 |
* @param data |
|
385 |
* Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
386 |
* @param block |
|
387 |
* Number of block to assign |
|
388 |
* @throws OperationNotSupportedException |
|
389 |
*/ |
|
390 |
public void setByteBlock(byte[][] data, int block) throws OperationNotSupportedException; |
|
391 |
|
|
392 |
/** |
|
393 |
* Sets a minimum short block. The height of this data block is getBlockHeight |
|
394 |
* pixels. |
|
395 |
* @param data |
|
396 |
* Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
397 |
* @param block |
|
398 |
* Number of block to assign |
|
399 |
* @throws OperationNotSupportedException |
|
400 |
*/ |
|
401 |
public void setShortBlock(short[][] data, int block) throws OperationNotSupportedException; |
|
402 |
|
|
403 |
/** |
|
404 |
* Sets a minimum int block. The height of this data block is getBlockHeight |
|
405 |
* pixels. |
|
406 |
* @param data |
|
407 |
* Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
408 |
* @param block |
|
409 |
* Number of block to assign |
|
410 |
* @throws OperationNotSupportedException |
|
411 |
*/ |
|
412 |
public void setIntBlock(int[][] data, int block) throws OperationNotSupportedException; |
|
413 |
|
|
414 |
/** |
|
415 |
* Sets a minimum float block. The height of this data block is getBlockHeight |
|
416 |
* pixels. |
|
417 |
* @param data |
|
418 |
* Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
419 |
* @param block |
|
420 |
* Number of block to assign |
|
421 |
* @throws OperationNotSupportedException |
|
422 |
*/ |
|
423 |
public void setFloatBlock(float[][] data, int block) throws OperationNotSupportedException; |
|
424 |
|
|
425 |
/** |
|
426 |
* Sets a minimum double block. The height of this data block is getBlockHeight |
|
427 |
* pixels. |
|
428 |
* @param data |
|
429 |
* Data buffer in memory. This is an array of two dimensions (width x heigth). |
|
430 |
* @param block |
|
431 |
* Number of block to assign |
|
432 |
* @throws OperationNotSupportedException |
|
433 |
*/ |
|
434 |
public void setDoubleBlock(double[][] data, int block) throws OperationNotSupportedException; |
|
435 |
} |
|
0 | 436 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/PxTile.java | ||
---|---|---|
1 |
package org.gvsig.raster.cache.buffer; |
|
2 |
|
|
3 |
|
|
4 |
public abstract class PxTile extends RasterBase { |
|
5 |
/** |
|
6 |
* Set size and position values |
|
7 |
* @param x |
|
8 |
* Upper left X position |
|
9 |
* @param y |
|
10 |
* Upper left X position |
|
11 |
* @param w |
|
12 |
* Width |
|
13 |
* @param h |
|
14 |
* Height |
|
15 |
*/ |
|
16 |
public PxTile(int x, int y, int w, int h) { |
|
17 |
super(x, y, w, h); |
|
18 |
} |
|
19 |
|
|
20 |
/** |
|
21 |
* Set size, position values and a file reference |
|
22 |
* @param x |
|
23 |
* Upper left X position |
|
24 |
* @param y |
|
25 |
* Upper left X position |
|
26 |
* @param w |
|
27 |
* Width |
|
28 |
* @param h |
|
29 |
* Height |
|
30 |
* @param ref |
|
31 |
* file reference |
|
32 |
*/ |
|
33 |
public PxTile(int x, int y, int w, int h, String ref) { |
|
34 |
super(x, y, w, h); |
|
35 |
} |
|
36 |
} |
|
0 | 37 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.28/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/Buffer.java | ||
---|---|---|
1 |
package org.gvsig.raster.cache.buffer; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
import java.awt.image.DataBuffer; |
|
5 |
import java.io.IOException; |
|
6 |
import java.util.ArrayList; |
|
7 |
|
|
8 |
import org.gvsig.raster.cache.buffer.exception.BandNotCompatibleException; |
|
9 |
import org.gvsig.raster.cache.buffer.exception.OperationNotSupportedException; |
|
10 |
import org.gvsig.raster.cache.buffer.exception.ProcessInterruptedException; |
|
11 |
import org.gvsig.raster.cache.buffer.exception.WrongParameterException; |
|
12 |
import org.gvsig.raster.cache.buffer.histogram.Histogramable; |
|
13 |
|
|
14 |
/** |
|
15 |
* Interfaz que contiene las operaciones que debe soportar un buffer de datos. |
|
16 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
17 |
* |
|
18 |
*/ |
|
19 |
public interface Buffer extends Histogramable { |
|
20 |
public static boolean noDataValueEnable = false; |
|
21 |
public static double defaultNoDataValue = -99999.0; |
|
22 |
|
|
23 |
public final static int TYPE_UNDEFINED = DataBuffer.TYPE_UNDEFINED; |
|
24 |
public final static int TYPE_BYTE = DataBuffer.TYPE_BYTE; |
|
25 |
public final static int TYPE_SHORT = DataBuffer.TYPE_SHORT; |
|
26 |
public final static int TYPE_USHORT = DataBuffer.TYPE_USHORT; |
|
27 |
public final static int TYPE_INT = DataBuffer.TYPE_INT; |
|
28 |
public final static int TYPE_FLOAT = DataBuffer.TYPE_FLOAT; |
|
29 |
public final static int TYPE_DOUBLE = DataBuffer.TYPE_DOUBLE; |
|
30 |
|
|
31 |
//Read type constants |
|
32 |
public static final int READ_ONLY = 0; |
|
33 |
public static final int READ_WRITE = 1; |
|
34 |
//If the returned buffer is a cache buffer then it will have vertical stripes |
|
35 |
public static final int READ_WRITE_CVERT = 2; |
|
36 |
|
|
37 |
//************************************** |
|
38 |
//************GETTING INFO************** |
|
39 |
//************************************** |
|
40 |
|
|
41 |
/** |
|
42 |
* Ancho del raster |
|
43 |
* @return Entero con el ancho del raster |
|
44 |
*/ |
|
45 |
public int getWidth(); |
|
46 |
|
|
47 |
/** |
|
48 |
* Alto del raster |
|
49 |
* @return Entero con el alto del raster |
|
50 |
*/ |
|
51 |
public int getHeight(); |
|
52 |
|
|
53 |
/** |
|
54 |
* N?mero de bandas |
|
55 |
* @return Entero con el n?mero de bandas |
|
56 |
*/ |
|
57 |
public int getBandCount(); |
|
58 |
|
|
59 |
/** |
|
60 |
* Obtiene el tipo de dato. Los tipos de dato posibles est?n definidos en IRaster. |
|
61 |
* @return tipo de datos |
|
62 |
*/ |
|
63 |
public int getDataType(); |
|
64 |
|
|
65 |
/** |
Also available in: Unified diff