Statistics
| Revision:

gvsig-raster / 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 @ 8781

History | View | Annotate | Download (7.17 KB)

1 5439 fdiaz
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2016 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.lib.buffer.api;
24
25 5452 dmartinezizquierdo
import org.gvsig.raster.lib.buffer.api.exceptions.BandException;
26 6493 fdiaz
import org.gvsig.tools.dispose.Disposable;
27 5441 fdiaz
import org.gvsig.tools.lang.Cloneable;
28 5535 fdiaz
import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
29 5439 fdiaz
30
/**
31
 * @author fdiaz
32
 *
33
 */
34 6494 fdiaz
public interface Band extends Cloneable, ComplexWeakReferencingObservable, Disposable {
35 5439 fdiaz
36 5441 fdiaz
    /**
37
     * Gets the number of columns of the band
38
     *
39
     * @return the number of columns of the band
40
     */
41
    public int getColumns();
42
43
    /**
44
     * Gets the number of rows of the band
45
     *
46
     * @return the number of rows of the band
47
     */
48
    public int getRows();
49
50
    /**
51
     * Gets the dataType.
52
     *
53 5483 llmarques
     * The possible data types are defined in {@link BufferManager}.
54 5441 fdiaz
     *
55
     * The data type of the band can't be changed after being created.
56
     *
57
     * @return the data type
58
     */
59
    public int getDataType();
60
61
    /**
62 5483 llmarques
     * Gets the NoData value
63 5441 fdiaz
     *
64
     * @return the noData of the band. Can't be null;
65
     */
66
    public NoData getNoData();
67
68
    /**
69
     * Gets the corresponding value to a row and column of the band
70
     *
71
     * @param row
72
     * @param column
73
     * @return value of corresponding data type.
74
     */
75
    public Object get(int row, int column);
76
77
    /**
78
     * Set the value in the row and column of the band.
79
     *
80
     * @param row
81
     * @param column
82
     * @param value
83
     */
84
    public void set(int row, int column, Object value);
85
86
    /**
87
     * Fills the band with a unique value.
88
     *
89 5483 llmarques
     * If the value is null, fills with NoData value. If NoData is undefined, do
90
     * nothing.
91 5441 fdiaz
     *
92
     * @param value
93
     */
94
    public void fill(Object value);
95
96
    /**
97
     * Fills this band with a copy of the source data band.
98
     *
99
     * @param source
100 5483 llmarques
     * @throws BandException
101 5441 fdiaz
     */
102 5452 dmartinezizquierdo
    public void copyFrom(Band source) throws BandException;
103 5441 fdiaz
104
    /**
105 6538 fdiaz
     * Fills a sector of this band with a copy of the source band data from a position.
106
     *
107
     * @param source
108
     * @param row
109
     * @param column
110
     * @throws BandException
111
     */
112
    public void copyFrom(Band source, int row, int column) throws BandException;
113
114
    /**
115 5441 fdiaz
     * Creates an array of corresponding data type.
116
     *
117
     * The size of the array is the width of the band.
118
     *
119
     * @return an array of corresponding data type.
120
     */
121
    public Object createRowBuffer();
122
123
    /**
124
     * Fills the rowBuffer Object with the row.
125
     *
126
     * @param row
127
     * @param rowBuffer
128
     */
129
    public void fetchRow(int row, Object rowBuffer);
130
131
    /**
132
     * Fills the row with the rowBuffer
133
     *
134
     * @param row
135
     * @param rowBuffer
136
     */
137
    public void putRow(int row, Object rowBuffer);
138
139
    /**
140 5527 fdiaz
     *
141
     * @return true if is paginated
142 5515 fdiaz
     */
143 5527 fdiaz
    public boolean isPaginated();
144
145
    /**
146
     * @return If supports writing or not
147
     */
148 5515 fdiaz
    public boolean isReadOnly();
149 6493 fdiaz
150 6302 llmarques
    /**
151 6303 llmarques
     * Gets information about the specified band. If band does not have
152
     * information, it will return <code>null</code>
153 6493 fdiaz
     *
154 6303 llmarques
     * @param band
155
     *            The specified band
156
     * @return Returns information about specified band.
157 6302 llmarques
     */
158
    public BandInfo getBandInfo();
159 5515 fdiaz
160
    /**
161 5441 fdiaz
     * A Band which elements are bytes.
162
     *
163
     * @author fdiaz
164
     *
165
     */
166
    public interface BandByte extends Band {
167
168
        /**
169
         * Gets the corresponding value to the row and column;
170
         *
171
         * @param row
172
         * @param column
173
         * @return a byte;
174
         */
175
        public byte getValue(int row, int column);
176
177
        /**
178
         * Sets the value in the row and column;
179
         *
180
         * @param row
181
         * @param column
182
         * @param value
183
         */
184
        public void setValue(int row, int column, byte value);
185
186 5515 fdiaz
        public byte[] createRowBuffer();
187
188
189 5441 fdiaz
    }
190
191
    /**
192
     * A Band which elements are shorts.
193
     *
194
     * @author fdiaz
195
     *
196
     */
197
    public interface BandShort extends Band {
198
199
        /**
200
         * Gets the corresponding value to the row and column;
201
         *
202
         * @param row
203
         * @param column
204
         * @return a short;
205
         */
206
        public short getValue(int row, int column);
207
208
        /**
209
         * Sets the value in the row and column;
210
         *
211
         * @param row
212
         * @param column
213
         * @param value
214
         */
215
        public void setValue(int row, int column, short value);
216
217 5515 fdiaz
        public short[] createRowBuffer();
218
219
220 5441 fdiaz
    }
221
222
    /**
223 5483 llmarques
     * A Band which elements are integers.
224 5441 fdiaz
     *
225
     * @author fdiaz
226
     *
227
     */
228
    public interface BandInt extends Band {
229
230
        /**
231
         * Gets the corresponding value to the row and column;
232
         *
233
         * @param row
234
         * @param column
235
         * @return a int;
236
         */
237
        public int getValue(int row, int column);
238
239
        /**
240
         * Sets the value in the row and column;
241
         *
242
         * @param row
243
         * @param column
244
         * @param value
245
         */
246
        public void setValue(int row, int column, int value);
247
248 5515 fdiaz
        public int[] createRowBuffer();
249
250
251 5441 fdiaz
    }
252
253
    /**
254
     * A Band which elements are floats.
255
     *
256
     * @author fdiaz
257
     *
258
     */
259
    public interface BandFloat extends Band {
260
261
        /**
262
         * Gets the corresponding value to the row and column;
263
         *
264
         * @param row
265
         * @param column
266
         * @return a byte;
267
         */
268
        public float getValue(int row, int column);
269
270
        /**
271
         * Sets the value in the row and column;
272
         *
273
         * @param row
274
         * @param column
275
         * @param value
276
         */
277
        public void setValue(int row, int column, float value);
278
279 5515 fdiaz
        public float[] createRowBuffer();
280
281
282 5441 fdiaz
    }
283
284
    /**
285 5483 llmarques
     * A Band which elements are doubles.
286 5441 fdiaz
     *
287
     * @author fdiaz
288
     *
289
     */
290
    public interface BandDouble extends Band {
291
292
        /**
293
         * Gets the corresponding value to the row and column;
294
         *
295
         * @param row
296
         * @param column
297
         * @return a byte;
298
         */
299
        public double getValue(int row, int column);
300
301
        /**
302
         * Sets the value in the row and column;
303
         *
304
         * @param row
305
         * @param column
306
         * @param value
307
         */
308
        public void setValue(int row, int column, double value);
309
310 5515 fdiaz
        public double[] createRowBuffer();
311
312 5441 fdiaz
    }
313
314 5439 fdiaz
}