Package org.locationtech.udig.tools.edit

Examples of org.locationtech.udig.tools.edit.EditToolHandler


        this.typeToCreate = typeToCreate;
    }

    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);
           
            commands.addCommand(handler.getContext().getEditFactory()
                    .createNullEditFeatureCommand());
            commands.addCommand(new ClearEditBlackboardCommand(handler, editBlackboard));
            commands.addCommand(new SetEditStateCommand(handler, EditState.NONE));
        }

        if (typeToCreate != null) {
            if (typeToCreate == ShapeType.POINT) {
                commands.addCommand(new StartEditingCommand(handler, parameters.event,
                        typeToCreate, handler.getCurrentState()));
                commands.addCommand(handler.getCommand(handler.getAcceptBehaviours()));
            } else {
                commands.addCommand(new StartEditingCommand(handler, parameters.event,
                        typeToCreate, EditState.CREATING));
            }
        }
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

     * @param feature Feature being selected
     * @param firstFeature true if this is the first feature returned for selection
     */
    public void run( IProgressMonitor monitor, UndoableComposite commands,
            SelectionParameter parameters, SimpleFeature feature, boolean firstFeature ) {
        EditToolHandler handler = parameters.handler;
        Class< ? extends Geometry>[] acceptableClasses = parameters.acceptableClasses;
        boolean onlyAdd = parameters.onlyAdd;
        MapMouseEvent event = parameters.event;

        for( Class< ? extends Geometry> clazz : acceptableClasses ) {
            if (clazz.isAssignableFrom(feature.getDefaultGeometry().getClass())) {
                EditPlugin.trace(EditPlugin.SELECTION,
                        "Feature is one of the acceptable classes " + feature.getID(), null); //$NON-NLS-1$

                if (firstFeature && !keyboardModifierIndicatesAdd(handler, event) && !onlyAdd ) {
                    commands.addCommand(handler.getCommand(handler.getAcceptBehaviours()));
                    commands.addCommand(new SelectFeatureAsEditFeatureCommand(handler, feature,
                            handler.getEditLayer(), Point.valueOf(event.x, event.y)));
                } else {
                    if (onlyAdd || keyboardModifierIndicatesAdd(handler, event)) {
                        // call SelectFeaturecommand so that it is the CurrentEditGeom
                        commands.addCommand(new SelectFeatureCommand(handler, feature, Point
                                .valueOf(event.x, event.y)));
View Full Code Here

    if (toolContext == null) {
      return;
    }

    EditToolHandler handler = toolContext.getHandler();

    List<UndoableMapCommand> commands = new ArrayList<UndoableMapCommand>();

    commands.add(handler.getCommand(handler.getAcceptBehaviours()));
    UndoableComposite undoableComposite = new UndoableComposite(commands);

    undoableComposite.setMap(handler.getContext().getMap());
    handler.getContext().sendASyncCommand(undoableComposite);

    handler.getContext().getViewportPane().repaint();
  }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.EditToolHandler

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.