293 |
293 |
}
|
294 |
294 |
|
295 |
295 |
if (e.getSource() == getCoordinatesPanel().getRealCoordinates()) {
|
296 |
|
if (e.getName().equals("11"))
|
|
296 |
if (e.getName().equals("11")) {
|
297 |
297 |
data.setUlxWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue11()).doubleValue());
|
298 |
|
if (e.getName().equals("12"))
|
|
298 |
data.setLlxWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue11()).doubleValue());
|
|
299 |
}
|
|
300 |
if (e.getName().equals("12")) {
|
299 |
301 |
data.setUlyWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue12()).doubleValue());
|
300 |
|
if (e.getName().equals("21"))
|
|
302 |
data.setUryWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue12()).doubleValue());
|
|
303 |
}
|
|
304 |
if (e.getName().equals("21")) {
|
301 |
305 |
data.setLrxWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue21()).doubleValue());
|
302 |
|
if (e.getName().equals("22"))
|
|
306 |
data.setUrxWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue21()).doubleValue());
|
|
307 |
}
|
|
308 |
if (e.getName().equals("22")) {
|
303 |
309 |
data.setLryWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue22()).doubleValue());
|
|
310 |
data.setLlyWc(Double.valueOf(getCoordinatesPanel().getRealCoordinates().getValue22()).doubleValue());
|
|
311 |
}
|
304 |
312 |
data.updateObservers();
|
305 |
313 |
}
|
306 |
314 |
} catch (NumberFormatException ex1) {
|
... | ... | |
314 |
322 |
* @param modifyPx true si se ha modificado alg?n campo de coordenadas pixel y false si se ha modificado
|
315 |
323 |
* alg?n campo de las coordenadas reales.
|
316 |
324 |
*/
|
317 |
|
private void recalcCoordFields(boolean modifyPx) {
|
|
325 |
private void recalcCoordFields(boolean modifyPx, boolean modifyUL, boolean modifyX) {
|
318 |
326 |
try {
|
319 |
327 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_APPLY).setEnabled(false);
|
320 |
328 |
getClippingPanel().getButtonsPanel().getButton(ButtonsPanel.BUTTON_ACCEPT).setEnabled(false);
|
... | ... | |
326 |
334 |
Point2D urPx = new Point2D.Double(data.getUrxPx(), data.getUryPx());
|
327 |
335 |
|
328 |
336 |
//Comprobamos que las esquinas no esten cambiadas de sitio
|
329 |
|
if(ulPx.getX() > lrPx.getX()) {
|
330 |
|
double ulTmp = ulPx.getX();
|
331 |
|
ulPx.setLocation(lrPx.getX(), ulPx.getY());
|
332 |
|
lrPx.setLocation(ulTmp, lrPx.getY());
|
|
337 |
//Mueve la ULX
|
|
338 |
if(modifyUL && modifyX) {
|
|
339 |
if(ulPx.getX() > lrPx.getX()) {
|
|
340 |
urPx.setLocation(dim.width, urPx.getY());
|
|
341 |
lrPx.setLocation(dim.width, lrPx.getY());
|
|
342 |
}
|
333 |
343 |
}
|
334 |
|
if(ulPx.getY() > lrPx.getY()) {
|
335 |
|
double ulTmp = ulPx.getY();
|
336 |
|
ulPx.setLocation(ulPx.getX(), lrPx.getY());
|
337 |
|
lrPx.setLocation(lrPx.getX(), ulTmp);
|
|
344 |
|
|
345 |
//Mueve la LRX
|
|
346 |
if(!modifyUL && modifyX) {
|
|
347 |
if(lrPx.getX() < ulPx.getX()) {
|
|
348 |
ulPx.setLocation(0, ulPx.getY());
|
|
349 |
llPx.setLocation(0, llPx.getY());
|
|
350 |
}
|
338 |
351 |
}
|
339 |
352 |
|
|
353 |
//Mueve la ULY
|
|
354 |
if(modifyUL && !modifyX) {
|
|
355 |
if(ulPx.getY() > lrPx.getY()) {
|
|
356 |
llPx.setLocation(llPx.getX(), dim.height);
|
|
357 |
lrPx.setLocation(lrPx.getX(), dim.height);
|
|
358 |
}
|
|
359 |
}
|
|
360 |
|
|
361 |
//Mueve la LRY
|
|
362 |
if(!modifyUL && !modifyX) {
|
|
363 |
if(lrPx.getY() < ulPx.getY()) {
|
|
364 |
ulPx.setLocation(ulPx.getX(), 0);
|
|
365 |
urPx.setLocation(urPx.getX(), 0);
|
|
366 |
}
|
|
367 |
}
|
|
368 |
|
340 |
369 |
//Ajustamos la selecci?n al ?rea
|
341 |
370 |
ulPx = adjustPixelRequest(ulPx);
|
342 |
371 |
lrPx = adjustPixelRequest(lrPx);
|
... | ... | |
345 |
374 |
Point2D lrWc = new Point2D.Double();
|
346 |
375 |
Point2D llWc = new Point2D.Double();
|
347 |
376 |
Point2D urWc = new Point2D.Double();
|
|
377 |
|
348 |
378 |
at.transform(ulPx, ulWc);
|
349 |
|
/*at.transform(new Point2D.Double(lrPx.getX() + 1, lrPx.getY() + 1), lrWc);
|
350 |
|
at.transform(new Point2D.Double(llPx.getX(), llPx.getY() + 1), llWc);
|
351 |
|
at.transform(new Point2D.Double(urPx.getX() + 1, urPx.getY()), urWc);*/
|
352 |
379 |
at.transform(lrPx, lrWc);
|
353 |
380 |
at.transform(llPx, llWc);
|
354 |
381 |
at.transform(urPx, urWc);
|
... | ... | |
368 |
395 |
Point2D llWc = new Point2D.Double(data.getLlxWc(), data.getLlyWc());
|
369 |
396 |
Point2D urWc = new Point2D.Double(data.getUrxWc(), data.getUryWc());
|
370 |
397 |
|
|
398 |
//Mueve la ULX
|
|
399 |
if(modifyUL && modifyX) {
|
|
400 |
if(ulWc.getX() > lrWc.getX()) {
|
|
401 |
urWc.setLocation(fLayer.getMaxX(), urWc.getY());
|
|
402 |
lrWc.setLocation(fLayer.getMaxX(), lrWc.getY());
|
|
403 |
}
|
|
404 |
}
|
|
405 |
|
|
406 |
//Mueve la LRX
|
|
407 |
if(!modifyUL && modifyX) {
|
|
408 |
if(lrWc.getX() < ulWc.getX()) {
|
|
409 |
ulWc.setLocation(fLayer.getMinX(), ulWc.getY());
|
|
410 |
llWc.setLocation(fLayer.getMinX(), llWc.getY());
|
|
411 |
}
|
|
412 |
}
|
|
413 |
|
|
414 |
//Mueve la ULY
|
|
415 |
if(modifyUL && !modifyX) {
|
|
416 |
if(ulWc.getY() < lrWc.getY()) {
|
|
417 |
llWc.setLocation(llWc.getX(), fLayer.getMinY());
|
|
418 |
lrWc.setLocation(lrWc.getX(), fLayer.getMinY());
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
//Mueve la LRY
|
|
423 |
if(!modifyUL && !modifyX) {
|
|
424 |
if(lrWc.getY() > ulWc.getY()) {
|
|
425 |
ulWc.setLocation(ulWc.getX(), fLayer.getMaxY());
|
|
426 |
urWc.setLocation(urWc.getX(), fLayer.getMaxY());
|
|
427 |
}
|
|
428 |
}
|
|
429 |
|
371 |
430 |
//Ajustamos la selecci?n al ?rea
|
372 |
431 |
ulWc = getFLayer().adjustWorldRequest(ulWc);
|
373 |
432 |
lrWc = getFLayer().adjustWorldRequest(lrWc);
|
... | ... | |
686 |
745 |
public void actionValueChanged(CoordinatesEvent e) {
|
687 |
746 |
if (e.getSource() == getCoordinatesPanel().getPixelCoordinates()) {
|
688 |
747 |
eventJTextField(e);
|
689 |
|
recalcCoordFields(true);
|
|
748 |
if (e.getName().equals("11"))
|
|
749 |
recalcCoordFields(true, true, true);
|
|
750 |
if (e.getName().equals("12"))
|
|
751 |
recalcCoordFields(true, true, false);
|
|
752 |
if (e.getName().equals("21"))
|
|
753 |
recalcCoordFields(true, false, true);
|
|
754 |
if (e.getName().equals("22"))
|
|
755 |
recalcCoordFields(true, false, false);
|
690 |
756 |
}
|
691 |
757 |
if (e.getSource() == getCoordinatesPanel().getRealCoordinates()) {
|
692 |
758 |
eventJTextField(e);
|
693 |
|
recalcCoordFields(false);
|
|
759 |
if (e.getName().equals("11"))
|
|
760 |
recalcCoordFields(false, true, true);
|
|
761 |
if (e.getName().equals("12"))
|
|
762 |
recalcCoordFields(false, true, false);
|
|
763 |
if (e.getName().equals("21"))
|
|
764 |
recalcCoordFields(false, false, true);
|
|
765 |
if (e.getName().equals("22"))
|
|
766 |
recalcCoordFields(false, false, false);
|
694 |
767 |
}
|
695 |
768 |
}
|
696 |
769 |
|