Examples of EditBlackboard


Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

      try {
        ILayer editLayer = parameters.handler.getEditLayer();
        FeatureCollection<SimpleFeatureType, SimpleFeature> features = getFeatureIterator(
            monitor, editLayer, feature.getBounds());
           
        final EditBlackboard blackboard = parameters.handler.getEditBlackboard(editLayer);       
        features.accepts( new FeatureVisitor(){
                    public void visit( Feature feature ) {
                        SimpleFeature next = (SimpleFeature) feature;
                        SelectFeatureCommand selectFeatureCommand = new SelectFeatureCommand(
                                blackboard, next);
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

  public UndoableMapCommand getCommand(EditToolHandler handler, MapMouseEvent e, EventType eventType) {

    if (!isValid(handler, e, eventType)) {
      throw new IllegalArgumentException("Behaviour is not valid for the current state"); //$NON-NLS-1$
    }
    EditBlackboard bb = handler.getEditBlackboard(handler.getEditLayer());
    Point currPoint = Point.valueOf(e.x, e.y);
    Coordinate coor = bb.toCoord(currPoint);

    SetInitialPointCommand setInitialPointCommand = new SetInitialPointCommand(this.parallelContext, coor);
    return setInitialPointCommand;
  }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

                listener = this;
                return;
            }
      switch( msg.getFeatureID(ViewportModel.class) ) {
            case RenderPackage.VIEWPORT_MODEL__BOUNDS: {
                EditBlackboard editBlackBoard = getEditBlackBoardFromLayer(layer);
                if( editBlackBoard == null ){
                  return; // cannot notify edit blackboard
                }
              editBlackBoard.setToScreenTransform(model.worldToScreenTransform());
                break;
            }
            case RenderPackage.VIEWPORT_MODEL__CRS: {             
                EditBlackboard editBlackBoard = getEditBlackBoardFromLayer(layer);
                if( editBlackBoard == null ){
                  return; // cannot notify edit blackboard
                }
                try {
                    editBlackBoard
                            .setMapLayerTransform(layer.mapToLayerTransform());
                } catch (IOException e) {
                    EditPlugin.log("", e); //$NON-NLS-1$
                }
                editBlackBoard.setToScreenTransform(model.worldToScreenTransform());
                break;
            }
      }
        }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
        List<UndoableMapCommand> commands=new ArrayList<UndoableMapCommand>();
       
        if( handler.getCurrentState()==EditState.CREATING && addPoint){
            Point clickPoint = Point.valueOf(e.x, e.y);
            EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());
           
            Point destination = editBlackboard.overVertex(clickPoint, PreferenceUtil.instance().getVertexRadius());
            if( destination==null ){
               
                AddVertexCommand addVertexCommand = new AddVertexCommand(handler, editBlackboard, clickPoint);

                try {
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

        if (!isValid(handler, e, eventType)) {
            throw new IllegalArgumentException("Behaviour is not valid for the current state"); //$NON-NLS-1$
        }
       
       
        EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());
        List<EditGeom> intersectingGeoms = EditUtils.instance.getIntersectingGeom(editBlackboard,
                Point.valueOf(e.x, e.y), treatUnknownGeomsAsPolygon);
       
        if (e.isModifierDown(MapMouseEvent.MOD1_DOWN_MASK) && !intersectingGeoms.isEmpty()) {
            return new DeselectEditGeomCommand(handler, intersectingGeoms);
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

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

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

        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

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

        @Override
        public void runWithEvent( Event event ) {
            EditGeom currentGeom = handler.getCurrentGeom();
            if( currentGeom==null )
                return;
            EditBlackboard editBlackboard = currentGeom.getEditBlackboard();
            if( editBlackboard.getSelection().isEmpty() || hasNoPoints() ){
                UndoableComposite composite=new UndoableComposite();
                composite.getCommands().add(new SetEditStateCommand(handler, EditState.BUSY));
                composite.getCommands().add(new RemoveAllVerticesCommand(handler));
                composite.getCommands().add(handler.getCommand(handler.getAcceptBehaviours()));
                composite.getCommands().add(new SetCurrentGeomCommand(handler, (PrimitiveShape)null));
                composite.getFinalizerCommands().add(new SetEditStateCommand(handler, EditState.MODIFYING));
                handler.getContext().sendASyncCommand(composite);
            }else{
                UndoableComposite composite=new UndoableComposite();
                composite.getFinalizerCommands().add(new SetEditStateCommand(handler, EditState.MODIFYING));
                composite.getCommands().add(new SetEditStateCommand(handler, EditState.BUSY));
                RemoveSelectedVerticesCommand removeCommand = new RemoveSelectedVerticesCommand(handler);
                removeCommand.setRunAnimation(editBlackboard.getSelection().size()<10);
                composite.getCommands().add(removeCommand);
                handler.getContext().sendASyncCommand(composite);
            }
        }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

                handler.getContext().sendASyncCommand(composite);
            }
        }
        private boolean hasNoPoints() {
            Iterator<Point> iter = handler.getCurrentGeom().getShell().iterator();
            EditBlackboard editBlackboard = handler.getCurrentGeom().getEditBlackboard();
            while( iter.hasNext()){
                if( !editBlackboard.getSelection().contains(iter.next()) )
                    return false;
            }
            return true;
        }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.EditBlackboard

        creator = new Creator(dragStarted);
        initDrawCommands(handler, dragStarted);
        handler.getBehaviours().add(creator);

        ILayer selectedLayer = handler.getEditLayer();
        EditBlackboard editBlackboard = handler.getEditBlackboard(selectedLayer);
        int vertexRadius = PreferenceUtil.instance().getVertexRadius();
        Point nearestPoint = editBlackboard.overVertex(dragStarted, vertexRadius);

        if( nearestPoint==null )
            nearestPoint=dragStarted;
       
        initShapePath(nearestPoint);

        SimpleFeatureType schema = selectedLayer.getSchema();
        determineShapeType(schema);
       
        if( type==ShapeType.POLYGON && EditPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.P_FILL_POLYGONS) ){
            drawShapeCommand.setFill(PreferenceUtil.instance().getDrawGeomsFill());
        }
       
        EditBlackboard blackboard = editBlackboard;
        PrimitiveShape currentShape = handler.getCurrentShape();
        if (currentShape == null) {
            UndoableComposite undoableComposite = startNewShape(handler, blackboard);
            return undoableComposite;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.