当前位置: 首页>>代码示例>>C#>>正文


C# MapLayer.Remove方法代码示例

本文整理汇总了C#中MapLayer.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# MapLayer.Remove方法的具体用法?C# MapLayer.Remove怎么用?C# MapLayer.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapLayer的用法示例。


在下文中一共展示了MapLayer.Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: updateLocationMarker

        // we have this function so after user will come back to the main menu, he will see last geolocation, while current one is updating
        private void updateLocationMarker()
        {
            PushpinMapLayer = new MapLayer();
            Map.Layers.Add(PushpinMapLayer);

            positionCoord = (App.Current as App).lastUserLocation;
            if (positionCoord != null)
            {

                Map.Center = positionCoord;

                Map.ZoomLevel = 19;

                if (MyOverlay != null)
                    PushpinMapLayer.Remove(MyOverlay);

                MyOverlay = putOverlayOnMap(positionCoord, MyOverlay);

                PushpinMapLayer.Add(MyOverlay);
            }
        }
开发者ID:vladk1,项目名称:Kaizen,代码行数:22,代码来源:MainPage.xaml.cs

示例2: MapRenderer2WinPhone

        public MapRenderer2WinPhone()
            : base()
        {
            MessagingCenter.Subscribe<IEnumerable<HeritageProperty>>(this, MapRenderer2.MESSAGE_ADD_AND_ZOOM_ON_PINS, (items) =>
            {
                Task.Run(async () =>
                {
                    // just wait to give the control time to render and set it's position
                    await Task.Delay(300);

                    // invoke on main thread
                    Dispatcher.BeginInvoke(() =>
                    {
                        CustomPushPinWithToolTip prevItem = null;
                        List<GeoCoordinate> coords = new List<GeoCoordinate>();
                        var layer = new MapLayer();
                        // loop through all the properties and add them to the list
                        foreach (var item in items)
                        {
                            // create the overlay
                            var overlay = new MapOverlay()
                            {
                                GeoCoordinate = new GeoCoordinate(item.Latitude, item.Longitude),
                                PositionOrigin = new System.Windows.Point(0, 1)
                            };

                            // create th epin
                            var pin = new CustomPushPinWithToolTip(item, overlay);
                            pin.ToolTipTapped = (i) =>
                            {
                                MessagingCenter.Send<Location>(new Location() { Latitude = i.Latitude, Longitude = i.Longitude }, MapRenderer2.MESSAGE_ON_INFO_WINDOW_CLICKED);
                            };
                            pin.MarkerTapped = (p) =>
                            {
                                if (prevItem != null && prevItem != p)
                                    prevItem.HideCallout();
                                prevItem = p;
                                var o = p.ParentOverlay;
                                layer.Remove(o);
                                layer.Add(o);
                                this.NativeMap.Center = p.ParentOverlay.GeoCoordinate;
                            };

                            // set the content for the overlay
                            overlay.Content = pin;

                            // add overlay to layer
                            layer.Add(overlay);
                            
                            // add to the list
                            coords.Add(overlay.GeoCoordinate);
                        }

                        // add to map
                        this.NativeMap.Layers.Add(layer);

                        // zoom in on pins
                        this.NativeMap.SetView(LocationRectangle.CreateBoundingRectangle(coords));
                    });
                });
            });

            MessagingCenter.Subscribe<IEnumerable<HeritageProperty>>(this, MapRenderer2.MESSAGE_ZOOM_ON_PINS, (items) =>
            {
                List<GeoCoordinate> coords = new List<GeoCoordinate>();
               
                // loop through all the properties and add them to the list
                foreach (var item in items)
                    coords.Add(new GeoCoordinate(item.Latitude,item.Longitude));

                // zoom in on pins
                this.NativeMap.SetView(LocationRectangle.CreateBoundingRectangle(coords));
            });
        }
开发者ID:RhysPartlett,项目名称:oakville-heritage-properties,代码行数:74,代码来源:MapRenderer2WinPhone.cs


注:本文中的MapLayer.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。