示例#1
0
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleVoyager);

            // Initialize source and Edit layer, add it to the map
            source = new LocalVectorDataSource(MapView.Options.BaseProjection);

            editLayer = new EditableVectorLayer(source);
            MapView.Layers.Add(editLayer);

            // Convenience methods to add elements to the map, cf. LocalVectorDataSourceExtensions
            source.AddPoint(new MapPos(-5000000, -900000));

            source.AddLine(new MapPosVector {
                new MapPos(-6000000, -500000), new MapPos(-9000000, -500000)
            });

            source.AddPolygon(new MapPosVector {
                new MapPos(-5000000, -5000000), new MapPos(5000000, -5000000), new MapPos(0, 10000000)
            });

            // Add a vector element event listener to select elements (on element click)
            editLayer.VectorElementEventListener = new VectorElementSelectEventListener(editLayer);

            // Add a map event listener to deselect element (on map click)
            MapView.MapEventListener = new VectorElementDeselectEventListener(editLayer);

            // Add the vector element edit event listener
            editLayer.VectorEditEventListener = new BasicEditEventListener(source);

            Alert("Click on object to modify or move it");
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleDefault);

            // Initialize source and Edit layer, add it to the map
            source = new LocalVectorDataSource(MapView.Options.BaseProjection);

            editLayer = new EditableVectorLayer(source);
            MapView.Layers.Add(editLayer);

            // Convenience methods to add elements to the map, cf. LocalVectorDataSourceExtensions
            source.AddPoint(new MapPos(-7000000, 7000000));

            source.AddLine(new MapPosVector {
                new MapPos(-9000000, -9000000), new MapPos(-5000000, -500000)
            });

            source.AddPolygon(new MapPosVector {
                new MapPos(-4000000, -4000000), new MapPos(4000000, -4000000), new MapPos(0, 7000000)
            });

            // Add a vector element even listener to select elements (on element click)
            editLayer.VectorElementEventListener = new VectorElementSelectEventListener(editLayer);

            // Add a map even listener to deselect element (on map click)
            MapView.MapEventListener = new VectorElementDeselectEventListener(editLayer);

            // Add the vector element edit even listener
            editLayer.VectorEditEventListener = new BasicEditEventListener(source);
        }
示例#3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleDefault);

            // Initialize source and Edit layer, add it to the map
            source = new LocalVectorDataSource(MapView.Options.BaseProjection);

            editLayer = new EditableVectorLayer(source);
            MapView.Layers.Add(editLayer);

            // Convenience methods to add elements to the map, cf. LocalVectorDataSourceExtensions
            source.AddPoint(new MapPos(-7000000, 7000000));

            source.AddLine(new MapPosVector {
                new MapPos(-9000000, -9000000), new MapPos(-5000000, -500000)
            });

            source.AddPolygon(new MapPosVector {
                new MapPos(-4000000, -4000000), new MapPos(4000000, -4000000), new MapPos(0, 7000000)
            });

            // Add a vector element even listener to select elements (on element click)
            editLayer.VectorElementEventListener = new VectorElementSelectEventListener(editLayer);

            // Add a map even listener to deselect element (on map click)
            MapView.MapEventListener = new VectorElementDeselectEventListener(editLayer);

            // Add the vector element edit even listener
            editLayer.VectorEditEventListener = new BasicEditEventListener(source);
        }
        protected override void OnCreate(Android.OS.Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AddOnlineBaseLayer(CartoBaseMapStyle.CartoBasemapStyleDefault);

            // Initialize source and Edit layer, add it to the map
            source = new LocalVectorDataSource(MapView.Options.BaseProjection);

            editLayer = new EditableVectorLayer(source);
            MapView.Layers.Add(editLayer);

            // Convenience methods to add elements to the map, cf. LocalVectorDataSourceExtensions
            source.AddPoint(new MapPos(-5000000, -900000));

            source.AddLine(new MapPosVector {
                new MapPos(-6000000, -500000), new MapPos(-9000000, -500000)
            });

            source.AddPolygon(new MapPosVector {
                new MapPos(-5000000, -5000000), new MapPos(5000000, -5000000), new MapPos(0, 10000000)
            });

            // Add a vector element event listener to select elements (on element click)
            editLayer.VectorElementEventListener = new VectorElementSelectEventListener(editLayer);

            // Add a map event listener to deselect element (on map click)
            MapView.MapEventListener = new VectorElementDeselectEventListener(editLayer);

            // Add the vector element edit event listener
            editLayer.VectorEditEventListener = new BasicEditEventListener(source);

            Alert("Click on object to modify or move it");
        }