Revision 11946
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.algorithm/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.roimask.algorithm.ROIMaskAlgorithmLibrary |
|
0 | 2 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.algorithm/src/main/java/org/gvsig/raster/roimask/algorithm/ROIMaskAlgorithmLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.algorithm; |
|
2 |
|
|
3 |
import org.gvsig.i18n.Messages; |
|
4 |
import org.gvsig.raster.algorithm.RasterBaseAlgorithmLibrary; |
|
5 |
import org.gvsig.tools.library.AbstractLibrary; |
|
6 |
import org.gvsig.tools.library.LibraryException; |
|
7 |
|
|
8 |
/** |
|
9 |
* Initialization of ROIMaskAlgorithmLibrary library. |
|
10 |
*/ |
|
11 |
public class ROIMaskAlgorithmLibrary extends AbstractLibrary { |
|
12 |
public static final String PROCESS_LABEL = "ROIMaskProcess"; |
|
13 |
|
|
14 |
@Override |
|
15 |
protected void doInitialize() throws LibraryException { |
|
16 |
// Nothing to do |
|
17 |
} |
|
18 |
|
|
19 |
@Override |
|
20 |
protected void doPostInitialize() throws LibraryException { |
|
21 |
//Registers the process and its parameters |
|
22 |
RasterBaseAlgorithmLibrary.register(PROCESS_LABEL, ROIMaskProcess.class); |
|
23 |
ROIMaskProcess.registerParameters(); |
|
24 |
|
|
25 |
Messages.addResourceFamily( |
|
26 |
"org.gvsig.raster.roimask.algorithm", |
|
27 |
ROIMaskAlgorithmLibrary.class.getClassLoader(), |
|
28 |
ROIMaskAlgorithmLibrary.class.getClass().getName()); |
|
29 |
//registerGeoProcess(new RasterReprojectAlgorithmLibrary()); |
|
30 |
|
|
31 |
Messages.addResourceFamily("org.gvsig.raster.roimask.algorithm.i18n.text", |
|
32 |
ROIMaskAlgorithmLibrary.class.getClassLoader(), |
|
33 |
ROIMaskAlgorithmLibrary.class.getClass().getName()); |
|
34 |
} |
|
35 |
} |
|
0 | 36 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.algorithm/src/main/java/org/gvsig/raster/roimask/algorithm/ROIMaskException.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.algorithm; |
|
2 |
|
|
3 |
import org.gvsig.raster.algorithm.process.ProcessException; |
|
4 |
|
|
5 |
|
|
6 |
/** |
|
7 |
* This exception is thrown if happen problems processing data with this algorithm. |
|
8 |
*/ |
|
9 |
public class ROIMaskException extends ProcessException { |
|
10 |
private static final long serialVersionUID = -3022090543908771484L; |
|
11 |
|
|
12 |
public ROIMaskException(String msg){ |
|
13 |
super(msg); |
|
14 |
} |
|
15 |
|
|
16 |
public ROIMaskException(String msg, Throwable e){ |
|
17 |
super(msg, e); |
|
18 |
} |
|
19 |
} |
|
0 | 20 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.algorithm/src/main/java/org/gvsig/raster/roimask/algorithm/ROIMaskProcess.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.algorithm; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
|
|
5 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
|
6 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
7 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
8 |
import org.gvsig.fmap.dal.coverage.dataset.BufferParam; |
|
9 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
10 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
|
11 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
12 |
import org.gvsig.fmap.dal.coverage.exception.QueryException; |
|
13 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
|
14 |
import org.gvsig.fmap.dal.coverage.store.RasterQuery; |
|
15 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
16 |
import org.gvsig.i18n.Messages; |
|
17 |
import org.gvsig.raster.algorithm.process.DataProcess; |
|
18 |
import org.gvsig.raster.algorithm.process.ProcessException; |
|
19 |
import org.gvsig.raster.roi.ROI; |
|
20 |
|
|
21 |
/** |
|
22 |
* Process |
|
23 |
*/ |
|
24 |
public class ROIMaskProcess extends DataProcess { |
|
25 |
public static String RASTER_STORE1 = "RasterStore1"; |
|
26 |
public static String BUFFER = "Buffer"; |
|
27 |
public static String PATH = "Path"; |
|
28 |
public static String FILENAME = "FileName"; |
|
29 |
public static String ROIS = "Rois"; |
|
30 |
public static String INVERSE = "Inverse"; |
|
31 |
public static String ALPHA = "Alpha"; |
|
32 |
public static String ALPHA_BAND = "AlphaBand"; |
|
33 |
public static String NODATA = "NoData"; |
|
34 |
|
|
35 |
private RasterDataStore store = null; |
|
36 |
private String filename = null; |
|
37 |
|
|
38 |
private ROI[] rois = null; |
|
39 |
private boolean inverse = false; |
|
40 |
private int alpha = 0; |
|
41 |
private NoData nodata = null; |
|
42 |
|
|
43 |
private double noDataResult = 0; |
|
44 |
|
|
45 |
/** |
|
46 |
* This buffer is just to test |
|
47 |
*/ |
|
48 |
private Buffer bufferForTest = null; |
|
49 |
|
|
50 |
public static void registerParameters() { |
|
51 |
registerInputParameter(RASTER_STORE1, RasterDataStore.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
52 |
registerInputParameter(PATH, String.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
53 |
registerInputParameter(ROIS, ROI[].class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
54 |
registerInputParameter(INVERSE, Boolean.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
55 |
registerInputParameter(ALPHA, Integer.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
56 |
registerInputParameter(NODATA, NoData.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
57 |
|
|
58 |
registerOutputParameter(FILENAME, String.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
59 |
registerOutputParameter(ALPHA_BAND, Buffer.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
60 |
registerOutputParameter(BUFFER, Buffer.class, ROIMaskAlgorithmLibrary.PROCESS_LABEL); |
|
61 |
} |
|
62 |
|
|
63 |
public void init() { |
|
64 |
store = getParam(RASTER_STORE1) != null ? (RasterDataStore)getParam(RASTER_STORE1) : null; |
|
65 |
filename = getStringParam(PATH); |
|
66 |
inverse = getBooleanParam(INVERSE); |
|
67 |
alpha = getIntParam(ALPHA); |
|
68 |
|
|
69 |
nodata = getParam(NODATA) != null ? (NoData)getParam(NODATA) : null; |
|
70 |
rois = getParam(ROIS) != null ? (ROI[])getParam(ROIS) : null; |
|
71 |
|
|
72 |
switch (store.getDataType()[0]) { |
|
73 |
case Buffer.TYPE_BYTE: |
|
74 |
if(nodata.getValue() != null) |
|
75 |
noDataResult = nodata.getValue().byteValue(); |
|
76 |
else |
|
77 |
noDataResult = RasterLibrary.defaultByteNoDataValue; |
|
78 |
break; |
|
79 |
case Buffer.TYPE_SHORT: |
|
80 |
if(nodata.getValue() != null) |
|
81 |
noDataResult = nodata.getValue().shortValue(); |
|
82 |
else |
|
83 |
noDataResult = RasterLibrary.defaultShortNoDataValue; |
|
84 |
break; |
|
85 |
case Buffer.TYPE_INT: |
|
86 |
if(nodata.getValue() != null) |
|
87 |
noDataResult = nodata.getValue().intValue(); |
|
88 |
else |
|
89 |
noDataResult = RasterLibrary.defaultIntegerNoDataValue; |
|
90 |
break; |
|
91 |
case Buffer.TYPE_FLOAT: |
|
92 |
if(nodata.getValue() != null) |
|
93 |
noDataResult = nodata.getValue().floatValue(); |
|
94 |
else |
|
95 |
noDataResult = RasterLibrary.defaultFloatNoDataValue; |
|
96 |
break; |
|
97 |
case Buffer.TYPE_DOUBLE: |
|
98 |
if(nodata.getValue() != null) |
|
99 |
noDataResult = nodata.getValue().doubleValue(); |
|
100 |
else |
|
101 |
noDataResult = RasterLibrary.defaultDoubleNoDataValue; |
|
102 |
break; |
|
103 |
} |
|
104 |
} |
|
105 |
|
|
106 |
public void process() throws ProcessInterruptedException, ProcessException { |
|
107 |
insertLineLog(Messages.getText("applying_mask")); |
|
108 |
try { |
|
109 |
if (store == null) |
|
110 |
throw new ROIMaskException("Store not found"); |
|
111 |
|
|
112 |
RasterQuery query = RasterLocator.getManager().createQuery(); |
|
113 |
|
|
114 |
Extent windowExtent = getExtentResult(getOutputWindow(), null, store); |
|
115 |
Rectangle2D sourcePxBBox = null; |
|
116 |
if(isOutputRescaled()) { |
|
117 |
sourcePxBBox = new Rectangle2D.Double(0, 0, getOutputWidth(), getOutputHeight()); |
|
118 |
query.setSupersamplingOption(true); |
|
119 |
} else { |
|
120 |
sourcePxBBox = getSourcePxBox(windowExtent, store); |
|
121 |
query.setSupersamplingOption(false); |
|
122 |
} |
|
123 |
double cellSize = windowExtent.width() / sourcePxBBox.getWidth(); |
|
124 |
|
|
125 |
if(isForPreviews()) { |
|
126 |
query.setReadOnly(false); |
|
127 |
query.forceRGBRequest(); |
|
128 |
query.setDrawableBands(store.getRender().getRenderColorInterpretation().buildRenderBands()); |
|
129 |
} else { |
|
130 |
query.setAllDrawableBands(); |
|
131 |
query.setReadOnly(true); |
|
132 |
} |
|
133 |
|
|
134 |
int w = (int)sourcePxBBox.getWidth(); |
|
135 |
int h = (int)sourcePxBBox.getHeight(); |
|
136 |
|
|
137 |
query.setAreaOfInterest(windowExtent, w, h); |
|
138 |
Buffer sourceBuffer = null; |
|
139 |
try { |
|
140 |
sourceBuffer = store.query(query); |
|
141 |
sourceBuffer.setDataExtent(windowExtent.toRectangle2D()); |
|
142 |
} catch (QueryException e) { |
|
143 |
throw new ROIMaskException("Error reading data", e); |
|
144 |
} |
|
145 |
|
|
146 |
bufferForTest = sourceBuffer; |
|
147 |
ColorInterpretation ci = store.getColorInterpretation(); |
|
148 |
int ouputAlphaBandNumber = -1; |
|
149 |
|
|
150 |
if(rois != null && rois.length > 0) { |
|
151 |
nodata.setNoDataTransparent(false); |
|
152 |
if(ci.isRGBA()) { |
|
153 |
bufferForTest = processRGB(windowExtent, sourceBuffer, w, h, cellSize, ci.getAlphaBand()); |
|
154 |
ouputAlphaBandNumber = bufferForTest.getBandCount() - 1; |
|
155 |
ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(ColorInterpretation.ARGB); |
|
156 |
} else if(ci.isRGB()) { |
|
157 |
bufferForTest = processRGB(windowExtent, sourceBuffer, w, h, cellSize, -1); |
|
158 |
ouputAlphaBandNumber = bufferForTest.getBandCount() - 1; |
|
159 |
ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(ColorInterpretation.ARGB); |
|
160 |
} else { |
|
161 |
bufferForTest = processMDT(windowExtent, sourceBuffer, cellSize); |
|
162 |
ci = RasterLocator.getManager().getDataStructFactory().createColorInterpretation(ColorInterpretation.GRAYSCALE); |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
if(!isForPreviews()) { |
|
167 |
super.exportRaster(filename, |
|
168 |
bufferForTest, |
|
169 |
ci, |
|
170 |
windowExtent, |
|
171 |
nodata, |
|
172 |
store.getProjection()); |
|
173 |
addOutputValue(FILENAME, filename); |
|
174 |
} else { |
|
175 |
addOutputValue(BUFFER, bufferForTest); |
|
176 |
} |
|
177 |
|
|
178 |
addOutputValue(ALPHA_BAND, ouputAlphaBandNumber); |
|
179 |
} catch (ROIMaskException e) { |
|
180 |
if (incrementableTask != null) |
|
181 |
incrementableTask.processFinalize(); |
|
182 |
messageBoxError("Error in mask process", this, e); |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
private Buffer processRGB(Extent extent, Buffer sourceBuffer, int w, int h, double cellsize, int inputAlphaBandNumber) throws ProcessInterruptedException, ProcessException { |
|
187 |
BufferParam params = RasterLocator.getManager().getBufferFactory().createBufferParams( |
|
188 |
w, h, 4, store.getDataType()[0], true); |
|
189 |
Buffer outputBuffer = null; |
|
190 |
try { |
|
191 |
outputBuffer = RasterLocator.getManager().getBufferFactory().createBuffer(params); |
|
192 |
} catch (Exception e) { |
|
193 |
throw new ProcessException("Error creating buffer", e); |
|
194 |
} |
|
195 |
|
|
196 |
for (int row = 0; row < h; row++) { |
|
197 |
for (int col = 0; col < w; col++) { |
|
198 |
double wcX = extent.minX() + ((((double) col) * extent.width()) / ((double) w)); |
|
199 |
double wcY = extent.minY() + ((((double) (h - (row))) * extent.height()) / ((double) h)); |
|
200 |
|
|
201 |
for (int iBand = 0; iBand < 3; iBand++) { |
|
202 |
outputBuffer.setElem(row, col, iBand, sourceBuffer.getElemByte(row, col, iBand)); |
|
203 |
} |
|
204 |
|
|
205 |
boolean insideRoi = false; |
|
206 |
for (int i = 0; i < rois.length; i++) { |
|
207 |
if (((ROI) rois[i]).isInside(wcX, wcY, cellsize, cellsize)) { |
|
208 |
if (inverse) { |
|
209 |
if(inputAlphaBandNumber != -1) |
|
210 |
outputBuffer.setElem(row, col, 3, sourceBuffer.getElemByte(row, col, inputAlphaBandNumber)); |
|
211 |
else |
|
212 |
outputBuffer.setElem(row, col, 3, (byte) 255); |
|
213 |
} else { |
|
214 |
outputBuffer.setElem(row, col, 3, (byte) (255 - alpha)); |
|
215 |
} |
|
216 |
insideRoi = true; |
|
217 |
} |
|
218 |
} |
|
219 |
|
|
220 |
if(!insideRoi) { |
|
221 |
if (inverse) { |
|
222 |
outputBuffer.setElem(row, col, 3, (byte) (255 - alpha)); |
|
223 |
} else { |
|
224 |
if(inputAlphaBandNumber != -1) |
|
225 |
outputBuffer.setElem(row, col, 3, sourceBuffer.getElemByte(row, col, inputAlphaBandNumber)); |
|
226 |
else |
|
227 |
outputBuffer.setElem(row, col, 3, (byte) 255); |
|
228 |
} |
|
229 |
} |
|
230 |
} |
|
231 |
updatePercent(row, h); |
|
232 |
} |
|
233 |
return outputBuffer; |
|
234 |
} |
|
235 |
|
|
236 |
private Buffer processMDT(Extent extent, Buffer inputBuffer, double cellsize) throws ProcessInterruptedException, ProcessException { |
|
237 |
int w = inputBuffer.getWidth(); |
|
238 |
int h = inputBuffer.getHeight(); |
|
239 |
Buffer outputBuffer = null; |
|
240 |
|
|
241 |
BufferParam params = RasterLocator.getManager().getBufferFactory().createBufferParams( |
|
242 |
w, h, inputBuffer.getBandCount(), inputBuffer.getDataType(), true); |
|
243 |
try { |
|
244 |
outputBuffer = RasterLocator.getManager().getBufferFactory().createBuffer(params); |
|
245 |
} catch (Exception e) { |
|
246 |
throw new ProcessException("Error creating buffer", e); |
|
247 |
} |
|
248 |
|
|
249 |
for (int row = 0; row < h; row++) { |
|
250 |
for (int col = 0; col < w; col++) { |
|
251 |
for (int nband = 0; nband < inputBuffer.getBandCount(); nband++) { |
|
252 |
double wcX = extent.minX() + ((((double) col) * extent.width()) / ((double) w)); |
|
253 |
double wcY = extent.minY() + ((((double) (h - (row))) * extent.height()) / ((double) h)); |
|
254 |
boolean insideRoi = false; |
|
255 |
for (int i = 0; i < rois.length; i++) { |
|
256 |
if (((ROI) rois[i]).isInside(wcX, wcY, cellsize, cellsize)) { |
|
257 |
if (inverse) |
|
258 |
writePixel(inputBuffer, outputBuffer, col, row, nband); |
|
259 |
else |
|
260 |
writeNoData(outputBuffer, col, row, nband); |
|
261 |
insideRoi = true; |
|
262 |
} |
|
263 |
} |
|
264 |
|
|
265 |
if(!insideRoi) { |
|
266 |
if (inverse) |
|
267 |
writeNoData(outputBuffer, col, row, nband); |
|
268 |
else { |
|
269 |
writePixel(inputBuffer, outputBuffer, col, row, nband); |
|
270 |
} |
|
271 |
} |
|
272 |
} |
|
273 |
} |
|
274 |
updatePercent(row, h); |
|
275 |
} |
|
276 |
return outputBuffer; |
|
277 |
} |
|
278 |
|
|
279 |
private void writePixel(Buffer inputBuffer, Buffer outputBuffer, int col, int row, int nband) { |
|
280 |
switch (inputBuffer.getDataType()) { |
|
281 |
case Buffer.TYPE_BYTE: |
|
282 |
outputBuffer.setElem(row, col, nband, inputBuffer.getElemByte(row, col, nband)); |
|
283 |
break; |
|
284 |
case Buffer.TYPE_SHORT: |
|
285 |
outputBuffer.setElem(row, col, nband, inputBuffer.getElemShort(row, col, nband)); |
|
286 |
break; |
|
287 |
case Buffer.TYPE_INT: |
|
288 |
outputBuffer.setElem(row, col, nband, inputBuffer.getElemInt(row, col, nband)); |
|
289 |
break; |
|
290 |
case Buffer.TYPE_FLOAT: |
|
291 |
outputBuffer.setElem(row, col, nband, inputBuffer.getElemFloat(row, col, nband)); |
|
292 |
break; |
|
293 |
case Buffer.TYPE_DOUBLE: |
|
294 |
outputBuffer.setElem(row, col, nband, inputBuffer.getElemDouble(row, col, nband)); |
|
295 |
break; |
|
296 |
} |
|
297 |
} |
|
298 |
|
|
299 |
private void writeNoData(Buffer outputBuffer, int col, int row, int nband) { |
|
300 |
switch (outputBuffer.getDataType()) { |
|
301 |
case Buffer.TYPE_BYTE: |
|
302 |
outputBuffer.setElem(row, col, nband, (byte)noDataResult); |
|
303 |
break; |
|
304 |
case Buffer.TYPE_SHORT: |
|
305 |
outputBuffer.setElem(row, col, nband, (short)noDataResult); |
|
306 |
break; |
|
307 |
case Buffer.TYPE_INT: |
|
308 |
outputBuffer.setElem(row, col, nband, (int)noDataResult); |
|
309 |
break; |
|
310 |
case Buffer.TYPE_FLOAT: |
|
311 |
outputBuffer.setElem(row, col, nband, (float)noDataResult); |
|
312 |
break; |
|
313 |
case Buffer.TYPE_DOUBLE: |
|
314 |
outputBuffer.setElem(row, col, nband, (double)noDataResult); |
|
315 |
break; |
|
316 |
} |
|
317 |
} |
|
318 |
|
|
319 |
public String getTitle() { |
|
320 |
return Messages.getText("mask_process"); |
|
321 |
} |
|
322 |
} |
|
0 | 323 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.algorithm/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.roimask.algorithm</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.raster.roimask.algorithm</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.raster.roimask</artifactId> |
|
10 |
<version>2.2.108</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.i18n</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.ui</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
|
|
49 |
<dependency> |
|
50 |
<groupId>org.gvsig</groupId> |
|
51 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
52 |
<scope>compile</scope> |
|
53 |
</dependency> |
|
54 |
<!-- |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.fmap.geometry.generalpath</artifactId> |
|
58 |
<scope>runtime</scope> |
|
59 |
</dependency> |
|
60 |
--> |
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
64 |
<scope>compile</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.gvsig</groupId> |
|
68 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
69 |
<scope>compile</scope> |
|
70 |
</dependency> |
|
71 |
<dependency> |
|
72 |
<groupId>org.gvsig</groupId> |
|
73 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
74 |
<scope>compile</scope> |
|
75 |
</dependency> |
|
76 |
<dependency> |
|
77 |
<groupId>org.gvsig</groupId> |
|
78 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
79 |
<scope>runtime</scope> |
|
80 |
</dependency> |
|
81 |
<dependency> |
|
82 |
<groupId>org.gvsig</groupId> |
|
83 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
84 |
<scope>compile</scope> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
89 |
<scope>compile</scope> |
|
90 |
</dependency> |
|
91 |
<dependency> |
|
92 |
<groupId>org.gvsig</groupId> |
|
93 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
94 |
<scope>compile</scope> |
|
95 |
</dependency> |
|
96 |
<dependency> |
|
97 |
<groupId>org.gvsig</groupId> |
|
98 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
99 |
<scope>compile</scope> |
|
100 |
</dependency> |
|
101 |
</dependencies> |
|
102 |
</project> |
|
0 | 103 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/src/main/java/org/gvsig/raster/roimask/lib/ROIMaskManager.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.lib; |
|
2 |
|
|
3 |
/** |
|
4 |
* This class is responsible of the management of the library's business logic. |
|
5 |
* It is the library's main entry point, and provides all the services to manage |
|
6 |
* {@link ROIMaskService}s. |
|
7 |
* |
|
8 |
* @see ROIMaskService |
|
9 |
* @author gvSIG team |
|
10 |
* @version $Id$ |
|
11 |
*/ |
|
12 |
public interface ROIMaskManager { |
|
13 |
|
|
14 |
} |
|
0 | 15 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/src/main/java/org/gvsig/raster/roimask/lib/ROIMaskService.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.lib; |
|
2 |
|
|
3 |
import java.util.Date; |
|
4 |
|
|
5 |
/** |
|
6 |
* Represents a Raster element. |
|
7 |
* |
|
8 |
* @author gvSIG team |
|
9 |
* @version $Id$ |
|
10 |
*/ |
|
11 |
public interface ROIMaskService { |
|
12 |
|
|
13 |
/** |
|
14 |
* Returns the Raster's message. |
|
15 |
* |
|
16 |
* @return the message associated to a TaskWithoutPreviewService |
|
17 |
* @throws ROIMaskMessageException |
|
18 |
* if there is an error getting the Raster's message |
|
19 |
*/ |
|
20 |
public String getMessage() throws ROIMaskMessageException; |
|
21 |
|
|
22 |
/** |
|
23 |
* Returns the {@link ROIMaskManager} |
|
24 |
* |
|
25 |
* @return {@link ROIMaskManager} |
|
26 |
* @see {@link ROIMaskManager} |
|
27 |
*/ |
|
28 |
public ROIMaskManager getManager(); |
|
29 |
|
|
30 |
/** |
|
31 |
* Returns the Raster's creation date. |
|
32 |
* |
|
33 |
* @return the creation date associated to a TaskWithoutPreviewService |
|
34 |
*/ |
|
35 |
public Date getDate(); |
|
36 |
|
|
37 |
} |
|
0 | 38 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/src/main/java/org/gvsig/raster/roimask/lib/ROIMaskLocator.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.lib; |
|
2 |
|
|
3 |
import org.gvsig.tools.locator.BaseLocator; |
|
4 |
import org.gvsig.tools.locator.Locator; |
|
5 |
import org.gvsig.tools.locator.LocatorException; |
|
6 |
|
|
7 |
/** |
|
8 |
* This locator is the entry point for the Raster library, providing |
|
9 |
* access to all Raster services through the {@link ROIMaskManager} |
|
10 |
* . |
|
11 |
* |
|
12 |
* @author gvSIG team |
|
13 |
* @version $Id$ |
|
14 |
*/ |
|
15 |
public class ROIMaskLocator extends BaseLocator { |
|
16 |
public static final String MANAGER_NAME = "ROIMask.manager"; |
|
17 |
public static final String MANAGER_DESCRIPTION = "ROIMask Manager"; |
|
18 |
private static final String LOCATOR_NAME = "ROIMask.locator"; |
|
19 |
private static final ROIMaskLocator INSTANCE = new ROIMaskLocator(); |
|
20 |
|
|
21 |
/** |
|
22 |
* Return the singleton instance. |
|
23 |
* |
|
24 |
* @return the singleton instance |
|
25 |
*/ |
|
26 |
public static ROIMaskLocator getInstance() { |
|
27 |
return INSTANCE; |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* Return the Locator's name. |
|
32 |
* |
|
33 |
* @return a String with the Locator's name |
|
34 |
*/ |
|
35 |
public final String getLocatorName() { |
|
36 |
return LOCATOR_NAME; |
|
37 |
} |
|
38 |
|
|
39 |
/** |
|
40 |
* Return a reference to the ROIMaskManager. |
|
41 |
* |
|
42 |
* @return a reference to the ROIMaskManager |
|
43 |
* @throws LocatorException |
|
44 |
* if there is no access to the class or the class cannot be |
|
45 |
* instantiated |
|
46 |
* @see Locator#get(String) |
|
47 |
*/ |
|
48 |
public static ROIMaskManager getManager() throws LocatorException { |
|
49 |
return (ROIMaskManager) getInstance().get(MANAGER_NAME); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* Registers the Class implementing the RasterManager interface. |
|
54 |
* |
|
55 |
* @param clazz |
|
56 |
* implementing the RasterManager interface |
|
57 |
*/ |
|
58 |
public static void registerManager( |
|
59 |
Class<? extends ROIMaskManager> clazz) { |
|
60 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
61 |
} |
|
62 |
|
|
63 |
} |
|
0 | 64 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/src/main/java/org/gvsig/raster/roimask/lib/ROIMaskMessageException.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.lib; |
|
2 |
|
|
3 |
import org.gvsig.tools.exception.BaseException; |
|
4 |
|
|
5 |
/** |
|
6 |
* Exception thrown when there is an error getting a Raster message. |
|
7 |
* |
|
8 |
* @author gvSIG team |
|
9 |
* @version $Id$ |
|
10 |
*/ |
|
11 |
public class ROIMaskMessageException extends BaseException { |
|
12 |
|
|
13 |
private static final long serialVersionUID = -4051458353306878010L; |
|
14 |
|
|
15 |
private static final String MESSAGE = |
|
16 |
"An error has been produced " + "getting the Raster message"; |
|
17 |
|
|
18 |
private static final String KEY = "_RasterMessageException"; |
|
19 |
|
|
20 |
/** |
|
21 |
* Creates a new {@link ROIMaskMessageException}. |
|
22 |
* |
|
23 |
* @param cause |
|
24 |
* the original cause |
|
25 |
*/ |
|
26 |
public ROIMaskMessageException(Throwable cause) { |
|
27 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
28 |
} |
|
29 |
} |
|
0 | 30 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/src/main/java/org/gvsig/raster/roimask/lib/ROIMaskLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.roimask.lib; |
|
2 |
|
|
3 |
import org.gvsig.tools.library.AbstractLibrary; |
|
4 |
import org.gvsig.tools.library.LibraryException; |
|
5 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
6 |
|
|
7 |
/** |
|
8 |
* Library for API initialization and configuration. |
|
9 |
* |
|
10 |
* @author gvSIG team |
|
11 |
* @version $Id$ |
|
12 |
*/ |
|
13 |
public class ROIMaskLibrary extends AbstractLibrary { |
|
14 |
|
|
15 |
public ROIMaskLibrary() { |
|
16 |
registerAsAPI(ROIMaskLibrary.class); |
|
17 |
} |
|
18 |
|
|
19 |
@Override |
|
20 |
protected void doInitialize() throws LibraryException { |
|
21 |
} |
|
22 |
|
|
23 |
@Override |
|
24 |
protected void doPostInitialize() throws LibraryException { |
|
25 |
// Validate there is any implementation registered. |
|
26 |
ROIMaskManager manager = ROIMaskLocator.getManager(); |
|
27 |
if (manager == null) { |
|
28 |
throw new ReferenceNotRegisteredException( |
|
29 |
ROIMaskLocator.MANAGER_NAME, |
|
30 |
ROIMaskLocator.getInstance()); |
|
31 |
} |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
0 | 35 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.roimask.lib.ROIMaskLibrary |
|
0 | 2 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.roimask.lib.api</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.raster.roimask.lib.api</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.raster.roimask.lib</artifactId> |
|
10 |
<version>2.2.108</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
</dependencies> |
|
24 |
</project> |
|
0 | 25 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
|
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.raster.roimask.lib</artifactId> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>org.gvsig.raster.roimask.lib</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.raster.roimask</artifactId> |
|
11 |
<version>2.2.108</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
17 |
<scope>compile</scope> |
|
18 |
</dependency> |
|
19 |
</dependencies> |
|
20 |
<modules> |
|
21 |
<module>org.gvsig.raster.roimask.lib.api</module> |
|
22 |
<module>org.gvsig.raster.roimask.lib.impl</module> |
|
23 |
</modules> |
|
24 |
</project> |
|
0 | 25 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.impl/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.roimask.lib.impl</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.raster.roimask.lib.impl</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.raster.roimask.lib</artifactId> |
|
10 |
<version>2.2.108</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.raster.roimask.lib.api</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
41 |
<scope>runtime</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.ui</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
</dependencies> |
|
49 |
</project> |
|
0 | 50 |
org.gvsig.raster.roimask/tags/org.gvsig.raster.roimask-2.2.108/org.gvsig.raster.roimask.lib/org.gvsig.raster.roimask.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.roimask.lib.impl.ROIMaskDefaultImplLibrary |
|
0 | 2 |
Also available in: Unified diff