Statistics
| Revision:

gvsig-raster / org.gvsig.raster.cache / trunk / org.gvsig.raster.cache / org.gvsig.raster.cache.lib.api / src / main / java / org / gvsig / raster / cache / buffer / Band.java @ 991

History | View | Annotate | Download (13.2 KB)

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
}