Package org.locationtech.udig.tools.edit.support

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard


   
    public void run( IProgressMonitor monitor ) throws Exception {
        monitor.beginTask(Messages.StartEditingCommand_name, 32);
        monitor.worked(2);
       
        EditBlackboard editBlackboard = handler.getEditBlackboard(layer);
       
        EditGeom editGeom = editBlackboard.getGeoms().get(0);
        if( editGeom.getShell().getNumPoints()>0 )
            editGeom=editBlackboard.newGeom(null, type);
        else{
            editGeom.setShapeType(type);
        }
       
        this.currentState=handler.getCurrentState();
View Full Code Here


        oldFilter = (Filter) editLayer.getFilter();
        editLayer.setFilter(Filter.EXCLUDE);

        EditUtils.instance.cancelHideSelection(editLayer);

        EditBlackboard editBlackboard = handler.getEditBlackboard(editLayer);
        editBlackboard.startBatchingEvents();
        editBlackboard.clear();
        editBlackboard.fireBatchedEvents();

        handler.repaint();
    }
View Full Code Here

    public void rollback( IProgressMonitor monitor ) throws Exception {
        Layer editLayer = (Layer) handler.getEditLayer();
        editLayer.setFilter(oldFilter);
       
        EditBlackboard editBlackboard = handler.getEditBlackboard(editLayer);
        editBlackboard.startBatchingEvents();
        for( EditGeom geom : geoms ) {
            copyFeature(editBlackboard, geom);
        }
        handler.setCurrentState(this.currentState);
        editBlackboard.fireBatchedEvents();
        handler.repaint();
    }
View Full Code Here

            command.run(monitor);
        } else {
            IToolContext context = handler.getContext();
            ILayer editLayer = handler.getEditLayer();

            EditBlackboard editBlackboard = handler.getEditBlackboard(editLayer);
            editBlackboard.startBatchingEvents();
            BlockingSelectionAnim animation = new BlockingSelectionAnim(event.x, event.y);
            AnimationUpdater.runTimer(context.getMapDisplay(), animation);
            FeatureIterator<SimpleFeature> iter = getFeatureIterator();
            try {

                if (iter.hasNext()) {
                    runSelectionStrategies(monitor, iter);
                } else {
                    runDeselectionStrategies(monitor);
                }

                setAndRun(monitor, command);
      } finally {
        try {
          if (iter != null) {
            iter.close();
          }
        } finally {
          if (animation != null) {
            animation.setValid(false);
            animation = null;
          }
        }
        editBlackboard.fireBatchedEvents();
      }
        }
    }
View Full Code Here

    }

    private Pair<PrimitiveShape, SimpleFeature> newSelection( IProgressMonitor monitor )
            throws IOException {

        EditBlackboard editBlackboard = handler.getEditBlackboard(layer);
        if (!editBlackboard.isEmpty()) {
            EditGeom newSelection = editBlackboard.getGeoms().get(0);

            FilterFactory factory = CommonFactoryFinder
                    .getFilterFactory(GeoTools.getDefaultHints());
            Id id = factory.id(Collections.singleton(factory.featureId(newSelection
                    .getFeatureIDRef().get())));
View Full Code Here

        monitor.beginTask(Messages.RemoveEditGeomCommand_rollbackTaskMessage, 20);
        if (currentState != null)
            handler.setCurrentState(currentState);
        if (nullEditFeatureCommand != null)
            nullEditFeatureCommand.rollback(new SubProgressMonitor(monitor, 10));
        EditBlackboard bb = handler.getEditBlackboard(layer);
        EditGeom newCurrentGeom = null;
        List<EditGeom> empty = bb.getGeoms();
        for( EditGeom original : removed ) {
            EditGeom inBlackboard = bb.newGeom(original.getFeatureIDRef().get(), original
                    .getShapeType());
            inBlackboard.setChanged(original.isChanged());
            if (original == currentGeom)
                newCurrentGeom = inBlackboard;

            PrimitiveShape destination = inBlackboard.getShell();
            newCurrentGeom = setCurrentGeom(newCurrentGeom, destination, original.getShell());

            for( Iterator<Coordinate> iter = original.getShell().coordIterator(); iter.hasNext(); ) {
                bb.addCoordinate(iter.next(), destination);
            }

            for( PrimitiveShape shape : original.getHoles() ) {
                destination = inBlackboard.newHole();
                newCurrentGeom = setCurrentGeom(newCurrentGeom, destination, shape);
                for( Iterator<Coordinate> iter = shape.coordIterator(); iter.hasNext(); ) {
                    bb.addCoordinate(iter.next(), destination);
                }
            }
        }
        if (removedAll)
            bb.removeGeometries(empty);
    }
View Full Code Here

        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
                }
View Full Code Here

            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);
View Full Code Here

    }

    public void run( IProgressMonitor monitor, SelectionParameter parameters,
            UndoableComposite commands ) {
        EditToolHandler handler = parameters.handler;
        EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());

        if (!parameters.event.isModifierDown(MapMouseEvent.MOD1_DOWN_MASK)
                && !parameters.event.isShiftDown() && parameters.permitClear) {
            writeModifiedFeaturesAndStartEditing(monitor, parameters, commands);
           
View Full Code Here

    }

    private void writeModifiedFeaturesAndStartEditing( final IProgressMonitor monitor,
            final SelectionParameter parameters, final UndoableComposite commands ) {
        EditToolHandler handler = parameters.handler;
        EditBlackboard editBlackboard = handler.getEditBlackboard(handler
                .getEditLayer());
        if (hasDirtyGeom(handler)) {
            commands.addCommand(handler.getCommand(handler.getAcceptBehaviours()));
            commands.addCommand(new DeselectEditGeomCommand(handler, editBlackboard.getGeoms()));
        }
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.support.EditBlackboard

Copyright © 2018 www.massapicom. 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.