Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.buffer.api / src / main / java / org / gvsig / raster / lib / buffer / api / Band.java @ 44831

History | View | Annotate | Download (7.43 KB)

1
/* 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
import org.gvsig.raster.lib.buffer.api.exceptions.BandException;
26
import org.gvsig.tools.dispose.Disposable;
27
import org.gvsig.tools.lang.Cloneable;
28
import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
29

    
30
/**
31
 * @author fdiaz
32
 *
33
 */
34
public interface Band extends Cloneable, ComplexWeakReferencingObservable, Disposable {
35

    
36
    /**
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
     * The possible data types are defined in {@link BufferManager}.
54
     *
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
     * Gets the NoData value
63
     *
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
     * Gets the corresponding value to a row and column of the band as a Double.
79
     * return null if the value is the NoData value.
80
     *
81
     * @param row
82
     * @param column
83
     * @return
84
     */
85
    public Double getAsDouble(int row, int column);
86

    
87
    /**
88
     * Set the value in the row and column of the band.
89
     *
90
     * @param row
91
     * @param column
92
     * @param value
93
     */
94
    public void set(int row, int column, Object value);
95

    
96
    /**
97
     * Fills the band with a unique value.
98
     *
99
     * If the value is null, fills with NoData value. If NoData is undefined, do
100
     * nothing.
101
     *
102
     * @param value
103
     */
104
    public void fill(Object value);
105

    
106
    /**
107
     * Fills this band with a copy of the source data band.
108
     *
109
     * @param source
110
     * @throws BandException
111
     */
112
    public void copyFrom(Band source) throws BandException;
113

    
114
    /**
115
     * Fills a sector of this band with a copy of the source band data from a position.
116
     *
117
     * @param source
118
     * @param row
119
     * @param column
120
     * @throws BandException
121
     */
122
    public void copyFrom(Band source, int row, int column) throws BandException;
123

    
124
    /**
125
     * Creates an array of corresponding data type.
126
     *
127
     * The size of the array is the width of the band.
128
     *
129
     * @return an array of corresponding data type.
130
     */
131
    public Object createRowBuffer();
132

    
133
    /**
134
     * Fills the rowBuffer Object with the row.
135
     *
136
     * @param row
137
     * @param rowBuffer
138
     */
139
    public void fetchRow(int row, Object rowBuffer);
140

    
141
    /**
142
     * Fills the row with the rowBuffer
143
     *
144
     * @param row
145
     * @param rowBuffer
146
     */
147
    public void putRow(int row, Object rowBuffer);
148

    
149
    /**
150
     *
151
     * @return true if is paginated
152
     */
153
    public boolean isPaginated();
154

    
155
    /**
156
     * @return If supports writing or not
157
     */
158
    public boolean isReadOnly();
159

    
160
    /**
161
     * Gets information about the specified band. If band does not have
162
     * information, it will return <code>null</code>
163
     *
164
     * @param band
165
     *            The specified band
166
     * @return Returns information about specified band.
167
     */
168
    public BandInfo getBandInfo();
169

    
170
    /**
171
     * A Band which elements are bytes.
172
     *
173
     * @author fdiaz
174
     *
175
     */
176
    public interface BandByte extends Band {
177

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

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

    
196
        public byte[] createRowBuffer();
197

    
198

    
199
    }
200

    
201
    /**
202
     * A Band which elements are shorts.
203
     *
204
     * @author fdiaz
205
     *
206
     */
207
    public interface BandShort extends Band {
208

    
209
        /**
210
         * Gets the corresponding value to the row and column;
211
         *
212
         * @param row
213
         * @param column
214
         * @return a short;
215
         */
216
        public short getValue(int row, int column);
217

    
218
        /**
219
         * Sets the value in the row and column;
220
         *
221
         * @param row
222
         * @param column
223
         * @param value
224
         */
225
        public void setValue(int row, int column, short value);
226

    
227
        public short[] createRowBuffer();
228

    
229

    
230
    }
231

    
232
    /**
233
     * A Band which elements are integers.
234
     *
235
     * @author fdiaz
236
     *
237
     */
238
    public interface BandInt extends Band {
239

    
240
        /**
241
         * Gets the corresponding value to the row and column;
242
         *
243
         * @param row
244
         * @param column
245
         * @return a int;
246
         */
247
        public int getValue(int row, int column);
248

    
249
        /**
250
         * Sets the value in the row and column;
251
         *
252
         * @param row
253
         * @param column
254
         * @param value
255
         */
256
        public void setValue(int row, int column, int value);
257

    
258
        public int[] createRowBuffer();
259

    
260

    
261
    }
262

    
263
    /**
264
     * A Band which elements are floats.
265
     *
266
     * @author fdiaz
267
     *
268
     */
269
    public interface BandFloat extends Band {
270

    
271
        /**
272
         * Gets the corresponding value to the row and column;
273
         *
274
         * @param row
275
         * @param column
276
         * @return a byte;
277
         */
278
        public float getValue(int row, int column);
279

    
280
        /**
281
         * Sets the value in the row and column;
282
         *
283
         * @param row
284
         * @param column
285
         * @param value
286
         */
287
        public void setValue(int row, int column, float value);
288

    
289
        public float[] createRowBuffer();
290

    
291

    
292
    }
293

    
294
    /**
295
     * A Band which elements are doubles.
296
     *
297
     * @author fdiaz
298
     *
299
     */
300
    public interface BandDouble extends Band {
301

    
302
        /**
303
         * Gets the corresponding value to the row and column;
304
         *
305
         * @param row
306
         * @param column
307
         * @return a byte;
308
         */
309
        public double getValue(int row, int column);
310

    
311
        /**
312
         * Sets the value in the row and column;
313
         *
314
         * @param row
315
         * @param column
316
         * @param value
317
         */
318
        public void setValue(int row, int column, double value);
319

    
320
        public double[] createRowBuffer();
321

    
322
    }
323

    
324
}