Statistics
| Revision:

svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / 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 / Buffer.java @ 43876

History | View | Annotate | Download (6.99 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

    
26
import java.awt.image.BufferedImage;
27

    
28
import org.cresques.cts.ICoordTrans;
29
import org.cresques.cts.IProjection;
30

    
31
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
32
import org.gvsig.fmap.geom.primitive.Envelope;
33
import org.gvsig.fmap.geom.primitive.Point;
34
import org.gvsig.raster.lib.buffer.api.Band.BandByte;
35
import org.gvsig.raster.lib.buffer.api.Band.BandDouble;
36
import org.gvsig.raster.lib.buffer.api.Band.BandFloat;
37
import org.gvsig.raster.lib.buffer.api.Band.BandInt;
38
import org.gvsig.raster.lib.buffer.api.Band.BandShort;
39
import org.gvsig.raster.lib.buffer.api.exceptions.BandException;
40
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException;
41
import org.gvsig.raster.lib.buffer.api.statistics.StatisticsCapable;
42
import org.gvsig.tools.dispose.Disposable;
43
import org.gvsig.tools.locator.LocatorException;
44
import org.gvsig.tools.observer.Observer;
45
import org.gvsig.tools.task.SimpleTaskStatus;
46

    
47
/**
48
 * @author fdiaz
49
 *
50
 */
51
public interface Buffer extends StatisticsCapable, Iterable<Band>, Observer , Disposable {
52

    
53
    public final static int INTERPOLATION_Undefined        = 0;
54
    public final static int INTERPOLATION_NearestNeighbour = 1;
55
    public final static int INTERPOLATION_Bilinear         = 2;
56
    public final static int INTERPOLATION_InverseDistance  = 3;
57
    public final static int INTERPOLATION_BicubicSpline    = 4;
58
    public final static int INTERPOLATION_BSpline          = 5;
59

    
60
//    /**
61
//     * Adds a filter list to buffer
62
//     *
63
//     * @param filterList
64
//     */
65
//    public void filter(FilterList filterList);
66

    
67
    /**
68
     * @return Number of buffer bands
69
     */
70
    public int getBandCount();
71

    
72
    /**
73
     * @return Bands of buffer
74
     */
75
    public Band[] getBands();
76

    
77
    public BandInfo[] getBandsInfo();
78

    
79
    /**
80
     * @return the number of columns
81
     */
82
    public int getColumns();
83

    
84
    /**
85
     * @return the number of rows
86
     */
87
    public int getRows();
88

    
89
    /**
90
     * @return Envelope of this buffer
91
     * @throws CreateEnvelopeException
92
     * @throws LocatorException
93
     */
94
    public Envelope getEnvelope() throws LocatorException, CreateEnvelopeException;
95

    
96
    /**
97
     * @return Projection of buffer
98
     */
99
    public IProjection getProjection();
100

    
101
    /**
102
     * Returns true if passed as parameter cell is inside of the buffer, else returns false.
103
     *
104
     * @param cellX Cell's x position
105
     * @param cellY Cell's y position
106
     * @return true if cell is inside, false if it is outside
107
     */
108
    public boolean isInside(int cellX, int cellY);
109

    
110
    /**
111
     * Returns true if passed as parameter point is inside of the buffer, else returns false.
112
     *
113
     * @param point
114
     * @return true if point is inside of this
115
     */
116
    public boolean isInside(Point point);
117

    
118

    
119
    /**
120
     * Adds a band
121
     *
122
     * @param band
123
     */
124
    public void addBand(Band band);
125

    
126
    /**
127
     * Sets a band in the "pos" position
128
     *
129
     * @param pos
130
     * @param band
131
     * @throws BandException
132
     */
133
    public void setBand(int pos, Band band) throws BandException;
134

    
135
    /**
136
     * Removes the band in the "pos" position
137
     *
138
     * @param pos
139
     */
140
    public void removeBand(int pos);
141

    
142
    /**
143
     * Gets the band in the "pos" position
144
     *
145
     * @param pos
146
     * @return return the band in the "pos" position
147
     */
148
    public Band getBand(int pos);
149

    
150
    /**
151
     *
152
     * @param pos
153
     * @return return the band in the "pos" position if the band is of type byte
154
     */
155
    public BandByte getBandByte(int pos);
156

    
157
    /**
158
     * @param pos
159
     * @return return the band in the "pos" position if the band is of type short
160
     */
161
    public BandShort getBandShort(int pos);
162

    
163
    /**
164
     * @param pos
165
     * @return return the band in the"pos" position if the band is of type int
166
     */
167
    public BandInt getBandInt(int pos);
168

    
169
    /**
170
     * @param pos
171
     * @return return the band in the "pos" position if the band is of type float
172
     */
173
    public BandFloat getBandFloat(int pos);
174

    
175
    /**
176
     * @param pos
177
     * @return return the band in the "pos" position if the band is of type double
178
     */
179
    public BandDouble getBandDouble(int pos);
180

    
181
    /**
182
     * Switches the bands as indicated by the parameter
183
     *
184
     * @param positions
185
     */
186
    public void switchBands(int[] positions);
187

    
188
    /**
189
     * Switches two bands
190
     *
191
     * @param pos1
192
     * @param pos2
193
     */
194
    public void switchBands(int pos1, int pos2);
195

    
196
    /**
197
     * Creates a interpolated buffer
198
     *
199
     * @param rows
200
     * @param columns
201
     * @param interpolationMode
202
     * @param status
203
     * @return a interpolated Buffer according the interpolation mode
204
     * @throws BufferException
205
     * @throws LocatorException
206
     */
207
    public Buffer createInterpolated(int rows, int columns, int interpolationMode, SimpleTaskStatus status) throws LocatorException, BufferException;
208

    
209
    /**
210
     * Converts buffer using specified coordinate transformation
211
     *
212
     * @param ct
213
     *            Coordinate transformation to convert buffer
214
     * @param status
215
     * @return New converted buffer.
216
     * @throws BufferException If there are problems converting buffer
217
     */
218
    public Buffer convert(ICoordTrans ct, SimpleTaskStatus status) throws BufferException;
219

    
220
    /**
221
     * @return Gets band types of buffer bands
222
     */
223
    public int[] getBandTypes();
224

    
225
    public boolean areAllBandsOfTheSameType();
226
    
227
    /**
228
     * @return Gets NoData object from buffer bands
229
     */
230
    public NoData[] getBandNoData();
231

    
232
    /**
233
     * @param envelope
234
     * @return A clip of buffer
235
     * @throws BufferException
236
     */
237
    public Buffer clip(Envelope envelope) throws BufferException;
238

    
239
    /**
240
     * @return Returns X pixel of this buffer.
241
     * @deprecated use getDimensions().getPixelSizeX()
242
     */
243
    public double getPixelSizeX();
244

    
245
    /**
246
     * @return Returns Y pixel of this buffer.
247
     * @deprecated use getDimensions().getPixelSizeY()
248
     */
249
    public double getPixelSizeY();
250

    
251
    /**
252
     * @return
253
     */
254
    BufferedImage getBufferedImage();
255

    
256
    /**
257
     * @return
258
     */
259
    public BufferDimensions getDimensions();
260

    
261

    
262
}