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 @ 6302

History | View | Annotate | Download (6.8 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.lang.Cloneable;
27
import org.gvsig.tools.observer.ComplexWeakReferencingObservable;
28

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

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

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

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

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

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

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

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

    
95
    /**
96
     * Fills this band with a copy of the source data band.
97
     *
98
     * @param source
99
     * @throws BandException
100
     */
101
    public void copyFrom(Band source) throws BandException;
102

    
103
    /**
104
     * Creates an array of corresponding data type.
105
     *
106
     * The size of the array is the width of the band.
107
     *
108
     * @return an array of corresponding data type.
109
     */
110
    public Object createRowBuffer();
111

    
112
    /**
113
     * Fills the rowBuffer Object with the row.
114
     *
115
     * @param row
116
     * @param rowBuffer
117
     */
118
    public void fetchRow(int row, Object rowBuffer);
119

    
120
    /**
121
     * Fills the row with the rowBuffer
122
     *
123
     * @param row
124
     * @param rowBuffer
125
     */
126
    public void putRow(int row, Object rowBuffer);
127

    
128
    /**
129
     *
130
     * @return true if is paginated
131
     */
132
    public boolean isPaginated();
133

    
134
    /**
135
     * @return If supports writing or not
136
     */
137
    public boolean isReadOnly();
138
    
139
    /**
140
     * Gets information about this band.
141
     * 
142
     * @return A {@link BandInfo} with information about band. If there is not
143
     *         Band information, this method will return <code>null</code>
144
     */
145
    public BandInfo getBandInfo();
146

    
147
    /**
148
     * A Band which elements are bytes.
149
     *
150
     * @author fdiaz
151
     *
152
     */
153
    public interface BandByte extends Band {
154

    
155
        /**
156
         * Gets the corresponding value to the row and column;
157
         *
158
         * @param row
159
         * @param column
160
         * @return a byte;
161
         */
162
        public byte getValue(int row, int column);
163

    
164
        /**
165
         * Sets the value in the row and column;
166
         *
167
         * @param row
168
         * @param column
169
         * @param value
170
         */
171
        public void setValue(int row, int column, byte value);
172

    
173
        public byte[] createRowBuffer();
174

    
175

    
176
    }
177

    
178
    /**
179
     * A Band which elements are shorts.
180
     *
181
     * @author fdiaz
182
     *
183
     */
184
    public interface BandShort extends Band {
185

    
186
        /**
187
         * Gets the corresponding value to the row and column;
188
         *
189
         * @param row
190
         * @param column
191
         * @return a short;
192
         */
193
        public short getValue(int row, int column);
194

    
195
        /**
196
         * Sets the value in the row and column;
197
         *
198
         * @param row
199
         * @param column
200
         * @param value
201
         */
202
        public void setValue(int row, int column, short value);
203

    
204
        public short[] createRowBuffer();
205

    
206

    
207
    }
208

    
209
    /**
210
     * A Band which elements are integers.
211
     *
212
     * @author fdiaz
213
     *
214
     */
215
    public interface BandInt extends Band {
216

    
217
        /**
218
         * Gets the corresponding value to the row and column;
219
         *
220
         * @param row
221
         * @param column
222
         * @return a int;
223
         */
224
        public int getValue(int row, int column);
225

    
226
        /**
227
         * Sets the value in the row and column;
228
         *
229
         * @param row
230
         * @param column
231
         * @param value
232
         */
233
        public void setValue(int row, int column, int value);
234

    
235
        public int[] createRowBuffer();
236

    
237

    
238
    }
239

    
240
    /**
241
     * A Band which elements are floats.
242
     *
243
     * @author fdiaz
244
     *
245
     */
246
    public interface BandFloat extends Band {
247

    
248
        /**
249
         * Gets the corresponding value to the row and column;
250
         *
251
         * @param row
252
         * @param column
253
         * @return a byte;
254
         */
255
        public float getValue(int row, int column);
256

    
257
        /**
258
         * Sets the value in the row and column;
259
         *
260
         * @param row
261
         * @param column
262
         * @param value
263
         */
264
        public void setValue(int row, int column, float value);
265

    
266
        public float[] createRowBuffer();
267

    
268

    
269
    }
270

    
271
    /**
272
     * A Band which elements are doubles.
273
     *
274
     * @author fdiaz
275
     *
276
     */
277
    public interface BandDouble extends Band {
278

    
279
        /**
280
         * Gets the corresponding value to the row and column;
281
         *
282
         * @param row
283
         * @param column
284
         * @return a byte;
285
         */
286
        public double getValue(int row, int column);
287

    
288
        /**
289
         * Sets the value in the row and column;
290
         *
291
         * @param row
292
         * @param column
293
         * @param value
294
         */
295
        public void setValue(int row, int column, double value);
296

    
297
        public double[] createRowBuffer();
298

    
299

    
300
    }
301

    
302
}