Package org.locationtech.udig.project.command

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


            }
        }
        if( commands.size() == 0)
            return null;
        else
            return new UndoableComposite(commands);
    }
View Full Code Here


                }
               
                if( shape.getEditGeom().getShapeType()==ShapeType.POLYGON  )
                    generalPath.close();
               
                UndoableComposite appendPathToShape;
                    appendPathToShape = EditUtils.instance.appendPathToShape(handler, generalPath.getPathIterator(),
                        shape);
                // Now we need to collapse the last two vertices if they are
                // within snapping distance. 
                if ( shape.getEditGeom().getShapeType()==ShapeType.POLYGON ){
                   
                    List< ? extends MapCommand> commands = appendPathToShape.getCommands();
                    AddVertexCommand lastVertexCommand=(AddVertexCommand) commands.get(commands.size()-1);
                    AddVertexCommand previousVertexCommand=(AddVertexCommand) commands.get(commands.size()-2);
                    EditUtils.MinFinder finder = new EditUtils.MinFinder(lastVertexCommand.getPointToAdd());
                    double dist = finder.dist(previousVertexCommand.getPointToAdd());
                    if( dist<vertexRadius ){
                        commands.remove(previousVertexCommand);
                    }
                }
                if( handler.getCurrentShape()!=null )
                    appendPathToShape.getFinalizerCommands().add(new SetEditStateCommand( handler, EditState.MODIFYING));
                else{
                    appendPathToShape.getFinalizerCommands().add(new SetEditStateCommand( handler, EditState.CREATING));
                }
               
                appendPathToShape.setMap(handler.getContext().getMap());
                appendPathToShape.run(new NullProgressMonitor());
               
                return new UndoRedoCommand(appendPathToShape);
            } catch (Exception exception) {
                throw (RuntimeException) new RuntimeException( exception );
            } finally {
View Full Code Here

            }
        }
        if( commands.size() == 0)
            return null;
        else{
            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

                PreferenceUtil.instance().getVertexRadius());
        if( point.equals(handler.getCurrentShape().getPoint(0))){
            List<UndoableMapCommand> commands=new ArrayList<UndoableMapCommand>();
            commands.add(new ReversePointsInShapeCommand(handler, handler.getCurrentShape()));
            commands.add(new SetEditStateCommand(handler, EditState.CREATING));
            return new UndoableComposite(commands);
        }else
            return new SetEditStateCommand(handler, EditState.CREATING);
    }
View Full Code Here

  /**
   * Deletes the previous parallel preview and draws a new one.
   */
  private void redraw() {

    UndoableComposite composite = new UndoableComposite();

    delete(composite);
    draw(composite);

    composite.setMap(handler.getContext().getMap());
    context.sendASyncCommand(composite);

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

  }

    private void runDeselectionStrategies( IProgressMonitor monitor ) {

        List<DeselectionStrategy> strategies = parameters.deselectionStrategies;
        UndoableComposite compositeCommand = new UndoableComposite();
        for( DeselectionStrategy strategy : strategies ) {
            strategy.run(monitor, parameters, compositeCommand);
        }
        this.command = compositeCommand;
View Full Code Here

    }

    private void runSelectionStrategies( IProgressMonitor monitor, FeatureIterator<SimpleFeature> reader ) {
        List<SelectionStrategy> strategies = parameters.selectionStrategies;
        UndoableComposite compositeCommand = new UndoableComposite();
        compositeCommand.setName(Messages.SelectGeometryCommand_name);
       
        SimpleFeature firstFeature = reader.next();
        for( SelectionStrategy selectionStrategy : strategies ) {
          selectionStrategy.run(monitor, compositeCommand, parameters, firstFeature,
              true);
View Full Code Here

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

    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.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.