コード例 #1
0
        private void Refresh()
        {
            ShapefileLayer areaLayer = Map1.FindLayer <ShapefileLayer>("countries-900913");

            if (areaLayer == null)
            {
                return;
            }
            areaLayer.Styles.Clear();
            ClassBreakStyle classBreakStyle = ClassBreakStyle.Create(columnName, 281396894, 5000000, 11, DimensionType.Area, colorFamily, new GeoColor(50, 100, 200, 150), 0.01f);

            classBreakStyle.ClassBreaks[0].Value = 0;
            areaLayer.Styles.Add(classBreakStyle);

            LegendTitleTextBlock.Text = "The population of countries";
            ClassBreak[] classBreaks = classBreakStyle.ClassBreaks.OrderBy(i => i.Value).ToArray();
            for (int i = 0; i < classBreaks.Length; i++)
            {
                ClassBreak fromClassBreak = classBreaks[i];
                ClassBreak toClassBreak   = i + 1 < classBreaks.Length ? classBreaks[i + 1] : null;
                foreach (var style in fromClassBreak.Styles)
                {
                    if (toClassBreak != null)
                    {
                        style.Name = $"{(fromClassBreak.Value / 1000000).ToString("N0")} ~ {(toClassBreak.Value / 1000000).ToString("N0")} million";
                    }
                    else
                    {
                        style.Name = $">= {(fromClassBreak.Value / 1000000).ToString("N0")} million";
                    }
                }
            }
            LegendView.Update(classBreaks.SelectMany(i => i.Styles));
            Map1.Refresh(RefreshType.Redraw);
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913");

            pointLayer.UseRandomStyle(120);

            SyncSymbolSettings(pointLayer);
        }
コード例 #3
0
        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {
            bool useDash = ((CheckBox)sender).IsChecked.Value;

            ShapefileLayer lineLayer = Map1.FindLayer <ShapefileLayer>("streets-900913");

            ((LineStyle)lineLayer.Styles[0]).Pen.DashPattern = useDash ? new[] { 4f, 4f } : null;
            Map1.Refresh("LineOverlay");
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShapefileLayer lineLayer = Map1.FindLayer <ShapefileLayer>("streets-900913");

            float[] dashPattern = ((LineStyle)lineLayer.Styles[0]).Pen.DashPattern;
            lineLayer.UseRandomStyle();
            ((LineStyle)lineLayer.Styles[0]).Pen.DashPattern = dashPattern;

            Map1.Refresh("LineOverlay");
        }
コード例 #5
0
        private void SyncSymbolSettings(ShapefileLayer pointLayer)
        {
            SymbolStyle symbolStyle = (SymbolStyle)pointLayer.Styles[0];

            symbolStyle.SymbolType = (SymbolType)SymbolTypeComboBox.SelectedValue;
            symbolStyle.Size       = (float)SymbolSizeComboBox.SelectedValue;
            symbolStyle.Margin     = 40;

            Map1.Refresh("PointOverlay");
        }
コード例 #6
0
        private void SynbolSettingsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913");

            if (pointLayer == null)
            {
                return;
            }

            SyncSymbolSettings(pointLayer);
        }
コード例 #7
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer areaLayer = new ShapefileLayer("SampleData/countries-900913.shp");

            Map1.AddStaticLayers("AreaOverlay", areaLayer);
            Map1.CurrentBound = areaLayer.GetBound();
            Refresh();
        }
コード例 #8
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Degree;

            ShapefileLayer featureLayer = new ShapefileLayer("SampleData/countries-wgs84.shp");

            featureLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#FAB04D"), GeoColors.White));
            Map1.AddStaticLayers("countries-wgs84", featureLayer);

            Map1.ZoomToFullBound();
        }
コード例 #9
0
        private void UpdateStyle()
        {
            ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913");

            if (pointLayer == null)
            {
                return;
            }

            SyncFontStyleSettings(pointLayer);
            Map1.Refresh("PointOverlay");
        }
コード例 #10
0
        public IHttpActionResult GetXyzTile(int z, int x, int y)
        {
            ShapefileLayer countriesLayer = new ShapefileLayer(HttpContext.Current.Server.MapPath("~/App_Data/countries-900913.shp"));

            countriesLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#AAFFDF3E"), GeoColors.White));

            MapModel mapModel = new MapModel(GeoUnit.Meter);

            mapModel.Layers.Add(countriesLayer);

            return(new XyzTileResult(mapModel, x, y, z));
        }
