Revision 5441 org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer/org.gvsig.raster.lib.buffer.api/src/main/java/org/gvsig/raster/lib/buffer/api/Band.java

View differences:

Band.java
22 22
 */
23 23
package org.gvsig.raster.lib.buffer.api;
24 24

  
25
import org.gvsig.tools.lang.Cloneable;
25 26

  
26 27
/**
27 28
 * @author fdiaz
28 29
 *
29 30
 */
30
public interface Band {
31
public interface Band extends Cloneable {
31 32

  
33
    /**
34
     * Gets the number of columns of the band
35
     *
36
     * @return the number of columns of the band
37
     */
38
    public int getColumns();
39

  
40
    /**
41
     * Gets the number of rows of the band
42
     *
43
     * @return the number of rows of the band
44
     */
45
    public int getRows();
46

  
47
    /**
48
     * Gets the dataType.
49
     *
50
     * The possible data types are defined in BufferManager
51
     *
52
     * The data type of the band can't be changed after being created.
53
     *
54
     * @return the data type
55
     */
56
    public int getDataType();
57

  
58
    /**
59
     *Gets the NoData value
60
     *
61
     * @return the noData of the band. Can't be null;
62
     */
63
    public NoData getNoData();
64

  
65
    /**
66
     * Gets the corresponding value to a row and column of the band
67
     *
68
     * @param row
69
     * @param column
70
     * @return value of corresponding data type.
71
     */
72
    public Object get(int row, int column);
73

  
74
    /**
75
     * Set the value in the row and column of the band.
76
     *
77
     * @param row
78
     * @param column
79
     * @param value
80
     */
81
    public void set(int row, int column, Object value);
82

  
83
    /**
84
     * Fills the band with a unique value.
85
     *
86
     * If the value is null, fills with NoData
87
     *
88
     * @param value
89
     */
90
    public void fill(Object value);
91

  
92
    /**
93
     * Fills this band with a copy of the source data band.
94
     *
95
     * @param source
96
     */
97
    public void copyFrom(Band source);
98

  
99
    /**
100
     * Creates an array of corresponding data type.
101
     *
102
     * The size of the array is the width of the band.
103
     *
104
     * @return an array of corresponding data type.
105
     */
106
    public Object createRowBuffer();
107

  
108
    /**
109
     * Fills the rowBuffer Object with the row.
110
     *
111
     * @param row
112
     * @param rowBuffer
113
     */
114
    public void fetchRow(int row, Object rowBuffer);
115

  
116
    /**
117
     * Fills the row with the rowBuffer
118
     *
119
     * @param row
120
     * @param rowBuffer
121
     */
122
    public void putRow(int row, Object rowBuffer);
123

  
124
    /**
125
     * A Band which elements are bytes.
126
     *
127
     * @author fdiaz
128
     *
129
     */
130
    public interface BandByte extends Band {
131

  
132
        /**
133
         * Gets the corresponding value to the row and column;
134
         *
135
         * @param row
136
         * @param column
137
         * @return a byte;
138
         */
139
        public byte getValue(int row, int column);
140

  
141
        /**
142
         * Sets the value in the row and column;
143
         *
144
         * @param row
145
         * @param column
146
         * @param value
147
         */
148
        public void setValue(int row, int column, byte value);
149

  
150
        /**
151
         * Gets a row of the Band.
152
         * @param row
153
         *
154
         * @return an array of bytes.
155
         */
156
        public byte[] getRowValues(int row);
157

  
158
        /**
159
         * Sets a row to the band
160
         *
161
         * @param row
162
         *            Row number
163
         * @param values
164
         *            byte array
165
         */
166
        public void setRowValues(int row, byte[] values);
167
    }
168

  
169
    /**
170
     * A Band which elements are shorts.
171
     *
172
     * @author fdiaz
173
     *
174
     */
175
    public interface BandShort extends Band {
176

  
177
        /**
178
         * Gets the corresponding value to the row and column;
179
         *
180
         * @param row
181
         * @param column
182
         * @return a short;
183
         */
184
        public short getValue(int row, int column);
185

  
186
        /**
187
         * Sets the value in the row and column;
188
         *
189
         * @param row
190
         * @param column
191
         * @param value
192
         */
193
        public void setValue(int row, int column, short value);
194

  
195
        /**
196
         * Gets a row of the Band.
197
         *
198
         * @param row
199
         * @return an array of shorts
200
         */
201
        public short[] getRowValues(int row);
202

  
203
        /**
204
         * Sets a row to the band
205
         *
206
         * @param row
207
         *            Row number
208
         * @param values
209
         *            byte array
210
         */
211
        public void setRowValues(int row, short[] values);
212
    }
213

  
214
    /**
215
     * A Band which elements are ints.
216
     *
217
     * @author fdiaz
218
     *
219
     */
220
    public interface BandInt extends Band {
221

  
222
        /**
223
         * Gets the corresponding value to the row and column;
224
         *
225
         * @param row
226
         * @param column
227
         * @return a int;
228
         */
229
        public int getValue(int row, int column);
230

  
231
        /**
232
         * Sets the value in the row and column;
233
         *
234
         * @param row
235
         * @param column
236
         * @param value
237
         */
238
        public void setValue(int row, int column, int value);
239

  
240
        /**
241
         * Gets a row of the Band.
242
         * @param row
243
         *
244
         * @return an array of ints
245
         */
246
        public int[] getRowValues(int row);
247

  
248
        /**
249
         * Sets a row to the band
250
         *
251
         * @param row
252
         *            Row number
253
         * @param values
254
         *            byte array
255
         */
256
        public void setRowValues(int row, int[] values);
257
    }
258

  
259
    /**
260
     * A Band which elements are floats.
261
     *
262
     * @author fdiaz
263
     *
264
     */
265
    public interface BandFloat extends Band {
266

  
267
        /**
268
         * Gets the corresponding value to the row and column;
269
         *
270
         * @param row
271
         * @param column
272
         * @return a byte;
273
         */
274
        public float getValue(int row, int column);
275

  
276
        /**
277
         * Sets the value in the row and column;
278
         *
279
         * @param row
280
         * @param column
281
         * @param value
282
         */
283
        public void setValue(int row, int column, float value);
284

  
285
        /**
286
         * Gets a row of the Band.
287
         * @param row
288
         *
289
         * @return an array of floats
290
         */
291
        public float[] getRowValues(int row);
292

  
293
        /**
294
         * Sets a row to the band
295
         *
296
         * @param row
297
         *            Row number
298
         * @param values
299
         *            byte array
300
         */
301
        public void setRowValues(int row, float[] values);
302
    }
303

  
304
    /**
305
     * A Band which elements are double.
306
     *
307
     * @author fdiaz
308
     *
309
     */
310
    public interface BandDouble extends Band {
311

  
312
        /**
313
         * Gets the corresponding value to the row and column;
314
         *
315
         * @param row
316
         * @param column
317
         * @return a byte;
318
         */
319
        public double getValue(int row, int column);
320

  
321
        /**
322
         * Sets the value in the row and column;
323
         *
324
         * @param row
325
         * @param column
326
         * @param value
327
         */
328
        public void setValue(int row, int column, double value);
329

  
330
        /**
331
         * Gets a row of the Band.
332
         * @param row
333
         *
334
         * @return an array of doubles
335
         */
336
        public double[] getRowValues(int row);
337

  
338
        /**
339
         * Sets a row to the band
340
         *
341
         * @param row
342
         *            Row number
343
         * @param values
344
         *            byte array
345
         */
346
        public void setRowValues(int row, double[] values);
347
    }
348

  
32 349
}

Also available in: Unified diff