Package org.locationtech.udig.tools.edit.support

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


     */
    @Test
    public void testCreateFeature() throws Exception {
        EditBlackboard bb = handler.getEditBlackboard();
       
        EditGeom geom1 = bb.newGeom("newOne", ShapeType.LINE); //$NON-NLS-1$
        bb.addPoint(10,10, geom1.getShell());
        bb.addPoint(20,10, geom1.getShell());
        bb.addPoint(20,20, geom1.getShell());
        bb.addPoint(10,10, geom1.getShell());
       
       
        EditGeom geom2 = bb.newGeom(feature.getID(), null);
        bb.addPoint(100,100, geom2.getShell());
        bb.addPoint(200,100, geom2.getShell());
        bb.addPoint(200,200, geom2.getShell());
        bb.addPoint(100,100, geom2.getShell());
        handler.setCurrentShape(geom2.getShell());
       
        AcceptChangesBehaviour behaviour=new AcceptChangesBehaviour(LineString.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap((Map) handler.getContext().getMap());
        command.run(new NullProgressMonitor());
View Full Code Here


      for (Coordinate coord : coordinates) {
        array.add(coord);
      }
      Iterator<Coordinate> coorIt = array.iterator();

      EditGeom newEditGeom = bb.newGeom("", ShapeType.LINE); //$NON-NLS-1$
      PrimitiveShape shape = newEditGeom.getShell();
      handler.setCurrentShape(shape);
      handler.setCurrentState(EditState.MODIFYING);

      Coordinate coor = null;
      while (coorIt.hasNext()) {
View Full Code Here

    public RemoveAllVerticesCommand( EditToolHandler handler ) {
        this.handler=handler;
    }

    public void run( IProgressMonitor monitor ) throws Exception {
        EditGeom geom = handler.getCurrentGeom();

        oldGeom=new EditGeom(geom);
        for( Point point : geom.getShell() ) {
            geom.getEditBlackboard().removeCoords(point.getX(), point.getY(), geom.getShell() );
        }
    }
View Full Code Here

        return "RemoveAllVerticesCommand"; //$NON-NLS-1$
    }

    public void rollback( IProgressMonitor monitor ) throws Exception {
        EditBlackboard bb = oldGeom.getEditBlackboard();
        EditGeom geom = bb.newGeom(oldGeom.getFeatureIDRef().get(), oldGeom.getShapeType());
        for( Point p : oldGeom.getShell() ) {
            bb.addPoint(p.getX(), p.getY(), geom.getShell());
        }
       
        for( PrimitiveShape shape : oldGeom.getHoles() ) {
            PrimitiveShape hole = geom.newHole();
            for( Point p : shape ) {
                bb.addPoint(p.getX(), p.getY(), hole);
            }
        }
View Full Code Here

            geom.getFeatureIDRef().set(oldID);

            getMap().getEditManagerInternal().setEditFeature(oldFeature, (Layer) oldLayer);
            if (deselectCreatedFeature) {
                EditBlackboard bb = geom.getEditBlackboard();
                EditGeom newGeom = bb.newGeom(geom.getFeatureIDRef().get(), geom.getShapeType());
                PrimitiveShape shell = geom.getShell();
                for( org.locationtech.udig.tools.edit.support.Point point : shell ) {
                    bb.addPoint(point.getX(), point.getY(), newGeom.getShell());
                }

                List<PrimitiveShape> holes = geom.getHoles();
                for( PrimitiveShape primitiveShape : holes ) {
                    PrimitiveShape newHole = newGeom.newHole();
                    for( Point point2 : primitiveShape ) {
                        bb.addPoint(point2.getX(), point2.getY(), newHole);
                    }
                }
                geom = newGeom;
View Full Code Here

        Collection<EditGeom> geoms = handler.getEditBlackboard(selectedLayer).setGeometries(
                (Geometry) feature.getDefaultGeometry(), feature.getID()).values();
        Class<?> type = selectedLayer.getSchema().getGeometryDescriptor().getType().getBinding();
        boolean polygonLayer=Polygon.class.isAssignableFrom(type) || MultiPolygon.class.isAssignableFrom(type);
        EditGeom over = EditUtils.instance.getGeomWithMouseOver(geoms, mouse, polygonLayer);
        handler.setCurrentShape(over.getShell());
        monitor.done();
    }
View Full Code Here

    public void rollback( IProgressMonitor monitor ) throws Exception {
        monitor.beginTask(Messages.SetGeomCommand_runTask, 30);
        handler.setCurrentShape(currentShape);
        EditBlackboard bb = handler.getEditBlackboard(selectedLayer);
        handler.setCurrentState(currentState);
        EditGeom newCurrentGeom=null;
        List<EditGeom> empty = bb.getGeoms();
       
        for( EditGeom original : removed ) {
            EditGeom inBlackboard = bb.newGeom(original.getFeatureIDRef().get(), original.getShapeType());
            inBlackboard.setChanged(original.isChanged());
            if( original == currentGeom )
                newCurrentGeom=inBlackboard;
           
            PrimitiveShape destination = inBlackboard.getShell();
            newCurrentGeom = setCurrentGeom(newCurrentGeom, destination, original.getShell());
           
            for( Iterator<Coordinate> iter=original.getShell().coordIterator(); iter.hasNext(); ) {
                bb.addCoordinate(iter.next(), destination);
            }
           
            for( PrimitiveShape shape : original.getHoles() ) {
                destination=inBlackboard.newHole();
                newCurrentGeom = setCurrentGeom(newCurrentGeom, destination, shape);
                for( Iterator<Coordinate> iter=shape.coordIterator(); iter.hasNext(); ) {
                    bb.addCoordinate(iter.next(), destination);
                }
            }
View Full Code Here

            geom.getFeatureIDRef().set(oldID);

            getMap().getEditManagerInternal().setEditFeature(oldFeature, (Layer) oldLayer);
            if (deselectCreatedFeature) {
                EditBlackboard bb = geom.getEditBlackboard();
                EditGeom newGeom = bb.newGeom(geom.getFeatureIDRef().get(), geom.getShapeType());
                PrimitiveShape shell = geom.getShell();
                for( org.locationtech.udig.tools.edit.support.Point point : shell ) {
                    bb.addPoint(point.getX(), point.getY(), newGeom.getShell());
                }

                List<PrimitiveShape> holes = geom.getHoles();
                for( PrimitiveShape primitiveShape : holes ) {
                    PrimitiveShape newHole = newGeom.newHole();
                    for( Point point2 : primitiveShape ) {
                        bb.addPoint(point2.getX(), point2.getY(), newHole);
                    }
                }
                geom = newGeom;
View Full Code Here

        monitor.beginTask(Messages.StartEditingCommand_name, 32);
        monitor.worked(2);
       
        EditBlackboard editBlackboard = handler.getEditBlackboard(layer);
       
        EditGeom editGeom = editBlackboard.getGeoms().get(0);
        if( editGeom.getShell().getNumPoints()>0 )
            editGeom=editBlackboard.newGeom(null, type);
        else{
            editGeom.setShapeType(type);
        }
       
        this.currentState=handler.getCurrentState();
        this.currentShape=handler.getCurrentShape();
        handler.setCurrentShape(editGeom.getShell());
        handler.setCurrentState(endState);

        addVertexCommand.setMap(handler.getContext().getMap());
        addVertexCommand.run((monitor));
        monitor.done();
View Full Code Here

        oldGeometry = (Geometry) oldFeature.getDefaultGeometry();
        layer = layerProvider.get(new SubProgressMonitor(monitor, 1));

        editBlackboard.removeGeometries(Collections.singleton(oldshape.getEditGeom()));
        ShapeType shapeType = oldshape.getEditGeom().getShapeType();
        EditGeom current = editBlackboard.newGeom(oldshape.getEditGeom().getFeatureIDRef().get(), shapeType);
        first = current;

        final Set<EditGeom> addedGeoms=new HashSet<EditGeom>();
        for( int i = 0; i < oldshape.getNumPoints(); i++ ) {
            addCoords(current.getShell(), i);
            if (current.getShell().getNumPoints() > 1 && i < oldshape.getNumPoints() - 1
                    && points.contains(oldshape.getPoint(i))) {

                current = editBlackboard.newGeom("newFeature" + System.currentTimeMillis(), shapeType); //$NON-NLS-1$
                List<Coordinate> coords = oldshape.getCoordsAt(i);
                editBlackboard.addCoordinate(coords.get(coords.size() - 1), current.getShell());
                addedGeoms.add(current);
            }
        }
       
        editBlackboard.removeGeometries(addedGeoms);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.support.EditGeom

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.