Search in sources :

Example 1 with SetObjectProperty

use of com.revolsys.swing.undo.SetObjectProperty in project com.revolsys.open by revolsys.

the class AbstractOverlay method newPropertyUndo.

protected void newPropertyUndo(final Object object, final String propertyName, final Object oldValue, final Object newValue) {
    final SetObjectProperty edit = new SetObjectProperty(object, propertyName, oldValue, newValue);
    addUndo(edit);
}
Also used : SetObjectProperty(com.revolsys.swing.undo.SetObjectProperty)

Example 2 with SetObjectProperty

use of com.revolsys.swing.undo.SetObjectProperty in project com.revolsys.open by revolsys.

the class EditGeoreferencedImageOverlay method moveCornerFinish.

private boolean moveCornerFinish(final MouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1) {
        if (clearOverlayAction(ACTION_MOVE_IMAGE_CORNER)) {
            try {
                if (this.moveImageBoundingBox != null) {
                    final SetObjectProperty setBBox = new SetObjectProperty(this, "imageBoundingBox", getImageBoundingBox(), this.moveImageBoundingBox);
                    addUndo(setBBox);
                    event.consume();
                }
            } finally {
                moveCornerClear();
            }
            repaint();
            return true;
        }
    }
    return false;
}
Also used : SetObjectProperty(com.revolsys.swing.undo.SetObjectProperty)

Example 3 with SetObjectProperty

use of com.revolsys.swing.undo.SetObjectProperty in project com.revolsys.open by revolsys.

the class EditGeoreferencedImageOverlay method moveTiePointFinish.

private boolean moveTiePointFinish(final MouseEvent event) {
    if (this.moveTiePointStarted) {
        final MappedLocation tiePoint = getMoveTiePoint();
        if (tiePoint != null) {
            Point point = getPoint(event);
            String action;
            if (this.moveTiePointSource) {
                action = ACTION_TIE_POINT_MOVE_SOURCE;
            } else {
                action = ACTION_TIE_POINT_MOVE_TARGET;
            }
            if (clearOverlayAction(action)) {
                if (this.moveTiePointSource) {
                    final Point sourcePixel = this.layer.targetPointToSourcePixel(point);
                    final SetObjectProperty setSourcePixel = new SetObjectProperty(tiePoint, "sourcePixel", tiePoint.getSourcePixel(), sourcePixel);
                    addUndo(setSourcePixel);
                } else {
                    final Point snapPoint = getSnapPoint();
                    if (snapPoint != null) {
                        point = snapPoint;
                    }
                    final GeometryFactory imageGeometryFactory = getImageGeometryFactory();
                    point = point.newGeometry(imageGeometryFactory);
                    tiePoint.setTargetPoint(point);
                    final SetObjectProperty setTargetPoint = new SetObjectProperty(tiePoint, "targetPoint", tiePoint.getTargetPoint(), point);
                    addUndo(setTargetPoint);
                }
                this.closeSourcePixelIndexes.clear();
                this.closeTargetPointIndexes.clear();
                moveTiePointClear();
                clearCachedImage();
                clearMapCursor();
                clearSnapLocations();
                if (event != null) {
                    event.consume();
                }
                repaint();
                return true;
            }
        }
    }
    return false;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) MappedLocation(com.revolsys.raster.MappedLocation) SetObjectProperty(com.revolsys.swing.undo.SetObjectProperty) Point(com.revolsys.geometry.model.Point) LineString(com.revolsys.geometry.model.LineString)

Example 4 with SetObjectProperty

use of com.revolsys.swing.undo.SetObjectProperty in project com.revolsys.open by revolsys.

the class EditGeoreferencedImageOverlay method moveImageFinish.

private boolean moveImageFinish(final MouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1) {
        if (clearOverlayAction(ACTION_MOVE_IMAGE)) {
            final BoundingBox boundingBox = getMoveBoundingBox(event);
            final SetObjectProperty setBBox = new SetObjectProperty(this, "imageBoundingBox", getImageBoundingBox(), boundingBox);
            addUndo(setBBox);
            moveImageClear();
            event.consume();
            repaint();
            return true;
        }
    }
    return false;
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) SetObjectProperty(com.revolsys.swing.undo.SetObjectProperty)

Aggregations

SetObjectProperty (com.revolsys.swing.undo.SetObjectProperty)4 BoundingBox (com.revolsys.geometry.model.BoundingBox)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 LineString (com.revolsys.geometry.model.LineString)1 Point (com.revolsys.geometry.model.Point)1 MappedLocation (com.revolsys.raster.MappedLocation)1