Package org.locationtech.udig.project.command

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


       
        return executeCommand(handler, command, setEditStateCommand);
    }

    private UndoableMapCommand executeCommand( EditToolHandler handler, UndoableMapCommand command2, SetEditStateCommand setEditStateCommand ) {
        UndoableMapCommand command=command2;
        if (command != null) {
            List<UndoableMapCommand> commands = new ArrayList<UndoableMapCommand>();
            commands.add(command);
            commands.add(setEditStateCommand);
            UndoableComposite undoableComposite = new UndoableComposite(commands);
            command=undoableComposite;
        } else {
            command=setEditStateCommand;
        }
        command.setMap(handler.getContext().getMap());
        try {
            command.run(new NullProgressMonitor());
        } catch (Exception e1) {
            throw (RuntimeException) new RuntimeException( e1 );
        }
        return new UndoRedoCommand(command);
    }
View Full Code Here


    private void runEventBehaviours( MapMouseEvent e, EventType eventType ) {
        for( EventBehaviour b : behaviour ) {

            if (canUnlock(b) && b.isValid(this, e, eventType)) {
                UndoableMapCommand c = null;
                c = b.getCommand(this, e, eventType);
                if (c == null)
                    continue;

                if (testing) {
                    c.setMap((Map) getContext().getMap());
                    try {
                        NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
                        c.run(nullProgressMonitor);
                    } catch (Exception e1) {
                        throw (RuntimeException) new RuntimeException().initCause(e1);
                    }
                } else{
                    getContext().sendASyncCommand(c);
View Full Code Here

        ReferencedEnvelope newBounds = bounds.transform(dataCrs, true);
       
        String name = geometryDescriptor.getLocalName();
        Filter bboxFilter = getBboxFilter(name, newBounds);
        SelectionCommandFactory cmdFactory = SelectionCommandFactory.getInstance();
        UndoableMapCommand selectCommand = cmdFactory.createSelectCommand(layer, bboxFilter);
       
        IToolContext toolContext = ApplicationGIS.createContext(ApplicationGIS.getActiveMap());
        toolContext.sendASyncCommand(selectCommand);
    }
View Full Code Here

     * @param unselectedFeature
     */
    private void unselect(SimpleFeature unselectedFeature) {

        IToolContext context = this.mergeView.getContext();
        UndoableMapCommand unselectCommand = context.getSelectionFactory().createNoSelectCommand();

        context.sendASyncCommand(unselectCommand);
    }
View Full Code Here

     */
    protected void operate( Layer layer ) {
        if (layer == null || layer.getMap() == null)
            return;

        UndoableMapCommand command = EditCommandFactory.getInstance().createDeleteLayers(
                new ILayer[]{layer});
        // UndoableMapCommand command =
        // EditCommandFactory.getInstance().createDeleteLayer((ILayer)layer);
        executeCommand(command, layer.getMapInternal());
    }
View Full Code Here

                }
            }
            for( Entry<IMap, List<Layer>> entry : distributor.entrySet() ) {
                IMap map = entry.getKey();
                Layer[] removedLayers = entry.getValue().toArray(new Layer[0]);
                UndoableMapCommand command = EditCommandFactory.getInstance().createDeleteLayers(
                        removedLayers);
                executeCommand(command, map);
            }

        }
View Full Code Here

                result = MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay()
                        .getActiveShell(), Messages.DeleteFeature_confirmation_title,
                        Messages.DeleteFeature_confirmation_text);

                if (result) {
                    UndoableMapCommand c = EditCommandFactory.getInstance().createDeleteFeature(
                            feature, layer);
                    executeCommand(c, layer.getMap());
                }
            }
        });
View Full Code Here

TOP

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

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.