Revision 875
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/RasterExtension.java | ||
---|---|---|
451 | 451 |
"linecursor-icon", |
452 | 452 |
getClass().getClassLoader().getResource("images/LineCursor.png") |
453 | 453 |
); |
454 |
PluginServices.getIconTheme().registerDefault( |
|
455 |
"export-icon", |
|
456 |
getClass().getClassLoader().getResource("images/export.png") |
|
457 |
); |
|
458 |
PluginServices.getIconTheme().registerDefault( |
|
459 |
"import-icon", |
|
460 |
getClass().getClassLoader().getResource("images/import.png") |
|
461 |
); |
|
462 |
PluginServices.getIconTheme().registerDefault( |
|
463 |
"round-icon", |
|
464 |
getClass().getClassLoader().getResource("images/round.png") |
|
465 |
); |
|
466 |
PluginServices.getIconTheme().registerDefault( |
|
467 |
"rois-icon", |
|
468 |
getClass().getClassLoader().getResource("images/rois.png") |
|
469 |
); |
|
470 |
PluginServices.getIconTheme().registerDefault( |
|
471 |
"fullextent-icon", |
|
472 |
getClass().getClassLoader().getResource("images/fullExtent.png") |
|
473 |
); |
|
474 |
PluginServices.getIconTheme().registerDefault( |
|
475 |
"selecttool-icon", |
|
476 |
getClass().getClassLoader().getResource("images/selectTool.png") |
|
477 |
); |
|
454 | 478 |
} |
455 | 479 |
/* |
456 | 480 |
* (non-Javadoc) |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/clip/ui/panel/ClippingCoordinatesPanel.java | ||
---|---|---|
30 | 30 |
import javax.swing.JPanel; |
31 | 31 |
|
32 | 32 |
import org.gvsig.andami.PluginServices; |
33 |
import org.gvsig.gui.beans.buttonbar.ButtonBarContainer; |
|
34 | 33 |
import org.gvsig.gui.beans.coordinatespanel.CoordinatesPanel; |
35 | 34 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
35 |
import org.gvsig.raster.tools.app.basic.raster.bean.buttonbar.ButtonBarContainer; |
|
36 | 36 |
import org.gvsig.raster.tools.app.basic.tool.clip.ui.listener.ClippingPanelListener; |
37 | 37 |
|
38 | 38 |
/** |
... | ... | |
64 | 64 |
getButtonBarContainer().getButton(2).addActionListener(clippingPanelListener); |
65 | 65 |
getButtonBarContainer().getButton(3).addActionListener(clippingPanelListener); |
66 | 66 |
getButtonBarContainer().getButton(4).addActionListener(clippingPanelListener); |
67 |
|
|
67 |
getButtonBarContainer().getButton(5).addActionListener(clippingPanelListener); |
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
/** |
... | ... | |
132 | 132 |
public ButtonBarContainer getButtonBarContainer() { |
133 | 133 |
if (buttonBarContainer == null) { |
134 | 134 |
buttonBarContainer = new ButtonBarContainer(); |
135 |
buttonBarContainer.addButton("export.png", RasterToolsUtil.getText(this, "load_parameters"), 0); |
|
136 |
buttonBarContainer.addButton("import.png", RasterToolsUtil.getText(this, "save_parameters"), 1); |
|
137 |
buttonBarContainer.addButton("rois.png", RasterToolsUtil.getText(this, "adjust_to_rois"), 2); |
|
138 |
buttonBarContainer.addButton("fullExtent.png", RasterToolsUtil.getText(this, "fullExtent"), 3); |
|
139 |
buttonBarContainer.addButton("selectTool.png", RasterToolsUtil.getText(this, "select_tool"), 4); |
|
135 |
buttonBarContainer.addButton("export-icon", RasterToolsUtil.getText(this, "load_parameters"), 0); |
|
136 |
buttonBarContainer.addButton("import-icon", RasterToolsUtil.getText(this, "save_parameters"), 1); |
|
137 |
buttonBarContainer.addButton("round-icon", RasterToolsUtil.getText(this, "round_pixels"), 2); |
|
138 |
buttonBarContainer.addButton("rois-icon", RasterToolsUtil.getText(this, "adjust_to_rois"), 3); |
|
139 |
buttonBarContainer.addButton("fullextent-icon", RasterToolsUtil.getText(this, "fullExtent"), 4); |
|
140 |
buttonBarContainer.addButton("selecttool-icon", RasterToolsUtil.getText(this, "select_tool"), 5); |
|
140 | 141 |
buttonBarContainer.setButtonAlignment("right"); |
141 | 142 |
buttonBarContainer.setComponentBorder(false); |
142 | 143 |
buttonBarContainer.setBorder(BorderFactory.createLineBorder(new Color(189, 190, 176))); |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/clip/ui/ClippingPanel.java | ||
---|---|---|
88 | 88 |
} |
89 | 89 |
|
90 | 90 |
/** |
91 |
* Gets the listener |
|
92 |
* @return |
|
93 |
*/ |
|
94 |
public ClippingPanelListener getListener() { |
|
95 |
return clippingPanelListener; |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
91 | 99 |
* A?ade listeners a los controles que lo necesitan |
92 | 100 |
* @param list |
93 | 101 |
*/ |
... | ... | |
217 | 225 |
getResolutionPanel().setHeightText(Math.round(data.getPxHeight()), 0); |
218 | 226 |
RasterUtils util = RasterLocator.getManager().getRasterUtils(); |
219 | 227 |
getCoordinatesPanel().setCoordReal(util.getCoord(data.getUlxWc(), data.getUlyWc(), data.getLrxWc(), data.getLryWc(), ClippingData.DEC)); |
220 |
getCoordinatesPanel().setCoordPixel(util.getCoord(data.getPxMinX(), data.getPxMinY(), data.getPxMaxX(), data.getPxMaxY(), ClippingData.DEC));
|
|
228 |
getCoordinatesPanel().setCoordPixel(util.getCoord(data.getUlxPx(), data.getUlyPx(), data.getLrxPx(), data.getLryPx(), ClippingData.DEC));
|
|
221 | 229 |
getResolutionPanel().setCellSizeText(data.getCellSize(), ClippingData.DEC); |
222 | 230 |
clippingPanelListener.setEnableValueChangedEvent(true); |
223 | 231 |
} |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/clip/ui/listener/ClippingPanelListener.java | ||
---|---|---|
164 | 164 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(1)) { |
165 | 165 |
lastDataSaved = (ClippingData)data.clone(); |
166 | 166 |
} |
167 |
|
|
168 |
//Redondear las coordenadas p?xel |
|
169 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(2)) { |
|
170 |
roundPixels(); |
|
171 |
return; |
|
172 |
} |
|
167 | 173 |
|
168 | 174 |
//Bot?n de selecci?n del ?rea m?xima asociada a los ROIs |
169 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(2)) {
|
|
175 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(3)) {
|
|
170 | 176 |
ArrayList<ROI> roiList = getFLayer().getRois(); |
171 | 177 |
if(roiList != null && roiList.size() > 0) { |
172 | 178 |
Extent ext = RasterLocator.getManager().getRasterUtils().getROIsMaximunExtent(roiList); |
... | ... | |
178 | 184 |
|
179 | 185 |
// Bot?n de selecci?n del extent completo |
180 | 186 |
// Modificamos las coordenadas reales y recalculamos las coordenadas pixel |
181 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(3)) {
|
|
187 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(4)) {
|
|
182 | 188 |
assignFullExtent(); |
183 | 189 |
return; |
184 | 190 |
} |
185 | 191 |
|
186 | 192 |
// Bot?n de selecci?n de la herramienta de seleccionar desde la vista |
187 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(4)) {
|
|
193 |
if (e.getSource() == getCoordinatesPanel().getButtonBarContainer().getButton(5)) {
|
|
188 | 194 |
selectToolButton(); |
189 | 195 |
return; |
190 | 196 |
} |
191 | 197 |
|
192 | 198 |
} |
199 |
|
|
200 |
/** |
|
201 |
* Round off the pixels value |
|
202 |
*/ |
|
203 |
private void roundPixels() { |
|
204 |
data.setUlxPx((int)(data.getUlxPx())); |
|
205 |
data.setUlyPx((int)(data.getUlyPx())); |
|
206 |
data.setLrxPx((int)(data.getLrxPx())); |
|
207 |
data.setLryPx((int)(data.getLryPx())); |
|
208 |
data.setUrxPx((int)(data.getUrxPx())); |
|
209 |
data.setUryPx((int)(data.getUryPx())); |
|
210 |
data.setLlxPx((int)(data.getLlxPx())); |
|
211 |
data.setLlyPx((int)(data.getLlyPx())); |
|
212 |
|
|
213 |
Point2D ulWc = new Point2D.Double(); |
|
214 |
Point2D lrWc = new Point2D.Double(); |
|
215 |
Point2D llWc = new Point2D.Double(); |
|
216 |
Point2D urWc = new Point2D.Double(); |
|
217 |
|
|
218 |
at.transform(new Point2D.Double(data.getUlxPx(), data.getUlyPx()), ulWc); |
|
219 |
at.transform(new Point2D.Double(data.getLrxPx() + 1, data.getLryPx() + 1), lrWc); |
|
220 |
at.transform(new Point2D.Double(data.getLlxPx(), data.getLlyPx() + 1), llWc); |
|
221 |
at.transform(new Point2D.Double(data.getUrxPx() + 1, data.getUryPx()), urWc); |
|
193 | 222 |
|
223 |
data.setCoorReal(ulWc, lrWc, llWc, urWc); |
|
224 |
data.setAffineTransform(at); |
|
225 |
data.initSize(); |
|
226 |
data.updateObservers(); |
|
227 |
} |
|
228 |
|
|
194 | 229 |
/** |
195 | 230 |
* Asigna el extent completo a los cuadros de texto donde se introducen las coordenadas |
196 | 231 |
* reales y p?xel. |
... | ... | |
320 | 355 |
} |
321 | 356 |
} |
322 | 357 |
|
358 |
|
|
323 | 359 |
/** |
324 | 360 |
* Recalcula el valor de los campos de coordenadas reales y pixel. Cuando modificamos alg?n campo |
325 | 361 |
* de las coordenadas reales se modifican los pixeles y viceversa. |
... | ... | |
327 | 363 |
* alg?n campo de las coordenadas reales. |
328 | 364 |
*/ |
329 | 365 |
@SuppressWarnings("deprecation") |
330 |
private void recalcCoordFields(boolean modifyPx, boolean modifyUL, boolean modifyX) {
|
|
366 |
private void recalcCoordFields(boolean modifyPx) { |
|
331 | 367 |
try { |
332 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false); |
|
333 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false); |
|
334 |
|
|
368 |
Point2D ulPx = new Point2D.Double(data.getUlxPx(), data.getUlyPx()); |
|
369 |
Point2D lrPx = new Point2D.Double(data.getLrxPx(), data.getLryPx()); |
|
370 |
Point2D llPx = new Point2D.Double(data.getLlxPx(), data.getLlyPx()); |
|
371 |
Point2D urPx = new Point2D.Double(data.getUrxPx(), data.getUryPx()); |
|
372 |
|
|
373 |
Point2D ulWc = new Point2D.Double(data.getUlxWc(), data.getUlyWc()); |
|
374 |
Point2D lrWc = new Point2D.Double(data.getLrxWc(), data.getLryWc()); |
|
375 |
Point2D llWc = new Point2D.Double(data.getLlxWc(), data.getLlyWc()); |
|
376 |
Point2D urWc = new Point2D.Double(data.getUrxWc(), data.getUryWc()); |
|
377 |
|
|
335 | 378 |
if (modifyPx) { |
336 |
Point2D ulPx = new Point2D.Double(data.getUlxPx(), data.getUlyPx());
|
|
337 |
Point2D lrPx = new Point2D.Double(data.getLrxPx(), data.getLryPx());
|
|
338 |
Point2D llPx = new Point2D.Double(data.getLlxPx(), data.getLlyPx());
|
|
339 |
Point2D urPx = new Point2D.Double(data.getUrxPx(), data.getUryPx());
|
|
379 |
at.transform(new Point2D.Double(ulPx.getX(), ulPx.getY()), ulWc);
|
|
380 |
at.transform(new Point2D.Double(lrPx.getX() + 1, lrPx.getY() + 1), lrWc);
|
|
381 |
at.transform(new Point2D.Double(llPx.getX(), llPx.getY() + 1), llWc);
|
|
382 |
at.transform(new Point2D.Double(urPx.getX() + 1, urPx.getY()), urWc);
|
|
340 | 383 |
|
341 |
//Comprobamos que las esquinas no esten cambiadas de sitio |
|
342 |
//Mueve la ULX |
|
343 |
if(modifyUL && modifyX) { |
|
344 |
if(ulPx.getX() > lrPx.getX()) { |
|
345 |
urPx.setLocation(dim.width, urPx.getY()); |
|
346 |
lrPx.setLocation(dim.width, lrPx.getY()); |
|
347 |
} |
|
348 |
} |
|
349 |
|
|
350 |
//Mueve la LRX |
|
351 |
if(!modifyUL && modifyX) { |
|
352 |
if(lrPx.getX() < ulPx.getX()) { |
|
353 |
ulPx.setLocation(0, ulPx.getY()); |
|
354 |
llPx.setLocation(0, llPx.getY()); |
|
355 |
} |
|
356 |
} |
|
357 |
|
|
358 |
//Mueve la ULY |
|
359 |
if(modifyUL && !modifyX) { |
|
360 |
if(ulPx.getY() > lrPx.getY()) { |
|
361 |
llPx.setLocation(llPx.getX(), dim.height); |
|
362 |
lrPx.setLocation(lrPx.getX(), dim.height); |
|
363 |
} |
|
364 |
} |
|
365 |
|
|
366 |
//Mueve la LRY |
|
367 |
if(!modifyUL && !modifyX) { |
|
368 |
if(lrPx.getY() < ulPx.getY()) { |
|
369 |
ulPx.setLocation(ulPx.getX(), 0); |
|
370 |
urPx.setLocation(urPx.getX(), 0); |
|
371 |
} |
|
372 |
} |
|
373 |
|
|
374 |
//Ajustamos la selecci?n al ?rea |
|
375 |
ulPx = adjustPixelRequest(ulPx); |
|
376 |
lrPx = adjustPixelRequest(lrPx); |
|
377 |
|
|
378 |
Point2D ulWc = new Point2D.Double(); |
|
379 |
Point2D lrWc = new Point2D.Double(); |
|
380 |
Point2D llWc = new Point2D.Double(); |
|
381 |
Point2D urWc = new Point2D.Double(); |
|
382 |
|
|
383 |
at.transform(ulPx, ulWc); |
|
384 |
at.transform(lrPx, lrWc); |
|
385 |
at.transform(llPx, llWc); |
|
386 |
at.transform(urPx, urWc); |
|
387 |
|
|
388 |
data.setCoorPixel(ulPx, lrPx, llPx, urPx); |
|
389 | 384 |
data.setCoorReal(ulWc, lrWc, llWc, urWc); |
390 | 385 |
data.setAffineTransform(at); |
391 | 386 |
data.initSize(); |
392 | 387 |
|
393 | 388 |
getClippingPanel().saveStatus(data); |
394 |
|
|
395 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(true); |
|
396 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(true); |
|
397 | 389 |
} else { |
398 |
Point2D ulWc = new Point2D.Double(data.getUlxWc(), data.getUlyWc()); |
|
399 |
Point2D lrWc = new Point2D.Double(data.getLrxWc(), data.getLryWc()); |
|
400 |
Point2D llWc = new Point2D.Double(data.getLlxWc(), data.getLlyWc()); |
|
401 |
Point2D urWc = new Point2D.Double(data.getUrxWc(), data.getUryWc()); |
|
402 |
|
|
403 |
//Mueve la ULX |
|
404 |
if(modifyUL && modifyX) { |
|
405 |
if(ulWc.getX() > lrWc.getX()) { |
|
406 |
urWc.setLocation(fLayer.getMaxX(), urWc.getY()); |
|
407 |
lrWc.setLocation(fLayer.getMaxX(), lrWc.getY()); |
|
408 |
} |
|
409 |
} |
|
410 |
|
|
411 |
//Mueve la LRX |
|
412 |
if(!modifyUL && modifyX) { |
|
413 |
if(lrWc.getX() < ulWc.getX()) { |
|
414 |
ulWc.setLocation(fLayer.getMinX(), ulWc.getY()); |
|
415 |
llWc.setLocation(fLayer.getMinX(), llWc.getY()); |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
419 |
//Mueve la ULY |
|
420 |
if(modifyUL && !modifyX) { |
|
421 |
if(ulWc.getY() < lrWc.getY()) { |
|
422 |
llWc.setLocation(llWc.getX(), fLayer.getMinY()); |
|
423 |
lrWc.setLocation(lrWc.getX(), fLayer.getMinY()); |
|
424 |
} |
|
425 |
} |
|
426 |
|
|
427 |
//Mueve la LRY |
|
428 |
if(!modifyUL && !modifyX) { |
|
429 |
if(lrWc.getY() > ulWc.getY()) { |
|
430 |
ulWc.setLocation(ulWc.getX(), fLayer.getMaxY()); |
|
431 |
urWc.setLocation(urWc.getX(), fLayer.getMaxY()); |
|
432 |
} |
|
433 |
} |
|
434 |
|
|
435 |
//Ajustamos la selecci?n al ?rea |
|
436 |
ulWc = getFLayer().adjustWorldRequest(ulWc); |
|
437 |
lrWc = getFLayer().adjustWorldRequest(lrWc); |
|
438 |
llWc = getFLayer().adjustWorldRequest(llWc); |
|
439 |
urWc = getFLayer().adjustWorldRequest(urWc); |
|
440 |
|
|
441 |
Point2D ulPx = new Point2D.Double(); |
|
442 |
Point2D lrPx = new Point2D.Double(); |
|
443 |
Point2D llPx = new Point2D.Double(); |
|
444 |
Point2D urPx = new Point2D.Double(); |
|
445 |
|
|
446 | 390 |
try { |
447 | 391 |
at.inverseTransform(ulWc, ulPx); |
448 | 392 |
at.inverseTransform(lrWc, lrPx); |
... | ... | |
453 | 397 |
return; |
454 | 398 |
} |
455 | 399 |
|
456 |
adjustPoints(ulPx, lrPx); |
|
457 |
adjustPoints(llPx, urPx); |
|
400 |
//adjustPoints(ulPx, lrPx); |
|
401 |
//adjustPoints(llPx, urPx); |
|
402 |
lrPx = new Point2D.Double(lrPx.getX() - 1, lrPx.getY() - 1); |
|
403 |
llPx = new Point2D.Double(llPx.getX(), llPx.getY() - 1); |
|
404 |
urPx = new Point2D.Double(urPx.getX() - 1, urPx.getY()); |
|
458 | 405 |
data.setCoorPixel(ulPx, lrPx, llPx, urPx); |
459 |
data.setCoorReal(ulWc, lrWc, llWc, urWc); |
|
460 | 406 |
data.setAffineTransform(at); |
461 | 407 |
data.initSize(); |
462 | 408 |
getClippingPanel().saveStatus(data); |
463 |
|
|
409 |
} |
|
410 |
|
|
411 |
//Condiciones para activar botones. |
|
412 |
if(activeButtons(ulPx, lrPx, ulWc, lrWc)) { |
|
464 | 413 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(true); |
465 | 414 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(true); |
415 |
} else { |
|
416 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false); |
|
417 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false); |
|
466 | 418 |
} |
419 |
|
|
467 | 420 |
} catch (NumberFormatException ex) { |
468 | 421 |
return; |
469 | 422 |
} |
470 | 423 |
|
471 | 424 |
} |
472 | 425 |
|
426 |
public boolean activeButtons(Point2D ulPx, Point2D lrPx, Point2D ulWc, Point2D lrWc) { |
|
427 |
if(ulPx.getX() < lrPx.getX() && ulPx.getY() < lrPx.getY() && |
|
428 |
ulWc.getX() < lrWc.getX() && ulWc.getY() > lrWc.getY() && |
|
429 |
(lrPx.getX() - ulPx.getX()) >= 2 && (lrPx.getY() - ulPx.getY()) >= 2 && |
|
430 |
ulPx.getX() >= 0 && ulPx.getY() >= 0 && |
|
431 |
lrPx.getX() <= (fLayer.getDataStore().getWidth() - 1) && |
|
432 |
lrPx.getY() <= (fLayer.getDataStore().getHeight() - 1)) { |
|
433 |
return true; |
|
434 |
} |
|
435 |
return false; |
|
436 |
} |
|
437 |
|
|
473 | 438 |
/** |
474 | 439 |
* Turns world coordinates into entire numbers to avoid rounds errors |
475 | 440 |
* @param ul |
... | ... | |
591 | 556 |
} |
592 | 557 |
|
593 | 558 |
double[] wcValues = data.getWcCoordinatesToClip(); |
594 |
//double[] pxSize = data.getPxSizeToClip(); |
|
559 |
double[] pxValues = data.getPxCoordinatesToClip(); |
|
560 |
boolean pxRound = arePixelsRound(pxValues); |
|
595 | 561 |
|
596 | 562 |
// Seleccionamos las bandas que se usaran en el recorte a partir de la tabla |
597 | 563 |
int countBands = 0; |
... | ... | |
642 | 608 |
if (getFLayer() == null) |
643 | 609 |
return; |
644 | 610 |
|
645 |
AffineTransform transf = calcAffineTransform(wcValues[0], wcValues[1], wcValues[2], wcValues[3], |
|
646 |
Math.round(data.getPxWidth()), Math.round(data.getPxHeight()), at); |
|
611 |
AffineTransform transf = null; |
|
612 |
if(pxRound && |
|
613 |
((pxValues[2] - pxValues[0] + 1) == data.getPxWidth()) && |
|
614 |
((pxValues[3] - pxValues[1] + 1) == data.getPxHeight())) |
|
615 |
transf = new AffineTransform(at.getScaleX(), at.getShearY(), at.getShearX(), at.getScaleY(), wcValues[0], wcValues[1]); |
|
616 |
else |
|
617 |
transf = calcAffineTransform(wcValues[0], wcValues[1], wcValues[2], wcValues[3], |
|
618 |
Math.round(data.getPxWidth()), Math.round(data.getPxHeight()), at); |
|
619 |
|
|
647 | 620 |
|
648 | 621 |
int interpMethod = getResolutionPanel().getSelectedInterpolationMethod(); |
649 | 622 |
|
... | ... | |
678 | 651 |
RasterProcess clippingProcess = new ClippingProcess(); |
679 | 652 |
clippingProcess.setActions(this); |
680 | 653 |
clippingProcess.addParam("viewname", getViewName()); |
681 |
//clippingProcess.addParam("pixelcoordinates", dValues); |
|
682 |
clippingProcess.addParam("realcoordinates", wcValues); |
|
654 |
if(pxRound) |
|
655 |
clippingProcess.addParam("pixelcoordinates", pxValues); |
|
656 |
else |
|
657 |
clippingProcess.addParam("realcoordinates", wcValues); |
|
683 | 658 |
clippingProcess.addParam("filename", filename); |
684 | 659 |
clippingProcess.addParam("datawriter", dataWriter); |
685 | 660 |
clippingProcess.addParam("layer", getFLayer()); |
... | ... | |
726 | 701 |
trans.transform(lr, lr); |
727 | 702 |
trans.transform(ll, ll); |
728 | 703 |
|
729 |
double pixelSizeX = (ur.getX() - ul.getX()) / width;
|
|
730 |
double pixelSizeY = (ll.getY() - ul.getY()) / height;
|
|
704 |
double pixelSizeX = (lrx - ulx) / width;
|
|
705 |
double pixelSizeY = (lry - uly) / height;
|
|
731 | 706 |
double rotX = trans.getShearX(); |
732 | 707 |
double rotY = trans.getShearY(); |
733 | 708 |
return new AffineTransform(pixelSizeX, rotY, rotX, pixelSizeY, ulx, uly); |
734 | 709 |
} |
710 |
|
|
711 |
/** |
|
712 |
* Returns true if the pixels are round |
|
713 |
* @param pxValues |
|
714 |
* @return |
|
715 |
*/ |
|
716 |
private boolean arePixelsRound(double[] pxValues) { |
|
717 |
if((((int)pxValues[0]) - pxValues[0]) == 0 && |
|
718 |
(((int)pxValues[1]) - pxValues[1]) == 0 && |
|
719 |
(((int)pxValues[2]) - pxValues[2]) == 0 && |
|
720 |
(((int)pxValues[3]) - pxValues[3]) == 0) { |
|
721 |
return true; |
|
722 |
} |
|
723 |
return false; |
|
724 |
} |
|
735 | 725 |
|
736 | 726 |
/* |
737 | 727 |
* (non-Javadoc) |
... | ... | |
756 | 746 |
public void actionValueChanged(CoordinatesEvent e) { |
757 | 747 |
if (e.getSource() == getCoordinatesPanel().getPixelCoordinates()) { |
758 | 748 |
eventJTextField(e); |
759 |
if (e.getName().equals("11")) |
|
760 |
recalcCoordFields(true, true, true); |
|
761 |
if (e.getName().equals("12")) |
|
762 |
recalcCoordFields(true, true, false); |
|
763 |
if (e.getName().equals("21")) |
|
764 |
recalcCoordFields(true, false, true); |
|
765 |
if (e.getName().equals("22")) |
|
766 |
recalcCoordFields(true, false, false); |
|
749 |
if (e.getName().equals("11") || |
|
750 |
e.getName().equals("12") || |
|
751 |
e.getName().equals("21") || |
|
752 |
e.getName().equals("22")) |
|
753 |
recalcCoordFields(true); |
|
754 |
|
|
767 | 755 |
} |
768 | 756 |
if (e.getSource() == getCoordinatesPanel().getRealCoordinates()) { |
769 | 757 |
eventJTextField(e); |
770 |
if (e.getName().equals("11")) |
|
771 |
recalcCoordFields(false, true, true); |
|
772 |
if (e.getName().equals("12")) |
|
773 |
recalcCoordFields(false, true, false); |
|
774 |
if (e.getName().equals("21")) |
|
775 |
recalcCoordFields(false, false, true); |
|
776 |
if (e.getName().equals("22")) |
|
777 |
recalcCoordFields(false, false, false); |
|
758 |
if (e.getName().equals("11") || |
|
759 |
e.getName().equals("12") || |
|
760 |
e.getName().equals("21") || |
|
761 |
e.getName().equals("22")) |
|
762 |
recalcCoordFields(false); |
|
778 | 763 |
} |
779 | 764 |
} |
780 | 765 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/clip/ui/listener/ClippingMouseViewListener.java | ||
---|---|---|
82 | 82 |
*/ |
83 | 83 |
public void rectangle(EnvelopeEvent event) { |
84 | 84 |
super.rectangle(event); |
85 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false); |
|
86 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false); |
|
87 | 85 |
|
88 | 86 |
if(((FLyrRaster) layer).getAffineTransform() == null) |
89 | 87 |
return; |
... | ... | |
126 | 124 |
at.transform(llPx, llWc); |
127 | 125 |
at.transform(urPx, urWc); |
128 | 126 |
|
129 |
data.setCoorPixel(ulPx, lrPx, llPx, urPx); |
|
127 |
data.setCoorPixel(ulPx, lrPx, llPx, urPx);
|
|
130 | 128 |
data.setCoorReal(ulWc, lrWc, llWc, urWc); |
131 | 129 |
data.setAffineTransform(at); |
132 | 130 |
data.initSize(); |
... | ... | |
136 | 134 |
|
137 | 135 |
clippingPanel.saveStatus(data); |
138 | 136 |
|
139 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(true); |
|
140 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(true); |
|
137 |
if(clippingPanel.getListener().activeButtons(ulPx, lrPx, ulWc, lrWc)) { |
|
138 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(true); |
|
139 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(true); |
|
140 |
} else { |
|
141 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false); |
|
142 |
clippingPanel.getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false); |
|
143 |
} |
|
141 | 144 |
|
142 | 145 |
if (currentTool != null) |
143 | 146 |
mapControl.setTool(currentTool); |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/clip/ClippingData.java | ||
---|---|---|
145 | 145 |
* @return |
146 | 146 |
*/ |
147 | 147 |
public double getCellSize() { |
148 |
return Math.abs(ulWc.getX() - lrWc.getX()) / pxWidth; |
|
148 |
if(((lrPx.getX() - ulPx.getX() + 1) == getPxWidth()) && |
|
149 |
((lrPx.getY() - ulPx.getY() + 1) == getPxHeight())) |
|
150 |
return at != null ? at.getScaleX() : 0; |
|
151 |
else |
|
152 |
return Math.abs(ulWc.getX() - lrWc.getX()) / pxWidth; |
|
149 | 153 |
} |
150 | 154 |
|
151 | 155 |
/** |
... | ... | |
551 | 555 |
* @return double[] |
552 | 556 |
*/ |
553 | 557 |
public double[] getWcCoordinatesToClip() { |
554 |
Point2D ul = new Point2D.Double(getPxMinX(), getPxMinY()); |
|
558 |
/*Point2D ul = new Point2D.Double(getPxMinX(), getPxMinY());
|
|
555 | 559 |
Point2D lr = new Point2D.Double(getPxMaxX(), getPxMaxY()); |
556 | 560 |
at.transform(ul, ul); |
557 | 561 |
at.transform(lr, lr); |
558 |
return new double[]{ul.getX(), ul.getY(), lr.getX(), lr.getY()}; |
|
562 |
return new double[]{ul.getX(), ul.getY(), lr.getX(), lr.getY()};*/ |
|
563 |
return new double[]{ulWc.getX(), ulWc.getY(), lrWc.getX(), lrWc.getY()}; |
|
559 | 564 |
} |
565 |
|
|
566 |
/** |
|
567 |
* Gets the pixel coordinates to clip |
|
568 |
* @return double[] |
|
569 |
*/ |
|
570 |
public double[] getPxCoordinatesToClip() { |
|
571 |
return new double[]{ulPx.getX(), ulPx.getY(), lrPx.getX(), lrPx.getY()}; |
|
572 |
} |
|
560 | 573 |
|
561 | 574 |
/** |
562 | 575 |
* Obtiene el tama?o en pixeles de la imagen de la petici?n de recorte |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/tool/clip/ClippingTocMenuEntry.java | ||
---|---|---|
32 | 32 |
import org.gvsig.fmap.mapcontrol.MapControl; |
33 | 33 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior; |
34 | 34 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior; |
35 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
|
35 | 36 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
36 | 37 |
import org.gvsig.raster.fmap.layers.ILayerState; |
37 | 38 |
import org.gvsig.raster.fmap.layers.IRasterLayerActions; |
... | ... | |
173 | 174 |
loadClippingListener(mapCtrl, clippingMouseViewListener, ((FLyrRaster)fLayer)); |
174 | 175 |
|
175 | 176 |
clippingData.updateObservers(); |
177 |
|
|
178 |
clippingDialog.getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false); |
|
179 |
clippingDialog.getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false); |
|
180 |
|
|
176 | 181 |
RasterToolsUtil.addWindow(clippingDialog); |
177 | 182 |
} |
178 | 183 |
|
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/raster/process/ClippingProcess.java | ||
---|---|---|
75 | 75 |
private AffineTransform affineTransform = new AffineTransform(); |
76 | 76 |
private boolean oneLayerPerBand = false; |
77 | 77 |
private int[] drawableBands = { 0, 1, 2 }; |
78 |
private int[] pValues = null;
|
|
78 |
private double[] pValues = null;
|
|
79 | 79 |
private RasterWriter rw = null; |
80 | 80 |
private int interpolationMethod = Buffer.INTERPOLATION_Undefined; |
81 | 81 |
private String viewName = ""; |
... | ... | |
115 | 115 |
fileName = getStringParam("filename"); |
116 | 116 |
writerBufferServer = (DataServerWriter) getParam("datawriter"); |
117 | 117 |
viewName = getStringParam("viewname"); |
118 |
pValues = getIntArrayParam("pixelcoordinates");
|
|
118 |
pValues = getDoubleArrayParam("pixelcoordinates");
|
|
119 | 119 |
wcValues = getDoubleArrayParam("realcoordinates"); |
120 | 120 |
rasterSE = (FLyrRaster)getLayerParam("layer"); |
121 | 121 |
drawableBands = getIntArrayParam("drawablebands"); |
... | ... | |
218 | 218 |
if(pValues != null) { |
219 | 219 |
if (util.isBufferTooBig(new double[] { pValues[0], pValues[3], pValues[2], pValues[1] }, drawableBands.length)) |
220 | 220 |
query.setReadOnly(true); |
221 |
query.setAreaOfInterest(pValues[0], pValues[3], pValues[2] - pValues[0], pValues[1] - pValues[3]);
|
|
221 |
query.setAreaOfInterest((int)pValues[0], (int)pValues[1], (int)Math.abs(pValues[2] - pValues[0]) + 1, (int)Math.abs(pValues[3] - pValues[1]) + 1);
|
|
222 | 222 |
} else if(wcValues != null) { |
223 | 223 |
query.setReadOnly(true); |
224 | 224 |
query.setAreaOfInterest(wcValues[0], wcValues[1], Math.abs(wcValues[0] - wcValues[2]), Math.abs(wcValues[1] - wcValues[3])); |
... | ... | |
237 | 237 |
if (util.isBufferTooBig(new double[] { 0, 0, resolutionWidth, resolutionHeight }, drawableBands.length)) |
238 | 238 |
query.setReadOnly(true); |
239 | 239 |
if(pValues != null) |
240 |
query.setAreaOfInterest(pValues[0], pValues[3], Math.abs(pValues[2] - pValues[0]) + 1, Math.abs(pValues[1] - pValues[3]) + 1, resolutionWidth, resolutionHeight);
|
|
240 |
query.setAreaOfInterest((int)pValues[0], (int)pValues[3], (int)Math.abs(pValues[2] - pValues[0]) + 1, (int)Math.abs(pValues[1] - pValues[3]) + 1, resolutionWidth, resolutionHeight);
|
|
241 | 241 |
else if(wcValues != null) { |
242 | 242 |
Extent bbox = RasterLocator.getManager().getDataStructFactory().createExtent(wcValues[0], wcValues[1], wcValues[2], wcValues[3]); |
243 | 243 |
query.setAreaOfInterest(bbox, resolutionWidth, resolutionHeight); |
... | ... | |
256 | 256 |
int despX = 0; |
257 | 257 |
int despY = 0; |
258 | 258 |
if (pValues != null){ |
259 |
despX = pValues[0]; |
|
260 |
despY = pValues[1]; |
|
259 |
despX = (int)pValues[0];
|
|
260 |
despY = (int)pValues[1];
|
|
261 | 261 |
} else if (wcValues != null){ |
262 | 262 |
despX = (int)dstoreCopy.worldToRaster(new Point2D.Double(wcValues[0], wcValues[1])).getX(); |
263 | 263 |
despY = (int)dstoreCopy.worldToRaster(new Point2D.Double(wcValues[0], wcValues[1])).getY(); |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/java/org/gvsig/raster/tools/app/basic/raster/bean/buttonbar/ButtonBarContainer.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.tools.app.basic.raster.bean.buttonbar; |
|
23 |
|
|
24 |
import java.awt.FlowLayout; |
|
25 |
import java.util.ArrayList; |
|
26 |
|
|
27 |
import javax.swing.JButton; |
|
28 |
import javax.swing.JPanel; |
|
29 |
|
|
30 |
import org.gvsig.raster.tools.app.basic.RasterToolsUtil; |
|
31 |
|
|
32 |
public class ButtonBarContainer extends JPanel { |
|
33 |
private static final long serialVersionUID = -2556987128553063939L; |
|
34 |
|
|
35 |
private ArrayList<JButton> buttons = new ArrayList<JButton>(); |
|
36 |
|
|
37 |
private int wComp = 400; |
|
38 |
private int hComp = 26; |
|
39 |
private boolean disableAllControls = false; |
|
40 |
private boolean[] buttonsState = null; |
|
41 |
|
|
42 |
|
|
43 |
/** |
|
44 |
* This is the default constructor |
|
45 |
*/ |
|
46 |
public ButtonBarContainer() { |
|
47 |
super(); |
|
48 |
initialize(); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* This method initializes this |
|
53 |
* |
|
54 |
* @return void |
|
55 |
*/ |
|
56 |
private void initialize() { |
|
57 |
FlowLayout flowLayout = new FlowLayout(); |
|
58 |
flowLayout.setHgap(0); |
|
59 |
flowLayout.setVgap(0); |
|
60 |
this.setLayout(flowLayout); |
|
61 |
this.setSize(wComp, hComp); |
|
62 |
} |
|
63 |
|
|
64 |
|
|
65 |
/** |
|
66 |
* A?ade un boton al ArrayList de los botones. |
|
67 |
* |
|
68 |
* @param iconName: nombre del icono asignado al boton. La imagen tendr?a que |
|
69 |
* estar dentro de la carpeta "images/" |
|
70 |
* @param tip: tip del boton; |
|
71 |
* @param order: orden que ocupar? el boton dentro del control |
|
72 |
*/ |
|
73 |
public void addButton(String iconName, String tip, int order){ |
|
74 |
JButton bt = new JButton(); |
|
75 |
|
|
76 |
bt.setPreferredSize(new java.awt.Dimension(22, 22)); |
|
77 |
try{ |
|
78 |
if (iconName != null) |
|
79 |
bt.setIcon(RasterToolsUtil.getIcon(iconName)); |
|
80 |
}catch(NullPointerException exc){ |
|
81 |
//El icono no existe -> No se a?ade ninguno |
|
82 |
} |
|
83 |
|
|
84 |
if(tip != null) |
|
85 |
bt.setToolTipText(tip); |
|
86 |
|
|
87 |
buttons.add(order, bt); |
|
88 |
addList(); |
|
89 |
|
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* Elimina el bot?n correspondiente al indice que le pasamos. |
|
94 |
* @param index |
|
95 |
*/ |
|
96 |
public void delButton(int index){ |
|
97 |
buttons.remove(index); |
|
98 |
this.removeAll(); |
|
99 |
addList(); |
|
100 |
} |
|
101 |
|
|
102 |
/** |
|
103 |
* A?ade en el panel los botones que tenemos en el ArrayList. |
|
104 |
* |
|
105 |
*/ |
|
106 |
public void addList(){ |
|
107 |
for(int i = 0 ; i < buttons.size() ; i++){ |
|
108 |
this.add((JButton)buttons.get(i)); |
|
109 |
} |
|
110 |
} |
|
111 |
|
|
112 |
|
|
113 |
/** |
|
114 |
* Esta funci?n deshabilita todos los controles y guarda sus valores |
|
115 |
* de habilitado o deshabilitado para que cuando se ejecute restoreControlsValue |
|
116 |
* se vuelvan a quedar como estaba |
|
117 |
*/ |
|
118 |
public void disableAllControls(){ |
|
119 |
if(!disableAllControls){ |
|
120 |
disableAllControls = true; |
|
121 |
|
|
122 |
buttonsState = new boolean[buttons.size()]; |
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
for (int i = 0 ; i < buttons.size() ; i++){ |
|
127 |
|
|
128 |
//Salvamos los estados |
|
129 |
buttonsState[i] = ((JButton)buttons.get(i)).isEnabled(); |
|
130 |
//Desactivamos controles |
|
131 |
((JButton)buttons.get(i)).setEnabled(false); |
|
132 |
} |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
/** |
|
137 |
* Esta funci?n deja los controles como estaban al ejecutar la funci?n |
|
138 |
* disableAllControls |
|
139 |
*/ |
|
140 |
public void restoreControlsValue(){ |
|
141 |
if(disableAllControls){ |
|
142 |
disableAllControls = false; |
|
143 |
|
|
144 |
for(int i = 0 ; i < buttons.size() ; i++){ |
|
145 |
((JButton)buttons.get(i)).setEnabled(buttonsState[i]); |
|
146 |
} |
|
147 |
} |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* M?todo para acceder a los botones del control; |
|
152 |
* @param index |
|
153 |
* @return |
|
154 |
*/ |
|
155 |
public JButton getButton(int index){ |
|
156 |
return (JButton)buttons.get(index); |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* M?todo para establecer la posici?n de los botones dentro del control. |
|
161 |
* @param align: "left" o "right" |
|
162 |
*/ |
|
163 |
public void setButtonAlignment(String align){ |
|
164 |
FlowLayout layout = new FlowLayout(); |
|
165 |
layout.setHgap(2); |
|
166 |
layout.setVgap(0); |
|
167 |
|
|
168 |
if (align.equals("right")) |
|
169 |
layout.setAlignment(FlowLayout.RIGHT); |
|
170 |
else |
|
171 |
layout.setAlignment(FlowLayout.LEFT); |
|
172 |
|
|
173 |
this.setLayout(layout); |
|
174 |
} |
|
175 |
|
|
176 |
public void setComponentBorder(boolean br){ |
|
177 |
if(br) |
|
178 |
this.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
|
179 |
if(!br) |
|
180 |
this.setBorder(javax.swing.BorderFactory.createEmptyBorder()); |
|
181 |
} |
|
182 |
|
|
183 |
} |
|
0 | 184 |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/text.properties | ||
---|---|---|
543 | 543 |
delete_value=Eliminar valor NoData de la imagen |
544 | 544 |
tratar_nodata_transparente=Tratar valor NoData como transparente |
545 | 545 |
value_not_valid=Valor no valido para un valor NoData |
546 |
round_pixels=Redondear p?xeles |
org.gvsig.raster.tools/trunk/org.gvsig.raster.tools/org.gvsig.raster.tools.app/org.gvsig.raster.tools.app.basic/src/main/resources/text_en.properties | ||
---|---|---|
527 | 527 |
delete=Delete |
528 | 528 |
delete_value=Deletes the NoData value of this layer |
529 | 529 |
tratar_nodata_transparente=Draw the NoData values transparent |
530 |
value_not_valid=This NoData value is not valid |
|
530 |
value_not_valid=This NoData value is not valid |
|
531 |
round_pixels=Round off pixels |
org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.fmap/src/main/java/org/gvsig/raster/fmap/tool/behavior/TransformedRectangleBehavior.java | ||
---|---|---|
191 | 191 |
|
192 | 192 |
if (e.getButton() == MouseEvent.BUTTON1) { |
193 | 193 |
// Fijamos el nuevo extent |
194 |
Rectangle2D.Double r = new Rectangle2D.Double(); |
|
195 |
r.setFrameFromDiagonal(p1, p2); |
|
194 |
double minX = Math.min(p1.getX(), p2.getX()); |
|
195 |
double minY = Math.min(p1.getY(), p2.getY()); |
|
196 |
double maxX = Math.max(p1.getX(), p2.getX()); |
|
197 |
double maxY = Math.max(p1.getY(), p2.getY()); |
|
198 |
Rectangle2D.Double r = new Rectangle2D.Double( |
|
199 |
minX, |
|
200 |
minY, |
|
201 |
Math.abs(p1.getX() - p2.getX()), |
|
202 |
Math.abs(p1.getY() - p2.getY())); |
|
196 | 203 |
Envelope env = null; |
197 | 204 |
try { |
198 |
env = geomManager.createEnvelope(p1.getX(), p1.getY(), |
|
199 |
p2.getX(), p2.getY(), SUBTYPES.GEOM2D); |
|
205 |
env = geomManager.createEnvelope(minX, minY, maxX, maxY, SUBTYPES.GEOM2D); |
|
200 | 206 |
} catch (CreateEnvelopeException e1) { |
201 | 207 |
logger.error("Error creating the envelope", e); |
202 | 208 |
} |
org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalNative.java | ||
---|---|---|
946 | 946 |
assignDataTypeFromGdalRasterBands(gdalBands); |
947 | 947 |
|
948 | 948 |
int[] stepBuffer = new int[]{0, 0, w, h}; |
949 |
readData(buf, bandList, x, y, x + w, y + h, w, h, 0, 0, stepBuffer);
|
|
949 |
readData(buf, bandList, x, y, w, h, w, h, 0, 0, stepBuffer);
|
|
950 | 950 |
//int yMax = y + h; |
951 | 951 |
//readDataByLine(buf, bandList, x, y, w, yMax); |
952 | 952 |
} |
Also available in: Unified diff