Beispiel #1
0
        private void Map1_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeoUnit.Meter;
            Map1.UseOpenStreetMapAsBaseMap();

            ShapefileSource dataSource = new ShapefileSource("SampleData/countries-900913.shp");

            dataSource.Open();
            highlightFeature = dataSource.GetFeatureById("1", RequireColumnsType.None);

            GeoBound tempBound = highlightFeature.GetBound();

            tempBound.ScaleDown(20);
            crossLineFeature = new Feature(new GeoLine(tempBound.GetVertices().Skip(1)));

            MemoryLayer highlightLayer = new MemoryLayer();

            highlightLayer.Features.Add(highlightFeature);
            highlightLayer.Features.Add(crossLineFeature);
            highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D")));
            highlightLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#00BCD4"), 4));
            Map1.AddStaticLayers("HighlightOverlay", highlightLayer);

            MemoryLayer resultLayer = new MemoryLayer {
                Name = "ResultLayer"
            };

            resultLayer.Styles.Add(new SymbolStyle(SymbolType.Circle, GeoColor.FromHtml("#99FF5722"), GeoColors.White));
            Map1.AddDynamicLayers("ResultOverlay", resultLayer);

            Map1.ZoomTo(highlightFeature);
        }
Beispiel #2
0
        private void Map1_MapSingleClick(object sender, MapClickEventArgs e)
        {
            Feature identifiedFeature = IdentifyHelper.Identify(dataLayer, e.WorldCoordinate, Map1.CurrentScale, Map1.MapUnit).FirstOrDefault();

            if (identifiedFeature != null)
            {
                MemoryLayer highlightLayer = Map1.FindLayer <MemoryLayer>("HighlightLayer");

                highlightLayer.Features.Clear();
                highlightLayer.Features.Add(identifiedFeature);

                GeoBound identifiedBound = identifiedFeature.GetBound();
                highlightLayer.Features.Add(new Feature(new GeoLine(identifiedBound.GetVertices())));

                GeoPoint identifiedCenter = identifiedBound.GetCentroid();
                highlightLayer.Features.Add(new Feature(identifiedCenter));

                Map1.Refresh("HighlightOverlay");
            }
        }