use of com.revolsys.swing.undo.ListAddUndo in project com.revolsys.open by revolsys.
the class EditGeoreferencedImageOverlay method addTiePointFinish.
private boolean addTiePointFinish(final MouseEvent event) {
if (event == null || event.getButton() == MouseEvent.BUTTON1) {
if (this.addTiePointFirstPoint != null) {
if (clearOverlayAction(ACTION_TIE_POINT_ADD)) {
try {
clearMapCursor(CURSOR_SOURCE_PIXEL_ADD);
Point mapPoint = getEventPoint();
final Point snapPoint = getSnapPoint();
if (snapPoint != null) {
mapPoint = snapPoint;
}
final Point sourcePoint = this.addTiePointFirstPoint;
final Point sourcePixel = this.layer.targetPointToSourcePixel(sourcePoint);
final GeometryFactory geometryFactory = getImageGeometryFactory();
final Point targetPoint = mapPoint.newGeometry(geometryFactory);
final MappedLocation mappedLocation = new MappedLocation(sourcePixel, targetPoint);
addUndo(new ListAddUndo(this.image.getTiePoints(), mappedLocation));
} finally {
addTiePointClear();
}
return true;
}
}
}
return false;
}
Aggregations