コード例 #11
0
        /// <summary>
        /// Handles the Loaded event of the Map1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer areaLayer = new ShapefileLayer("SampleData/countries-900913.shp");

            areaLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White, 1));
            Map1.AddStaticLayers("AreaOverlay", areaLayer);

            Map1.ZoomTo(areaLayer.GetBound());
        }
コード例 #12
0
        public IActionResult GetXyzTile(int z, int x, int y)
        {
            ShapefileLayer countriesLayer = new ShapefileLayer("AppData/countries-900913.shp");

            countriesLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#AAFFDF3E"), GeoColors.White));

            MapModel mapModel = new MapModel(GeoUnit.Meter);

            mapModel.Layers.Add(countriesLayer);

            return(new XyzTileResult(mapModel, x, y, z));
        }
コード例 #13
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;

            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer shapefileLayer = new ShapefileLayer("AppData/countries-900913.shp");

            shapefileLayer.UseRandomStyle(120);
            Map1.AddStaticLayers("Dynamic Layers", shapefileLayer);

            Map1.ZoomToFullBound();
        }
コード例 #14
0
        public Form1()
        {
            InitializeComponent();

            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer shapefileLayer = new ShapefileLayer("AppData/countries-900913.shp");

            shapefileLayer.UseRandomStyle(120);
            Map1.AddStaticLayers("Dynamic Layers", shapefileLayer);

            Map1.ZoomToFullBound();
        }
コード例 #15
0
        public IHttpActionResult Identify(double x, double y, int z)
        {
            ShapefileLayer layer   = new ShapefileLayer(HttpContext.Current.Server.MapPath("~/App_Data/world-bound-900913.shp"));
            Feature        feature = layer.Identify(new GeoCoordinate(x, y), new ScaleLevels()[z].Scale, GeoUnit.Meter).FirstOrDefault();

            if (feature != null)
            {
                return(Json(feature));
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #16
0
        /// <summary>
        /// Handles the Loaded event of the Map1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer lineLayer = new ShapefileLayer("SampleData/streets-900913.shp");

            lineLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#55FAB04D"), 1));
            Map1.AddStaticLayers("LineOverlay", lineLayer);

            GeoBound bound = lineLayer.GetBound();

            bound.ScaleDown(90);
            Map1.ZoomTo(bound);
        }
コード例 #17
0
        private void Refresh()
        {
            ShapefileLayer pointLayer = Map1.FindLayer <ShapefileLayer>("cities-900913");

            if (pointLayer == null)
            {
                return;
            }
            HeatStyle heatStyle = (HeatStyle)pointLayer.Styles[0];

            heatStyle.Radius           = (2 - HeatPointSizeComboBox.SelectedIndex) * 30 + 20;
            heatStyle.ColorPaletteType = colorPaletteType;

            Map1.Refresh(RefreshType.Redraw);
        }
コード例 #18
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer shapefileLayer = new ShapefileLayer("SampleData/countries-900913.shp");

            shapefileLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White));

            LayerOverlay layerOverlay = new LayerOverlay();

            layerOverlay.Layers.Add(shapefileLayer);
            Map1.Overlays.Add(layerOverlay);

            Map1.ZoomToFullBound();
        }
コード例 #19
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ShapefileLayer        sectionLayer   = Map1.FindLayer <ShapefileLayer>("sections-900913");
            MemoryLayer           highlightLayer = Map1.FindLayer <MemoryLayer>("HighlightLayer");
            MemoryLayer           queryAreaLayer = Map1.FindLayer <MemoryLayer>("QueryAreaLayer");
            Geometry              queryArea      = queryAreaLayer.Features.First().Geometry;
            IEnumerable <Feature> resultFeatures = sectionLayer.Source.SpatialQuery(queryArea, (SpatialQueryMode)QueryOptionComboBox.SelectedValue);

            highlightLayer.Features.Clear();
            foreach (var feature in resultFeatures)
            {
                highlightLayer.Features.Add(feature);
            }

            Map1.Refresh("HighlightOverlay");
        }
