Package org.locationtech.udig.project.command

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


      // return null, framework will continue
      DialogUtil.openInformation(Messages.TrimFeaturesCommand_no_features_modified,
            Messages.TrimFeaturesCommand_did_not_apply_to_any_feature);
      return null;
    }
    UndoableMapCommand trimCommand = new TrimFeaturesCommand(handler, selectedLayer, featuresToTrim,
          trimmingLineInLayerCrs);

    return trimCommand;
  }
View Full Code Here


                String fidNotTrimmed = ""; //$NON-NLS-1$
                try {
                    SimpleFeature feature;
                    Geometry original;
                    Geometry trimmed;
                    UndoableMapCommand command;
                    while (iterator.hasNext()) {
                        feature = iterator.next();
                        original = (Geometry) feature.getDefaultGeometry();

                        if (checkTrimPossible(original)) {
View Full Code Here

      geom = GeometryUtil.adapt(geom, type);
      feature.setDefaultGeometry(geom);
    } catch (IllegalAttributeException e) {
      throw new RuntimeException(e);
    }
    UndoableMapCommand command = editCmdFac.createAddFeatureCommand(feature, layer);

    handler.setCurrentShape(null);
    handler.setCurrentState(EditState.NONE);

    return command;
View Full Code Here

      IViewPart viewPart = page.findView(MergeView.ID);
      page.hideView(viewPart);
    } finally {
      IToolContext context = getContext();
      if(context != null){
        UndoableMapCommand clearSelectionCommand = context
            .getSelectionFactory().createNoSelectCommand();

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

    final FeatureIterator<SimpleFeature> iter = sourceFeatures.features();
    while (iter.hasNext()) {
      SimpleFeature feature = iter.next();

      UndoableMapCommand deleteCmd = cmdFactory.createDeleteFeature(feature, layer);
      deleteCmd.setMap(map);
     
      cmdList.add(deleteCmd);
    }
    iter.close();

    // adds the merge feature to new layer
    UndoableMapCommand addCmd = cmdFactory.createAddFeatureCommand(mergedFeature, layer);
    addCmd.setMap(map);
   
    cmdList.add(addCmd);

    assert cmdList.size() >= 3; // Almost two delete and one add command
View Full Code Here

            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

            public void run() {
                boolean decision = MessageDialog.openQuestion(shell,
                    Messages.ValidToolDetectionActivator_questionTitle, string);

                if (decision) {
                    UndoableMapCommand command = handler.getContext().getBasicCommandFactory()
                            .createSetApplicabilityCommand(layer, Interaction.EDIT, true);
                    handler.getContext().sendASyncCommand(command);
                } else {
                    warning[0]=Messages.ValidToolDetectionActivator_warning2;
                }
View Full Code Here

            monitor.worked(2);
            for( Behaviour behaviour : behaviours ) {
                monitor.beginTask(getName(), behaviours.size()*12);
                monitor.worked(2);
                if( behaviour.isValid(handler)){
                    UndoableMapCommand c=null;
                    try{
                        c=behaviour.getCommand(handler);
                        if( c==null )
                            continue;
                        c.setMap(getMap());
                        IProgressMonitor submonitor = new SubProgressMonitor(monitor, 10);
                        if (c instanceof PostDeterminedEffectCommand) {
                            PostDeterminedEffectCommand command = (PostDeterminedEffectCommand) c;
                            if( command.execute(submonitor) )
                                commandsRan.add(command);
                        }else{
                        c.run(submonitor);
                        commandsRan.add(c);
                        }
                        submonitor.done();
                    }catch(Exception e){
                      EditPlugin.trace( e.getClass().getName()+" executing "+c+":"+e.getMessage(), e);
View Full Code Here

            }
            GeometryOperationAnimation animation = new GeometryOperationAnimation(
                    EditGeomPathIterator.getPathIterator(editGeom).toShape(),
                    new IsBusyStateProvider(handler));

            UndoableMapCommand startAnimationCommand = drawfactory.createStartAnimationCommand(
                    display, Collections.singletonList((IAnimation) animation));
            commands.add(startAnimationCommand);

            if (isCurrentGeometry(handler, editGeom)) {
                if (isCreatingNewFeature(handler)) {
                    int attributeCount = schema.getAttributeCount();
                    SimpleFeature feature;
                    try {
                        feature = SimpleFeatureBuilder.template(schema, "newFeature"
                                + new Random().nextInt());
                        // feature = SimpleFeatureBuilder.build(schema, new
                        // Object[attributeCount],"newFeature");
                        feature.setDefaultGeometry(geom);
                    } catch (IllegalAttributeException e) {
                        throw new IllegalStateException(
                                "Could not create an empty " + schema.getTypeName() + ":" + e, e); //$NON-NLS-1$//$NON-NLS-2$
                    }
                   
                    CreateFeatureCommand.runFeatureCreationInterceptors(feature);
                   
                    // FeaturePanelProcessor panels = ProjectUIPlugin.getDefault()
                    // .getFeaturePanelProcessor();
                    // List<FeaturePanelEntry> popup = panels.search(schema);
                    // if (popup.isEmpty()) {
                    CreateAndSelectNewFeature newFeatureCommand = new CreateAndSelectNewFeature(
                            handler.getCurrentGeom(), feature, layer, deselectCreatedFeatures);
                    commands.add(newFeatureCommand);
                    // } else {
                    // CreateDialogAndSelectNewFeature newFeatureCommand = new
                    // CreateDialogAndSelectNewFeature(
                    // handler.getCurrentGeom(), feature, layer, deselectCreatedFeatures,
                    // popup);
                    // commands.add(newFeatureCommand);
                    // }
                } else {
                    // not creating it so don't need to set it.
                    UndoableMapCommand setGeometryCommand = new SetGeometryCommand(editGeom
                            .getFeatureIDRef().get(), new StaticBlockingProvider<ILayer>(layer),
                            SetGeometryCommand.DEFAULT, geom);
                    commands.add(setGeometryCommand);
                }
            } else {
View Full Code Here

    }

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e,
            EventType eventType ) {
        UndoableMapCommand command = null;
        if (creator == null || generalPath==null || drawEndPoints==null || drawShapeCommand==null )
            command = init(handler, e, eventType);
        generalPath.lineTo(e.x, e.y);
       
        updateShapes(handler, e);
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.