Package org.locationtech.udig.project.command

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


        count = 0;
        while( featureIterator.hasNext() ) {
            SimpleFeature feature = featureIterator.next();
            Geometry geometry = (Geometry) feature.getDefaultGeometry();
            Geometry newGeometry = geometry.reverse();
            UndoableMapCommand setGeometryCmd = cmdFactory.createSetGeomteryCommand(feature, selectedLayer, newGeometry);
            cmdList.add(setGeometryCmd);
            count++;
        }
        CompositeCommand compositeCommand = new CompositeCommand(cmdList);
        IToolContext toolContext = ApplicationGIS.createContext(ApplicationGIS.getActiveMap());
View Full Code Here


        List<UndoableMapCommand> copyOverList = new LinkedList<UndoableMapCommand>();
        List<UndoableMapCommand> deleteOldList = new LinkedList<UndoableMapCommand>();
        int count = 0;
        while( featureIterator.hasNext() ) {
            SimpleFeature feature = featureIterator.next();
            UndoableMapCommand addFeatureCmd = cmdFactory.createAddFeatureCommand(feature, toLayer);
            copyOverList.add(addFeatureCmd);
            UndoableMapCommand deleteFeatureCmd = cmdFactory.createDeleteFeature(feature, selectedLayer);
            deleteOldList.add(deleteFeatureCmd);
            count++;
        }

        /*
 
View Full Code Here

            ref = ref.transform(activeMap.getViewportModel().getCRS(), true);
        } catch (Exception e1) {
            // ignore
        }

        UndoableMapCommand selectCommand = SelectionCommandFactory.getInstance().createFIDSelectCommand(selectedLayer,
                currentFeature);
        ZoomCommand zoomCommand = new ZoomCommand(ref);
        activeMap.sendCommandASync(selectCommand);
        activeMap.sendCommandASync(zoomCommand);
        activeMap.getRenderManager().refresh(null);
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] );
        assertEquals(Point.class, feature.getDefaultGeometry().getClass());
       
        bb.addPoint(40,10,bb.newGeom(null, null).getShell());
        handler.getCurrentGeom().setChanged(true);

        SimpleFeatureType type = DataUtilities.createType("MultiPoint", "*geom:MultiPoint"); //$NON-NLS-1$ //$NON-NLS-2$
        feature = SimpleFeatureBuilder.template(type, feature.getID());
        ((TestLayer)handler.getContext().getMap().getMapLayers().get(0)).setSchema(type);
        ((Map)handler.getContext().getMap()).getEditManagerInternal().setEditFeature(feature, layer);
       

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

        EditGeom editGeom = bb.getGeoms().get(0);

        bb.addPoint(10,10,editGeom.getShell());

        handler.setCurrentShape(editGeom.getShell());
       UndoableMapCommand command = behaviour.getCommand(handler);
       command.setMap((Map) handler.getContext().getMap());
       nullProgressMonitor = new NullProgressMonitor();
       command.run(nullProgressMonitor);
       assertFalse(handler.getCurrentGeom().isChanged());
       assertNotNull(handler.getCurrentGeom().getFeatureIDRef().get());
      
       
        assertEquals( count+1, source.getCount(Query.ALL) );
View Full Code Here

       
        EditGeom geom2 = bb.newGeom(feature.getID(), ShapeType.POINT);
        bb.addPoint(20,20, geom2.getShell());
       
        AcceptChangesBehaviour behaviour = new AcceptChangesBehaviour(Point.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap((Map) handler.getContext().getMap());
        command.run(new NullProgressMonitor());
        assertEquals( "Should have 2 points", 2, ((Geometry) feature.getDefaultGeometry()).getCoordinates().length); //$NON-NLS-1$
        assertEquals( "Should have 2 geoms", 2, ((Geometry) feature.getDefaultGeometry()).getNumGeometries()); //$NON-NLS-1$
    }
View Full Code Here

        bb.addPoint(200,100, geom2.getShell());
        bb.addPoint(200,200, geom2.getShell());
        bb.addPoint(100,100, geom2.getShell());
       
        AcceptChangesBehaviour behaviour=new AcceptChangesBehaviour(LineString.class, false);
        UndoableMapCommand command = behaviour.getCommand(handler);
        command.setMap((Map) handler.getContext().getMap());
        command.run(new NullProgressMonitor());
       
        layer.getMapInternal().getEditManagerInternal().commitTransaction();
       
        FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        FeatureSource<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureSource.class, new NullProgressMonitor());
View Full Code Here

        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());
       
        layer.getMapInternal().getEditManagerInternal().commitTransaction();
       
        FilterFactory fac = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        Set<String> fids = new HashSet<String>();
View Full Code Here

        public boolean isValid( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
            return true;
        }

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

               
                private Map map;

                public void setMap( IMap map ) {
View Full Code Here

        public boolean isValid( EditToolHandler handler ) {
            return true;
        }

        public UndoableMapCommand getCommand( EditToolHandler handler) {
            return new UndoableMapCommand(){

               
                private Map map;

                public void setMap( IMap map ) {
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.