コード例 #20
0
        public IHttpActionResult GetMap(int z, int x, int y)
        {
            ShapefileLayer layer = new ShapefileLayer(HttpContext.Current.Server.MapPath("~/App_Data/world-bound-900913.shp"));

            layer.Styles.Add(new FillStyle(GeoColor.FromHtml("#AAFFDF3E"), GeoColors.White));

            ShapefileLayer layer2 = new ShapefileLayer(HttpContext.Current.Server.MapPath("~/App_Data/user_timelines_since_t1_w_coordinates.shp"));

            layer2.Styles.Add(new FillStyle(GeoColor.FromHtml("#AAFFDF3E"), GeoColors.Red));

            MapModel mapModel = new MapModel(GeoUnit.Meter);

            mapModel.Layers.Add(layer);
            mapModel.Layers.Add(layer2);

            return(new XyzTileResult(mapModel, x, y, z));
        }
コード例 #21
0
        /// <summary>
        /// Handles the Loaded event of the Map1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer pointLayer = new ShapefileLayer("SampleData/cities-900913.shp");

            SymbolStyle symbolStyle = new SymbolStyle(SymbolType.Circle, GeoColor.FromHtml("#55FAB04D"), GeoColors.White, 2);

            symbolStyle.SymbolType = (SymbolType)SymbolTypeComboBox.SelectedValue;
            symbolStyle.Size       = (float)SymbolSizeComboBox.SelectedValue;
            symbolStyle.Margin     = 40;
            pointLayer.Styles.Add(symbolStyle);
            Map1.AddStaticLayers("PointOverlay", pointLayer);

            Map1.ZoomTo(pointLayer.GetBound());
        }
コード例 #22
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            dataLayer = new ShapefileLayer("SampleData/countries-900913.shp");
            dataLayer.Open();

            MemoryLayer highlightLayer = new MemoryLayer {
                Name = "HighlightLayer"
            };

            highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White, 4));
            Map1.AddDynamicLayers("HighlightOverlay", highlightLayer);

            Map1.ZoomTo(new GeoBound(2171997.6512, 8356849.2669, 3515687.9933, 11097616.86));
        }
コード例 #23
0
        /// <summary>
        /// Handles the Loaded event of the Map1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer pointLayer = new ShapefileLayer("SampleData/cities-900913.shp");

            MapKit.Symbologies.FontStyle fontStyle = new MapKit.Symbologies.FontStyle();
            fontStyle.Brush      = GeoBrushes.Red;
            fontStyle.OutlinePen = new GeoPen(GeoColors.White, 2);
            fontStyle.Margin     = 40;
            pointLayer.Styles.Add(fontStyle);
            Map1.AddStaticLayers("PointOverlay", pointLayer);

            SyncFontStyleSettings(pointLayer);

            Map1.ZoomTo(pointLayer.GetBound());
        }
コード例 #24
0
        public MapGettingStartedCSharp()
        {
            // >> map-gettingstarted-csharp
            var map = new RadMap();

            var shapeFileLayer = new ShapefileLayer()
            {
                Reader = new MapShapeReader()
                {
                    Source = MapSource.FromResource("SDKBrowser.Examples.MapControl.world.shp")
                }
            };

            map.Layers.Add(shapeFileLayer);
            // << map-gettingstarted-csharp

            Content = map;
        }
コード例 #25
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer pointLayer = new ShapefileLayer("SampleData/cities-900913.shp");
            HeatStyle      heatStyle  = new HeatStyle();

            heatStyle.DataColumn       = columnName;
            heatStyle.MaxIntensity     = 37.7;
            heatStyle.MinIntensity     = 30;
            heatStyle.Alpha            = 150;
            heatStyle.Radius           = (2 - HeatPointSizeComboBox.SelectedIndex) * 30 + 20;
            heatStyle.ColorPaletteType = colorPaletteType;
            pointLayer.Styles.Add(heatStyle);
            Map1.AddStaticLayers("PointOverlay", pointLayer);

            Map1.ZoomTo(pointLayer.GetBound());
        }
