Package org.locationtech.udig.project.command

Examples of org.locationtech.udig.project.command.UndoableMapCommand.run()


                        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){
                        behaviour.handleError(handler, e, c);
View Full Code Here


        command.setMap((Map) handler.getContext().getMap());
        if (command instanceof PostDeterminedEffectCommand) {
            PostDeterminedEffectCommand c = (PostDeterminedEffectCommand) command;
            c.execute(new NullProgressMonitor());
        }else{
            command.run(new NullProgressMonitor());
        }
       
        assertEquals("Current shape should equal new hole", editGeom.getHoles().get(0), handler.getCurrentShape()); //$NON-NLS-1$
        assertEquals("A point should have been added to hole", Point.valueOf(10,10), handler.getCurrentShape().getPoint(0)); //$NON-NLS-1$
        assertEquals( EditState.CREATING, handler.getCurrentState());
View Full Code Here

        bb.addPoint(20,20,hole);
       
        behaviour=new AcceptChangesBehaviour(Polygon.class, false);       
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());

        assertFalse(handler.getCurrentGeom().isChanged());
        LineString shell = ((Polygon)feature.getDefaultGeometry()).getExteriorRing();
        assertEquals(4, shell.getCoordinates().length);
        assertEquals(toCoord(bb,10,10), shell.getCoordinates()[0]);
View Full Code Here

        bb.addPoint(20,20,hole);
       
        behaviour=new AcceptChangesBehaviour(Polygon.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertFalse(handler.getCurrentGeom().isChanged());
        LineString shell = ((Polygon)((MultiPolygon)feature.getDefaultGeometry()).getGeometryN(0)).getExteriorRing();
        assertEquals(4, shell.getCoordinates().length);
        assertEquals(toCoord(bb,10,10), shell.getCoordinates()[0]);
        assertEquals(toCoord(bb,40,10), shell.getCoordinates()[1]);
View Full Code Here

       
        // test create LineString
        behaviour=new AcceptChangesBehaviour(LineString.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertFalse(handler.getCurrentGeom().isChanged());
        assertEquals(2, ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates().length);
        assertEquals(toCoord(bb,10,10), ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates()[0]);
        assertEquals(toCoord(bb,40,10), ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates()[1]);
        features = layer.getResource(FeatureSource.class, null).getFeatures().features();
View Full Code Here

        // test create LinearRing
        behaviour=new AcceptChangesBehaviour(LinearRing.class, false);
        handler.getCurrentGeom().setChanged(true);
        command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertEquals(4, ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates().length);
        assertEquals(toCoord(bb,10,10), ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates()[0]);
        assertEquals(toCoord(bb,40,10), ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates()[1]);
        assertEquals(toCoord(bb,10,10), ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates()[2]);
        assertEquals(toCoord(bb,10,10), ((GeometryCollection)feature.getDefaultGeometry()).getGeometryN(0).getCoordinates()[3]);
View Full Code Here

       
        // test create LineString
        behaviour=new AcceptChangesBehaviour(LineString.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertFalse(handler.getCurrentGeom().isChanged());
        assertEquals(toCoord(bb,10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[0]);
        assertEquals(toCoord(bb,40,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[1]);
        assertEquals(2, ((Geometry) feature.getDefaultGeometry()).getCoordinates().length);
        features = layer.getResource(FeatureSource.class, null).getFeatures().features();
View Full Code Here

        // test create LinearRing
        behaviour=new AcceptChangesBehaviour(LinearRing.class, false);
        handler.getCurrentGeom().setChanged(true);
        command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertEquals(4, ((Geometry) feature.getDefaultGeometry()).getCoordinates().length);
        assertEquals(toCoord(bb,10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[0]);
        assertEquals(toCoord(bb,40,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[1]);
        assertEquals(toCoord(bb,10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[2]);
        assertEquals(toCoord(bb,10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[3]);
View Full Code Here

        handler.setCurrentShape(editGeom.getShell());
       
        // test create point
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
       
        assertEquals(toCoord(bb,10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[0]);
        FeatureIterator<SimpleFeature> features = layer.getResource(FeatureSource.class, null).getFeatures().features();
        SimpleFeature next = features.next();
        assertEquals( toCoord(bb,10,10), ((Geometry) next.getDefaultGeometry()).getCoordinates()[0] );
View Full Code Here

       

        // test create Multi Point
        command = behaviour.getCommand(handler);
        command.setMap(handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertFalse(handler.getCurrentGeom().isChanged());
        assertEquals(toCoord(bb,10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[0]);
        assertEquals(toCoord(bb,40,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[1]);
        assertEquals(2, ((Geometry) feature.getDefaultGeometry()).getCoordinates().length);
        features = layer.getResource(FeatureSource.class, null).getFeatures().features();
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.