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 / BufferManager.java @ 6302
History | View | Annotate | Download (9.41 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 java.awt.image.DataBuffer; |
26 |
import java.io.File; |
27 |
import java.io.IOException; |
28 |
import java.util.List; |
29 |
import java.util.Map; |
30 |
|
31 |
import org.cresques.cts.IProjection; |
32 |
import org.gvsig.fmap.geom.primitive.Envelope; |
33 |
import org.gvsig.raster.lib.buffer.api.exceptions.BandException; |
34 |
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException; |
35 |
|
36 |
/**
|
37 |
* @author fdiaz
|
38 |
*
|
39 |
*/
|
40 |
public interface BufferManager { |
41 |
|
42 |
public final static int TYPE_UNDEFINED = DataBuffer.TYPE_UNDEFINED; |
43 |
public final static int TYPE_BYTE = DataBuffer.TYPE_BYTE; |
44 |
public final static int TYPE_SHORT = DataBuffer.TYPE_SHORT; |
45 |
public final static int TYPE_USHORT = DataBuffer.TYPE_USHORT; |
46 |
public final static int TYPE_INT = DataBuffer.TYPE_INT; |
47 |
public final static int TYPE_FLOAT = DataBuffer.TYPE_FLOAT; |
48 |
public final static int TYPE_DOUBLE = DataBuffer.TYPE_DOUBLE; |
49 |
|
50 |
/**
|
51 |
* Creates a NoData object.
|
52 |
*
|
53 |
* @param value
|
54 |
* @param defaultValue
|
55 |
*
|
56 |
* @return NoData
|
57 |
*/
|
58 |
public NoData createNoData(Number value, Number defaultValue); |
59 |
|
60 |
/**
|
61 |
* Creates {@link BandInfo} with information about one band.
|
62 |
* @param band
|
63 |
* Band of this {@link BandInfo}
|
64 |
* @param name
|
65 |
* Band name
|
66 |
* @param description
|
67 |
* Description of band
|
68 |
* @param values
|
69 |
* A key-value map with information properties about band
|
70 |
* @return BandInfo
|
71 |
*/
|
72 |
public BandInfo createBandInfo(int band, String name, String description, |
73 |
List<Map.Entry<Object, Object>> values); |
74 |
|
75 |
/**
|
76 |
* Creates a {@link Band}. If {@link PageManager} is null, the band will be
|
77 |
* in
|
78 |
* memory, otherwise, the band will be paginated using page manager.
|
79 |
*
|
80 |
* @param dataType
|
81 |
* Type of band. Check {@link BufferManager} to see what types
|
82 |
* are available
|
83 |
* @param rows
|
84 |
* Band rows
|
85 |
* @param columns
|
86 |
* Band columns
|
87 |
* @param noData
|
88 |
* {@link NoData} of band. If It is null, a undefined NoData will
|
89 |
* be set.
|
90 |
* @param pageManager
|
91 |
* Page manager to paginate band. It page manager is null, band
|
92 |
* will be in memory.
|
93 |
* @return Band A empty band.
|
94 |
* @throws BandException
|
95 |
* If there are problems creating the band.
|
96 |
* @see BufferManager#createNoData(Number, Number)
|
97 |
* @see BufferManager#createBandInfo(String, String, List)
|
98 |
* @see BufferManager#createSimpleBandPageManager(File, int, int, int)
|
99 |
*/
|
100 |
public Band createBand(int dataType, int rows, int columns, NoData noData, PageManager pageManager) throws BandException; |
101 |
|
102 |
/**
|
103 |
* Creates a memory buffer.
|
104 |
*
|
105 |
* @param rows
|
106 |
* Rows of buffer. All buffer bands will have the same rows as
|
107 |
* buffer.
|
108 |
* @param columns
|
109 |
* Columns of buffer. All buffer bands will have the same
|
110 |
* columns as buffer.
|
111 |
* @param bandDataTypes
|
112 |
* Types of buffer bands, see {@link BufferManager} to get types.
|
113 |
* The length of array indicates number of buffer bands.
|
114 |
* @param projection
|
115 |
* Projection of buffer.
|
116 |
* @return Buffer
|
117 |
* @throws BufferException
|
118 |
* If there is any problem creating buffer.
|
119 |
*/
|
120 |
Buffer createBuffer(int rows, int columns, int[] bandDataTypes, IProjection projection) throws BufferException; |
121 |
|
122 |
/**
|
123 |
* Creates a memory buffer.
|
124 |
*
|
125 |
* @param rows
|
126 |
* Rows of buffer. All buffer bands will have the same rows as
|
127 |
* buffer.
|
128 |
* @param columns
|
129 |
* Columns of buffer. All buffer bands will have the same
|
130 |
* columns as buffer.
|
131 |
* @param bandDataTypes
|
132 |
* Types of buffer bands, see {@link BufferManager} to get types.
|
133 |
* The length of array indicates number of buffer bands.
|
134 |
* @param bandNodata
|
135 |
* {@link NoData} of each band. It can be null. If there are
|
136 |
* bands without NoData object, a undefined NoData will be set.
|
137 |
* @param projection
|
138 |
* Projection of buffer.
|
139 |
* @return Buffer
|
140 |
* @throws BufferException
|
141 |
* If there is any problem creating buffer.
|
142 |
*/
|
143 |
Buffer createBuffer(int rows, int columns, int[] bandDataTypes, NoData[] bandNodata, IProjection projection) |
144 |
throws BufferException;
|
145 |
|
146 |
/**
|
147 |
* Creates a memory buffer.
|
148 |
*
|
149 |
* @param rows
|
150 |
* Rows of buffer. All buffer bands will have the same rows as
|
151 |
* buffer.
|
152 |
* @param columns
|
153 |
* Columns of buffer. All buffer bands will have the same
|
154 |
* columns as buffer.
|
155 |
* @param bandDataTypes
|
156 |
* Types of buffer bands, see {@link BufferManager} to get types.
|
157 |
* The length of array indicates number of buffer bands.
|
158 |
* @param bandNodata
|
159 |
* {@link NoData} of each band. If there are bands without NoData
|
160 |
* object, a undefined NoData will be set. It can be
|
161 |
* <code>null</code>.
|
162 |
* @param projection
|
163 |
* Projection of buffer.
|
164 |
* @param envelope
|
165 |
* Envelope of data. It can be <code>null</code>.
|
166 |
* @return Buffer
|
167 |
* @throws BufferException
|
168 |
* If there is any problem creating buffer.
|
169 |
*/
|
170 |
Buffer createBuffer(int rows, int columns, int[] bandDataTypes, NoData[] bandNodata, IProjection projection, |
171 |
Envelope envelope) throws BufferException;
|
172 |
|
173 |
/**
|
174 |
* Creates a buffer. Buffer bands will be paginated using
|
175 |
* {@link BandPageManager}.
|
176 |
*
|
177 |
* @param rows
|
178 |
* Rows of buffer. All buffer bands will have the same rows as
|
179 |
* buffer.
|
180 |
* @param columns
|
181 |
* Columns of buffer. All buffer bands will have the same
|
182 |
* columns as buffer.
|
183 |
* @param bandDataTypes
|
184 |
* Types of buffer bands, see {@link BufferManager} to get types.
|
185 |
* The length of array indicates number of buffer bands.
|
186 |
* @param bandNoData
|
187 |
* {@link NoData} of each band. If there are bands without NoData
|
188 |
* object, a undefined NoData will be set. It can be
|
189 |
* <code>null</code>.
|
190 |
* @param projection
|
191 |
* Projection of buffer.
|
192 |
* @param envelope
|
193 |
* Envelope of data. It can be <code>null</code>.
|
194 |
* @param pageManagers
|
195 |
* Page manager list to paginate data bands. If there are bands
|
196 |
* without page manager,
|
197 |
* they will be loaded at memory.
|
198 |
* @return Buffer
|
199 |
* @throws BufferException
|
200 |
* If there is any problem creating buffer.
|
201 |
*/
|
202 |
public Buffer createBuffer(int rows, int columns, int[] bandDataTypes, NoData[] bandNoData, |
203 |
IProjection projection, Envelope envelope, List<PageManager> pageManagers)
|
204 |
throws BufferException;
|
205 |
|
206 |
/**
|
207 |
* Creates a clipping of a buffer. The returned clipping will be like a view
|
208 |
* of the original buffer. It not reserve additional memory. It will only be
|
209 |
* a walkway to access an area of the buffer.
|
210 |
*
|
211 |
* @param buffer
|
212 |
* @param envelope
|
213 |
* @return a clip buffer
|
214 |
* @throws BufferException
|
215 |
*/
|
216 |
public Buffer createClippedBuffer(Buffer buffer, Envelope envelope) throws BufferException; |
217 |
|
218 |
/**
|
219 |
* @param file
|
220 |
* @param rows
|
221 |
* @param columns
|
222 |
* @param dataType
|
223 |
* @return BandPageManager
|
224 |
* @throws IOException
|
225 |
*/
|
226 |
public PageManager createSimpleBandPageManager(File file, int rows, int columns, int dataType) throws IOException; |
227 |
|
228 |
/**
|
229 |
*
|
230 |
* @param files
|
231 |
* @param rows
|
232 |
* @param columns
|
233 |
* @param dataType
|
234 |
* @return A list of page managers
|
235 |
* @throws IOException
|
236 |
*/
|
237 |
public List<PageManager> createSimpleBandPageManagerList(File[] files, int rows, int columns, int[] dataType) |
238 |
throws IOException; |
239 |
|
240 |
/**
|
241 |
* @param dataType
|
242 |
* Data tpye
|
243 |
* @return Data type size in bytes
|
244 |
*/
|
245 |
public int getDataTypeSize(int dataType); |
246 |
|
247 |
/**
|
248 |
* Creates a clipping of a band. The returned clipping will be like a view
|
249 |
* of the original band. It not reserve additional memory. It will only be
|
250 |
* a walkway to access an area of the band.
|
251 |
*
|
252 |
* @param buffer
|
253 |
* @param band
|
254 |
* @return Band
|
255 |
* @throws BandException
|
256 |
*/
|
257 |
public Band createClippedBand(Buffer buffer, Band band) throws BandException; |
258 |
|
259 |
} |