Package org.locationtech.udig.project.command

Examples of org.locationtech.udig.project.command.UndoableComposite


  public UndoableMapCommand getCommand(EditToolHandler handler) {

    if (!isValid(handler)) {
      throw new IllegalArgumentException("Behaviour is not valid for the current state"); //$NON-NLS-1$
    }
    UndoableComposite composite = new UndoableComposite();
    List<EditGeom> list = new LinkedList<EditGeom>();
    list.add(handler.getCurrentGeom());
    // composite.getCommands().add(new
    // DeselectEditGeomCommand(handler,list));
    // composite.getCommands().add(new SetEditStateCommand(handler,
View Full Code Here


        ReferencedEnvelope bounds = new ReferencedEnvelope(getFeature().getBounds());
        double deltax=bounds.getWidth()/4;
        double deltay=bounds.getHeight()/4;
        bounds.expandToInclude(bounds.getMinX()-deltax, bounds.getMinY()-deltay);
        bounds.expandToInclude(bounds.getMaxX()+deltax, bounds.getMaxY()+deltay);
        UndoableComposite composite = new UndoableComposite();
        IAction tool = ApplicationGIS.getToolManager().getToolAction("org.locationtech.udig.tools.selectionTool", "org.locationtech.udig.tool.edit.edit"); //$NON-NLS-1$ //$NON-NLS-2$
        // could be null if tool.edit plug-in is not in distribution.
        if( tool !=null ){
          tool.run();
        }
        NavCommand zoom = context.getNavigationFactory().createSetViewportBBoxCommand(
                bounds, crs);
        context.sendASyncCommand(zoom);
        composite.getCommands().add(context.getSelectionFactory().createFIDSelectCommand(getLayer(),getFeature()));
        composite.getCommands().add(context.getEditFactory().createSetEditFeatureCommand(getFeature(), getLayer()));
        context.sendASyncCommand(composite);
    }
View Full Code Here

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
        if( processAsCommand )
            return new EventBehaviourCommand(modes, handler, e, eventType);
       
        UndoableComposite command=new UndoableComposite();
        for( EventBehaviour mode : modes ) {
            if( mode.isValid(handler,e, eventType) ){
                UndoableMapCommand command2 = mode.getCommand(handler, e, eventType);
                if( command2!=null )
                    command.getCommands().add(command2);
            }
        }
        return command;
    }
View Full Code Here

                commands.add(new UndoRedoCommand(addVertexCommand));
            }
        }
       
        commands.add(handler.getCommand(handler.getAcceptBehaviours()));
        UndoableComposite undoableComposite = new UndoableComposite(commands);
        return undoableComposite;
    }
View Full Code Here

        //This command isn't need because before that the AcceptChangesBehaviour is launched
        //and its entrust of changing the state if everything goes well.
//        if( handler.getCurrentState()==EditState.CREATING)
//            commands.add(new SetEditStateCommand(handler, EditState.MODIFYING));           
       
        UndoableComposite undoableComposite = new UndoableComposite(commands);
        undoableComposite.setMap(handler.getContext().getMap());
        try {
            undoableComposite.execute(new NullProgressMonitor());
        } catch (Exception e1) {
            throw (RuntimeException) new RuntimeException().initCause(e1);
        }
        return new UndoRedoCommand(undoableComposite);
    }
View Full Code Here

        if (newShape != null && newShape != handler.getCurrentShape()) {
            List<UndoableMapCommand> commands = new ArrayList<UndoableMapCommand>();
            commands.add(new SetCurrentGeomCommand(handler, newShape));
            commands.add(new SetEditFeatureCommand(handler, Point.valueOf(e.x, e.y), newShape));
            UndoableComposite undoableComposite = new UndoableComposite(commands);
            return undoableComposite;
        }

        SelectionParameter selectionParameter = new SelectionParameter(handler, e, getAcceptableClasses(), filterType, permitClear, onlyAdd);
        selectionParameter.selectionStrategies.addAll(selectionStrategies);
View Full Code Here

* @since 1.1.0
*/
public class DeselectEditShapeAcceptBehaviour implements Behaviour {

    public UndoableMapCommand getCommand( EditToolHandler handler ) {
        UndoableComposite composite = new UndoableComposite();
        List<EditGeom> geoms = handler.getEditBlackboard(handler.getEditLayer()).getGeoms();
        composite.getCommands().add(new DeselectEditGeomCommand(handler, geoms ));
        composite.getCommands().add(new SetEditStateCommand(handler, EditState.NONE));
        return composite;
    }
View Full Code Here

        for( Entry<String, GeometryCreationUtil.Bag> entry : entries ) {

            commands.addAll(processIntoCommands(handler, layer, entry));
        }

        UndoableComposite composite = new UndoableComposite(commands);
        composite.setName(Messages.WriteChangesBehaviour_commandName);
        composite.getFinalizerCommands().add(new SetEditStateCommand(handler, EditState.MODIFYING));

        handler.setCurrentState(oldState);

        return composite;
    }
View Full Code Here

        }

        public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
            try{
                PathIterator iter = drawCommand.getShape().getPathIterator(AffineTransform.getTranslateInstance(0,0), 1.0);
                UndoableComposite commands=new UndoableComposite();
                commands.getCommands().add(handler.getContext().getEditFactory().createNullEditFeatureCommand());
                EditBlackboard bb = handler.getEditBlackboard(handler.getEditLayer());
                commands.getCommands().add(new DeselectEditGeomCommand(handler, bb.getGeoms()));
                ShapeType shapeType = determineLayerType(handler);
               
               
                CreateEditGeomCommand createEditGeomCommand = new CreateEditGeomCommand(bb, "newShape", shapeType); //$NON-NLS-1$
                commands.getCommands().add(createEditGeomCommand);
                commands.getCommands().add(EditUtils.instance.appendPathToShape(iter, shapeType, handler, bb, createEditGeomCommand.getShapeProvider()));
                commands.getCommands().add( new SetCurrentGeomCommand(handler, createEditGeomCommand.getShapeProvider()));
                commands.getCommands().add(handler.getCommand(handler.getAcceptBehaviours()));
               
                commands.getFinalizerCommands().add( new SetEditStateCommand(handler, EditState.NONE));
                return commands;
            }finally{
                drawCommand.setValid(false);
                drawCommand=null;
                path=null;
View Full Code Here

            throw new IllegalStateException("isValid() return false"); //$NON-NLS-1$

        Point vertexOver=handler.getEditBlackboard(handler.getEditLayer()).overVertex(Point.valueOf(e.x, e.y),
                PreferenceUtil.instance().getVertexRadius());
       
        UndoableComposite command=new UndoableComposite();
        EditBlackboard bb = handler.getCurrentShape().getEditBlackboard();
        command.getCommands().add(new SelectVertexCommand(bb, vertexOver, Type.SET));
        command.getCommands().add(new RemoveSelectedVerticesCommand(handler));
       
        return command;
    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.command.UndoableComposite

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.