Exemplo n.º 1
0
        private Map CreateMap()
        {
            var map = new Map();

            var osmLayer = new TileLayer(new OsmTileSource())
            {
                LayerName = "OSM"
            };

            map.Layers.Add(osmLayer);

            var pointLayer = PointLayerSample.CreateRandomPointLayer(map.Envelope, 600);
            var bitmapData = System.Reflection.Assembly.GetExecutingAssembly()
                             .GetManifestResourceStream("Mapsui.Silverlight.UI.Images.btnBbox.png");
            var symbolStyle = new SymbolStyle {
                Symbol = new Bitmap {
                    Data = bitmapData
                }
            };

            pointLayer.Styles.Add(symbolStyle);
            map.Layers.Add(pointLayer);

            return(map);
        }
Exemplo n.º 2
0
        private void RandomPointWithStackLabelClick(object sender, RoutedEventArgs e)
        {
            MapControl.Map.Layers.Clear();
            MapControl.Map.Layers.Add(new TileLayer(KnownTileSources.Create())
            {
                Name = "OSM"
            });
            var provider = CreateRandomPointsProvider();

            MapControl.Map.Layers.Add(PointLayerSample.CreateStackedLabelLayer(provider));
            MapControl.Map.Layers.Add(PointLayerSample.CreateRandomPointLayer(provider));
            LayerList.Initialize(MapControl.Map.Layers);
            MapControl.ZoomToFullEnvelope();
            MapControl.Refresh();
        }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            var mapControl = FindViewById <MapControl>(Resource.Id.mapcontrol);
            var tileLayer  = CreateTileLayer();

            mapControl.Map.Layers.Add(tileLayer);

            mapControl.Map.Layers.Add(LineStringSample.CreateLineStringLayer(CreateLineStringStyle()));

            var pointLayer = PointLayerSample.CreateRandomPointLayer(mapControl.Map.Envelope);

            pointLayer.Style = CreatePointLayerStyle();
            mapControl.Map.Layers.Add(pointLayer);

            mapControl.Map.Layers.Add(PointLayerSample.CreateBitmapPointLayer());

            mapControl.Map.Viewport.RenderResolutionMultiplier = 2;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            mapControl.Map.Layers.Add(new TileLayer(new OsmTileSource()));

            var pointLayer = PointLayerSample.CreateRandomPointLayer(mapControl.Map.Envelope, 200);

            // add some sample symbols (resource images) to the map...
            var assembly = typeof(MainPage).GetTypeInfo().Assembly;
            var stream   = assembly.GetManifestResourceStream(@"Mapsui.Samples.Metro.Resources.Images.ns.png");

            stream.Position = 0;
            pointLayer.Styles.Clear();
            pointLayer.Styles.Add(new SymbolStyle {
                Symbol = new Bitmap {
                    Data = stream
                }, SymbolRotation = 45.0
            });

            mapControl.Map.Layers.Add(pointLayer);
            mapControl.Map.Layers.Add(PointLayerSample.CreateRandomPolygonLayer(mapControl.Map.Envelope, 1));
        }
Exemplo n.º 5
0
        private void RandomPointsWithFeatureInfoClick(object server, RoutedEventArgs e)
        {
            MapControl.Map.Layers.Clear();
            MapControl.Map.Layers.Add(new TileLayer(KnownTileSources.Create())
            {
                Name = "OSM"
            });
            var pointLayer = PointLayerSample.CreateRandomPointLayer(CreateRandomPointsProvider());

            pointLayer.Style = new StyleCollection {
                new SymbolStyle {
                    SymbolScale = 1, Fill = new Brush(Color.Cyan),
                    Outline     = { Color = Color.White, Width = 2 }
                }
            };
            MapControl.Map.Layers.Add(pointLayer);
            MapControl.MouseInfoUp += MapControlOnMouseInfoDown;
            MapControl.MouseInfoUpLayers.Add(pointLayer);
            LayerList.Initialize(MapControl.Map.Layers);
            MapControl.ZoomToFullEnvelope();
            MapControl.Refresh();
        }
Exemplo n.º 6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            var mapView = FindViewById <MapControl>(Resource.Id.mapview);

            mapView.Map.Layers.Add(new TileLayer(new OsmTileSource())
            {
                LayerName = "OSM"
            });
            var lineStringLayer = LineStringSample.CreateLineStringLayer();

            lineStringLayer.Style = CreateLineStringStyle();

            mapView.Map.Layers.Add(lineStringLayer);
            var pointLayer = PointLayerSample.CreateRandomPointLayer(mapView.Map.Envelope);

            pointLayer.Style = CreatePointLayerStyle();
            mapView.Map.Layers.Add(pointLayer);

            mapView.Map.Layers.Add(PointLayerSample.CreateBitmapPointLayer());
        }