Examples of GeometryOperationAnimation


Examples of org.locationtech.udig.tools.edit.animation.GeometryOperationAnimation

            if (updateBlackboard) {
                // mostly used to tack on an extra addVertex command
                // so the display is drawn as a closed polygon.
                updateBlackboardGeometry(handler, editGeom, geom, commands);
            }
            GeometryOperationAnimation animation = new GeometryOperationAnimation(
                    EditGeomPathIterator.getPathIterator(editGeom).toShape(),
                    new IsBusyStateProvider(handler));

            UndoableMapCommand startAnimationCommand = drawfactory.createStartAnimationCommand(
                    display, Collections.singletonList((IAnimation) animation));
View Full Code Here

Examples of org.locationtech.udig.tools.edit.animation.GeometryOperationAnimation

        Point startPoint = shape.getPoint(0);
        if (!startPoint.equals(shape.getPoint(shape.getNumPoints() - 1))) {
            addedEndVertex = true;
            shape.getEditBlackboard().addPoint(startPoint.getX(), startPoint.getY(), shape);
        }
        GeometryOperationAnimation indicator = new GeometryOperationAnimation(
                PrimitiveShapeIterator.getPathIterator(shape).toShape(), new IsBusyStateProvider(
                        handler));
        try {
            AnimationUpdater.runTimer(handler.getContext().getMapDisplay(), indicator);
            handler.setCurrentState(EditState.BUSY);

            if (writeCommand == null) {
                EditBlackboard editBlackboard = handler.getEditBlackboard(layer);
                this.geoms = new ArrayList<EditGeom>(editBlackboard.getGeoms());
                geoms.remove(shape.getEditGeom());

                editBlackboard.clear();

                FeatureCollection<SimpleFeatureType, SimpleFeature>  features = getFeatures(monitor);
                if( features == null ){                   
                    return; // did not hit anything
                }
                try {
                    List<Geometry> geoms = new ArrayList<Geometry>();
                    geoms.add(createReferenceGeom());
                   
                    SimpleFeature first = runDifferenceOp(features.features(), geoms);
                   
                    if (first == null)
                        return;
                   
                    createAddFeatureCommands(commands, geoms, first);
                } finally {
                    monitor.worked(2);
                }
                this.writeCommand = new UndoableComposite(commands);
            }
            writeCommand.setMap(getMap());
            handler.setCurrentState(EditState.COMMITTING);
            writeCommand.execute(new SubProgressMonitor(monitor, 5));
        } finally {
            indicator.setValid(false);
            handler.setCurrentState(endState);
            monitor.done();
        }
    }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.animation.GeometryOperationAnimation

        GeometryFactory fac = new GeometryFactory();
        return fac.createPolygon(ring, new LinearRing[0]);

    }
    public void rollback( IProgressMonitor monitor ) throws Exception {
        GeometryOperationAnimation indicator = new GeometryOperationAnimation(
                PrimitiveShapeIterator.getPathIterator(shape).toShape(), new IsBusyStateProvider(
                        handler));
        try {
            monitor.beginTask(Messages.DifferenceFeatureCommand_undoTaskMessage, 10);
            monitor.worked(1);

            AnimationUpdater.runTimer(handler.getContext().getMapDisplay(), indicator);

            handler.setCurrentState(EditState.BUSY);

            SubProgressMonitor submonitor = new SubProgressMonitor(monitor, 5);
            writeCommand.rollback(submonitor);
            submonitor.done();

            EditBlackboard bb = handler.getEditBlackboard(layer);
            bb.clear();
            for( EditGeom geom : geoms ) {
                addGeom(bb, geom);
            }
            PrimitiveShape shell = addGeom(bb, shape.getEditGeom()).getShell();
            handler.setCurrentShape(shell);
            if (addedEndVertex) {
                bb.removeCoordinate(shape.getNumCoords() - 1, shape
                        .getCoord(shape.getNumCoords() - 1), shell);
            }
            handler.setCurrentState(state);
        } catch (Exception e) {
            handler.setCurrentState(EditState.NONE);
            throw e;
        } finally {
            indicator.setValid(false);
            monitor.done();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.