Revision 10167
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.38/org.gvsig.raster.cache.lib.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.cache.lib.api</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.raster.cache.lib.api</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.raster.cache</artifactId> |
|
10 |
<version>2.2.38</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
16 |
<type>test-jar</type> |
|
17 |
<scope>test</scope> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
22 |
<scope>compile</scope> |
|
23 |
</dependency> |
|
24 |
<dependency> |
|
25 |
<groupId>org.gvsig</groupId> |
|
26 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
27 |
<scope>compile</scope> |
|
28 |
</dependency> |
|
29 |
</dependencies> |
|
30 |
<build> |
|
31 |
<plugins> |
|
32 |
<plugin> |
|
33 |
<groupId>org.apache.maven.plugins</groupId> |
|
34 |
<artifactId>maven-jar-plugin</artifactId> |
|
35 |
<configuration> |
|
36 |
</configuration> |
|
37 |
<executions> |
|
38 |
<!-- |
|
39 |
Generates a jar file only with the test classes |
|
40 |
--> |
|
41 |
<execution> |
|
42 |
<goals> |
|
43 |
<goal>test-jar</goal> |
|
44 |
</goals> |
|
45 |
</execution> |
|
46 |
</executions> |
|
47 |
</plugin> |
|
48 |
</plugins> |
|
49 |
</build> |
|
50 |
</project> |
|
0 | 51 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.38/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.38/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.38/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.38/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 |
/** |
|
66 |
* Asigna el tipo de dato. Los tipos de dato posibles est?n definidos en IRaster. |
|
67 |
* @param dataType Tipo de dato del buffer |
|
68 |
*/ |
|
69 |
public void setDataType(int dataType); |
|
70 |
|
|
71 |
/** |
|
72 |
* Get no data value |
|
73 |
* @return double |
|
74 |
*/ |
|
75 |
public BufferNoData getNoDataValue(); |
|
76 |
|
|
77 |
/** |
|
78 |
* Sets no data value |
|
79 |
* @return double |
|
80 |
*/ |
|
81 |
public void setNoDataValue(BufferNoData noDataValue); |
|
82 |
|
|
83 |
/** |
|
84 |
* Get true if current buffer is writable and false if is not. |
|
85 |
* @return true or false |
|
86 |
*/ |
|
87 |
public boolean isWritable(); |
|
88 |
|
|
89 |
/** |
|
90 |
* Obtiene true si el pixel pasado por par?metro cae dentro de los l?mites |
|
91 |
* del rater y false si cae fuera. |
|
92 |
* @param x Posici?n X del pixel a averiguar |
|
93 |
* @param y Posici?n Y del pixel a averiguar |
|
94 |
* @return true si est? dentro y false si cae fuera. |
|
95 |
*/ |
|
96 |
public boolean isInside(int x, int y); |
|
97 |
|
|
98 |
/** |
|
99 |
* Gets a bouding box of this buffer |
|
100 |
* @return |
|
101 |
*/ |
|
102 |
public Rectangle2D getDataExtent(); |
|
103 |
|
|
104 |
/** |
|
105 |
* Sets the bounding box of this buffer |
|
106 |
* @param extent |
|
107 |
*/ |
|
108 |
public void setDataExtent(Rectangle2D extent); |
|
109 |
|
|
110 |
/** |
|
111 |
* Libera el buffer de memoria |
|
112 |
* @throws IOException |
|
113 |
*/ |
|
114 |
public void free() throws IOException; |
|
115 |
|
|
116 |
/** |
|
117 |
* Sets the RasterDataStore reference |
|
118 |
* @param store |
|
119 |
*/ |
|
120 |
public void setStore(Object store); |
|
121 |
|
|
122 |
/** |
|
123 |
* Gets the RasterDataStore reference |
|
124 |
* @return |
|
125 |
*/ |
|
126 |
public Object getStore(); |
|
127 |
|
|
128 |
//************************************** |
|
129 |
//************GETTING DATA************** |
|
130 |
//************************************** |
|
131 |
|
|
132 |
//*********************************************** |
|
133 |
//Obtiene una linea de datos de todas las bandas |
|
134 |
|
|
135 |
/** |
|
136 |
* Obtiene una l?nea de datos con todas las bandas para buffers con tipo |
|
137 |
* de dato byte. |
|
138 |
* @param line N?mero de l?nea del buffer a recuperar |
|
139 |
* @return Array bidimensional conteniendo la l?nea de datos donde la primera |
|
140 |
* dimensi?n representa las bandas y la segunda la posici?n en la l?nea |
|
141 |
*/ |
|
142 |
public byte[][] getLineByte(int line) throws OperationNotSupportedException; |
|
143 |
|
|
144 |
/** |
|
145 |
* Obtiene una l?nea de datos con todas las bandas para buffers con tipo |
|
146 |
* de dato short. |
|
147 |
* @param line N?mero de l?nea del buffer a recuperar |
|
148 |
* @return Array bidimensional conteniendo la l?nea de datos donde la primera |
|
149 |
* dimensi?n representa las bandas y la segunda la posici?n en la l?nea |
|
150 |
*/ |
|
151 |
public short[][] getLineShort(int line) throws OperationNotSupportedException; |
|
152 |
|
|
153 |
/** |
|
154 |
* Obtiene una l?nea de datos con todas las bandas para buffers con tipo |
|
155 |
* de dato int. |
|
156 |
* @param line N?mero de l?nea del buffer a recuperar |
|
157 |
* @return Array bidimensional conteniendo la l?nea de datos donde la primera |
|
158 |
* dimensi?n representa las bandas y la segunda la posici?n en la l?nea |
|
159 |
*/ |
|
160 |
public int[][] getLineInt(int line) throws OperationNotSupportedException; |
|
161 |
|
|
162 |
/** |
|
163 |
* Obtiene una l?nea de datos con todas las bandas para buffers con tipo |
|
164 |
* de dato float. |
|
165 |
* @param line N?mero de l?nea del buffer a recuperar |
|
166 |
* @return Array bidimensional conteniendo la l?nea de datos donde la primera |
|
167 |
* dimensi?n representa las bandas y la segunda la posici?n en la l?nea |
|
168 |
*/ |
|
169 |
public float[][] getLineFloat(int line) throws OperationNotSupportedException; |
|
170 |
|
|
171 |
/** |
|
172 |
* Obtiene una l?nea de datos con todas las bandas para buffers con tipo |
|
173 |
* de dato double. |
|
174 |
* @param line N?mero de l?nea del buffer a recuperar |
|
175 |
* @return Array bidimensional conteniendo la l?nea de datos donde la primera |
|
176 |
* dimensi?n representa las bandas y la segunda la posici?n en la l?nea |
|
177 |
*/ |
|
178 |
public double[][] getLineDouble(int line) throws OperationNotSupportedException; |
|
179 |
|
|
180 |
//*********************************************** |
|
181 |
//Obtiene una linea de datos de una banda |
|
182 |
|
|
183 |
/** |
|
184 |
* Obtiene una l?nea de datos de la banda solicitada para buffers con tipo |
|
185 |
* de dato byte. |
|
186 |
* @param line N?mero de l?nea del buffer a recuperar |
|
187 |
* @param band N?mero de banda a recuperar |
|
188 |
* @return Array unidimensional que representa la l?nea de datos. |
|
189 |
*/ |
|
190 |
public byte[] getLineFromBandByte(int line, int band) throws OperationNotSupportedException; |
|
191 |
|
|
192 |
/** |
|
193 |
* Obtiene una l?nea de datos de la banda solicitada para buffers con tipo |
|
194 |
* de dato short. |
|
195 |
* @param line N?mero de l?nea del buffer a recuperar |
|
196 |
* @param band N?mero de banda a recuperar |
|
197 |
* @return Array unidimensional que representa la l?nea de datos. |
|
198 |
*/ |
|
199 |
public short[] getLineFromBandShort(int line, int band) throws OperationNotSupportedException; |
|
200 |
|
|
201 |
/** |
|
202 |
* Obtiene una l?nea de datos de la banda solicitada para buffers con tipo |
|
203 |
* de dato int. |
|
204 |
* @param line N?mero de l?nea del buffer a recuperar |
|
205 |
* @param band N?mero de banda a recuperar |
|
206 |
* @return Array unidimensional que representa la l?nea de datos. |
|
207 |
*/ |
|
208 |
public int[] getLineFromBandInt(int line, int band) throws OperationNotSupportedException; |
|
209 |
|
|
210 |
/** |
|
211 |
* Obtiene una l?nea de datos de la banda solicitada para buffers con tipo |
|
212 |
* de dato float. |
|
213 |
* @param line N?mero de l?nea del buffer a recuperar |
|
214 |
* @param band N?mero de banda a recuperar |
|
215 |
* @return Array unidimensional que representa la l?nea de datos. |
|
216 |
*/ |
|
217 |
public float[] getLineFromBandFloat(int line, int band) throws OperationNotSupportedException; |
|
218 |
|
|
219 |
/** |
|
220 |
* Obtiene una l?nea de datos de la banda solicitada para buffers con tipo |
|
221 |
* de dato double. |
|
222 |
* @param line N?mero de l?nea del buffer a recuperar |
|
223 |
* @param band N?mero de banda a recuperar |
|
224 |
* @return Array unidimensional que representa la l?nea de datos. |
|
225 |
*/ |
|
226 |
public double[] getLineFromBandDouble(int line, int band) throws OperationNotSupportedException; |
|
227 |
|
|
228 |
//*********************************************** |
|
229 |
//Obtiene un elemento de la matriz |
|
230 |
|
|
231 |
/** |
|
232 |
* Gets one element from the array if this is byte datatype |
|
233 |
* @param line Y position |
|
234 |
* @param col X position |
|
235 |
* @param band Number of band to read |
|
236 |
* @return Readed element |
|
237 |
*/ |
|
238 |
public byte getElemByte(int line, int col, int band); |
|
239 |
|
|
240 |
/** |
|
241 |
* Gets one element from the array if this is short datatype |
|
242 |
* @param line Y position |
|
243 |
* @param col X position |
|
244 |
* @param band Number of band to read |
|
245 |
* @return Readed element |
|
246 |
*/ |
|
247 |
public short getElemShort(int line, int col, int band); |
|
248 |
|
|
249 |
/** |
|
250 |
* Gets one element from the array if this is int datatype |
|
251 |
* @param line Y position |
|
252 |
* @param col X position |
|
253 |
* @param band Number of band to read |
|
254 |
* @return Readed element |
|
255 |
*/ |
|
256 |
public int getElemInt(int line, int col, int band); |
|
257 |
|
|
258 |
/** |
|
259 |
* Gets one element from the array if this is float datatype |
|
260 |
* @param line Y position |
|
261 |
* @param col X position |
|
262 |
* @param band Number of band to read |
|
263 |
* @return Readed element |
|
264 |
*/ |
|
265 |
public float getElemFloat(int line, int col, int band); |
|
266 |
|
|
267 |
/** |
|
268 |
* Gets one element from the array if this is double datatype |
|
269 |
* @param line Y position |
|
270 |
* @param col X position |
|
271 |
* @param band Number of band to read |
|
272 |
* @return Readed element |
|
273 |
*/ |
|
274 |
public double getElemDouble(int line, int col, int band); |
|
275 |
|
|
276 |
//*********************************************** |
|
277 |
//Copia un elemento de todas la bandas en el buffer pasado por par?metro |
|
278 |
|
|
279 |
/** |
|
280 |
* Gets one element of each band from the array if this is byte datatype |
|
281 |
* @param line Y position |
|
282 |
* @param col X position |
|
283 |
* @param data Each element of this array is a diferent band of the position line, col |
|
284 |
*/ |
|
285 |
public void getElemByte(int line, int col, byte[] data); |
|
286 |
|
|
287 |
/** |
|
288 |
* Gets one element of each band from the array if this is short datatype |
|
289 |
* @param line Y position |
|
290 |
* @param col X position |
|
291 |
* @param data Each element of this array is a diferent band of the position line, col |
|
292 |
*/ |
|
293 |
public void getElemShort(int line, int col, short[] data); |
|
294 |
|
|
295 |
/** |
|
296 |
* Gets one element of each band from the array if this is int datatype |
|
297 |
* @param line Y position |
|
298 |
* @param col X position |
|
299 |
* @param data Each element of this array is a diferent band of the position line, col |
|
300 |
*/ |
|
301 |
public void getElemInt(int line, int col, int[] data); |
|
302 |
|
|
303 |
/** |
|
304 |
* Gets one element of each band from the array if this is float datatype |
|
305 |
* @param line Y position |
|
306 |
* @param col X position |
|
307 |
* @param data Each element of this array is a diferent band of the position line, col |
|
308 |
*/ |
|
309 |
public void getElemFloat(int line, int col, float[] data); |
|
310 |
|
|
311 |
/** |
|
312 |
* Gets one element of each band from the array if this is double datatype |
|
313 |
* @param line Y position |
|
314 |
* @param col X position |
|
315 |
* @param data Each element of this array is a diferent band of the position line, col |
|
316 |
*/ |
|
317 |
public void getElemDouble(int line, int col, double[] data); |
|
318 |
|
|
319 |
//************************************** |
|
320 |
//************SETTING DATA************** |
|
321 |
//************************************** |
|
322 |
|
|
323 |
//*********************************************** |
|
324 |
//Asigna una linea de datos a una banda |
|
325 |
|
|
326 |
/** |
|
327 |
* Sets a line of byte data |
|
328 |
* @param data Array of data |
|
329 |
* @param line Y position |
|
330 |
* @param band N?mber of band |
|
331 |
* @throws OperationNotSupportedException |
|
332 |
*/ |
|
333 |
public void setLineInBandByte(byte[] data, int line, int band) throws OperationNotSupportedException; |
|
334 |
|
|
335 |
/** |
|
336 |
* Sets a line of short data |
|
337 |
* @param data Array of data |
|
338 |
* @param line Y position |
|
339 |
* @param band N?mber of band |
|
340 |
*/ |
|
341 |
public void setLineInBandShort(short[] data, int line, int band) throws OperationNotSupportedException; |
|
342 |
|
|
343 |
/** |
|
344 |
* Sets a line of int data |
|
345 |
* @param data Array of data |
|
346 |
* @param line Y position |
|
347 |
* @param band N?mber of band |
|
348 |
*/ |
|
349 |
public void setLineInBandInt(int[] data, int line, int band) throws OperationNotSupportedException; |
|
350 |
|
|
351 |
/** |
|
352 |
* Sets a line of float data |
|
353 |
* @param data Array of data |
|
354 |
* @param line Y position |
|
355 |
* @param band N?mber of band |
|
356 |
*/ |
|
357 |
public void setLineInBandFloat(float[] data, int line, int band) throws OperationNotSupportedException; |
|
358 |
|
|
359 |
/** |
|
360 |
* Sets a line of double data |
|
361 |
* @param data Array of data |
|
362 |
* @param line Y position |
|
363 |
* @param band N?mber of band |
|
364 |
*/ |
|
365 |
public void setLineInBandDouble(double[] data, int line, int band) throws OperationNotSupportedException; |
|
366 |
|
|
367 |
//*********************************************** |
|
368 |
//Asigna una linea de datos a todas las bandas |
|
369 |
|
|
370 |
public void setLineByte(byte[][] data, int line) throws OperationNotSupportedException; |
|
371 |
|
|
372 |
public void setLineShort(short[][] data, int line) throws OperationNotSupportedException; |
|
373 |
|
|
374 |
public void setLineInt(int[][] data, int line) throws OperationNotSupportedException; |
|
375 |
|
|
376 |
public void setLineFloat(float[][] data, int line) throws OperationNotSupportedException; |
|
377 |
|
|
378 |
public void setLineDouble(double[][] data, int line) throws OperationNotSupportedException; |
|
379 |
|
|
380 |
//********************************************** |
|
381 |
//Asigna un elemento de la matriz |
|
382 |
|
|
383 |
public void setElem(int line, int col, int band, byte data) throws OperationNotSupportedException; |
|
384 |
|
|
385 |
public void setElem(int line, int col, int band, short data) throws OperationNotSupportedException; |
|
386 |
|
|
387 |
public void setElem(int line, int col, int band, int data) throws OperationNotSupportedException; |
|
388 |
|
|
389 |
public void setElem(int line, int col, int band, float data) throws OperationNotSupportedException; |
|
390 |
|
|
391 |
public void setElem(int line, int col, int band, double data) throws OperationNotSupportedException; |
|
392 |
|
|
393 |
//*********************************************** |
|
394 |
//Asigna un elemento a todas la bandas en el buffer pasado por par?metro |
|
395 |
|
|
396 |
public void setElemByte(int line, int col, byte[] data) throws OperationNotSupportedException; |
|
397 |
|
|
398 |
public void setElemShort(int line, int col, short[] data) throws OperationNotSupportedException; |
|
399 |
|
|
400 |
public void setElemInt(int line, int col, int[] data) throws OperationNotSupportedException; |
|
401 |
|
|
402 |
public void setElemFloat(int line, int col, float[] data) throws OperationNotSupportedException; |
|
403 |
|
|
404 |
public void setElemDouble(int line, int col, double[] data) throws OperationNotSupportedException; |
|
405 |
|
|
406 |
//*********************************************** |
|
407 |
//Inicializa una banda a un valor pasado por par?metro |
|
408 |
|
|
409 |
public void assign(int band, byte value) throws OperationNotSupportedException; |
|
410 |
|
|
411 |
public void assign(int band, short value) throws OperationNotSupportedException; |
|
412 |
|
|
413 |
public void assign(int band, int value) throws OperationNotSupportedException; |
|
414 |
|
|
415 |
public void assign(int band, float value) throws OperationNotSupportedException; |
|
416 |
|
|
417 |
public void assign(int band, double value) throws OperationNotSupportedException; |
|
418 |
|
|
419 |
//************************************** |
|
420 |
//**********BANDS OPERATIONS************ |
|
421 |
//************************************** |
|
422 |
|
|
423 |
/** |
|
424 |
* Removes a band from memory buffer |
|
425 |
* @param band Number of band |
|
426 |
*/ |
|
427 |
public void removeBand(int pos) throws IOException ; |
|
428 |
|
|
429 |
/** |
|
430 |
* Makes an empty band without initial value in the selected position |
|
431 |
* @return IRasterBand New band |
|
432 |
* @throws IOException |
|
433 |
*/ |
|
434 |
public Band addBand(int pos) throws IOException; |
|
435 |
|
|
436 |
/** |
|
437 |
* Sustituye una banda completa copiando los datos de la que se pasa por par?metro |
|
438 |
* @param nBand N?mero de banda a sustituir |
|
439 |
* @param banda a copiar |
|
440 |
* @throws OperationNotSupportedException |
|
441 |
*/ |
|
442 |
public void copyBand(int nBand, Band band) throws BandNotCompatibleException, OperationNotSupportedException; |
|
443 |
|
|
444 |
/** |
|
445 |
* Creates a new band assigning other by reference. Owing to this fact, the band |
|
446 |
* assigned must be the same kind of buffer. |
|
447 |
* @param nBand |
|
448 |
* band number to be assigned |
|
449 |
* @param banda |
|
450 |
* Assigned band |
|
451 |
* @throws IOException |
|
452 |
*/ |
|
453 |
public void assignBand(int nBand, Band band) throws IOException, BandNotCompatibleException; |
|
454 |
|
|
455 |
/** |
|
456 |
* Gets a band from raster by reference. |
|
457 |
* @param nBand |
|
458 |
* Band number |
|
459 |
*/ |
|
460 |
public Band getBand(int nBand); |
|
461 |
|
|
462 |
/** |
|
463 |
* Gets a copy of one band from ra. |
|
464 |
* @param nBand |
|
465 |
* Band number |
|
466 |
*/ |
|
467 |
public Band getBandCopy(int nBand); |
|
468 |
|
|
469 |
/** |
|
470 |
* Gets all bands in an IRasterBand array by reference. |
|
471 |
* @return Array of IRasterBand |
|
472 |
*/ |
|
473 |
public Band[] getBands(); |
|
474 |
|
|
475 |
/** |
|
476 |
* Gets all bands in an IRasterBand array by reference. |
|
477 |
* @return ArrayList of IRasterBand |
|
478 |
*/ |
|
479 |
public ArrayList<Band> getBandList(); |
|
480 |
|
|
481 |
/** |
|
482 |
* Gets a buffer with only one band. The number of this band is specified with the parameter. |
|
483 |
* @param nBand |
|
484 |
* Band number |
|
485 |
* @throws IOException |
|
486 |
* @throws OperationNotSupportedException |
|
487 |
*/ |
|
488 |
public Buffer getBufferWithOneBand(int nBand) throws IOException, OperationNotSupportedException; |
|
489 |
|
|
490 |
/** |
|
491 |
* This method create a new band with the value in selected in |
|
492 |
* the parameter. Settings in the new band are readed from the existing |
|
493 |
* buffer. |
|
494 |
* @param defaultValue |
|
495 |
* Default value in new band |
|
496 |
* @throws OperationNotSupportedException |
|
497 |
*/ |
|
498 |
public Band createBand(double defaultValue) throws OperationNotSupportedException; |
|
499 |
|
|
500 |
/** |
|
501 |
* Replica la banda de una posici?n sobre otra. Si la banda de destino no existe |
|
502 |
* se crea nueva. Si la posici?n de la banda de destino est? intercalada entre bandas |
|
503 |
* que ya existen las otras se desplazan hacia abajo, NO se machacan los datos de ninguna. |
|
504 |
* Los datos se replican por referencia por lo que al modificar la banda original las |
|
505 |
* del resto quedar?n afectadas. |
|
506 |
* @param orig. Posici?n de la banda de origen. |
|
507 |
* @param dest. Posici?n de la banda destino |
|
508 |
* @throws IOException |
|
509 |
*/ |
|
510 |
public void replicateBand(int orig, int dest) throws IOException; |
|
511 |
|
|
512 |
/** |
|
513 |
* Clona el buffer actual y devuelve el clone |
|
514 |
* @return Buffer clonado |
|
515 |
*/ |
|
516 |
public Buffer cloneBuffer(); |
|
517 |
|
|
518 |
/** |
|
519 |
* Swap two bands. |
|
520 |
* @param band1 |
|
521 |
* band to swap with band2 |
|
522 |
* @param band2 |
|
523 |
* band to swap with band1 |
|
524 |
* @throws IOException |
|
525 |
* @throws WrongParameterException |
|
526 |
*/ |
|
527 |
public void swapBands(int band1, int band2) throws WrongParameterException, IOException; |
|
528 |
|
|
529 |
/** |
|
530 |
* Intercambia la posici?n de las bandas. La nueva posici?n viene dada por el vector |
|
531 |
* pasado por par?metro. Cada posici?n del vector es una banda del buffer y el contenido de |
|
532 |
* esa posici?n es la banda que se dibujar? sobre ese buffer. |
|
533 |
* <P> |
|
534 |
* Por ejemplo un array con los valores: |
|
535 |
* [2, 0, 1] significa que la banda que ocupa ahora la posici?n 2 pasar? a ocupar la 0, la que |
|
536 |
* tiene la posici?n 0 pasa a ocupar la 1 y la que tiene la posici?n 1 pasa a ocupar la 2. |
|
537 |
* </P> |
|
538 |
* @param bands Array con la nueva distribuci?n de bandas |
|
539 |
* @throws WrongParameterException |
|
540 |
* @throws IOException |
|
541 |
*/ |
|
542 |
public void swapBands(int[] bands) throws WrongParameterException, IOException; |
|
543 |
|
|
544 |
/** |
|
545 |
* Asigna el valor de no valido. |
|
546 |
* @param value |
|
547 |
*/ |
|
548 |
public void setNotValidValue(double value); |
|
549 |
|
|
550 |
/** |
|
551 |
* Obtiene el valor de no valido. |
|
552 |
* @return value |
|
553 |
*/ |
|
554 |
public double getNotValidValue(); |
|
555 |
|
|
556 |
/** |
|
557 |
* Asigna una banda al valor especificado como no valido. Esta banda es com?n para todas las bandas |
|
558 |
* del buffer, es decir se asigna por referencia. No tiene el mismo resultado que asignar una banda |
|
559 |
* a un valor fijo. |
|
560 |
* @param iBand N?mero de banda |
|
561 |
* @throws OperationNotSupportedException |
|
562 |
*/ |
|
563 |
public void assignBandToNotValid(int iBand) throws OperationNotSupportedException; |
|
564 |
|
|
565 |
/** |
|
566 |
* Gets the statistics object |
|
567 |
* @return BufferStats |
|
568 |
*/ |
|
569 |
public BufferStats getStatistics(); |
|
570 |
|
|
571 |
/** |
|
572 |
* Ajusta el ?rea del grid a un ancho y un alto dado en pixeles. Este ajuste se har? |
|
573 |
* en relaci?n a un m?todo de interpolaci?n definido en el par?metro. |
|
574 |
* @param w Ancho de la nueva imagen. |
|
575 |
* @param h Alto de la nueva imagen. |
|
576 |
* @param interpolation M?todo de interpolaci?n que se usar? en el ajuste. |
|
577 |
*/ |
|
578 |
public Buffer getAdjustedWindow(int w, int h, int interpolationMethod) throws ProcessInterruptedException; |
|
579 |
|
|
580 |
/** |
|
581 |
* Selects bands for read-only buffers which referencing a image in disk |
|
582 |
* @param bands |
|
583 |
*/ |
|
584 |
public void addDrawableBands(int[] bands); |
|
585 |
} |
|
0 | 586 |
org.gvsig.raster.cache/tags/org.gvsig.raster.cache-2.2.38/org.gvsig.raster.cache.lib.api/src/main/java/org/gvsig/raster/cache/buffer/histogram/BufferHistogram.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.histogram; |
|
23 |
|
|
24 |
import org.gvsig.raster.cache.buffer.BufferNoData; |
|
25 |
|
|
26 |
/** |
|
27 |
* Interfaz que representa un histograma. |
|
28 |
* |
|
29 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
30 |
*/ |
|
31 |
public interface BufferHistogram { |
|
32 |
/** |
|
33 |
* Obtiene el n?mero de bandas del histograma |
|
34 |
* @return entero que representa el n?mero de bandas |
|
35 |
*/ |
|
36 |
public int getNumBands(); |
|
37 |
|
|
38 |
/** |
|
39 |
* Obtiene la longitud (n?mero de valores) de una banda determinada |
|
40 |
* @param band Banda o obtener la longitud |
|
41 |
* @return entero con la longitud de la banda |
|
42 |
* rangos de valores y DataclassList. |
|
43 |
*/ |
|
44 |
public int getBandLenght(int band); |
|
45 |
|
|
46 |
/** |
|
47 |
* Obtiene el tipo de datos del histograma original |
|
48 |
* @return |
|
49 |
*/ |
|
50 |
public int getDataType(); |
|
51 |
|
|
52 |
/** |
|
53 |
* Asigna un valor para una posici?n del histograma segun la posicion en las |
|
54 |
* clases |
|
55 |
* @param band Valor del pixel o clase a asignar |
|
56 |
* @param pos Posicion dentro de la clase. Ejemplo 0..63 |
|
57 |
* @param value Valor a asignar |
|
58 |
*/ |
|
59 |
public void setHistogramValueByPos(int band, int pos, long value); |
|
60 |
|
|
61 |
/** |
|
62 |
* Obtiene un valor del histograma segun la posicion dentro de las clases |
|
63 |
* @param band N?mero de banda del valor a recuperar |
|
64 |
* @param px Pixel o valor de la clase del valor a recuperar |
|
65 |
* @return valor |
|
66 |
*/ |
|
67 |
public double getHistogramValueByPos(int band, int pos); |
|
68 |
|
|
69 |
/** |
|
70 |
* Obtiene un valor del histograma |
|
71 |
* @param band N?mero de banda del valor a recuperar |
|
72 |
* @param px Pixel o valor de la clase del valor a recuperar |
|
73 |
* @return valor |
|
74 |
*/ |
|
75 |
public double getHistogramValue(int band, double px); |
|
76 |
|
|
77 |
/** |
|
78 |
* Realiza la uni?n entre el histograma actual y el pasado |
|
79 |
* por par?metro. |
|
80 |
* @param hist |
|
81 |
*/ |
|
82 |
public boolean union(BufferHistogram hist); |
|
83 |
|
|
84 |
/** |
|
85 |
* Obtiene la tabla de valores |
|
86 |
* @return |
|
87 |
*/ |
|
88 |
public long[][] getTable(); |
|
89 |
|
|
90 |
/** |
|
91 |
* Asigna la tabla |
|
92 |
* @param t |
|
93 |
*/ |
|
94 |
public void setTable(long[][] t); |
|
95 |
|
|
96 |
/** |
|
97 |
* Obtiene el histograma sin modificar |
|
98 |
* @return array bidimensional donde el primer elemento es el valor del pixel |
|
99 |
* o rango y el segundo el n?mero de elementos que aparecen. |
|
100 |
*/ |
|
101 |
public HistogramClass[][] getHistogram(); |
|
102 |
|
|
103 |
/** |
|
104 |
* Obtiene el histograma de la imagen negativa. |
|
105 |
* @return long[][] |
|
106 |
*/ |
|
107 |
public long[][] getNegativeTable(); |
|
108 |
|
|
109 |
/** |
|
110 |
* Devuelve el minimo valor del histograma |
|
111 |
* @return |
|
112 |
*/ |
|
113 |
public double getMin(int band); |
|
114 |
|
|
115 |
/** |
|
116 |
* Devuelve el maximo valor del histograma |
|
117 |
* @return |
|
118 |
*/ |
|
119 |
public double getMax(int band); |
|
120 |
|
|
121 |
/** |
|
122 |
* Obtiene el n?mero de valores o clases del histograma |
|
123 |
* @return entero que representa el n?mero de valores o clases del histograma |
|
124 |
*/ |
|
125 |
public int getNumValues(); |
|
126 |
|
|
127 |
/** |
|
128 |
* Devuelve si un histograma esta en un rango RGB aceptable |
|
129 |
* @return |
|
130 |
*/ |
|
131 |
public boolean isInRangeRGB(); |
|
132 |
|
|
133 |
/** |
|
134 |
* Calculo de estad?sticas a partir de un histograma. El resultado de la funci?n es un array |
|
135 |
* bidimensional donde el primer ?ndice inndica la estadistica y el segundo el n?mero de banda. |
|
136 |
* |
|
137 |
* <UL> |
|
138 |
* <LI>m?nimo</LI> |
|
139 |
* <LI>m?ximo</LI> |
|
140 |
* <LI>media</LI> |
|
141 |
* <LI>mediana</LI> |
|
142 |
* <LI>N?mero de pixels</LI> |
|
143 |
* </UL> |
|
144 |
* @param histogram |
|
145 |
* @param beginPos Posici?n de inicio del histograma para contabilizar estadisticas |
|
146 |
* @param endPos Posici?n de fin del histograma para contabilizar estadisticas |
|
147 |
* @param bandas solicitadas. Cada elemento del vector representa una banda. Si est? a true se calcula la |
|
148 |
* estadistica para esa banda y si est? a false no se calcular?. |
|
149 |
* @return |
|
150 |
*/ |
|
151 |
public double[][] getBasicStats(double beginPos2, double endPos2, boolean[] bands); |
|
152 |
|
|
153 |
/** |
|
154 |
* Calculo de estad?sticas a partir de un histograma. El resultado de la funci?n es un array |
|
155 |
* bidimensional donde el primer ?ndice inndica la estadistica y el segundo el n?mero de banda. |
|
156 |
* |
|
157 |
* <UL> |
|
158 |
* <LI>m?nimo</LI> |
|
159 |
* <LI>m?ximo</LI> |
|
160 |
* <LI>media</LI> |
|
161 |
* <LI>mediana</LI> |
|
162 |
* <LI>N?mero de pixels</LI> |
|
163 |
* </UL> |
|
164 |
* @param histogram |
|
165 |
* @param bandas solicitadas. Cada elemento del vector representa una banda. Si est? a true se calcula la |
|
166 |
* estadistica para esa banda y si est? a false no se calcular?. |
|
167 |
* @return |
|
168 |
*/ |
|
169 |
public double[][] getBasicStats(boolean[] bands); |
|
170 |
|
|
171 |
/** |
Also available in: Unified diff