Revision 1724 org.gvsig.raster.georeferencing/trunk/org.gvsig.raster.georeferencing/org.gvsig.raster.georeferencing.swing/org.gvsig.raster.georeferencing.swing.impl/src/main/java/org/gvsig/raster/georeferencing/swing/impl/control/GeorefControlPanelImpl.java
GeorefControlPanelImpl.java | ||
---|---|---|
141 | 141 |
if(buttonsPanel == null) { |
142 | 142 |
buttonsPanel = new JPanel(); |
143 | 143 |
buttonsPanel.setLayout(new GridBagLayout()); |
144 |
//buttonsPanel.setBorder(BorderFactory.createLineBorder(Color.red)); |
|
145 | 144 |
|
146 | 145 |
GridBagConstraints gb = new GridBagConstraints(); |
147 | 146 |
gb.insets = new java.awt.Insets(0, 0, 1, 1); |
... | ... | |
189 | 188 |
|
190 | 189 |
gb.gridy = 0; |
191 | 190 |
gb.gridx = 10; |
192 |
//gb.gridwidth = 4; |
|
193 | 191 |
buttonsPanel.add(getError(), gb); |
194 | 192 |
} |
195 | 193 |
return buttonsPanel; |
... | ... | |
374 | 372 |
|
375 | 373 |
public void componentShown(ComponentEvent e) { |
376 | 374 |
} |
377 |
|
|
378 |
|
|
379 |
//**************************************************** |
|
380 |
//Acceso a los datos de la tabla |
|
381 |
|
|
382 |
/** |
|
383 |
* Obtiene las coordenadas de una fila |
|
384 |
* @param row Fila de la que se quieren obtener las coordenadas |
|
385 |
* @return Array con 4 valores coordenadas real X, coordenada real Y, coordenadas raster X y coordenada raste Y |
|
386 |
*/ |
|
387 |
/*public double[] getCoordinates(int row) { |
|
388 |
double xMap = 0, yMap = 0, xRaster = 0, yRaster = 0; |
|
389 |
boolean numberFormatException = false; |
|
390 |
try { |
|
391 |
Object value = getTable().getModel().getValueAt(row, 2); |
|
392 |
try { |
|
393 |
if(value instanceof Double) |
|
394 |
xMap = ((Double)value).doubleValue(); |
|
395 |
else if(value instanceof String) |
|
396 |
xMap = Double.valueOf(((String)value)).doubleValue(); |
|
397 |
} catch (NumberFormatException ex1) { |
|
398 |
numberFormatException = true; |
|
399 |
} |
|
400 |
|
|
401 |
value = getTable().getModel().getValueAt(row, 3); |
|
402 |
try { |
|
403 |
if(value instanceof Double) |
|
404 |
yMap = ((Double)value).doubleValue(); |
|
405 |
else if(value instanceof String) |
|
406 |
yMap = Double.valueOf(((String)value)).doubleValue(); |
|
407 |
} catch (NumberFormatException ex1) { |
|
408 |
numberFormatException = true; |
|
409 |
} |
|
410 |
|
|
411 |
try { |
|
412 |
value = getTable().getModel().getValueAt(row, 4); |
|
413 |
if(value instanceof Double) |
|
414 |
xRaster = ((Double)value).doubleValue(); |
|
415 |
else if(value instanceof String) |
|
416 |
xRaster = Double.valueOf(((String)value)).doubleValue(); |
|
417 |
} catch (NumberFormatException ex1) { |
|
418 |
numberFormatException = true; |
|
419 |
} |
|
420 |
|
|
421 |
try { |
|
422 |
value = getTable().getModel().getValueAt(row, 5); |
|
423 |
if(value instanceof Double) |
|
424 |
yRaster = ((Double)value).doubleValue(); |
|
425 |
else if(value instanceof String) |
|
426 |
yRaster = Double.valueOf(((String)value)).doubleValue(); |
|
427 |
} catch (NumberFormatException ex1) { |
|
428 |
numberFormatException = true; |
|
429 |
} |
|
430 |
|
|
431 |
//Esto es necesario porque aunque se produzca una excepci?n en la lectura |
|
432 |
//de un valor deben leerse los dem?s campos antes de terminar. |
|
433 |
if(numberFormatException) { |
|
434 |
GeoreferencingSwingImplLibrary.messageBoxError("value_not_valid", table, null); |
|
435 |
try { |
|
436 |
getTable().getModel().setValueAt(new String(xMap + ""), row, 2); |
|
437 |
getTable().getModel().setValueAt(new String(yMap + ""), row, 3); |
|
438 |
getTable().getModel().setValueAt(new String(xRaster + ""), row, 4); |
|
439 |
getTable().getModel().setValueAt(new String(yRaster + ""), row, 5); |
|
440 |
} catch (NotInitializeException e) { |
|
441 |
//Si est? inicializada sino habr?a entrado en la excepci?n de nivel mayor |
|
442 |
} |
|
443 |
} |
|
444 |
|
|
445 |
//return new double[]{xMap, yMap, xRaster, yRaster}; |
|
446 |
} catch (NotInitializeException ex) { |
|
447 |
GeoreferencingSwingImplLibrary.messageBoxError("table_not_initialize", table, null); |
|
448 |
} |
|
449 |
return new double[]{xMap, yMap, xRaster, yRaster}; |
|
450 |
}*/ |
|
451 |
|
|
452 |
/** |
|
453 |
* Asigna un valor al punto en coordenadas raster de la tabla. Es recomendable gastar este y no |
|
454 |
* setValueAt para evitar que se recalculen los errores en cada inserci?n de cada celda. De esta |
|
455 |
* forma al actualiza ambas coordenadas a la vez solo se calcular? el error una vez. |
|
456 |
* @param valueX Valor en X |
|
457 |
* @param valueY Valor en Y |
|
458 |
* @param row Fila a actualizar |
|
459 |
* @param col Columna a actualizar |
|
460 |
*/ |
|
461 |
/*public void updateRasterPoint(Object valueX, Object valueY, int row) { |
|
462 |
try { |
|
463 |
getTable().setValueAt(valueX, row, 4); |
|
464 |
getTable().setValueAt(valueY, row, 5); |
|
465 |
updateErrors(); |
|
466 |
} catch (NotInitializeException e) { |
|
467 |
GeoreferencingSwingImplLibrary.messageBoxError("table_not_initialize", this, e); |
|
468 |
} |
|
469 |
}*/ |
|
470 |
|
|
471 |
/** |
|
472 |
* Asigna un valor al punto en coordenadas del mundo de la tabla. Es recomendable gastar este y no |
|
473 |
* setValueAt para evitar que se recalculen los errores en cada inserci?n de cada celda. De esta |
|
474 |
* forma al actualiza ambas coordenadas a la vez solo se calcular? el error una vez. |
|
475 |
* @param valueX Valor en X |
|
476 |
* @param valueY Valor en Y |
|
477 |
* @param row Fila a actualizar |
|
478 |
* @param col Columna a actualizar |
|
479 |
*/ |
|
480 |
/*public void updateMapPoint(Object valueX, Object valueY, int row) { |
|
481 |
try { |
|
482 |
getTable().setValueAt(valueX, row, 2); |
|
483 |
getTable().setValueAt(valueY, row, 3); |
|
484 |
updateErrors(); |
|
485 |
} catch (NotInitializeException e) { |
|
486 |
GeoreferencingSwingImplLibrary.messageBoxError("table_not_initialize", this, e); |
|
487 |
} |
|
488 |
}*/ |
|
489 |
|
|
490 |
/** |
|
491 |
* Asigna un valor al punto de la tabla. Es recomendable gastar este y no |
|
492 |
* setValueAt para evitar que se recalculen los errores en cada inserci?n de cada celda. De esta |
|
493 |
* forma al actualiza ambas coordenadas a la vez solo se calcular? el error una vez. |
|
494 |
* @param mapX Valor en X en coordenadas del mundo |
|
495 |
* @param mapY Valor en Y en coordenadas del mundo |
|
496 |
* @param pixelX Valor en X en coordenadas del raster |
|
497 |
* @param pixelY Valor en Y en coordenadas del raster |
|
498 |
* @param row Fila a actualizar |
|
499 |
* @param col Columna a actualizar |
|
500 |
*/ |
|
501 |
/*public void updatePoint(Object mapX, Object mapY, Object pixelX, Object pixelY, int row) { |
|
502 |
try { |
|
503 |
getTable().setValueAt(mapX, row, 2); |
|
504 |
getTable().setValueAt(mapY, row, 3); |
|
505 |
getTable().setValueAt(pixelX, row, 4); |
|
506 |
getTable().setValueAt(pixelY, row, 5); |
|
507 |
updateErrors(); |
|
508 |
} catch (NotInitializeException e) { |
|
509 |
GeoreferencingSwingImplLibrary.messageBoxError("table_not_initialize", this, e); |
|
510 |
} |
|
511 |
}*/ |
|
512 |
|
|
513 |
/** |
|
514 |
* Actualiza los errores de toda la tabla. Esta funci?n debe ser llamada cuando ha |
|
515 |
* habido alg?n cambio en los valores de los puntos. |
|
516 |
* @throws NotInitializeException |
|
517 |
*/ |
|
518 |
/*public void updateErrors() { |
|
519 |
if(pointList == null) |
|
520 |
return; |
|
521 |
process.addParam("gpcs", pointList); |
|
522 |
process.addParam("orden", new Integer(selectedDegree)); |
|
523 |
try { |
|
524 |
process.execute(); |
|
525 |
} catch(RuntimeException e) { |
|
526 |
//Matriz singular |
|
527 |
return; |
|
528 |
} catch (ProcessInterruptedException e) { |
|
529 |
} catch (ProcessException e) { |
|
530 |
} |
|
531 |
HashMap<String, Object> map = (HashMap<String, Object>)process.getResult(); |
|
532 |
Geotransformation result = (Geotransformation)map.get("RESULT"); |
|
533 |
if(result == null) |
|
534 |
return; |
|
535 |
|
|
536 |
//Actualizamos los errores de toda la tabla |
|
537 |
try { |
|
538 |
ColorColumnRenderer cr = new ColorColumnRenderer(); |
|
539 |
for (int i = 0; i < pointList.size(); i++) { |
|
540 |
GeoPoint point = pointList.get(i); |
|
541 |
getTable().setValueAt(new Double(point.getErrorX()), point.getNumber(), 6); |
|
542 |
getTable().setValueAt(new Double(point.getErrorY()), point.getNumber(), 7); |
|
543 |
getTable().setValueAt(new Double(point.getRms()), point.getNumber(), 8); |
|
544 |
if (point.getRms() > threshold) |
|
545 |
cr.addRowToColor1(point.getNumber()); |
|
546 |
else |
|
547 |
cr.addRowToColor2(point.getNumber()); |
|
548 |
} |
|
549 |
getTable().getTable().getJTable().getColumnModel().getColumn(8).setCellRenderer(cr); |
|
550 |
getError().setValue(result.getRmsTotal() + ""); |
|
551 |
} catch (NotInitializeException e) { |
|
552 |
GeoreferencingSwingImplLibrary.messageBoxError("table_not_initialize", this, e); |
|
553 |
} |
|
554 |
}*/ |
|
555 |
|
|
556 | 375 |
} |
557 | 376 |
|
558 | 377 |
|
Also available in: Unified diff