コード例 #26
0
        /// <summary>
        /// Handles the Loaded event of the Map1 control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileLayer areaLayer = new ShapefileLayer("SampleData/countries-900913.shp");
            var            feature   = areaLayer.Source.GetFeatureById("1", RequireColumnsType.All);

            areaLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White, 1));

            LabelStyle labelStyle = new LabelStyle("CNTRY_NAME", new GeoFont {
                FontSize = 8
            }, GeoColors.Black, GeoColors.White, 2);

            labelStyle.Margin = 100;
            areaLayer.Styles.Add(labelStyle);
            Map1.AddStaticLayers("AreaOverlay", areaLayer);

            Map1.ZoomTo(areaLayer.GetBound());
        }
コード例 #27
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;

            Map1.AddStaticLayers("OpenStreetMap", new OpenStreetMapLayer());
            Map1.AddStaticLayers("StamenMap - Toner", new StamenMapLayer(StamenMapType.Toner));
            Map1.AddStaticLayers("StamenMap - Watercolor", new StamenMapLayer(StamenMapType.Watercolor));

            ShapefileLayer countriesLayer = new ShapefileLayer("SampleData/countries-900913.shp");

            countriesLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#FAB04D"), GeoColors.White));
            Map1.AddStaticLayers("Countries", countriesLayer);

            Map1.Overlays.Skip(1).ForEach(o => o.IsVisible = false);
            Map1.ZoomToFullBound();

            List <OverlayViewModel> viewModel = new List <OverlayViewModel>();

            viewModel.AddRange(Map1.Overlays.Select(o => new OverlayViewModel(o)));
            OverlayListGrid.DataContext = viewModel;
        }
コード例 #28
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            dataLayer = new ShapefileLayer("SampleData/sections-900913.shp");
            dataLayer.Styles.Add(new FillStyle(GeoColors.Transparent, GeoColor.FromHtml("#99FAB04D"), 1));
            Map1.AddStaticLayers(dataLayer);

            MemoryLayer highlightLayer = new MemoryLayer {
                Name = "HighlightLayer"
            };

            highlightLayer.Columns.Add(new FeatureColumn("Area", UnifiedColumnType.Text));
            highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#66FFFF00"), GeoColors.White));

            LabelStyle areaLabelStyle = new LabelStyle("Area", new GeoFont(), GeoColor.FromHtml("#111111"), GeoColors.White);

            highlightLayer.Styles.Add(areaLabelStyle);
            Map1.AddDynamicLayers("HighlightOverlay", highlightLayer);

            Map1.ZoomTo(new GeoBound(-10111509.577, 4582117.8006, -10099064.6735, 4598828.7496));
        }
コード例 #29
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            dataLayer = new ShapefileLayer("SampleData/streets-900913.shp");
            dataLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#55FAB04D"), 4));
            Map1.AddStaticLayers(dataLayer);

            MemoryLayer highlightLayer = new MemoryLayer {
                Name = "HighlightLayer"
            };

            highlightLayer.Columns.Add(new FeatureColumn("Distance", UnifiedColumnType.Text));
            highlightLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#8800BCD4"), 8));

            LabelStyle distanceLabelStyle = new LabelStyle("Distance", new GeoFont(), GeoColor.FromHtml("#111111"), GeoColors.White);

            distanceLabelStyle.LineSegmentRatio = 100;
            highlightLayer.Styles.Add(distanceLabelStyle);
            Map1.AddDynamicLayers("HighlightOverlay", highlightLayer);

            Map1.ZoomTo(new GeoBound(-10880446.205, 3540612.6137, -10879623.9531, 3541519.945));
        }
コード例 #30
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            dataLayer = new ShapefileLayer("SampleData/countries-900913.shp");
            dataLayer.Open();

            GeoPen outlinePen = new GeoPen(GeoColor.FromHtml("#00BCD4"), 2)
            {
                DashPattern = new float[] { 4, 4 }
            };

            MemoryLayer highlightLayer = new MemoryLayer {
                Name = "HighlightLayer"
            };

            highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D")));
            highlightLayer.Styles.Add(new LineStyle(outlinePen));
            highlightLayer.Styles.Add(new SymbolStyle(SymbolType.Circle, GeoColor.FromHtml("#99FF5722"), GeoColors.White));
            Map1.AddDynamicLayers("HighlightOverlay", highlightLayer);

            Map1.ZoomTo(new GeoBound(2171997.6512, 8356849.2669, 3515687.9933, 11097616.86));
        }