Revision 2125 org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/raster/process/ClippingProcess.java
ClippingProcess.java | ||
---|---|---|
64 | 64 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
65 | 65 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
66 | 66 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
67 |
import org.gvsig.i18n.Messages; |
|
67 | 68 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
68 | 69 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
69 |
import org.gvsig.raster.fmap.roi.VectorialROI; |
|
70 |
import org.gvsig.raster.mainplugin.RasterMainPluginUtils; |
|
71 |
import org.gvsig.raster.roi.ROI; |
|
72 |
import org.gvsig.raster.swing.RasterSwingLibrary; |
|
70 | 73 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
71 | 74 |
import org.gvsig.raster.util.RasterNotLoadException; |
72 | 75 |
/** |
... | ... | |
88 | 91 |
private String viewName = ""; |
89 | 92 |
private Params params = null; |
90 | 93 |
private ColorInterpretation colorInterp = null; |
91 |
private ArrayList<VectorialROI> selectedRois = null;
|
|
94 |
private ArrayList<ROI> selectedRois = null;
|
|
92 | 95 |
private AffineTransform affineTransform = null; |
93 | 96 |
private double[] wcValues = null; |
94 | 97 |
private RasterManager rManager = RasterLocator.getManager(); |
... | ... | |
130 | 133 |
interpolationMethod = getIntParam("interpolationmethod"); |
131 | 134 |
affineTransform = (AffineTransform)getParam("affinetransform"); |
132 | 135 |
colorInterp = (ColorInterpretation)getParam("colorInterpretation"); |
133 |
selectedRois = (ArrayList<VectorialROI>)getParam("selectedrois");
|
|
136 |
selectedRois = (ArrayList<ROI>)getParam("selectedrois"); |
|
134 | 137 |
if(getIntArrayParam("resolution") != null) { |
135 | 138 |
resolutionWidth = getIntArrayParam("resolution")[0]; |
136 | 139 |
resolutionHeight = getIntArrayParam("resolution")[1]; |
... | ... | |
179 | 182 |
try { |
180 | 183 |
rManager.getProviderServices().saveObjectToRmfFile(fileName, ColorTable.class, colorTable); |
181 | 184 |
} catch (RmfSerializerException e) { |
182 |
RasterToolsUtil.messageBoxError("error_salvando_rmf", this, e);
|
|
185 |
RasterSwingLibrary.messageBoxError("error_salvando_rmf", this, e);
|
|
183 | 186 |
} |
184 | 187 |
} |
185 | 188 |
|
... | ... | |
201 | 204 |
e1.printStackTrace(); |
202 | 205 |
} |
203 | 206 |
|
204 |
insertLineLog(RasterToolsUtil.getText(this, "leyendo_raster"));
|
|
207 |
insertLineLog(Messages.getText("leyendo_raster"));
|
|
205 | 208 |
|
206 | 209 |
dstoreCopy = rasterSE.getDataStore().newDataStore(); |
207 | 210 |
RasterQuery query = rManager.createQuery(); |
... | ... | |
209 | 212 |
|
210 | 213 |
if(dstoreCopy.getParameters() instanceof RemoteStoreParameters && |
211 | 214 |
!((RemoteStoreParameters)dstoreCopy.getParameters()).isSizeFixed()) { |
212 |
insertLineLog(RasterToolsUtil.getText(this, "downloading_image"));
|
|
215 |
insertLineLog(Messages.getText("downloading_image"));
|
|
213 | 216 |
((RemoteStoreParameters)dstoreCopy.getParameters()).setWidth(resolutionWidth); |
214 | 217 |
((RemoteStoreParameters)dstoreCopy.getParameters()).setHeight(resolutionHeight); |
215 | 218 |
Extent bbox = RasterLocator.getManager().getDataStructFactory().createExtent(wcValues[0], wcValues[1], wcValues[2], wcValues[3]); |
... | ... | |
217 | 220 |
try { |
218 | 221 |
buffer = dstoreCopy.query(query); |
219 | 222 |
} catch (InvalidSetViewException e) { |
220 |
RasterToolsUtil.messageBoxError("No se ha podido asignar la vista al inicial el proceso de recorte.", this, e);
|
|
223 |
RasterSwingLibrary.messageBoxError("No se ha podido asignar la vista al inicial el proceso de recorte.", this, e);
|
|
221 | 224 |
} |
222 | 225 |
} else { |
223 | 226 |
if(interpolationMethod != Buffer.INTERPOLATION_Undefined) { |
... | ... | |
232 | 235 |
} |
233 | 236 |
buffer = dstoreCopy.query(query); |
234 | 237 |
} catch (InvalidSetViewException e) { |
235 |
RasterToolsUtil.messageBoxError("No se ha podido asignar la vista al inicial el proceso de recorte.", this, e);
|
|
238 |
RasterSwingLibrary.messageBoxError("No se ha podido asignar la vista al inicial el proceso de recorte.", this, e);
|
|
236 | 239 |
} |
237 | 240 |
|
238 |
insertLineLog(RasterToolsUtil.getText(this, "interpolando"));
|
|
241 |
insertLineLog(Messages.getText("interpolando"));
|
|
239 | 242 |
|
240 | 243 |
Buffer bufTmp = buffer; |
241 | 244 |
processIncrement = bufTmp.getIncrementableTask(Buffer.INCREMENTABLE_INTERPOLATION); |
... | ... | |
254 | 257 |
} |
255 | 258 |
buffer = dstoreCopy.query(query); |
256 | 259 |
} catch (InvalidSetViewException e) { |
257 |
RasterToolsUtil.messageBoxError("No se ha podido asignar la vista al inicial el proceso de recorte.", this, e);
|
|
260 |
RasterSwingLibrary.messageBoxError("No se ha podido asignar la vista al inicial el proceso de recorte.", this, e);
|
|
258 | 261 |
} |
259 | 262 |
} |
260 | 263 |
} |
... | ... | |
277 | 280 |
} |
278 | 281 |
|
279 | 282 |
|
280 |
insertLineLog(RasterToolsUtil.getText(this, "salvando_imagen"));
|
|
283 |
insertLineLog(Messages.getText("salvando_imagen"));
|
|
281 | 284 |
|
282 | 285 |
DataManager manager = DALLocator.getDataManager(); |
283 | 286 |
String provider = "Gdal Store"; |
... | ... | |
323 | 326 |
incrementableTask = null; |
324 | 327 |
} |
325 | 328 |
if(viewName != null) { |
326 |
if (RasterToolsUtil.messageBoxYesOrNot("cargar_toc", this)) {
|
|
329 |
if (RasterSwingLibrary.messageBoxYesOrNot("cargar_toc", this)) {
|
|
327 | 330 |
try { |
328 | 331 |
for (int i = 0; i < drawableBands.length; i++) { |
329 |
FLayer lyr = RasterToolsUtil.loadLayer(viewName, fileNames[i], null);
|
|
332 |
FLayer lyr = RasterMainPluginUtils.loadLayer(viewName, fileNames[i], null);
|
|
330 | 333 |
if(lyr != null && lyr instanceof DefaultFLyrRaster) |
331 | 334 |
((DefaultFLyrRaster)lyr).setRois(rasterSE.getRois()); |
332 | 335 |
} |
333 | 336 |
} catch (RasterNotLoadException e) { |
334 |
RasterToolsUtil.messageBoxError("error_load_layer", this, e);
|
|
337 |
RasterSwingLibrary.messageBoxError("error_load_layer", this, e);
|
|
335 | 338 |
} |
336 | 339 |
} |
337 | 340 |
} |
... | ... | |
342 | 345 |
} else { |
343 | 346 |
if (isUsingFile(fileName)) { |
344 | 347 |
incrementableTask.hideWindow(); |
345 |
RasterToolsUtil.messageBoxError("error_opened_file", this);
|
|
348 |
RasterSwingLibrary.messageBoxError("error_opened_file", this);
|
|
346 | 349 |
return; |
347 | 350 |
} |
348 | 351 |
File f = new File(fileName); |
... | ... | |
368 | 371 |
try { |
369 | 372 |
provider = rManager.createWriter(finalFileName).getProviderName(); |
370 | 373 |
} catch (NotSupportedExtensionException e1) { |
371 |
RasterToolsUtil.messageBoxError("no_driver_escritura", this, e1);
|
|
374 |
RasterSwingLibrary.messageBoxError("no_driver_escritura", this, e1);
|
|
372 | 375 |
} catch (RasterDriverException e1) { |
373 |
RasterToolsUtil.messageBoxError("no_driver_escritura", this, e1);
|
|
376 |
RasterSwingLibrary.messageBoxError("no_driver_escritura", this, e1);
|
|
374 | 377 |
} |
375 | 378 |
|
376 | 379 |
sparams = (NewRasterStoreParameters)serverExplorer.getAddParameters(provider); |
... | ... | |
405 | 408 |
} |
406 | 409 |
|
407 | 410 |
} catch (RasterDriverException e) { |
408 |
RasterToolsUtil.messageBoxError("error_writer", this, e);
|
|
411 |
RasterSwingLibrary.messageBoxError("error_writer", this, e);
|
|
409 | 412 |
} catch (ValidateDataParametersException e) { |
410 |
RasterToolsUtil.messageBoxError("error_georasterwriter", this, e);
|
|
413 |
RasterSwingLibrary.messageBoxError("error_georasterwriter", this);
|
|
411 | 414 |
} catch (ProviderNotRegisteredException e) { |
412 |
RasterToolsUtil.messageBoxError("error_georasterwriter", this, e);
|
|
415 |
RasterSwingLibrary.messageBoxError("error_georasterwriter", this, e);
|
|
413 | 416 |
} catch (InitializeException e) { |
414 |
RasterToolsUtil.messageBoxError("error_georasterwriter", this, e);
|
|
417 |
RasterSwingLibrary.messageBoxError("error_georasterwriter", this, e);
|
|
415 | 418 |
} catch (DataException e) { |
416 |
RasterToolsUtil.messageBoxError("error_georasterwriter", this, e);
|
|
419 |
RasterSwingLibrary.messageBoxError("error_georasterwriter", this, e);
|
|
417 | 420 |
} catch (Exception e) { |
418 | 421 |
e.printStackTrace(); |
419 | 422 |
} finally { |
... | ... | |
433 | 436 |
* regiones de inter?s seleccionadas. |
434 | 437 |
* @param buffer |
435 | 438 |
*/ |
436 |
private void drawOnlyROIs(Buffer buffer, ArrayList<VectorialROI> rois, int despX, int despY){
|
|
439 |
private void drawOnlyROIs(Buffer buffer, List<ROI> rois, int despX, int despY){
|
|
437 | 440 |
for (int i = 0 ; i < buffer.getWidth() ; i++){ |
438 | 441 |
for (int j = 0 ; j < buffer.getHeight() ; j++){ |
439 | 442 |
boolean inside = false; |
440 | 443 |
for (int k = 0 ; k < rois.size() ; k++){ |
441 |
VectorialROI roi = (VectorialROI)rois.get(k);
|
|
444 |
ROI roi = rois.get(k);
|
|
442 | 445 |
//TODO: Hacer la comprobacion por coordenadas del mundo en lugar de coordenadas pixel. |
443 | 446 |
if (roi.isInsideOfPolygon(i + despX, j + despY)){ |
444 | 447 |
inside = true; |
... | ... | |
506 | 509 |
return; |
507 | 510 |
|
508 | 511 |
if(viewName != null) { |
509 |
if (RasterToolsUtil.messageBoxYesOrNot("cargar_toc", this)) {
|
|
512 |
if (RasterSwingLibrary.messageBoxYesOrNot("cargar_toc", this)) {
|
|
510 | 513 |
|
511 | 514 |
try { |
512 |
FLayer lyr = RasterToolsUtil.loadLayer(viewName, fileName, null);
|
|
515 |
FLayer lyr = RasterMainPluginUtils.loadLayer(viewName, fileName, null);
|
|
513 | 516 |
if(lyr != null && lyr instanceof DefaultFLyrRaster) |
514 | 517 |
((DefaultFLyrRaster)lyr).setRois(rasterSE.getRois()); |
515 | 518 |
} catch (RasterNotLoadException e) { |
516 |
RasterToolsUtil.messageBoxError("error_load_layer", this, e);
|
|
519 |
RasterSwingLibrary.messageBoxError("error_load_layer", this, e);
|
|
517 | 520 |
} catch (ROIException e) { |
518 |
RasterToolsUtil.messageBoxError("error_load_layer", this, e);
|
|
521 |
RasterSwingLibrary.messageBoxError("error_load_layer", this, e);
|
|
519 | 522 |
} |
520 | 523 |
} |
521 | 524 |
} |
... | ... | |
537 | 540 |
* @see org.gvsig.gui.beans.incrementabletask.IIncrementable#getTitle() |
538 | 541 |
*/ |
539 | 542 |
public String getTitle() { |
540 |
return RasterToolsUtil.getText(this, "incremento_recorte");
|
|
543 |
return Messages.getText("incremento_recorte");
|
|
541 | 544 |
} |
542 | 545 |
|
543 | 546 |
/* |
Also available in: Unified diff